Notes on the ZX80 Display File

Author(s): Sage Kring
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v3 n1 (Volume 3, Issue 1)
Date: January 1982
Pages: 8

Brook Mick‘s letter (Oct.81) recalls our early experience with our ZX80. We tried the exercise in the manual, p.24. In the 15th line, every character typed made another disappear from the screen! The answer appeared in an article by David Tebbit, reprinted in Sync.

This phenomenon is normal to unexpanded ZX80 RAMs, because of display file space limitations. Of the 1024 bytes (1K) of RAM, the ZX80 needs 40 to store system variables. It uses another 25 in the display file just to maintain a blank screen (the Linsac Companion, p.64), leaving 959 bytes for displayed and stored program lines, input and calculated variables, and computed output (display). The more you want displayed, the less RAM available for storage and execution; the more program and variables you want stored the less RAM available for display. The TV screen’s size limits also cut down on displayed information.

You ask the 1K ZX80 to rob Peter (display) to pay Paul (storage). To comply, it erases screen characters. When it nears the display file limit, the ZX80 subtracts bytes from the display file to store newly inputted characters (and erase ones on the screen). Already displayed characters disappear from the display file, but not from storage. RUBOUT removes the latest entries from storage, freeing bytes for the display file and lost characters reappear.

A similar thing occurs with a 16K RAM pack, but with worse consequences. Total RAM is 16384 (16 x 1024). Subtracting 40 bytes for system variables and 25 for display file leaves you 16310 bytes. The ZX80 expands its storage capacity, but not its display file capacity.

The TV screen gives 24 lines of 32 characters, including spaces, or 768 total “squares.” Since most keywords and characters occupy 1 byte, assume the screen holds 768 bytes. Input (program lines and prompt responses) uses far less of this maximum potential than does output. ZX80s permit only 14 full 32-character lines, plus a 15th line of about 10 (prompt response) to 18 (program characters) spaces for keyboard input. This gives you a maximum of 458 to 466 1-byte characters, including spaces.

If you pass this limit, the ZX80 makes room in the display file for more input by sacrificing its supplied cursors and the end quote in string prompt responses. It next removes bytes from the display file, causing screen erasure. For output of computed information, the ZX80 only needs the last screen line to print a run report, or error code. So an output display can fill 23 lines of 32 characters each (736 in all) and RUN successfully. If you ask for 737 characters, the program stops, giving error 5 (no more room on screen) having printed up to 736 1-byte characters, its maximum output at any time. On a 1K machine, the more program and stored variables, the less room in the display file.

A 16K RAM can also output 736 bytes at a time in a successful run, then stops with error 5. Until the program and all variables exceed 15583 bytes, the ZX80 won’t cut down this maximum display.

Input data also permits this maximum, but cursors and end quotes for strings (needed for acceptable input) use 2-3 of the total 736 screen spaces. To allow for the letter cursor, syntax marker in program input, and mandatory or supplied end quote, keep maximum input display in 1 program line or prompt response to 733 bytes or fewer. If you don’t, you won’t get an easily cured disappearing act as on the 1K machine. Instead, you’ll face an impasse with your ZX80 and have to pull the plug!