EasyManua.ls Logo

Radio Shack TRS-80 Model 100 - Page 121

Radio Shack TRS-80 Model 100
210 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Experiment
#4
Available Memory
The Model 100 has many other useful functions built into it besides square root,
tangent
and
arctangent. While some
of
these are mathematical in nature, others are
more general. For example, the
FRE
function lets you determine the amount
of
available memory and, indirectly, the amount of memory used by your BASIC
program.
To see how much memory you currently have available, type:
PRINT
FRE(0)
~
The number which is displayed, such as
28265
will depend upon several factors, including how much RAM is installed
in
your
Computer, how many files you have saved, and how large the current BASIC program
is. The argument (within the parentheses) used with the PRE function can be a
numeric constant, variable or expression. The PRE function will always return the
amount
of
available memory regardless
of
the value
of
the argument. To verify this,
type:
PRINT
FRE(10)
~
and you should see the same value displayed
as
before.
To determine the amount of memory used by a BASIC program, type:
PRINT
FRE(0)
~
before you begin typing your program. Then, after having typed it, type:
PRINT
FRE(0)
(ENTER)
again. This will print the amount
of
memory left or unused by your program. Finally,
subtract the amount you obtained initially from the amount of memory after the
program was typed. The number obtained is the number
of
bytes used by the program.
Experiment
#5
String Space
The PRE function may also be used to determine the amount of memory available to
store strings. Type:
PR
I
NT
FRE
( "
II
)
CEJIT.EID
and
you should
see:
256
which indicates that 256 bytes
of
memory have been allocated for the storage
of
strings. The PRE function will return available string space if the argument
is
any
string constant (such
as
the null
string'"
'), string variable, or string expression.
Verify this by typing:
PRINT
FRE
("ABC")
CE8.LEID
115

Other manuals for Radio Shack TRS-80 Model 100

Related product manuals