Quote:
I guess with the simple method, it is not so simple either. You need to know how much time has passed. The only way I can think of is to execute a loop, know how many instructions are in the loop and how long it takes to complete an instruction. Is there another way?
Using T1 on the 6522 in free-run mode to generate an interrupt to advance one or more bytes in memory as a time keeper is pretty easy. I think the "Tips" column mentions it. If/when you get that far and want help, I can give you the code to do it. It's not long, but there is a trick to getting T1 started that's not in the datasheets. You're going to have a 6522 anyway, so you might as well use it.
The timing loop will work. Keep in mind that the timing for key debouncing is not critical. Specifying it with only one significant digit (eg, 40ms versus 50ms) is more than adequate, which makes it easier that it might otherwise be. It's just that it really limits what the computer can do while waiting for the key to quit bouncing, be released, or get pressed. If you really had to be strobing an LED display, I would recommend that that be on an interrupt basis to get consistent timing so it doesn't flicker and it doesn't stop working when the computer turns its attention to the keypad or something else useful.
So is there another way? Well, yes, but software sure beats the hardware possibilities. My first computer, shown
here, had a separate, non-multiplexed hex keypad that I debounced in hardware, and an 8-digit 7-segment display (before I knew about the LCD modules or how to do LED multiplexing) that had an 8-bit serial-in, parallel-out shift register
for each digit and a current-limiting resistor for each of the 64 segments, with an impressive pile of thin wires. It was an awful lot of construction work for what I got out of it. I wrote the software for what segments to light for each character, something else you don't have to do with the intelligent character LCD modules. Making some of the characters in 7-segment required getting pretty creative. An "M" was an up-side-down "U", a "W" was an up-side-down "A", etc., and many specials were ridiculous combinations you had to look up until you had them memorized.
Quote:
I am wondering if I should get started first with PICs. There seem to be a lot more projects on those. They seem to be a little easier to implement too. I could learn a lot of the basics of I/O etc. then move back to my nostalgic dream project of building a 6502 based computer.
I've used them a lot. What they have going for them is that the whole thing is on one IC and there are lots of variations in stock at lots of distributors. You still have to connect your keypad and display and other I/O, and the sad part about the PICs is their decrepit microprocessor whose assembly language is much harder to program solutions in than the 6502 is. Hardwarewise the PIC is the quicker way to get going, but then in software, even doing something as simple as add-with-carry and subtract-with-borrow is pain. There's no direct access to the stack. The RAM and ROM memory banking is a big source of bugs. Table indexing becomes a ridiculous jerry-rig which if not done correctly won't just give you a wrong result but will even crash. Actually I could give you a ton of these, but it's better if I not get started because it gets me to wound up. It's just that so many things that are relatively efficient on the 6502 take a really mickey-mouse process to accomplish on the PIC, if indeed the PIC can do it at all. Over the years I have developed a lot of macros for use in the PIC assembler to try to hide some of the ugly details that shouldn't have to be so ugly.
Quote:
Once I move on to my 6501 project, it would be nice to find a use for these 6502s. I have a bunch of them. But if you think it would be easier for me to use the 65C02 then maybe I will pick up a couple of those.
I have over a hundred 6512's I bought for pennies on the dollar many years ago for something I had in mind and then I never used them, and now never will. I should probably eBay them if they're even worth the shipping to someone. They're a 6502 that requires the clock source to provide two non-overlapping signals.
I'll tell you another secret-- After you get your feet wet with the 6502, you might want to move to the 65816, as you'll find it is actually easier to program, even though initially it looks more daunting.
Quote:
What about the 6522s that I have? or is there also a CMOS version of those?
Yes, and there are hardware advantages to them, but the difference is not as pronounced as the NMOS-CMOS difference is in the processor. The current-production WDC 65c22's have a far greater drive capability than the NMOS ones, and in input mode the pins offer a CMOS load instead of an LSTTL load. Sometimes that's important for not loading a line. Unfortunately the only bug the NMOS 6522 had is still not corrected in the CMOS versions from
any of the manufacturers. It has to do with inputting serial data to its shift register with an external clock source. There's a way around the problem, but it would be nice if they would just fix it.