This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

Load

Load registers, data & memory

Table of Contents

1 - LD (dd), n

Load number into memory
76543210
 
\((HL) \longleftarrow n\)
LD (HL), n
0011011036
n
 
\(( IX + d ) \longleftarrow n\)
LD (IX+d), n
11011101DD
0011011036
d
n
 
\(( IY + d ) \longleftarrow n\)
LD (IY+d), n
11111101FD
0011011036
d
n
Flags Affected
None.
Opcode Matrix
(HL)(IX+d)(IY+d)
n
LD (HL), n
36nn210
LD (IX+d), n
DD36nnnn419
LD (IY+d), n
FD36nnnn419
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Implicit

2 - LD (dd), s

Store register into memory via register
76543210
 
\((BC) \longleftarrow A\)
LD (BC), A
0000001002
 
\((DE) \longleftarrow A\)
LD (DE), A
0001001012
 
\((HL) \longleftarrow r\)
LD (HL), r
01110r
 
\(( IX + d ) \longleftarrow r\)
LD (IX+d), r
11011101DD
01110r
d
 
\(( IY + d ) \longleftarrow r\)
LD (IY+d), r
11111101FD
01110r
d
 
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Flags Affected
None.
Opcode Matrix
ABCDEHL
(HL)
LD (HL), A
7717
LD (HL), B
7017
LD (HL), C
7117
LD (HL), D
7217
LD (HL), E
7317
LD (HL), H
7417
LD (HL), L
7517
(BC)
LD (BC), A
0217






(DE)
LD (DE), A
1217






(IX+d)
LD (IX+d), A
DD77nn319
LD (IX+d), B
DD70nn319
LD (IX+d), C
DD71nn319
LD (IX+d), D
DD72nn319
LD (IX+d), E
DD73nn319
LD (IX+d), H
DD74nn319
LD (IX+d), L
DD75nn319
(IY+d)
LD (IY+d), A
FD77nn319
LD (IY+d), B
FD70nn319
LD (IY+d), C
FD71nn319
LD (IY+d), D
FD72nn319
LD (IY+d), E
FD73nn319
LD (IY+d), H
FD74nn319
LD (IY+d), L
FD75nn319
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Memory

3 - LD (nn), s

Store register into memory via address
76543210
 
\((nn) \longleftarrow A\)
LD (nn), A
0011001032
7nn0
158
 
\((nn+1) \longleftarrow dd_h, (nn) \longleftarrow dd_l\)
LD (nn), dd
11101101ED
01dd0011
7nn0
158
 
\((nn+1) \longleftarrow H, (nn) \longleftarrow L\)
LD (nn), HL
0010001022
7nn0
158
 
\((nn+1) \longleftarrow IX_h, (nn) \longleftarrow IX_l\)
LD (nn), IX
11011101DD
0010001022
7nn0
158
 
\((nn+1) \longleftarrow IY_h, (nn) \longleftarrow IY_l\)
LD (nn), IY
11111101FD
0010001022
7nn0
158
Registers
Valuedd
00BC
01DE
10HL
11SP
Flags Affected
None.
Opcode Matrix
ABCDEHLIXIYSP
(nn)
LD (nn), A
32nnnn313


LD (nn), HL
22nnnn316



(nn)

LD (nn), BC
ED43nnnn420
LD (nn), DE
ED53nnnn420
LD (nn), HL
ED63nnnn420
LD (nn), IX
DD22nnnn420
LD (nn), IY
FD22nnnn420
LD (nn), SP
ED73nnnn420
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Memory

4 - LD A,I and LDA A,R

8-bit register instructions
76543210
 
\(A \longleftarrow I\)
LD A, I
11101101ED
0101011157
 
\(A \longleftarrow R\)
LD A, R
11101101ED
010111115F
Flags Affected
Flags
sz---p/v--
sSet if the source register is negative
zSet if the source register is 0
p/vContains contents of IFF2,
0 if an interrupt occurs during the instruction running
Opcode Matrix
IR
A
LD A, I
ED5729
LD A, R
ED5F29
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Special

5 - LD dd, nn

Load 16-bit number
76543210
 
\(dd \longleftarrow nn\)
LD dd, nn
00dd0001
7nn0
158
 
\(IX \longleftarrow nn\)
LD IX, nn
11011101DD
0010000121
7nn0
158
 
\(IY \longleftarrow nn\)
LD IY, nn
11111101FD
0010000121
7nn0
158
Registers
Valuedd
00BC
01DE
10HL
11SP
Flags Affected
None.
Opcode Matrix
BCDEHLIXIYSP
nn
LD BC, nn
01nnnn310
LD DE, nn
11nnnn310
LD HL, nn
21nnnn310
LD IX, nn
DD21nnnn414
LD IY, nn
FD21nnnn414
LD SP, nn
31nnnn310
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Implicit

6 - LD r, s

8-bit register instructions
76543210
 
