CLEAR
This page was last modified 20:18, 1 July 2019 by NYYRIKKI. Based on work by Mars2000you and Gdx and others.

Contents

Effect

Clears the contents of all variables, including functions defined with DEF FN, and all dimensions of arrays, sets all numeric variables to zero, all strings to null and closes all open files.

Optionally reserves a specified number of bytes for storing string variables in a program and/or defines the highest memory location that may be used by MSX-BASIC. After execution, you can check the result of the first parameter with PRINT FRE("") and the new available free space memory for MSX-BASIC with PRINT FRE(0).

Syntax

CLEAR[<strings area>][,<upper address>]

Parameters

<strings area> is the amount of bytes to be reserved for storing string variables. (200 by default)

<upper address> is the highest memory location that may be used by MSX-BASIC. This address can vary between 831Fh and F380h. It is stored into variable system HIMEM (FC4Ah).

Example

CLEAR 300, &HC000

PLEASE NOTE: MSX1 has a bug that allows string space to be exceeded by a byte. This problem can be fixed by adding another CLEAR-command without parameters after the actual CLEAR-command.

Related to

DEF FN, DIM, END, ERASE, FRE, MAXFILES, NEW

Compatibility

MSX-BASIC 1.0 or higher