- 00. DTA FCB. , AL . IBM PC. 16. 10 , , , , DTA. , , 128 , .. . 23 , : | 20 | 21 | 22 | 23 | , , 23, . , DTA. 35, , , DTA. , , . DTA , . , , , , , (, ) . FCB .22 : MOV AH,22H ; LEA DX,FCBname ; INT 21H ; DOS AL : 00 01 02 DTA. . 00. FCB ( ), . , . IBM PC. 16. 11 : ------------------------------------------------------------ .16.3 , , (..16.1). , , . 25 , 00 24. ASCII - . : C10OPEN , 32 DTA. D10RECN , FCB. 00 24. F10READ DTA FCB. G10DISP . D10RECN . : 00 01 ( AL) 02 ( AX) ------------------------------------------------------------ ------------------------------------------------------------ .16.3. . ASCII . AX, AAD . AX FCB. , , 12 ASCII , AX 3132. AND 0102, AAD - 000C. FCB 000 0000. ------------------------------------------------------------ , DTA , DTA. , . IBM PC. 16. 12 . , . DTA. X , FCB .28: MOV AH,28H ; MOV CX,records ; LEA DX,FCBname ; INT 21H ; DOS . . AL : 00 01 . FCB , . , 00 24, 25 (.19). CX .27: MOV AH,27H ; MOV CX,records ; LEA DX,FCBname ; INT 21H ; DOS AL : 00 01 02 DTA 03 . CX , FCB , . , , . , .320 (800) .20 (32) .19 (25). IBM PC. 16. 13 : ------------------------------------------------------------ .16.4 , , .16.1. 00, CX - 25 DTA ( , , ). 25 . : E10OPEN , FCB 32 DTA. F10READ 25 . G10DISP . 00 FCB 00 00. FCB .19, - . 19000000. ------------------------------------------------------------ ------------------------------------------------------------ . 16.4. . - ------------------------------------------------------------ DOS INT 25H 26H. , DOS INT 21H. , , . " " ( ). 0, 1, : 0 1 0 0 2 1 1 1 9 1 9 17 2 9 26 : = ( 9) + ( - 1) IBM PC. 16. 14 , 2 9 (2 9) + (9 - 1) = 18 + 8 = 26 -: MOV AL,drive# ; 0 A, 1 B .. MOV BX,addr ; - MOV CX,sectors ; MOV DX,record# ; INT 25H 26H ; , , CF (0) (1) . AL : AL 1000 0000 0100 0000 0010 0000 0001 0000 ? 0000 1000 DMA 0000 0100 0000 0011 0000 0010 INT . INT , CF. ------------------------------------------------------------ DOS . : . D . ( ) . DOS . D . , . MOV AH,ODH ; INT 21H ; DOS : . E IBM PC. 16. 15 DOS .E - ( ) . DL, 0 A, 1 - B .. MOV AH,OEH ; MOV DL,02 ; C INT 21H ; DOS AL ( ). DOS 2 A B, DOS 02 . ( INT 11H). : . 11 12 , , . DX FCB 11H. FCB (. DOS). MOV AH,11H ; LEA DX,FCBname ; FCB INT 21H ; DOS FCB 5CH , (DTA ). . . 22. AL .FF, , .00, . DTA (1=A, 2=B ..) . (, *.ASM), 12H: MOV AH,12H ; LEA DX,FCBname ; FCB INT 21H ; DOS AL 11H. : .13 DOS 13H. . MOV AH,13H ; LEA DX,FCBname ; FCB INT 21H ; DOS , AL 00, .FF. IBM PC. 16. 16 : . 17 DOS .17. FCB, - 16. MOV AH,17H ; LEA DX,FCBname ; FCB INT 21H ; DOS ? * . AL 00, ( ) - FF. : .19 DOS .19 : MOV AH,19H ; INT 21H ; DOS . AL (0=A, 1=B ..). FCB . FAT (1B 10), (24), (25), (26) (29). DOS. : ------------------------------------------------------------ .16.5 COM- SDEL, DOS 11H, 12H 13H . ,, : SDEL *.* ( ) SDEL *.BAK ( BAK-) SDEL TEST.* ( TEST) DOS , . DOS PSP ( ) .81 (DTA ). . Y () , N () , Return . IBM PC. 16. 17 , COM-, EXE- .5 81 PSP. . ------------------------------------------------------------ ------------------------------------------------------------ .16.5. . ------------------------------------------------------------ - , INT 21H DOS - , (FCB) . - 128 . FCB , . - FCB : , , . - , , FCB. - - (DTA) , . , , DTA. - FCB : , , (.80), . . - , DOS INT 21H, , ( ) . - DOS INT 21H FCB. - DOS INT 21H . - FCB. - ( ) . - , DTA. , . - . . IBM PC. 16. 18 - DOS INT 25H 26H , , . ------------------------------------------------------------ 16.1. DOS : ) , ) DTA, ) , ) , ) . 16.2. , . ) ? ) ? ) () , ? 16.3. , , : ( ), (12 ) ( ). . ASCII . 16.4. , , 16.3. 16.5. : )45, )73, )150, )260. 16.6. 2652 () FCB? 16.7. : ) , ) , ) , ) . 16.8. , , . FCB FLSZ FCB FCSZ. 16.9. 16.4 , , . , . 023 00315 024 00430 027 00525 049 00920 114 11250 117 00630 IBM PC. 16. 19 122 10520 124 21335 127 00960 232 05635 ? 999 00000 16.10. 16.9 , . 16.11. 16.9 , ) , ) ) ( ). IBM PC. 17. 1  17. III: DOS ------------------------------------------------------------ III: DOS : DOS, 2.0 . ------------------------------------------------------------ DOS , 16, DOS. , DOS 2.0 3.0 . , , DOS. DOS. DOS , UNIX. ASCIIZ , ; ; . ASCIIZ ------------------------------------------------------------ DOS ASCIIZ, - , ( ) , : PATHNM1 DB 'B:\TEST.ASM',0 PATHNM2 DB 'C:\UTILITY\NU.EXE',0 ( ) . (zero) ( ASCIIZ ). , ASCIIZ , DX, , LEA DX,PATHNM1. ------------------------------------------------------------ AX , . 8 , : 0 - , 1 - , 2 - , 3 - , 4 - . IBM PC. 17. 2 ASCIIZ DOS . 3C 3D. CF 0 AX. DW . CF 1, AX - , (..17.1). 01 02 03 04 05 ( ) 06 07 08 09 10 11 12 13 15 16 17 ? 18 ------------------------------------------------------------ , DOS. : .3C .3C. DX ASCIIZ-, CX - . 15; - 0. : MOV AH,3CH ; MOV CX,00 ; LEA DX,PATHNM1 ; ASCIIZ INT 21H ; DOS JC error ; MOV HANDLE1,AX ; DW , CF AX. . (.. ), 0 . IBM PC. 17. 3 CF 1 AX : 03, 04 05 (..17.1). 05 , " ". CF, AX 0005, 05 ( ). : .40 DOS .40. BX , CX - , DX - . 256 OUTREC: HANDLE1 DW ? OUTREC DB 256 DUP (' ') MOV AH,40H ; MOV BX,HANDLE1 ; MOV CX,256 ; LEA DX,OUTREC ; INT 21H ; DOS JC error2 ; CMP AX,256 ; ? JNE error3 (256 ), CF AX . , . CF 1, AX 05 ( ) 06 ( ). : .3E BX , DOS .3E, . FAT. MOV AH,3EH ; MOV BX,HANDLE1 ; INT 21H ; DOS AX 06 ( ). : . ------------------------------------------------------------ , .17.2, , . : IBM PC. 17. 4 C10CREA .3C HANDLE. D10PROC . F10WRIT , .40. G10CLSE , .3E, , . 30 : (.0DH) (. 0AH). - 32 . 32-x , . " " " ", , . DOS SORT . SORT : SORT B:<NAMEFILE.DAT >NAMEFILE.SRT NAMEFILE.DAT NAMEFILE.SRT. , .17.3 NAMEFILE.SRT . : 1) - . 2) ( ); , .17.4. ------------------------------------------------------------ ------------------------------------------------------------ .17.2. . ------------------------------------------------------------ DOS. : .3D , , .3D. . DX ASCIIZ-, AL - : 0 1 IBM PC. 17. 5 2 AL DOS 3.0 (. DOS). , (.3C), . : MOV AH,3DH ; MOV AL,00 ; LEA DX,PATHNM1 ; ASCIIZ INT 21H ; DOS JC error4 ; MOV HANDLE2,AX ; DW , 1, , CF AX. . , CF AX : 02, 04, 05 12 (. .17.1). CF. AX 0005, 05 ( ). : .3F DOS . 3F. BX , CX - DX - . 512- : HANDLE2 DW ? INPREC DB 512 DUP (' ') MOV AH,3FH ; MOV BX,HANDLE2 ; MOV CX,512 ; LEA DX,INPREC ; INT 21H ; DOS JC error5 ; CMP AX,00 ; 0 ? JE endfile , CF AX . AX . CF AX 05 ( ) 06 ( ). IBM PC. 17. 6 DOS , , , . : ------------------------------------------------------------ .17.3 , , (..17.2) DOS SORT. .3D. HANDLE .3F . , " " " ". ASCII- ( ASCII) ------------------------------------------------------------ . ASCII- ( ), DOS . FAT, , . DOS , , ASM- , (.09), (.OD) (.OA). DOS , , , " ". , : <tab>MOV<tab>AH,09<return> ------------------------------------------------------------ ------------------------------------------------------------ .17.3. . ASCII- : 094D4F560941482C30390D0A TYPE "", " " " " . , .17.4, HANREAD.ASM ( . 17.3) . HANREAD , . ------------------------------------------------------------ ------------------------------------------------------------ IBM PC. 17. 7 .17.3. ASCII-. , DOS TYPE, .. " " " " (CR/LE). () . , . . ASCII- , , . SECTOR. G10XFER SECTOR DISAREA, . " ", DISAREA, " ". ( (.09) 8). ( ) . ASCII-, ASM-, CR/LF. , EXE OBJ, DISAREA . ASCII-, . G10XFER : 1. SECTOR. 2. DISAREA. 3. SECTOR . , , SECTOR. 4. DISAREA CR/LF, DISAREA. 5. SECTOR DISAREA. 6. " " (.1A) . 7. " " (.OA) .2, .3. DEBUG. , DOS . . IBM PC. 17. 8 DOS ------------------------------------------------------------