How to crunch basic programs

Discuss anything related to the VIC
Post Reply
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

How to crunch basic programs

Post by nbla000 »

Sometimes for big basic programs i will to crunch them using Pucrunch.

So this is my work:
LOAD"BASICPRG1",8
SAVE"BASICPRG2",8,1 (so Pucrunch know the exact load Address)
using Star Commander i copy the BASICPRG2 to Pucrunch Folder

command on a DOS box:
pucrunch BASICPRG2.PRG BASICPRG3.PRG -c20 -x0xc871

$c871 (SYS51313) Perform [RUN] but don't work

?UNDEF'D STATEMENT
ERROR

but if you type RUN + [RETURN] again the program start
so you must type RUN 2 times to start the crunched version

there is a SYS that do a RUN command or which execution address is necessary for basic unexpanded/3k/8k+ programs?
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

perform RUN from ML

Post by Mike »

You need to perform the following calls:

Code: Select all

JSR $C533 ;re-link BASIC program
JSR $C659 ;reset TXTPTR
JMP $C7AE ;handle next BASIC statement
See here.

If you have a fixed start of the BASIC program, you can omit the first JSR. Then you can embed this ML code (sans re-link) into your BASIC program as follows (I assume there's no expansion) :

Code: Select all

0 REMZZZZZZ

POKE4102,32:POKE4103,89:POKE4104,198
POKE4105,76:POKE4106,174:POKE4107,199
and specify 0x1006 as starting address.

Greetings,

Michael
Post Reply