CLR

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: CLR
Abbreviation: C Shift+L
Type: Command
Token code: 156/$9C
Handling routine
in BASIC ROM:
42590–42637
$A65E–A68D
List of all BASIC keywords


Remark: This article describes the BASIC-Command CLR in BASIC V2 at the Commodore 64.

Type: Command
General Programming-Syntax: CLR


The BASIC-Command CLR deletes all variables, arrays, data read in from data-lines, defined functions, return addresses of subroutines (see GOSUB) and variables of loops (see FOR and NEXT) by releasing the RAM previously allocated for those. Furthermore opened files of both diskette and datasette are gone, because the cache is also deleted.

Examples[edit]

10 A=64 : B$="COMMODORE" : C%=128
20 PRINT B$ A "AND " B$ C% ; FRE(0)+65536
30 CLR
40 PRINT : PRINT B$ A "AND " B$ C% ; FRE(0)+65536
0 POKE56,52:CLR:REM make some free space after the BASIC program area for sprite shapes, character shapes etc.
10 A$="":REM the above usage of CLR command MUST precede first variable use
20 POKE13312,8:REM this would be dangerous if BASIC program area was not limited in line 0 or CLR was omitted - program code would be overwritten
BASIC V2.0 (second release) Commands

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT