I'm trying to write some programs from an old magazine that were specified to run on an ZX80/ZX81 but I'm using a Sinclair BASIC interpreter for the Spectrum.

Is there any significant changes in BASIC instructions for those computers?

  • 2
    – Tomas By
    Commented Apr 18, 2022 at 17:45
  • 1
    Some info here also.
    – Tomas By
    Commented Apr 18, 2022 at 17:55
  • 1
    So presumably you're only interested in changes that break backward compatibility? E.g. the ZX80 BASIC was integer only, but that shouldn't necessarily be a problem.
    – Tommy
    Commented Apr 18, 2022 at 19:06
  • 1
    @Tommy The lack of floating point could break stuff; consider (3/2) > 1. Commented Apr 18, 2022 at 22:11
  • 1
    @Tommy At the distance of 42 years, I would not bet my life on it, but I think I would remember if I had to pay for it. I suspect kit purchasers were slightly better treated, or maybe were (unsuspecting) Beta testers. I also think I got the upgrade before the ZX81 was released, so not a retro-fit for me. Commented Apr 19, 2022 at 23:00

3 Answers 3


Spectrum BASIC is a superset of the earlier BASICs (all the colour commands, etc), so pedantically the answer to the question is the title of the post is "yes, there are significant differences".

However, if you're asking whether a earlier BASIC program can be run on the Spectrum, the answer is mostly yes. Possibly the most notable changes are:

  • PLOT works differently on the earlier machines (where it functioned on a 64x44 grid) and the Spectrum (where it functioned on a 256x176 grid). If not corrected, PLOT statements will all end up in the bottom-left corner of the Spectrum's screen.
    • UNPLOT does not exist on the Spectrum; it can be emulated with PLOT INVERSE 1 or similar with the same caveats as for PLOT.
  • The Spectrum doesn't have FAST and SLOW mode (as it didn't use the Z80 to render the screen); just ignore those commands.
  • The Spectrum's character set doesn't have the half-tone graphics or the inverse characters which existed on the earlier machines:
    • The half-tone graphics can be emulated with UDGs
    • For output, the inverse characters can be emulated with embedded control codes in the output strings.
  • While the Spectrum's character set was very close to ASCII, the ZX81's character set was entirely custom. This will break anything which makes too many assumptions about the relations between the character set values (although 0 to 9 and A to Z are contiguous ranges in both sets so a lot of stuff will work).
  • The ZX80 had only integer math, while the ZX81 and Spectrum had only floating point math (in the sense that there is no way to force integer math). If a ZX80 program relied on the integer behaviour (e.g. for truncation - (X/4)*4) then you will need to scatter some INT calls in the ZX81/Spectrum code.

There was even a utility back in the day, ZX Slowloader, which emulated the ZX81's tape loading routine so ZX81 tapes could be loaded into the Spectrum.

  • I'm not as familiar with the ZX80's BASIC but I believe it was very similar to the ZX81's; please comment or just edit in any additional differences. Commented Apr 18, 2022 at 21:55
  • 2
    Because of lack of time, just as a comment: AFAIK the ZX80 BASIC has only integer numbers, while the ZX81 BASIC has only floating point numbers. Commented Apr 19, 2022 at 6:27
  • 1
    I believe the PLOT thing will plot things in the bottom-left corner, as Y coords where bottom-up. My 11-year-old self was really confused - I typed some PLOT-based ZX81 on my Spectrum, and couldn't figure out the point of those tiny drawings. Fun times!
    – Jonathan
    Commented Apr 19, 2022 at 7:14
  • 1
    One other minor tweak is that the ZX81 used a "quote image" token which displayed as "" in a listing but " when printed; the Spectrum allows you to insert a " in a string by simply doubling it.
    – Neil
    Commented Apr 19, 2022 at 11:04
  • There is also the SCROLL statement on the ZX81 -- the nearest equivalent on the Spectrum is POKE 23692,255: PRINT AT 21,0: PRINT
    – john_e
    Commented Apr 28, 2022 at 10:28

