1 0 0 0 0 0 0 1 - 1 0 0 1 0 0 1 0 - 1 0 1 0 0 0 1 1 - 1 0 1 1 0 1 0 0 - 1 1 0 0 0 1 0 1 - 1 1 0 1 0 1 1 0 1 1 1 0 0 1 1 0 - 1 1 1 1 o 16 . . , . , . - , p 9. , BL (BLinking), RGB - , , I - : IBM PC. 10 230 : BL R G B I R G B : 7 6 5 4 3 2 1 0 . : : 7 6 5 4 3 2 1 0 BL R G B I R G B . 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 1 01 0 0 0 1 0 1 0 0 14 0 0 1 0 0 0 1 1 23 - 0 1 1 1 1 1 0 1 7D , 1 0 1 0 1 0 0 0 A8 - - (BW) . INT 11H. BW 07 . . , . INT 10H AH=06, AH=07 AH=09. , - : MOV AH,09 ; MOV AL,'*' ; MOV BH,00 ; 0 MOV BL,0DAH ; MOV CX,05 ; INT 10H ; BIOS ------------------------------------------------------------ - (pixel). (CGA) : 1. ( ROM) 100 160 (.. ). 16 , "". Motorola 6845 CRT. : .3D4 3D5. 2. 200 320 . (.. ). IBM PC. 10 231 3. 200 640 . 16 , - (BW) . 8 (.. ). , - . , ROM 128 ASCII-. INT 1FH 1 , 128 . (8 ). , , p. ------------------------------------------------------------ , 0 3: : |C1 C0|C1 C0|C1 C0|C1 C0| : 0 1 2 3 , 0 3. 4 , 4 : 00, 01, 10 11. p 00 16 01, 10, 11 . p : C1 C0 0 1 0 0 0 1 1 0 1 1 INT 10H. p, , , 0, : , , . , 10101010, . - 1, : , , . , 00011011, , , . BIOS INT 10H IBM PC. 10 232 AH=00 INT 10H . AH=11 INT 10H . AH : AH=00: . AH 04 p AL : MOV AH,00 ; MOV AL,04 ; 320200 INT 10H . 9. AH=0BH: . BH BL: BH=00 p BL. 1 16 . o 0 F; BH=01 BL (0 1): MOV AH,0BH ; MOV BH,01 ; MOV BL,00 ; 0 (, , .) INT 10H ; BIOS , , , . . AH=0BH , , 0 , . AH=0CH: . 0C AH ( ). , 320200 DX ( 0 199), CX - ( 0 319). AL ( 0 3): MOV AH,0CH ; MOV AL, ; MOV CX, ; MOV DX, ; INT 10H ; BIOS AH=0DH: . . DX ( 0 199), IBM PC. 10 233 CX - ( 0 319). AH 0D. AL. ------------------------------------------------------------ ------------------------------------------------------------ . 10.1 . : ------------------------------------------------------------ , .10.1, INT 10H , (40 320 ). 1 . , . . DOS MODE (MODE CO80) COM , INT 10H. ------------------------------------------------------------ 16 (). 80 40 . ( ROM), ( ) ( - ). ( ) (, ). (CGA) , 16 , . ------------------------------------------------------------ 10.1. (CGA) ? IBM PC. 10 234 10.2. ) -, ) , ) . 10.3. , , . 10.4. "" - . 10.5. ) 320200 CGA ) 640200 EGA. 10.6. . 10.7. 12 13 . 10.8. .10.1 : ) ; ) ; ) 10 30; ) 20 300. IBM PC. 11 241  11.  ------------------------------------------------------------ : , . ------------------------------------------------------------ , , , . , , , . , , . , . : MOVS ; LODS AL AX; STOS AL AX ; CMPS , ; SCAS AL AX . REP . ------------------------------------------------------------ p . , "" "" . , ( ). , DI SI : MOVS DI,SI MOVSB MOVSW LODS AL,SI AX,SI LODSB LODSW IBM PC. 11 242 STOS DI,AL DI,AX STOSB STOSW CMPS SI,DI CMPSB CMPSW SCAS DI,AL DI,AX SCASB SCASW , MOVS, MOVSB MOVSW. , p DI SI , ( LEA). SI - DS:SI. DI - ES:DI. , MOVS, STOS, CMPS SCAS ES ( DS). REP: ------------------------------------------------------------ , , REP . , , REP MOVSB. REP CX. REP 1 CX . , . : - CLD DF 0; - STD DF 1. 20 STRING1 STRING2. , DS ES : STRING1 DB 20 DUP('*') STRING2 DB 20 DUP(' ') ... CLD ; DF MOV CX,20 ; 20 LEA DI,STRING2 ; "" LEA SI,STRING1 ; "" REP MOVSB ; CMPS SCAS , . REP . REP - , CX 0; IBM PC. 11 243 REPZ REPE - , ZF " ". ZF, CX 0; REPNE REPNZ - , ZF " ". ZF, " " CX 0. 8086, 80286 80386, o , , , . MOVS: ------------------------------------------------------------ .7.5 . . MOVS REP CX . , , , p ES, DI , . DS, SI . , MOVS ES DS, DI SI. DF MOVS 1 ( ) 2 ( ) DI SI. , REP MOVSB: JCXZ LABEL2 LABEL1: MOV AL,[SI] MOV [DI],AL INC/DEC DI ; UNC/DEC SI ; LOOP LABEL1 LABEL2: ... . 11.1 C10MVSB MOVSB NAME1 NAME2. CLD 0 . DF CLD . IBM PC. 11 244 LEA SI DI NAME1 NAME2 . DS ES DATASG, NAME1 NAME2 ES:DI DS:SI. (COM ES DS). MOV CX 10 - NAME1 NAME2. REP MOVSB : NAME1 ( p ES:DI) NAME2 ( DS:SI). 1 DI SI . CX 1. ( 10 ), CX . DF , MOVSB DI SI, , .. NAME1+1 NAME2+1 .. DF 1, MOVSB DI SI, . SI DI , .. NAME1+9 NAME2+9 . D10MVSW (.11.1) MOVSW, . MOVSW DS SI 2, . SI NAME1+8, DI - NAME2+8. LODS: ------------------------------------------------------------ LODS AL AX . DS:SI. DF SI. LODS , REP . MOV LODS, MOV , LODS - , SI. LODS , ( ), . , LODSB: MOV AL,[SI] INC SI IBM PC. 11 245 .11.1 E10LODS LODSW. : NAME1 ( As) AL, - AH. AX sA. STOS: ------------------------------------------------------------ STOS () AL AX . ES:DI. DF STOS DI 1 2 . STOS REP - , , . ( c) AX. , REP STOSB: JCXZ LABEL2 LABEL1: MOV [DI],AL INC/DEC DI ; LOOP LABEL1 LABEL2: ... .11.1 F10STOS STOSW. . 2020 () NAME3, AL , AH - . DI NAME3+10. CMPS: ------------------------------------------------------------ CMPS ( DS:SI) ( ES:DI). DF CMPS SI DI 1 2 . CMPS AF, CF, OF, PF, SF ZF. REP CX . CMPS . ------------------------------------------------------------ ------------------------------------------------------------ . 11.1. . , JEAN JOAN. : IBM PC. 11 246 J : J E : O (E O) A : A N : N N:N - p/. " ", , " ". REP REPE, , , CX p . : REPE CMPSB .11.1 G10CMPS CMPSB. NAME1 NAME2. MOVSB NAME1 NAME2, CMPSB p/: SF 0 () ZF - 1(). NAME2 NAME3. STOSW NAME3 , CMPB "/": SF 0 () ZF - 0 (). "/" 01 BH. "" 02 BL. DEBUG , G10CMPS BX 0102. ! CMPSB . CMPSW , p CX 5. , CMPSW . , SAMUEL ARNOLD CMPSW SA AR , .. AS RA. "" "", .. . CMPSW , , DW, DD DQ. SCAS: ------------------------------------------------------------ SCAS CMPS , () . SCAS IBM PC. 11 247 ( p ES:DI) AL AX. DF SCAS DI 1 2 . SCAS AF, CF, OF, PF, SF ZF. REP CX SCAS . SCAS , , , , : , . .11.1 H10SCAS NAME1 "m". SCASB , - " " CX , REPNE: REPNE SCASB NAME1 "Assemblers", SCASB "m" . DEBUG H10SCAS AH 03 , "m" . REP SCASB CX 10 06. SCASW AX. LODSW MOV AX, , AL, - AH. SCAS , o . ------------------------------------------------------------ , , . c STRING (&) . SCASB & ( STRING+8), DI a STRING+9. & DI . STRLEN EQU 15 ; STRING STRING DB 'The time&is now' ... CLD MOV AL,'&' ; MOV CX,STRLEN ; STRING LEA DI,STRING ; STRING REPNE SCASB ; IBM PC. 11 248 JNZ K20 ; ? DEC DI ; - MOV BYTE PTR[DI],20H ; K20: RET ------------------------------------------------------------ MOVSB MOVSW . MOVS . , FLDA FLDB (DB), REP MOVS FLDA,FLDB FLDB FLDA. : REP MOVS ES:BYTE PTR[DI],DS:[SI] DI SI FLDA FLDB o . ------------------------------------------------------------ STOS o . , , MOVS . , : ***---***---***---***---***--- . . . , , . : PATTERN DB '***---' DISAREA DB 42 DUP(?) . . CLD MOV CX,21 LEA DI,DISAREA LEA SI,PATTERN REP MOVSW MOVSW (**) PATTERN DISAREA, - (*-), (--): IBM PC. 11 249 ***---***--- | | PATTERN DISAREA DI DISAREA+6, p SI - PATTERN+6, DISAREA. MOVSW , DISAREA DISAREA+6, DISAREA+2, DISAREA+8, DISAREA+4 DISAREA+10 .. DISAREA: ***---***---***---***---***--- . . . ***--- | | | | PATTERN DISAREA+6 DISAREA+12 DISAREA+42 . . : ------------------------------------------------------------ COM-, .1.2, , . : B10INPT 30 , . D10SCAS SCASB , "". E10RGHT MOVSB , . ACTNLEN , : JEROME KERN OSCAR HAMMERSTEIN RICHARD ROGERS F10CLNM STOSW . ------------------------------------------------------------ ------------------------------------------------------------ .11.2. . ------------------------------------------------------------ IBM PC. 11 250 MOVS, STOS, CMPS SCAS - ES. (CLD) (STD) . DI SI . , MOVS DI,SI, CMPS - SI,DI. CX , . REP MOVS STOS (REPE REPNE) CMPS SCAS. c CMPSW SCASW. . , , NAME1 10 , , LEA, NAME1+9. - NAME1+8. ------------------------------------------------------------ 11.1. ) MOVSB, ) LODSB )STOSB REP. ) MOVSW, ) LODSW ) STOSW REP. 11.2. , , .11.1. ES. MOVSB MOVSW . H10SCAS NAME1 "mb". DEBUG , . 11.3. : DATASG SEGMENT PARA CONAME DB 'SPACE EXPLORERS INC.' PRLINE DB 20 DUP(' ') , : ) CONAME PRLINE ; IBM PC. 11 251 ) CONAME PRLINE ; ) CONAME AX; ) AX PRLINE+5; ) CONAME PRLINE ( ); ) CONAME PRLINE, . , BH. 11.4. H10SCAS (.11.1) , NAME1 "er". , "er" NAME1 : /As/se/mb/le/rs/. : ) SCASW , NAME1, - NAME1+1; ) SCASB "" "r". 11.5. , . 03, 04, 05 B4. 20 . IBM PC. 12 262  12. I:  ------------------------------------------------------------ I: : , , . ------------------------------------------------------------ , ( 10), ( 2). , , 16- , . , , . . ASCII . ------------------------------------------------------------ ADD SUB , . : 1, CX . , , . . 12.1 ADD SUB, . B10ADD ADD , C10SUB SUB . : / -; / -; / -; / -.; / -.. ------------------------------------------------------------ ------------------------------------------------------------ . 12.1 ADD SUB. - , o . WORDB WORDA, DW: IBM PC. 12 263 MOV AX,WORDA ADD AX,WORDB MOV WORDB,AX . , .. -128 +127. . , AL, , AH. , AL .60, ADD AL,20H AL - .80. "". , .80 1000 0000 . .. , +128, -128. AL AX. CBW (Convert Byte to Word - ) .60 AL .0060 AX, (0) AH. ADD AX : .0080, +128: CBW ; AL AX ADD AX,20H ; AX : 15 , -32768 +32767. , . +32767 . . - , , - , . ------------------------------------------------------------ ------------------------------------------------------------ . 12.2. . IBM PC. 12 264