IO and Block Instructions

http://www.asm86.cwc.net/

by Ciaran McCreesh
Created: 14th November 1999
Last Modified: 14th November 1999

IO Instructions

Mnemonic Bytes T-States Description
in a,(n) 2 11 Requests a value from IO port n and stores the given value in a
in r,(c) 2 12 Requests a value from IO port c and stores the given value in r
ini 2 16 Requests a value from IO port (c), stores the given value in (hl), decrements b and increments hl
inir (21*(b-1))+16 16 Requests a value from IO port (c), stores the given value in (hl), decrements b and increments hl. This is repeated until b = 0.
ind 2 16 Requests a value from IO port (c), stores the given value in (hl), decrements b and decrements hl
indr (21*(b-1))+16 16 Requests a value from IO port (c), stores the given value in (hl), decrements b and decrements hl. This is repeated until b = 0.
out (n),a 2 11 Puts the value of a out of IO port n
out (c),r 2 12 Puts the value in r out of IO port (c)
outi
oti
2 16 Puts the value in (hl) out of IO port (c), decrements b and increments hl
Note: Assembly Studio and some versions of TASM tables use oti. The Zilog z80 specification and data sheets use outi.
otir 2 (21*(b-1))+16 Puts the value in (hl) out of IO port (c), decrements b and increments hl. This is repeated until b = 0.
outd
otd
2 16 Puts the value in (hl) out of IO port (c), decrements b and decrements hl
Note: Assembly Studio and some versions of TASM tables use otd. The Zilog z80 specification and data sheets use outd.
otdr 2 (21*(b-1))+16 Puts the value in (hl) out of IO port (c), decrements b and decrements hl. This is repeated until b = 0.

Block Transfer Instructions

Mnemonic Bytes T-States Description
ldi 2 16 Copies the value in (hl) to (de), increments de, increments hl and decrements bc
ldir 2 (21*(bc-1))+16 Copies the value in (hl) to (de), increments de, increments hl and decrements bc. This is repeated until bc = 0.
ldd 2 16 Copies the value in (hl) to (de), decrements de, decrements hl and decrements bc
lddr 2 (21*(bc-1))+16 Copies the value in (hl) to (de), decrements de, decrements hl and decrements bc. This is repeated until bc = 0.
Mnemonic Bytes T-States Description
cpi 2 16 Subtracts (hl) from a and stores the result nowhere, increments hl and decrements bc
cpir 2 (21*(bc-1))+16 Subtracts (hl) from a and stores the result nowhere, increments hl and decrements bc. This is repeated until bc = 0.
cpd 2 16 Subtracts (hl) from a and stores the result nowhere, decrements hl and decrements bc
cpdr 2 (21*(bc-1))+16 Subtracts (hl) from a and stores the result nowhere, decrements hl and decrements bc. This is repeated until bc = 0.