Difference between revisions of "ADD"
From GbdevWiki
(→add sp,2comp) |
|||
Line 44: | Line 44: | ||
*H - Set or reset according to operation. | *H - Set or reset according to operation. | ||
*C - Set or reset according to operation. | *C - Set or reset according to operation. | ||
+ | |||
+ | [[Category:Assembly_Opcodes]] |
Revision as of 11:52, 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.