Jump to content

Zilog Z80 Instruction Set: Difference between revisions

From FoxLabs Wiki
Updated single-byte instructions chart. Not done yet.
m Added link to NOP.
Line 47: Line 47:
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3
|-
|-
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || — || — ||align="left"| NOP ||align="left"| No operation
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || — || — ||align="left"| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align="left" | No operation
|-
|-
| 0 || 0 ||colspan="2"| rr || 0 || 0 || 0 || 1 || n-lo || n-hi ||align="left"| LD rr, nn ||align="left"| rr ← nn
| 0 || 0 ||colspan="2"| rr || 0 || 0 || 0 || 1 || n-lo || n-hi ||align="left"| LD rr, nn ||align="left"| rr ← nn

Revision as of 04:50, 2 June 2026

Instructions by Opcode

Legend
Mnemonic Description
b Identifies a one-bit expression in the range (0 to 7). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.
cc Identifies the status of the Flag Register as any of (NZ, Z, NC, C, PO, PE, P, or M) for the conditional jumps, calls, and return instructions.
d Identifies a one-byte signed integer expression in the range ( -128 to +127).
e Identifies a one-byte signed integer expression in the range (-126 to +129) for relative jump offset from current location.
m Identifies any one of r, (HL), (IX+d) or (IY+d).
n Identifies a one-byte unsigned integer expression in the range (0 to 255).
nn Identifies a two-byte unsigned integer expression in the range (0 to 65535).
pp Identifies any one of the 16-bit registers BC, DE, IX, SP.
qq Identifies any one of the 16-bit registers BC, DE, HL, AF.
r Identifies any one of the 8-bit registers A, B, C, D, E, H, L.
rr Identifies any one of the 16-bit registers BC, DE, IY, SP.
ss Identifies any one of the 16-bit registers BC, DE, HL, SP.
(HL) Identifies the contents of the memory location, whose address is specified by the contents of the register pair HL.
(IX+d) Identifies the contents of the memory location, whose address is specified by the contents of the IX Index Register plus the signed displacement d.
(IY+d) Identifies the contents of the memory location, whose address is specified by the contents of the IY Index Register plus the signed displacement d.

Single-byte Instructions

Opcode Operands Mnemonic Description
7 6 5 4 3 2 1 0 b2 b3
0 0 0 0 0 0 0 0 NOP No operation
0 0 rr 0 0 0 1 n-lo n-hi LD rr, nn rr ← nn
0 0 rr 0 0 1 0 LD (rr), A rr ← A
0 0 ss 0 0 1 1 INC ss ss ← ss + 1
0 0 r 1 0 0 INC r r ← r + 1
0 0 r 1 0 1 DEC r r ← r - 1
0 0 r 1 1 0 n LD r, n r ← n
0 0 0 0 0 1 1 1 RLCA A1-7 ← A0-6; A0 ← Cy ← A7
0 0 0 0 1 0 0 0 EX AF,AF' AF ↔ AF
0 0 rr 1 0 0 1 ADD HL, rr HL ← HL + rr
0 0 rr 1 0 1 0 LD A, (rr) A ← (rr) [BC or DE only]
0 0 rr 1 0 1 1 DEC rr rr ← rr - 1
0 0 0 0 1 1 1 1 RRCA A0-6 ← A1-7; A7 ← Cy ← A0
0 0 0 1 0 0 0 0 d DJNZ d B = B - 1; if B ≠ 0 then PC ← PC + d
0 0 0 1 0 1 1 1 RLA A1-7 ← A0-6; Cy ← A7; A0 ← Cy
0 0 0 1 1 0 0 0 d JR d PC ← PC + d
0 0 0 1 1 1 1 1 RRA A0-6 ← A1-7; Cy ← A0; A7 ← Cy
0 0 1 cc 0 0 0 d JR cc, d If cc0-1 true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)
0 0 1 0 0 0 1 0 n-lo n-hi LD (nn), HL (nn) ← HL
0 0 1 0 0 1 1 1 DAA @
0 0 1 0 1 0 1 0 n-lo n-hi LD HL, (nn) HL ← (nn)
0 0 1 0 1 1 1 1 CPL A ← ¬A

Instructions by Group

8-bit Load Group

16-bit Load Group

Exchange, Block Transfer, Search Group

General Purpose Arithmetic and CPU Control Group

NOP

Operation

Op Code

NOP

0 0 0 0 0 0 0 0 0 00

Operands

None.

Description

The CPU performs no operation during the machine cycle.

M-Cyles T-States 4 MHz E.T.
1 4 1.0

Condition Bits Affected

None.

8-bit Arithmetic Group

Rotate and Shift Group

Bit Set, Reset and Test Group

Jump Group

Call and Return Group

Input and Output Group

16-bit Arithmetic Group