use two commas in a row.

There are two more kinds of PRINT items, which are used to tell the computer not what, but where to print. For example PRINT AT 11,16;"*" prints a star in the middle of the screen in Layer 0.

The modifier

AT vertical_position, horizontal_position

moves the PRINT position (the place where the next item is to be printed) to the vertical and horizontal position specified. Horizontal positions are measured in columns and vertical positions in rows however for layers other than Layer 0, the number of columns and rows varies according to the size of characters used (and for HiRes mode the horizontal resolution as well). Character sizes are set according to the previous section, however for AT usage purposes, we need to note that double-width and double-height character sizes do not modify the maximum columns and rows AT will accept as parameters, so if for example you use PRINT CHR$ 29; CHR$ 1 for characters that are 16 pixels high, you will still get a maximum of 24 rows for AT purposes.

You may have noticed at the beginning of this chapter that we discussed Layer 0 as being organised for character printing purposes, in a matrix of 24 rows by 32 columns. As you will see however when in Layer 0, NextBASIC will not give you access to the last two rows since, as we discussed in Chapter 1, the bottom two rows of the screen are reserved. This is also true for bitmap graphics commands as you will see in Chapters 17 and 18. We will expand further on the possible combinations for AT but for now give the command:

PRINT AT 22,31;"*"

and you will immediately receive error 5 Out of screen, 0:1. It's not difficult to understand why that happened. As we can see in Fig. 8 below, for the purposes of printing via NextBASIC1, your computer has a vertical resolution of 192 pixels. Since, as we learned in Chapter 13, each character is 8 pixels high, we can make a quick division and see that 192 ÷ 8 = 24. Knowing that the two last lines are reserved and not accessible to us, we can reduce our available rows by a further 16 pixels (or 2 rows) so we get a total 22 rows. As your computer starts counting from zero, 22 rows would go up to 21 as a value, which in turn explains why you received the error.

Rows on which we can place output using AT, are numbered therefore from 0 (at the top) to 21, and columns from 0 (on the left) to 31.

This situation changes when we change layers and go to the other two groups (remember that Layer 3 and the higher resolution Layer 2 sublayers are excluded). As discussed previously, columns and rows on these are calculated according to the width of characters that we have selected with the control codes. Before we illustrate graphically how the screen is organised, the following table will give you the possible combinations in columns per character width. Remember that you can also figure this out on your own by dividing the maximum resolution of the layer you're using by the selected character width.

Number of columns per Layer
Character
width
(in px)
LoRes
Layer 1,0
(128 x 96)
HiRes
Layer 1,2
(512 x 192)
Standard Res
Layers: 1,1–1,3 – 2
(256 x 192)
34217085
43212864
52510251
6218542
7187336
8166432

Table 6 – Column positions for PRINT according to character size

1 The maximum screen resolution of the ZX Spectrum Next is 320 x 256 pixels (or 640 x 256 half-width pixels), however these resolutions are only available to Layers 2,3 and Sprite Layers as we will see in the following chapters.


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.