Dick Smith VZ200 Technical Reference Manual page 15

Personal colour computer
Table of Contents

Advertisement

Method 2: With this method of reserving space for a machine
language program, you create the required space in between the
end of the main BASIC program and the start of the VLT, by
shifting the VLT upward in memory.
This is simpler to achieve than Method 1, because all that is
required is to change the 'End of BASIC program/Start of VLT'
pointer stored in 78F9/A hex (decimal 30969/70). In effect, we
'fool' the BASIC interpreter into thinking that the BASIC
program is longer than it really is.
How do you work out the new value for this EOP/VLT pointer?
Probably the best approach is to PEEK at the value of the
pointer when your main program is loaded in normally, and then
add to this figure the amount you need for the machine language
routine -- plus a small amount (say 64 bytes) for safety margin.
Let's say you again want to reserve 128 bytes. First load in
your main BASIC program, then key in this command:
PRINT PEEK(30969) + 256*PEEK(30970)
The answer you get is the current value of the EOP/VLT pointer,
in decimal. In other words, it represents the actual end of your
BASIC program. So add say 192 to this (128 plus a safety
margin), to get the new EOP/VLT pointer value.
Say the value you get is 32800. Now find the decimal equivalents
of the high and low pointer bytes for this figure, by keying in
this line:
P=32800:PRINT INT(P/256), P—(256*INT(P/256))
The first number you get is the pointer high byte (in this case
128), while the second is the pointer low byte (here 32).
Obviously if you get a different value from 32800, key this into
the above line to get the corresponding values.
Now all you have to do is fit these values into a pair of POKE
statements at the very start of your main BASIC program:
1 POKE 30969,32 :POKE 30970,128
This line must be right at the start of your program, so that
the EOP/VLT pointer is moved before the program introduces or
uses any variables. Otherwise the variables would be 'lost'.
This method allows you to load, save and run the BASIC program
normally, without any prior preparation. Once you have loaded
the machine language program into the reserved space between the
BASIC program and its VLT, you can also save and re—load it
along with the BASIC program, automatically. This is because the
CSAVE and CLOAD routines use the EOP/VLT pointer to indicate the
end of the BASIC program.
Note that the 64—byte 'safety margin' allows for the small
increase in program length when you add line 1 above.
— 14 —

Advertisement

Table of Contents
loading

Related Products for Dick Smith VZ200

Table of Contents