. - , , , . : 0 0 = , 1 = 1 0 = , 1 = 2 0 = , 1 = 3 0 = , 1 = 4 0 = , 1 = 5-7 0-2 3 0 = , 1 = 4 0 = off-line, 1 = on-line 5 0 = , 1 = 6 0 = , 1 = - 7 0 = , 1 = , , . , (on line). , . , - , , . 6.1.1 / . (LPT1 - LPT3) . . - . - . - - . - , , , , , .. , . - , . , . - , , " ", . , - . , , .. Ctrl-Break. , , , ( ). , , . , - . , ; , . ASCII 24 ( ). . 1 17H BIOS , . DX - 0 2 LPT1 - LPT3, - . ( [6.1.2]) AH. ;--- LPT1 MOV AH,1 ; MOV DX,0 ;LPT1 INT 17H ; . , . 2 , . , LPT1 0040:0008, LPT2 - 0040:000A .. 5 - . 2 - 1. 0 (3000 AT 1/20 , BIOS [2.1.5]). , 3 ( ). 12, , ( ) - , 8. LPT1: ;--- LPT1 MOV DX,ES:[8] ; DX INC DX ; 2 INC DX ; MOV AL,12 ; OUT DX,AL ; DELAY: MOV AX,1000 ; DEC AX ; JNZ DELAY ; 1000 MOV AL,8 ; OUT DX,AL ; 6.1.2 , . , - , , . , , 3 - 1 . - : , - . - , - , - . , , ( 3 , , 4 - 5 - ). "", IBM: 223 11011111 87 01010111 119 01110111 247 11110111 1 , - . LPT1 0040:0008, LPT2 - 0040:000A .. , , . , , . . - , . . , , - , , . , 120 , - 256 . 1. 100 ''' LPT1 110 DEF SEG = &H40 ' BIOS 120 PRTRBASE = PEEK(9)+256*PEEK(8)+1 ' 130 IF INP(PRTRBASE) = 223 THEN 180 ' 140 BEEP ' 150 IF INP(PRTRBASE) = 87 THEN LOCATE 1,1: PRINT"Strike the SELECT key": GOTO 150 160 IF INP(PRTRBASE) = 247 THEN LOCATE 1,1: PRINT"Turn the printer on": GOTO 160 170 IF INP(PRTRBASE) <> 223 THEN 170 ' 180 ''' on-line -- 190 LPRINT Z$ . - 2 17H. DX LPT (0-2 LPT1-3). , - : 144 10010000 24 00011000 184 10111000 , . " " 3 0. . - on-line . - LPT1. ;--- MESSAGE DB 'Printer not ready - strike any key when OK$' ;--- (on-line) MOV AX,40H ;ES BIOS MOV ES,AX ; MOV DX,ES:[8] ; INC DX ; IN AL,DX ; AL TEST AL,1000B ; 3 JNZ GO_AHEAD ; on-line, ;--- MOV AH,9 ; LEA DX,MESSAGE ;DS:DX INT 21H ; MOV AH,7 ; INT 21H ; ( ) GO_AHEAD: ; 6.1.3 . , - , . - - . , . " ", " " " ". [6.1.2], , - : 3 = 0 4 = 0 (off-line) 5 = 1 , 4 . , 1 , . LPT1 0040:0008, LPT2 - 0040:000A .. , , 7 , - . 3, . , 4 5, 3 0. - , . , DOS, ( 5 21H - . [6.3.1]), - MODE. , 5, MODE LPT1: ,,P ( - AUTOEXEC.BAT, ). , - . , - . , . . , , . . . 24 , 27 - . , [7.2.5]. 27. 24 , . . , , . - : 100 ON ERROR GOTO 1000 ' . . 1000 ''' 1010 IF ERR = 24 OR IF ERR = 27 THEN GOSUB 2000: RESUME . . 2000 BEEP: LOCATE 1,1: PRINT"Printer not ready" 2010 PRINT "Strike any key when ready" 2020 IF INKEY$ = "" THEN 2020 ' 2030 RETURN . 0 17H , AH. . BIOS - . 0 , , ( ). : " " "- ". , (.. ) - , - STARTING_PTR. - , - . . ( - .) ;--- MESSAGE1 DB 'Printer off-line - strike any key when ready$' MESSAGE2 DB 'Printer out of paper - strike any key when ready$' ;--- NEXT_CHAR: MOV AH,0 ; MOV DX,0 ; LPT1 MOV AL,[BX] ;BX INC BX ; INT 17H ; TEST AH,00001000B ; 3 ( ) JZ NEXT_CHAR ; , TEST AH,00100000B ; 5 ( ) JZ OFF_LINE ; MOV AH,9 ; LEA DX,MESSAGE2 ;DS:DX INT 21H ; JMP SHORT RECOVER ; OFF_LINE: MOV AH,9 ; LEA DX,MESSAGE1 ;DS:DX INT 21H ; RECOVER: MOV BX,STARTING_PTR ; MOV AH,0 ; INT 16H ; CALL PRTR_INIT ; JMP NEXT_CHAR ; 6.1.4 . , . - . , , . , . LPT1, , - LPT1. - , LPT1. BIOS 0040:0008. LPT2 3 ( 0040:000A 0040:000C) LPT1 - . . , OPEN "LPT1" AS #1, - CLOSE #1, OPEN "LPT2" AS #1. PRINT #1 . , LPRINT, LPRINT LPT1. . - , LPT1 LPT2. , . 100 DEF SEG = &H40 ' BIOS 110 X = PEEK(8) ' LPT1 120 Y = PEEK(9) ' LPT1 130 POKE 8,PEEK(10) ' LPT2 140 POKE 9,PEEK(11) ' LPT2 150 POKE 10,X ' LPT1 LPT2 160 POKE 11,Y ' LPT1 LPT2 170 SYSTEM ' , . - , OTHERPRN, ( DOS), . - , OTHERPRN.BAT - BASIC OTHERPRN. OT- HERPRN, , OTHERPRN.BAS, . , , BASIC.COM. , , , , . . , , , 0 17H [6.3.1]. , DX. - , . LPT1 LPT2 LPT3. . , COM , [1.3.6]. ;--- LPT1 LPT2 MOV AX,40H ; BIOS MOV ES,AX ;ES MOV BX,8 ; LPT1 MOV DX,ES:[BX] ; LPT1 MOV AX,ES:[BX]+2 ; LPT2 MOV ES:[BX],AX ; LPT2 MOV ES:[BX]+2,DX ; LPT1  2. . , , .., . . 32- ASCII. (- [7.1.9]) , ( ). Esc-- , Esc, ASCII 27. Esc - , () , . Esc-- -, - "" . , , - , - ASCII 0. , . , , , - , - . . , - . - , . , , , - Esc-, , Esc-, . , - , - . , , - , . - , , , (LPRINT PRINT#), . - / . IBM. , , "", . , ( IBM PC Epson), . , IBM [6.2.7]. , , , , . 6.2.1 . , . , - , ( ) , - , . , . . , 2 , ( ). - , 256 , - . . , . (1) - , (128) - . , , , - , 2 .. . 1, - 3 (1+2), 7 (1+2+4), 15 (1+2+4+8) .. 6-1 . IBM : 100 LPRINT CHR$(27);CHR$(75);CHR$(15);CHR$(0);CHR$(1);CHR$(3); CHR$(7);CHR$(15);CHR$(31);CHR$(63);CHR$(127);CHR$(255); CHR$(127);CHR$(63);CHR$(31);CHR$(15);CHR$(3);CHR$(1); 480 , - , 15 , - . , - , . , , . . , 80 , "" . WIDTH "LPT1:",255. IBM , "". : 27,75 480 . . 480 . 27,76 960 . , ( ). 960 . 27,89 960 , (- ). , - , , . , - . 960 . 27,90 1920 , ( ). 3 (.. 1 , 2 - ). 1920 . . , , - , . - : 27,75 480 1108 560 480 27,76 960 2216 - 960 27,89 960 2216 - 960 27,90 1920 4432 - 1920 IBM , (aspect ratio) - . . - 1:1, - . , . - 5 , 6 . 5:6 . 1:1 5:6. 6.2.2 . , , - . , . ASCII 10 - - . ( Esc) , . , , . , . . 1 (. [6.1.0]). 27,53, - 27,93. 1/6 (.. 6 ) , 27,50 ( , ). , 1/8 7/72 . 27,48 27,49. . - , - . 2- Esc-, 72- 216- , . - 1/72 . 8/72 (9 ). 6 12/72 . , 1/216 1/3 1/72. , , . Esc-: Esc- 72- 27,65,n ( n 1 85) 216- 27,51,n ( n 1 255) 216- 27,74,n ( n 1 255) 72- , : 27,50. , 1/6 . 27,65,n, - 1/6 27,65,12,27,50. - 1/216 . , - ; , , . , IBM: - 27,48 1/8 1/8 1/8 1/9 1/8 1/8 1/8 27,49 7/72 7/72 6/72 1/9 9/96 7/72 27,50 1/6 1/6 1/6 1/6 1/6 1/6 1/6 27,51 n/216 n/144 n/216 27,65 n/72 n/72 n/72 n/72 n/72 27,74 n/216 n/144 n/216 , - , . 6.2.3 . , . - . , . - . , , . - , - 27,56, - 27,57, . , , . 27,78,n, n - 1 127. , 27,78,10 , 10 . - 1/6 , 11- 66 56- 10- . , 5 , 55 . , - 11-, , . , . , 27,67,n, n - . - , , 0,n, n 1 22 . 27,67,0,11. 6.2.4 . [6.2.3], . , . , , . , . , . 27,60, , ( ). - . " " - . - - . , - - , , - . , - . . - , . - , . [6.3.2]. , , . , - . - . 27,85,1, - 27,85,0. 6.2.5 . - ( IBM ). - , , . 112 - . , - , . IBM 64- . 27,68, - 27,66. , - . ASCII 0, . - 15, 30 60 27, 68, 15, 30, 60, 0. 8 12 - 27, 66, 8, 12, 0. , 11- , . 27,67. , . - . - ASCII 0. . 6.2.6 . 8 1/2 80- , . [6.3.3] . , 132 , - 40 - , - 64 . , . . - IBM: : 15. - 18. - 8 1/2 132 . : , 14. - , , . , . 20. : . , . . 27,69. - 27,70. : 1/216 . - , . .