10TEXT:HOME
100GOSUB 30000
110VTAB 8:? "Instructions (y/n) :"; :GET key$:?:ON (key$="Y" OR key$="y") GOTO 20000:ON (key$<>"N" AND key$<>"n") GOTO 110
120HOME:GOSUB 30000
130VTAB 4:INPUT "Line Spacing (1 to 66):"; ls$
135IF VAL(ls$)<1 OR VAL(ls$)>66 THEN 130
140VTAB 6:? "Justification:":? TAB(10); "[L]eft":? TAB(10); "[C]enter"
141? TAB(10); "[R]ight":? "Enter letter of setting:"; :GET just$
142?
145ON (just$<>"L" AND just$<>"l" AND just$<>"C" AND just$<>"c" AND just$<>"r" AND just$<>"R") GOTO 140
150VTAB 12:? "Vertical Justification (y/n):"; 
155GET vj$:?:ON (vj$<>"Y" AND vj$<>"y" AND vj$<>"N" AND vj$<>"n") GOTO 150
160VTAB 14:? "Characters per line (20-80):"; :INPUT ""; cl$
165IF VAL(cl$)<20 OR VAL(cl$)>80 THEN 160
200VTAB 2:? CHR$(24)
210VTAB 6:? "Enter message line by line.  A":?:? "line cannot exceed 80 cha-":?:? "racters.  When finished, type"
220?:? "\DONE\ to go to printing sub-":?:? "routine."
230?:?:? "Type any key to begin:"; :GET key$
240HOME
250DIM message$(120)
260 cv=1: ht=1: v=1
265IF v>=22 THEN HOME: v=1
270VTAB v:HTAB ht:GET key$:? key$
271IF ASC(key$)=8 OR ASC(key$)=160 THEN VTAB v:? message$(cv):GOTO 270
280IF ASC(key$)=3 THEN VTAB 22:END
285IF ASC(key$)=163 AND ht=33 THEN  ht=ht-2:GOTO 430
286IF ASC(key$)=163 AND ht=65 THEN  ht=ht-2:GOTO 430
290IF ASC(key$)=163 THEN  ht=ht-1:GOTO 430
291IF ASC(key$)=13 THEN 380
293IF ht=VAL(cl$)+2 THEN 270
295IF ASC(key$)<32 OR ASC(key$)>126 THEN 270
300 message$(cv)=message$(cv)+key$
380IF message$(cv)="\DONE\" THEN 1000
390IF ASC(key$)=13 THEN ?: ht=1: v=v+4: cv=cv+1: key$="":GOTO 265
400GOTO 450
430IF LEN(message$(cv))<=1 THEN  message$(cv)="": ht=0:GOTO 450
440 l=LEN(message$(cv)): message$(cv)=LEFT$(message$(cv), (l-1)):GOTO 265
450IF ht=32 THEN  ht=ht+2:GOTO 460
451IF ht=64 THEN  ht=ht+2:GOTO 460
455 ht=ht+1
460ON (ht<VAL(cl$)) GOTO 265:GOTO 500
500? CHR$(7):? "<press RETURN>":GOTO 265
1000REM        *** user input complete: \DONE\ routine ***
1010HOME:GOSUB 30000
1020VTAB 4:? "You have entered "; cv-1; " lines of":? "text. Press any key to review:"; :GET key$:?
1025FOR x=1 TO 31:? CHR$(23); :NEXT
1030 v=7
1040FOR x=1 TO cv-1
1050VTAB v:? message$(x)
1060 v=v+4:IF v>=21 THEN ?:? " <press any key to continue>"; :NORMAL:GET key$: v=7:VTAB v:? CHR$(24): v=7
1070NEXT
1075VTAB 22:? " <press any key to continue>"; :GET key$:?
1080VTAB 7:? CHR$(24)
1090VTAB 15:? TAB(2); "<Review Procedure Complete>"
1100FOR x=1 TO 2000:NEXT
1120IF just$="C" OR just$="c" THEN  jp$="CENTER"
1130IF just$="L" OR just$="l" THEN  jp$="LEFT"
1140IF just$="R" OR just$="r" THEN  jp$="RIGHT"
1150 ls=VAL(ls$)
1155 cl=VAL(cl$)
1160IF vj$="Y" OR vj$="y" THEN  vp$="ON":GOTO 1180
1170 vp$="OFF"
1180HOME:GOSUB 30000:VTAB 4
1190? "Line Spacing: "; ls
1200?:? "Justification: "; jp$
1210?:? "Vertical Justification: "; vp$
1215?:? "Characters Per Line: "; VAL(cl$)
1220?:?:? "Center paper in printer.  If   vertical justification is OFF, position paper at line you wishprinting to begin."
1230?:? "Press <RETURN> when ready:"; :INPUT ""; go$
1240REM      *** lines 1240-1290 are to be used for a graphic screen that says "PRINTING" *** 
1300PR #1
1305IF vp$="OFF" THEN 1400
1310REM      *** vertical justification routine ***
1320 v1=((cv-2)*ls)+1:REM      *** total number of lines used ***
1330 v2=66-v1: v3=v2/2
1340FOR x=1 TO v3
1350?
1360NEXT x
1400IF jp$="LEFT" THEN  last=1
1410IF jp$="CENTER" THEN  last=2
1420IF jp$="RIGHT" THEN  last=3
1430FOR x=1 TO (cv-1)
1435 t$=message$(x)
1440IF LEFT$(t$, 1)="." THEN GOSUB 10000
1450ON last GOSUB 11000, 12000, 13000
1455IF ls=1 THEN 1490
1460FOR y=1 TO ls-1
1470?
1480NEXT y
1490NEXT x
1500PR #0:TEXT
1510VTAB 4:? "Choose an option:"
1520VTAB 6:? "1] Print same announcement"
1530?:? "2] Print new announcement"
1540?:? "3] Exit program"
1550VTAB 12:? "What is your choice: "; :GET key$:?
1560IF VAL(key$)<1 OR VAL(key$)>3 THEN 1510
1570ON VAL(key$) GOTO 1180, 1580, 9999
1580CLEAR:GOTO 120
9999END
10000REM      *** change justification parameter ***
10010IF MID$(t$, 2, 1)="L" THEN  last=1
10020IF MID$(t$, 2, 1)="C" THEN  last=2
10030IF MID$(t$, 2, 1)="R" THEN  last=3
10040 t$=RIGHT$(t$, (LEN(t$)-2))
10050RETURN
11000REM      *** left justification ***
11005 ht=(80-VAL(cl$))/2
11010? SPC(ht); t$
11020RETURN
12000REM      *** center justification ***
12010 ht=(40-(LEN(t$)/2))
12020? SPC(ht); t$
12030RETURN
13000REM      *** right justification ***
13010 ht=(VAL(cl$)-LEN(t$))+(80-VAL(cl$))/2
13020? SPC(ht); t$
13030RETURN
20000REM      *** instructions ***
20010HOME:GOSUB 30000:VTAB 4:? "    This rather simplistic pro-gram will print a one-page     announcement with any message"
20020? "you see fit to type in. ":?:? "    To use the program, simply type in your message, followingall directions given you."
20030GOSUB 21000
20040HOME:GOSUB 30000:VTAB 4:? "    You will be asked to set   line spacing.  Simply type in  the number."
20050?:? "    Next, you will be asked to set the justification (either"
20055? "Left, Center, or Right).  Left justification will print your"
20060? "message lined up on the left   margin.  Center will center    the text, while Right will "
20065? "line up the text."
20070GOSUB 21000
20080HOME:GOSUB 30000:VTAB 4:? "    After that, you must de-   cide whether you want the docu-ment vertically justified, or"
20090? "centered, on the page.":?:? "Lastly, decide on the number ofcharacters you wish per line.  (The usual amount is 60,"
20100? "although you may have up to 80)"
20110GOSUB 21000
20120HOME:GOSUB 30000:VTAB 4:? "    When entering text, you maytype any printable character.  If you exceed the number of"
20130? "characters per line, you will  be instructed to press <RETURN>":? "    You may also change "
20140? "justifications within the text,allowing you to vary the way   the message will be printed."
20150? "To do so, type a period (.)    followed by the first letter ofthe justification you want. "
20160? "This letter must be CAPITALIZEDEXAMPLE: .C will center "
20165? "text, .L will left justify it."
20170GOSUB 21000
20180GOTO 120
21000VTAB 22:? " <press any key to continue>"; :GET key$
21010RETURN
30000 r$="*** ANNOUNCE! ***":HTAB (15-(LEN(r$)/2)):? r$
30010RETURN
