Beruflich Dokumente
Kultur Dokumente
AH must be cleared before addition If AL is between 0 to 9 and AF is 0 AAA sets the 4 higher order bits of AL to 0. If the lower digits of AL is between 0 to 9 and AF is SET, 1. 06 is added to AL. 2. The upper 4-bits of AL is cleared and 3. AH is incremented by 1
Example:
MOV AL,39H; AL=39H MOV BL,32H;BL=32H ADD AL,BL; RESULT AL=6BH AAA; AH=01H, AL=01H,CF=AF=1
NOTE:
6B
=11
=0101
(HEX)
Used after subtraction Used to adjust the hexadecimal answer,which is present in AL register to an unpacked BCD answers. The unpacked answer will be stored in AH and AL register.
AH must be cleared before addition If AL is between 0 to 9 and AF is 0 AAS sets the 4 higher order bits of AL to 0.
Example:
MOV AH,00H ;AH=00 MOV AL,39H ; AL=39H MOV BL,32H ; BL=32H SUB AL,BL ; AL=07H AAS ;do not alter the contents of AL and AH register
Used to adjust hexadecimal product which is present in AX register to unpacked BCD format. Multiplication has to performed on two unpacked BCD numbers. Only S , Z , P flags will be affected Operation:
AL
Examples:
MOV AL,09H; AL=09H MOV BL,09H; BL=09H MUL BL ; AH=00,AL=51H AAM ;AH=08 ,AL=01 HLT
AL=AL
Used before division to adjust the unpacked BCD data to hexadecimal format Result will be obtained in unpacked BCD format.
Quotient
Examples
MOV AX,0205H ;AX=0205 MOV BL,06H ; BL=06 AAD ;AX= 0019H DIV BL ; AH=01,AL=04
AX=0205H
Used after packed BCD addition. Used to adjust hexadecimal result to packed BCD format 8 bit result must be stored in AL register. Operation:
if lower nibble of AL>9 or AF=1 Then AL=AL+06 ;AF=1
Example
MOV AL,42H ;AL=42H MOV BL,29H ;BL=29H ADD AL,BL ;AL=6BH DAA ;AL=71 ;which is packed BCD format result for 42+29=71
Flags
Used after subtracting two packed BCD number Result will be stored in AL register in hexadecimal format. Used to convert hexadecimal result to packed BCD Operation:
if lower nibble of AL>9 or AF=1 Then AL=AL-06 ;AF=1
Example
MOV AL,85H ;AL=85H MOV BL,57H ;BL=57H SUB AL,BL ;AL=2EH DAS ;AL=28 ;which is packed BCD format result for 85-57=28
Flags