ROM1 DISK MAGIC V1.5 by Jason Cook 2024-10-17
Finally! The ability for a Commodore PET ROM1 computer to be able to use DISK (IEEE-488) devices! This also gives the ability to use SD and wifi based devices (links at bottom) such as PETdisk MAX and SD2PET.
Update 1.5: Rom1diskROM: Fixes LOAD operation from corrupting memory on variable initialization. Rom1DISKmagic: Makes sure to not load if latest Rom1diskROM utilized as it is not necessary.
Update 1.4: Fully supports VERIFY operation. To verify a file, the file must be loaded in memory. The contents are then verified against the file you specify on disk. EXAMPLE:
VERIFY "TESTFILE",8
Update 1.2: Compatible with bitfixer's PETdisk MAX v2. The load operation is now closer to the STATUS implementation provided by ROM 2&4. This allows for both PETdisk MAX SD and Network LOAD operations.
Download V1.5: #^https://www.insanerocketry.com/personal/rom1diskmagic.zipNote: Included in the download, I also provide a ROM PATCH if you want to replace the ROM at H4 on the motherboard. Details are here:
#^https://hub.inktada.com/channel/rom1diskmagic?cat=ROM1+DISK+FIXSimply load and run the program from tape cassette and voilà! The ability to load from disk with no decrease in memory footprint. The lack of memory footprint is critical on 8K systems, as many programs and games use every byte of program space.
This is accomplished by utilizing buffer space for tape#2, so it is disabled.
If you need SAVE capability, the patch utilizes 77 bytes at the top of program space.
Video:#^https://www.youtube.com/watch?v=nA95gQia7sM3 minutes 40 secondsBACKGROUND:This code's concept was derived from the original IEEE-488 ROM 1 patch written by André Fachat and ROM 1 disassembly. I then added support for VERIFY and a better implementation of STATUS.
I wanted my Commodore PET ROM 1 computer to be able to use new IEEE-488 SD/wifi devices so I started with looking at André Fachat's ROM patch. I was looking for a solution that did not require replacing a ROM, as ideally I want to keep my Commodore PET stock.
TECHNICAL:While things typically will just work fine, you may want your program to use ST (status) BASIC variable to get the result or read location $20c. Bit 6 set indicates end of file reached, which is a good indicator. You may also want to check any of the bits 4, 5, 7 set, as any would indicate error.
Quick test BASIC:
IF ((ST) AND 64)>0 THEN REM SUCCESS CODE HERE
Quick test Assembler:
LDA $20C
AND # $40 ;(bit 6) indicates end of file reached, NON ZERO means success.
ASSEMBLY:If you want to use the upgraded SAVE and LOAD from assembly language, first test to see if the patch has been applied by checking:
$c2+$2=# $03,
$c2+$3=# $2c, and
tapebuffer2+$a=# $03
1.2 CHANGE - UNFORTUNATELY CHECK tapebuffer2+$8 HAD TO BE CHANGED TO tapebuffer2+$a
TEST FOR PATCH EXAMPLE:
tapebuffer2 = $33a
LDA $C2+$2
CMP # $0c
BNE NOTPATCHED
LDA $C2+$3
CMP # $2c
BNE NOTPATCHED
LDA tapebuffer2+$a
CMP # $03
BNE NOTPATCHED
PATCH IS IDENTIFIED AND ACTIVE
On test success, JMP addresses are as follows:
JSR tapebuffer2+0: LOAD/VERIFY low level address.
Make sure to initialize.
FA(device number)
SA(secondary address)
LFN(logical file number)
FNLEN(file length)
OSPTR(filename)
VERFL(0=LOAD)
1.2 CHANGE FROM tapebuffer2+$3 TO tapebuffer2+$5, and First TEST LOCATION CHANGED TOO
JSR tapebuffer2+$5: (First TEST tapebuffer2+$8 = # $20, SAVE code enabled.)
SAVE low level address.
Make sure to initialize.
FA(device number)
SA(secondary address)
LFN(logical file number)
FNLEN(file length)
OSPTR(filename)
SADDR(start address of save)
EADDR(end address of save)
For reference, native equivalents to above JMP locations:
rom1load = $f362
rom2load = $f322
rom4load = $f356
rom1save = $f6b1
rom2save = $f6a4
rom4save = $f6e3
* rom2 and rom 4 have different locations for
FA, SA, LFN, FNLEN, OSPTR, SADDR, EADDR
rom2 and rom4 share the same locations for those variables.