I have a vague recollection from my earliest days that the ZX80 only shipped with 1K of RAM.

If this RAM was used to store both the program and the contents of the 32x24 screen, wouldn't that mean only about 256 bytes were available for programming?

Or was there some trick used for video memory, such as a separate section of memory dedicated to the screen, apart from the advertised 1K RAM?

2 Answers 2


Both the ZX80 and the ZX81 had a variable-size display file (DFILE). They didn't store the complete screen contents, but rather only the characters per line up to a terminating newline. This collapsed DFILE is activated when the ZX detects less than 3 1/4kB of memory on startup. A collapsed DFILE can thus be as small as 24+1 bytes (initial HALT, 24 NEWLINEs, or HALT instructions) for an empty screen.

Because ZX-80 and ZX-81 "execute" the DFILE in the display output routine as NOPs, the terminating newline character has to be the opcode of a HALT instruction (76h). This stops the CPU fetching bytes from the DFILE and makes it internally execute NOPs until interrupted (which happens at the end of each scanline, 8 times per character line). The video hardware simply generates white space pixels for the rest of the line.

This results in much less screen memory used than the 768 bytes you would otherwise need for a full screen, at least if you did not fill the complete lines with 32 characters.

Here is a detailed description of how this works (on Grant Searle's great Z80 pages).

  • 5
    Wow, Grant has way too much time on his hands :-) That's an impressive set of pages, I especially liked the "how to build your own complete zx80/zx81/ace" stuff. The execution of the display file is rather bizarre ...
    – user6464
    Commented Oct 15, 2018 at 13:35
  • 5
    @paxdiablo bizarre is not the proper term, IMHO. Ingenious fits it better.
    – tofro
    Commented Oct 15, 2018 at 13:49
  • 2
    @tofro yeah, I've written one of only two emulators that score 100% timing accuracy to a real ZX81, I was just trying to keep it simple by sticking to the thing already being discussed. I don't think IX is involved though — probably you meant I, which contributes the top 8 bits of the refresh address and therefore the top 7 bits of the character lookup address? Nowhere near as good as Grant Searle's documentation, but my hardware summary is at github.com/TomHarte/CLK/wiki/The-ZX80-and-ZX81
    – Tommy
    Commented Oct 15, 2018 at 14:54
  • 2
    The Atari 2600 Basic Programming cartridge manages to go one better than this--it generates a line of text from the tokenized source, then displays it, generates another line of text using the same buffer, displays that, etc.thus avoiding any duplication between memory used to store a tokenized program and memory used to display it as text.
    – supercat
    Commented Oct 15, 2018 at 15:33
  • 1
    @supercat but then again, re: "better", a program running on the ZX80 and ZX81 can output anything it wants over the whole screen, subject to available memory, whereas I think the Atari BASIC offers only two lines out of twelve for your own output? Which, admittedly, is still a superhuman feat with only 128 bytes of RAM.
    – Tommy
    Commented Oct 15, 2018 at 15:48

It did not (at least not without ugly tricks). In addition to tofro's answer, a simple program at ZX-81 looking something like this (writing from memory):

10 FOR Y=1 TO 24
20 FOR X=1 TO 32

... was enough to achieve Out-of-memory error, because there was not enough room in memory for this measly program, system variables and a full display.

  • 2
    Seems to be not true. At least not on ZX80 on this emulator nocanvas.zame-dev.org/0004
    – UncleBod
    Commented Oct 16, 2018 at 9:36
  • 4
    @UncleBod are you able to show the code you ran? The ZX 80 does not have an AT, like the ZX Spectrum does and like Edheldil's code shows. Commented Oct 16, 2018 at 11:15
  • I guess just PRINT "X"; would achieve what the author is trying to communicate?
    – Tommy
    Commented Oct 16, 2018 at 12:20
  • 1
    ZX81 1K Chess only used 8 lines of the display for the same reason discussed here. I would guess the ZX80 emulator you used was set up to have expanded RAM. Sinclair sold a 3K RAM pack for it, but the initial machine came with only 1K. It could not store a full screen of characters.
    – Greenaum
    Commented Sep 17, 2019 at 4:56
  • 2
    I remember on my old 1K ZX80, as I typed in more and more program, it would seem to lose more and more of it from the end, "eating" its way from the bottom of the screen upwards. Presumably because the DFILE had to be sacrificed for the actual program. And ISTR the 3K expansion pack (when I finally got some money together as a poor student) was very flaky, prone to reboot as the slightest tremor. I'm pretty certain it was a good idea to leave the room if you had to cough :-)
    – paxdiablo
    Commented Feb 28, 2022 at 0:22

You must log in to answer this question.