First page Back Continue Last page Overview Graphics
Arithmetic Instructions: Addition
The following instructions add the contents of a register to the value stored at the address given by the operand and store the results back into the register.
- ADDA MEM ;A+MEM->A
- ADDB MEM ;B+MEM->B
- ADDD MEM ;D+(MEM:MEM+1)->D
The following instructions use internal registers.
- ABA ;Add B to A
- ABX, ABY ;Add B to X or Y
ADDA and ADDB are 8-bit. The result of the addition is left in internal register A or B. ADDD is a 16 bit addition. The result is placed in register D. MEM is the operand in memory. This operand can be accessed using immediate, direct, extended or indexed (will be discussed later) addressing modes.
ABA adds A and B and then places the sum in A.
ABX and ABY add register B to either register X or Y. Note that these instructions add the contents of an 8-bit register to a 16-bit register. This instruction treats register B as unsigned (the upper byte added is zero).
Cons1: equ 5
Var1: dc.b 30