100 'DIRECT PRINTER DRIVER.  THIS PROGRAM IS USED TO SEND CHARACTERS DIRECTLY
110 'TO THE PRINTER OUTPUT PORT ON THE IBM MONOCHROME BOARD OR PARALLEL PRINTER
120 'BOARD (or equivalent).  CONTROL CHARACTERS OR ESCAPE CODE SEQUENCES CAN BE
130 'SENT.  REMEMBER HOWEVER, THE PRINT BUFFER IS NOT DUMPED UNTIL IT IS FULL
140 '(set by the width command), OR A CARRIAGE RETURN, LINE FEED, OR OTHER
150 'APPROPRIATE CONTROL CHARACTER IS SENT.
160 '***
170 '***  Program by: Lee M. Buck, October, 1982. Arlington, Va.(703-527-5813)
180 '***  The subroutine that performs the direct output to the printer
190 '***  is from W. Fastie's  IBM  column in the Oct. 82 'Creative Computing '
200 '***
210 'THE PROGRAM WILL GET 'HUNG ' IF YOU SPECIFY THE INCORRECT PRINTER ADAPTER.
220 'IF THAT HAPPENS, ENTER Ctrl-Break AND START AGAIN.  TO QUIT THE PROGRAM
230 'ENTER Ctrl-Break.
240 CLEAR:CLOSE:CLS:DEFINT A-Z
250 DATAIO=&H378 : PRNTLATCH=&H37A : STATUSREG=&H379
260 LOCATE 5,1: PRINT "IS YOUR PRINTER ATTACHED TO THE IBM MONOCHROME"
270 PRINT "DISPLAY BOARD OR 'OTHER ' ?  PRESS  M  OR  O : ";
280 Q$=INKEY$: IF Q$="" THEN 280
290 IF Q$="M" OR Q$="m" OR Q$="O" OR Q$="o" THEN PRINT Q$ ELSE BEEP: GOTO 260
300 IF Q$<>"M" AND Q$<>"m" THEN 320
310 DATAIO=&H3BC : PRNTLATCH=&H3BE : STATUSREG=&H3BD
320 WIDTH "LPT1:",80
330 LOCATE 10,1:PRINT"PRESS KEY TO SEND TO PRINTER (including control keys) ";
340 DEF SEG: POKE 106,0
350 Q$=INKEY$: IF Q$="" THEN 350 ELSE PRINT Q$;
360 LNTH=LEN(Q$): C=ASC(MID$(Q$,LNTH))
370 GOSUB 390
380 LOCATE 10,1: PRINT SPACE$(79);:GOTO 330
390 OUT PRNTLATCH, &H6
400 IF INP(STATUSREG) <> &HDF THEN 400
410 OUT DATAIO, C
420 OUT PRNTLATCH, &H3F
430 IF INP(STATUSREG) <> &HDF THEN 430
440 RETURN