ROL Lives

At some point, around 2017 or so, I read something about someone who was putting together a computer based on a 6502 microprocessor. It piqued my interest. I started seeing several other such projects popping up. I did more research, mostly at 6502.org. Eventually, I designed my own system and made a schematic. I named it “ROL” after the 6502 assembly instruction. I started breadboarding it and eventually got the basic circuit wired up. I made the mistake of wiring up most of the chips before I did any testing at all. Of course, it didn’t work when I applied power.

I shelved it a little over a year ago when we moved. It sat around collecting dust since then. I got it out a couple of weeks ago and tried to get it running, but the wiring was such a rat’s nest, I couldn’t fix it, so I scrapped it and started over. Luckily, I still had the schematic, so it was much easier this time. I also followed along Ben Eater’s YouTube videos on his 6502 build, making the necessary changes to accommodate my memory map.

I decided instead of trying to minimize the breadboard space, I’d just put each component on its own breadboard and run an address/data/control bus along the bottom of each breadboard. Then I could wire each of those to each component from the bottom of its own breadboard. This worked out great–it made it way, way easier to debug and move things around when necessary. So, I got it running.

On the left is the clock module. I can press the red button and generate a single clock pulse. I can also hit the switch and put it in free-running mode. The free-running clock is generated from a 555 timer connected to a potentiometer. It can go from < 1 pulse per second to about 500 Hertz. Once I get everything stabilized, I’m going to see how fast I can get it going with a crystal oscillator. I’m aiming for 10MHz, which is over 5 times faster than an Atari 400/800 (my first computer was an Atari 400). So far, I’ve had it running at 4MHz, but I wouldn’t exactly call it “reliably stable” at that speed.

To the right of the clock module is the 6502 CPU itself. The reset switch is above it and all of the address/data/control lines run from it to the bottom of the breadboard (the yellow, blue and green lines going from left to right across the bottom of each breadboard).

To the right of the processor is the address decoding logic. It maps the addresses output by the CPU into signals to enable the chip that lives at that address. The upper 16K of memory is two 8K EEPROMs, which are to the right of the address decoding logic. I built an EEPROM programmer, so I can write 6502 assembly on my MacBook Pro, assemble it with VASM and then upload the binary output to my EEPROM programmer over a serial port via x-modem. The programmer then writes it to the chip. I can then put the chip onto the breadboard and the 6502 reads the code that it runs off of that chip. The ROM is located at 0xc0000 – 0xffff.

To the right of the EEPROMs is a 32K RAM chip and it’s address decoding logic. The RAM is located at 0x0000 – 0x7ffff (32K).

Next to the RAM is a 6522 I/O chip. It provides 16 bits of I/O. My design supports four of those so far. They start at address 0xb000.

I still need to add the UART and I bought some nonvolatile RAM and a real time clock to put into it. I also have an 8K hole in memory between 0x8000 and 0xa000. I’m thinking I will use it as a window for page-swapped video RAM. I also bought an FPGA some dude programmed to emulate an Atari Pokey chip. Pokey was responsible for handling the game controllers, keyboard and sound generation. That’ll be fun to play with.

The computer works now. It reads the code I write to the EEPROM and executes it. RAM works, I/O works. There’s a bug somewhere so when the processor executes a JSR (Jump to SubRoutine) instruction, it causes memory to start returning all 0s after about 4 instructions. I’ve been working on that bug for a couple of days now.

The colored ribbon cable in the photo is where I have patched an Arduino into the address/data/control line busses. As the processor runs, I can watch all of the signals in a serial window running on my MacBook.

If you’re interested in building your own 6502-based computer, I highly recommend heading over to Ben Eater’s site and following his YouTube series (linked on his site). His memory map/address decoding logic is different than mine, but the series is an excellent resource. He not only shows how to do something but why to do it or why to do it a particular way.

Published
Categorized as ROL Tagged

Leave a comment

Your email address will not be published.