Ultim809: Homebrew 8-Bit Computer

2010 (in progress)

Sadly, I was born a couple years too late to grow up with an 8-bit home computer. (though I did use Apple IIs in elementary school.) In an attempt to compensate, and relive a childhood I never had, I've decided to design and build my own 8-bit home computer.

There are a number of homebrew computer projects out there. A few of them use additional microcontrollers, FPGAs, and CPLDs. I wanted to keep it authentic and use discrete logic and chips from that time period—nothing surface-mount, nothing that requires an expensive programmer.

Other projects, including the ambitious N8VEM,attempt to run existing software and interface with many different kinds of devices. I wanted to do the whole thing myself—build the hardware, design the interfaces, and write my own kernel, monitor, libraries, filesystrem drivers, development tools, and, of course, user software.

Thus, I started the Ultim809 project in January 2010.

processor

As the name suggests, the processor is a Motorola 6809 (specifically, a 68B09E) running at 2 MHz.

The 6809 was the 8-bit processor the world forgot about—it was overshadowed by the 68000 a few years later. Very few consumer products used it; the TRS-80 CoCo and the Vectrex are just about the only notable ones released in the US. Williams also used the 6809 in many of its arcade games and pinball machines. However, it was nowhere near as prevalent as the 6502 or Z80.

So why did I decide to build a computer around one?

Everyone and their mother has built their own Z80 computer.

I found a microcomputer design book at the library that uses the 6809 in its examples.

It has a very clean, almost RISC-like design; not too many instructions, lots of addresing modes, very orthogonal.

The 6809 is regarded by many (including Bill Gates) to be the best 8-bit processor ever.

memory

Now, this thing could never be awesome if it had a measly 32 or 64KB of memory. So I put in the biggest SRAM chip I could find; the Ultim809 has 512KB of RAM.

However, an 8-bit processor can only address 64KB of memory at a time, so I implemented a bank switching scheme:

+------------------+ 0x0000 | | | 32K fixed RAM | | (pages 0 and 1) | | | +------------------+ 0x8000 | 16K banked RAM | | (page 0 thru 31) | +------------------+ 0xC000 | 8K I/O space | +------------------+ 0xE000 | 8K EEPROM | +------------------+ 0xFFFF

The 512KB is divided into thirty-two 16KB pages, three of which are available at once. The first two are always pages 0 and 1 (i.e. the lower 32KB of memory is always fixed), and the third can be selected programmatically.

I decided on this simplified layout to keep chip count down. Yes, it might be nice to have a fully remappable address space, but low-byte-count SRAM chips like the 74S189 cost a fortune nowadays. I don't intend to support multitasking in this system anyway; the point of the Ultim809 is not to run a third-party operating system like FLEX or OS-9, but to be an entirely new system built from the ground up.

peripherals

The Ultim809 interfaces with a SparkFun CompactFlash card breakout board for mass storage, and I've written my own FAT16 filesystem routines. Adding an SD card reader would have been a nightmare; I would have had to implement the SPI protocol in software, resulting in very slow transfer rates. They also require a 3.3V supply. On the other hand, CF cards hook up directly to a parallel bus (with a minimum of 8 data lines and 3 address lines), accept 5V power, and are still widely available, making them a much better choice for this project.

User interaction is handled via a high-speed serial port, using a 16550 UART. Rates of 38400 baud and higher are possible. I put a 6-pin FTDI connector on the board, so I can connect the Ultim809 to a PC with a 5V FTDI USB-to-serial cable. The Ultim809 also interfaces nicely with my Terminalscope, which I'm using in the videos I've posted to YouTube.

I'm also using some of the 16550's modem control pins for general I/O, allowing me to control a tri-color status LED and read the "present" and "busy" lines of the CF card.

There is also a socket on the board for an 8254 programmable timer, but I'm not using it yet. As you've noticed, I'm not using Motorola 68Bxx-series peripheral chips, since they're pretty much unavailable today.

In the future, I'm going to add a YM2149 sound chip (I really want to play Dma-Sc songs on actual hardware!), a TMS9918 or V9938 for color composite video, and a WIZnet W5100 Ethernet module, because every 8-bit computer nowadays has to be able to tweet and display RSS feeds or no one will care. :-P

design/construction

I've tried to keep everything as minimal as possible. The current design uses only 14 chips, and the final board (without expansion cards) will probably use less than 20. All of the glue logic is implemented with fast, inexpensive 74HC chips (they seem to work fine with the 6809, even though it's NMOS).

Every part in the Ultim809 is readily available today; even Jameco still sells the 68B09E for a few dollars. No PROMs, PALs, GALs, or other parts that require an expensive programmer are used. The firmware is in EEPROM, and it can be upgraded in-system via the serial port. Bootstrapping the EEPROM is the only tricky part; I did this the hardcore way by manually toggling in machine code with switches, but using an Arduino as a simple programmer would probably be smarter. :-p

I'm building the Ultim809 on a Eurocard using point-to-point enameled magnet wire. Wire-wrap sockets are too expensive, but point-to-point wiring enables me to design the circuit in pieces.

Pictures of the project are on Flickr.

software

I wrote the computer's firmware/OS in assembly language and it lives in the 8KB onboard EEPROM. It mainly consists of hardware support routines, console I/O functions, a bare-bones, read-only FAT16 filesystem driver, and a monitor.

Currently, all user interaction with the Ultim809 takes place over a serial line. It can't read a keyboard or drive a display on its own, so you'll have to use a PC (using screen on Linux or Mac OS X) or dumb terminal.

The monitor acts like the Ultim809's command prompt. There are commands for reading, modifying, and executing the contents of memory. There is a built-in disassembler and a line-by-line assembler (no expression or symbol support). So while it's possible to develop software directly on the Ultim809, it's much easier to use a cross-assembler. I use the ASxxxx assembler. It uses nonstandard syntax, but is the most mature and feature-full 6809 assembler I could find.)

The monitor can also access the CompactFlash card. It can read files from the card's root directory into memory (if they're under 32K) and execute them. All the CF card commands start with k ; kl lists the files in the root directory, ks loads a specific sector from the card, and kg (g for "go") loads a file containing machine code into memory, starting at address 0x0100, and executes it. An swi instruction (software interrupt) in the running program causes it to terminate and return to the monitor.

I've written two text-mode games for the Ultim809 purely in assembly language: a simple implementation of Mastermind (the game with the pegs, not the British TV show) and a full multiplayer Blackjack game. Blackjack is demonstrated in this YouTube video:



schematics/source

The Ultim809 is fully functional at this point, but I'm going to hold off on releasing schematics and source code until later this year. This is because I want to get everything done—audio, video, ethernet, etc. before I release it to the public.

Once it's all done, though, I'll put up everything. Schematics, ROM source code, example programs, my development tools, you name it. For now, you'll just have to check the Flickr set, my YouTube channel, and my Twitter for updates.