JCodeDescription
UWSW
13Start new line (PRINT ')
14Clear window to current attributes
15Wash window with current attributes8
●16; nSet INK n (where n=0 to 7)
●17; nSet PAPER n (where n=0 to 7)
●18; nSet FLASH n (where n=0 or 1)9
●19; nSet BRIGHT n (where n=0 or 1)9
●20; nSet INVERSE n (where n=0 or 1)
●21; nSet OVER n (where n=0 or 1)
×22; y; xSets cursor to pixel line y, character size column x. (AT y,x). Position is specified in terms of character positions (dependent upon the character size currently selected and whether reduced-height text is in operation. Double-width and double-height do not affect the coordinates, however)
×23; nLow; nHighTAB to (character sized) column n. This is a 16bit number so for column numbers smaller than 256, nHigh is always 0. Otherwise n is calculated as nLow+(nHigh*256)
●24; nSets ATTR n (Where n=0 to 255)10
×25; y; xLow; xHighChanges the print position to pixel coordinates x, y (0 to 511 and 0 to 191 respectively). Since we may be running at Layer 1,2 mode (HiRes) and the x position may be higher than 256 pixels (ergo a value larger than what a single byte can hold) it breaks the x coordinate into two byte components: xLow (0 to 255) and xHigh (0 to 1). For horizontal resolutions up to 256 pixels, xHigh is always 0 while for resolutions > 256 pixels it may be 0 or 1. The x coordinate is calculated as (xLow) + (xHigh*256)
●26; nAuto-pauses every n character lines. After each n character lines have been scrolled out of the window, output will automatically pause until the SPACE key is pressed (the bottom right character in the window will be flashed to indicate SPACE is being waited for).
After a window has been cleared, the first pause occurs before any lines have been scrolled out; subsequent pauses wait for n character lines. Typically you would want to set n to the height of the window. If set to 0 (the default), auto-pause is disabled.
●27; nFills window with character n. Attributes and cursor position are affected.
×28; nSets double width (where n=1) or normal width (where n=0)
●29; nSets height n (0=normal, 1=double, 2=reduced, 3=double reduced) – See Chapter 14 for details
30; nSelects justification mode n where n is 0=Left Justified , 1= Fully Justified and 2 =Centre JustifiedChanges the current character set width to n (can be 3,4,5,6,7 or 8 pixels), and moves the cursor to the start of the next line.
31; nSelects whether embedded codes are permitted (1) or not (0) in justify modeCauses the size n character set to be replaced with the character set defined by the CHARS system variable.

Table 21– Window control codes

In the table above on the column marked as J an × means ignored if issued in justified mode and an ● means code can be used in justified mode only if the "embedded codes" setting has been enabled. For control codes normally ignored in justified mode, note that these will still be taken into account if you set them before entering justified mode.

User character sets

If the default character set(s) are replaced using control codes 2, 3 or 31 in a system window, any subsequent text printed in any window (which doesn't have its own user-defined character set) will use the new character set(s).

The system-defined character sets are partially shared: sizes 3 and 4 use the same set (only the leftmost 3 pixels are used for size 3), and similarly so do sizes 5 and 6. This should be borne in mind when replacing system character sets using control code 31.

8 Has no effect on Layer 2 or LoRes 9: Ignored unless in Standard or HiColour modes and EnhancedULA is not enabled 10: Ignored in LoRes, Layer 2 and HiRes modes


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.