I noticed in my other post about starting out with SBCs; viewtopic.php?f=1&t=3513 ... that in the sourcecode you provide on your website for SBC-OS (which is told to be used with TASM I believe?), uses "DEC" opcodes.. yet the simulator you provide to me.. 'barfs' at "DEC" and seemingly wants "DEA". I'm going to have to go with what the 6502 assembler needs, but I want to know...
Which is correct? DEC? or DEA?
DEC vs DEA
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: DEC vs DEA
DEA is an alias for DEC A. Both are correct. I'm not familiar with TASS though.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: DEC vs DEA
TASS supports DEC without an operand to impy the accumulator. The Kowalski simu;ator however does not allow DEC or DEC A. DEA is the only option for DEC accumulator. I should have added that in the comments.
Daryl
Daryl
Please visit my website -> https://sbc.rictor.org/
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: DEC vs DEA
In the official MOS Technology assembly language standard, the syntax for any accumulator instruction is xxx A, where xxx is the instruction—A is an internal assembler symbol that represents in the accumulator. The reasoning has to do with the fact that all implied accumulator instructions, other than those that are register-to-register copies, can also also act on memory. Hence consistency in the assembly language is maintained by always having an operand for accumulator instructions, regardless of addressing mode. So one could write ASL FLAG or ASL A, and the assembler would understand the former to be acting on memory and the latter to be acting on the accumulator.
Many assemblers written by amateurs don't conform to the MOS Technology/WDC language standards for a variety of reasons, often resulting in unnecessary work to fix up source code so it will assemble.
Many assemblers written by amateurs don't conform to the MOS Technology/WDC language standards for a variety of reasons, often resulting in unnecessary work to fix up source code so it will assemble.
Last edited by BigDumbDinosaur on Wed Nov 25, 2015 6:49 am, edited 1 time in total.
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: DEC vs DEA
8BIT wrote:
TASS supports DEC without an operand to impy the accumulator. The Kowalski simu;ator however does not allow DEC or DEC A. DEA is the only option for DEC accumulator. I should have added that in the comments.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: DEC vs DEA
In a way INA & DEA are consistent with register addressing (INX, DEY). We don't write INC X or DEC Y, so it kind of makes sense.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: DEC vs DEA
satpro wrote:
In a way INA & DEA are consistent with register addressing (INX, DEY). We don't write INC X or DEC Y, so it kind of makes sense.
DEC A and INC A weren't part of the original instruction set—they were added in the 65C02. Their syntax follows the pattern of other arithmetic and logical instructions, such as ASL, LSR, etc., all of which are instructions that can act on memory or the accumulator, but not on the index registers. For example, with the 65C02 I can INC memory or the accumulator, which is different than INX or INY, which can only affect a specific register. INC is not register-implied, and thus the assembler has to have a way of determining which opcode to use when it assembles an INC instruction.
As a matter of necessity, any instruction that can act on memory must have an operand. Hence when MOS Technology wrote the assembly language standard 40 years ago, they copied what had been done with the Motorola 6800, the 6502's immediate ancestor, and required that any instruction mnemonic that could reference memory or the accumulator must have an operand. If the operation is on the accumulator then the symbol A acts as the operand. It's quite unambiguous and countless programmers who have known the 6502 assembly language since the processor's inception see it as the proper syntax. It's only the relative newcomers to 6502 machine code who don't seem to understand it.
x86? We ain't got no x86. We don't NEED no stinking x86!
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: DEC vs DEA
BigDumbDinosaur wrote:
... INC is not register-implied, and thus the assembler has to have a way of determining which opcode to use when it assembles an INC instruction ...
Mike B.
[Edit: "site" -> "cite" ... thanks, Jeff!]
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: DEC vs DEA
barrym95838 wrote:
BigDumbDinosaur wrote:
... INC is not register-implied, and thus the assembler has to have a way of determining which opcode to use when it assembles an INC instruction ...
It's possible in an absolute assembler to do what you are describing, as the only thing that can appear in the operand field is a literal address or constant. Hence it can be assumed that an instruction such as DEC or ROL that has no operand must be acting on the accumulator. In an symbolic assembler, however, the operand field may contain a literal address, literal constant, label, symbol or computed value. That's quite a bit different than what goes on in an absolute assembler. So for the sake of consistency, the symbolic assemblers that were published over the years have required the presence of an operand with any mnemonic that operates on either the accumulator or memory. As I early said, the deviation from this started with relative newcomers to the 6502 assembly language, unnecessarily complicating things for those who have been working with the MPU since its inception.
Incidentally, Supermon, Supermon 64, the resident M/L monitor in the Commodore 128 and my Supermon 816 all work as does the absolute assembler in the Apple monitor, as again, the operand can only be a literal address or constant.
x86? We ain't got no x86. We don't NEED no stinking x86!
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: DEC vs DEA
BigDumbDinosaur wrote:
... In an symbolic assembler, however, the operand field may contain a literal address, literal constant, label, symbol or computed value. That's quite a bit different than what goes on in an absolute assembler ...
Mike B.