Close

XMODEM!

A project log for TG6502

A 6502 based single board computer project

tom-gwozdzTom Gwozdz 07/06/2018 at 02:520 Comments

In my last update, I had just gotten my serial routines working, and my memory sanity check complete.  I am now able to write some simple software, but having to re-flash the EEPROM for every code change was wasting a lot of time.  To fix this, I wrote an XMODEM receive routine which will allow me to send code to the computer over the serial port.

I chose the XMODEM protocol because its super simple to implement.  My routine gets called on boot and waits for an XMODEM transfer to start.  I then write the data I receive to memory starting at address $1000.  I set up a linker file to write the start address as the first 2 bytes of the linked file, which show up at address $1000, $1001.  I then do a jump to the address at that location to execute the code.

Below is an image of this in action.  I created a very simple test program which just prints out "Hello, world!" and then loops forever.  I booted the computer, uploaded the binary over XMODEM, and success!

It took me many hours to get the protocol implementation correct.  Having no debugging capability made this very difficult.  And since I'm using the serial port for data, I couldn't even do printf style debugging over the serial port.  My Saleae Logic proved extremely useful in being able to see what was happening.  The built in protocol decoder made debugging possible.

Logic attached to the TG6502:

Discussions