After looking at how Ben Ryvers built up his Z80 based computer, I decided to borrow some of his ideas for a trivial test. The idea is that test data - a sequence of bytes indicating which LEDs should be on and off, held in ROM - will be outputted. Once the sequence has ended it is restarted. As simple as can be.
My test-bed 6809 computer consists of:
- 6809 clocked by a 4Mhz crystal
- The 28C256 EEPROM
- 8 bit latch which drives a 10 LED bar graph
- Glue logic
The memory map for this setup is completely trivial. When started, the 6809 reads a 16bit startup vector from memory location $fffe. Therefore ROM has to live at the end of the memory space. In this case, 16KByte of ROM will be available at $c000 to $ffff. The other half of the 32KByte EEPROM isn't mapped.
It is helpful to consider the memory map in terms of the high nibble, in binary:
- 0xxx - RAM (in the future)
- 10xx - IO
- 11xx - EEPROM
To avoid the risk of the 6809 modifying the content of the EEPROM, the R/W line on the EEPROM is tied high. The /CS line for the EEPROM is derived from the address decoding, described above, whilst the /OE line is form by the negation of the R/W signal on the 6809 (alternatively it could be held low, but this will not be useful when the EEPROM is programmed in-place).
In this simple case, "IO" consists of a single 8 bit latch - I chose a 74HC574 for this purpose. Attached to the outputs of the latch are 10 LEDs in a bar graph (the end 2 LEDs are unused). Since the latch is clocked on the rising edge, it is necessary to invert the IO enable signal from the address decoder.
Two push buttons, one for /RESET and one for /HALT, and a 4MHz crystal with caps complete the circuit:
You can download a postscript version.
The code, in good old fashioned assembly - such as it is, is on github. Note the $4000 delay loop. This sets the speed of the pattern. This is equates to a delay of about a half of a second with the 1Mhz clock. This program is my first crack at assembly programming since the mid to late 1980s, on the ZX Spectrum!
To turn the assembly file into a ROM image, I used a09 (available here), along with hex2bin to form the 16Kbyte ROM image, which of course is written out to the EEPROM using the upload tool previously written.
I did make a video of the "computer" in action. Unfortunately it seems I'm unable to upload videos to this blog. You will have to make do with a picture instead:
As you can see, the breadboard is a mess - extending the busses is going to be difficult. Power is provided by the same IDC header used by the EEPROM programmer - only the +5V and 0V lines are used.
Amazingly the circuit worked first time.
The next step is to decide what the next step is. ;-) I can either add some RAM and play with some more advanced testing towards making the computer "useable", or I could try to get an old UART working.
I suspect I will try my hand at the RAM, since a serial port is, after all, only a "peripheral"....
Update... Finally figured out that the way to get videos on my blog is via youtube. So here is that video: