Apart from the palettes, sprite definitions4 themselves can be stored and exchanged through the use of memory banks. The command and its syntax to define either all 64 sprites at once (64 sprites of 256 bytes each equals a full bank of 16K) or some of them is:
SPRITE BANK b [, offset, pattern_no, number_of_sprites]
where b is the bank number holding the sprite pattern definitions, offset is the starting location in the bank where sprite definitions are stored, pattern_no is the starting pattern number that's defined by the command and number_of_sprites is the total number of sprites that are defined. If we store all 64 sprite definitions within a bank, then the command can be as simple as:
SPRITE BANK 14
which will load 64 sprite definitions from bank 14. Alternatively to load 32 sprite definitions starting with pattern number 4 from bank 15 offset 256 would require:
SPRITE BANK 15,4,256
Sprites and tiles (not to be confused with Layer 3 tiles) are closely related. As a matter of fact as we saw in Chapter 17, their main difference is that tiles are managed by software and not hardware, so it follows that NextBASIC provides similar commands to manage them at least memory-definition wise. The BANK commands related to tiles are TILE BANK to define the tiles themselves and TILE DIM to define the tilemap, that is how are the tile patterns organised. The syntax of the first is:
TILE BANK n
where n is the number of the base bank holding the tiles. If more are needed as defined by the tilemap, they will be taken from subsequent bank numbers (up to an additional 3 making a total of 4 banks assigned to tile definitions). The tilemap itself is also held in a bank and managed with:
TILE DIM n,offset, w, tile_size
which defines the tilemap in bank n, starting at location offset with width w which ranges from 1 to 2048 and tile size tile_size (8 for 8 × 8 pixels or 16 for 16 × 16 pixels).
The entire range of BANK commands for file management, has been covered in length throughout Chapter 21 – NextZXOS and alternatives so we'll just include them here for completeness and as a quick reference. As a general guideline for syntax, BANK does not need an offset and length for SAVE operations except the ones that deal with fixed areas. The commands that deal with files and their syntax are:
LOAD|SAVE|VERIFY filespec BANK n [,offset,length]
and the additional
SAVE|LOAD filespec LAYER
that are special shortcut commands to load and save the current layer display. This obviously includes bank access (as for example Layer 2 occupies 3 banks) and thus it's included here. In all the above, filespec is a valid filespec for the filesystem you're accessing, n is the bank number while the optional offset and length must be given together to signify the starting location and length of the data chunk we're manipulating. If omitted the entirety of the bank is used.
4 Although the ZX Spectrum Next's Sprite Engine can define and manipulate a total of 128 sprites, these only work with 4 bit palette definitions which are not supported by NextBASIC. Instead NextBASIC supports a total of 64 sprites of 256 colours each
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.