This is part four of my Retrochallenge 2016/10 journal, where I’m working towards loading ROM images to an Intellivision from an Atari 800. To jump to the very beginning, click here.
Transferring ROMs from Linux to the Intellicart!
Before trying to transfer ROMs from the Atari 800 to the Intellicart!, I thought it wiser to troubleshoot these details from a modern machine.
Binary ROM Images and The Intellicart!
ROMs for the library of classic Intellivision games are typically available as raw binary files containing solely the bits dumped from cartridge EPROMs. These raw data files are found on ROM archive websites with a “.bin” file extension. I’d like to transfer ROM images from the Atari 800 to the Intellicart!. However, the Intellicart! cartridge emulator expects more than just the raw binary data. It expects some transmission details and metadata before and after the raw binary data. This download protocol is explained in the Intellicart! manual pages 17-22.
The Intellicart! Download Protocol
Here is a summary of the Intellicart! download protocol verbatim from the manual:
- Send Byte 0xA8, used for auto baud rate detection
- Send number of ROM segments
This is the number of non-contiguous ROM segments that will follow. For example, a cart that occupied memory from 0x5000-0x6FFF and 0xD000-0xDFFF would send the number 0x02. (The actual binary value, not its ASCII equivalent.)
- Send the ones complement of the number of ROM segments.
- Send high byte of start address of first segment, 0x50 for above example.
- Send high byte of stop address of first segment, 0x6F for above example.
- Send the ROM segment itself.
- Send the high byte of the CRC-16 for the first ROM segment.
- Send the low byte of the CRC-16 for the first ROM segment.
- Repeat steps 4-8 for each additional ROM segment.
- Send the Enable Tables (see manual for details).
- Send high byte of CRC-16 for the tables.
- Send low byte of CRC-16 for the tables.
The Intellicart! Diskette
At the beginning of this season’s Retrochallenge, my assumption was I’d have to write my own code to handle the details of the download protocol either at run-time on the Atari, or more likely, in a pre-calculated form on a modern machine.
So it was with great gratitude to the Intellicart! team that I found a C source file called BIN2ROM.C included on its installation diskette. The C source compiled without complaints on my Linux laptop. The program takes a .bin and corresponding .cfg file as input and outputs a .rom file that encapsulates the entire protocol. The only caveat is that for it to run successfully under Linux, the input files need to be lowercase. Many of the .BIN files included on the installation disk are old-fashioned MS-DOS upper case.
The diskette is available here.
Creating a Test ROM File
Included on the installation diskette for the Intellicart! is (among other .BIN files) a file called TESTROM.BIN. This is a minimal Intellivision program to test downloads. I’ll be using it for my tests.
1. Compile BINROM.C (included on Intellicart! diskette).
$ cc -o bin2rom BIN2ROM.C $ ls -l bin2rom -rwxr-xr-x 1 michael michael 15192 Oct 20 19:44 bin2rom
2. Create copies of TESTROM.BIN & TESTROM.CFG with lower-case names to appease the Linux version of the executable.
$ cp TESTROM.BIN testrom.bin $ cp TESTROM.CFG testrom.cfg $ ls -l testrom.* -rw-r--r-- 1 michael michael 512 Oct 20 19:45 testrom.bin -rw-r--r-- 1 michael michael 92 Oct 20 19:45 testrom.cfg
2. Convert testrom.bin to testrom.rom
$ ./bin2rom testrom $ ls -l testrom.* -rw-r--r-- 1 michael michael 512 Oct 20 19:45 testrom.bin -rw-r--r-- 1 michael michael 92 Oct 20 19:45 testrom.cfg -rw-r--r-- 1 michael michael 569 Oct 20 19:48 testrom.rom
Now I need to try uploading testrom.rom to the Intellicart!.
Minicom Is a Bad Friend
I’ve used minicom to get me this far in my Retrochallenge. I’ve used it to capture data being sent from the Intellicart software for Windows to the Intellicart! cartridge. However, I tried transferring testrom.rom from my Linux laptop to the Intellicart! cartridge using minicom’s “Paste File” functionality but I kept receiving a BAUD ERROR on the Intellicart! side.
STTY Is My New Friend
To the rescue comes the old Unix tool stty, which alters terminal line settings. I’ve used STTY to correct backspace keys and screen sizes in the past. But this functionality is new to me and now I’m grateful minicom was unsuccessful. Otherwise I may not have learned about it.
$ stty -F /dev/ttyUSB0 raw speed 9600 $ cat testrom.rom > /dev/ttyUSB0
The first command configures my laptop’s serial port to 9600 baud and the second command uploads the ROM file onto the serial connection.
So now I know I’m able to generate a ROM data file that is acceptable to the Intellicart!. And I know what serial port configuration works. I just need to do the same on the Atari 800 and I should find success there, too.