--- title: "Auto Answer" id: 56279 type: "computer_media" slug: "autoanswer" url: "http://localhost/computer_media/autoanswer/" markdown_url: "http://localhost/computer_media/autoanswer.md" published_at: "2024-08-04T10:49:46+00:00" modified_at: "2026-03-30T21:41:00+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/08/SCR-20240804-kpty.png" excerpt: "A hardware port-polling routine detects incoming telephone calls and waits for a persistent off-hook signal before triggering your own answer code." 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/" indiv: - name: "Randy Kuhn" slug: "randy-kuhn" taxonomy: "indiv" url: "http://localhost/indiv/randy-kuhn/" genre: - name: "Modem" slug: "modem" taxonomy: "genre" url: "http://localhost/type/modem/" media_contents: - id: 56277 title: "Timex Sinclair Public Domain Library Tape 2001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-2001/" media_type: "Program" programmers: - name: "Randy Kuhn" slug: "randy-kuhn" taxonomy: "indiv" url: "http://localhost/indiv/randy-kuhn/" download_url: "https://archive.org/download/timex-sinclair-software-archive/AutoAnswer%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/08/SCR-20240804-kpty.png" media_type_tags: "Modem" --- # Auto Answer This program implements an automatic telephone line answering detection routine using direct hardware port access. It monitors port 119 for line status changes, polling the IN 119 value and comparing it to 5, which represents an idle or on-hook state. A PAUSE 400 (approximately 7 seconds on a 50 Hz machine) is inserted between polls to allow for ringing cadence timing. When a non-idle state is detected and persists through two subsequent checks, the program falls through to a LIST command, which would typically be replaced by the user’s own answer-handling routine. *** ## Program Analysis ### Program Structure The program is short and linear, consisting of an initialisation phase, a polling loop, a timed delay, two further single-shot checks, and a terminal action. There are no subroutines; control flow is handled entirely by conditional `GO TO` branches back to line `10`. 1. **Lines 1–3:** REM header identifying the program and author. 2. **Lines 5–6:** Port initialisation — `OUT 119,34` followed by `OUT 119,0`. 3. **Lines 10–20:** Primary polling loop; reads port 119 and returns to line 10 while the value equals 5 (idle state). 4. **Line 30:**`PAUSE 400` — a delay of approximately 8 seconds at 50 Hz, allowing the ring cadence to develop. 5. **Lines 40–45:** Second single read of port 119; if still idle, restart the loop. 6. **Lines 60–65:** Third single read; if still idle, restart the loop. 7. **Line 70:**`LIST` — reached only when all three samples are non-idle, acting as a placeholder for user-defined answer logic. ### Hardware Interface Port 119 (decimal) is used for both output and input, indicating a hardware peripheral — most likely a modem or telephone interface card — connected to the expansion bus. The initialisation sequence `OUT 119,34` / `OUT 119,0` suggests a two-step configuration write, possibly setting a control register and then clearing it. The idle sentinel value of `5` read via `IN 119` represents the on-hook or no-ring state of the interface. ### Polling Strategy and Debounce Rather than a single detection sample, the program uses three separate reads separated by a pause. The first read at line `10` acts as a continuous idle-wait loop. After detecting a non-5 value, `PAUSE 400` introduces a delay before two further confirmatory reads at lines `40` and `60`. This three-sample approach provides a basic software debounce, helping to reject transient noise on the line and confirm a genuine incoming call condition before proceeding. ### Notable Techniques and Idioms - `OUT` and `IN` used for direct peripheral communication, bypassing any operating system abstraction. - The polling loop at lines `10–20` is tight and efficient, with no unnecessary computation inside the loop body. - `PAUSE 400` doubles as both a ring-cadence timer and a simple debounce delay without requiring any additional variable or counter logic. - Line `70` uses `LIST` as a terminal stub — a common placeholder technique to mark where custom user code should be inserted, as `LIST` is harmless and visually obvious during development. ### Potential Issues - Between lines `40–45` and `60–65` there is no additional delay, so the second and third samples are taken in rapid succession and are not truly independent — a brief transient could satisfy both checks. - The program offers no timeout mechanism; if the telephone never rings, it loops indefinitely at line `10` with no way to exit other than a manual break. - Line numbering has gaps (e.g. no lines 50 or 55), suggesting lines may have been deleted or left for future expansion. ## Source Code ``` 1 REM AUTO-ANSWER 2 REM Written by 3 REM Randy Kuhn 5 OUT 119,34 6 OUT 119,0 10 LET A=IN 119 20 IF A=5 THEN GO TO 10 30 PAUSE 400 40 LET A=IN 119 45 IF A=5 THEN GO TO 10 60 LET A=IN 119 65 IF A=5 THEN GO TO 10 70 LIST ```