10 REM PRINTER 15 REM SOURCE: CREATIVE COMPUTING [MAY 1982] page 194 20 REM PROGRAM TO DEAL WITH THE IBM 80 CPS PRINTER (EPSON MX80) 30 REM FUNCTIONS: SETUP PRINTER MODES 40 REM PRINT PAGINATED LISTED LISTING OF TEXT FILES 50 REM ISSUE CONTROLS TO PRINTER 55 REM EDITED BY DAVID C. REUSSOW 60 REM AUTHOR: Will Fastie 70 REM CREATED: 12 DEC 1981 80 REM EDITED: 26 JAN 1982 2355 90 REM SOURCE: PRINTER.BAS 100 REM NOTE: OPERATES ON CURRENT DISPLAY DEVICE, CURRENT MODE 110 REM ***** CONSTANTS 120 PROG$ = "PRINTER V1.01 26 JAN 1982" 130 ESC$=CHR$(27) 140 CLRLPT$=CHR$(18)+CHR$(20)+ESC$+"F"+ESC$+"H" 150 PWIDTH=77 160 REM ***** INITAL MENU 170 KEY OFF: CLS: SCREEN 0,0,0 180 PRINT PROG$: PRINT 190 PRINT "THE PRINTER MUST BE ONLINE TO" 200 PRINT "PREFORM THESE FUNTIONS." 210 PRINT 220 PRINT "FUNCTIONS:"; 230 PRINT TAB(13);"P - PRINT A TEXT FILE" 240 PRINT TAB(13);"S - SETUP PRINTER" 250 PRINT TAB(13);"R - RESET PRINTER" 260 PRINT TAB(13);"T - ADVANCE PAPER TO TOP" 270 PRINT TAB(13);"Q - QUIT (RETURN TO DOS)" 280 PRINT TAB(13);"X - EXIT TO BASIC" 290 MENSEL = CSRLIN+1 300 PLOC = MENSEL: GOSUB 1270 310 INPUT " ENTER FUNCTION: ",X$: IF X$="" THEN BEEP: GOTO 300 320 GOSUB 1210 330 X = INSTR("PSRTQX",X$): IF X = 0 THEN BEEP: GOTO 300 340 ON X GOSUB 360, 770, 1080, 1120, 1150, 1180 350 GOTO 160 360 REM ***** PRINT PAGINATED LISTING 370 CLS 380 PRINT PROG$: PRINT 390 PRINT "ADJUST THE PAPER IN THE PRINTER SO THAT" 400 PRINT "THE PERFORATION IS AT THE PAPER BAIL." 410 PRINT "PUT THE PRINTER ONLINE." 420 PRINT 425 PRINT "*****************************************" 430 PRINT "* FILES MUST BE ASCII TEXT FILES *" 435 PRINT "* NOTE: SAVE`FILE NAME',A *" 440 PRINT "*****************************************" 445 PRINT 450 PRINT "NO FILENAME EXTENSION IS ASSUMED," 460 PRINT "SO ENTER THE FILENAME EXACTLY." 470 PRINT "DEPRESS ENTER KEY TO RETURN TO MENU." 480 PRINT "PRESS ESC KEY TO ABORT PRINTING." 490 PRINT:FILES:PRINT 500 INPUT "FILE TO PRINT : ",X$ 510 IF LEN(X$) = 0 THEN RETURN 520 GOSUB 1210 530 WIDTH "LPT1:",PWIDTH 540 OPEN X$ FOR INPUT AS #1 550 PAGENR = 0 560 LINENR = 1 570 IF EOF (1) THEN 650 580 LINE INPUT #1, L$ 590 IF LINENR = 1 THEN GOSUB 690 600 LPRINT L$ 610 IF INKEY$ = ESC$ THEN 650 620 LINENR = LINENR + INT((LEN(L$)+79)/80) 630 IF LINENR > 54 THEN LINENR = 1 640 GOTO 570 650 REM CLOSE FILE AND RETURN 660 CLOSE 670 GOSUB 1120 680 GOTO 500 690 REM ***** SUBROUTINE TO PRINT PAGE HEADING 700 IF PAGENR <> 0 THEN LPRINT CHR$(12); 710 PAGENR = PAGENR + 1 720 LPRINT: LPRINT 730 LPRINT CHR$(14);X$;" ";CHR$(20); 740 LPRINT "-- PRINTED ON ";DATE$;" AT ";TIME$;" -- PAGE";PAGENR 750 LPRINT: LPRINT 760 RETURN 770 REM ***** SETUP PRINTER 780 CLS: PRINT PROG$ 790 PRINT : PRINT "PRINTER ENHANCEMENTS ARE:" 800 PRINT 810 PRINT " DW - DOUBLE WIDTH" 820 PRINT " C - COMPRESSED PRINT " 830 PRINT " E - EMPHASIZED PRINT " 840 PRINT " DS - DOUBLE STRIKE" 850 PRINT 860 PRINT "ENTER EHANCEMENTS SEPARATED BY SPACES." 870 PRINT 880 PRINT" EXAMPLES:" 890 PRINT 900 PRINT " C E -ILLEGAL" 910 PRINT " -10 CPI, NORMAL" 920 PRINT " E -10 CPI, BOLD" 930 PRINT " DS C -16.5 CPI, DOUBLE" 940 PRINT 950 INPUT " ENTER ENHANCEMENTS: ",O$ 960 X$=O$: GOSUB 1210: O$=X$ 970 LPRINT CLRLPT$; 980 IF INSTR(O$,"DW") THEN LPRINT CHR$(14); 990 IF INSTR(O$,"C") THEN LPRINT CHR$(15); 1000 IF INSTR(O$,"E") THEN LPRINT ESC$;"E"; 1010 IF INSTR(O$,"DS")THEN LPRINT ESC$;"G"; 1020 PRINT 1030 PLOC=CSRLIN 1040 GOSUB 1270 1050 INPUT "ENTER DESIRED LINE WIDTH: ",PWIDTH 1060 IF 1 > PWIDTH OR PWIDTH > 132 THEN 1040 1070 RETURN 1080 REM ***** RESET PRINTER TO DEFAULTS 1090 LPRINT CLRLPT$; 1100 PWIDTH =80 1110 RETURN 1120 REM ***** FORM FEED TO PRINTER 1130 LPRINT CHR$(12); 1140 RETURN 1150 REM ***** RETUNR TO DOS 1160 CLS 1170 SYSTEM 1180 REM ***** EXIT TO BASIC 1190 CLS 1200 END 1210 REM ***** SUBROUTINE TO UPPERFY A STRING (IN X$) 1220 FOR X = 1 TO LEN(X$) 1230 XC$ = MID$(X$,X,1) 1240 IF "a" <= XC$ AND XC$ <= "z" THEN MID$(X$,X,1) = CHR$(ASC(XC$)-32) 1250 NEXT X 1260 RETURN 1270 REM ***** SUBROUTINE TO POSITION AT SPECIFIED LINE AND CLEAR IT 1280 LOCATE PLOC,1 1290 PRINT STRING$(40," "); 1300 LOCATE PLOC,1 1310 RETURN 1320 REM ***** SUBROUTINE TO WAIT FOR ANY KEYSTROKE 1330 PRINT "DEPRESS ANY KEY TO COTINUE..."; 1340 GOSUB 1360 1350 RETURN 1360 REM ***** SUBROUTINE TO GET A KEYSTROKE INTO X$ 1370 X$ = INKEY$ 1380 IF X$ = "" THEN 1370 1390 RETURN 1350 RETURN 1360 REM ***** SUBROUTINE TO GET A KEYSTROKE INTO X$ 1370 X$ = INKEY$ 1380 IF X$ = "" THEN 1370