There are two ways for data to get into and out of the Z80 CPU (and most other CPUs): the memory and I/O buses.

The memory bus is a 16-bit address bus with 8 data bits, giving 64KB of byte-accessed memory or memory-mapped hardware. It is intended for fast accesses. You access memory using the ld instructions, for example:

 ld a,($0100) ; load register a with contents of memory address $0100
 ld ($c000),a ; load memory address $c000 with the contents of a

It is generally mapped to ROM and RAM, although memory-mapped hardware can be set up to be accessed in the same way.

The I/O bus is an 8-bit address bus with 8 data bits, intended for communication with external devices and more complex hardware. It is intended for slower accesses. You access memory using the in and out instructions, for example:

 in a,($bf)   ; input from port $bf to register a
 out ($be),a  ; output from register a to port $bf

It is generally used for everything but ROM and RAM, such as video hardware, I/O, etc.




Return to top
0.058s