On Thu, Jun 07, 2001 at 08:16:10AM +0200, M. J. Bethlehem wrote:
>
> The Z80 has 65536 I/O addresses, not 256. But just like its bigger
> cousins, the x86 series from Intel, they are not directly accesible. If
> I'm not mistaken you have to use the BC register to access ports above
> 0xff (of course you can also use it for the first 256 ports, but what use
> would that be if there's a smaller and faster opcode for that?).
>
> Thus, it would seem like this:
>
> LD BC, 0x1234
> LD A, 0x56
> OUT [BC], A
For I/O ports, the address bus is used. However in the "standard" way the
Z80 is used (like in the MSX) only the lower 8 bits of the address bus is
used. In reality, when the Z80 executes an "OUT (C),A" the entire BC
register is put on the address bus. With a different hardware design than
the MSX (dunno much about hardware, correct me if I'm wrong) the full 16 bit
could be used, like happens in the Spectrum.
In some situations it could be advantagous. Suppose you use the high 8 bit
for an keyboard row (I think this is what happens on the spectrum), then
you could do something like:
LD BC,0AA9h
LD HL,SCANLINES
INIR
In one go, 10 scanlines are read. Note that the lower 8 bit is still used for
the port, but the higher 8 bit are used for the keyboard row. And B is decreased
every iteration of INIR.
I hope that clears things up,
Sean
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html