Finding The Top Of Your Vz-200'S Memory - Dick Smith VZ200 Technical Reference Manual

Personal colour computer
Table of Contents

Advertisement

Method 3: This method of reserving space for a machine language
program involves changing the 'Top of Memory' (TOM) pointer so
that it points to an address lower than the actual top of
memory. This forces the BASIC interpreter to move its string
storage area and stack downward, leaving a space for your
machine language program at the top.
Like Method 2, this is quite easy to do and it can be done from
within your BASIC program.
First, you need to PEEK the current value of the TOM pointer.
This is found quite easily:
PRINT PEEK(30897) + 256*PEEK(30898)
This will normally give you 36863 for a basic VZ-200, or 53247
if you have the 16K Memory Expansion Module plugged in.
Then you simply subtract from this figure the amount of space
you want to reserve for the machine language program, to give a
new TOM address. Then it's simply a matter of poking the low and
high byte figures for this address into the TOM pointer, at the
start of your program.
For example, say you want to reserve 256 bytes, and you have a
basic VZ-200 so the normal TOM is 36863. So the new artificial
TOM will be 36863-256, giving 36607. To work out the two new
pointer bytes in decimal, type in:
T=36607:PRINT INT(T/256), T-(256*INT(T/256))
The first number you get is the pointer high byte (here 142),
while the second is the low byte (here 255). If you have a
different value for TOM (T), you'll get corresponding values.
Having found these values, all you need to do is add the
following line to the start of your program:
1 POKE 30897,255:POKE 30898,142
The pointer must be changed before the program uses string
variables and the stack, or the system could 'crash'.
Note that this method allows your BASIC program to be loaded,
saved and run normally. However it does not allow the machine
language program to be loaded directly into the reserved area at
the same time. The machine code must be loaded either
separately, or POKEd into the reserved area by the BASIC program
itself -- after the pointer is changed.
10. FINDING THE TOP OF YOUR VZ-200's MEMORY
This is quite an easy one -- simply type in the line:
PRINT PEEK(30897) + 256*PEEK(30898)
- 15 -

Advertisement

Table of Contents
loading

Table of Contents