How CPU's work (was Re: Hi, I'm new...)
cclist at sydex.com
Tue Aug 8 11:25:19 CDT 2006
On 8/8/2006 at 11:11 AM Dave McGuire wrote:
> I like the index registers; I use them with some frequency. The
>alternate register set, though...ugh. It'd be much more useful if the
>designers had provided a way to determine which set is currently in use!
When I (and I'm sure, others did likewise) wrote Z80 code, the alternate
set was used for the highest-priority interrupt, usually the interval timer
(I refuse to call it a clock, but could also be a byte-interrupt data
acquisition routine. There was no possibility of confusion that way--and
one made the best use of the reduced latency.
BTW, if you look at early Intel documentation, the B,C D and E registers
are referred to as "Index registers". A strange twist of the term, isn't
Other than the relative jumps, the enhanced instruction set of the Z80
rarely brought much speed increase by itself. For example, moving a block
of bytes using LDIR isn't really much faster than using a MOV A,M/STAX D
type of loop. On the other hand, the INI and OTI instructions was very
welcome when one had to deal with a peripheral whose I/O port addresses
weren't known in advance. The alternative on the 8080/8085 was
hot-patching code--an impossiblity if one was executing out of ROM--one had
to copy the applicable code into RAM and execute it there. Not a great
feature if the I/O ports in question controlled the bank-switching hardware
and you were trying to do a RAM diagnostic.
I've wondered about something for years, however. Did anyone ever make use
of the fact that an INI or OTI instruction placed the contents of both the
B and C registers on the Z80 address bus? It would seem to be a simple way
of expanding the I/O space to 64K ports.
More information about the cctalk