Running Commodore 64 BASIC Programs on a PET
By Michael Doornbos
- 3 minutes read - 436 wordsThe Commodore 64 and PET are fairly similar systems. Other than a few memory location differences, many BASIC programs written for the Commodore 64 that don’t use graphics can run on a PET.
There is one caveat. The PET doesn’t relocate a saved BASIC program to the beginning of BASIC, like all of the Commodore lines after it. So if you find yourself trying to load a program on your PET written on one of its younger siblings, you may wonder why it loads, but you can’t find it.
The VIC-20 and Commodore 128 have several locations that BASIC can start from, depending on your configuration and ALL of the later systems have relocatable BASIC start locations. This table is just meant to give you an idea of where to start looking.
SYSTEM | BASIC START HEX | BASIC START DECIMAL |
---|---|---|
PET | $0401 | 1025 |
VIC-20 Unexpanded | $1001 | 4097 |
C64 | $0801 | 2049 |
Let’s load a C64 BASIC program to a PET
Earlier this week, I typed in an old maze program from Compute! magazine from 1981 and changed the screen location variable to work on my C64 so I could compare it running on the Atari 400. Let’s load this one on the PET from disk.
Clear any programs, and add a line 0 to give it an anchor point to load to.
NEW
0 REM
Now load the program as usual.
When we try and list the program, the only line we get is the REM statement we typed before. This is because the program was saved from the beginning in BASIC on a Commodore 64, the PET just loaded it to that address. The program is there, it’s just at the wrong memory location.
Start up the monitor and go to location $0401
Notice that the memory pointer (in low byte/high byte format) is NOT in the location the BASIC program was saved on the Commodore 64. Cursor up to those bytes and change them:
Press enter and type X on the next line to exit. Now try listing the program:
Great, that worked! Now you can remove line 0 and save this program to disk, and the next time the PET will load it to the correct location.
This program was written for the PET originally and will run with one minor change I made for the C64:
Change SC to 32768, which is where the start of screen memory ALWAYS is on the PET:
Run it
One more thing
If you’re pretty sure that the location the file is loading at is $0801
you can just:
NEW
0 REM
DLOAD"MAZEP54"
POKE 1025,1:POKE 1026,8
0
LIST