A VIA for the Commodore 64: Revised PCB
Now that all electronic issues are resolved, it’s time to update the PCB for my expansion board that adds a W65C22S Versatile Interface Adapter (VIA) to my Commodore 64. Besides fixing the clock issue uncovered in the last post, there are a couple of other changes I made.
First, the address bus lines are no longer reversed, so all VIA registers appear now where they ought to be. Next, I’ve rearranged the LEDs in a four-by-four pattern, which allows showing small shapes using the board. I’ve also changed the headers that bring out the VIA’s signals. I am now using a shrouded header that allows connecting a ribbon cable. There’s a counterpart I designed that lets me connect these signals to a breadboard.
On the backside of the board is now a diode that connects the IRQ line of the VIA to the C64. The C64’s IRQ line is pulled high with a resistor, and various chips in the C64 can drive it to ground using a wired-or configuration. The VIA I am using (a W65C22S) drives the pin either to 5V or to ground. The diode ensures that when another chip drives it to ground that the VIA does not drive it back up to 5V, causing a short circuit, while still allowing the VIA to drive the line to ground if it wants to signal an interrupt. I have not tested yet if this works, but I have some old code leveraging a VIA for timer interrupts that I can adapt to give it a try.
Does everything work as intended? No, I’ve introduced a small new issue. There is a new jumper to turn the board LEDs off (in case it’s used to connect to a breadboard, for example). To keep the circuit simple, I wired it to only one output-enable pin of each of the 74AHCT244 buffers, assuming that it works similar to the VIA where both enable signals need to be asserted at the same time. A closer look at the datasheet would have told me that each output-enable is for 4 of the 8 outputs of the buffer IC. Hence, the jumper can only turn half of the LEDs off, 4 for each port.
For some of the components I am now using surface-mount technology (SMT) parts instead of through-hole ones. That saves some space but it is also a good soldering challenge. Schottky diodes suitable for the IRQ line were all SMT parts, so there was no way around SMT for that component. I have changed the resistors for the LEDs to SMT ones for the new version of the PCB, and they are on the backside, saving a good amount of room. In addition, the two 74AHCT244 buffers driving the LEDs are SMT versions as is the buffer for the address bus and other input-only signals. The latter buffer moved to the backside as well.
To wrap things up, let’s give the board a test drive with a small BASIC program, all developed and typed in directly on the C64. The code below scrolls the letters “C64” across the 4x4 LED matrix. The scroll direction is vertical since that makes the computations easier. BASIC is slow, and this saves time. You can view the video at the bottom to see it in action.
10 via=56832:t=100
30 ob=via:oa=via+1:db=via+2:da=via+3
40 poke da,255:poke db,255:rem output
60 dim g(20)
70 for i=0 to 19
80 read v
90 g(i)=v
100 next
110 for i=0 to 15
120 poke oa,g(i)+g(i+1)*16
130 poke ob,g(i+2)+g(i+3)*16
140 for d=0 to t:next
150 next
160 goto 110
1000 data 0,0,0,0,15,9,9,0
1010 data 15,5,7,0,12,4,15,0
1020 data 0,0,0,0
Subscribe via RSS