100 REM Select the print options on an Epson RX-80 printer.
110 REM Copyright (c) 1983, Michael D. Shapiro.
120 REM
125 G$ = "-" :REM indicate graphics not set
130 WIDTH 255 :REM turn off automatic cr/lf
140 CLS$ = CHR$(26)
150 DEF FNC$(NC) = SPACE$(80-NC) :REM CLEAR TO END OF LINE
160 DEF FNP$(NL,NC) = CHR$(27)+"="+CHR$(31+NL)+CHR$(31+NC)
170 REM Display instructions page
180 PRINT CLS$
190 PRINT TAB(20);"Option selector for Epson RX-80 printer":PRINT
200 PRINT TAB(20);"Copyright (c) 1983, Michael D. Shapiro.":PRINT:PRINT
220 PRINT TAB(12);"As you make a selection from the menu which follows, the"
230 PRINT TAB(12);"appropriate control information will be sent to the Epson"
240 PRINT TAB(12);"RX-80 printer connected as your list (LST:) device.":PRINT
250 PRINT TAB(12);"The printer will remain in the mode you specify until you"
260 PRINT TAB(12);"cancel the mode, reset all parameters, or turn the power"
270 PRINT TAB(12);"switch on the printer off.  Note, however, that other"
280 PRINT TAB(12);"programs may also change or reset the mode, overriding"
290 PRINT TAB(12);"selections you make here.":PRINT
300 PRINT TAB(12);"Make certain your printer is ON LINE and press any key to"
310 PRINT TAB(12);"continue.":PRINT FNP$(23,40);CHR$(127);CHR$(8);
320 K$ = INKEY$:IF K$="" THEN 320
330 M$="+"
340 REM Clear the screen, show the menu, and get one response
350 PRINT CLS$;"To select an option, type its letter.  If needed, more data will be requested."
360 PRINT"To cancel an option, type a minus (-) and then its letter.":PRINT
370 PRINT TAB(6);"character set";TAB(35);"page layout";TAB(65);"other"
380 PRINT
390 PRINT"C - Condensed";TAB(30);"F - Form length";TAB(60);"W - reWrite screen"
400 PRINT"D - Double width {1}";TAB(30);"L - Line spacing";TAB(60);"X - eXit program"
410 PRINT"E - Elite width";TAB(30);"S - Skip at page bottom"
420 PRINT"M - eMphasized {1,2}";TAB(30);"T - Tab stop set";TAB(60);"Y - unidirectional"
430 PRINT"O - Overstrike";TAB(60);"Q - paper out sensor"
440 PRINT"U - Underline";TAB(31);"{character set notes}";TAB(60);"H - Half speed print"
450 PRINT"B - suBscript {3,4}";TAB(28);"{1} cancels super/subscript"
460 PRINT"P - suPerscript {3,4}";TAB(28);"{2} cancels condensed";TAB(60);"K - print test line"
470 PRINT"A - Alternate characters";TAB(28);"{3} ignored if in double width";TAB(60);"J - eJect form"
480 PRINT"G - Graphics characters";TAB(33);"character mode";TAB(60);"V - adVance one line"
485 PRINT"I - Internat'l characters";TAB(28);"{4} uses overstrike mode";TAB(60);"R - Reinitialize"
490 REM get response
500 M$="+":PRINT FNP$(21,1);FNC$(1);
505 PRINT FNP$(22,1);FNC$(1):PRINT FNP$(18,21);FNC$(21);
507 PRINT FNP$(18,21);"Enter option: ";
510 R$ = INKEY$:IF R$ = "" THEN 510
520 IF R$ <> "-" THEN 560
530 M$ = "-"
531 PRINT FNP$(20,21);FNC$(21);FNP$(18,35);FNC$(35);
540 PRINT FNP$(18,35);"-        Cancel option: ";
550 R$ = INKEY$: IF R$ = "" THEN 550
560 IF R$ >= "a" AND R$ <= "z" THEN R$ = CHR$(ASC(R$) - 32)
570 PRINT R$
580 IF R$ >= "A" AND R$ <= "Z" THEN 610
585 IF R$ < " " THEN R$ = "^"+CHR$(ASC(R$) + 64)
590 PRINT FNP$(20,21);FNC$(21);
595 PRINT FNP$(20,21);"*** Invalid option (";R$;"); please select again. ***"
600 GOTO 500
610 PRINT FNP$(20,21);FNC$(21);FNP$(20,21);
620 IF R$ = "A" THEN 10100
630 IF R$ = "B" THEN 10200
640 IF R$ = "C" THEN 10300
650 IF R$ = "D" THEN 10400
660 IF R$ = "E" THEN 10500
670 IF R$ = "F" THEN 10600
680 IF R$ = "G" THEN 10700
690 IF R$ = "H" THEN 10800
700 IF R$ = "I" THEN 10900
710 IF R$ = "J" THEN 11000
720 IF R$ = "K" THEN 11100
730 IF R$ = "L" THEN 11200
740 IF R$ = "M" THEN 11300
750 IF R$ = "N" THEN 11400
760 IF R$ = "O" THEN 11500
770 IF R$ = "P" THEN 11600
780 IF R$ = "Q" THEN 11700
790 IF R$ = "R" THEN 11800
800 IF R$ = "S" THEN 11900
810 IF R$ = "T" THEN 12000
820 IF R$ = "U" THEN 12100
830 IF R$ = "V" THEN 12200
840 IF R$ = "W" THEN 12300
850 IF R$ = "X" THEN 12400
860 IF R$ = "Y" THEN 12500
870 IF R$ = "Z" THEN 12600
880 GOTO 590 :REM option not currently valid
1000 REM Emit "selected" or "cancelled" message.
1010 IF M$ = "-" THEN 1040
1020 PRINT" selected."
1030 GOTO 1100
1040 PRINT" cancelled."
1100 REM Emit control string to printer
1110 IF P$ < " " THEN 1130
1120 LPRINT CHR$(27);
1130 LPRINT P$;
1140 GOTO 500
10000 REM Code for actually performing options
10100 PRINT"Alternate (italics or oblique) characters"; :REM A entry
10110 IF M$="-" THEN P$="5":GOTO 1040
10120 P$="4":GOTO 1020
10200 PRINT"Subscript mode"; :REM B entry
10205 N=1
10210 IF M$<>"-" THEN P$="S"+CHR$(N):GOTO 1020
10215 P$="T"
10220 PRINT" cancelled.  (Overstrike still in effect.)":GOTO 1100
10300 PRINT"Condensed mode"; :REM C entry
10310 IF M$="-" THEN P$=CHR$(18):GOTO 1040
10320 P$=CHR$(15):GOTO 1020
10400 PRINT"Double width mode"; :REM D entry
10410 IF M$="-" THEN P$="W"+CHR$(0):GOTO 1040
10420 P$="W"+CHR$(1):GOTO 1020
10500 PRINT"Elite width"; :REM E entry
10510 IF M$="-" THEN P$="P":GOTO 1040
10520 P$="M":GOTO 1020
10600 IF M$="-" THEN N=66:GOTO 10650 :REM F entry
10610 INPUT "How many lines for new form length";N
10620 IF N>=1 AND N<=127 THEN 10650
10630 PRINT FNP$(22,21);FNC$(21);FNP$(22,21);"Form length must be from 1 through 127 lines."
10640 PRINT FNP$(20,21);FNC$(21);FNP$(20,21);:GOTO 10610
10650 PRINT FNP$(22,21);FNC$(21);FNP$(20,21);FNC$(21);FNP$(20,21);"Form length set to";N;"lines."
10660 P$="C"+CHR$(N):GOTO 1100
10700 PRINT"Graphics characters"; :REM G entry
10705 G$=M$ :REM note whether graphics present for print
10710 IF M$="-" THEN P$="m"+CHR$(0):GOTO 1040
10720 P$="m"+CHR$(4):GOTO 1020
10800 PRINT"Half speed printing"; :REM H entry
10810 IF M$="-" THEN P$="s"+CHR$(0):GOTO 1040
10820 P$="s"+CHR$(1):GOTO 1020
10900 IF M$="-" THEN PRINT"United States character set";:P$="R"+CHR$(0):GOTO 1020
10910 PRINT FNP$(22,11);FNC$(21);FNP$(22,11);"0=United States  1=France  2=Germany  3=England  4=Denmark#1"
10920 PRINT FNP$(23,11);FNC$(21);FNP$(23,11);"5=Sweden  6=Italy  7=Spain  8=Japan  9=Norway  10=Denmark#2"
10930 PRINT FNP$(20,21);FNC$(20);FNP$(20,21);:INPUT"Which country code";N
10940 IF N<0 OR N>10 THEN 10930
10950 PRINT FNP$(22,11);FNC$(21);FNP$(23,11);FNC$(21);FNP$(20,21);FNC$(21);FNP$(20,21);
10960 PRINT"International character set ";N;:P$="R"+CHR$(N):GOTO 1020
11000 IF M$="-" THEN PRINT"Cancel request ignored.  "; :REM J entry
11010 PRINT"Paper ejected to top of form."
11020 LPRINT CHR$(12);
11030 GOTO 500
11100 IF M$="-" THEN PRINT"Cancel request ignored.  "; :REM K entry
11110 PRINT"Printing test line(s)."
11120 FOR I=32 TO 126:LPRINT CHR$(I);:NEXT I
11130 IF G$ = "+" THEN LPRINT" ";:FOR I=128 TO 159:LPRINT CHR$(I);:NEXT I
11140 LPRINT
11150 PRINT FNP$(20,21);FNC$(21);FNP$(20,21);:GOTO 500
11200 IF M$="-" THEN N=12:GOTO 11250 :REM L entry
11210 INPUT "How many 1/72 of an inch for new line spacing";N
11220 IF N>=1 AND N<=85 THEN 11250
11230 PRINT FNP$(22,21);FNC$(21);FNP$(22,21);"Line spacing must be from 1/72 through 85/72 inch."
11240 PRINT FNP$(20,21);FNC$(21);FNP$(20,21);:GOTO 11210
11250 PRINT FNP$(22,21);FNC$(21);FNP$(20,21);FNC$(21);FNP$(20,21);"Line spacing set to";N;"/ 72 inch."
11252 IF N=9 THEN P$="0":GOTO 1100
11254 IF N=7 THEN P$="1":GOTO 1100
11256 IF N=12 THEN P$="2":GOTO 1100
11260 P$="A"+CHR$(N):GOTO 1100
11300 PRINT"Emphasized mode"; :REM M entry
11310 IF M$="-" THEN P$="F":GOTO 1040
11320 P$="E":GOTO 1020
11400 GOTO 590 :REM no N entry
11500 PRINT"Overstrike mode"; :REM O entry
11510 IF M$="-" THEN P$="H":GOTO 1040
11520 P$="G":GOTO 1020
11600 PRINT"Superscript mode"; :REM P entry
11610 N=0:GOTO 10210 :REM same logic as subscript
11700 PRINT"Paper our sensor"; :REM Q entry
11710 IF M$="-" THEN P$="8":PRINT" will be ignored.":GOTO 1100
11720 P$="9":PRINT" enabled.":GOTO 1100
11800 IF M$="-" THEN PRINT"Cancel request ignored.  "; :REM R entry
11810 PRINT"All modes reset to default state."
11820 P$="@":GOTO 1100
11900 IF M$="-" THEN P$="O":PRINT"Skip over perforations";:GOTO 1040 :REM S entry
11910 INPUT "How many lines to be skipped over perforations";N
11920 IF N>=1 AND N<=127 THEN 11950
11930 PRINT FNP$(22,21);FNC$(21);FNP$(22,21);"Skip over perforations must be 1 through 127 lines."
11940 PRINT FNP$(20,21);FNC$(21);FNP$(20,21);:GOTO 11910
11950 PRINT FNP$(22,21);FNC$(21);FNP$(20,21);FNC$(21);FNP$(20,21);"Skip over perforations set to";N;"lines."
11960 P$="N"+CHR$(N):GOTO 1100
12000 IF M$="-" THEN N=8:GOTO 12050 :REM T entry
12010 INPUT"Tab spacing (see manual for limits)";N
12020 IF N>=0 AND N<=36 THEN 12050
12030 PRINT FNP$(22,21);FNC$(21);FNP$(22,21);"Tab spacing must be 0 through no more than 36 columns."
12040 PRINT FNP$(20,21);FNC$(21);FNP$(20,21);:GOTO 12010
12050 PRINT FNP$(22,21);FNC$(21);FNP$(20,21);FNC$(21);FNP$(20,21);
12052 IF N>0 THEN PRINT"Tab spacing set to";N;"columns.":GOTO 12060
12054 PRINT"Tabs disabled."
12060 P$="e"+CHR$(0)+CHR$(N):GOTO 1100
12100 PRINT"Underline mode"; :REM U entry
12110 IF M$="-" THEN P$="-"+CHR$(0):GOTO 1040
12120 P$="-"+CHR$(1):GOTO 1020
12200 IF M$="-" THEN PRINT"Cancel request ignored.  "; :REM V entry
12210 PRINT"Printer advanced one line.":LPRINT:GOTO 500
12300 GOTO 350 :REM W entry
12400 PRINT FNP$(20,16);"Exiting -- printer options will remain until changed" :REM X entry 
12410 PRINT FNP$(21,16);"by another program or the printer is turned off.":GOTO 32000
12500 PRINT"Unidirectional printing mode"; :REM Y entry
12510 IF M$="-" THEN P$="U"+CHR$(0):GOTO 1040
12520 P$="U"+CHR$(1):GOTO 1020
12600 GOTO 590 :REM no Z entry
32000 SYSTEM

12510 IF M$="-" THEN P$="U"+CHR$(0):GOTO 1040
12520 P$="U"+CHR$(1):GOTO 1020
12600 GOTO 590 :REM no Z entry
32