15/20 Word Processor Program

Developer(s): Gerald W. Goegelein
Date: 1985
Type: Program
Platform(s): TS 2068

This is a 15/20-page word processor program that stores up to 15 pages of text in a two-dimensional string array A$(15,640), with each page divided into 20 lines of 32 characters each. The program provides a full menu system covering text input, page review, line-by-line correction, tape save/verify with optional data erasure, full-text printing via LPRINT, and a mailing-label subsystem that formats addressed envelopes with a fixed return address for G. W. Goegelein of Phoenix, Arizona. A short machine code routine is POKEd into RAM at address 57786 on first run (guarded by a FAT flag), attributed to the Triangle Timex Users Group of North Carolina (April 1985); the routine manipulates the display file pointer at system variable address 23606/23607 and is invoked via RANDOMIZE USR 57786 at line 3. The save/verify subsystem supports two modes: a full program save with text data using SAVE Z$ LINE 850, and a stripped re-save as “WORD.3” after a CLEAR that wipes the text array.


Program Analysis

Program Structure

The program is organized around a central menu loop (lines 70–216) that dispatches to eleven numbered functions. Initialization occurs at lines 10–62, with a first-run guard using the variable FAT at line 70 to ensure the machine code loader at line 8000 runs exactly once. After machine code installation, control passes to line 75 for the main display loop.

Line RangeFunction
1–62Initialization, variable setup
70–216Main menu display and dispatch
220–240Input next page (increments N)
250–280Input program title into Z$
290–410Review page by number
420–540Copy (LPRINT) page by number
550–800Page input engine and full-file warning
810–850Save with text data (auto-run to line 850)
860–900Save without text (CLEAR then save as “WORD.3”)
910–990Line input subroutine (20 lines × 32 chars)
1000–1030Page display and LPRINT subroutines
1040–1360Correction by page and line number
1380–2450Mailing label subsystem (input, print, letter close)
2550–2620Label menu entry point and tape verify routine
3000–3060Print entire text via LPRINT
8000–8010Machine code loader (first-run only)

Text Storage Model

Text is held in A$(15,640), a two-dimensional string array of 15 pages each 640 characters wide. Each page is subdivided into 20 lines of 32 characters using the slice notation A$(N, D TO E), where D and E start at 1 and 32 respectively and are incremented by 32 per line (subroutine at lines 960–990). This avoids any dynamic string allocation and keeps the entire document in a fixed memory block.

The page count is capped at 15 in the input loop (line 730: IF N>15 THEN GO TO 760), but the print routine at line 3020 further caps output at 10 pages (IF N>10 THEN LET N=10), which is an apparent inconsistency — up to 5 pages of entered text could silently be omitted from a full print.

Machine Code Routine

Lines 8000–8010 implement a first-run machine code installer. The code is stored in a DATA statement and POKEd byte-by-byte starting at address 57786, with a sentinel value of -1 terminating the loop. The routine is 29 bytes long. Based on the data values and the reference to system variable address 23606 (hex 5C36, DF_SZ/S_POSN area), the routine appears to perform a fast screen copy or display manipulation, consistent with its attribution to a users’ group utility. It is called via RANDOMIZE USR 57786 at line 3, which is also reachable from line 70 via the FAT guard.

The FAT variable serves as a run-once flag: on first execution it is undefined (treated as 0), so the machine code is installed and FAT is set to 1. On subsequent runs (e.g. after a tape load auto-run), FAT is already 1 and the installer is skipped.

AddressByteNote
5778617, 0, 221LD DE, nn (partial)
1, 0, 3LD BC, 0x0300
42, 54, 92LD HL, (23606)
Loop: copy/manipulate display bytes
last201RET

Save and Verify Subsystem

Two save paths are provided. Option 7 (line 810) saves the entire program including the populated A$ array using SAVE Z$ LINE 850, auto-running at line 850 which immediately jumps to the verify prompt at line 2580. Option 8 (line 860) issues CLEAR first, which destroys the string array, then saves only the bare program as “WORD.3” — intended as a clean program-only backup. The verify routine at lines 2580–2620 handles both cases via the flag variable A (0 for data save, 1 for program-only save) and uses VERIFY Z$ or VERIFY "WORD.3" accordingly.

Mailing Label Subsystem

Lines 1380–2540 implement a self-contained mailing label printer. Address fields are collected into O$ (name), B$ (address line 1), C$ (address line 2, optional), and D$ (city/state/zip). The return address is hard-coded in LPRINT statements (lines 1470–1510). An in-place editing facility at lines 1840–1970 allows any of the four fields to be re-entered before printing by entering its number. The subsystem also supports printing the word-processor text as a letter body (GO SUB 3000) and appending a fixed closing signature (“SINCRELY” / “J. I. MASON”) — note the typo “SINCRELY” at line 2340.

