Instruction Set
4-43
DAA
DAA
Flag Settings After Instruction
Examples
This example adds two 3-byte packed decimal numbers.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Processor Status
Flags Register
reserved
OF DF
IF TF SF ZF
AF
PF
CF
? = undefined; – = unchanged
AF=1 if carry or borrow to low nibble
AF=0 otherwise
PF=1 if low byte of result has even number of set bits
PF=0 otherwise
CF=1 for carry or borrow to high-order bit
CF=0 otherwise
?
–
–
–
res
res
res
SF=1 if result is 0 or positive
SF=0 if result is negative
ZF=1 if result equal to 0
ZF=0 if result not equal to 0
PADDEND1
DB
00h,24h,17h,08h
; 241708 packed BCD
PADDEND2
DB
00h,19h,30h,11h
; 193011 packed BCD
; multibyte packed decimal addition: PADDEND1 = PA PADDEND2
; add right bytes
MOV
AL,PA 3
ADD
AL,PA 3
DAA
MOV
PA 3,AL
; add next bytes
MOV
AL,PA 2
ADC
AL,PA 2
DAA
MOV
PA 2,AL
; add next bytes
MOV
AL,PA 1
ADC
AL,PA 1
DAA
MOV
PA 1,AL
; if CF is 1, propagate carry into left byte
JC
ADD_CARRY
JMP
CONTINUE
ADD_CARRY:
MOV
PADDEND1,1
CONTINUE:
...
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...