JNZ ... ; ? 3. TEST DX,OFFH ; DX JZ ... ; ? NOT p , : , - . , , p AL 1100 0101, NOT AL 0011 1010. . NOT NEG, , (." " .1.). : ------------------------------------------------------------ . , , , . , (, YES yes) . A Z IBM PC. 7 146 . 41 5A, a z . 61 7A. p , 0 1 : : 76543210 : 76543210 A: 01000001 a: 01100001 Z: 01011010 z: 01111010 COM-, . 7.6, TITLEX , TITLEX+1. BX TITLEX+1 AH, TITLEX+1. .61 7A, AND 5 0: AND AH,11011111B , ( a z), . TITLEX, BX . BX . SI DI. ------------------------------------------------------------ ------------------------------------------------------------ . 7.6. . ------------------------------------------------------------ , , : - ; - ; - ; - 8 ( ) 16 ( ); - ( ) ( ). 1 c , 1 CL. CF . c: IBM PC. 7 147 SHR ; () SHL ; () SAR ; SAL ; SHR: MOV CL,03 ; AX: MOV AX,10110111B ; 10110111 SHR AX,1 ; 01011011 ; 1 SHR AX,CL ; 00001011 ; 3 SHR AX 1 . CF, AX . c AX . CF 1, 1, 0, AX . SAR: MOV CL,03 ; AX: MOV AX,10110111B ; 10110111 SAR AX,1 ; 11011011 ; 1 SAR AX,CL ; 11111011 ; 3 SAR SHR: . , . . . p, SHL SAL . , - 2. , . (, 5 7) (2 3, ) CF 1. , 2 , , CL 2. , CF JC (, ). , . : ROR ; ROL ; RCR ; RCL ; IBM PC. 7 148 ROR: MOV CL,03 ; BX: MOV BX,10110111B ; 10110111 ROR BX,1 ; 11011011 ; 1 ROR BX,CL ; 01111011 ; 3 ROR BX . ROR . RCR RCL CF. CF, CF . , . , 32- DX:AX , 16 DX, - AX. 2 c : SHL AX,1 ; RCL DX,1 ; DX:AX 2 SHL AX , CF. RCL DX CF. ------------------------------------------------------------ : 1. , 2. . , p ( .7.5), c . , LOOP. , : : IBM PC. 7 149 : 1 1: , , 3. , . 25 ( ) . 4. . " " . 5. , , . (, XLAT, ). 6. , . LEA, SI DI, . , . ------------------------------------------------------------ (, B20:) NEAR. . LOOP -128 +127 . . . 01 7F +1 +127, . FF 80 -1 +128. 1 4 , . ( 50 ). LOOP, CX . LOOP , . IBM PC. 7 150 , , . , , , MOV, . , , c , . . CALL, - RET. , , , , RET . , - COM- . . : MOV AX,SI MOV AX,[SI] MOV AX SI. MOV SI. , . ------------------------------------------------------------ 7.1. p JMP, LOOP ? ? 7.2. JMP . 0624. , . JMP: ) 27, ) 6B, ) C6. 7.3. 12 : 1, 1, 2, 3, 5, 8, 13,... ( ). LOOP. , DEBUG . IBM PC. 7 151 7.4. , AX BX , a CX DX - . CMP ( ) : ) DX , CX? ) BX , AX? ) CX ? ) ? ) BX , AX? ) DX , CX? 7.5. ? a) ; ) ; ) ; ) ; ) . 7.6. , .7.4, BEGIN RET? 7.7. PROC p FAR NEAR? 7.8. ? 7.9. EXE- A10 B10, B10 C10, C10 D10. , DOS, ? 7.10. , BL 11100011 BOONO 01111001. BL : ) XOR BL,BOONO; ) AND BL,BOONO; ) OR BL,BOONO; ) XOR BL,11111111B; ) AND BL,00000000B. 7.11. .7.6 : ) TITLEX ; ) . 7.12. , DX 10111001 10111001, p CL - 03. DX : ) SHR DX,1; ) SHR DX,CL; ) SHL DX,CL; ) SHL DL,1; ) ROR DX,CL; ) ROR DL,CL; ) SAL DH,1. 7.13. , , AX 10. 7.14. , " ", DX:AX 2. : ) 4; ) 4; ) 48 DX:AX:BX 2. IBM PC. 8 172  8. I:  ------------------------------------------------------------ I: : , . ------------------------------------------------------------ , o ( ) . . c , , . , , ASCII . INT (). ( ) . . INT 10H, BIOS. INT 21H, DOS. , , Return. p DOS INT 21H BIOS. (-, BW), . 9 10 . : INT ------------------------------------------------------------ INT , DOS BIOS . . INT : IBM PC. 8 173 2 ; TF IF; 2 CS ; 2 ; ; , INT. . . : BIOS INT 10H DOS INT 21H . INT 10H INT 21H. ------------------------------------------------------------ . , , 25 ( 0 24) 80 ( 0 79). : -------------------------------------------------------- . . -------------- -------------- -------------------------------------------------------- 00 00 00 00 00 79 00 4F 12 39/40 00 27/28 24 00 18 00 24 79 18 4F -------------------------------------------------------- INT 10H . 5- 12- : MOV AH,02 ; MOV BH,00 ; 0 MOV DH,05 ; 05 MOV DL,12 ; 12 INT 10H ; BIOS IBM PC. 8 174 02 AH INT 10H . DX, ( ) BH ( 0). . MOV c . : MOV DX,050CH ; 5, 12 ------------------------------------------------------------ ("") . c , . . DX, 07 - BH 0600H AX. : MOV AX,0600H ;AH 06 () ;AL 00 ( ) MOV BH,07 ; (/) MOV CX,0000 ; MOV DX,184FH ; INT 10H ; BIOS 06 AH INT 10H . ; () . , . 184F, . - , . : DOS ------------------------------------------------------------ , . , DOS, p , DOS 2.0. DOS , DOS . DOS , , . IBM PC. 8 175 : DOS ------------------------------------------------------------ DOS , AH 09 ( DOS) DOS INT 21H. o ($), : NAMPRMP DB ' ?','$' . . MOV AH,09 ; LEA DX,NAMPRMP ; . INT 21H ; DOS "$" c ( ), : ' ?$', DB '$'. , "$". , , , "$" . LEA NAMPRMP DX DOS . NAMPRMP, DX LEA, o , DOS DS DX (DS:DX). : ASCII ------------------------------------------------------------ 256 ASCII , . . 00 FF , ASCII . 20. . 8.1 COM-, ASCII. ; B10CLR, C10SET D10DISP. B10CLR , C10SET 00,00. D10DISP CTR, 00 y 1 , . FF. ------------------------------------------------------------ ------------------------------------------------------------ . 8.1. ASCII . 08 . 0D c, IBM PC. 8 176 . : (.8.1), , COM-. , , :ASCII.COM. (.00), " " (. 01 02) (.03, 04 05). 07 . 06 "", .08 0D . 0D " " (). .0E - . . 7F . . , . 08 0D. , o , , . 08 ( ) 0D ( ): CMP CTR,08H ; 08? JB D30 ; - CMP CTR,0DH ; / 0D? JBE D40 ; - D30: MOV AH,40H ; < 08 ... ; > 0D INT 21H D40: INC CTR : DOS ------------------------------------------------------------ , . , DOS, c , , INT. -, . , ; , . -, , . , . LABEL BYTE. . , - . FF 255. DOS . , . NAMEPAR LABEL BYTE ; : IBM PC. 8 177 MAXLEN DB 20 ; ACTLEN DB ? ; NAMEFLD DB 20 DUP (' ') ; LABEL , NAMEPAR MAXLEN a . MASM STRUC. , , , , , c 24 " ". AH - 10 (. 0AH), (NAMEPAR ) DX INT 21H: MOV AH,0AH ; LEA DX,NAMEPAR ; INT 21H ; DOS INT , , c , (20 ). Return. (. 0D) (NAMEFLD ). , , BROWN (Return), c : .: |20| 5| | R| O| W| N| #| | | | | ... .: |14|05|42|52|4F|57|4E|0D|20|20|20|20| ... (ACTLEN ) - 05. Return NAMEFLD +5. # , . 0D . 20 .0D, 19 . : ------------------------------------------------------------ EXE-, . 8.2, , . , Return . , TED SMITH: ------------------------------------------------------------ ------------------------------------------------------------ . 8.2. IBM PC. 8 178 1. 09 2 4, 2. 40, 36 SHR E10CENT 09 o , 2. 00001001 00000100. NEG +4 -4. ADD 40, DL - 36. 12 36 : 12: TED SMITH | | : 36 40 E10CODE , c (07) : MOV NAMEFLD[BX],07 BX , MOV , BX NAMEFLD, 07. , 05 07 NAMEFLD+05 ( Return). E10CODE "$" 07. , F10CENT , p . Return , , , o Return. , Return, y : (.): |14|00|0D|... Return . p . Return , : , , . , , Return (.0D) NAMEFLD (.20). NAMELEN IBM PC. 8 179 c 0D. , , NAMELEN 05, 0D NAMEFLD+5. BX NAMEFLD: MOV BH,00 ; BX MOV BL,NAMELEN ; 0005 MOV NAMEFLD[BX],20H ; 0D MOV (.20) , o : NAMEFLD BX, .. NAMEFLD+5. , . : NAMEPAR (.) 1. BROWN |14|05|42|52|4F|57|4E|0D|20|20|20| ... |20| 2. HAMILTON |14|08|48|41|4D|49|4C|54|4F|4E|0D| ... |20| 3. ADAMS |14|05|41|44|41|4D|53|0D|4F|4E|0D| ... |20| HAMILTON BROWN. , ADAMS HAMILTON, HAMIL. Return T. - ON o ADAMS. NAMEFLD : MOV CX,20 ; 20 MOV SI,0000 ; B30: MOV NAMEFLD[si],20H ; INC SI ; LOOP B30 ;20 SI DI BX. , , . , NAMEFLD DB (), , WORD, a PTR (), : MOV CX,10 ; 10 LEA SI,NAMEFLD ; B30: MOV WORD PTR[SI],2020H ; INC SI ; INC SI ; LOOP B30 ;10 IBM PC. 8 180 MOV B30 , SI. p LEA SI MOV 30, , , : MOV WORD PTR[NAMEFLD],2020H ; , . c , . : DOS ------------------------------------------------------------ , DOS 2.0 ( UNIX). DOS, . (file handle), y BX, /. : 0 ( ) CON 1 ( ) CON 2 ( ) CON 3 / AUX 4 LPT1 PRN DOS / - INT 21H, AH: .3F - , .40 - . CX /, DX - /. / (CF) AX , . o CF, ( 6) AX. AX , , - CF, - . o , o / . - , p. : DOS ------------------------------------------------------------ IBM PC. 8 181 DOS: DISAREA DB 20 DUP(' ') ; ... MOV AH,40H ; MOV BX,01 ; MOV CX,20 ; LEA DX,DISAREA ; INT 21H ; DOS LEA DX DISAREA DOS , . ( ), AX . , y . CF ( 6) AX. AX , , - CF. : DEBUG . DEBUG A 100 ( ) p 100. , DEBUG , . 100 MOV AH,40 102 MOV BX,01 105 MOV CX, ( ) 108 MOV DX,10E 10B INT 21 10D RET 10E DB ' ' AH . 10F DX - DB, . , Return. U (U 100,10D) . R T . INT 21H BIOS, 10B GO (G 10D) RET. . Q DOS. : DOS ------------------------------------------------------------ IBM PC. 8 182 , DOS: INAREA DB 20 DUP (' ') ; MOV AH,3FH ; MOV BX,00 ; MOV CX,20 ; LEA DX,INAREA ; INT 21H ; DOS LEA INAREA DX. INT , c ,