Sinclair ZX80 BASIC Maximum Program Line Length Explained
This article provides a definitive answer regarding the coding constraints of the Sinclair ZX80, specifically focusing on the maximum allowable length for a single line of BASIC code. Readers will learn about the 255-byte limit, how tokenization affects storage, and why this specification mattered for memory management on the early 1KB and 4KB home computers.
The 255-Byte Limit
The Sinclair ZX80, released in 1980, utilized a unique version of BASIC designed to operate within extremely tight memory constraints. The maximum length of a single program line in Sinclair ZX80 BASIC was 255 bytes. This limit included the line number, the tokenized command structure, any variables or strings, and the carriage return character that marked the end of the line.
Understanding Tokenization
To fit meaningful code into such a small limit, ZX80 BASIC employed a tokenization system. Common keywords like PRINT, GOTO, and FOR were stored as single-byte tokens rather than full text strings. While a user might type a long string of characters on the keyboard, the interpreter converted these into bytes immediately. Therefore, the 255-byte limit referred to the stored memory size rather than the number of characters visibly typed on the screen.
Memory Implications
With standard memory configurations of only 1KB or 4KB, every byte counted. A line reaching the maximum 255-byte length could consume a significant portion of the available RAM, leaving less space for variables and screen display memory. Programmers often had to balance writing concise, long lines against splitting logic into multiple shorter lines to optimize performance and avoid out-of-memory errors during execution.
Legacy and Comparison
This 255-byte restriction was carried forward to the successor, the Sinclair ZX81, maintaining compatibility between the two popular home computers. While modern programming environments allow for vastly longer lines, this constraint defined the coding style of the early microcomputer era, encouraging efficiency and brevity in software development for the Sinclair platform.