This is an opcode reference chart for on-calculator programming and/or size optimizations.
Rows are first nibble, columns are second.
Primary
xx80xx (ED)
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | in b,(c) | out (c),b | sbc hl,bc | ld (xx),bc | neg | retn | im 0 | ld i,a | in c,(c) | out (c),c | adc hl,bc | ld bc,(xx) | neg | reti | ld r,a | |
5 | in d,(c) | out (c),d | sbc hl,de | ld (xx),de | neg | retn | im 1 | ld a,i | in e,(c) | out (c),e | adc hl,de | ld de,(xx) | neg | retn | im 2 | ld a,r |
6 | in h,(c) | out (c),h | sbc hl,hl | ld (xx),hl | neg | retn | rrd | in l,(c) | out (c),l | adc hl,hl | ld hl,(xx) | neg | retn | rld | ||
7 | in f,(c) | out (c),0 | sbc hl,sp | ld (xx),sp | neg | retn | in a,(c) | out (c),a | adc hl,sp | ld sp,(xx) | neg | reti | ||||
A | ldi | cpi | ini | outi | ldd | cpd | ind | outd | ||||||||
B | ldir | cpir | inir | otir | lddr | cpdr | indr | otdr |
xxBITxx (CB)
Blank spaces or spaces not listed function like NOP.
xxIXxx (DD)
If the next byte is CB, it will follow xxIXBITxx, described later below. If the next byte is DD, ED, or FD, the current DD (the xxIXxx) will be ignored (functions like NOP).
Functions like the primary table, except each instance of hl is replaced with ix, h with ixh, and l with ixl, except in the case of (hl). (hl) will be replaced by (ix+x), where x is an 8-bit displacement, and all other h and l are unaffected. For example, ld ixh, (ix+x) is not an instruction, but ld h, (ix+x) is.
xxIYxx (FD)
Same as xxIXxx, but instead with IY, IYH, and IYL.
xxIXBITxx (DDCB)
Functions like xxBITxx, but instead applying the bitwise operations to (ix+x), then if the instruction wasn't BIT return the result to the register if it is not (hl). For example, rlc b becomes rlc (ix+x)->b.
xxIYBITxx (FDCB)
Same as xxIXBITxx, but instead with IY, IYH, and IYL.
Additional Information
Most of the instructions have more information here, or click on the instruction.
Source:
Primary, xx80xx, xxBITxx: Xeda Elnara, aka Zeda
xxIXxx, xxIYxx, xxIXBITxx, xxIYBITxx: www.z80.info/decoding.htm