. IBM . , . 1. . 1. . 8255. IBM PC. MS DOS. . . . . 2. . 8259. / . . . 3. . . . . . . .EXE .COM. 2. . 1. . 8253/8254. / . / . / . . . . . 2. . 76496 ( PCjr). . . . . , . . . . 3. . 1. . . . . . . . / -. . . 2. . <BackSpace>, <Enter>, <Escape> <Tab>. -: <Shift>, <Ctrl> <Alt>. -: NumLock, CapsLock, Ins ScrollLock. - . . . . Ctrl-Break. PrtSc. 3: . . -. ASCII . . 4. . 1. . 6845. / . / . . / . . 2. . . . . // . . 3. . . . . . . 4. . . (, PCjr). (EGA). . . . . 5. . . . . . 5. . 1. . . . / . , . 2. . / . / . / . / . / . . / . 3. . / . / . / . ; . . . 4. . 765 - 8237. / . . . . . /. . 6. . 1. . / . , . . . 2. . . . . . . . IBM. 3. . . . . . ( ). 7. /. 1. . UART 8250. . . . . . . / . , . 2. . . . . . . 3. /. / . . . . . . - . . . . . . . . ANSI.SYS. . 8088. . 80286. . IBM PC.  1. .  1. . : IBM PC ?... MS DOS?... ?... - ? . - ( ?). . . - - - - BIOS. - , , - - 8255. . /, ( 65535 ). . [7.3.0]. . 1-1 - . 1.1.1 8255. Intel 8255 - , , . . . . , 8253. IBM PC AT 8255; - . AT , 8255, - . 8255 , A C. 60H 62H - . , B. PC, 7 B 1 , - A. PC 2 C, 3 XT. : A (60H) B 7=0 0-7 PC,XT,PCjr,AT: 8- - B 7=1 PC 0 PC: 0 = 1 PC: 2-3 PC: 4-5 PC: (11 = , 10 = 80*25, 01 = 40*25) 6-7 PC: B (61H) 0 PC,XT,PCjr: 2 8253 1 PC,XT,PCjr: 2 PC: C PCjr: 1 = , 0 = 3 PC,PCjr: 1 = XT: C 4 PC,XT: 0 = PCjr: 1 = 5 PC,XT: 0 = 6 PC,XT: 1 = 5-6 PCjr: (00 = 8253, 01 = , 10 = /, 11 = 76496) 7 PC: A PC,XT: C (62H) B 2=1 PC 3=1 XT 0-3 PC: 2 - ( ) 0 PCjr: 1 = 1 XT: 1 = . PCjr: 2 PCjr: 2-3 XT: 3 PCjr: 0 = 128K 4 PC,PCjr: XT: 5 PC,XT,PCjr: 2 8253 6 PC,XT: 1 = PCjr: 1 = 7 PC,XT: 1 = PCjr: 0 = B 2=0 PC 3=0 XT 0-3 PC: 2 - ( ) 0-1 XT: (11 = , 10 = 80*25, 01 = 40*25) 2-3 XT: (00 = 1 ..) 4-7 PC,XT: , , 0 - "off". AT MC146818 Motorola, . 8255, - . 64 , 00 3FH. 70H, 71H. . : 10H 12H 14H 15H ( ) 16H ( ) 17H ( ) 18H ( ) 30H 1 ( ) 31H 1 ( ) . - . , , IBM PC. - A, 7 B - 1. , 0 , - . , . 255 ( , ) . MID$ . - . 100 A = INP(&H61) ' B 110 A = A OR 128 ' 7 120 OUT &H61,A ' B 130 B = INP(&H60) ' A 140 A = A AND 128 ' 7 150 OUT &H61,A ' B 160 GOSUB 1000 ' 170 NUMDISK$ = RIGHT$(B$,1) ' 180 IF D$ = 1 THEN NUMDISK = 0: GOTO 230 ' 190 C$ = LEFT$(B$,2) ' 200 TALLEY = 0 ' 210 IF RIGHT$(C$,1) = "1" THEN TALLEY = 2 ' 220 IF LEFT$(C$,1) = "1" THEN TALLEY = TALLEY + 1 ' 230 TALLEY = TALLEY + 1 ' 1, 0 ' 1000 ''' 1010 B$ = "" ' 1020 FOR N = 7 TO 0 STEP -1 ' 2 1030 Z = B - 2^N ' 1040 IF Z >= 0 THEN B = Z: B$ = B$+"1" ELSE B$ = B$+"0" 1050 NEXT ' 1060 RETURN ' . - , , . , B. IN AL,61H ; B OR AL,10000000B ; 7 1 OUT 61H,AL ; IN AL,60H ; A MOV CL,6 ; AL SHR AL,CL ; 2 6 INC AL ; 1, 0 MOV NUM_DRIVES,AL ; IN AL,61H ; B AND AL,01111111B ; 7 OUT 61H,AL ; 1.1.2 IBM PC. IBM PC. IBM PC, - , - , . - FFFFE ROM-BIOS, . PC FF XT FE PCjr FD AT FC . PEEK : 100 DEF SEG = &HF000 ' 64K 110 X = PEEK(&HFFFE) ' 120 IF X = &HFD THEN ... '... PCjr . : ;--- : MOV AX,0F000H ; ES MOV ES,AX ; MOV AL,ES:[0FFFEH] ; CMP AL,0FDH ; PCjr? JE INITIALIZE_JR ; 1.1.3 MS DOS. MS DOS , . MS DOS , MS DOS 1.0. , MS DOS. . , , MS DOS. . 30H 21H MS DOS. (2 2.10) AL, (10 2.10) AH ( , .1 AH, 1H). AL 0, MS DOS 2.0. BX CX, - 0. ;--- MS DOS: MOV AH,30H ; INT 21H ; CMP AL,2 ; 2. JL WRONG_DOS ; 2, 1.1.4 . , , EGA, . [4.1.6] . , - ROM-BIOS 0040:0010 1, . 11 , 10 - 80*25, 01 - 40*25 00 EGA. EGA 00, . - EGA, , , BIOS . EGA 0040:0087. 0, EGA . , 3=0, EGA , 1, - . EGA, - 6845 [4.1.1] . 0FH 3B4H, , 3B5H. 3D4H 3D5H. , - 0FFH; , . , EGA: ? 1 0040:0087; , , - - . 350 , IRGB R'G'B'RGB, IBM. EGA. - CL 12H 10H. 0110 . EGA. BL, 0 64K, 1 - 128, 2 - 192 3 - 256K . . , : 100 ''' 110 DEF SEG = &H40 ' BIOS 120 X = PEEK(&H87) ' EGA 130 IF X = 0 THEN 200 'EGA , 140 IF X AND 8 = 0 THEN... ' EGA . . 200 X = PEEK(&H10) ' 210 Y = X AND 48 ' 4 5 220 IF Y = 48 THEN ... '... (00110000) 230 IF Y = 32 THEN ... '... 80*25 (00100000) 240 IF Y = 16 THEN ... '... 40*25 (00010000) , EGA . &H3D4 &H3D5. 100 ''' 110 OUT &H3B4,&HF ' 120 X = INP(&H3B5) ' 130 OUT &H3B5,100 ' 140 IF INP(&H3B5)<>100 THEN... ' - 150 OUT &H3B5,X ' . . ;--- : MOV AX,40H ; ES BIOS MOV ES,AX ; MOV AL,ES:[87H] ; EGA CMP AL,0 ; JE NO_EGA ; 0040:0087 = 0, EGA TEST AL,00001000B ;EGA , 3 JNZ EGA_NOT_ACTIVE; 3=1, EGA . . EGA_NOT_ACTIVE: MOV AL,ES:[10H] ; AND AL,00110000B ; 4 5 CMP AL,48 ; ? JE MONOCHROME ; (): ;--- ? MOV DX,3D4H ; 6845 MOV AL,0FH ; OUT DX,AL ; INC DX ; IN AL,DX ; XCNG AH,AL ; MOV AL,100 ; 100 OUT DX,AL ; IN AL,DX ; CMP AL,100 ; JNE NO_CARD ; XCNG AH,AL ; OUT DX,AL ; 1.1.5 . AT ( ) 8255 - , . [1.1.1] - . (FAT) , . FAT : FF , 8 FE , 8 FD , 9 FC , 9 F9 , 15 F8 . DOS BIOS - . [5.1.1] FAT. , , . BIOS , . . 0CDH, , . , . AT , . 71H, 70H. 10H. - 7-4, - 3-0. 0000 - , 0001 - 48 , 0010 - (96 - ). - 12H. 7-4 3-0 - . 0000 . 15 . ; - , AT. . 1CH 21H . DL, 0 = - , 1 = A, .. DX FAT, AL - , CX - . DS:BX , FAT, . - A: ;--- MOV AH,1CH ; MS DOS MOV DL,1 ; A INT 21H ; MOV DL,[BX] ; CMP DL,0FDH ;, 9 ? JE DBL_9 ; .. BIOS AT , . 8 13H. DL, DH, CL CH, AH (. [5.4.8]). BIOS AT . 15H 13H, DL. AH , 0 = , 1 = , 2 = 3 = . CX:DX - 512 . 1.1.6 . ROM-BIOS , . , 0040:0010. , - : 0 1, 1 XT,AT:1 = . (PC,PCjr: .) 2-3 11 = 64K (AT: ) 4-5 (11 = , 10 = 80*25, 01 = 40*25) 6-7 ( 0 = 1) 8 PCjr:0 = DMA (PC,XT,AT: ) 9-11 12 1 = (AT: ) 13 PCjr: (PC,XT,AT: .) 14-15 . - , 0 6-7. 0 6-7 , - ; - 0. - BIOS. BIOS 2- COM (MS DOS ). - , - , - . 0040:0008. COM1 :0008, COM2 - 000A. 0, . , :0008 , 000A - , . AT 14H . 14H 70H, 71H. : 7-6 00 = 1 , 01 = 2 5-4 01 = , 40 10 = , 80 11 = 3-2 1 1 = . 0 0 = , 1 = . BIOS. . - ( - ). 100 DEF SEG = 0 ' 110 X = PEEK(&H410) ' 120 IF X MOD 2 = 0 THEN 140 ' - 130 PRINT " " ' 140 GOTO 160 ' 150 PRINT " " ' 160 ... '... COM1: 100 DEF SEG = 40H ' BIOS 110 PORT = PEEK(0) + 256*PEEK(1) ' 0 120 IF PORT = 0 THEN... '... COM1 . 11H BIOS AX. . . ; --- : INT 11H ; TEST AL,0 ; ? JZ NO_DRIVES ;, AND AL,1100000B ; 5-6 MOV CL,5 ; SHR AL,CL ; 5 INC AL ; 1, .. 1 . , . AT, : MOV AL,14H ; OUT 70H,AL ; IN AL,71H ; TEST AL,10B ; 1 JZ NO_COPROCESSOR ; , 1.1.7 . : " ?",- . , ? ? , , , DOS ? 10 64K, - 320K, - - . , 320K , , ? . PC XT B 8255. [1.1.1] . BIOS 0040:0013, . PCjr 3 62H ( C 8255) , 64K . AT . 15H () 16H (- ) ( : 0100H - 256K, 0200H - 512K 0280H 512K 128K ). / AT - 17H 18H ( 512K). 1 30H 31H ( 512K, 15 ). AT 128K , 7 33. 70H, 71H. , . - 16 , - 16- , , 16K . , 233. , 233 . - 233, . - AT, . AT , . , , - MS DOS. . , , . . - , . 64K, . - , . - , 13E2, 13E2 64K- . , 3E2 . [1.2.2] - , . . , DOS , , DOS ( , - ). , - , . - [1.3.1] 4AH - 21H. - . , . , , AX 8, BX - 16- . . BX ( , F000H ), . , , ES . . 64K ( PEEK POKE 64K). FRE. , . BYTES = FRE(x) BYTES . BYTES = FRE(x$) . - - . , CLEAR, , FRE 2.5 4 - . 64K . , . , /N. . . 12H BIOS - AX . 8255 , AT, /.