NEW

From C64-Wiki
Jump to navigationJump to search
BASIC keyword
Keyword: NEW
Abbreviation: (none)
Type: Command
Token code: 162/$A2
Handling routine
in BASIC ROM:
42562–42589
$A642–A65D
List of all BASIC keywords


Remark: This article describes the BASIC command NEW in BASIC V2 of the Commodore 64.

Typ: Command
General Programming-Syntax: NEW

The BASIC command NEW releases the whole BASIC RAM and the stack of the C64. Using the NEW command results in the BASIC program that was stored in the memory being deleted.

NEW can be used in programs, but after executing NEW, the program ends by being deleted. That is, using the BASIC command NEW in programs does not usually make much sense.

The command NEW should be used before writing a new BASIC program, because old program code can conflict with the new BASIC code and complicate debugging.

The NEW instruction will also reset the variable memory pointer, which makes it handy after modifying the start and end address of BASIC RAM. You will constantly be bugged with ?OUT OF MEMORY ERROR messages if the variable memory pointer is not set correctly, pointing outside the BASIC RAM. If this is the case, you may want to issue a NEW command and then start coding.

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