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.
- Lines 1–3: REM header identifying the program and author.
- Lines 5–6: Port initialisation —
OUT 119,34followed byOUT 119,0. - Lines 10–20: Primary polling loop; reads port 119 and returns to line 10 while the value equals 5 (idle state).
- Line 30:
PAUSE 400— a delay of approximately 8 seconds at 50 Hz, allowing the ring cadence to develop. - Lines 40–45: Second single read of port 119; if still idle, restart the loop.
- Lines 60–65: Third single read; if still idle, restart the loop.
- 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
OUTandINused for direct peripheral communication, bypassing any operating system abstraction.- The polling loop at lines
10–20is tight and efficient, with no unnecessary computation inside the loop body. PAUSE 400doubles as both a ring-cadence timer and a simple debounce delay without requiring any additional variable or counter logic.- Line
70usesLISTas a terminal stub — a common placeholder technique to mark where custom user code should be inserted, asLISTis harmless and visually obvious during development.
Potential Issues
- Between lines
40–45and60–65there 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
10with 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.
Content
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
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
