Author Topic: How does the IN instruction work on a processor like the Z80...  (Read 1361 times)

0 Members and 1 Guest are viewing this topic.

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2196
If it executed "IN 0x75,A" would it set the address lines to 0x75, data lines as input, and then cycle the "RD" pin?  Would the device being addressed switch its data lines to output and set the value it wanted to output?  Finally then in the next cycle the data would be captured and the "RD" pin would go inactive?
 

Offline Len

  • Frequent Contributor
  • **
  • Posts: 552
  • Country: ca
Re: How does the IN instruction work on a processor like the Z80...
« Reply #1 on: August 02, 2016, 07:11:35 pm »
Yes, basically. There's also an /IORQ line that signals when the CPU is doing a I/O operation.
This is explained in the Z80 User Manual:
http://www.zilog.com/appnotes_download.php?FromPage=DirectLink&dn=UM0080&ft=User%20Manual&f=YUhSMGNEb3ZMM2QzZHk1NmFXeHZaeTVqYjIwdlpHOWpjeTk2T0RBdlZVMHdNRGd3TG5Ca1pnPT0=
DIY Eurorack Synth: https://lenp.net/synth/
 

Offline dnwheeler

  • Regular Contributor
  • *
  • Posts: 86
  • Country: us
Re: How does the IN instruction work on a processor like the Z80...
« Reply #2 on: August 02, 2016, 07:20:06 pm »
That is essentially correct. Also note, the differences between memory accesses and port accesses are that the Z80 pulls the /IOREQ line low for port accesses and /MREQ low for memory accesses, port accesses only use A0-A7, and the Z80 inserts an extra was state for port I/O (to allow time for the target to decode the address).

You really should look at the timing diagrams in the Z80 datasheet to get the complete picture. It should be called "Input or Output Cycles".
 

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2196
Re: How does the IN instruction work on a processor like the Z80...
« Reply #3 on: August 02, 2016, 07:22:09 pm »
Thanks guys - I'll take a look at them!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf