Contended IO

When the Z80 wishes to access an IO port, it places the port address on the data bus exactly as it does when accessing memory. On the 48K Spectrum, this causes delays to IO as the ULA halts the processor. Two effects can occur here:


 * 1) If the port address has its low bit reset, the ULA halts the processor to supply the result.
 * 2) If the port being accessed is between 0x4000 and 0x7fff, this "looks like" an access to contended memory to the ULA and it again halts the processor.

The combination of these two effects leads to the following pattern:

The "Contention pattern" shows the sequence of (non-)contention which occurs: an entry of "N:x" means that the Z80 simply continues for x tstates, while "C:x" means that the Z80 is halted for the same number of tstates as with a normal contended memory access, before continuing for x tstates.