Determining BASIC Base Address

Por BiFi

Enlighted (4348)

Imagen del BiFi

08-05-2004, 18:49

In this thread flyguille explains a few things the BASIC interpreter does to do a RENUM. This brought me to the following:

When saving a tokenized BASIC program it also saves the addresses it uses to point to the beginning of the next line. It's possible to change the BASIC Base address using:

POKE &HC000,0
POKE &HF676,1
POKE &HF677,&HC0

which changes the pointer from the default &H8000 (on MSX computers with at least 32 KB RAM) to &HC000 (which is the default for 16 KB RAM MSX computers).

I've been trying to figure out how BASIC determines the BASIC Base for that program to changes the addresses to the (newly set) BASIC Base on that computer. I haven't found the method yet, but maybe someone else already found out how things are done?

Login sesión o register para postear comentarios

Por flyguille

Prophet (3028)

Imagen del flyguille

08-05-2004, 19:15

one thing is the base address of all the basic program and other the current line number base address

It use diferent variables.

That base address of all the program is use on the RUN or LOAD "",R or CLOAD "",R commands TO:

so , the value in F676-7, (value +1), is used to set the variable "base address of the next line number to execute", and also the interpreter set a variable that say "which is the line number of that base address", so, if got a error, the ERL variable is set with that value. AND then run the basic engine......well, not forgot all events verifications done on each change of line number.

Well, i remember that, now, i got a lot of note of that when i dissasemble the basic interpreter 10 years before, because that i can't post more details...

Por flyguille

Prophet (3028)

Imagen del flyguille

08-05-2004, 19:19

because that , you can change the base address of all the program without bothering the executing of the current basic program.

I not remember if the GOTO or GOSUB will to work after you change the base address of all the basic program. I think no.