In one of  Adrian's Digital Basement videos about the SWTPC 6800 he mentioned that by default the machine bit-bangs serial data at 300baud instead of having dedicated UART hardware.

I found this very interesting and read up on the UART protocol. The next step was to get out an Arduino and my little USB logic analyzer and tried to see if I can modify the blink sketch to output serial data ... and sure enough without too much hassle, I was able to write some bytes that the logic analyzer could display.

Great! now I have a solution looking for a problem. :)

On the shelve in my study, I spot the Atari 2600 with a breadboard attached from a previous project ... and that gave me an idea ... what if I add some RAM and ROM through the cartridge port and use the joystick port to bit-bang the serial data ... I will then have a Ben Eater style breadboard based computer but with less effort.

So I started wiring up the ROM without issue but when I got to the RAM I realized that there is no ReadWrite line from the CPU exposed on the cartridge port so I thought about it for a bit and decided to use the one address line for write-enable on the RAM. The Atari 2600 cartridge port can only address 4K of memory by default (without fancy bank switching).

My original idea was 2K of ROM and 2K of RAM but since I now have to use one of the address lines as write-enable I will only have 1K of RAM ... but that is fine right? Why would anyone require more than 1K of RAM? ;)

I did think of some other options like running a jumper wire from the CPU or using one of the bits on the joystick port to toggle the write-enable on the RAM, but I didn't want to make any changes to the Atari itself, and using one of the bits on the joystick port would mean that I have to run a jumper from joystick port to the cartridge and that also did not seem very elegant ... and again I'm fine with 1K.

Now that the hardware is sorted I needed to turn my attention to the software. I have not done a lot of development in 6502 assembly, however there are some great resources and tutorials on the web and specifically for the Atari 2600.

Again I started with a simple program just "blinking" a bit on the Atari's RIOT chip's port A (also known as the joystick port) and that also worked, and I was able to fairly quickly start bit-banging out serial data, however not at a standard baud rate.

Again looking at forum posts and code for Atari 2600 games I found out about the timer on the RIOT chip. Using the logic analyzer and by trial and error, I found a value that I could put into the timer that would give very close to a standard 1200 baud rate. I also learned that at least at these slower rates that UART can be pretty forgiving.   

After getting this far, I took a break because I knew the next step would be to read bytes back over serial and I was not sure how I was going to do it, however, I was sure it was not going to be easy to get the timing right.

a day or two later I tried my first attempt at reading data, again by using the RIOT timer and to my surprise, the code worked the first time! I did mess with it and try to optimize it but that just broke it so I reverted to my first attempt.

Awesome so now I have working BIOS routines all I need now is the rest of the firmware.

Early on I already knew I wanted to try and port Wozmon but that was more of a stretch goal, however everything was going so well that I now was confident it could be done.

Going through Steve Wozniak's code  I could see there was a subroutine (ECHO) for writing to the Apple 1 display and a memory location that he checked for keyboard presses. All I needed to do was to replace the "ECHO" subroutine with my own character-out routine and update the Wozmon code to instead of checking a memory location for key presses call my subroutine for reading bytes over serial. One last thing I had to do was to update the code that when...

Read more »