| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Type | Instruction | Byte size | Cycles | Description | Effects coded | Effects explained | |||||||||||||||||||
2 | Arith | adc a,(hl) | 1 | 7 | Adds (hl) and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | *-P*++ | C=excp; N=____; P\V=PRTY; H=excp; Z=desc; S=desc; | C', 'N', 'P/V', 'H', 'Z', 'S' | C: the Carry flag. It is set when the last operation caused a register to step over zero in either direction. | |||||||||||||||
3 | Arith | adc a,* | 2 | 7 | Adds * and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | *0-*-- | C=excp; N=ZERO; P\V=____; H=excp; Z=____; S=____; | - = unaffected + = affected as defined P = detects parity V = detects overflow 1 = set 0 = reset * = exceptional | ||||||||||||||||
4 | Arith | adc a,a | 1 | 4 | Adds a and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | ++-+-- | C=desc; N=desc; P\V=____; H=desc; Z=____; S=____; | |||||||||||||||||
5 | Arith | adc a,b | 1 | 4 | Adds b and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | N: this bit indicates subtraction. | ||||||||||||||||
6 | Arith | adc a,c | 1 | 4 | Adds c and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | +0-0-- | C=desc; N=ZERO; P\V=____; H=ZERO; Z=____; S=____; | P/V: the Parity/Overflow flag, which has different meanings depending on which instruction alters it. When it is Parity, it tells you whether the number of set (1) bits in the register is odd or even. When it means Overflow, it indicates overflowing (leaving the 0...127 or -128...-1 intervals) by being set. Actually, in the case of certain operations the contents of the flip-flop controlling the interrupt also appear here. | ||||||||||||||||
7 | Arith | adc a,d | 1 | 4 | Adds d and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||
8 | Arith | adc a,e | 1 | 4 | Adds e and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||
9 | Arith | adc a,h | 1 | 4 | Adds h and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -1-1-- | C=____; N=ONE ; P\V=____; H=ONE ; Z=____; S=____; | |||||||||||||||||
10 | Arith | adc a,l | 1 | 4 | Adds l and the carry flag to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||
11 | Arith | add a,(hl) | 1 | 7 | Adds (hl) to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||
12 | Arith | add a,* | 2 | 7 | Adds * to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | 10-0-- | C=ONE ; N=ZERO; P\V=____; H=ZERO; Z=____; S=____; | |||||||||||||||||
13 | Arith | add a,a | 1 | 4 | Adds a to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -0P0++ | C=____; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||
14 | Arith | add a,b | 1 | 4 | Adds b to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -0*0-- | C=____; N=ZERO; P\V=excp; H=ZERO; Z=desc; S=desc; | H: the BCD Half Carry flag. It is set when there is a carry transfer from bit 3 to bit 4, and it is used for packed BCD correction. | ||||||||||||||||
15 | Arith | add a,c | 1 | 4 | Adds c to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -1*+++ | C=____; N=ONE ; P\V=excp; H=decs; Z=desc; S=desc; | |||||||||||||||||
16 | Arith | add a,d | 1 | 4 | Adds d to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -1--*- | C=____; N=ONE ; P\V=____; H=____; Z=excp; S=____; | |||||||||||||||||
17 | Arith | add a,e | 1 | 4 | Adds e to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -000-- | C=____; N=ZERO; P\V=ZERO; H=ZERO; Z=desc; S=desc; | Z: the Zero flag, which is set if one of the registers was set to zero during the preceding operation. Note that not all operations resulting in zero alter this flag! | ||||||||||||||||
18 | Arith | add a,h | 1 | 4 | Adds h to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -10+++ | C=____; N=ONE ; P\V=ZERO; H=decs; Z=desc; S=desc; | |||||||||||||||||
19 | Arith | add a,l | 1 | 4 | Adds l to a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | -1--1- | C=____; N=ONE ; P\V=____; H=____; Z=ONE ; S=____; | |||||||||||||||||
20 | Arith | add hl,bc | 1 | 11 | The value of bc is added to hl. | ++-+-- | C=desc; N=desc; P\V=____; H=desc; Z=____; S=____; | -0-1+- | C=____; N=ZERO; P\V=____; H=ONE ; Z=desc; S=____; | |||||||||||||||||
21 | Arith | add hl,de | 1 | 11 | The value of de is added to hl. | ++-+-- | C=desc; N=desc; P\V=____; H=desc; Z=____; S=____; | +0P0++ | C=desc; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | S: the Sign flag, which is set if one of the registers changed its value from non-negative to negative. It is zero in all the other cases. | ||||||||||||||||
22 | Arith | add hl,hl | 1 | 11 | The value of hl is added to hl. | ++-+-- | C=desc; N=desc; P\V=____; H=desc; Z=____; S=____; | |||||||||||||||||||
23 | Arith | daa | 1 | 4 | Adjusts a for BCD addition and subtraction operations. Can be used to convert a value to hex. | *-P*++ | C=excp; N=____; P\V=PRTY; H=excp; Z=desc; S=desc; | |||||||||||||||||||
24 | Arith | dec (hl) | 1 | 11 | Subtracts one from (hl). | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
25 | Arith | dec a | 1 | 4 | Subtracts one from a. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
26 | Arith | dec b | 1 | 4 | Subtracts one from b. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
27 | Arith | dec bc | 1 | 6 | Subtracts one from bc. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
28 | Arith | dec c | 1 | 4 | Subtracts one from c. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
29 | Arith | dec d | 1 | 4 | Subtracts one from d. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
30 | Arith | dec de | 1 | 6 | Subtracts one from de. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
31 | Arith | dec e | 1 | 4 | Subtracts one from e. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
32 | Arith | dec h | 1 | 4 | Subtracts one from h. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
33 | Arith | dec hl | 1 | 6 | Subtracts one from hl. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
34 | Arith | dec l | 1 | 4 | Subtracts one from l. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
35 | Arith | inc (hl) | 1 | 11 | Adds one to (hl). | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
36 | Arith | inc a | 1 | 4 | Adds one to a. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
37 | Arith | inc b | 1 | 4 | Adds one to b. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
38 | Arith | inc bc | 1 | 6 | Adds one to bc. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
39 | Arith | inc c | 1 | 4 | Adds one to c. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
40 | Arith | inc d | 1 | 4 | Adds one to d. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
41 | Arith | inc de | 1 | 6 | Adds one to de. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
42 | Arith | inc e | 1 | 4 | Adds one to e. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
43 | Arith | inc h | 1 | 4 | Adds one to h. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
44 | Arith | inc hl | 1 | 6 | Adds one to hl. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
45 | Arith | inc l | 1 | 4 | Adds one to l. | -+V+++ | C=____; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
46 | Arith | sbc a,(hl) | 1 | 7 | Subtracts (hl) and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
47 | Arith | sbc a,* | 2 | 7 | Subtracts * and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
48 | Arith | sbc a,a | 1 | 4 | Subtracts a and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
49 | Arith | sbc a,b | 1 | 4 | Subtracts b and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
50 | Arith | sbc a,c | 1 | 4 | Subtracts c and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
51 | Arith | sbc a,d | 1 | 4 | Subtracts d and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
52 | Arith | sbc a,e | 1 | 4 | Subtracts e and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
53 | Arith | sbc a,h | 1 | 4 | Subtracts h and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
54 | Arith | sbc a,l | 1 | 4 | Subtracts l and the carry flag from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
55 | Arith | sub (hl) | 1 | 7 | Subtracts (hl) from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
56 | Arith | sub * | 2 | 7 | Subtracts * from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
57 | Arith | sub a | 1 | 4 | Subtracts a from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
58 | Arith | sub b | 1 | 4 | Subtracts b from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
59 | Arith | sub c | 1 | 4 | Subtracts c from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
60 | Arith | sub d | 1 | 4 | Subtracts d from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
61 | Arith | sub e | 1 | 4 | Subtracts e from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
62 | Arith | sub h | 1 | 4 | Subtracts h from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
63 | Arith | sub l | 1 | 4 | Subtracts l from a. | ++V+++ | C=desc; N=desc; P\V=OVFL; H=desc; Z=desc; S=desc; | |||||||||||||||||||
64 | Bits | and (hl) | 1 | 7 | Bitwise AND on a with (hl). | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
65 | Bits | and * | 2 | 7 | Bitwise AND on a with *. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
66 | Bits | and a | 1 | 4 | Bitwise AND on a with a. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
67 | Bits | and b | 1 | 4 | Bitwise AND on a with b. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
68 | Bits | and c | 1 | 4 | Bitwise AND on a with c. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
69 | Bits | and d | 1 | 4 | Bitwise AND on a with d. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
70 | Bits | and e | 1 | 4 | Bitwise AND on a with e. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
71 | Bits | and h | 1 | 4 | Bitwise AND on a with h. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
72 | Bits | and l | 1 | 4 | Bitwise AND on a with l. | 00P1++ | C=ZERO; N=ZERO; P\V=PRTY; H=ONE ; Z=desc; S=desc; | |||||||||||||||||||
73 | Bits | ccf | 1 | 4 | Inverts the carry flag. | *0-*-- | C=excp; N=ZERO; P\V=____; H=excp; Z=____; S=____; | |||||||||||||||||||
74 | Bits | cpl | 1 | 4 | The contents of a are inverted (one's complement). | -1-1-- | C=____; N=ONE ; P\V=____; H=ONE ; Z=____; S=____; | |||||||||||||||||||
75 | Bits | or (hl) | 1 | 7 | Bitwise OR on a with (hl). | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
76 | Bits | or * | 2 | 7 | Bitwise OR on a with *. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
77 | Bits | or a | 1 | 4 | Bitwise OR on a with a. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
78 | Bits | or b | 1 | 4 | Bitwise OR on a with b. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
79 | Bits | or c | 1 | 4 | Bitwise OR on a with c. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
80 | Bits | or d | 1 | 4 | Bitwise OR on a with d. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
81 | Bits | or e | 1 | 4 | Bitwise OR on a with e. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
82 | Bits | or h | 1 | 4 | Bitwise OR on a with h. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
83 | Bits | or l | 1 | 4 | Bitwise OR on a with l. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
84 | Bits | rla | 1 | 4 | The contents of a are rotated left one bit position. The contents of bit 7 are copied to the carry flag and the previous contents of the carry flag are copied to bit 0. | +0-0-- | C=desc; N=ZERO; P\V=____; H=ZERO; Z=____; S=____; | |||||||||||||||||||
85 | Bits | rlca | 1 | 4 | The contents of a are rotated left one bit position. The contents of bit 7 are copied to the carry flag and bit 0. | +0-0-- | C=desc; N=ZERO; P\V=____; H=ZERO; Z=____; S=____; | |||||||||||||||||||
86 | Bits | rra | 1 | 4 | The contents of a are rotated right one bit position. The contents of bit 0 are copied to the carry flag and the previous contents of the carry flag are copied to bit 7. | +0-0-- | C=desc; N=ZERO; P\V=____; H=ZERO; Z=____; S=____; | |||||||||||||||||||
87 | Bits | rrca | 1 | 4 | The contents of a are rotated right one bit position. The contents of bit 0 are copied to the carry flag and bit 7. | +0-0-- | C=desc; N=ZERO; P\V=____; H=ZERO; Z=____; S=____; | |||||||||||||||||||
88 | Bits | xor (hl) | 1 | 7 | Bitwise XOR on a with (hl). | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
89 | Bits | xor * | 2 | 7 | Bitwise XOR on a with *. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
90 | Bits | xor a | 1 | 4 | Bitwise XOR on a with a. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
91 | Bits | xor b | 1 | 4 | Bitwise XOR on a with b. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
92 | Bits | xor c | 1 | 4 | Bitwise XOR on a with c. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
93 | Bits | xor d | 1 | 4 | Bitwise XOR on a with d. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
94 | Bits | xor e | 1 | 4 | Bitwise XOR on a with e. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
95 | Bits | xor h | 1 | 4 | Bitwise XOR on a with h. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
96 | Bits | xor l | 1 | 4 | Bitwise XOR on a with l. | 00P0++ | C=ZERO; N=ZERO; P\V=PRTY; H=ZERO; Z=desc; S=desc; | |||||||||||||||||||
97 | Jump | call ** | 3 | 17 | The current pc value plus three is pushed onto the stack, then is loaded with **. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
98 | Jump | jp (hl) | 1 | 4 | Loads the value of hl into pc. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
99 | Jump | jp ** | 3 | 10 | ** is copied to pc. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; | |||||||||||||||||||
100 | Jump | jr * | 2 | 12 | The signed value * is added to pc. The jump is measured from the start of the instruction opcode. | ------ | C=____; N=____; P\V=____; H=____; Z=____; S=____; |