Extended Z80 instruction set
Standard and Extended Z80 Instructions
Register and Data manipulation
- LD (LoaD)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=LD r, r' | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=LD r, r' | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
LD r, r' | Register | Register | S | - | - | - | - | - | - | 4 | {{{shortfx}}} |
| cleandesc=LD r,n | status=S | isZ80Instruction=y | admode1=Register | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=LD r,n | status=S | isZ80Instruction=y | admode1=Register | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} |
LD r,n | Register | Immediate | S | - | - | - | - | - | - | 7 | {{{shortfx}}} |
| cleandesc=LD r, (HL) | status=S | isZ80Instruction=y | admode1=Register | admode2=Indirect | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=LD r, (HL) | status=S | isZ80Instruction=y | admode1=Register | admode2=Indirect | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} |
LD r, (HL) | Register | Indirect | S | - | - | - | - | - | - | 7 | {{{shortfx}}} |
| cleandesc=LD r, (IXY+d) | status=S | isZ80Instruction=y | admode1=Register | admode2=Indexed | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=LD r, (IXY+d) | status=S | isZ80Instruction=y | admode1=Register | admode2=Indexed | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} |
LD r, (IXY+d) | Register | Indexed | S | - | - | - | - | - | - | 19 | {{{shortfx}}} |
| cleandesc=LD (HL),r | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (HL),r | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} |
LD (HL),r | Indirect | Register | S | - | - | - | - | - | - | 7 | {{{shortfx}}} |
| cleandesc=LD (IXY+d),r | status=S | isZ80Instruction=y | admode1=Indexed | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (IXY+d),r | status=S | isZ80Instruction=y | admode1=Indexed | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} |
LD (IXY+d),r | Indexed | Register | S | - | - | - | - | - | - | 19 | {{{shortfx}}} |
| cleandesc=LD (HL), n | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (HL), n | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} |
LD (HL), n | Indirect | Immediate | S | - | - | - | - | - | - | 10 | {{{shortfx}}} |
| cleandesc=LD (IXY+d), n | status=S | isZ80Instruction=y | admode1=Indexed | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (IXY+d), n | status=S | isZ80Instruction=y | admode1=Indexed | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} |
LD (IXY+d), n | Indexed | Immediate | S | - | - | - | - | - | - | 19 | {{{shortfx}}} |
| cleandesc=LD A, (BC/DE) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=LD A, (BC/DE) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} |
LD A, (BC/DE) | Accumulator | Indirect | S | - | - | - | - | - | - | 7 | {{{shortfx}}} |
| cleandesc=LD A, (nn) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Address | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=13
}} {{#cargo_store: _table = Opcode |
cleandesc=LD A, (nn) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Address | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=13
}} |
LD A, (nn) | Accumulator | Address | S | - | - | - | - | - | - | 13 | {{{shortfx}}} |
| cleandesc=LD (BC/DE), A | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (BC/DE), A | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=7
}} |
LD (BC/DE), A | Indirect | Accumulator | S | - | - | - | - | - | - | 7 | {{{shortfx}}} |
| cleandesc=LD (nn), A | status=S | isZ80Instruction=y | admode1=Address | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=13
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (nn), A | status=S | isZ80Instruction=y | admode1=Address | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=13
}} |
LD (nn), A | Address | Accumulator | S | - | - | - | - | - | - | 13 | {{{shortfx}}} |
| cleandesc=LD A, I | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=- | neffect=0 | pveffect=! | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=9
}} {{#cargo_store: _table = Opcode |
cleandesc=LD A, I | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=- | neffect=0 | pveffect=! | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=9
}} |
LD A, I | Accumulator | Register | S | - | 0 | ! | 0 | S | S | 9 | {{{shortfx}}} |
| cleandesc=LD A, R | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=- | neffect=0 | pveffect=! | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=9
}} {{#cargo_store: _table = Opcode |
cleandesc=LD A, R | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=- | neffect=0 | pveffect=! | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=9
}} |
LD A, R | Accumulator | Register | S | - | 0 | ! | 0 | S | S | 9 | {{{shortfx}}} |
| cleandesc=LD I, A | status=S | isZ80Instruction=y | admode1=Register | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=9
}} {{#cargo_store: _table = Opcode |
cleandesc=LD I, A | status=S | isZ80Instruction=y | admode1=Register | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=9
}} |
LD I, A | Register | Accumulator | S | - | - | - | - | - | - | 9 | {{{shortfx}}} |
| cleandesc=LD R, A | status=S | isZ80Instruction=y | admode1=Register | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=9
}} {{#cargo_store: _table = Opcode |
cleandesc=LD R, A | status=S | isZ80Instruction=y | admode1=Register | admode2=Accumulator | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=9
}} |
LD R, A | Register | Accumulator | S | - | - | - | - | - | - | 9 | {{{shortfx}}} |
| cleandesc=LD BC/DE/HL/SP, nn | status=S | isZ80Instruction=y | admode1=Register | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} {{#cargo_store: _table = Opcode |
cleandesc=LD BC/DE/HL/SP, nn | status=S | isZ80Instruction=y | admode1=Register | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} |
LD BC/DE/HL/SP, nn | Register | Immediate | S | - | - | - | - | - | - | 10 | {{{shortfx}}} |
| cleandesc=LD IXY, nn | status=S | isZ80Instruction=y | admode1=Register | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=14
}} {{#cargo_store: _table = Opcode |
cleandesc=LD IXY, nn | status=S | isZ80Instruction=y | admode1=Register | admode2=Immediate | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=14
}} |
LD IXY, nn | Register | Immediate | S | - | - | - | - | - | - | 14 | {{{shortfx}}} |
| cleandesc=LD HL, (nn) | status=S | isZ80Instruction=y | admode1=Register | admode2=Address | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=LD HL, (nn) | status=S | isZ80Instruction=y | admode1=Register | admode2=Address | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=16
}} |
LD HL, (nn) | Register | Address | S | - | - | - | - | - | - | 16 | {{{shortfx}}} |
| cleandesc=LD BC/DE/SP/IXY, (nn) | status=S | isZ80Instruction=y | admode1=Register | admode2=Address | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=20
}} {{#cargo_store: _table = Opcode |
cleandesc=LD BC/DE/SP/IXY, (nn) | status=S | isZ80Instruction=y | admode1=Register | admode2=Address | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=20
}} |
LD BC/DE/SP/IXY, (nn) | Register | Address | S | - | - | - | - | - | - | 20 | {{{shortfx}}} |
| cleandesc=LD (nn), HL | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (nn), HL | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=16
}} |
LD (nn), HL | Address | Register | S | - | - | - | - | - | - | 16 | {{{shortfx}}} |
| cleandesc=LD (nn), HL | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (nn), HL | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=16
}} |
LD (nn), HL | Address | Register | S | - | - | - | - | - | - | 16 | {{{shortfx}}} |
| cleandesc=LD (nn), BC/DE/SP/IXY | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=20
}} {{#cargo_store: _table = Opcode |
cleandesc=LD (nn), BC/DE/SP/IXY | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=20
}} |
LD (nn), BC/DE/SP/IXY | Address | Register | S | - | - | - | - | - | - | 20 | {{{shortfx}}} |
| cleandesc=LD SP, HL | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=6
}} {{#cargo_store: _table = Opcode |
cleandesc=LD SP, HL | status=S | isZ80Instruction=y | admode1=Address | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=6
}} |
LD SP, HL | Address | Register | S | - | - | - | - | - | - | 6 | {{{shortfx}}} |
| cleandesc=LD SP, IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} {{#cargo_store: _table = Opcode |
cleandesc=LD SP, IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} |
LD SP, IXY | Register | Register | S | - | - | - | - | - | - | 10 | {{{shortfx}}} |
- The basic data load/transfer instruction. Transfers data from the location specified by the second argument, to the location specified by the first. Available combinations are as follows:
- Any 8-bit register can be:
- loaded with an immediate value;
- loaded with the contents of any other 8-bit register except I and R;
- loaded with the contents of, or stored in, memory pointed to by HL;
- loaded with the contents of, or stored in, memory offset-indexed by IX or IY.
- Additionally, the accumulator A (only) can be:
- loaded with the contents of, or stored in, memory pointed to by BC or DE;
- loaded with the contents of, or stored in, memory pointed to by an immediate address;
- loaded with the contents of I or R.
- Any 16-bit register pair can be:
- loaded with an immediate value;
- loaded with the contents of, or stored in, memory pointed to by an immediate address.
- Additionally, SP (only) can be:
- loaded with the contents of HL, IX, or IY.
- Memory referred to by HL or through IX can be assigned immediate values.
- Any 8-bit register can be:
- Although 16-bit register pairs cannot be directly moved between each other, they can be moved by moving the two 8-bit registers. (SP gets a special case because it can't be addressed via 8-bit registers.) Some assemblers will provide built-in macro instructions allowing, for example, ld bc, de.
- LD instructions do not alter any flags unless I or R are loaded into A.
- EX (EXchange)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=EX DE, HL | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=EX DE, HL | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
EX DE, HL | Register | Register | S | - | - | - | - | - | - | 4 | {{{shortfx}}} |
| cleandesc=EX AF, AF' | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=! | neffect=! | pveffect=! | heffect=! | zeffect=! | seffect=! | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=EX AF, AF' | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=! | neffect=! | pveffect=! | heffect=! | zeffect=! | seffect=! | shortfx= | tstates=4
}} |
EX AF, AF' | Register | Register | S | ! | ! | ! | ! | ! | ! | 4 | {{{shortfx}}} |
| cleandesc=EX (SP), HL | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=EX (SP), HL | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=19
}} |
EX (SP), HL | Indirect | Register | S | - | - | - | - | - | - | 19 | {{{shortfx}}} |
| cleandesc=EX (SP), IXY | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=EX (SP), IXY | status=S | isZ80Instruction=y | admode1=Indirect | admode2=Register | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=23
}} |
EX (SP), IXY | Indirect | Register | S | - | - | - | - | - | - | 23 | {{{shortfx}}} |
- Exchanges the contents of two sources. The only permitted combinations are
- Exchanging DE and HL;
- Exchanging AF and AF';
- Exchanging HL, IX, or IY with the contents of memory pointed to by SP.
- Has no effect on flags (unless AF is exchanged, of course)
- EXX (EXchange all)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=EXX | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=EXX | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
EXX | - | - | S | - | - | - | - | - | - | 4 | {{{shortfx}}} |
- Exchanges BC, DE, and HL with their shadow registers. AF and AF' are not exchanged. Has no effect on flags.
- PUSH
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=PUSH BC/DE/HL/AF | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=11
}} {{#cargo_store: _table = Opcode |
cleandesc=PUSH BC/DE/HL/AF | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=11
}} |
PUSH BC/DE/HL/AF | Register | - | S | - | - | - | - | - | - | 11 | {{{shortfx}}} |
| cleandesc=PUSH IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=PUSH IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=15
}} |
PUSH IXY | Register | - | S | - | - | - | - | - | - | 15 | {{{shortfx}}} |
- Pushes the given argument on the stack. This can be any 16-bit register pair except SP. SP is reduced by 2 and then the argument is written to the new location SP points to.
- POP
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=POP BC/DE/HL/AF | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} {{#cargo_store: _table = Opcode |
cleandesc=POP BC/DE/HL/AF | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} |
POP BC/DE/HL/AF | Register | - | S | - | - | - | - | - | - | 10 | {{{shortfx}}} |
| cleandesc=POP IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=14
}} {{#cargo_store: _table = Opcode |
cleandesc=POP IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=14
}} |
POP IXY | Register | - | S | - | - | - | - | - | - | 14 | {{{shortfx}}} |
- Pops the given argument from the stack. This can be any 16-bit register pair except SP. The current value at SP is copied to the register pair and then SP is raised by 2.
Block Copy
- LDI (LoaD and Increment)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=LDI | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=L | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=LDI | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=L | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=16
}} |
LDI | - | - | S | - | 0 | L | 0 | - | - | 16 | {{{shortfx}}} |
- Copies the byte pointed to by HL to the address pointed to by DE, then adds 1 to DE and HL and subtracts 1 from BC. If BC did not reach 0, P/V is reset, otherwise it is set. H and N are reset.
- LDIR (LoaD and Increment Repeated)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=LDIR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=L | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=21x+16
}} {{#cargo_store: _table = Opcode |
cleandesc=LDIR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=L | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=21x+16
}} |
LDIR | - | - | S | - | 0 | L | 0 | - | - | 21x+16 | {{{shortfx}}} |
- Automatically loops LDI until BC reaches zero. Note that no loop occurs with BC=0. Flag effects are the same as LDI except that P/V will always be set, because BC by definition reaches 0 before this instruction ends.
- LDD (LoaD and Decrement)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=LDD | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=L | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=LDD | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=L | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=16
}} |
LDD | - | - | S | - | 0 | L | 0 | - | - | 16 | {{{shortfx}}} |
- Same as LDI, but subtracts 1 from DE and HL instead of adding.
- LDDR (LoaD and Decrement Repeated)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=LDDR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=0 | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=21
}} {{#cargo_store: _table = Opcode |
cleandesc=LDDR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=0 | pveffect=0 | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=21
}} |
LDDR | - | - | S | - | 0 | 0 | 0 | - | - | 21 | {{{shortfx}}} |
- Same as LDIR but loops LDD instead of LDI.
- LDIX, LDIRX, LDDX, LDDRX
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=LDIX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} {{#cargo_store: _table = Opcode |
cleandesc=LDIX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} |
LDIX | - | - | E | ? | ? | ? | ? | ? | ? | ? | {{{shortfx}}} |
| cleandesc=LDIRX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} {{#cargo_store: _table = Opcode |
cleandesc=LDIRX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} |
LDIRX | - | - | E | ? | ? | ? | ? | ? | ? | ? | {{{shortfx}}} |
| cleandesc=LDDX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} {{#cargo_store: _table = Opcode |
cleandesc=LDDX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} |
LDDX | - | - | E | ? | ? | ? | ? | ? | ? | ? | {{{shortfx}}} |
| cleandesc=LDDRX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} {{#cargo_store: _table = Opcode |
cleandesc=LDDRX | status=E | isZ80Instruction=y | admode1=- | admode2=- | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} |
LDDRX | - | - | E | ? | ? | ? | ? | ? | ? | ? | {{{shortfx}}} |
- Next-only extended opcodes. Behave the same as their non-X equivalents except the byte is not copied if it is equal to A.
Block Search
- CPI (ComPare and Increment)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=CPI | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=CPI | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=16
}} |
CPI | - | - | S | - | 1 | L | S | ! | S | 16 | {{{shortfx}}} |
- Compares the byte pointed to by HL with the contents of A and sets Z if it matches or S if the comparison goes negative. Then adds 1 to HL and subtracts 1 from BC. Sets P/V if BC did not reach 0 or resets it if it did. H is set if a borrow occurred from bit 4 and N is set.
- CPIR (ComPare and Increment Repeated)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=CPIR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=21x+16
}} {{#cargo_store: _table = Opcode |
cleandesc=CPIR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=21x+16
}} |
CPIR | - | - | S | - | 1 | L | S | ! | S | 21x+16 | {{{shortfx}}} |
- Automatically loops CPI until either Z is set (A is found in the byte pointed to by HL) or P/V is reset (BC reached 0). Flag effects are the same as CPI except that one of the two terminating flag conditions will always be true.
- CPD (ComPare and Decrement)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=CPD | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=16
}} {{#cargo_store: _table = Opcode |
cleandesc=CPD | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=16
}} |
CPD | - | - | S | - | 1 | L | S | ! | S | 16 | {{{shortfx}}} |
- Same as CPI, but subtracts 1 from HL instead of adding it.
- CPDR (ComPare and Decrement Repeated)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=CPDR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=21x+16
}} {{#cargo_store: _table = Opcode |
cleandesc=CPDR | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=- | neffect=1 | pveffect=L | heffect=S | zeffect=! | seffect=S | shortfx= | tstates=21x+16
}} |
CPDR | - | - | S | - | 1 | L | S | ! | S | 21x+16 | {{{shortfx}}} |
- Same as CPIR but loops CPD instead of CPI.
Arithmetic
- ADD
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=ADD A, r | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD A, r | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
ADD A, r | Accumulator | Register | S | S | 0 | V | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=ADD A, n | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Immediate | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD A, n | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Immediate | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
ADD A, n | Accumulator | Immediate | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=ADD A, (HL) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD A, (HL) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
ADD A, (HL) | Accumulator | Indirect | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=ADD A, (IXY+d) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indexed | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD A, (IXY+d) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indexed | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
ADD A, (IXY+d) | Accumulator | Indexed | S | S | 0 | V | S | S | S | 19 | {{{shortfx}}} |
| cleandesc=ADD HL, BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=11
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD HL, BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=11
}} |
ADD HL, BC/DE/HL/SP | Register | Register | S | S | 0 | - | ! | - | - | 11 | {{{shortfx}}} |
| cleandesc=ADD IXY, BC/DE/IXY/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD IXY, BC/DE/IXY/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=15
}} |
ADD IXY, BC/DE/IXY/SP | Register | Register | S | S | 0 | - | ! | - | - | 15 | {{{shortfx}}} |
| cleandesc=ADD HL/DE/BC, A | status=E | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} {{#cargo_store: _table = Opcode |
cleandesc=ADD HL/DE/BC, A | status=E | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=? | neffect=? | pveffect=? | heffect=? | zeffect=? | seffect=? | shortfx= | tstates=?
}} |
ADD HL/DE/BC, A | Register | Register | E | ? | ? | ? | ? | ? | ? | ? | {{{shortfx}}} |
- Adds values together. Legal combinations are:
- When adding 8-bit values the first parameter must be A and the second may be:
- The contents of an 8-bit register;
- An immediate value;
- The contents of memory pointed to by HL or by indexing based on IX or IY.
- When adding 16-bit values the first parameter must be HL, IX or IY and the second must be another 16-bit register pair. If the first parameter is IX or IY, the second cannot be HL or the other index register.
- On the Spectrum Next the extended opcodes also allow the first parameter to be HL, DE, or BC and the second to be A.
- When adding 8-bit values the first parameter must be A and the second may be:
- Has standard flag effects for 8-bit adding and limited ones for 16-bit ones. For 16 bit additions, H is set if a carry occurred in bit 11 (ie, a half carry in the high byte)
- ADC (ADd with Carry)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=ADC A, r | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=ADC A, r | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
ADC A, r | Accumulator | Register | S | S | 0 | V | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=ADC A, n | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Immediate | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=ADC A, n | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Immediate | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
ADC A, n | Accumulator | Immediate | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=ADC A, (HL) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=ADC A, (HL) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
ADC A, (HL) | Accumulator | Indirect | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=ADC A, (IXY+d) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indexed | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=ADC A, (IXY+d) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indexed | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
ADC A, (IXY+d) | Accumulator | Indexed | S | S | 0 | V | S | S | S | 19 | {{{shortfx}}} |
| cleandesc=ADC HL, BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=ADC HL, BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=15
}} |
ADC HL, BC/DE/HL/SP | Register | Register | S | S | 0 | - | ! | - | - | 15 | {{{shortfx}}} |
- Adds values together, adding an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of ADC and in 16-bit values the first parameter can only be HL. Flag effects are also the same as ADD.
- SUB
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=SUB r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=SUB r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
SUB r | Register | - | S | S | 0 | V | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=SUB n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=SUB n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
SUB n | Immediate | - | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=SUB (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=SUB (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
SUB (HL) | Indirect | - | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=SUB (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=SUB (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
SUB (IXY+d) | Indexed | - | S | S | 0 | V | S | S | S | 19 | {{{shortfx}}} |
- Subtracts a value from A. Legal combinations are the same as for ADD for 8-bit, except that A does not need to be specified as the first parameter because subtraction can only be done from A. SUB cannot be used for 16-bit numbers. Flag effects are the same as ADD except C and H are set based on borrow, not carry.
- SBC (SuBtract with Carry, er, borrow)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=SBC A, r | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=SBC A, r | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Register | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
SBC A, r | Accumulator | Register | S | S | 0 | V | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=SBC A, n | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Immediate | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=SBC A, n | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Immediate | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
SBC A, n | Accumulator | Immediate | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=SBC A, (HL) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=SBC A, (HL) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indirect | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
SBC A, (HL) | Accumulator | Indirect | S | S | 0 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=SBC A, (IXY+d) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indexed | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=SBC A, (IXY+d) | status=S | isZ80Instruction=y | admode1=Accumulator | admode2=Indexed | ceffect=S | neffect=0 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
SBC A, (IXY+d) | Accumulator | Indexed | S | S | 0 | V | S | S | S | 19 | {{{shortfx}}} |
| cleandesc=SBC HL, BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=SBC HL, BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=Register | ceffect=S | neffect=0 | pveffect=- | heffect=! | zeffect=- | seffect=- | shortfx= | tstates=15
}} |
SBC HL, BC/DE/HL/SP | Register | Register | S | S | 0 | - | ! | - | - | 15 | {{{shortfx}}} |
- Subtracts values, subtracting an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of SBC and in 16-bit values the first parameter can only be HL. Flag effects are the same as SUB.
- AND, OR, XOR
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=AND r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=AND r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
AND r | Register | - | S | 0 | 0 | V | 1 | S | S | 4 | {{{shortfx}}} |
| cleandesc=AND n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=AND n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
AND n | Immediate | - | S | 0 | 0 | V | 1 | S | S | 7 | {{{shortfx}}} |
| cleandesc=AND (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=AND (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
AND (HL) | Indirect | - | S | 0 | 0 | V | 1 | S | S | 7 | {{{shortfx}}} |
| cleandesc=AND (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=AND (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=1 | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
AND (IXY+d) | Indexed | - | S | 0 | 0 | V | 1 | S | S | 19 | {{{shortfx}}} |
| cleandesc=OR r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=OR r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
OR r | Register | - | S | 0 | 0 | V | 0 | S | S | 4 | {{{shortfx}}} |
| cleandesc=OR n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=OR n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
OR n | Immediate | - | S | 0 | 0 | V | 0 | S | S | 7 | {{{shortfx}}} |
| cleandesc=OR (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=OR (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
OR (HL) | Indirect | - | S | 0 | 0 | V | 0 | S | S | 7 | {{{shortfx}}} |
| cleandesc=OR (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=OR (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=0 | neffect=0 | pveffect=V | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
OR (IXY+d) | Indexed | - | S | 0 | 0 | V | 0 | S | S | 19 | {{{shortfx}}} |
| cleandesc=XOR r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=XOR r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
XOR r | Register | - | S | 0 | 0 | P | 0 | S | S | 4 | {{{shortfx}}} |
| cleandesc=XOR n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=XOR n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
XOR n | Immediate | - | S | 0 | 0 | P | 0 | S | S | 7 | {{{shortfx}}} |
| cleandesc=XOR (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=XOR (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
XOR (HL) | Indirect | - | S | 0 | 0 | P | 0 | S | S | 7 | {{{shortfx}}} |
| cleandesc=XOR (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=XOR (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=0 | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
XOR (IXY+d) | Indexed | - | S | 0 | 0 | P | 0 | S | S | 19 | {{{shortfx}}} |
- Performs the appropriate bitwise operator on A. Legal combinations are the same as SUB.
- CP (ComPare)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=CP r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=CP r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
CP r | Register | - | S | S | 1 | V | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=CP n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=CP n | status=S | isZ80Instruction=y | admode1=Immediate | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
CP n | Immediate | - | S | S | 1 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=CP (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} {{#cargo_store: _table = Opcode |
cleandesc=CP (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=7
}} |
CP (HL) | Indirect | - | S | S | 1 | V | S | S | S | 7 | {{{shortfx}}} |
| cleandesc=CP (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} {{#cargo_store: _table = Opcode |
cleandesc=CP (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=S | neffect=1 | pveffect=V | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=19
}} |
CP (IXY+d) | Indexed | - | S | S | 1 | V | S | S | S | 19 | {{{shortfx}}} |
- Sets the flags as if a SUB was performed but does not perform it. Legal combinations are the same as SUB. This is commonly used to set the flags to perform an equality or greater/less test.
- CP is not equivalent to "if" in high level languages. Flag based jumps can follow any instruction that sets the flags, not just CP.
- INC
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=INC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=0 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=INC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=0 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
INC r | Register | - | S | - | 0 | ! | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=INC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=- | neffect=0 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=11
}} {{#cargo_store: _table = Opcode |
cleandesc=INC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=- | neffect=0 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=11
}} |
INC (HL) | Indirect | - | S | - | 0 | ! | S | S | S | 11 | {{{shortfx}}} |
| cleandesc=INC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=- | neffect=0 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=INC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=- | neffect=0 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
INC (IXY+d) | Indexed | - | S | - | 0 | ! | S | S | S | 23 | {{{shortfx}}} |
| cleandesc=INC BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=6
}} {{#cargo_store: _table = Opcode |
cleandesc=INC BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=6
}} |
INC BC/DE/HL/SP | Register | - | S | - | - | - | - | - | - | 6 | {{{shortfx}}} |
| cleandesc=INC IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} {{#cargo_store: _table = Opcode |
cleandesc=INC IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} |
INC IXY | Register | - | S | - | - | - | - | - | - | 10 | {{{shortfx}}} |
- Increments the target by one. The argument can be any 8-bit register, any 16-bit register pair, or the address pointed to by HL or indexed via IX or IY. S is set if result is negative, Z if it is zero, H if a carry occurred from bit 3, and P/V set if the target held $7F. N is reset.
- INC A is faster than ADD 1.
- DEC
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=DEC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=1 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=DEC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=1 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=4
}} |
DEC r | Register | - | S | - | 1 | ! | S | S | S | 4 | {{{shortfx}}} |
| cleandesc=DEC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=- | neffect=1 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=11
}} {{#cargo_store: _table = Opcode |
cleandesc=DEC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=- | neffect=1 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=11
}} |
DEC (HL) | Indirect | - | S | - | 1 | ! | S | S | S | 11 | {{{shortfx}}} |
| cleandesc=DEC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=- | neffect=1 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=DEC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=- | neffect=1 | pveffect=! | heffect=S | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
DEC (IXY+d) | Indexed | - | S | - | 1 | ! | S | S | S | 23 | {{{shortfx}}} |
| cleandesc=DEC BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=6
}} {{#cargo_store: _table = Opcode |
cleandesc=DEC BC/DE/HL/SP | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=6
}} |
DEC BC/DE/HL/SP | Register | - | S | - | - | - | - | - | - | 6 | {{{shortfx}}} |
| cleandesc=DEC IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} {{#cargo_store: _table = Opcode |
cleandesc=DEC IXY | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=- | neffect=- | pveffect=- | heffect=- | zeffect=- | seffect=- | shortfx= | tstates=10
}} |
DEC IXY | Register | - | S | - | - | - | - | - | - | 10 | {{{shortfx}}} |
- Decrements the target by one. Allowed arguments are the same as INC. Flag effects are the same as INC except H refers to borrow, not carry; and P/V is set if the target held $80.
- DEC A is faster than SUB 1.
- RLC (Rotate Left and Copy)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=RLC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=RLC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} |
RLC r | Register | - | S | ! | 0 | P | 0 | S | S | 8 | {{{shortfx}}} |
| cleandesc=RLC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=RLC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} |
RLC (HL) | Indirect | - | S | ! | 0 | P | 0 | S | S | 15 | {{{shortfx}}} |
| cleandesc=RLC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=RLC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
RLC (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | S | 23 | {{{shortfx}}} |
- Rotates the target bitwise left by one position. The MSB is copied to bit 0, and also to Carry. Can be applied to any 8-bit register or to a location in memory pointed to by HL or indexed via IX or IY.
- RL (Rotate Left)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=RL r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=RL r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} |
RL r | Register | - | S | ! | 0 | P | 0 | S | S | 8 | {{{shortfx}}} |
| cleandesc=RL (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=RL (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} |
RL (HL) | Indirect | - | S | ! | 0 | P | 0 | S | S | 15 | {{{shortfx}}} |
| cleandesc=RL (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=RL (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
RL (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | S | 23 | {{{shortfx}}} |
- Same as RLC, except the MSB is copied to Carry only, and the previous contents of Carry are copied to bit 0.
- RRC, RR (Rotate Right and Copy, Rotate Right)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=RRC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=RRC r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} |
RRC r | Register | - | S | ! | 0 | P | 0 | S | S | 8 | {{{shortfx}}} |
| cleandesc=RRC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=RRC (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} |
RRC (HL) | Indirect | - | S | ! | 0 | P | 0 | S | S | 15 | {{{shortfx}}} |
| cleandesc=RRC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=RRC (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
RRC (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | S | 23 | {{{shortfx}}} |
| cleandesc=RR r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=RR r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} |
RR r | Register | - | S | ! | 0 | P | 0 | S | S | 8 | {{{shortfx}}} |
| cleandesc=RR (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=RR (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} |
RR (HL) | Indirect | - | S | ! | 0 | P | 0 | S | S | 15 | {{{shortfx}}} |
| cleandesc=RR (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=RR (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
RR (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | S | 23 | {{{shortfx}}} |
- Same as RLC and RL except they rotate right instead of left.
- SLA (Shift Left Arithmetic)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=SLA r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=SLA r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} |
SLA r | Register | - | S | ! | 0 | P | 0 | S | S | 8 | {{{shortfx}}} |
| cleandesc=SLA (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=SLA (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} |
SLA (HL) | Indirect | - | S | ! | 0 | P | 0 | S | S | 15 | {{{shortfx}}} |
| cleandesc=SLA (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=SLA (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
SLA (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | S | 23 | {{{shortfx}}} |
- Same as RL except bit 0 is set to zero, not the previous contents of Carry.
- SRA (Shift Right Arithmetic?)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=SRA r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=SRA r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=8
}} |
SRA r | Register | - | S | ! | 0 | P | 0 | S | S | 8 | {{{shortfx}}} |
| cleandesc=SRA (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=SRA (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=15
}} |
SRA (HL) | Indirect | - | S | ! | 0 | P | 0 | S | S | 15 | {{{shortfx}}} |
| cleandesc=SRA (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=SRA (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=S | shortfx= | tstates=23
}} |
SRA (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | S | 23 | {{{shortfx}}} |
- Same as RR except the MSB is left unchanged, not replaced with the previous contents of Carry.
- SRL (Shift Right Logical?)
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=SRL r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=0 | shortfx= | tstates=8
}} {{#cargo_store: _table = Opcode |
cleandesc=SRL r | status=S | isZ80Instruction=y | admode1=Register | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=0 | shortfx= | tstates=8
}} |
SRL r | Register | - | S | ! | 0 | P | 0 | S | 0 | 8 | {{{shortfx}}} |
| cleandesc=SRL (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=0 | shortfx= | tstates=15
}} {{#cargo_store: _table = Opcode |
cleandesc=SRL (HL) | status=S | isZ80Instruction=y | admode1=Indirect | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=0 | shortfx= | tstates=15
}} |
SRL (HL) | Indirect | - | S | ! | 0 | P | 0 | S | 0 | 15 | {{{shortfx}}} |
| cleandesc=SRL (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=0 | shortfx= | tstates=23
}} {{#cargo_store: _table = Opcode |
cleandesc=SRL (IXY+d) | status=S | isZ80Instruction=y | admode1=Indexed | admode2=- | ceffect=! | neffect=0 | pveffect=P | heffect=0 | zeffect=S | seffect=0 | shortfx= | tstates=23
}} |
SRL (IXY+d) | Indexed | - | S | ! | 0 | P | 0 | S | 0 | 23 | {{{shortfx}}} |
- Same as SLA except it shifts right instead of left.
- RLCA, RLA, RRCA, RRA
| Mnemonic | Addressing mode 1 | Addressing mode 2 | Status | C | N | PV | H | Z | S | Tstates | shortfx | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cleandesc=RLCA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=RLCA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
RLCA | - | - | S | ! | 0 | - | 0 | - | - | 4 | {{{shortfx}}} |
| cleandesc=RLA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=RLA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
RLA | - | - | S | ! | 0 | - | 0 | - | - | 4 | {{{shortfx}}} |
| cleandesc=RRCA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=RRCA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
RRCA | - | - | S | ! | 0 | - | 0 | - | - | 4 | {{{shortfx}}} |
| cleandesc=RRA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} {{#cargo_store: _table = Opcode |
cleandesc=RRA | status=S | isZ80Instruction=y | admode1=- | admode2=- | ceffect=! | neffect=0 | pveffect=- | heffect=0 | zeffect=- | seffect=- | shortfx= | tstates=4
}} |
RRA | - | - | S | ! | 0 | - | 0 | - | - | 4 | {{{shortfx}}} |
]
Control Flow
Input and Output
|