Contents / Reference section / Previous chapter / Next chapter / Index
These four psuedo-variables give the programmer an indication of the way the computer has allocated the available memory. PAGE and TOP give the bottom and top of the user's program so
PRINT TOP-PAGE
can be used to find out how big a program is.
HIMEM gives the top of memory so
PRINT HIMEM-TOP
will indicate how much space is left.
When you run the program the computer will need some space to store variables so you cannot use up all the available memory just with your program.
In a Model B computer Random Access memory extends from location 0 to location 32767 (in hexadecimal that is &7FFF). RAM is normally allocated in MODE 7 as shown opposite. As the user enters more program so the program grows, increasing the value of TOP. Normally the computer stores program variables immediately above the user program but this can be changed by re-setting the variable LOMEM.
Again the computer normally expects to be able to use all the memory up to that set aside for the screen, but the user may move the position of the highest boundary by changing HIMEM.
The variable TOP is calculated by the computer on request. It does this by starting at PAGE and working through the program. The user cannot reset the value of TOP but can reset PAGE, HIMEM and LOMEM if needed for some special purpose.