Pulse-dials a phone number through a modem on I/O port 119, redials until it gets a connection, and then starts the MTERM terminal program. After you enter the number, it takes the line off-hook and sends each digit as a train of pulses, with 0 sent as ten. It then watches the port for a connect status. If none arrives it hangs up, pauses and dials again. On a connection it flashes “C O N N E C T E D ! !” and beeps. Pressing ENTER then POKEs a set of changes into MTERM, which must already be in memory, and starts it with USR 54016.
Program Analysis
Program Structure
Line 15 sends OUT 119,31 before dialing. The loop at 20–50 reads each digit with VAL a$(i) and calls the pulse subroutine at 60. That subroutine pulses each digit with OUT 119,3 and OUT 119,4, using short PAUSEs between them, followed by OUT 119,1 and OUT 119,2. Line 55 jumps to the nonexistent line 150, which Sinclair BASIC treats as the next line, 160. Lines 160–168 poll IN 119 up to 2000 times for the value 133. If it never appears, OUT 119,0 hangs up and line 180 redials the same number.
After Connecting
Lines 200–218 repeat a burst of ten beeps with a flashing prompt until ENTER is pressed. Lines 220–260 then POKE single bytes at 61157, 61158, 61170, 61172 and 61699, copy DATA bytes into 61193–61211 and fill 61311–61331 with spaces. These addresses are in the area used by MTERM. Line 280 sends OUT 119,34 and runs MTERM with PRINT USR 54016. MTERM is not included on this tape, and the listing does not say what the patched bytes change.
Potential Issues
- Only digits can be dialed. A dash, space or bracket in the number makes
VALfail with an error. - The loop at 240 reads 19 DATA values, but line 300 holds 20, so the last one is never used.
PAUSE 2.5is rounded to a whole number of frames.- The beep burst at line 200 plays again on every pass of the ENTER-wait loop, and the keyboard is checked only once per pass.
Source Code
1 INPUT "PHONE NUMBER?";a$
3 CLS
15 OUT 119,31
18 PAUSE 50
19 PRINT AT 10,8; FLASH 1;"DIALING "; FLASH 0;a$
20 FOR i=1 TO LEN a$
30 LET a=VAL a$(i)
32 IF a=0 THEN LET a=10
35 PAUSE 32
40 GO SUB 60
50 NEXT i
55 GO TO 150
60 FOR d=1 TO a
70 FOR e=3 TO 4
80 OUT 119,e
90 PAUSE 2.5
100 NEXT e
110 OUT 119,1
120 OUT 119,2
130 NEXT d
140 RETURN
160 FOR i=1 TO 2000
165 IF IN 119=133 THEN CLS : PRINT FLASH 1;"C O N N E C T E D ! !": GO TO 200
168 NEXT i
170 OUT 119,0
175 PAUSE 100
180 GO TO 3
200 FOR i=1 TO 10: BEEP .05,18: NEXT i
210 LET g$=INKEY$: PRINT AT 10,0; FLASH 1;"Hit <ENTER> to Start MTERM"
215 IF g$=CHR$ 13 THEN GO TO 220
218 GO TO 200
220 POKE 61157,24: POKE 61158,6
230 POKE 61170,184: POKE 61172,184
240 FOR i=61193 TO 61211: READ m: POKE i,m: NEXT i
250 FOR i=61311 TO 61331: POKE i,32: NEXT i
260 POKE 61699,21
280 OUT 119,34: PRINT USR 54016
300 DATA 254,147,27,95,254,147,27,95,234,246,50,193,154,89,193,247,105,105,121,195Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
