If no character size is specified, the default is assumed which is 8 px wide. If a character set address is given, then this is used instead of the built-in fonts8; this allows you to use nice fonts such as those provided with art programs and adventure games.
The character size, has no bearing on the way the window is defined, but it does affect the number of actual columns you have available. For example, the following defines a window the size of the entire screen; but because a character size of 5 is specified, the number of characters that can be printed in the window at any time is 24 x 51:
OPEN #5,"w>0,0,24,32,5"
When outputting via PRINT to windows, you can use many of the same control functions as you can with the normal screen. For example: ' (apostrophe); start a new line, , (comma); start a new column, TAB, AT, POINT, INK, PAPER, FLASH, BRIGHT, INVERSE, OVER.
When first defined, windows are in non-justified mode, but they can be set to be left, full or centre justified. Note that in justified mode, some features and control codes cannot be accessed, so you may need to switch back to non-justified mode to use them.
A complete list of control codes follows in the table below; these codes can be sent to a window using PRINT followed by the CHR$ function as we've already seen in Chapter 14. Note that it's always preferred to use standard PRINT, AT, INK etc commands instead of control codes when using windows as they're usually easier to use than their control codes counterparts. Below is a list of all control codes that can be used while outputting to a Window Channel's stream.
NOTE that wherever there are sequential numbers they must be given using semicolon separated CHR$ statements. For example:
PRINT CHR$ 29; CHR$ 2;
| J | Code | Description | |
|---|---|---|---|
| UW | SW | ||
| 0 | Turn justification off | Increases the current character set width (can range from 3 to 8 pixels), and moves the cursor to the start of the next line. | |
| 1 | Turn justification on | Decreases the current character set width (can range from 3 to 8 pixels), and moves the cursor to the start of the next line. | |
| 2 | Save current window contents | Causes the size 8 character set to be replaced with the character set defined by the CHARS system variable. | |
| 3 | Restore saved window contents | Causes the sizes 3 to 7 character sets to be regenerated | |
| 4 | Home cursor to top left | ||
| 5 | Home cursor to bottom left | ||
| × | 6 | Tab to left or centre of window (PRINT ,) | |
| 7 | Scroll window | ||
| × | 8 | Move cursor left | |
| × | 9 | Move cursor right | |
| 10 | Move cursor down | ||
| 11 | Move cursor up | ||
| × | 12 | Delete character to left of cursor | |
8 A font is a collection of a stylised graphical representation of characters . For the ZX Spectrum Next, this follows the 8x8 pixel matrix of the UDGs and it is exactly 768 bytes long (defining 96 characters in the 7-bit Sinclair ASCII series from 32 to 128). See Appendix A for a list of characters.
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.