This is part five 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.
Tranferring ROMs from the Atari 800 to the Intellicart!
Here I’ll combine what I learned in Post 3 about transferring non-Intellivision data from the Atari 800 to my laptop and what I learned in Post 4 about creating and transferring Intellivision ROMs from my laptop to the Intellicart!. The result should be transferring Intellivision ROMs from the Atari 800 to the Intellicart!. Yippee!
Something Afoul in the Library
The Action! code I created in Post 3 reads characters from a small text file using the statement CH=GETD(INP). In that experiment, the GETD() procedure found in Action!’s default library returned zeroes once the program started reading past the end-of-file. That’s somewhat okay for reading text files but will not work when reading binary ROM files which will certainly contain many, many zeroes as valid data.
I looked through the Action! documentation and couldn’t find any procedures or functions that would provide a clue when the end-of-file is encountered. One kludgey solution would be to set up a loop counter break out of it after a per-determined number of iterations. Then I’d have to maintain a table of byte counts for each ROM file. Adding new ROM files would require updating the table. That’s no good.
IOFUN3
Looking through the list of Action! articles at atariwiki.org, I found a library file called iofun3.act. It contains file I/O functions akin to those found in Unix’s low-level system library. That is, the file read function includes a requested number of bytes to be retrieved and then returns the actual number of bytes retrieved. So if the function requests to read, say, 128 bytes, but receives something less than 128 bytes, then it can be assumed the end-of-file has been reached.
Let’s get cracking.
Action! Code to Upload a ROM to the Intellicart!
INCLUDE "D3:IOFUN3.ACT" ;------------------------------------ PROC CONFIG_RS232(BYTE IOCB) BYTE AUX1 BYTE AUX2 ; AUX1: 19200,8 Bit words,1 stop bit ; AUX2: No READY checks AUX1=15 AUX2=0 XIO(IOCB,0,36,AUX1,AUX2,"R1:") ; AUX1: No translation. No parity ; AUX2: Unused AUX1=32+0+0 AUX2=0 XIO(IOCB,0,38,AUX1,AUX2,"R1:") ; AUX1: DTR off,RTS off ; AUX2: Unused AUX1=128+32 AUX2=0 XIO(IOCB,0,34,AUX1,AUX2,"R1:") RETURN ;------------------------------------ PROC MAIN() DEFINE BUFSIZ="256" BYTE CH, INP,OUT, GO BYTE ARRAY ROMFILE(30) BYTE ARRAY BUF(BUFSIZ) CARD COUNT CARD TOTAL INP=2 ; IOCB #1 OUT=5 ; IOCB #5 TOTAL=0 ; GET INPUT FILE PRINT("Enter ROM: ") INPUTS(ROMFILE) ; OPEN INPUT FILE CLOSE(INP) IF FOPEN(INP,4,0,ROMFILE)>127 THEN PRINTE("Error> ROM not found.") ELSE ; OPEN OUTPUT ON ATARI 850 FOPEN(OUT,8,0,"R1:") CONFIG_RS232(OUT) DO ; XFER BLOCKS FROM INP TO OUT COUNT=FREAD(INP,BUF,BUFSIZ) IF COUNT>0 THEN FWRITE(OUT,BUF,COUNT) FI TOTAL==+COUNT PRINT("So far...") PRINTCE(TOTAL) UNTIL COUNT<>BUFSIZ OD FI ; HOUSEKEEPING CLOSE(OUT) CLOSE(INP) RETURN
A Trivial Test
- Created a custom Intellivision ROM image called RC201610.ROM using TESTROM.BIN found on the Intellicart! Download Software diskette as a basis.
- Transferred the ROM file to a physical floppy disk via a NUXX SDrive SD card/floppy drive emulator.
- Booted DOS XL and ran the compiled version of the Action! code found above.
- Entered “RC201610.ROM” at the program’s input prompt.
A Non Trivial Test
Here I transferred a ROM image for the 2011 homebrew game DK Arcade which was 49,221 bytes. There’d only be room for two ROMs that size on a typical Atari-formatted diskette. (If you’re wondering why the ROM files are so large, the Intellivision uses 10-bit words called decles. The ROM format spreads that information across two bytes).
Up Next
If nothing else gets accomplished, I’d be happy with having this command-line user interface. But my original plan was to have a “GUI” using @InverseATASCII’s Window Gadgets for Action!. I’ll have a little more than a week to get that working.