Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/10/08 15:18
Read: times


 
#149224 - DAA Misunderstanding
Last night, I was working on my Verilog 8051 model, and from the description in the "bible", I was having trouble understanding exactly how the DA A (Decimal-adjust Accumulator for Addition) instruction is supposed to work. So I decided I would just try it, and I found that my SiLabs C8051F120 doesn't seem to behave anywhere close to what I expected.

This screenshot shows what I am talking about:


Here, I have just set the auxiliary carry flag (AC) in PSW, loaded the ACC with 0Ah, and executed the DA A instruction. According to the bible, if AC is set or if the low order nibble of ACC is greater than nine, then the DA A instruction should add 6 to the low order nibble of ACC, giving a result of 10h in ACC.

But this doesn't happen! As the screenshot shows, DA A didn't make the expected adjustment.

After seeing this, I wrote a program to exercise DA A for all possible values of carry, aux carry, and ACC. The result is here, and shows all kinds of goofiness in cases where carry and aux carry are not both zero before the DA A is executed.

Can somebody help me understand what's going on here? Am I being stupid? Or is the C8051F120 wrong? Or is the bible wrong? Or is this a case where the part doesn't match the bible, but it doesn't matter somehow? Or ???

It might also help if somebody could experiment with a different chip. I don't have an easy way to do that offhand.

Thanks,

-- Russ


List of 34 messages in thread
TopicAuthorDate
DAA Misunderstanding            01/01/70 00:00      
   could this be it?            01/01/70 00:00      
      Maybe ... nope            01/01/70 00:00      
   a double negative ???            01/01/70 00:00      
      ... or an exclusive OR            01/01/70 00:00      
      Case 4            01/01/70 00:00      
         Are there don't-care situations?            01/01/70 00:00      
            I think this is the case            01/01/70 00:00      
               Not quite ...            01/01/70 00:00      
                  no            01/01/70 00:00      
            True to bible            01/01/70 00:00      
   e-mail to SILabs sent just now            01/01/70 00:00      
   Operands must consist of two packed BCD digits!            01/01/70 00:00      
      OK, but what does a packed 07 look like            01/01/70 00:00      
         Correct            01/01/70 00:00      
            if case 4 is a biblical catastrophe            01/01/70 00:00      
               Not true            01/01/70 00:00      
                  more to this            01/01/70 00:00      
                     Same as Case 1            01/01/70 00:00      
   reply from SILabs            01/01/70 00:00      
      I'm happy now            01/01/70 00:00      
      I am willing to try...            01/01/70 00:00      
         DA A test program            01/01/70 00:00      
            the results...            01/01/70 00:00      
               DS89C450 is strictly "biblical", too...            01/01/70 00:00      
                  The DAA instruction is so specific...            01/01/70 00:00      
                     point of view            01/01/70 00:00      
                        Agreed!            01/01/70 00:00      
               the last hope gone... XC866 is DAA-biblical too            01/01/70 00:00      
                  no "pick and choose" eitherThe Bible or "the bible            01/01/70 00:00      
                     don't take it too literally, please...            01/01/70 00:00      
      DAA on other Architectures            01/01/70 00:00      
         this is how it happened            01/01/70 00:00      
         Thanks for the link!            01/01/70 00:00      

Back to Subject List