--- title: "AUTOLINE" id: 71151 type: "computer_media" slug: "autoline" url: "http://localhost/computer_media/autoline/" markdown_url: "http://localhost/computer_media/autoline.md" published_at: "2026-08-30T23:00:40+00:00" modified_at: "2026-08-30T23:00:40+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/08/autoline.png" alt: "AUTOLINE screen" excerpt: "A machine code utility that hooks into the BASIC editor to provide configurable automatic line numbering, activated and deactivated via USR calls." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Programming" slug: "programming" taxonomy: "genre" url: "http://localhost/type/programming/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/AUTOLINE%20%28198x%29%28-%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/08/autoline.png" alt: "AUTOLINE screen" media_type_tags: "Programming" --- # AUTOLINE AUTOLINE is a machine code utility that automates line numbering in the BASIC editor, modifying the TS 2068’s line-number increment behavior. The machine code block of 250 bytes is stored starting at address 65024, just below the top of the standard 48K RAM. Three key addresses are documented in the BASIC loader: POKE 65192 sets the step value between auto-generated line numbers, RANDOMIZE USR 65120 activates the routine, and RANDOMIZE USR 65124 deactivates it. The program saves itself in two parts — a BASIC loader and a separate CODE file — allowing the machine code to be reloaded independently of the BASIC program. The CLEAR 65024 in line 110 protects the machine code area from being overwritten by BASIC’s memory manager before the CODE file is loaded. *** ### Program Structure The listing is a self-contained loader/installer for a machine code routine. It operates in two logical phases: 1. **Information display (lines 10–60):** Prints usage instructions and waits for a keypress via `PAUSE 0`. 2. **Installation (lines 70–80):** Calls `RANDOMIZE USR 65024` to execute the machine code, then halts. Lines 90–100 handle the two-part save process, and line 110 serves as the bootstrap entry point used when loading from tape — it sets up protected RAM, loads the machine code, and restarts the display loop. ### Memory Layout | Address | Purpose | | --- | --- | | `65024` | Start of machine code block (entry point / installer) | | `65120` | USR address to activate auto-line numbering | | `65124` | USR address to deactivate auto-line numbering | | `65192` | POKE target: configures the line number step value | | `65024 + 250` | End of machine code block (250 bytes total) | Placing the code at 65024 puts it near the very top of 48K RAM, well above the typical BASIC and variable area, minimizing interference with user programs. ### Save and Load Strategy Line 90 saves two separate files: a BASIC autostart file (`AUTOLINE` with `LINE 110`) and a raw machine code file (`autoline C`) covering the 250 bytes from address 65024. On reloading, line 110 issues `CLEAR 65024` before `LOAD "autoline C" CODE`, which raises `RAMTOP` to protect the target address range from BASIC. This is the standard safe-load idiom for machine code residing in high RAM. ### Key BASIC Idioms - `PAUSE 0` at line 60 halts execution indefinitely until any key is pressed — an efficient keypress-wait without polling `INKEY$`. - `RANDOMIZE USR 65024` at line 70 calls the machine code entry point; the return value is discarded by `RANDOMIZE`, making it a clean way to invoke Z80 code without requiring a function-like return value. - The `REM` at line 10 uses embedded character codes (`\{20}\{1}` and `\{20}\{0}`) to switch ink colors within the remark, providing a styled title without affecting program logic. ### Machine Code Block The 250-byte machine code block is entirely external to this listing (saved as `autoline C`). From the documented addresses, the block contains at least three distinct entry points: the installer at 65024, an activate hook at 65120, and a deactivate hook at 65124. The POKE address at 65192 (168 bytes into the block) holds the configurable step value, suggesting it is a single byte used as an immediate operand or a data cell read by the line-increment routine. The routine most likely patches the ROM keyboard handler or editor loop to inject incremented line numbers automatically when the user starts a new BASIC line. ### Anomalies and Notes - Line 80 and line 100 both contain `STOP`, acting as clear barriers between the run-time and save-time sections of the program, preventing accidental fall-through into the `SAVE` commands during normal operation. ## Source Code ``` 10 REM \{20}\{1}AUTOLINE\{20}\{0} 20 PRINT "POKE 65192 WITH STEP REQUIRED" 30 PRINT "RANDOMIZE USR 65120 TO TURN ON" 40 PRINT "RANDOMIZE 65124 TO TURN OFF" 50 PRINT "NOTE THESE NUMBERS AND PRESS ANY KEY WHEN READY" 60 PAUSE 0 70 RANDOMIZE USR 65024 80 STOP 90 SAVE "AUTOLINE" LINE 110:SAVE "autoline C"CODE 65024,250 100 STOP 110 CLEAR 65024:LOAD "autoline C"CODE :GO TO 10 ```