GO64 & Preserve BASIC Program

Started by airship, October 29, 2007, 06:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

airship

Editing BASIC programs on the 64 side is a pain if you're used to the 128 side's 80-column screen and extra BASIC editing commands like RENUMBER and AUTO. But you can have the best of both.

Load or write and edit your 64 program in 128 mode. Make sure you don't use any BASIC 7.0 keywords. Keep it strictly legit BASIC 2.0.

When done, type GO64.

Once in 64 mode, type POKE 43,1:POKE 44,28.

This relocates the start of BASIC pointer to match the 128's start of BASIC location ($1C01). Type LIST and you'll see it there. You lose 5120 bytes (20 pages) of your C64 BASIC memory, but it's worth it in my book. Just use them for machine code routines. Or save your program, reset the 64 side, and load it back in.

I know, I didn't think it would be that easy, either. But it is.

(From Randy Thompson's "Programmer's Page" column on p.G-24 of the Gazette edition of Compute, Sept. 1993)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

Guest

QuoteOnce in 64 mode, type POKE 43,1:POKE 44,28.

This relocates the start of BASIC pointer to match the 128's start of BASIC location ($1C01). Type LIST and you'll see it there. You lose 5120 bytes (20 pages) of your C64 BASIC memory, but it's worth it in my book. Just use them for machine code routines. Or save your program, reset the 64 side, and load it back in.
C64 DOS and C128 DOS will ignore the load address on the disk file and will always load to the start of basic ($1C01 C128 or $0801 C64). You can load a basic program on the C128 side, written and saved in C64 mode and it will load to $1C01. If it doesn't have any PEEKs and POKEs in the program it will run.

If you write a basic program in C128 mode and use only BASIC 2.0 commands then DSAVE the program, the load address on disk will be $1C01. GO64 and load it like a basic program (LOAD"program",8), it will load to $0801 and run.

A basic program will always load to the operating systems start of basic regardless of the disk file address.

QuoteWhen done, type GO64.
Airship, the only advantage to your way that I can see is to give the program a quick test run in the C64 mode. But make sure you save it before you GO64 or you will lose the program on the way back to the C128 mode. :)

Dan...

airship

Yep. I know how BASIC loading and saving works. This ain't my first rodeo, Dan. :D

It's mostly just a curiosity. Like you say, you'd want to SAVE it sometime before you ran it, either in C128 or C64 mode. Using these two POKEs just saves you a LOAD when you get to 64 mode. But it does cost you some RAM.

However you could, just for example, set up some machine code, sprites, music tables, or screens on the C128 side, BSAVE them for later use, then GO64 and run your BASIC program that makes use of them without having to load all the various chunks.
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine