Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
18 Views

question about DAA(opcode 0x27) instruction's operation

Hi,

I'm currently writing a x86 code emulator.

So I need to know detailed instruction's operation.

 

I was writing a DAA instruction, detailed operation is like this,

 

old_AL ← AL;
old_CF ← CF;
CF ← 0;
IF (((AL AND 0FH) > 9) or AF = 1)
    THEN
        AL ← AL + 6;
        CF ← old_CF or (Carry from AL ← AL + 6);
        AF ← 1;
    ELSE
        AF ← 0;
FI;
IF ((old_AL > 99H) or (old_CF = 1))
    THEN
        AL ← AL + 60H;
        CF ← 1;
    ELSE
        CF ← 0;
FI;

 

I'm just wondering about whether constant 0x99 is correct or not.

Somebody(from the internet) said  0x9F was right, but the intel manual says 0x99 is right.

Which one is correct?

 

I need exactly answer from Intel hardware engineering contacts.

Thank you.

 

0 Kudos
1 Reply
Highlighted
Employee
18 Views

If the threshold value is 9FH, that meant an input value of 9AH will become A0H, which is not a packed BCD value in one byte.

With the threshold value of 99H, 9AH will be adjusted by DAA into 00H, which is the wrapped result one would expect out of 1 byte packed BCD.

0 Kudos