I've read that the BASIC of the Timex Sinclair 2068 is a superset of the BASIC of the Sinclair ZX Spectrum with a few extra keywords.

The extra keywords are: DELETE delete BASIC program lines, FREE reports free RAM, ON ERR for error handling, RESET which is used in combination with ON ERR, SOUND for using the AY-3-8192 chip, and STICK for getting the joysticks' states.

In RAM and in a saved BASIC program, the Spectrum like many BASICs uses a tokenized format where each BASIC keyword has a 1-byte token. Here's one website documenting the tokens. There are probably several others around.

Now I know that the TS 2068 has extra keywords, but I can't find any information on how they are encoded as tokens.

Now Sinclair BASIC is odd in that all keywords are also "characters" in the character set, but note that the tokens do not match the "ASCII" codes. As far as I can see, only two of the 2068's extra keywords are given character codes: STICK is character 0x7c where the Speccy has |, and FREE is at 0x7e where the Speccy has ~. This all probably has no bearing at all on the tokenization, so don't be confused.

  • 1
    Concerning "STICK is character 0x7c where the Speccy has |, and FREE is at 0x7e where the Speccy has ~": Where do you see the difference? 0x7c is the hex representation of |'s ASCII value, and 0x7e is the same to ~.
    – glglgl
    Oct 17, 2022 at 10:26
  • 2
    @glglgl: I think I just worded it poorly, something I always struggle with. On the TS2068 the | and ~ characters do not exist. As you know, the original Speccy like its predecessors had all its keywords as part of its character set. So STICK is character 0x7c instead of | being there and FREE is a character in the character set where ~ would be at 0x7e. The first thing I did was a little BASIC program to print out all the characters from 32 to 255 to see if the new tokens were there. Oct 17, 2022 at 15:25

1 Answer 1


I wrote a silly BASIC program that uses all the extra keywords and then looked in RAM starting at the address indicated by the PROG system variable.

I did this before I found decent information on decoding Speccy BASIC, but I think I figured it out correctly. By saving the file from the TS2068 and loading into a Speccy I found what the tokens would be and added that info in parentheses:

  • 0x7B ON ERR ({)
  • 0x7C STICK (|)
  • 0x7D BEEP (})
  • 0x7E FREE (~)
  • 0x7F RESET (©)
  • 0x0C DELETE (shows up as ? in program listing but I think that's indicating a syntax error rather than a literal ? character)

It seems odd that DELETE is not with the others. I wonder if there's a reason for that?

Answering myself: 0C actually represents the same "delete" you get by pressing shift-0 on the Speccy. The Speccy character set includes control codes some of which you can force into BASIC lines, such as changing INK and PAPER colours. This one would only be achievable by POKEing though. Though I did manage to get DELETE into a BASIC program, I had to fight the system a little to do so. I think it's intended to only be used directly at the commandline.

The standard ZX Spectrum BASIC keyword tokens, including the extra one for the 128k Speccys are all encoded between and 0xA3 0xFF so the extra ones are in separate regions from them. Interestingly, the extra keywords used by Spectrum Next BASIC do use the values immediately before the standard Speccy ones and do not clash with any of the TS2068 ones.

Answering myself: Although the standard Sinclair tokens do differ from the character codes, the TS2068 tokens for the new keywords other than DELETE all use the character codes of the symbols they replaced on their respective keyboard location. And in the case of the two keywords that appear in the character set, they also match the character code.

I did some Googling and couldn't find this already documented. So having it here might help somebody some day.

You must log in to answer this question.

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