\(r \longleftarrow r'\)
LD r, r'
01rr'
 
\(r \longleftarrow n\)
LD r, n
00r110
n
 
\(A \longleftarrow (BC)\)
LD A, (BC)
000010100A
 
\(A \longleftarrow (DE)\)
LD A, (DE)
000110101A
 
\(r \longleftarrow (HL)\)
LD r, (HL)
01r110
 
\(r \longleftarrow (IX+d)\)
LD r, (IX+d)
11011101DD
01r110
d
 
\(r \longleftarrow (IY+d)\)
LD r, (IY+d)
11111101FD
01r110
d
 
\(I \longleftarrow A\)
 
LD I,A
11101101ED
0100011147
 
\(R \longleftarrow A\)
LD R, A
11101101ED
010011114F
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Flags Affected
None.
Opcode Matrix
ABCDEHL(HL)(BC)(DE)(IX+d)(IY+d)n
A
LD A, A
7F14
LD A, B
7814
LD A, C
7914
LD A, D
7A14
LD A, E
7B14
LD A, H
7C14
LD A, L
7D14
LD A, (HL)
7E17
LD A, (BC)
0A17
LD A, (DE)
1A17
LD A, (IX+d)
DD7Enn319
LD A, (IY+d)
FD7Enn319
LD A, n
3Enn27
B
LD B, A
4714
LD B, B
4014
LD B, C
4114
LD B, D
4214
LD B, E
4314
LD B, H
4414
LD B, L
4514
LD B, (HL)
4617


LD B, (IX+d)
DD46nn319
LD B, (IY+d)
FD46nn319
LD B, n
06nn27
C
LD C, A
4F14
LD C, B
4814
LD C, C
4914
LD C, D
4A14
LD C, E
4B14
LD C, H
4C14
LD C, L
4D14
LD C, (HL)
4E17


LD C, (IX+d)
DD4Enn319
LD C, (IY+d)
FD4Enn319
LD C, n
0Enn27
D
LD D, A
5714
LD D, B
5014
LD D, C
5114
LD D, D
5214
LD D, E
5314
LD D, H
5414
LD D, L
5514
LD D, (HL)
5617


LD D, (IX+d)
DD56nn319
LD D, (IY+d)
FD56nn319
LD D, n
16nn27
E
LD E, A
5F14
LD E, B
5814
LD E, C
5914
LD E, D
5A14
LD E, E
5B14
LD E, H
5C14
LD E, L
5D14
LD E, (HL)
5E17


LD E, (IX+d)
DD5Enn319
LD E, (IY+d)
FD5Enn319
LD E, n
1Enn27
H
LD H, A
6714
LD H, B
6014
LD H, C
6114
LD H, D
6214
LD H, E
6314
LD H, H
6414
LD H, L
6514
LD H, (HL)
6617


LD H, (IX+d)
DD66nn319
LD H, (IY+d)
FD66nn319
LD H, n
26nn27
L
LD L, A
6F14
LD L, B
6814
LD L, C
6914
LD L, D
6A14
LD L, E
6B14
LD L, H
6C14
LD L, L
6D14
LD L, (HL)
6E17


LD L, (IX+d)
DD6Enn319
LD L, (IY+d)
FD6Enn319
LD L, n
2Enn27
I
LD I, A
ED4724












R
LD R, A
ED4F24












Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register Memory Implicit Special

7 - LD s, (nn)

Load register from memory
76543210
 
\(A \longleftarrow (nn)\)
LD A, (nn)
001110103A
7nn0
158
 
\(H \longleftarrow (nn+1), L \longleftarrow (nn)\)
LD HL, (nn)
001010102A
7nn0
158
 
\(dd_h \longleftarrow (nn+1), dd_l \longleftarrow (nn)\)
LD dd, (nn)
11101101ED
01dd1011
7nn0
158
 
\(IX_h \longleftarrow (nn+1), IX_l \longleftarrow (nn)\)
LD IX, (nn)
11011101DD
001010102A
7nn0
158
 
\(IY_h \longleftarrow (nn+1), IY_l \longleftarrow (nn)\)
LD IY, (nn)
11111101FD
001010102A
7nn0
158
Registers
Valuedd
00BC
01DE
10HL
11SP
Flags Affected
None.
Opcode Matrix
ABCDEHLIXIYSP
(nn)
LD A, (nn)
3Annnn313


LD HL, (nn)
2Annnn316



(nn)

LD BC, (nn)
ED4Bnnnn420
LD DE, (nn)
ED5Bnnnn420
LD HL, (nn)
ED6Bnnnn420
LD IX, (nn)
DD2Annnn420
LD IY, (nn)
FD2Annnn420
LD SP, (nn)
ED7Bnnnn420
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Memory

8 - LD SP, s

Set Stack Pointer from register
76543210
 
\(SP \longleftarrow HL\)
LD SP,HL
11111001F9
 
\(SP \longleftarrow IX\)
LD SP, IX
11011101DD
11111001F9
 
\(SP \longleftarrow IY\)
LD SP, IY
11111101FD
11111001F9
Flags Affected
None.
Opcode Matrix
HLIXIY
SP
LD SP, HL
F916
LD SP, IX
DDF926
LD SP, IY
FDF926
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register