Notable Techniques and Idioms

  • Fixed-width 32-character line slices via arithmetic on D and E avoid the need for string parsing.
  • The FAT variable as a first-run flag is an economical alternative to using a POKE to a system variable.
  • Line 2 (GO TO 7999) targets a non-existent line, causing an immediate fall-through to line 3 — a deliberate technique to skip the GO TO 7999 redirect on warm starts while still reaching the RANDOMIZE USR call.
  • PAUSE 0 is not used; instead short PAUSE values (25, 45, 400) are used for timed display pauses.
  • At line 1860, a correction-mode bug exists: when editing field 1, the program does INPUT A$ instead of INPUT O$, clobbering the entire string array variable A$ with a scalar string input.
  • Line 3060 uses GO TO 70 after the print loop, which means the subroutine at line 3000 never returns via RETURN when called directly from the menu (line 203); however, at line 2142 it is called with GO SUB 3000 followed by GO TO 2070, making the GO TO 70 at line 3060 always divert control rather than return — callers using GO SUB will never receive a RETURN.

Dead and Unreachable Code

  • Line 205 is commented out with REM, preserving an earlier implementation of menu option 9.
  • Lines 1360–1370 (STOP / GO TO 2230) are unreachable; line 1350 unconditionally branches to line 70.
  • Lines 2260–2310 implement a keypress-driven sub-menu router, but the entry point at line 2550 falls through to line 2562 which jumps directly to 2260, bypassing the label printing path used elsewhere.
  • Lines 2460–2540 (a label feed-and-print loop using FOR A=1 TO 30 LPRINT blank lines) are never called from anywhere in the program.

Content

Appears On

Library tape of the Indiana Sinclair Timex User’s Group.

Related Products

Related Articles

Related Content

Image Gallery

15/20 Word Processor Program

