After pressing ENTER, you'll be greeted by the NextZXOS Startup menu. Select NextBASIC and rewrite the line above by adding 16384,6144 at the end after the CODE to read:

LAYER 0: LOAD "test.scr" CODE 16384,6144

Amazingly, the Hello World! message reappears but this time colourless! Adding the two numbers after CODE instructed the computer to load the file in address 16384 (which is the start of Layer 0's graphics memory) but at a smaller length than the actual file we've stored, removing all the colour attribute information. Attempting to set a longer length than the size of the file we're loading, the computer will return an End of file, 0:1 message. Note here that doing just that is not a good practice and we should be using LOAD BANK, LOAD SCREEN$ and LOAD LAYER to load data into graphic memory.

As we saw in Chapter 11, one of the most tedious aspects of programming is to prepare arrays. They can involve endless typing via data statements and use a lot of program space which could otherwise be used for actual program logic. Thankfully NextBASIC gives us the option, after we've prepared an array, to save it to a file to be retrieved later, saving us both time and code memory. To load such prepared arrays we need to use the LOAD modifier DATA. This takes the form:

LOAD filespec DATA arrayname()

to load for example the array b() from Chapter 11 assuming we have already saved it as b-array.dat we'd only need to type:

LOAD "b-array.dat" DATA b()

This would find if any other array named b() was already stored in the computer's memory, erase it and replace it with the information provided in the file.

We can only load string and floating point arrays. Also of note is that the parentheses after the array name cannot be ommited.

Integer arrays cannot be loaded or saved with the DATA modifier. For that we need the following modifier INT.

LOAD filespec INT

will load previously saved integer arrays and variables. All arrays and integer variables will be initialised prior to loading and replaced with what is in the saved file. Additionally the INPUT modifier:

LOAD filespec INPUT

will load a previously saved definition of the keyboard joystick. See Chapter 14 and the INPUT function for more.

The final LOAD modifier BANK should be looked upon as a variant of the CODE modifier, as it basically loads raw data into memory in the bank number, offset in said bank and length (in bytes) we specify very much like CODE does. This takes the form:

LOAD filespec BANK number, [offset], [length]

Keeping with the example we have been using try:

LOAD "test.scr" BANK 5

will load and display the exact same screen, with the main difference that it will put it in offset 0 of bank 5. For reasons that will become clear in Chapter 23, this is exactly the same location as the one we used with SCREEN$ and therefore if you slightly modify the command to be:

LOAD "test.scr" BANK 5, 0, 6144

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.