Page 1 of 2
Saying Hi/ My build
Posted: Sat Jul 03, 2021 5:02 am
by ThisWayUp
Greetings!
I just recently got into 6502 shenanigans after messing around with Arduinos for a while and realizing that I really wasn't learning how anything, at a hardware or low level, actually worked. I was just finding 'project' pages and throwing components together and copy-pasting code into the IDE. My build currently consists of a WDC 65c02, a 65c22 VIA, an Atmel at28c256 EEPROM, a Renesas 7164 64k SRAM, and a 2 line LCD with a 74HC00N for some glue logic. I don't have any questions right now but I wanted to say 'hello' and thank everyone big and small collectively on this site for all their contributions.
The next step in my project is adding a PS/2 keyboard but I have to wait until after the upcoming holiday period to receive the PS/2 extension cables that I am going to hack up in order to preserve the original cable. As with all milestones in this build I am sure I will immediately fudge something and be here asking questions.

Additionally, I purchased a 65c21 PIA that I have not integrated into the project as of yet, and was planning on using for the keyboard, but I rarely see anyone even mention the chip let alone use it. Can anyone clarify why?
Re: Saying Hi/ My build
Posted: Sat Jul 03, 2021 5:08 am
by Dr Jefyll
Welcome!
As for the 65(c)21, my own preference is to just a 65(c)22 VIA instead. I would hate to miss out on the timers, and other goodies like the shift register!
-- Jeff
Re: Saying Hi/ My build
Posted: Sat Jul 03, 2021 5:24 am
by GARTHWILSON
Welcome.
Be sure to go through the 6502 primer indexed at http://wilsonminesco.com/6502primer/ .
The 65c22 has some major advantages over the '21. A disadvantage the '21 PIA has compared to the '22 VIA is that access to the data-direction registers on the PIA is only indirect, requiring more instructions, making it pretty clumsy to emulate open-drain outputs when needed. The way to to it is to set the output register's bit to a 0 and then change the data direction, so that even in "output" mode, sending a 1 is accomplished by making the pin an input so the external pull-up resistor can bring the line up. (The output register bit is left as 0.) This is valuable for example when bit-banging an I²C or PC-keyboard interface. The 65c22 VIA is much more efficient at this.
Re: Saying Hi/ My build
Posted: Sat Jul 03, 2021 5:51 am
by Dr Jefyll
I have to wait until after the upcoming holiday period to receive the PS/2 extension cables that I am going to hack up in order to preserve the original cable.
Mightn't it be better to obtain a pcb-mount connector which the plug on the original cable can mate with? Just a suggestion. You might be able to scavenge such a connector from a discarded motherboard.
As for using a 6521 or 6522 to emulate open-drain outputs, that's a potentially confusing topic for hardware beginners. But it does have relevance to interfacing with a PC keyboard.
I realize you've already purchased a 65C21. But, time and budget permitting, maybe you should consider buying and incorporating a 65C22 instead.
( To be fair, the pin definitions of the '21 may be attractive in certain rare cases. Compared to the '22, the '21 has 3 chip-select inputs rather than 2, and 2 interrupt outputs rather than 1. But it pays for that by having only 2 register-select inputs rather than 4, which indirectly is the reason why the Data Direction registers are so clumsy to access. And, as already noted, the '22 has more goodies than the '21!)
-- Jeff
Re: Saying Hi/ My build
Posted: Sat Jul 03, 2021 6:27 am
by ThisWayUp
Thanks everyone for the welcomes and the fast replies!
Mightn't it be better to obtain a pcb-mount connector which the plug on the original cable can mate with? Just a suggestion. You might be able to scavenge such a connector from a discarded motherboard.
Well that would make way too much sense, Jeff, that's why!

I probably have an old mobo laying around somewhere, I'll see if I can yank one. Thanks for the suggestion, certainly a more robust solution.
The 65c22 has some major advantages over the '21. A disadvantage the '21 PIA has compared to the '22 VIA is that access to the data-direction registers on the PIA is only indirect, requiring more instructions, making it pretty clumsy to emulate open-drain outputs when needed. The way to to it is to set the output register's bit to a 0 and then change the data direction, so that even in "output" mode, sending a 1 is accomplished by making the pin an input so the external pull-up resistor can bring the line up. (The output register bit is left as 0.) This is valuable for example when bit-banging an I²C or PC-keyboard interface. The 65c22 VIA is much more efficient at this.
I have a nasty habit of becoming obsessed with something and buying everything I think I will need before I know the first thing about any of it. After putting everything together (ram, rom, processor, clock, via, lcd etc) and learning more about how everything interacts it did seem that the VIA and PIA are similar and the VIA was more flexible (hence the V) but I didn't want to jump to that conclusion without consulting people who actually know what they are talking about. Thanks for clarifying. I also have a 65c22N, I replaced it with an S in the current build but perhaps I will use that instead of the PIA. I definitely want to integrate I2C into this project since I have a ridiculous amount of I2C devices from my Arduino days.
Re: Saying Hi/ My build
Posted: Sat Jul 03, 2021 6:39 am
by GARTHWILSON
I definitely want to integrate I2C into this project since I have a ridiculous amount of I2C devices from my Arduino days.
I have VIA bit-bang sample code at http://wilsonminesco.com/6502primer/GENRLI2C.ASM which is part of the 6502 Primer, with sample circuitry in the Primer's "Circuit Potpourri" page.
I encourage use of the very hobbyist-friendly I2C-6 connector for small I²C modules.
Re: Saying Hi/ My build
Posted: Sat Jul 03, 2021 7:20 am
by ThisWayUp
I have poked around the primer and saw the section on I2C and the vast amount of work done to integrate other stuff (spi, rs-232, etc) and explain how to make it work with the 6502 and that was one of the key factors in my decision to pull the trigger on getting into the 6502 world, so kudos

. I will definitely be going over the primer with a fine toothed comb in the coming days. That connector looks perfect, thanks!
And to clarify, yes, I am another person who landed here because of Ben Eater, and my computer is on a breadboard.
While I'm here, I my computer currently is at the stage where it runs the standard 'Hello World' program. It works fine with my 555 timer clock, a 1Mhz can, but will not work with a 10mhz can. Is it possible to run something like this on a breadboard at 10Mhz? I am certaintly planning on migrating to a PCB configuration and I had actually made breakout boards with sockets and headers with the glue logic all wire-wrapped and everything but I couldn't get it to work and got so fed up I threw everything onto the breadboard.
EDIT: Just saw the thread on reliable high speed digital circuits. Time for me to shutup and read.

Re: Saying Hi/ My build
Posted: Sun Jul 04, 2021 12:13 am
by enso
Breadboards are very brittle... I find that I spend more time trying to figure out why the circuit stops working than actually using it. It seems every time I fart a wire comes lose (but not in a visible way). I use them anyway as the easiest way to see if something works, but usually regret it.
Wire wrapping is a pretty good alternative, and you can get started for $30 or so. I find it more enjoyable, and you would have to work hard to create a bad connection. It is also pretty easy to make changes, and very easy to probe and scope your circuit. I've been doing that lately to sketch out my 6502 designs and fine tune them prior to making a PCB.
Having said that, there are people here who've built really fast and large circuits on breadboards. How do they manage? Beats me.
Re: Saying Hi/ My build
Posted: Sun Jul 04, 2021 6:27 am
by BigDumbDinosaur
While I'm here, I my computer currently is at the stage where it runs the standard 'Hello World' program. It works fine with my 555 timer clock, a 1Mhz can, but will not work with a 10mhz can. Is it possible to run something like this on a breadboard at 10Mhz?
With meticulous construction, 10 MHz is possible. Of course, it also depends on the combination of parts you are using. But with breadboards, it is primarily lead length and dress that sets the limit on speed. As the old saying goes, you can get away with murder at 1 MHz. Not so at 10 MHz. Long, curving leads tend to insert a lot of inductance into the circuit, causing potentially intractable timing problems.
It's best to use a breadboard to test a circuit design at a conservative speed. If the circuit is working and you are happy with what it does, the next step is to switch to wire-wrap construction or get a PCB made. A properly-build wire-wrapped unit can easily manage 8+ MHz, and a good PCB layout can go much faster. Garth has a lot of info on wire-wrapping on his site. Be sure to read it.
Re: Saying Hi/ My build
Posted: Sun Jul 04, 2021 11:28 am
by Dr Jefyll
Breadboards are very brittle... I find that I spend more time trying to figure out why the circuit stops working than actually using it. It seems every time I fart a wire comes lose (but not in a visible way).
I guess to some extent that's just the nature of the beast, but it can only get worse if you're dealing with an inferior product. Radical Brad uses breadboards made by Twin Industries.
-- Jeff
Re: Saying Hi/ My build
Posted: Sun Jul 04, 2021 7:36 pm
by ThisWayUp
Breadboards are very brittle... I find that I spend more time trying to figure out why the circuit stops working than actually using it. It seems every time I fart a wire comes lose (but not in a visible way).
I guess to some extent that's just the nature of the beast, but it can only get worse if you're dealing with an inferior product. Radical Brad uses breadboards made by Twin Industries.
-- Jeff
I've certainly learned that not all breadboards are created equal! I had to rip off one of the power rails I was using because it would not supply over 4.7v despite the other 2 rails from different manufacturers working perfectly fine.
Wire wrapping is a pretty good alternative, and you can get started for $30 or so. I find it more enjoyable, and you would have to work hard to create a bad connection. It is also pretty easy to make changes, and very easy to probe and scope your circuit.
I have wire wrap wire coming out of my ears but its all the infamous VT Corporation imitation wire
With meticulous construction, 10 MHz is possible. Of course, it also depends on the combination of parts you are using. But with breadboards, it is primarily lead length and dress that sets the limit on speed. As the old saying goes, you can get away with murder at 1 MHz. Not so at 10 MHz. Long, curving leads tend to insert a lot of inductance into the circuit, causing potentially intractable timing problems.
I haven't dipped my toes into the high frequency pool before this endeavor and I am quickly learning that the tiniest things add up very quickly. I will definitely be going back over the wire wrapping stuff again. I've read so much stuff but every time I go back to the primer or other documents I always pick up something new because my understanding has grown.
Re: Saying Hi/ My build
Posted: Sun Jul 04, 2021 7:56 pm
by enso
Keep in mind that even with a very slow clock, modern logic chips have very fast transition times, effectively dragging your design into the world of very high frequencies and associated hazards.
A slow clock does help, but not the most straightforward way: it gives your crappy, spiky and ringy circuit a chance to settle down to a passable state before the next clock.
Re: Saying Hi/ My build
Posted: Mon Jul 05, 2021 7:59 pm
by ThisWayUp
I found an old PS/2 keyboard a while back and I tried interfacing it with my 65c02. turns out the keyboard is just toast. more specifically, from what I can tell, the IC that controls the keyboard. When powered it doesn't output anything and I tried plugging it into my computer and its just dead. I attached some pics of the board from the keyboard. There's one IC, 2 resistors and 3 capacitors. It seems like it would be pretty easy to build a control board to replace this dead one. Anyone got any experience with this?
EDIT: The top grey ribbon cable connector is for extended 'internet keys' for something like 12 extra buttons. The actual keyboard are the 26 pads on the bottom of the back. And I did check the resistors and caps with my multimeter. One of the resistors was flying all over the place from 3M to 30k (unpowered) but when I removed it from the board it was fine. I replaced it anyway but same problem.
Re: Saying Hi/ My build
Posted: Mon Jul 05, 2021 9:43 pm
by Dr Jefyll
Unless you're enjoying the repair attempt, I suggest you simply get another keyboard. In my experience, they're cheap and easy to find at Goodwill, Salvation Army and other thrift stores as well as yard sales and the like.
-- Jeff
Re: Saying Hi/ My build
Posted: Mon Jul 05, 2021 10:04 pm
by ThisWayUp
Unless you're enjoying the repair attempt, I suggest you simply get another keyboard. In my experience, they're cheap and easy to find at Goodwill, Salvation Army and other thrift stores as well as yard sales and the like.
-- Jeff
My thinking was 'well, ive got the entire mechanism, the only thing that isn't working is this one bit'. But I've spent enough of the last month on the verge of throwing my breadboard sidearm into highway traffic, I'll probably opt for that option.
EDIT: I found one on Amazon under the Amazon Renewed program that's certified to work for 90 days for $8 shipped. I could probably get 5 keyboards from Goodwill for that but none would be certified.