ASCII . : 1 2 3 4 5 6 7 8 9 10 ASCII 205 32 98 111 114 105 110 103 32 205 2- 205 32 32 32 32 32 32 32 32 205 . 0, 255, 0, 255, 0, 0, - 0, 15, 0, 15, 0, 0. , 4 , . , , - , , , ASCII. , - . . , 6 - , 6 . . ASCII . , . . , (.. , - ). , , . . . 6-3 . . , - . - , , FOR/NEXT 325 505. , . 100 ''' ( 178 179) 110 DATA 0, 0, 255, 0, 0, 0 120 DATA 4, 4, 255, 0, 0, 0 130 ''' 140 DATA 0, 0, 15, 0, 0, 0 150 DATA 0, 0, 15, 0, 0, 0 160 ''' 170 DIM FIRSTPASS$(45) ' 180 FOR N = 1 TO 2 ' 190 Y$ = "" 'Y$ 6 200 FOR M=1 TO 6: READ X: Y$ = Y$+CHR$(X): NEXT 210 FIRSTPASS$(N) = Y$: NEXT ' 220 ''' 230 DIM SECONDPASS$(45) ' 240 FOR N = 1 TO 2 ' 250 Y$ = "" ' 260 FOR M=1 TO 6: READ X: Y$ = Y$+CHR$(X): NEXT 270 SECONDPASS$(N) = Y$: NEXT ' 280 ''' 290 TEXT$ = "Here is one column"+CHR$(179)+"Here is the second column" 300 TEMP$ = STRING$(80,32) ' 2- 310 GRAPH$ = CHR$(27)+CHR$(75)+CHR$(6)+CHR$(0) 320 OPEN "LPT1:" AS #1 ' 330 FOR N = 1 TO LEN(TEXT$) ' 340 C$ = MID$(TEXT$,N,1) ' 350 IF C$ < CHR$(128) THEN PRINT #1,C$;: GOTO 400 360 ''', - 370 PRINT #1,GRAPH$; ' 380 PRINT #1,FIRSTPASS$(ASC(C$) - 178); 1- 390 MID$(TEMP$,N) = C$ ' 2- 400 NEXT 410 ''' 8 420 PRINT #1,CHR$(27)+CHR$(65)+CHR$(4)+CHR$(141); 430 Z$ = "" 'Z$ 2- 440 FOR N = 1 TO LEN(TEXT$) ' 450 C$ = MID$(TEMP$,N,1) ' 460 IF C$ = CHR$(32) THEN Z$ = Z$+" ": GOTO 480 470 Z$ = Z$+GRAPH$+SECONDPASS$(ASC(C$) - 178) 480 NEXT 490 PRINT #1,Z$ ' 500 PRINT #1,CHR$(10); ' . , . , , , ASCII. - XLAT, . 6.3.5 ( ). , , . 80 , , - . , , - . - , [6.3.4]. - . ( [4.1.3] , - ). - , - . , , : - . [6.3.4] . , , , , . . , . . , - 8 . , . 6-4. 8 , , - 8*8. , . , . , 1:1, - 5:6 ( - ). , - - , - , , (, ). , . - , , IBM . . - , : 10 OPEN "LPT1:" AS #1 ' 20 DEF SEG = &HB000 ' 30 PRINT #1,CHR$(13) ' 40 FOR G = 0 TO 3998 STEP 2 ' 50 PRINT #1,CHR$(PEEK(G)); ' 60 NEXT ' . (, BYTE$) , 8*8 . (VERTICAL$) , : 500 FOR M = 0 TO 7 ' 510 FOR N = 0 TO 7 ' 520 X = ASC(BYTES(N)) ' 530 Y = 2*(7 - M) ' 540 Z = X AND Y ' 550 IF Z <> 0 THEN VERTICAL$(M) = CHR$(ASC(VERTICAL$(M) OR 2*N) ' , ' 2- 560 NEXT N ' 570 NEXT M ' . . , , ( - , , - ). , 8 - CX, DX, BP DI. AL, AH CL, CH, DL DH. AL AH 4 , CX DX DX BP, . 8- , - , CL. , . 8 - BUFFER. 0 AX, CX, DX, BP DI. : LEA BX,BUFFER ; MOV SI,0 ; GET_BYTE: MOV AL,[BX][SI] ; DO_HALF: XCNG AH,CL ; CL, CH, DL DH SHL AX,1 ; AL XCNG AH,CL ; XCNG AH,CH ; SHL AX,1 ; XCNG AH,CH ; XCNG AH,DL ; SHL AX,1 ; XCNG AH,DL ; XCNG AH,DH ; SHL AX,1 ; XCNG AH,DH ; ;--- XCNG CX,BP ; CX DX XCNG DX,DI ; CMP SI,7 ; , JE PRINT_BYTES ; INC SI ; JMP SHORT GET_BYTE ; ;--- PRINT_BYTES: PUSH DX ; DX MOV AH,5 ; MOV DL,27 ; Esc INT 21H ; MOV DL,75 ; INT 21H ; MOV DL,6 ; 6 INT 21H ; MOV DL,0 ; INT 21H ; CALL PRINT_2_BYTES ; CX POP CX ; CALL PRINT_2_BYTES ; DX MOV CX,BP ; CALL PRINT_2_BYTES ; BP MOV DX,DI ; CALL PRINT_2_BYTES ; DI . ( ) . PRINT_2_BYTES: PROC NEAR MOV AH,5 ; MOV DL,CL ; CL INT 21H ; MOV DL,CH ; CH INT 21H ; RET PRINT_2_BYTES ENDP  7. /.  1. . . , . , , , (marking), , (spacing), . , . 0, . ( ) . , , 1 -, . - , - , ; - , - , . . 7-1 . , - ( , ). - , , - . - , , , . - , , . 7.1.1 UART 8250. , , , . - - (universal asynchronous receiver transmitter UART). IBM PC UART 8250 Intel. 2 , - 2 . 0040:0000 COM1 0040:0002 COM2. ( 2- , , UART.) PCjr COM1 3F8H, COM2 - 2F8H; PCjr 3F8H, COM1 - 3F8H. , 3FxH, 2FxH. 8250 10 - , - . , - , . 10 - 3F8H - 3FEH ( 2F8H - 2FEH). , , , - 7 , - 3FBH. : 3F8H (OUT, 7 = 0 3FBH) 3F8H (IN, 7 = 0 3FBH) 3F8H (OUT, 7 = 1 3FBH) () 3F9H (IN, 7 = 1 3FBH) () 3F9H (OUT, 7 = 0 3FBH) 3FAH (IN) 3FBH (OUT) 3FCH (OUT) 3FDH (IN) 3FEH (IN) - . , [7.1.6], - [7.1.7]. , , [7.1.2]. - [7.1.5], , , [7.1.8]. . - - , , - . , - , - , . 8250 , , .. , , , - . 7.1.2 . ("") - . , -, . , . 8 , 7 ASCII ( , ASCII 128), 4 . . , - : OPEN "COM1: .........." AS #1 , , - . : : 75, 100, 150, 300, 600, 1200, 1800, 2400, 4800 9600 . - 300 . : O E - N - . S - - 0 M - 1. 8 , N; N. - E. 4, 5, 6, 7 8. 7. - 1 2, 2 - 75 110 , 1 - . 4 5, 2 1 1/2 -. , . OPEN "COM1:" AS #1 COM1 300 , 7 1 -. OPEN "COM1:1200,O,8,1" 1200 , , 8 1 -. , OPEN LEN = , , GET PUT ( 128 ). - , . ( [7.1.5] , ): RS " " (Request to send). , OPEN "COM" RTS. CS " " (Clear to send). ( 0 65535), - - , , CS500. 1000, RS, 0. DS " " (Data set ready). , CS. 1000. CD " " (Carrier detect). , CS. 0. LF (ASCII 10) (AS- CII 13). . PE , . - OPEN "COM" . , CTS DSR , OPEN - , . OPEN "COM", , RS LF: OPEN "COM1:1200,O,7,1,CS2000,DS2000,CD,PE" AS #1 LEN = 256 . 0 14H BIOS - . DX (COM1 = 0, COM2 = 1). AL , : 1-0 . 10 = 7 , 11 = 8 . 2 -. 0 = 1, 1 = 2. 4-3 . 00 10 = , 01 = ., 11 = . 7-5 . 000 = 110 001 = 150 010 = 300 011 = 600 100 = 1200 101 = 2400 110 = 4800 111 = 9600 8 , - . 1200 . ;--- MOV WORDLENGTH,00000011B ; 8 MOV STOPBITS,00000000B ;1 - MOV PARITY,00011000B ; MOV BAUDRATE,10000000B ; 1200 ;--- COM1 MOV AL,0 ; AL OR AL,WORDLENGTH ; OR AL,STOPBITS ; OR AL,PARITY ; OR AL,BAUDRATE ; MOV AH,0 ; MOV DX,0 ; COM1 INT 14H ; . , , 4 8250 . , - . . , (1190000 ), . , 1200 96, 1190000/96 - 1200. , . 300 . 3F9H ( 2F9H), - 3F8H (2F8H). 7 1 ; - (. [7.1.0]). , : 3F9H 3F8H 110 04H 17H 300 01H 80H 600 00H C0H 1200 00H 60H 1800 00H 40H 2400 00H 30H 3600 00H 20H 4800 00H 18H 9600 00H 0CH , , , 7 . , 7- , . , - 7 1 . , PCjr - , . . , 3FBH ( 2FBH), : 1-0 . 00 = 5 , 01 = 6 10 = 7 , 11 = 8 2 -. 0 = 1, 1 = 1.5, , 2. 3 . 1 = , 0 = . 4 . 0 = , 1 = 5 . 0 1. 0 = 1 = 1, 3 = 1 & 4 = 0 1 = 0, 3 = 1 & 4 = 1 1 = , 3 = 0 6 . . 0 = , 1 = 7 5-7 0. , - . . , , , . 0. . . , , , - . [7.1.5] . BIOS COM1, 1200 , , -. ;--- COM1 MOV AX,40H ;ES BIOS MOV ES,AX ; MOV DX,ES:[0] ; COM1 ;--- 1200 ADD DX,3 ; MOV AL,10000000B ; 7 OUT DX,AL ; DEC DX ; DEC DX ; MOV AL,0 ; 1200 OUT DX,AL ; 1200 DEC DX ; MOV AL,60H ; 1200 OUT DX,AL ; ;--- MOV AL,0 ; AL OR AL,10B ; 7 OR AL,000B ;1 - OR AL,1000B ; OR AL,10000B ; ADD DX,3 ; OUT DX,AL ; ;--- DEC DX ; DEC DX ; MOV AL,0 ; OUT DX,AL ; 7.1.3 . , , . . COM1, , COM1. BIOS 2- , (MS DOS ). , . COM1 0040:0000, COM2 - 0040:0002. . - . . OPEN "COM" OPEN C$+"1200,N,8" AS #2, C$ "COM1:", "COM2:". PEEK POKE : 100 DEF SEG = &H40 ' BIOS 110 X = PEEK(0): Y = PEEK(1) ' 2 120 POKE 0,PEEK(2): POKE 1,PEEK(3) ' 2- 130 POKE 2,X: POKE 3,Y ' . 14H BIOS, COM DX, 0 1 ( COM1 COM2). , DX , - , 0 1. , 3 4 21H COM1. : ;--- COM1 COM2 MOV AX,40H ;ES BIOS MOV ES,AX ; MOV DX,ES:[0] ; 1- DX MOV AX,ES:[2] ; 2- AX MOV ES:[0],AX ; MOV ES:[2],DX ; 7.1.4 . UART 8250 . 5 , . - . - , , - . - , - . : 0 1 = 1 1 = ( ) 2 1 = (, - ) 3 1 = ( ) 4 1 = ( , , ) 5 1 = ( ) 6 1 = ( - ) 7 1 = ( ) . - , 5 - INP . , , . - : 100 DEF SEG = &H40 ' BIOS 110 ADDR = PEEK(4)+PEEK(5)*256 ' COM2 120 X = INP(ADDR+5) ' 130 IF X AND 16 THEN 500 ' -, 4 = 1 . . 500 ''' . 3 14H BIOS AH (AL [7.1.5]). DX , - , COM1 = 0, COM2 = 1. , : MOV AH,3 ; MOV DX,1 ; COM2 INT 14H ; TEST AH,10000B ; ? JNZ BREAK_DETECT ; , . . BIOS , 5, . MOV AX,40H ;ES BIOS MOV ES,AX ; MOV DX,ES:[2] ; COM2 ADD DX,5 ; 5 IN AL,DX ; TEST AL,10000B ; 5 ? JNZ BREAK_DETECT ; , 7.1.5 . 6 , ( - RS232). , : : Data Terminal Ready (DTR) , . Request To Send (RTS) , . : Data Set Ready (DSR) , . Clear To Send (CTS) , . Data Carrier Detect (DCD) , . Ring Indicator (RI) , - , - . DTR, - . , DSR. - , RTS. CTS, . , , UART 8250. 4 , - . : : 7-5 ( 0) 4 1 = UART 3 #2 2 #1 1 1 = " " 0 1 = " " 0 1 , 0. 2 0, , - . 3 , - [7.1.8]. , 4 - - . UART , UART . - . - 14H BIOS. , , . 6 , - . : : 7 1 = DCD 6 1 = RI 5 1 = DSR 4 1 = CTS 3 1 = DCD 2 1 = RI 1 1 = DSR 0 1 = CTS - . , 4 . 1 , , . 4 . . - 3 14H BIOS, - AL ( AH - ). DX (0 1). , , - . , . , . , - . ( Esc - ASCII 27) . - , - . . , PCjr: A Bn n*100 Cn n n Dn...n n...n Fn H I LR M Nn n O originate originate P pick-up Q R Sn Tn...n n...n V W . X Z , UART . , , .