ES:BX, - , . , . 13- , 13 . : 1. INITIALIZE () 2. CHECK_MEDIA ( ) 3. MAKE_BPB 4. IOCTL_IN 5. INPUT_DATA ( ) 6. NONDESTRUCT_IN 7. INPUT_STATUS ( ) 8. CLEAR_INPUT ( ) 9. OUTPUT_DATA ( ) 10. OUTPUT_VERIFY ( ) 11. OUTPUT_STATUS ( ) 12. CLEAR_OUTPUT ( ) 13. IOCTL_OUT , RET - . - , - . , , -. 15, 8, 1 0 , , - ( 15 , 8 , , 0 1 3, " "). - , 1 - . - , . , , , 14 . eop:. , . . 7-4 - . 12- , . , CHECK_MEDIA MAKE_BPB, ( , ..). : INPUT_DATA OUTPUT_DATA (, - - , ). : 13 1 ( ) 4 / 2 , 2 ( ) . , , ( 14). - , ( 18). , ( 3) . - , 8 . . . , , . ;--- DEV_INTERRUPT: PUSH ES ; PUSH DS PUSH AX PUSH BX PUSH CX PUSH DX PUSH SI PUSH DI PUSH BP MOV AX,CS:KEEP_ES ;ES:BX MOV ES,AX ; MOV BX,CS:KEEP_BX ; MOV AL,ES:[BX]+2 ; SHL AL,1 ; 2 (.. ) SUB AH,AH ; AH LEA DI,FUNCTIONS ;DI ADD DI,AX ; JMP WORD PTR [DI] ; FUNCTIONS LABEL WORD ; DW INITIALIZE DW CHECK_MEDIA DW MAKE_BPB DW IOCTL_IN DW INPUT_DATA DW NONDESTRUCT_IN DW INPUT_STATUS DW CLEAR_INPUT DW OUTPUT_DATA DW OUTPUT_VERIFY DW OUTPUT_STATUS DW CLEAR_OUTPUT DW IOCTL_OUT ;--- , CHECK_MEDIA: MAKE_BPB: IOCTL_IN: INPUT_DATA: NONDESTRUCT_IN: INPUT_STATUS: CLEAR_INPUT: OUTPUT_VERIFY: OUTPUT_STATUS: CLEAR_OUTPUT: IOCTL_OUT: OR ES:WORD PTR [BX]+3,8103H ; JMP QUIT ;--- INITIALIZE: LEA AX,E_O_P ; AX MOV ES:WORD PTR [BX]+14,AX ; MOV ES:WORD PTR [BX]+16,CS ; . ( ) . JMP QUIT OUTPUT_DATA: MOV CL,ES:[BX]+18 ; CBW CX ;CX MOV AX,ES:[BX]+16 ; MOV DS,AX ; MOV DX,ES:[BX]+14 ; . ( ) . JMP QUIT ;---, QUIT: OR ES:WORD PTR [BX]+3,100H ; 8 POP BP ; POP DI ; POP SI ; POP DX ; POP CX ; POP BX ; POP AX ; POP DS ; POP ES ; RET E_O_P: ; DEVICE12 ENDP CSEG ENDS END DEVICE12 - . , - . : OR ES:WORD PTR [BX]+3,XXXXH. - XXXX : 0-7 ( 15 = 1) 8 1, 9 1, 10-14 MS DOS 15 , 15, : 0 1 2 3 4 5 6 7 8 9 A B C 7.2.4 . - . CONFIG.SYS DEVICE = DEVI- CE12.COM. . , . , - MS DOS 21H. , - DOS ( ) - . , AUX, 3 [7.1.7] 4 [7.1.6] 21H . , PRN, 5 [6.3.1] . 3FH [5.4.4] [5.4.3] . 3 - 4 - . , - . MS DOS (.. , PRN, AUX ..), . , - , . - , , BX, 0 - AL, 44H 21H. IOCTL 7 , DL , . IOCTL , - - IOCTL . IOCTL 8 , 0 7, AL : 0 DX 1 , DL (DH=0) 2 CX - DS:DX 3 CX , DS:DX 4 , 2, BL, 0 = , 1 = A .. 5 , 3, 5 6 7 , , . 0 1 DX ( , 7 = 1, , , ): 0 1 = 1 1 = 2 1 = 3 1 = 4 5 1 = Ctrl-Z, 0 = Ctrl-Z 6 1 = , 0 = 7 1 = , 0 = 8-13 14 1 = 2 3, 0 = 15 2-5 . , . AX . 6-7 , . AL FF, 0, . - ( 7 = 0) AL FF , . , 3.0 IOCTL IOCTL$. , , , OPEN. , IOCTL #3,"...". , A$ = IOCTL$(3) IOCTL. 7.2.5 . . - . , - . , , - (, , - ). MS DOS - . . , . , . , , . . , - , , - . , , , ( ). . , - 4 . ON ERROR GOSUB n, n - , . - . IF ERR = n THEN , n - , , . , - . IF ERL = n THEN . ERL , , . RESUME , . , - . , , RESUME , - , . , , - , RESUME NEXT - , , . : 100 ON ERROR GOSUB 5000 ' . . 5000 IF ERR = 61 THEN 5100 ' 5010 IF ERR = 71 THEN 5200 ' . . 5100 IF ERL = 2080 THEN 5120 ' ? 5110 BEEP: PRINT "Disk in drive B: is full": RESUME 5120 BEEP: PRINT "Disk in drive A: is full": RESUME . 5200 BEEP: PRINT "A disk drive is not ready" 5210 PRINT "Strike any key when corrected" 5220 IF INKEY$ = "" THEN 5220 ' 5230 RESUME ERL - 10 ' 3.0 ERDEV ERDEV$. - 24H, . Z% = ERDEV Z% , 13-15 - , - 24H. Z$ = ERDEV$ Z$ 8- - 2- . . , , - . , - . , . - , - , . : "Not ready error reading drive A - Abort, Retry, Ignore?" , , - . 24H MS DOS, - . AH 0 1, . BP:SI , - . , AH , DI. ( ): 0 , 1 2 3 4 5 6 7 8 9 A B C AL , (0 = A, 1 = B ..), 2-0 AH . 0 , , - . 2-1 - , , 00 - DOS, 01 - FAT, 10 - 11 - . , : 1. (- , ), . 2. , INT 21H, . 3. . , IRET, , 0 AL, , 1 - 2 - . , , , , . IRET , , , 12. ( ) : : IP, CS, , AX, BX, CX, DX, SI, DI, BP, : DS, ES, IP, CS, MS DOS . , , DOS. , . , 3.0 MS DOS , FCB - . - , AX - . 59H, BX 0. , 24H. AX , (, " ") (, " " - ). BH , . , 1 , , .. , - . , , .. BL , , "- ", "" " ". , CH , : , , ? . . MS DOS 3.0. , MS DOS 3.0 - , , AT, - . , , MS DOS 3.0 . [1.1.3] - MS DOS, . , , - . - . , EXEC, - , - . , . , AL 4CH 21H . , 4DH 21H ( ) AL , . , AH , : 0 - , 1 - Ctrl-Break, 2 - 3 - 31H, . ( 20H - . [1.3.4]), MS DOS - IF. . ERRORLEVEL , . . " - " .  3. /. /, IBM PC, , , - .. - , IBM PC. , , . , , , - . IBM PC: 00-0F DMA 8237 ( PCjr) 20-2F 8259 (AT #1: 20-3F) 40-4F 8253/8254 60-6F PPI 8255 (AT 70-7F ( AT) 80-83 DMA ( PCjr) A0-BF #2 ( AT) C0-C7 SN76496 ( PCjr) F0-FF PCjr - , AT - - 1F0-1F8 AT 200-20F 278-27F AT #2 2F8-2FF COM2 (COM1 PCjr) 320-32F XT 378-37F PC, XT, AT 3B0-3BF / ( PCjr) 3D0-3DF 3F0-3F7 3F8-3FF COM1 ( PCjr) 7.3.1 / . IBM PC PCjr - , XT AT . , , - , . , PCjr. , 2 - 8253 [2.1.1], - . , , , BIOS - . . - , - . - . - . , - . , : .B .P .A ASCII .M .D SAVE "CAS1:". - LOAD "CAS1:". , , ( ). , . . BIOS 256- . "", 256 ASCII 1. . 16H, 256 . 2 , , .. "", ASCII 1. 2 - 15H. , . ES:BX , , CX - , - . DX , ES:BX 1. 0, , AH 1, , 2 - 3 - . 3 15H . ES:BX , CX , . ES:BX , . 0 () 1 () 15H. . 7.3.2 . , , , . . , , . , - , . . - . . , , - , . PEN X = PEN(n), n - , - . - n : 0 -1, - , 0 - 1 x (0-319 0-639), - ( , ) 2 y (0-199), . 3 -1, 0 - 4 x (0-319 0-639) 5 y (0-199) 6 - (1-24), 7 - (1-40 1-80), - 8 - (1-24) 9 - (1-40 1-80) , , : 100 IF NOT PEN(3) THEN 130 ' 110 X = PEN(4) ' x 120 Y = PEN(5) ' y 130 ... ' - ON PEN GOSUB. , , - . . - . - , , . ON PEN GOSUB , - PEN ON. PEN OFF . , , . , ON PEN GOSUB, PEN STOP. , , . PEN ON, - ON PEN GOSUB. , - . , . 100 ON PEN GOSUB 5000 ' 110 PEN ON ' . . 5000 ''' 5010 X = PEN(4) ' X 5020 Y = PEN(5) ' Y 5030 PSET(X,Y) ' 5040 RETURN ' . 4 10H BIOS - . . AX 0, 1 - . , . DX, DH (0-24), DL - (0-79). CH BX, CH (0-199), BX - (0-319 0-639, ). ;--- MOV AH,4 ; INT 10H ; BIOS CMP AH,1 ; ? JE NO_READING ; , MOV COL,BX ; MOV CL,CH ; MOV CH,0 ; CX MOV ROW,CX ; . CRT 6845. 2- , 10H ( ) 11H ( ) . [4.1.1] . . 3DCH , 3DBH - . ;--- MOV DX,3DAH ; IN AL,DX ; TEST AL,4 ; JNZ NOT_SET ; TEST AL,2 ; JZ NOT_SET ; SUB DX,7 ; 6845 MOV AL,10H ; OUT DX,AL ; INC DX ; 6845 IN AL,DX ; XCNG AH,AL ; AH DEC DX ; MOV AL,11H ; OUT DX,AL ; INC DX ; IN AL,DX ; AX 7.3.3 . 2 4 "". ; . - , , ; - . , . . STICK , - : 0 X A 1 Y A 2 X B 3 Y B , , X = STICK(0) X - X A. , . 0 , 4 . 1-3 - , 0. 3 X = STICK(0), , 0. , , . . , , , , , - , , . 100 ''' 110 STRIG ON ' 120 V= STRIG(0) ' 130 PRINT "Briefly push button 1 when stick is farthest to left" 140 XLEFT = STICK(0) ' 150 IF STRIG(0) = 0 THEN 140 ' 160 STRIG OFF: FOR N = 1 TO 1000: NEXT: STRIG ON 170 PRINT "Briefly push button 1 when stick is farthest to right" 180 XRIGHT = STICK(0) ' 190 IF STRIG(0) = 0 THEN 180 ' 200 STRIG OFF: FOR N = 1 TO 1000: NEXT: STRIG ON 210 PRINT "Briefly push button 1 when stick is farthest to top" 220 V = STICK(0): YTOP = STICK(1) ' 230 IF STRIG(0) = 0 THEN 220 ' 240 STRIG OFF: FOR N = 1 TO 1000: NEXT: STRIG ON 250 PRINT "Briefly push button 1 when stick farthest to bottom" 260 V = STICK(0): YBOTTOM = STICK(1) ' 270 IF STRIG(0) = 0 THEN 260 ' 280 STRIG OFF ' 290 ''' 300 XRIGHT = XRIGHT - XLEFT ' 310 XMULTIPLIER = 320/XRIGHT ' 320 YBOTTOM = YBOTTOM - YTOP ' 330 YMULTIPLIER = 200/B/YBOTTOM ' 340 ''' 350 X = STICK(0) ' 360 Y = STICK(1) ' 370 X = (X - XLEFT)*XMULTIPRIER ' 380 Y = (Y - YTOP)*YMULTIPRIER ' 390 PSET(X,Y) ' 400 GOTO 350 ' . AT - . 84H 15H, - , : AX = X A BX = Y A CX = X B DX = Y B DX 1. DX 0, - [7.3.4]. , . . , 201H. : 3 Y B D 2 X B C 1 Y A B 0 X A A . - . , 4 . , , 1. . - Y X. , 0 1 , . Y, X. . X A. ;--- X A MOV DX,201H ; OUT DX,AL ; MOV AH,1 ; 1 MOV SI,0 ; NEXT: IN AL,DX ; TEST AL,AH ; 1 JE FINISHED ;, INC SI ;, LOOP NEXT ; FINISHED: 7.3.4 . "", . . , , , . - . , ; , , , . . STRIG . STRIG , - , , .. : " , ?"