LD Load instructions

How to decode ld instructions from binary
Opcode format
76543210
 
Set 1
000B010
 
Set 4
00B0001
 
Set 2
001B010
7nn0
158
 
Set 3
00b110
n
 
LD r, r'
01rr'
 
LD r, (HL)
01r110
 
LD SP,HL
11111001
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Bits
ValuebB
000000
100101
201010
301111
4100
5101
6110
7111
Set 1 store a in memory
43Instruction
00 LD (BC),A
1 LD (DE),A
10 LD A,(BC)
1 LD A,(DE)
Set 2 store in memory
54Instruction
00 LD (nn),HL
1 LD (nn),A
10 LD HL,(nn)
1 LD A,(nn)
Set 3 set to constant n
432Instruction
000 LD B,n
1 LD C,n
10 LD D,n
1 LD E,n
100 LD H,n
1 LD L,n
10 LD (HL),n
1 LD A,n
Set 4 set to constant nnn
54Instruction
00 LD BC,nn
1 LD DE,nn
10 LD HL,nn
1 LD SP,nn

Last modified November 12, 2021: Finish LD instructions (c8e297c)