Questions about pia 8021

4 posts / 0 new
Last post
anarkavre's picture
Offline
Last seen: 9 years 8 months ago
Joined: Oct 18 2005 - 11:28
Posts: 59
Questions about pia 8021

I have some questions concerning the pia 8021. I would like to get this correctly emulated in Pom1. Can you write to the control registers during an interrupt? If so then when the flags get set is it whatever writes first that gets the final value? What would happen if you write or read to bits that are set to read or write respectively? What would happen if you write to the DSP register right after you wrote to it with out the check of bit 7 of the DSP register? What if you read the KBD register without checking bit 7 of KBDCR? Do you get the last key pressed again or garbage data? If anyone get explain the bits in the control registers to me that would greatly be appreciated. I don't own an Apple 1 or the replica so I can't test to see what happens. Thank you.

anarkavre's picture
Offline
Last seen: 9 years 8 months ago
Joined: Oct 18 2005 - 11:28
Posts: 59
Oops

I meant 6821

Offline
Last seen: 20 hours 13 min ago
Joined: Jun 5 2008 - 07:26
Posts: 478
I'll see how I can help you.

I'll see how I can help you.

First I have a question for you. Are you really looking for 6821 information - most Apple 1's (but not all) have 6820s in the PIA socket.

>Can you write to the control registers during an interrupt?
Yes

>If so then when the flags get set is it whatever writes first that gets the final value?
I'm not sure exactly what you mean here. When dealing with hardware, think in terms of flip-flops, if two conflicting settings are made at nearly the same time, the last will take effect. If there is a tie, the result will be unpredictable (this is known in the industry as a race condition and usually results in bugs).

>What would happen if you write or read to bits that are set to read or write respectively?
This is covered in the Synertek Sy6820 PIA data sheet. http://www.datasheetarchive.com/Scans/Scans-000/Scans-00179.html
For PORT A, the read operations read directly from the I/O pins, not the port. For PORT B, the read operation reads data from the port register, not the I/O pins. For writing, I would assume that the OUTPUT register is always written, no matter the state of the read/write control bits. You could write the data register, and then flip the controls from read to write and the I/O pins should reflect what you have written.

>What would happen if you write to the DSP register right after you wrote to it with out the check of bit 7 of the DSP register?
I'll check on this, but I think that the first character is never displayed by the terminal logic. This is a WOZ terminal function, not a PIA specific function.

>What if you read the KBD register without checking bit 7 of KBDCR?
You get the last character entered by the keyboard. Again not specific to the PIA, but a keyboard interface function.

I haven't actually double checked any of this with real hardware, but I think the data is accurate.

Regards,
Mike Willegal

Offline
Last seen: 20 hours 13 min ago
Joined: Jun 5 2008 - 07:26
Posts: 478
one minor note on the DSP reg

one minor note on the DSP register comment, there is a possibility that bit 7 may come true between the characters, so that both characters would be displayed. Characters are inserted into the terminal shift register at the curser location at a rate of about 60HZ (frame refresh rate). In other words one character can be inserted every time the screen is refreshed or more specifically every time the cursor is about to be refreshed on the display. This is why the Apple 1 terminal has such a slow output rate.

Log in or register to post comments