Header

Got tired of having to flash a cartridge every time I needed to run a small test program on the SEGA master system so, since I already have a serial port, I decided to make a serial port bootloader implementing the venerable XMODEM protocol.

The XMODEM bootloader is available as part of my Master System “BIOS menu” ROM; repository available on Bitbucket.

This quick project loads a ROM up to 4K in size using XMODEM, this way small ROMs can be loaded on the console using a PC and a serial adapter without having to remove the cartridge, flash another ROM and restart the computer, usually many times in a short period of time which is common (and annoying) during development.

Uploaded ROMs will be written to RAM at an unknown location and the CPU will jump to its base address once an upload succesfuly completes. This imposes a limitation on what can be uploaded since most ROMs not only expect to be run from ROM at a known address, but the interrupt vectors are hardcoded to ROM addresses, hence interrupts are unavailable for bootloaded ROMs.

The address location issue has been fixed using a Crt0 that will relocate the ROM to a known RAM base address before passing control to the main() function. This modified Crt0 is also available at the test ROMs repository.

The result can be seen below. Using an XMODEM program (I use Teraterm on windows or Minicom for Linux) on the PC, an UART-to-USB adapter, and the bootloader ROM, a simple “Hello world” program is uploaded to the console without having to remove and manually flash a cartridge. Watch in fullscreen for better results.

Download video in mp4 format or in webm format.