ZX Spectrum – System Variables

Browsing through the dead listings, you will see a lot of POKEs and PEEKs in the code. If the addresses are between 23552 and 23733, then these are known as System Variables.

The following are some of the more common ones you will come across when looking through a dead/extracted BASIC listing.

Change the Font (CHARS)

Memory addresses: 23606, 23607

This is only applicable if the game uses a different font. Examining the .TAP file for a binary file of (usually) 768 bytes that’s loaded after the main BASIC code. Check the listing and see if the addresses 23606 and 23607 are being manipulated and this gives it away that a new font is in town.

Normally these values are set to point to the system font in memory

POKE 23606,0
POKE 23607,60

To change them to a new font, you need to work out the address where your new character set is being stored and then do a quick calculation to get the correct values for the above addresses.

<Insert example from a game here>

Timer (FRAMES)

Memory addresses: 23672, 23673 & 23674

LET tmr = 65636*PEEK 23674 + 256*PEEK 23673 + PEEK 23672
LET tmr=tmr/50

tmr now has the number of seconds elapsed so far. Divide this again by 60 to get the number of minutes.

As a working example, Everest Ascent by Richard Shepherd Software would not let you save the game’s progress unless you had played it for 30 minutes or more! (1800 = 30 minutes in seconds)

9950 IF (65536*PEEK 23674+256*PEEK 23673+PEEK 23672)/50<1800 THEN GO TO 584

(Line 584 being the routine that prevented you from saving the game yet)

Prevent text causing screen scrolling message (DF_SZ)

Memory address: 23659

This system variable contains the number of lines in the lower section of the screen, normally used for INPUTs, error reports and so on.

POKEing 255 into 23659 would prevent the “Scroll? y/n” message from appearing at the bottom of the screen.

This was also used as a simple form of protection in BASIC games, as it prevented you from using BREAK to get back in and look around. Although MERGE”” got past that ‘protection’ back in the day.

Switching the speed at which a key press repeats itself (REPDEL)

Memory address: 23561

This has shown up in some text adventures and strategy games and the coders usually turn it off to prevent auto-repeat. The default value is 35, but POKEing 0 at this address would turn off the auto-repeat.

POKE 23561,0

If your tweaked or original code is going to quit back to the BASIC editor, I would include the POKE to turn it back to the normal value of 35 into your exit routine.

Back to ZX Spectrum – BASIC