Source Code

    1 REM  4;00 PM 04-13-85 JIM  
    2 GO TO 7999
    3 RANDOMIZE USR 57786
    5 POKE 23609,50
   10 DIM A$(15,640)
   20 LET N=0
   30 LET D=1
   40 LET B=0
   50 LET E=32
   60 LET Z$=""
   62 LET O$="": LET B$="": LET C$="": LET D$=""
   70 CLS : IF FAT>0 THEN GO TO 75: LET FAT=1: GO TO 8000
   75 BORDER 0: PAPER 0: INK 4: CLS 
   80 PRINT INK 7; PAPER 1;"  15/20 WORD PROCESSOR PROGRAM  "
   82 PRINT 
   88 IF Z$="" THEN PRINT INK 6; FLASH 1;"INPUT TITLE OF THE PROGRAM FIRST"
   90 IF Z$<>"" THEN PRINT "PROGRAM NAME: ";Z$
   92 PRINT 
  100 PRINT PAPER 4; INK 7;AT 4,9;" MENU "
  110 PRINT ,," 1. INPUT TITLE",," 2. INPUT BY PAGE NO."," 3. INPUT NEXT PAGE"," 4. REVIEW BY PAGE"," 5. CORRECT BY PAGE/LINE"," 6. COPY BY PAGE"," 7. SAVE WITH TEXT"," 8. SAVE WITHOUT TEXT"," 9. PRINT ENTIRE TEXT","10. MAILING LABELS","11.   ** END **"
  120 INPUT A
  130 IF A=3 THEN GO TO 220
  140 IF A=4 THEN GO TO 290
  150 IF A=6 THEN GO TO 420
  160 IF A=8 THEN GO TO 860
  170 IF A=7 THEN GO TO 810
  180 IF A=2 THEN GO TO 550
  190 IF A=1 THEN GO TO 250
  200 IF A=5 THEN GO TO 1040
  203 IF A=9 THEN GO TO 3000
  205 REM IF A=9 THEN PRINT AT 14,4; INK 6;"NOT IMPLEMENTED": IF A=9 THEN PAUSE 120: IF A=9 THEN PRINT AT 14,4; INK 4;"               "
  210 IF A=10 THEN GO TO 2550
  215 IF A=11 THEN GO TO 2320
  216 GO TO 120
  220 LET N=N+1
  230 REM 
  240 GO TO 610
  250 CLS 
  260 PRINT PAPER 3; INK 7;"INPUT NAME OF PROGRAM (<=8 let.)"
  270 INPUT Z$
  272 PRINT INK 6;AT 2,0;"PROGRAM NAME: ";Z$: PAUSE 25
  280 GO TO 70
  290 CLS 
  300 PRINT PAPER 3; INK 7;"PAGE TO REVIEW ?",
  310 INPUT F
  320 LET N=F
  330 CLS 
  340 PRINT PAPER 3; INK 7;"PAGE ";N,Z$;" ",: PAUSE 45
  350 GO SUB 1000
  360 PRINT FLASH 1; PAPER 2; INK 7;AT 0,0;"PRESS (M) MENUE - (C) NEXT PAGE."
  370 INPUT T$
  380 IF T$="M" OR T$="m" THEN GO TO 70
  390 IF T$="C" OR T$="c" THEN LET N=N+1
  400 IF T$="C" OR T$="c" THEN GO TO 330
  410 GO TO 360
  420 CLS 
  430 PRINT PAPER 3; INK 7;"PAGE NO. TO BE COPIED ?",
  440 INPUT F
  450 LET N=F
  460 GO SUB 1020
  470 CLS 
  480 PRINT PAPER 7; INK 6; "PRESS:",;TAB 0;"      ""N"" FOR NEW PAGE NO.",;TAB 0;"      ""C"" FOR NEXT PAGE NO.",;TAB 0; "      ""M"" FOR MENU",
  490 INPUT T$
  500 IF T$="M" OR T$="m" THEN GO TO 70
  510 IF T$="N" OR T$="n" THEN GO TO 420
  520 IF T$="C" OR T$="c" THEN LET F=F+1
  530 IF T$="C" OR T$="c" THEN GO TO 450
  540 GO TO 480
  550 CLS 
  560 PRINT PAPER 3; INK 7;"PAGE TO BE FILLED?",
  562 INPUT F
  570 LET N=F
  580 GO TO 610
  590 LET N=N+1
  600 GO TO 610
  610 CLS 
  620 LET E=32
  630 LET B=1
  640 LET D=1
  650 GO SUB 1190
  660 PRINT AT 0,0; "PAGE ";N,Z$
  670 GO SUB 910
  680 REM 
  690 PRINT PAPER 2; INK 7; FLASH 1;AT 0 ,0;"PRESS (M) MENU - (C) NEXT PAGE. "
  700 INPUT T$
  710 IF T$="M" OR T$="m" THEN GO TO 70
  720 IF T$="C" OR T$="c" THEN LET N=N+1
  730 IF N>15 THEN GO TO 760
  740 IF T$="C" OR T$="c" THEN GO TO 610
  750 GO TO 690
  760 CLS 
  770 REM 
  780 PRINT PAPER 2; INK 7;" ***THIS FILE IS NOW FULL ***","REVIEW ALL PAGES AND SAVE.","PRESS "; FLASH 1;"ENTER"; FLASH 0;" TO RETURN T0 MENU.",
  790 INPUT T$
  800 GO TO 70
  810 CLS 
  820 PRINT FLASH 1; PAPER 2; INK 7;"   SET UP TAPE. PRESS ENTER ",
  830 INPUT T$
  840 LET N$="V": LET a=0: SAVE Z$ LINE 850
  850 GO TO 2580
  860 CLS 
  870 PRINT PAPER 7; INK 2;"  TO SAVE ""WORD.3"" PRESS ENTER ",
  872 PRINT AT 3,12; FLASH 1; PAPER 7; INK 2;" WARNING "; FLASH 0;AT 5,0;"ALL DATA WILL BE ERASED, PRESS  ANY KEY BEFORE PRESSING ENTER   TO RETURN TO MAIN MENU.",
  880 INPUT R$
  882 IF R$<>"" THEN GO TO 70
  884 CLEAR 
  890 SAVE "WORD.3" LINE 900
  900 LET A=1: GO TO 2580
  910 INPUT A$(N,D TO E)
  920 PRINT A$(N,D TO E)
  930 GO SUB 960
  940 IF B>=21 THEN RETURN 
  950 GO TO 910
  960 LET B=B+1
  970 LET D=D+32
  980 LET E=E+32
  990 RETURN 
 1000 PRINT A$(N)
 1010 RETURN 
 1020 LPRINT A$(N)
 1030 RETURN 
 1040 CLS 
 1050 REM 
 1060 PRINT PAPER 3; INK 7;"PAGE TO CORRECT ",
 1070 INPUT F
 1080 LET N=F
 1090 LET B=21
 1100 CLS 
 1110 PRINT FLASH 1; PAPER 3; INK 7;"PAGE ";N;"CORRECT (1-20) - MENU (21)"
 1120 GO SUB 1000
 1130 INPUT X
 1140 GO TO 1240
 1150 GO SUB 910
 1160 CLS 
 1170 GO SUB 1000
 1180 GO TO 1100
 1190 PRINT 
 1200 FOR Y=1 TO 20
 1210 PRINT INK 6;Y
 1220 NEXT Y
 1230 RETURN 
 1240 LET D=1
 1250 LET E=32
 1260 IF X=1 THEN GO TO 1310
 1270 FOR Y=2 TO X
 1280 LET D=D+32
 1285 LET E=E+32
 1290 NEXT Y
 1300 IF X=21 THEN GO TO 1340
 1310 CLS 
 1320 GO SUB 1000
 1330 GO TO 1150
 1340 REM 
 1350 GO TO 70
 1360 STOP 
 1370 GO TO 2230
 1380 CLS 
 1390 GO SUB 1690
 1400 LPRINT "--------------------------------"
 1410:
 1411 REM LINES 1400 THRU 2570
 1412:
 1413 REM COPRIGHT "BASIC" 1984
 1414:
 1430 LPRINT 
 1440 LPRINT "   FROM"
 1450 LPRINT "▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗"
 1460 LPRINT "▗                     ▗"                
 1470 LPRINT "▗  G. W. GOEGELEIN    ▗"
 1480 LPRINT "▗  18026 N 41st PLACE ▗"  
 1490 LPRINT "▗  PHOENIX, ARIZONA   ▗"
 1500 LPRINT "▗  85032              ▗" 
 1510 LPRINT "▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗"
 1520 LPRINT 
 1530 LPRINT 
 1540 LPRINT 
 1570 LPRINT "               TO"
 1580 LPRINT "▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗"
 1590 LPRINT "▗                              ▗"
 1600 LPRINT "  ";O$
 1610 LPRINT "  ";B$
 1620 IF C$<=" " THEN GO TO 1640
 1630 LPRINT "  ";C$
 1640 LPRINT "  ";D$
 1650 LPRINT "▗                              ▗"
 1660 LPRINT "▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗▗"
 1670 LPRINT "--------------------------------": LPRINT : LPRINT 
 1680 GO TO 2010
 1690 REM 
 1700 PRINT INK 2;"ENTER:"
 1710 PRINT INK 2;AT 10,0;"1)NAME     ";
 1720 INPUT O$
 1730 PRINT O$
 1740 PRINT INK 2;AT 11,0;"2)ADD 1    ";
 1750 INPUT B$
 1760 PRINT B$
 1770 PRINT INK 2;AT 12,0;"3)ADD 2    ";
 1780 INPUT C$
 1790 PRINT C$
 1800 PRINT INK 2;AT 13,0;"4)C S ZIP  ";
 1810 INPUT D$
 1820 PRINT D$
 1830 PRINT FLASH 1;AT 18,0;"TO EDIT ENTER NO. OR CONTINUE"
 1840 INPUT H$
 1850 IF H$="1" THEN PRINT AT 10,11;
 1860 IF H$="1" THEN INPUT A$
 1870 PRINT AT 10,11;O$
 1880 IF H$="2" THEN PRINT AT 11,11;
 1890 IF H$="2" THEN INPUT B$
 1900 PRINT AT 11,11;B$
 1910 IF H$="3" THEN PRINT AT 12,11;"                     "
 1920 IF H$="3" THEN INPUT C$
 1930 PRINT AT 12,11;C$
 1940 IF H$="4" THEN PRINT AT 13,11;"                     "
 1950 IF H$="4" THEN INPUT D$
 1960 PRINT AT 13,11;D$
 1970 IF H$<>"C" AND H$<>"c" THEN GO TO 1830
 1980 PRINT PAPER 3; INK 7;AT 20,0;"PRESS ENTER TO PRINT ",
 1990 PAUSE 400
 2000 RETURN 
 2010 CLS 
 2020 PRINT O$
 2030 PRINT B$
 2040 PRINT C$
 2050 PRINT D$
 2070 PRINT PAPER 3; INK 7;AT 7,0;"PRINT SAME LABEL:ENTER...P ",
 2080 PRINT PAPER 3; INK 7;AT 8,0;"PRINT NEW  LABEL:ENTER...N ",
 2090 PRINT PAPER 3; INK 7;AT 9,0;"PRINT TEXT:      ENTER...T ",
 2092 PRINT PAPER 3; INK 7;AT 10,0;"PRINT MESSAGE:   ENTER...M ",
 2100 PRINT PAPER 3; INK 7;AT 11,0;"RETURN TO THE MENU:ENTER...R ",
 2110 INPUT E$
 2120 IF E$="P" OR E$="p" THEN GO TO 1400
 2130 IF E$="N" OR E$="n" THEN GO TO 1380
 2140 IF E$="R" OR E$="r" THEN GO TO 70
 2142 IF E$="T" OR E$="t" THEN GO SUB 3000: GO TO 2070
 2144 IF E$="M" OR E$="m" THEN GO TO 2150
 2146 GO TO 2110
 2148 GO TO 2110
 2150 CLS 
 2160 LPRINT 
 2170 LPRINT "--------------------------------"
 2180 LPRINT 
 2190 LPRINT 
 2200 LPRINT "DEAR ";O$;","
 2210 LPRINT 
 2220 LPRINT 
 2230 CLS 
 2240 GO SUB 3000: GO TO 2320
 2260 IF INKEY$="" THEN GO TO 2260
 2270 IF INKEY$="1" THEN GO TO 1400
 2280 IF INKEY$="2" THEN GO TO 1380
 2290 IF INKEY$="3" THEN GO TO 70
 2300 IF INKEY$="4" THEN GO TO 2010
 2310 GO TO 2260
 2320 LPRINT 
 2330 LPRINT 
 2340 LPRINT "                SINCRELY"
 2350 LPRINT 
 2360 LPRINT "             J. I. MASON"
 2370 GO SUB 2400
 2380 GO TO 2070
 2390 CLS 
 2400 LPRINT 
 2410 LPRINT 
 2420 LPRINT "--------------------------------"
 2430 LPRINT 
 2440 LPRINT 
 2450 RETURN 
 2460 FOR A=1 TO 30
 2470 LPRINT 
 2480 NEXT A
 2490 LPRINT O$
 2500 LPRINT B$
 2510 LPRINT C$
 2520 LPRINT D$
 2530 LPRINT 
 2540 RETURN 
 2550 CLS 
 2560 PRINT AT 10,0;"SELECT:",,"        (1)SAME LABEL","        (2)NEW LABEL","        (3)WORD PROCESSOR","        (4)REVIEW LABEL"  
 2562 GO TO 2260
 2570 REM VERIFY FILE
 2580 PRINT PAPER 5; INK 1;"TO VERIFY FILE ENTER V AND ENTERTO GO TO MAIN MENU JUST PRESS   ENTER.",,
 2582 INPUT N$: IF N$<>"V" AND A=1 THEN GO TO 1
 2583 IF N$<>"V" AND A=0 THEN GO TO 75
 2584 CLS : PRINT PAPER 3; INK 7;"REWIND TAPE TO BEGINNING OF FILEAND START RECORDER. ",: PRINT AT 19,0; PAPER 2; INK 7;"IN CASE OF ERROR ENTER GOTO 75  TO RETURN TO MAIN MENU.",
 2590 IF A=0 THEN VERIFY Z$: GO TO 75
 2594 PRINT AT 9,0; PAPER 6; INK 0;"PRESS ENTER TO CONTINUE.",: INPUT A$: IF A=1 THEN CLEAR : VERIFY "WORD.3": GO TO 1
 2600 PRINT AT 16,0; PAPER 1; INK 7;"IF ""OK"" WAS RETURNED AT BOTTEM";TAB 0;"OF SCREEN FILE WAS GOOD. IF AN  ERROR CODE WAS REPORTED RESAVE  FILE AFTER RETURNING TO MAIN    MENU.";TAB 0;"PRESS ENTER TO CONTINUE.",
 2610 INPUT T$
 2620 CLS : GO TO 75
 3000 REM NEW PRINT MESSAGE           ROUTINE - PRINTS ENTIRE         TEXT ALL AT ONCE
 3010 CLS : PRINT PAPER 3; INK 7;"     *** PRINTING TEXT ***     "
 3020 IF N>10 THEN LET N=10
 3030 FOR A=1 TO N: LPRINT A$(A): NEXT A
 3040 FOR A=1 TO 3: LPRINT : NEXT A
 3060 GO TO 70
 8000 REM DARK COPY FROM TRIANGLE TIMEXUSERS,S GROUP IN NORTH CAROLINA 4-5-85  JIM MASON
 8001 CLEAR 56575
 8002 LET a=57786
 8003 READ n
 8004 IF n=-1 THEN GO TO 8008
 8005 POKE a,n
 8006 LET a=a+1
 8007 GO TO 8003
 8009 DATA 17,0,221,213,1,0,3,42,54,92,36,126,167,31,182,18,35,19,13,32,246,16,244,225,37,34,54,92,201,-1
 8010 GO TO 75

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

Scroll to Top