Personal Computer News


No More "No Room" Messages On The BBC

 
Published in Personal Computer News #077

No More "No Room" Messages On The BBC

The four pseudo-variables HIMEM, LOMEM, TOP and PAGE give the BBC user information on the available memory allocation. So the user program size is TOP-PAGE and the screen memory extends from HIMEM to &7FFF. LOMEM defines the bottom of 'spare' RAM and is usually the same as PAGE.

The problem is that the 'spare' RAM given by (HIMEM-LOMEM) is partially occupied by the variables and hence is not truly spare.

The pointer to the address where the next variable is to be stored is stored in zero page locations 1 and 2 in high byte, low byte format.

Therefore the amount of RAM used by the variables is given by:

(256*?1+?2)-LOMEM

and the truly free RAM is given by:

HIMEM-(256*?1+?2)

Note that since variables are assigned as they are encountered in the program, this computation is only valid if the whole program is run first.

It then shows how much space is available for program expansion or additional variable declarations.

David Abbott
Horsham, Sussex

David Abbott