Basic Z80 Cpu Instructions: Instruction Operands Action

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

BASIC Z80 CPU INSTRUCTIONS

instruction opcode operands action


LD r, r’ 01rrrr’r’r’ r, r’ r’ --> r
LD r, n 00rrr110, nnnnnnnn r, n n --> r
LD r, (HL) 01rrr110 r adr(HL) --> r
LD r, (IX + d) 11011101, 01rrr110, r, d adr(IX+d) --> r
dddddddd
LD (HL), r 01110rrr r r --> adr(HL)
LD (IX + d), r 11011101, 01110rrr, r, d r --> adr(IX+d)
dddddddd
LD (HL), n 00110110, nnnnnnnn n n --> adr(HL)
LD A, (BC) 00001010 - adr(BC) --> A
LD A, (nn) 00111010, nnnnnnnn, nn adr(nn) --> A
nnnnnnnn
LD (BC), A 00000010 - A --> adr(BC)
LD (nn), A 00110010, nn A --> adr(nn)
nnnnnnnn,nnnnnnnn
LD dd, nn 00dd0001, d, nn nn --> dd
nnnnnnnn,nnnnnnnn
LD HL, (nn) 00101010, nnnnnnnn, nn adr(nn) --> L
nnnnnnnn adr(nn+1) --> H
LD dd, (nn) 11101101, 01dd1011, d, nn adr(nn) --> ddl
nnnnnnnn, nnnnnnnn adr(nn+1) --> ddh
LD (nn), HL 00100010, nnnnnnnn, nn L --> adr(nn)
nnnnnnnn H --> adr(nn+1)
LD (nn), dd 11101101, 01dd0011, d, nn ddl --> adr(nn)
nnnnnnnn, nnnnnnnn ddh --> adr(nn+1)
LD SP, HL 11111001 - HL --> SP
PUSH qq 11qq0101 q SP--, qqh --> stack,
SP--, qql --> stack
POP qq 11qq0001 q adr(SP) --> qql, SP++,
adr(SP) --> qqh, SP++
LDI 11101101, 10100000 - adr(HL) --> adr(DE), HL++,
DE++, BC--
CPI 11101101, 10100001 - if(adr(HL) == A): Z=1, HL++,
BC--
SET b, r 11001011, 11bbbrrr b, r set bit b in register r
RES b, r 11001011, 10bbbrrr reset bit b in register r
instruction opcode operands action
SET b, (HL) 11001011, 11bbb110 b set bit b in memory at
adress HL
RES b, (HL) 11001011, 10bbb110 b reset bit b in memory at
adress HL
JP nn 11000011, nnnnnnnn, nn nn --> PC
nnnnnnnn
JR e 00011000, eeeeeeee e PC += e
JP (HL) 11101001 - HL --> PC
JR Z, e 00101000, eeeeeeee e if(Z == 1): PC += e
DJNZ e 00010000, eeeeeeee e B--, if(B != 0): PC += e
IN A, (n) 11011011, nnnnnnnn n adrl = n, adrh = A, data --> A
OUT (n), A 11010011, nnnnnnnn n adrl = n, adrh = A, A --> data
OUT (C), r 11101101, 01rrr001 r adrl = C, adrh = B, r --> data

 r, r’ – registers (A, B, C, D, E, H, L)
 n – byte (unsigned 8-bit value from 0 to 255)
 d, e – displacement bytes (siged 8-bit value from -126 to 129)
 nn – word (unsigned 16-bit value, first byte specifies lower 8 bits, second byte
specifies higer 8 bits, eg. if n1 = 00110011, n2 = 11110000, then nn =
1111000000110011
 dd – register pairs (BC, DE, HL, SP)
 xh – higher 8 bits of 16-bit value; xl – lower 8 bits of 16-bit value
 adr(x) – value at memory adress x. „Y --> adr(x)” means „value of register Y
gets stored to adress x” while „adr(x) --> Y” means „value at adress x gets
stored to register Y”
 qq – register pairs (BC, DE, HL, AF)
 b – one of 8 bits in a byte
 data – data bus
 SP – stack pointer
 PC – program counter
 Z – zero flag

r 000 001 010 011 100 101 110 111


register B C D E H L - A

dd 00 01 10 11 qq 00 01 10 11
pair BC DE HL SP pair BC DE HL AF

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy