Instruction set - redcode/Z80 GitHub Wiki

8-bit load group

ld J,K

Description

The contents of any register K are loaded to any other register J.

ld O,P

ld J,BYTE

Description

The 8-bit immediate integer BYTE is loaded to any register J.

ld O,BYTE

ld J,(hl)

ld J,(XY+OFFSET)

ld (hl),K

ld (XY+OFFSET),K

ld (hl),BYTE

ld (XY+OFFSET),BYTE

ld a,(bc)

ld a,(de)

ld a,(WORD)

ld (bc),a

ld (de),a

ld (WORD),a

ld a,i

ld a,r

ld i,a

ld r,a

16-bit load group

ld SS,WORD

ld XY,WORD

ld hl,(WORD)

ld SS,(WORD)

ld XY,(WORD)

ld (WORD),hl

ld (WORD),SS

ld (WORD),XY

ld sp,hl

ld sp,XY

push TT

push XY

pop TT

pop XY

Exchange, block transfer and search groups

ex de,hl

ex af,af'

exx

ex (sp),hl

ex (sp),XY

ldi

ldir

ldd

lddr

cpi

cpir

cpd

cpdr

8-bit arithmetic and logical group

U [a,]K

U [a,]P

U [a,]BYTE

U [a,](hl)

U [a,](XY+OFFSET)

V J

V O

V (hl)

V (XY+OFFSET)

General-purpose arithmetic and CPU control groups

daa

cpl

neg

ccf

scf

nop

halt

di

ei

im 0

im 1

im 2

16-bit arithmetic group

add hl,SS

adc hl,SS

sbc hl,SS

add XY,WW

inc SS

inc XY

dec SS

dec XY

Rotate and shift group

rlca

rla

rrca

rra

G K

G (hl)

G (XY+OFFSET)

G (XY+OFFSET),K

rld

rrd

Bit set, reset and test group

bit N,K

bit N,(hl)

bit N,(XY+OFFSET)

M N,K

M N,(hl)

M N,(XY+OFFSET)

M N,(XY+OFFSET),K

Jump group

jp WORD

jp Z,WORD

jr OFFSET

jr Z,OFFSET

jp (hl)

jp (XY)

djnz OFFSET

Call and return group

call WORD

call Z,WORD

ret

ret Z

reti and retn

rst N

Input and output group

in a,(BYTE)

in J,(c)

in (c)

ini

inir

ind

indr

out (BYTE),a

out (c),J

out (c),0

outi

otir

outd

otdr