MEM
Function I
Returns the amount of memory.
MEM performs the same function
as
FRE.
It
returns the number of
unused and unprotected bytes
in
memory.
This function may
be
used
in
the immediate mode
to
see how much
space a resident program occupies.
It
may also
be
used inside a
program
to
avert "Out of memory" errors. MEM requires no argument.
Example
PRINT
MEM
Enter this command
in
the immediate mode (no line number
is
needed). The number returned indicates the amount of leftover
memory; that
is,
memory not being used to store programs, variables,
strings, the stack, or not reserved for object files.
Sample Program
1610
IF
MEM
80
THEN
1630
1620
DIM
A(1Sl
1630
REM
PROGRAM
CONTINUES
HERE
If
fewer than
80
bytes of memory are left, control switches
to
another
part of the program. Otherwise, an array of
16
elements is created.
2-125