Contents / Reference section / BASIC keywords / Previous letter / Next letter / Index


H

HIMEM highest memory location

Purpose

BASIC uses the computer's random access memory (RAM) to store the user's program, all the variables that the program uses, and memory for high-resolution graphics displays.

In the absence of other instructions the computer divides the available memory up in a sensible way. However there are occasions, particularly when changing display modes and when writing machine code programs, when you may wish to tell BASIC how to divide up the available memory.

One way of changing the allocation is by altering the value of the variable HIMEM. This variable contains the address of the highest memory location that BASIC uses for your program and variables. It is automatically set to just below the memory used for the screen when the MODE is selected. Addresses above HIMEM are not used by BASIC.

If it is manually altered then locations above HIMEM may be used by the programmer for other things, for example for machine code subroutines.

If you wish to change the value of HIMEM you should normally do so very early in your program - preferably right at the beginning. The beginning of the program is also the place to select the display mode that you will be using.

Other important boundaries are PAGE, TOP and LOMEM. The memory map on page 501 gives an indication of their relative positions.

Examples

100 HIMEM=HIMEN-40

100 PRINT HIMEN

100 HIMEM = &2800

Description

HIMEM contains the address of the first byte that BASIC does not use. This pseudo-variable must not be altered while executing a function or a procedure. Alter it with great care!

Syntax

HIMEM = <numeric>

or

<num-var> = HIMEM

Associated keywords

LOMEM, PAGE, TOP

Exit: BBC Microcomputer User Guide; Kasoft Typesetting; Archer


The BBC Microcomputer User Guide was written by John Coll and edited by David Allen for the British Broadcasting Corporation.

Optical character recognition and original formatting effort by Mark Usher.

HTML version maintained by: Kade "Archer" Hansson; e-mail: archer@dialix.com.au

Last updated: Monday 12th February 2001