[FAQ]
[Frequently Asked Questions] [Resources] [Emulators] [Where Is...?] [File Formats] [Technical Information] [Pinouts] [Acknowledgements]

PERIPHERAL PORTS

This page last updated on 11 Aug 2000

[Z80 Tech Info] [48K Tech Info] [128K Tech Info] [Peripheral Ports]

When an port is read from (with `IN') or written to (with `OUT'), it will activate a number of devices external to the Z80, depending on the port address. In general, devices respond if certain bits in the binary representation port number are set and/or reset, rather than to a specific port number; this is known as `partial decoding'. Whilst this makes the decoding hardware easier to make, it does mean that a considerable amount of congestion has occured in the space available for new peripherals to respond to if they do not wish to clash with any current devices.

The next complication is to do with the Z80's I/O instructions: it is quicker and easier to select the low 8 bits of the port number than it is to select the high 8 bits; this means that, when outputting to peripherals for which the upper 8 bits make no difference, this will often be left unset, and may contain garbage. Thus, the 48K ULA, which responds to all even port addresses, is often referred to as port #FE, rather than the full 16-bit port #FFFE.

Listed below are some of the available peripherals (including those like the ULA, which are in every machine), and the bit fields to which they respond. In the table, `-' means `don't care', `0' means the bit must be reset for the peripheral to respond, and `1' means it must be set.

PeripheralPortDescription
TS2068 display mode---- ---- 1111 1111
48K ULA---- ---- ---- ---048K Tech Info | Port FE
TS2068 ULA---- ---- 1111 1110As 48K ULA
128K AY register11-- ---- ---- --0-128K Tech Info | Sound Chip
128K AY data10-- ---- ---- --0-128K Tech Info | Sound Chip
128K memory01-- ---- ---- --0-128K Tech Info | 128K Memory
+3 FDC data0011 ---- ---- --0-128K Tech Info | Disk Drive
+3 FDC status0010 ---- ---- --0-128K Tech Info | Disk Drive
+3 memory0001 ---- ---- --0-128K Tech Info | +2A/+3 Memory
+3 Centronics0000 ---- ---- --0-
ZX Printer---- ---- ---- -0--
TS2040 / Alphacom 32 printer---- ---- 1111 1011
Interface 1 RS232/network---- ---- ---1 0---48K Tech Info | Port F7
Interface 1 control---- ---- ---0 1---48K Tech Info | Port EF
Interface 1 microdrive---- ---- ---0 0---48K Tech Info | Port E7
TS2068 AY data---- ---- 1111 0110
TS2068 AY register---- ---- 1111 0101
TS2068 horizontal select register---- ---- 1111 0100
Aerco Centronics Interface---- ---- 0111 1111
Kempston joystick---- ---- 000- ----48K Tech Info | Joysticks
JLO status/command---- ---- 1000 1111
JLO track---- ---- 1001 1111
JLO sector---- ---- 1010 1111
JLO data---- ---- 1011 1111
JLO select---- ---- 1011 0111

[Z80 Tech Info] [48K Tech Info] [128K Tech Info] [Peripheral Ports]

-----

This FAQ is maintained by Philip Kendall; distribution is permitted only under the conditions specified in the copyright notice.
Primary site for this FAQ: http://www.ast.cam.ac.uk/~pak/cssfaq/index.html.