Page 1 of 2
6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 12:14 am
by bluesky6
I spent most of this beautiful Sunday afternoon cloistered indoors and working on bringing up the new 6522 VIA board for the RC2014.

- 6522 board
It is set up as a typical RC2014 board except for the use of the R/W signal on pin 39 of the RC2014 bus. I decided not to use the /WR signal since that is gated on Phi2 and there's usually a pre-Phi2 rising edge setup time for 6800/6500 style peripherals. The 2 connectors for the ports are per Daryl's specs.
In any case, I was looking at the sample code on this site
http://6502.org/source/io/6522timr.htm and found at least a couple of errors in the use of Timer 1:
1. For Timer 1, the value that you compare IFR against is not $20 but $40.
2. Clearing the interrupt flag requires a read from T1CL (per Rockwell specs and my own testing).
Check out my modified test code on GitHub:
https://github.com/ancientcomputing/rc2 ... /6502/6522.
The code's probably a little cryptic but I was running 10ms timeouts on the 6522 timer to drive a software counter. This gave me a 1 second tick (+/- 10ms

)
My next step is to put together an audio output with the same free-running counter.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 1:05 am
by commodorejohn
Ah, spiffy! Is the interrupt line hooked up?
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 3:21 am
by bluesky6
Ah, spiffy! Is the interrupt line hooked up?
Yes it is. That's the next level of testing. I'll need to chain interrupts with the serial console. Fun stuff!!
The board files have been checked into GitHub:
https://github.com/ancientcomputing/rc2 ... 6522_board
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 3:52 am
by commodorejohn
Sweet. Will it work with the 65C22, or just the original? I know there's some difference in the interrupt line on the 65C22, but I'm not an expert on this stuff...
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 4:49 am
by BigDumbDinosaur
Sweet. Will it work with the 65C22, or just the original? I know there's some difference in the interrupt line on the 65C22, but I'm not an expert on this stuff...
I think you meant to ask if it would work with the W65C22S, which has a totem-pole IRQ output. The W65C22N, as well as older versions, such as Rockwell parts, have an open-drain IRQ output.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 4:53 am
by GARTHWILSON
Sweet. Will it work with the 65C22, or just the original? I know there's some difference in the interrupt line on the 65C22, but I'm not an expert on this stuff...
I see BDD answered while I was writing and getting interrupted, but I'll post anyway, with a couple of additional details.
The difference with the IRQ\ output is not in CMOS versus NMOS, but specifically in the W65C22S (with the S on the end). The S version has the totem-pole IRQ\ output. This change was made to improve the low-power, high-speed characteristics of the part. The other 65c22 VIAs have the open-drain IRQ\ output. The W65C22S has other improvements also that generally make it a better choice: stronger output pin drivers (much stronger than the data sheet lets on), bus-hold devices, and the inputs are truly high-impedance, unlike other brands of 65(c)22.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 5:18 am
by commodorejohn
Okay, thanks for the clarification. I don't think I have either on hand at the moment, so I was just curious what I should look for once bluesky6 has this board ready to go.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 1:25 pm
by bluesky6
The RC2014 design only has one interrupt line (other than NMI if you have the Pro motherboard with Enhanced bus).
So the assumption is the use of open collector/drain devices to share and drive that interrupt line. My Rev B & C 16550 board designs use a 74HCT03 open collector gate to convert the 16550 interrupt line to open collector. The original 16550 board didn't and interrupts don't/can't work if another I/O board (6850 or Dr Baker's SIO) is plugged in.
In short, yes: you need the open drain version of the WDC 6522.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 2:25 pm
by commodorejohn
Got it. That's what I figured.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 4:36 pm
by bluesky6
Tested with a WDC 65C22N this morning.
I've also update GitHub with the latest code with interrupt handling (
https://github.com/ancientcomputing/rc2 ... /6502/6522).
The code show how you can chain interrupt handlers: 6522 timer 1 interrupt chains to the serial console interrupt.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 6:29 pm
by GARTHWILSON
You could probably put a Schottky diode in series with the W65C22S's IRQ\ output (with the cathode toward the W65C22S) and meet the requirement. For the other benefits, I would still recommend the S version.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 10:34 pm
by bluesky6
For the other benefits, I would still recommend the S version.
That's funny. It sounds like there's some history/politics behind this endorsement
Since the RC2014 is a hobbyist system, I'd recommend that folks use what they have at hand, especially if they want to recreate the retro vibe of the late 70s/early 80s.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 10:40 pm
by BigDumbDinosaur
For the other benefits, I would still recommend the S version.
That's funny. It sounds like there's some history/politics behind this endorsement
Since the RC2014 is a hobbyist system, I'd recommend that folks use what they have at hand, especially if they want to recreate the retro vibe of the late 70s/early 80s.
I think Garth is referring to the lack of current limiting resistors on the W65C22S outputs, which gives the device much stronger drive.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 10:53 pm
by GARTHWILSON
Yes, there's the drive, and the fact that I got bit once with other CMOS VIAs because I thought the port inputs were high-impedance but they weren't. I needed to be able to pull them down with a high-resistance pull-down resistor so they'd be low unless actively pulled up; but that doesn't work with TTL- or LSTTL-type inputs. This was on Rockwell 65c22 VIAs. Similarly, the W65C22N data sheet says the port pins may take as much as 1.6mA in input mode to pull them down to .4V. That rules out a few things you can do with the W65C22S.
Re: 6522 VIA Board for the RC2014
Posted: Mon Jul 03, 2017 11:07 pm
by bluesky6
The discussion is probably moot at this point because the W65C22N6TPG–14 is no longer available at Mouser. Or at least, it's backordered. On the other hand, there's plenty of the 's' version...
I was in the process of putting up my spare boards on Tindie and writing up a recommendation for 6522 sources when I discovered this.