-
Notifications
You must be signed in to change notification settings - Fork 9
BASIC FRE Function
TYPE: BASIC System Function
FORMAT: FRE ( number )
Action: Returns the amount of RAM available to a BASIC program and its variables.
- In Aquarius BASIC and plusBASIC prior to v0.22y, the value of number does not affect the result (see below for more).
- Returns a [signed integer] (see below for other options).
- If a program tries to use more space than is available, Out of memory results.
Examples:
PRINT FRE(0)
Displays the current amount of memory available to BASIC
950 IF FRE(0)< 100 THEN PRINT "Not enough room":END
Displays message and terminates program if there is less than 100 bytes of available memory.
FORMAT: FRE ( string )
Action: Returns the amount of space available for string variables.
- Forces a garbage collection (removing all unused strings) before calculating the available space.
- The expression in parentheses can have any valid string, and it is not used in the calculation.
- If a program tries to use more string space than is available, Out of string space results.
Examples:
PRINT FRE("")
Displays the current amount of available string space
10 IF FRE("")<255 THEN PRINT "Not enough string space":END
Displays message and terminates program if there is less than 255 bytes of available string space.
plusBASIC v0.22y enhancement
FORMAT: FRE ( number )
- If number < 0, works as above, but always returns a positive number.
- It is preferable to use
FRE(-1)rather thanFRE(0).
- It is preferable to use
- If number = 0, works as above.
- If number = 1, returns the total size of string space (as set by the first argument of CLEAR).
- If number = 2, returns the top of BASIC memory (as set by the second argument of CLEAR).
- Any other numeric argument results in Illegal quantity.
To Search for pages in the wiki, press Pages above and type a search term in the "Find a page..." box. Results will update beneath automatically.
- Aquarius+ User Guide
- Quick Start
- Hardware
- Software
-
- plusBASIC QuickRef
- plusBASIC Programmer's Reference Guide
- plusBASIC Tutorials
- [plusBASIC Statement and Function Types
- plusBASIC Error Messages
- plusBASIC ASCII Table
- plusBASIC Glossary of Terms
- plusBASIC Optimization Examples
-
Other Development Resources