Takes a seven-digit telephone number and prints every letter combination it can spell using the letters on a telephone dial. Digits 2 through 9 each stand for three letters, from ABC to WXY (Q and Z are left out, as on dials of the period), while 0 and 1 are printed as they are. A number made only of the digits 2–9 gives 37 = 2187 combinations. The results fill the screen 76 at a time, and the user presses C to continue or Q to quit.
The cassette has a handwritten label reading “DIAL A WORD (Z.)”. The listing matches David Wahl’s type-in published in Timex Sinclair User #5.
Program Analysis
Program Structure
The 24-letter alphabet is held in A$, and the array A(7) holds a 0–2 offset for each digit position. For each digit d, line 280 prints A$(VAL (N$(I))*3-5+A(I)), so 2 maps to positions 1–3 (ABC), 3 to 4–6 (DEF), and so on. Lines 410–460 step through the combinations like an odometer: the first position’s offset is incremented, and when it passes 2, or when the digit is 0 or 1, it is reset and the carry moves to the next position. When the carry runs past position 7, the program prints DONE.
Notable Techniques
- Input is validated for length and checked one character at a time with string comparisons against
"0"and"9". PAUSE 4E4waits for a keypress, whichINKEY$then reads.- Positions holding 0 or 1 are skipped by the odometer, so no duplicate combinations are printed.
Potential Issues
- If the number contains a non-digit, line 220 jumps to line 280 instead of back to the input prompt. At that point
Iis 8 after the checking loop, soN$(8)is out of range and the program stops with an error rather than asking again. - The error flag
FLis set only once, at line 80, and is never reset.
Source Code
10 DIM A(7)
20 LET A$="ABCDEFGHIJKLMNOPRSTUVWXY"
30 LET NP=0
40 FOR I=1 TO 7
50 LET A(I)=0
60 NEXT I
70 SLOW
80 LET FL=0
89 REM --GET TELEPHONE NUMBER--
90 CLS
100 PRINT TAB 10;"DIAL-A-WORD"
110 PRINT
120 PRINT "PLEASE TYPE IN A 7-DIGIT PHONE","NUMBER (IN THIS FORM: 5558888):"
130 PRINT "THEN PRESS <ENTER>"
140 PRINT
150 PRINT "NUMBER?"
160 INPUT N$
170 PRINT N$
179 REM --CHECK FOR ERRORS--
180 IF LEN N$<>7 THEN GOTO 90
190 FOR I=1 TO 7
200 IF N$(I)<"0" OR N$(I)>"9" THEN LET FL=1
210 NEXT I
220 IF FL<>0 THEN GOTO 280
230 CLS
240 FOR I=1 TO 7
250 IF N$(I)>="2" THEN GOTO 280
260 PRINT N$(I);
270 GOTO 290
280 PRINT A$(VAL (N$(I))*3-5+A(I));
290 NEXT I
300 PRINT " ";
310 LET NP=NP+1
320 IF NP<76 THEN GOTO 410
330 PRINT
340 PRINT
350 PRINT "PRESS <C> TO CONTINUE,","<Q> TO QUIT."
359 REM --WAIT FOR KEY TO BE PRESSED--
360 PAUSE 4E4
370 IF INKEY$ ="Q" THEN STOP
380 IF INKEY$ <>"C" THEN GOTO 360
390 LET NP=0
400 CLS
409 REM --PRODUCE NEXT COMBINATION--
410 LET P=1
420 LET A(P)=A(P)+1
430 IF A(P)<3 AND N$(P)>"1" THEN GOTO 240
440 LET A(P)=0
450 LET P=P+1
460 IF P<8 THEN GOTO 420
470 PRINT
480 PRINT "DONE."
490 STOP
500 SAVE "DIALAWOR[D]"
510 GOTO 10Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

