Loading a VIC-20 datasette program on a PET?

Discuss anything related to the VIC
Post Reply
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Loading a VIC-20 datasette program on a PET?

Post by ral-clan »

Hi,

I'm trying to transfer a simple BASIC program I wrote and saved on my VIC-20 and datasette into a PET 8032.
The pet will load it, but after loading it acts like there is "nothing" there.

i.e. a LIST shows nothing.

I am pretty sure because this is because of a different between the memory pointers. I found these instructions online to transfer C64 datasette programs to PET:
Type NEW (on PET) to clear any old programs
Enter 0 REM
LOAD in the program you want to convert
When loaded, enter the machine language monitor by entering "SYS 1024"
Display the first part of the BASIC by typing: "M 0401 0408"
Now change the line-link to the memory location of the program to be moved; use cursor keys to move up and change the first two two-digit numbers to read: :0401 01 08 00 00 8F 00 00 00
Press return to change the bytes then enter "X" to exit the monitor.
Type LIST, you should see the 0 REM followed by the program.
Enter 0 to delete line 0 which will move the BASIC to its proper place.
Save the program.
Although I can do all the steps, this doesn't work for me.
When I type LIST I something very similar to:
0 REM +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Maybe the VIC-20 has a different memory pointer for it's programs.
Does anyone know how to do this?
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Loading a VIC-20 datasette program on a PET?

Post by ral-clan »

Found the answer here:

http://www.portcommodore.com/dokuwiki/d ... _on_my_pet
Load Addresses for BASIC files:
Start of BASIC
Saved Using
Computer Model/configuration load addr. dec. load addr. hex. change bytes to:
PET/CBM 1025 $0401 N/A
VIC-20 unex. 4097 $1001 01 10
VIC-20 +3k 1025 $0401 N/A
VIC-20 8k+ 4609 $1201 01 12
Commodore 64 2049 $0801 01 08
B-128 0003 $0003 +
Plus/4-C16 4097 $1001 01 10
Plus/4-C16++ 8193 $2001 01 20
C128 mode 7169 $1C01 01 1C
C128 mode++ 16385 $4001 01 40
The number needs to be :0401 01 10 00 00 8F 00 00 00 for a program written on an unexpanded VIC-20.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: Loading a VIC-20 datasette program on a PET?

Post by eslapion »

Doesn't automatic relocation work on the PET ?

The reason why the default LOAD procedure on the VIC-20 is on the datasette and relocates the code to the start basic address (LOAD vs LOAD"filename",1,1 ) is to accommodate for the fact a BASIC program can work on a VIC with no expansion, with 3K expansion or with 8k or more expansion, all 3 cases cause the start address to be different.

If you absolutely want the code to be saved with the same BASIC start address, use the 3K RAM config on the VIC-20.
Be normal.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Re: Loading a VIC-20 datasette program on a PET?

Post by Boray »

Shouldn't LOAD"",1,0 work then?
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
sjgray
Vic 20 Hobbyist
Posts: 115
Joined: Thu May 03, 2007 6:46 pm
Location: Markham, ON, Canada

Re: Loading a VIC-20 datasette program on a PET?

Post by sjgray »

eslapion wrote:Doesn't automatic relocation work on the PET ?

The reason why the default LOAD procedure on the VIC-20 is on the datasette and relocates the code to the start basic address (LOAD vs LOAD"filename",1,1 ) is to accommodate for the fact a BASIC program can work on a VIC with no expansion, with 3K expansion or with 8k or more expansion, all 3 cases cause the start address to be different.

If you absolutely want the code to be saved with the same BASIC start address, use the 3K RAM config on the VIC-20.
No the PET does not relocate on load. Another reason we need a relocating loader on the VIC/64 is because the disk drives use the PET load address for the directory listing when you LOAD"$",8 (try LOAD"$",8,1 and see! ;-) )

Steve
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: Loading a VIC-20 datasette program on a PET?

Post by eslapion »

sjgray wrote:No the PET does not relocate on load. Another reason we need a relocating loader on the VIC/64 is because the disk drives use the PET load address for the directory listing when you LOAD"$",8 (try LOAD"$",8,1 and see! ;-) )

Steve
That's a bummer!

Then AFAIK, the VIC-20 BASIC start address becomes the same as the one on the PET if you use a 3K RAM expansion. Would saving a BASIC program with this type of expansion fix the issue ?
Be normal.
sjgray
Vic 20 Hobbyist
Posts: 115
Joined: Thu May 03, 2007 6:46 pm
Location: Markham, ON, Canada

Re: Loading a VIC-20 datasette program on a PET?

Post by sjgray »

Yes, there are many ways to accomplish this. If the VIC (via 3K expansion) has the start of basic pointer set to the same address that the PET uses, then loading a PET program on the VIC will relocate it, and saving it back will save it with the new start address. You can modify the start of basic pointer on the VIC or PET as well (provided there is memory where you need it to go and it doesn't conflict with something else), and THEN load the file. Or you can use a disk editor to (say Disk Doctor on the PET) change the load address of the file to what the PET needs. And, you can do the "1 REM" line and POKE thing to change the line link pointers like previously mentioned (but I think this method is the hardest).

Steve
Post Reply