add
Adds a value to A, or a register pair to HL, IX or IY.
Used in
- Getting started with the Z80Z80 assembly
- Registers, pairs and the shadow setZ80 assembly
- Bytes and 16-bit pairsZ80 assembly
- The Z80 instruction setZ80 assembly
- The F registerZ80 assembly
- Loops and djnzZ80 assembly
- 8-bit and 16-bit arithmetic, logic and bitsZ80 assembly
- Arrays, strings and ixZ80 assembly
- The stack, push and popZ80 assembly
- call, ret and passing valuesZ80 assembly
SZHP/VNC ●●●●0●
- ● set from the result
- 0 always 0
The rows that do otherwise show their own flags.
Forms
-
Adds
rto A. add a,1 byte · 7 cyclesAdds (HL) to A.
add a,2 bytes · 7 cyclesAdds
nnto A.-
Adds the value pointed to by IX plus
ddto A. -
The value of
rris added to HL. -
The value of
rris added to IX. -
The value of IX is added to IX.
Pseudo-instructions
Other spellings the assembler accepts; each form shows the instruction it becomes.
-
Adds
rto A. -
Adds (HL) to A.
-
Adds
nnto A. -
Adds the value pointed to by IX plus
ddto A.
Undocumented 1 row
Left out of Zilog's manual, but the Z80 runs them, and so does this emulator.
-
Adds
ixh/lto A.
Pseudo-instructions · Undocumented 1 row
Other spellings the assembler accepts; each form shows the instruction it becomes. Left out of Zilog's manual, but the Z80 runs them, and so does this emulator.
-
Adds
ixh/lto A.
Operands
r- An 8-bit register:
a,b,c,d,e,horl. (hl)- The byte in memory at the address stored in
hl. More nn- An 8-bit immediate value,
0to255or-128to127, written as a number, character constant or symbol. More (ix+dd)- The byte in memory at
ix + dd, whereddis a signed displacement from-128to127, for example(ix+5)or(ix-3).(iy+dd)works the same way. More rr- A register pair:
bc,de,hlorsp. ix- The
ixindex register. You can also useiy, with the same instruction size and timing. More ixh/l- The high or low byte of
ix:ixhorixl. Foriy, useiyhoriyl. More
.org 0x8000
ld a, 5
ld hl, 0x9000
ld bc, 0x0234
add hl, bc
halt