The ZX Spectrum BASIC doesn't (ordinarily) let you print on lines 23 and 24 to allow for user input.

Is there a way around this? I found a fairly recent post that suggested I could POKE 16418,0 but testing this on both hardware and emulators it doesn't change anything.

This is my test code:

10 FOR a= 0 to 23
20 PRINT AT a,0;a
30 NEXT a

Which will end in 5 Out of screen (since it can't write to line index 22).

Or were these last two lines a pipedream for the 80s BASIC programmer?

3 Answers 3


POKE 16418,0 is for the ZX81, not the Spectrum - the equivalent system variable on the Spectrum is at 23659.

You need to take care when poking this address, as it's liable to cause a crash if the program exits (or displays a scroll? prompt) while the lower screen is disabled, but the following program demonstrates the principle:

10 POKE 23659,0
20 PRINT AT 22,0;"X"'"Y"
30 PAUSE 0
40 POKE 23659,2

For completeness, it's worth mentioning that the 'official' (and safe) way of accessing the lower screen is PRINT #0 (or equivalently PRINT #1), although that way you won't get direct control over PRINT AT coordinates.

10 PRINT #0;"hello world"
20 PAUSE 0
  • 1
    I like that there's an official way to print on those last lines, frustratingly they push the screen up by 1 line so I'm left with a blank line between (what I'd aim to be) line 21 and 22: imgur.com/E2PwrKV.
    – Remy Sharp
    Commented Mar 17, 2020 at 9:40
  • The first solution using poke seemed to work closer to what I was after, but I also needed to POKE 23692, 0 to hide the scroll message that I was getting (and restore it to 1 before my program ended).
    – Remy Sharp
    Commented Mar 17, 2020 at 9:41
  • Also mean to add that I love your work @gasman 👍 you bandersnatch work features at the end of a talk I give on JavaScript and ZX Spectrum screens
    – Remy Sharp
    Commented Mar 17, 2020 at 9:42
  • 1
    Even without POKE you could certainly PRINT #0;AT which would allow you to print on the entire screen, as long as you had a convenient point where you could split the printing, anywhere between 1-22 lines in the top half and 2-23 in the bottom half.
    – Neil
    Commented Dec 8, 2020 at 23:08

I don't know about the normal printing routines in ZX Spectrum BASIC, but you can directly access the screen memory using POKE from BASIC. You'll need to work out where to get the 8 bytes of bitmap data comprising the character, then POKE them into the 8 bytes (on a 256-byte stride) corresponding to the desired character cell.

According to this, the first row of line 23 (line index 22), column 1 would be at $50C0, or 20672 in decimal. So the following should fill that character cell with ink colour:

10 FOR a= 0 TO 7
20 POKE 20672 + 256 * a, 255
30 NEXT a

The corresponding attribute byte is at $5AC0, or 23232.


There's a good answer here, that uses the PRINT #1 technique I remember from back in the day:

PRINT #(1+(x<22));AT (x-(22*(x>21))),y;"*"

Stream 1 (#1) is the lower 2 lines of the screen, and stream 2 (#2) is the upper 22 lines. So this chooses the correct part of the screen to print in for the given y coordinate.

You can also turn this into a couple of functions to do things like:

 10 FOR y=0 TO 23
 20 FOR x=0 TO 31
 30 PRINT #FN s(); AT FN y(),x; "*"
 40 NEXT x
 50 NEXT y
100 DEF FN s()=(1+(y<22))
110 DEF FN y()=(y-(22*(y>21)))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .