Simon6809 Educational Computer

2007/12/02

Simon6809

SiMon6809 is a 6809 based educational computer. If you coded on 8-bit processors, you will remember the good-ol' days. If you never used an 8-bit processor, you can use SiMon6809 to go back in time.

This project is retired and shown for educational value. Check out RetroShield for Arduino instead.

Back in the days of Apple I/II and Commodore 64, 6502 and its derivatives were the most popular 8-bit microprocesor chips. Most of us spent hours coding in assembly, doing all sorts of tricks with about several kBytes(note k!) of memory and simple 8-bit move/add/subtract instructions. Those of us who coded on Commodore 64, will remember the underground competition about trying to come up with the best demos.

At the end of that era, Motorola designed the most powerful micro, 6809. It was fundamentally an 8-bit processor, but it had some support for high level languages and 16-bit operations, i.e. addition & multiplication. Unfortunately, 6809 came in little bit late; the world moved onto true 16-bit processors (like 68000 and 8086) and 6809 was forgotten.

My goal with SiMon6809 is to build a simple computer that will let you experience 6809. Yes, there are simulators on the web (and some of them are very good indeed), but running your code on real hardware is a different experience.

Simon6809 Block Diagram

SiMon6809 has the following features:

Design files are available for you to study and (hopefully) build one for yourself:

Acknowledgements

Before we get into details, I would like to acknowledge Lennart Benschop for writing his 6809 monitor code and making it available. His monitor code is a kick-ass monitor, with an assembler and disassembler included! I slightly modified it to run on SiMon6809.

6809 Features

Note: This list will make experienced 8-bit programmers salivate. Do not worry if some of these acronyms do not make sense. You will be able to try all of them on SiMon 6809.

SiMon has 4 major components.

Simon6809 Top View

SW Memory Map

0x0000 - 0x7FFF : System RAM (32K)
0x8000 - 0x9FFF : (Optional 2nd 8K EEPROM or RAM or I/O)
0xA000 - 0xCFFF : Unused
0xD000 - 0xD7FF : FT245RL
0xD800 - 0xDFFF : Unused
0xE000 - 0xFFFF : System EEPROM (includes monitor + assembler)

FT245R USB-to-Parallel FIFO Chip

FT245R is a single chip USB to parallel FIFO bidirectional data transfer interface chip. It has 256 bytes of receive buffer and 128 bytes of transmit buffer. Also, it will transfer data at ~300kBytes/sec. Unlike other designs where a ACIA (serial port) is used, the communication link on SiMon6809 is very fast.

After installing the drivers on the host PC, SiMon 6809 will showup as a Virtual COM port. This way, a simple terminal program (i.e.Hypterminal) can be used to communicate with SiMon 6809.

SiMon6809 programs can access FT245R at address 0xD000.

If you choose the FIRQ handler solution, the handler should receive each byte and put it in a FIFO in the RAM. Then you can implement getc() and putc() type functions to access this FIFO in a controlled way. Memory is precious and FT245RL already has a FIFO in it, so I don’t see any good reason to keep a second FIFO in SiMon6809.

SiMon6809 uses the SYNC method. Here is an example of how to read character and echo it back to the PC:

ECHO	ORCC #%0100_0000    # Disable FIRQ interrupt
RECV	SYNC                # 6809 will wait for FIRQ
        LDA $D000           # read byte from FT245
        STA $D000           # Echo back to PC
        BRA RECV

The problem with the above code is SYNC blocks the processor (i.e. 6809 will wait for the interrupt to occur). This means this code can not just check if there is a byte waiting or not.

In SiMon6809 monitor code, I actually do a trick. I enable the FIRQ interrupt, wait a few cycles and disable the FIRQ. Then I check if my FIRQ handler fired or not. If it fired, that means FT245RL was asserting the FIRQ line, which means there is at least one byte in its FIFO. Otherwise, there was no character received. Go thru the monitor code for details.

WARNING! The programmer must ensure FT245R has a byte in FIFO before reading from $D000, otherwise data read will be invalid (I believe you will read the last byte sent again, but don’t quote me on this.).

Installation

You can use SiMon 6809 on either a PC running Windows or a MAC.

Windows

  1. Before inserting the USB cable into the PC, copy or download FT245R drivers to your computer.
  2. Insert USB cable into PC.
  3. Windows will detect FT245R and ask for drivers. Point to the driver folder you just copied.
  4. After drivers are installed, run terminal program*.
  5. Create a new connection, using 115200 kbps, 8-bit, no parity, 1-stop bit.
  6. Hit reset on SiMon 6809 and check for the monitor prompt.

Mac

  1. Before inserting the USB cable into the PC, please install the FT245R drivers. You may need to restart your MAC.
  2. Start your favorite terminal program*.
  3. Create a new connection using 115200 kbps, 8-bit, no-parity, 1-stop bit.
  4. Hit reset on SiMon 6809 and check for the monitor prompt.

Note: Some terminal programs will give you faster baud rates with FT245RL. Choose the fastest option available.

At the time of writing this manual, there were several terminal programs available on the net:

Monitor Program

After reset, 6809 runs the monitor program stored in the EEPROM. With the monitor program, you can:

Upon reset, you will get the following message in the terminal program:

PASS

Welcome to BUGGY version 1.1 - D1
    by Lennart Benschop
 ported by Erturk Kocalar

.

The “PASS” indicates the monitor code checked the first 32Kbytes of memory and all addresses are good. While SiMon6809 checks the memory, it will save the memory contents, so if your program crashes and you need to reset, your program will still be there.

The dot “.” is the prompt. Type h [ENTER] for help.

Commands list
---------------
Asm       {A<addr>}
Unasm     {U or U<addr> or U<addr>,<length>}
Dump      {D or D<addr> or D<addr>,<length>}
Enter     {E or E<addr> or E<addr> <bytes> or E<addr><string>}
Inp       {I<addr>}
Break     {B or B<addr>. B displays, B<addr> sets or clears breakpoint}
Regs      {R or R<letter><hex>}
Go        {G or G<addr>}
Jump      {J<addr>}
Step Over {P}
Calc      {Chexnum{+|-|*hexnum}}
Find      {F<addr> <bytes> or F<addr>"ascii"}
Move      {M<addr1>,<addr2>,<lenght>}
Srec      {SO<addr> or SS<addr>,<len> or S1<bytes> or S9<bytes>}
Help      {H}
.