The Spectrum's character set was based on 7-bit ASCII. The main printing sets (20-7F) are nearly pure ASCII, the only differences are that 60="£" in Speccy, but "`" in ASCII, likewise 7F is "©" instead of DEL. My reference¹ shows 5C is "/" whereas ASCII has "\" but I think this may be a typo since 2F is also "/". The Speccy did, however, use the first 32 codes and all codes after 80 for its own purposes. 0D is mapped to ENTER, which matches with ASCII's CR. 80-8F are block graphics, 90-A4 are user-defined graphics and A5 to FF are the tokenised commands for BASIC.

The ZX80's character set has no relation to ASCII:² 00→space, 01→null string, 02-0B→chunky graphics, 0C-1B→"£$:?()_+*/=><;,.", 1C-25→"0-9", 26-3F→"A-Z", 40-7F (undefined) 80-BF inverses of 00-3F, D4-FF→tokens and some more punctuation.

Unfortunately I have no reliable copy of the ZX81 mappings. I've found the character code tables for the ZX81 between 007E and 01FB in the ROM.³ As pointed out by Tommy in a comment below, they are similar not quite identical, eg "<" is at 0x17 on a ZX80 but 0x12 in the ZX81 ROM.

Others have mentioned number representation: ZX80-integer only, ZX81-float only, Speccy-both. The ZX80 could not display a screen and calculate at the same time. The ZX81 had fast mode which was like the ZX80, and slow mode which used the NMI to interrupt calculations and display a screen before returning to calculate during frame fly-back. The Speccy used hardware to handle the screen.

¹Database Publications. The Complete Spectrum. Stockport: Database Publications, 1984. 004.165/SIN.

²Maunder, Bob, Terry Trotter, and Ian Logan. The ZX80 Companion. Second edition. Middlesbrough, England: Linsac, 1980. 004.165/SIN.

³Logan, I., and F. O’Hara. The Complete Timex TS1000 [and] Sinclair ZX81 ROM Disassembly. P.A. Cheddington, Leighton Buzzard, Bedfordshire: Melbourne House Publ, 1982. 005.265/SIN

  • From BASIC, the Spectrum's number representation is effectively always floating point; while it may have used a special encoding internally for small integers, there's no way to force e.g. 11/2 to return anything other than 5.5. Commented Apr 19, 2022 at 11:40
  • "There is an alternative [to floating point ] way of storing whole numbers between -65535 and +65535: (i) the first byte is 0, (ii) the second byte is 0 for a positive number, FFh for a negative one, (iii) the third and fourth bytes are the less and more significant bytes of the number (or the number +131072 if it is negative), (iv) the fifth byte is 0." Quote from Vickers, Steven John. Sinclair ZX Spectrum : Basic Programming. Edited by Robin Bradbeer. Cambridge: Sinclair Research, 1982. 005.265/SIN. This means that, say, 6/3 will yield integer 2 and not 1.9999 or similar.
    – user24174
    Commented Apr 19, 2022 at 12:59
  • 1
    I'm well aware of the short form and how it works, I've spent far too much time in my life stepping through Z80 code :-) Do you have an actual example of an actual published BASIC program which demonstrates different behaviour on the ZX81 and the Spectrum due to the lack of the the integer forms on the ZX81? I'm sure it's possible to construct a pathological one but this feels much more like a theoretical concern than a practical one. Commented Apr 19, 2022 at 13:10
  • Sorry, I went straight from the ZX80 to the Speccy, and then into machine code. I only got my ZX81 out of interest years later.
    – user24174
    Commented Apr 19, 2022 at 13:21
  • 1
    My memory is that the ZX81 character codes were the same as ZX80. Definitely not the same as the ASCII-based scheme used by the Spectrum. The change was probably in anticipation of ZX Interface 1 providing serial ports, and therefore access to modems. Commented Apr 19, 2022 at 16:25

Question is about translating ZX81 Basic to ZX Spectrum.

It's been about 40 years since I last did this from magazine listings, but the one thing that used to trip me up was not the bulk of the Basic listing but some POKEs and PEEKs. Or little bits of machine code to scroll screens or implement user defined characters etc, were common in ZX81 code

From memory, something like a peek of free RAM was different between the two, so that these didn't translate well without a cheatsheet of common peek/poke locations

You must log in to answer this question.

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