ld
Load
Copies a value between registers, memory and immediate data, 8 or 16 bits at a time.
- Getting started with the Z80Z80 assembly
- Registers, pairs and the shadow setZ80 assembly
- The 64 KB address spaceZ80 assembly
- org, db, dw and dsZ80 assembly
- Bytes and 16-bit pairsZ80 assembly
- The Z80 instruction setZ80 assembly
- Addressing on the Z80Z80 assembly
- The F registerZ80 assembly
- Memory regions and executable filesZ80 assembly
- jp, jr and the conditionsZ80 assembly
- Changes no flag
The rows that do otherwise show their own flags.
Forms
-
The contents of
r'are loaded intor. -
Loads
nnintor. -
The contents of (HL) are loaded into
r. -
Loads the value pointed to by IX plus
ddintor. -
The contents of
rare loaded into (HL). -
Stores
rto the memory location pointed to by IX plusdd. ld ,2 bytes · 10 cyclesLoads
nninto (HL).-
Stores
nnto the memory location pointed to by IX plusdd. ld a, (bc)1 byte · 7 cyclesLoads the value pointed to by BC into A.
ld a, (de)1 byte · 7 cyclesLoads the value pointed to by DE into A.
ld a, ()3 bytes · 13 cyclesLoads the value pointed to by
nnnninto A.ld (bc), a1 byte · 7 cyclesStores A into the memory location pointed to by BC.
ld (de), a1 byte · 7 cyclesStores A into the memory location pointed to by DE.
ld (), a3 bytes · 13 cyclesStores A into the memory location pointed to by
nnnn.ld a, i2 bytes · 9 cycles S●Z●H0P/V●N0Stores the value of register I into A.
ld a, r2 bytes · 9 cycles S●Z●H0P/V●N0Stores the value of register R into A.
ld i, a2 bytes · 9 cyclesStores the value of A into register I.
ld r, a2 bytes · 9 cyclesStores the value of A into register R.
-
Loads
nnnnintorr. -
Loads
nnnninto register IX. ld hl, ()3 bytes · 16 cyclesLoads the value pointed to by
nnnninto HL.-
Loads the value pointed to by
nnnnintorr. -
Loads the value pointed to by
nnnninto IX. ld (), hl3 bytes · 16 cyclesStores HL into the memory location pointed to by
nnnn.-
Stores
rrinto the memory location pointed to bynnnn. -
Stores IX into the memory location pointed to by
nnnn. ld sp, hl1 byte · 6 cyclesLoads the value of HL into SP.
-
Loads the value of IX into SP.
Pseudo-instructions
Other spellings the assembler accepts; each form shows the instruction it becomes.
-
The contents of
rr'are loaded intorr. -
The contents of (HL) are loaded into BC.
-
The contents of
rrare loaded into (HL).
Undocumented 4 rows
Left out of Zilog's manual, but the Z80 runs them, and so does this emulator.
-
Loads
nnintoixh/l. -
The contents of
ixh/lare loaded intor. -
The contents of
rare loaded intoixh/l. -
The contents of
ixh/l'are loaded intoixh/l.
Operands
r- An 8-bit register:
a,b,c,d,e,horl. The placeholderrstands for an 8-bit register. Inld a, randld r, a, the literalrnames the refresh register. r'- An 8-bit register:
a,b,c,d,e,horl. It may be the same register asr. nn- An 8-bit immediate value,
0to255or-128to127, written as a number, character constant or symbol. More (hl)- The byte in memory at the address stored in
hl. 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 nnnn- A 16-bit value or address,
0to65535, written as a number or label.(nnnn)accesses memory at that address. More rr- A register pair:
bc,de,hlorsp. ix- The
ixindex register. You can also useiy, with the same instruction size and timing. More rr'- A register pair:
bc,deorhl. It may be the same pair asrr. ixh/l- The high or low byte of
ix:ixhorixl. Foriy, useiyhoriyl. More ixh/l'- Choose
ixhorixlagain; the same half may be used twice. If the other operand usesiyhoriyl, choose fromiyhoriylhere too.
.org 0x8000
ld bc, 0x9000
halt