Contended I/O: Difference between revisions

From Sinclair Wiki
Jump to navigation Jump to search
(Add to Z80 category)
(Avoid confusion with Z80 HALT instruction, mention clock-stopping and {{overline|WAIT}} signal)
Line 1: Line 1:
When the [[Z80]] wishes to access an IO port, it places the port address on the address bus exactly as it does when accessing memory. On the 48K and 128K Spectrums, this causes delays to IO as the ULA halts the processor. On the +3 Spectrum, no contention occurs as the +3 ULA applies contention only when the Z80's MREQ line is active, which it is not during an IO operation. Two effects can occur here:
When the [[Z80]] wishes to access an IO port, it places the port address on the address bus exactly as it does when accessing memory. On the 48K and 128K Spectrums, this causes delays to IO as the ULA pauses the processor by stopping its clock, even when the ULA's I/O port is not the one being accessed. On the +3 Spectrum, no contention occurs as the +3 ULA applies contention only when the Z80's {{overline|MREQ}} line is active, which it is not during an IO operation. Two effects can occur here:


# If the port address has its low bit reset, the ULA halts the processor to supply the result.
# If the port address has its low bit reset, the ULA pauses the processor to supply the result using the {{overline|WAIT}} signal.
# 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. Contention is also applied if the port address is between 0xc000 and 0xffff on a 128K Spectrum with a contended RAM bank paged into that address range.<ref>http://www.worldofspectrum.org/forums/showpost.php?p=215386&postcount=88</ref><ref>http://www.worldofspectrum.org/forums/showthread.php?t=18214</ref>
# If the port being accessed is between 0x4000 and 0x7fff, this "looks like" an access to contended memory to the ULA and it again pauses the processor, but by stopping its clock. Contention is also applied if the port address is between 0xc000 and 0xffff on a 128K Spectrum with a contended RAM bank paged into that address range.<ref>http://www.worldofspectrum.org/forums/showpost.php?p=215386&postcount=88</ref><ref>http://www.worldofspectrum.org/forums/showthread.php?t=18214</ref>


The combination of these two effects leads to the following pattern:
The combination of these two effects leads to the following pattern:
Line 29: Line 29:
|}
|}


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.
The "Contention pattern" shows the sequence of (non-)contention which occurs: an entry of "N:x" means that the Z80 simply continues for x T&nbsp;states, while "C:x" means that the Z80 is paused for the same number of T&nbsp;states as with a normal [[contended memory]] access, before continuing for x T&nbsp;states.


== Notes ==
== Notes ==

Revision as of 21:27, 2 June 2015

When the Z80 wishes to access an IO port, it places the port address on the address bus exactly as it does when accessing memory. On the 48K and 128K Spectrums, this causes delays to IO as the ULA pauses the processor by stopping its clock, even when the ULA's I/O port is not the one being accessed. On the +3 Spectrum, no contention occurs as the +3 ULA applies contention only when the Z80's MREQ line is active, which it is not during an IO operation. Two effects can occur here:

  1. If the port address has its low bit reset, the ULA pauses the processor to supply the result using the WAIT signal.
  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 pauses the processor, but by stopping its clock. Contention is also applied if the port address is between 0xc000 and 0xffff on a 128K Spectrum with a contended RAM bank paged into that address range.[1][2]

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

High byte in 0x40 (0xc0) to 0x7f (0xff)? Low bit Contention pattern
No Reset N:1, C:3
No Set N:4
Yes Reset C:1, C:3
Yes Set C:1, C:1, C:1, C:1

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

Notes

Article license information

This article uses material from the "Contended IO" article on the ZX Spectrum technical information wiki at Fandom (formerly Wikia) and is released under the Creative Commons Attribution-Share Alike License.