Personal Computer News


Commodore Basic Which Runs And Runs

 
Published in Personal Computer News #053

Commodore Basic Which Runs And Runs

Caution! Basic programs on the Commodore 64 which call for machine code files to be loaded like this:

10 LOAD "M/C",1,1
20 REM REST OF PROGRAM

will never work.

This is because, having loaded the machine code, Basic re-runs the program from the beginning, i.e. attempts to load the machine code again ad infinitum. A solution is to use the following.

10 C=C+1
20 IF C=1 THEN LOAD "M/C",1,1
30 REM REST OF PROGRAM

Similarly, a Basic program which loads another Basic program will be overwritten but the new Basic program will autorun.

S. P. Rodgers, Camden Town, London NW1

S. P. Rodgers