Want to know?

Basic and Machine Language

Moderator: Moderators

Post Reply
Devlin
Vic 20 Amateur
Posts: 69
Joined: Sun Oct 16, 2005 8:46 pm

Want to know?

Post by Devlin »

Ok I have 16k Ram Expansion.
I made a program that only has 6777 bytes free.
So I did this
10 CLR:LOAD"ENGINE",8:RUN

Then second program works? So My question is this.
What is going on in my Vic-20.
Is it just loading a new program and writing it over the old program in memory?
Is this a safe thing to do.?
User avatar
Mike
Herr VC
Posts: 4832
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Want to know?

Post by Mike »

Both 'CLR' and 'RUN' are redundant, as a CLR is performed as you enter RUN to start this loader. Furthermore a RUN is executed on your behalf, as soon as the LOAD commands exits.

But the big problem is, that the pointer to the start of the variables (aka 'end of BASIC program'), 45/46, will not be adjusted! So, when the second program is started, and is longer than the first, the variables will scribble happily over your program.

...

No problem without solution ;)

Code: Select all

10 Q$=CHR$(34):PRINT"{CLR}LOAD"Q$"ENGINE"Q$",8"
20 POKE631,19:POKE632,131:POKE198,2
Greetings,

Michael
Post Reply