1  RUN AT 3

NextBASIC Editor and Program support commands

NextZXOS provides a few direct commands, that allow NextBASIC programmers to control both the appearance as well as the flow of their programs. These are:

ERASE [first, last]

erases all lines between first and last (inclusive) keeping any variable intact. ERASE on its own deletes the entire program (still keeping all variables intact) and unlike it's parameter version, can be included in a program (see the autoexec.bas section below for an example).

LINE first, step

renumbers the program starting at line first using a predefined step. Let's assume a small program:

10 FOR f=1 TO 10
20 PRINT f,
30 NEXT f

If we now give:

LINE 2,3

The program becomes:

2 FOR f=1 TO 10
5 PRINT f,
8 NEXT f

It's obvious that we can pack as much "program" as we can in the amount of lines NextBASIC allows once our program is finalised. This should not be confused with the direct command

BANK n LINE first, last

which copies all lines in the main program between first and last to BANK number n. More on all bank-related commands can be found on Chapter 23.

LINE MERGE first, last

performs an even nicer optimisation to our typed programs, merging lines together to form a longer line, thus freeing lines for use. Assuming the program above, type:

LINE MERGE 2,8

the program then becomes:

2 FOR f=1 TO 10: PRINT f,:
  NEXT f

Obviously LINE MERGE makes our programs less readable but let's us pack them even more allowing for even more line numbers to be freed.

BANK n MERGE

copies a banked program back into the main program (more details on Chapter 23) erasing everything that's already there with the same line numbers. For example, in the above LINE MERGE example, EDIT line 2 to be also line 4 by going over line number 2, deleting it and replacing it with a 4. Then do the following:


ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.