Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF

383 40 HIMEM, LOMEM, TOP and PAGE These four pseudo-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. Random Access Memory extends from location 0 to location 32767 (in hexadecimal that is &7FFF). RAM is normally allocated in MODE 7 as shown in the diagram.

As the user enters more program 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 resetting 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 . Note that in the ‘shadow screen’ mode, HIMEM always returns a value of &8000 (see chapter 42 for more details). 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. On a cassette system PAGE will be set to &0E00. On a disc system (DFS) PAGE would be &1900. On a system with an Econet interface (NFS) PAGE would be &1200. On a system with both disc and Econet interfaces fitted PAGE will be set to &1B00. If the Advanced Disc Filing System (ADFS) fitted, PAGE is &1D00. ADFS with DFS or NFS gives a PAGE value of &1F00, and ADFS with DFS and NFS gives a PAGE value of &2100.