Difference between revisions of "ADD"
From GbdevWiki
(→add a,reg8) |
|||
Line 1: | Line 1: | ||
ADD is an assembly opcode. | ADD is an assembly opcode. | ||
− | = add a,reg8 = | + | == add a,reg8 == |
Adds the contents of an 8-bit register to the contents of accumulator and stores the result in accumulator. | Adds the contents of an 8-bit register to the contents of accumulator and stores the result in accumulator. | ||
Line 20: | Line 20: | ||
*C - Set if carry from bit 7. | *C - Set if carry from bit 7. | ||
− | = add hl,reg16 = | + | == add hl,reg16 == |
Adds the contents of a 16-bit register to the contents of hl and stores the result in hl. | Adds the contents of a 16-bit register to the contents of hl and stores the result in hl. | ||
Line 34: | Line 34: | ||
*C - Set if carry from bit 15. | *C - Set if carry from bit 15. | ||
− | = add sp,2comp = | + | == add sp,2comp == |
Adds an 8-bit 2's complement value to sp and stores the result in sp. | Adds an 8-bit 2's complement value to sp and stores the result in sp. | ||
Revision as of 11:50, 25 February 2008
ADD is an assembly opcode.
add a,reg8
Adds the contents of an 8-bit register to the contents of accumulator and stores the result in accumulator.
- $80: add a,b
- $81: add a,c
- $82: add a,d
- $83: add a,e
- $84: add a,h
- $85: add a,l
- $86: add a,(hl)
- $87: add a,a
- $C6 $XX: add a,$XX
Returns:
- Z - Set if result is zero.
- N - Reset.
- H - Set if carry from bit 3.
- C - Set if carry from bit 7.
add hl,reg16
Adds the contents of a 16-bit register to the contents of hl and stores the result in hl.
- $09: add hl,bc
- $19: add hl,de
- $29: add hl,hl
- $39: add hl,sp
Returns:
- Z - Unaffected.
- N - Reset.
- H - Set if carry from bit 11.
- C - Set if carry from bit 15.
add sp,2comp
Adds an 8-bit 2's complement value to sp and stores the result in sp.
- $E8: add sp,2comp
Returns:
- Z - Reset.
- N - Reset.
- H - Set or reset according to operation.
- C - Set or reset according to operation.