Classic Computer Magazine Archive COMPUTE! ISSUE 17 / OCTOBER 1981 / PAGE 138

Train Your Pet To Run VIC Programs

Lyle Jordan
Maple Grove, MN

Have you already wished for the capability to renumber your VIC program, or to get a print-out, or to save it on a disk?

This could be especially frustrating if you have a PET, a printer, and a disk sitting idly nearby.

Or how about satisfying the desire to "upload" your VIC program into a PET? This article will give you a couple of quick and easy ways to do just that.

The PET BASIC programs start to occupy memory at location 1025 decimal or $0401 hex. For the VIC, programs will start at 4097 decimal or $1001 hex. To make things compatible, start by putting a one line program into your PET (example: 1 REM). Now load your VIC program by typing "load". The VIC program will load just fine, but will have a starting location of $1001 hex and if you do a LIST, it won't show up at all. You will see only your one line program, 1 REM.

To get to the VIC program, you will need to change the forward linking pointers. This can be accomplished by doing a SYS 54386 (to get into the machine language monitor) and then by changing two memory locations.

First look at memory locations $0400 to $0407, by typing:

M 0400, 0407

The PET will display the following:

M 0400, 0407
.: 0400 00 07 04 01 00 8F 00 00

Next list memory $1000 to $1007 and see:

.M 1000, 1007
.: 1000 AA 18 10 0A 00 99 22 56

This display will vary depending on the first line of your VIC program. My first line was 10 PRINT "VIC-20".

Now you can change the ‘07’ and the ‘04’ at locations $0401 and $0402. You want this to point to the location of the first forward pointer of the VIC program, so the ‘07’ becomes ‘01’ and the ‘04’ is changed to ‘10’. Make the changes, press RETURN, and cursor down to the last line displayed, type ‘x’, and then press return again. When the PET gives the "READY", you are back in BASIC and can do a LIST. What appears is the one line, 1 REM, followed by the VIC program.

Having served its purpose, line one can now be removed, and the VIC program will be copied into the normal start of PET BASIC at location 1025 decimal or $0401 hex.

If you have The BASIC Programmer's Toolkit from Palo Alto IC's, this entire procedure can be replaced by simply activating the Toolkit, and typing "APPEND".

I will have a lot of use for both of these procedures. Some that come to mind immediately are such things as getting a VIC program listing on a PET printer, renumbering a VIC program, and compacting a program so as to make the best possible use of the VIC's 3.5K of memory. I hope that this simple procedure will prove useful to others.