NEW is a BASIC command to erase the current program and variables.
|Availability||Present in all original versions of BBC BASIC.|
|Syntax||BASIC I-V|| |
|Token (hex)||BASIC I-IV|| |
|BASIC V|| |
|Description||BASIC I-V|| Writes an empty program at |
|Associated keywords|| |
NEW erases the BASIC program currently in memory, as well as all non-resident variables, arrays and memory blocks. As a command it cannot be executed within a program.
NEW does not affect the resident integer variables
NEW has been entered by mistake, the program can be recovered with
OLD, provided no new programs have been
LOADed, lines entered or variables declared. The old variables, however, are permanently lost.
If there is no valid program at
PAGE, the user must enter
NEW before trying to type in a listing, otherwise the computer may crash searching for the end of the program.
The command writes the end-of-program marker, &0D &FF (6502/32000/ARM), &00, &FF, &FF (Z80/80x86/PDP), to memory at
PAGE + 2 (6502/32000/ARM) or
PAGE+3 (Z80/80x86/PDP) and the
DATA pointer to
PAGE. It then does a
CLEAR, resetting the heap head pointers and setting VARTOP =
-- beardo 19:26, 20 March 2007 (UTC)