here that if you're not using Layer 2, the banks it occupies CAN be used for other purposes including machine code programs. They just cannot be released.
Banks marked as in-use, remain reserved after a NEW command and are only released at a reset (or with this BANK n CLEAR).
BANK CLEAR reports A Invalid Argument, 0:1 if you try to clear banks 1,3,4 and 6 even if you have given the BANK 1346 USR command which is described below.
NextZXOS allocates 64K to the RAMdisk by reserving banks 1,3,4 and 6; BANK 1346 USR allows you to release these for use by your programs. Once you give the command:
BANK 1346 USR
the following things happen; first all files in the RAMdisk are deleted, then the drive itself is unmounted and using BANK commands on these banks stops producing errors. To undo this action and reinstate the RAMdisk you will need to use:
BANK 1346 FORMAT
which will erase the contents of these banks and re-attach them to the RAMdisk. The disk itself however will need to be manually mounted again by using the MOVE...IN command. See Chapter 19 for details.
Bank contents can be copied and erased in whole or in part using the BANK COPY and BANK ERASE commands.There's also a specific one that copies data quickly to and from the screen but we'll look at that separately. The syntax to copy bank data is:
BANK source_bank COPY [source_offset, len] TO destination_bank [,dest_offset]
where source_bank is a readable bank number to copy from while destination_bank is a writeable bank number. Source_offset and len signify the location within the source bank and the size in bytes of the memory chunk we're copying. If the latter are specified, then the dest_offset must also be specified. Let's try:
BANK 9 COPY TO 47
will copy the bank holding the first third of Layer 2 into bank 47 while,
BANK 1 COPY TO 47
will return A Invalid argument, unless BANK 1346 USR has been used!
BANK 9 COPY 8192, 8192 TO 47, 0
will copy the bottom half of the first third of the Layer 2 screen to the start of bank 47 (Once you untangle that tongue-twister you can see how this can create interesting blinds effects!).
It's also quite handy to quickly erase the whole or part of a bank (fill it with zeroes or an arbitrary byte value). This is accomplished by the BANK ERASE command whose syntax is:
BANK n ERASE [offset, len][,][value]
where n is the number of writeable bank, offset is the optional starting point of the erase and len is the length (in bytes) of the area to be erased. The optional value will fill the area with a byte of your choosing or – if omitted – 00h. Here are some examples using Layer 2 and an image present in your System/Next™ distribution (you will need to provide the image in 256 x 192 x 256 colour BMP format):
10 CD "ENTER HERE THE FOLDER"
20 LAYER 2,1
30 .bmpload yourfile.bmp
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.