Many modules allow their input/output port address to be set, either with switches or with jumpers.
In some cases, there is a simple choice of two or more fixed addresses. In other cases, the address can be set in binary.
Below we describe modules that use jumpers to set the address in binary.
The table below illustrates some example addresses that are set in binary. In this case, a jumper shunt would be fitted to any jumper position indicated by a ‘1’ in the binary address column.
7654 3210 (bits)
The binary address column includes the bit numbers (0 to 7). The bit numbers represent the following values.
The address is determined by adding the hexadecimal or decimal values from each row where a jumper shunt is fitted. For example, with shunts fitted in bit positions 0 and 7, the device address is decimal 1 + 128, giving a value of 129.
Some devices occupy more than one address. For example, a Z80 SIO module will typically occupy 4 addresses. The recommended address for this device is 0x80 to 0x83 (or decimal 128 to 131, or binary 1000 0000 to 1000 0011). The first address in the occupied range is called the base address, in this case, the base address is 0x80 (or 128 decimal).
A module occupying a range of addresses will use less than 8 jumper positions. In the case of a Z80 SIO occupying 4 addresses, there only needs to be 6 jumper positions to select any possible base address. As the device occupies 4 addresses, bits 0 and 1 are not used. Unused bits are often described with an ‘X’ indicating they can be in either state (1 or 0).
A Z80 SIO with a base address of 0x80 (or binary1000 0000) occupies the binary range 1000 0000 to 1000 0011. Using the ‘X’ notation it can be said that the binary address of the Z80 SIO is 1000 00XX.
Incomplete address decoding
The examples above assume very tight address decoding. This means the device occupies the minimum possible number of input/output port addresses. In hardware terms, this means all 8 address bits are either required by the device or are included in the address decoding circuit.
In order to save complexity and cost some modules do not implement tight address decoding. In these cases, the module might occupy 2, 4, or even more times as many addresses as it strictly needs to.
For example, a Z80 SIO that only includes bits 3 to 7 in its address decoding will use 8 input/output addresses, rather than the necessary 4 addresses. As a result, the SIO will typically appear in the I/O address range from 0x80 to 0x83 and again from 0x84 to 0x87.
The unnecessary address ranges are sometimes called ghost addresses.
Each device usually requires a unique address range. If two devices occupy the same address they might clash and not operate as intended. Incomplete address decoding not only wastes addresses but also increases the chance of address clashes. It is not always obvious if devices have one or more ghost addresses so it is quite easy to set another device to an address that clashes with a ghost address.