NEW

From C64-Wiki
Jump to: navigation, 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 at the Commodore 64.

Typ: Command
General Programming-Syntax: NEW

The BASIC command NEW releases the whole BASIC RAM and the stack of the C64. This way, BASIC program that eventually was stored in the memory will be 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 makes not much sense.

You should use NEW before writing a new BASIC program, because old program code can conflict with the new BASIC code and complicate debugging (eliminating program errors).

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