I’ve begun work on a new 6502-based single board computer. I’ve done one before, but I’m somewhat disappointed with how useful it is.
Actually, let me rephrase that. The last version was just as useful as 99% of the other 6502 SBCs out there. However, in the retrocomputing community, there’s a large desire for some hardware that, ‘gets the kids back into assembly programming’. Yes, this is a little like getting young baby boomers interested in horse-drawn carriages, but it’s still an admirable goal.
As I see it, there are a few things preventing SBCs based on old processors from being used by noobs. The first and largest problem is the requirement for a 6502 developer tools. Things like ROM programmers and actual hardware serial ports (even I don’t have a DE-9 RS-232 to USB converter thingy) are either expensive or just a pain in the ass to get running.
Another thing I’m looking at is the price and availability of components. The usual way of getting I/O on a homebrew 6502 system is a 6522 VIA for something akin to GPIO and a 6551 or 6850 to talk to an RS232 transceiver. These are $5 parts, each, and they’re not available on Mouser or Digikey. There’s a lot of room for improvement if you’re looking for a cheap and accessible 6502 board for beginners.
What I’m doing about this
I’ve decided to build a new 6502 computer to address these concerns. Here’s a list of the design goals:
- In-system ROM programming. This is huge if you would ever want to develop for a 6502-based system. The ROM programmers you find on eBay go for around $50, the drivers are universally sucky, and I’m not a fan of a tool you’re only going to use a few times. If you want to get people interested in 6502 development, give them a cheap way to program a system.
- Replacing the weird chips with a microcontroller. 6502 SBCs designed in the last decade use 6551 and 6850 ACIAs and a MAX232 chip for their serial connection. This is at least $7 or $8 worth of parts per board, an amazing expense for a piece of hardware designed to get people interested in a platform. Could you imagine if $8 of the cost of any other dev board only went to a serial connection? It’s a crazy design choice.
- USB. Since my Thinkpad T61 broke, I don’t have a computer with a native serial port. Keep in mind the keyboard I’m typing this on was made in 1990 (Model M fo’ lyfe, yo). Requiring a DE-9 serial port, null modem cable, or even a USB to RS-232 transceiver is a weird design choice now, and fairly dumb if you’re building a system for others to use.
- SPI. This allows for a lot of really cool things like SD cards, LCDs, and even entire graphics processors. SPI is possible with a 6522 VIA, so why not replicate it on a microcontroller?
I’ve nearly completed the schematic for this new computer. Here’s a PDF of my entire design, along with my commentary for each sheet of the schematic. Click to embiggen each pic:
The CPU, RAM, and ROM:
I’m using a Western Design Center 6502 CPU, 62256 SRAM chip, and a 28c64 ROM. If you’re keeping track, that means I have 32kB of RAM, and 8kB of ROM at $0000 to $7FFF and $E000 to $FFFF, respectively. I was able to get the entire memory map working with a single 7400 quad 2-input NAND, so propagation delays shouldn’t be much of an issue, That’s especially true since I’m only running the 6502 at 1MHz.
But why don’t you use some sort of programmable logic? Because I don’t want to. I want everyone who picks up this board to know absolutely everything about it. That means no CPLDs, no FPGAs, and no custom chips. This is all open source, open hardware, and most importantly, unobfuscated hardware.
The clock for the CPU comes from a 1 MHz can crystal oscillator. It’s also the only through-hole part. I’m not terribly concerned about how screwed up this part of the schematic is. It’s a pretty basic system, running at a fairly slow speed, with minimal logic tying all the components together. Unless I’ve made some astoundingly stupid design choices, I’m confident this part of the design will work.
If anyone knows what package I should be looking at for an SMD can oscillator, drop me a line. Most of the ones I’ve found browsing Mouser and Digikey are just as large as a through-hole part.
Here’s where things get tricky, and I’m not even sure this part of the circuit will work. Once again, click to embiggen:
This really is the brains of the system. It’s an ATMega32u4 and I stole most of the design from Adafruit’s 32u4 breakout board (I’m not evil, I’m just lazy). There are really three distinct ways I’m using this microcontroller:
- The data bus. The 8-bit data bus on the 6502 system is connected directly to the 32u4. This is how the 6502 is going to send data to the “emulated ACIA” I’m going to write for the microcontroller. Of course it’s simply not a matter of sending bits from a 6502 to a microcontroller over a data bus, which is why I came up with…
- MCU Chip Select Pins. There’s a large gap in the 6502′s address space beginning at $8000 and ending at $DFFF. To fill this space, I’ve connected three pins of the microcontroller to the lines 13, 14, and 15 of the address bus to the microcontroller. I’m planning on having three ‘virtual’ CS pins, with all the logic programmed in the microcontroller. The addressing scheme goes as such:
MCU CS 0 = A15 + /A14 + /A13
MCU CS 1 = A15 + A14 + /A13
MCU CS 2 = A15 + /A14+ + A13
Along with these virtual CS pins, I have the R/W and PHI20 lines of the 6502 connected to the microcontroller. Basically, I’m treating the microcontroller like the SRAM – same signalling and everything.
- The ROM writer. 12 address pins, 8 data pins, and the /OE, /CE, and /WE pins are a lot for the relatively small ATmega32u4. I’ve reduced the number of pins required to write to the ROM with the use of shift registers:
Basically, I’m using six pins to write to any address on the ROM. Two shift registers and two octal buffers (a 74HC595 and 74AC245) allow the microcontroller to write data to any address on the 6502 system. It’s a fairly simple system, really, A ROM programmer like this has been done before, albeit not in-system, thus necessitating the use of the octal buffers.
Now I need your help
That’s what I have so far. There are still a few unanswered questions I have, such as:
- Can I get a schematic review? Seriously, I’ve been working on this for about two weeks now, and I know I’m missing something obvious.
- Will connecting the 6502 data bus to a microcontroller actually work? The ATmega is running at 16 MHz and has mostly 1 or 2-cycle instructions. The 6502 is running at 1MHz and isn’t going to be as efficient. My gut tells me the microcontroller will be fast enough, but I’d just like some feedback on this.
- Restarting the 6502 from the microcontroller. I have the PD4 pin on the microcontroller connected to the CPU Reset line via a transistor and pull-up resistor. What say you?
Like I said, I’ve been working on this for about two weeks now, and right now I just need another set of eyes on this. While it’s not the biggest circuit I’ve designed in terms of the number of airwires, it’s definitely the most complex. There’s a lot to go wrong here, and to be honest I’m an idiot.