Since the end of last year, I faced a lot of change in my personal
life: new job, new house, new car, etc. Except my girlfriend, almost everything
else changed in the last 3 months. Damn exciting, but I had very little time to
spend on side projects.
It’s now time to resume the work on the Universal Chip Analyzer! My next goal was to add support for the very successful MOS 6502, an 8-bit microprocessor released in mid-70s that was at the heart of many designs well into the 80s. The original 6501 (circa 1975) was pin-compatible with the M6800 while being much less expensive, but Motorola sued MOS almost instantly and the 6501 has been withdrawn very quickly. The 6502 shares the same internal micro-architecture with the original 6501 but uses a different pin arrangement. It’s a very simple CPU, with a 8-bit accumulator, two index registers and a 16-bit address bus (able to interface with a maximum of 64 KB of memory). The 6502, just like many other early CPU, doesn’t have a specific way to handle I/O: you must define an arbitrary memory-mapped I/O range and configure your hardware accordingly.
Several variants of the MOS 6502 has been launched through
the decade, some of the them with reduced addressable memory (6503 to 6507) and
some others with additional features (6508 to 6510, …). Many early computers
and consoles are based on a 6502: Apple IIe, Commodore 64, Atari 2600, Nintendo
NES, Oric Atmos, etc.
Adding support for the 6502 wasn’t as easy as I expected.
The main issue came from the timings. Usually, I drive all the logic inside the
FPGA with the the clock signal generated locally and sent to the CPU. That doesn’t
work with this particular CPU because it integrates an internal two-phase clock
generator used to sync external IC. So, I finally had to feed these two clocks
back in the FPGA and sync the internal logic with them. Some delays were needed
to match the original timings (FPGAs hate delays) but everything now seems to
work properly.
Here is the UCA testing a NMOS Rockwell R6502P at 1 MHz and a much more modern CMOS Rockwell R65C02 at 4 MHz (overclocked from 3 MHz):
Testing frequency can be set at 1.0 / 2.0 / 3.0 or 4.0 MHz to match the most popular 65xx
I’m waiting to get some samples to support other 6502-based CPU like 6510 or 28-pin 6503 -> 6507. A Rockwell 65C112 has already been seen working properly. The passive adapter isn’t final now, because I still need to work on my next goal: the Motorola 6800! This CPU Is the last (but not least) big one I need to support with the UCA. Stay tuned!