Loads a ZX81 or TS1000 BASIC program directly from its original cassette and rebuilds it in memory as a TS2068 BASIC program that can be listed, edited and saved. Two machine-code blocks do the work: a 256-byte translation table at 44000 that gives the TS2068 equivalent of every ZX81 character code, and a 234-byte loader routine at 45000 that reads the ZX81 tape signal and converts each line as it arrives. To use it, enter CLEAR 43999, load both code blocks, type RANDOMIZE USR 45000 without pressing ENTER, cue the ZX81 tape to the silent gap before the program, then start the tape and press ENTER. When the 2068 reports OK, the converted program can be LISTed and SAVEd. The result is a starting point for conversion, not a program ready to RUN.
First Loader was written by David Ornstein and published in Syntax (v. 4, no. 12, 1983, pp. 14–18, with a follow-up in v. 5, no. 1, 1984). David Solly described a modified version in his article “Line Listing: BASIC2 and M-Script, a Surprise Combination” in the Ottawa chapter Timex Sinclair User Group newsletter, v4 n2 (September 1987); a scan of that issue is included. He used First Loader as the first step in turning TS1000 listings into ASCII text with Michael E. Carver’s Basic2 and Jack Dohany’s version of M-Script. The handwritten label reads “FIRSTLOADER 0-30 (3 times) / CLEAR 43999, LOAD ‘firstloadr’ code / LOADER 35-60 (3 copies)”. The tape holds three saves each of firstloadr (CODE 44000) and loader (CODE 45000), 1,250 bytes each; there is no BASIC on the tape.
Program Analysis
Program Structure
Each 1,250-byte block contains the working code followed by zero padding. The table occupies 44000–44255 and the loader routine 45000–45233. The printed listing builds the same two blocks from DATA statements: lines 50–80 POKE the table into 44000 onward, lines 400–430 POKE the routine into 45000 onward, and line 9070 saves the result with SAVE "Lpf1.C1"CODE 44000,1250.
Translation Table
The table is indexed by ZX81 character code, and each entry holds the TS2068 code to store. Space, punctuation, digits and capital letters map to their ASCII codes. The ZX81 functions RND, INKEY$ and PI (64–66) map to the TS2068 tokens 165–167, ZX81 NEWLINE (118) becomes the TS2068 end-of-line byte 13, and the keyword tokens from 193 upward map to the matching TS2068 tokens. In the table on this tape, the ZX81 graphics characters become TS2068 block graphics (128–143), inverse letters, digits and punctuation become their normal forms, and the ZX81-only tokens "", SLOW, FAST, SCROLL and UNPLOT become spaces.
Comparison with the Printed Version
The loader routine on the tape matches the DATA in lines 500–730 of Solly’s printed listing byte for byte. The table does not. It differs at 54 positions, and the differences are the three changes Solly lists in his article. His version uploads inverse letters as lower case and inverse space as @, represents each block graphic by the letter or digit of the key it is typed on, and turns "", SLOW, FAST, SCROLL and UNPLOT into !, [, ], % and & so they can be restored later with M-Script’s search and replace. The tape’s table has none of these changes, so it produces a TS2068 program with block graphics rather than text for M-Script.
Notable Techniques
- Table-driven translation: the routine adds each incoming ZX81 code to the table base (
LD DE,44000appears in the code) and reads back the TS2068 code, so changing the conversion only means changing table entries, which is how Solly made his version. - The ZX81 tape is read directly from the cassette port (
IN A,(254)), so no ZX81 is needed. - Embedded numbers carry over unchanged. The routine checks for the ZX81 number marker 126, writes the TS2068 marker 14 in its place and skips the five bytes after it, since both machines use the same five-byte floating-point format.
Potential Issues
- Keywords with no TS2068 equivalent (SLOW, FAST, SCROLL, UNPLOT and the
""token) turn into spaces in this version’s table. They aren’t flagged, so they have to be found and fixed by hand. - ZX81-specific
PEEK,POKEandUSRaddresses come across unchanged and won’t work on the TS2068. Solly’s instructions say the uploaded program is not designed to be RUN.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
