RetroBrew Computers Forum
Discussion forum for the RetroBrew Computers community.

Home » RBC Forums » General Discussion » Z80 16 bit i/o (Input & Output 16 bit data)
Z80 16 bit i/o [message #8351] Thu, 25 February 2021 06:51 Go to next message
b1ackmai1er is currently offline  b1ackmai1er
Messages: 396
Registered: November 2017
Senior Member
Hello,

I was wondering if the capability of the Z80 to use a 16 bit i/o address can be used output a 16 bit data value, like this?

/forum/index.php?t=getfile&id=1993&private=0
  • Attachment: Z8016BIT.png
    (Size: 17.63KB, Downloaded 689 times)
Re: Z80 16 bit i/o [message #8352 is a reply to message #8351] Thu, 25 February 2021 07:06 Go to previous messageGo to next message
wsm is currently offline  wsm
Messages: 232
Registered: February 2017
Location: AB, Canada
Senior Member
The short answer is YES, although the instruction is actually "OUT (C),A". Since the actions are fully specified, the Z80 and derivatives actually supply a 16-bit I/O address.

This also works on other members of the Z80 family like the Z180 and eZ80. More importantly some of these other processors require A15-A8 = 0 for internal I/O devices and thus added the IN0 and OUT0 instructions. Zilog's ZDS actually accepts the "OUT (BC),r" form.
Re: Z80 16 bit i/o [message #8353 is a reply to message #8352] Thu, 25 February 2021 10:10 Go to previous messageGo to next message
cmacarthur is currently offline  cmacarthur
Messages: 26
Registered: April 2018
Location: Alberta / Montana
Junior Member
YES,
You can check out some of Alan's 16 bit I/O z80 boards for the RC2014,
https://hackaday.io/EtchedPixels

https://hackaday.io/project/168355-rc2014-bus-extender
https://hackaday.io/project/170819-16c552-dual-uart-for-rc20 14

They Work GREAT...
you just load BC with 16 bit I/O port address
then out (C),A or whatever register has data byte in it...

The issue is that once you start using/decoding 16 bit I/O, all programs and boards must be changed to 16 bit...
This includes your OS (CP/M etc)

Alan's boards above get around this by only having 1 8 bit I/O location that uses 16 bit addressing...
He swaps the HIGH and LOW bytes on the board (A0-A7 are now high and A8-A15 are now low)...
This also works great for INI,INDR,INIR,OTDR,OTIR,OUTD,OUTI as the "B" reg is INC or DEC giving you block I/O through one 8bit I/O location...

THX
CM
Re: Z80 16 bit i/o [message #8357 is a reply to message #8353] Fri, 26 February 2021 01:24 Go to previous messageGo to next message
b1ackmai1er is currently offline  b1ackmai1er
Messages: 396
Registered: November 2017
Senior Member
Thank you. I am keen to try this out Smile
Re: Z80 16 bit i/o [message #8358 is a reply to message #8353] Fri, 26 February 2021 07:57 Go to previous messageGo to next message
hperaza is currently offline  hperaza
Messages: 68
Registered: March 2017
Member
cmacarthur wrote on Thu, 25 February 2021 10:10
you just load BC with 16 bit I/O port address
then out (C),A or whatever register has data byte in it...

I think b1ackmai1er meant 16-bit data I/O and not 16-bit addressing of I/O ports. An interesting idea, that according to his diagram works by redirecting the high I/O address byte to the high data byte of the 16-bit I/O device, and leaving the low address byte for the usual 8-bit I/O port addressing. The only limitation is that it will work only for the output operation; input on the Z-80 is still limited to 8-bits.
Re: Z80 16 bit i/o [message #8365 is a reply to message #8358] Mon, 01 March 2021 07:48 Go to previous message
cmacarthur is currently offline  cmacarthur
Messages: 26
Registered: April 2018
Location: Alberta / Montana
Junior Member
Sorry Missed that...
YES
The above diagram works great for Output as the high data byte is in the "B" reg

CM
Previous Topic: Question 1Mbx8 Flash/EEPROM
Next Topic: A new version of the S100Computers Serial IO Board


Current Time: Mon Mar 24 23:14:12 PDT 2025

Total time taken to generate the page: 0.03985 seconds