. .13.2 - - . AAM , , . - 0108090105. , , . ASCII- (. " ASCII- "). ------------------------------------------------------------ ------------------------------------------------------------ .13.2. ASCII-. ASCII- AAD (ASCII Adjust for Division - ASCII-) ASCII . , ASCII- . AAD AX. , AX 3238 ASCII- CL 37 ASCII- . : AX: AND CL,0FH ; CL .. AND AX,0F0FH ; AX .. 0208 AAD ; 001C DIV CL ; 7 0004 AAD AH 10 (.0A), p 20 (.14) AL AH. 001C . 28. 01 09. . 13.3. . . AH AAD AL. p: 00090204 AH 02. IBM PC. 13 6 , , " ASCII- ." - (BCD) ------------------------------------------------------------ ASCII- 00090204. , , 0924. - (BCD - Binary Coded Decimal) ( ). 0 9. - ASCII-. ------------------------------------------------------------ ------------------------------------------------------------ .13.3. ASCII-. , , 0924 10 , 16 (.. . ), .039C. - (BCD-). p : DAA (Decimal Adjustment for Addition - ) DAS (Decimal Adjustment for Subtraction - ) . , . 13.4, ASCII- BCD- . B10CONV ASCII BCD. , . , , , BCD- ASCII-. ASCII- . C10ADD BCD-. - 127263. ASCII- ------------------------------------------------------------ b ASCII BCD . . IBM PC. 13 7 ASCII- , ASCII- BCD- , , : , ASCII- 10, 2. : 1. ASCII- . 2. . ASCII-. 3. ASCII- 1, 10, 100 (.1, A, 64) .. . 1234 ASCII- : 4 1 = 4 4 3 10 = 30 1E 2 100 = 200 C8 1 1000 = 1000 3E8 : 04D2 ------------------------------------------------------------ ------------------------------------------------------------ . 13.4. BCD- . , .04D2 1234. . 13.5. B10ASBI ASCII- 1234 . , ASCII- 4 ASCLEN. ASCII- ASCVAL-1 SI, - BX. B20 ASCII- AL: MOV AL,[SI+BX] ASCVAL-1 BX (4), .. ASCVAL+3 ( ASCVAL). BX 1, . BX, CX, , , LOOP. MULT10 10, 1,10,100 .. , , SI DI. ASCII- ------------------------------------------------------------ IBM PC. 13 8 , p, ASCII-. . 10 (. 0A) 10. , 0 9, ASCII-. .4D2 : 4D2 : A 7B 4 7B : A C 3 C : A 1 2 1 , .A, . ASCII-, 1234. , .. 31323334. . 13.5. C10BIAS . 4D2 ( B10ASBI) ASCII- 1234. (.13.5.) p . ------------------------------------------------------------ ------------------------------------------------------------ .13.5. ASCII . ------------------------------------------------------------ . 12,345, 5 : : 12,345 5: +5 : 12,350 = 12,35 12,3455, 50 . 12,34555 500 : 12,3455 12,34555 +50 +500 12,3505 = 12,35 12,35055 = 12,35 , , 5000 .. IBM PC. 13 9 , 12345 .3039. 5 3039, 303E, 12350 . . .181F, 1675 - .. . , . 10 (.A): .303E : .A = 4D3 .1235 .4D3 ASCII- 1235. o 12,35, . . 5 10, : 50 p 100. : (5, 50, 500 ..) (10, 100, 1000 ..). , p. : ------------------------------------------------------------ , .13.6, p . . : B10INPT . . D10HOUR ASCII . E10RATE ASCII . F10MULT , . . , , , , , . G10WAGE , ASCII ASCII-. IBM PC. 13 10 K10DISP . M10ASBI ASCII ( ) . ------------------------------------------------------------ ------------------------------------------------------------ .13.6. . . , .13.6, c , . - , , 10, a ASCII- 10. 655350, . . . , , , , . 0 9 . . XLAT (. 14). : , , . . , , 12,34-, -12,34. . , . ASCII . , , , , ASCII- , , 12 " ". IBM PC. 13 11 IMUL IDIV . , 5. ------------------------------------------------------------ ASCII- . 0 9, . . ASCII- AAA; ASCII- - AAS. ASCII-, " " , . AAM. ASCII-, : 1) " " , 2) AAD. ASCII- . ASCII-: .30 .39, () , , . ------------------------------------------------------------ 13.1. , AX 9 ASCII , BX -7 ASCII . : ) ADD AX,33H ) ADD AX,BX AAA AAA ) SUB AX,BX ) SUB AX,0DH AAS AAS 13.2. UNPAK . 01040705 . , ASCII-, .. 31343735. IBM PC. 13 12 13.3. ASCA 313733 ASCII-, ASCB 35. ASCII- ASCPRO. 13.4. 13.3, ASCA ASCB ASCQUO. 13.5. : ) ASCII 46328 .; ) . ASCII-. 13.6. , (INT 12H - ..2), ASCII- : nnn . IBM PC. 14 24  14.  ------------------------------------------------------------ : , . ------------------------------------------------------------ , , , , . - XLAT. , - , . . . . ------------------------------------------------------------ , .. ( ), . , - , 64- : STACK DW 64 DUP(?) : MONTAB DB 'JAN','FEB','MAR', ... ,'DEC' COSTAB DB 205,208,209,212,215,224,... MONTAB , COSTAB - . ( ). ( ) ( ), () . , "Paper" 9 . , . . IBM PC. 14 25 STOKTBL DB 12,'Computers',14,'Paper....',17,'Diskettes' : STOKTBL DB 12, 'Computers' DB 14, 'Paper....' DB 17, 'Diskettes' . ------------------------------------------------------------ , - 03 March. , . - September, : MONTBL DB 'January..' DB 'February.' DB 'March....' 9 . 'January' - MONTBL+0, 'February' - MONTBL+9, 'March' - MONTBL+18. 03, : 1. ASCII 33 03. 2. : 03 - 1 = 02 3. (9): 02 9 = 18 4. (18) MONTBL; : MONTBL+18. ------------------------------------------------------------ ------------------------------------------------------------ . 14.1. . .14.1 . - . MONIN. , ASCII- MONIN. . p , . IBM PC. 14 26 , . , : 1, 2, 3,... 106, 107, 108,... 5, 10, 15. , . , . ------------------------------------------------------------ , . - , , 134, 138, 141, 239 245. , . . . , , , , . , . (, , ). , : STOKNOS DB '101','107','109',... STOKDCR DB 'Excavators','Processors','Assemblers',... , : STOKTAB DB '101','Excavators' DB '107','Processors' DB '109','Assemblers' ... .14.2 . . STOKNIN . , . , (A30) DESCRN. , , . IBM PC. 14 27 , , STOKNIN AX. STOKNIN 3233, MOV AX 3332. , MOV XCHG, AX, , .. 3233. CMP, , , - . , p , . XCHG, MOV, , BX AX BX : MOV AX,STOKNIN LEA SI,STOKTAB C20: MOV BX,[SI] CMP AX,BX JA JB ... . , ( ) . . 14.2 . o . , REPE CMPSB, p CX. . , o , : - 0-1000.00 10 0,00 1000,01-2500,00 15 050,00 2500,01-4250,00 18 125,00 4250,01-6000,00 20 260,00 6000,01 23 390,00 IBM PC. 14 28 . : TAXTBL DD 100000,250000,425000,600000,999999 , x : , ; , . : : 100 - - , REPE CMPS. , (.14.2) . STOKNIN , STOKTAB - , c : : |123|035Excavators|038Lifters |049Presses | ... | | | | | | | : 00 03 06 16 19 29 32 .14.3 STOKTAB, '999' . STOKNIN: STOKNIN 035 123 : .- 038 123 : .- 049 123 : .- 102 123 : .- 123 123 : , CMPSB .14.3 , p SI DI. ------------------------------------------------------------ ------------------------------------------------------------ .14.3. CMPSB IBM PC. 14 29 CX 03, SI DI 03 00 . (035:123) , SI 04, DI: 01, CX: 02. SI 16, DI: 00. DI STOKNIN. , SI, , (, ) . CX , , - 02. SI CX , : SI CMPSB 04 CX 02 10 . 16 CX , ( ), : 1, 2 3 . , CX 00, p SI . , . , , .00; p .FF. , . , . SCAS. XLAT ------------------------------------------------------------ XLAT . XLAT . (IBM) XLAT ASCII EBCDIC. 0 9 ASCII EBCDIC. ASCII .30-39, EBCDIC - .F0-F9, OR. , ASCII (.40) IBM PC. 14 30 EBCDIC. XLAT , 256 , EBCDIC ASCII : XLTBL DB 47 DUP(40H) ; EBCDIC DB 0F0H,0F1H,0F2H,0F3H,...,0F9H ;0-9 (EBCDIC) DB 199 DUP(40H) ; EBCDIC XLAT BX, (, ASCNO) AL. : LEA BX,XLTBL MOV AL,ASCNO XLAT XLAT AL a , .. BX AL. , , ASCNO 00, XLTBL+00 XLAT 00 .40 . ASCNO c .32, XLTBL+50. .F2 (2 EBCDIC), XLAT AL. ------------------------------------------------------------ ------------------------------------------------------------ .14.4. ASCII EBCDIC. .14.4 (2E) (2D) ASCII EBCDIC (4B 60 ). . ASCNO 31.5 , .2D33312E3520. EBCNO . 60F3F14BF540. : . ASCII- ------------------------------------------------------------ , .14.5, ASCII-, .. , ASCII- .53 - S, 53 S. 1616: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF ------------------------------------------------------------ IBM PC. 14 31 ------------------------------------------------------------ .14.5. . ASCII- .8.1, ASCII- , o . . ASCII, . , ASCII . 00, 01 .. .00 . 3030, .01 .3031 .. HEXCTR 00. 1. C10HEX HEXCTR .. , HEXCTR . 4F. . 4 XLATAB. AL .34. . F .46. o .3446, 4F. DOS (.40) .1A , . , DOS (.09), '$' . . ASCII-. . : ------------------------------------------------------------ . , . , , . , , , . , , . , , . , , . - , . . , . 1 2, 2 3 .. IBM PC. 14 32 , . , .. 1-2, 2-3 .. , . , SWAP : (YES) (NO): G10: G20: SWAP=NO G30: > ? : SWAP=YES ? : G30 : SWAP=YES? : G20 ( .) : , .14.6, 30 , . ------------------------------------------------------------ ------------------------------------------------------------ .14.6. . , ------------------------------------------------------------ , . , ( ) , . TYPE (), LENGTH () SIZE () . : TABLEX DW 10 DUP(?) ; 10 TYPE (DW ), LENGTH DUP- (10) SIZE (10 2 = 20). : MOV AX,TYPE TABLEX ;AX=0002 MOV BX,LENGTH TABLEX ;BX=000A (10) MOV CX,SIZE TABLEX ;CX=0014 (20) IBM PC. 14 33 LENGTH SIZE . , SI , : CMP SI,SIZE TABLEX 23 " " TYPE, LENGTH SIZE. ------------------------------------------------------------ , , . . , , . : , , p,