Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TASM 2.x / MASM 6.x Assembly Language - <b>das decimal adjust after subtraction flags: o d i t s z a p c</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DAS              Decimal Adjust after Subtraction    Flags: O D I T S Z A P C
                                                            ?       * * * * *
DAS

          Logic:    If  (AL & 0Fh) > 9 or (AF = 1) then
                        AL . AL - 6
                        AF . 1
                    else AF . 0
                    If (AL > 9Fh) or (CF = 1) then
                        AL . AL - 60h
                        CF . 1
                    else CF . 0

    DAS corrects the result of a previous subtraction of two valid packed
    decimal operands (note that this result must be in AL). This
    instruction changes the content of AL so that it will contain a pair
    of valid packed decimal digits.

  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
   no operands                 4          -        1     DAS
  --------------------------------------------------------------------------

       Note:          Packed BCD stores one digit per nibble (4 bits); the
                      least significant digit is in the lower nibble.

                      It is not possible to apply an adjustment after
                      division or multiplication of packed BCD numbers.
                      If you need to use multiplication and division, it
                      is better to use unpacked BCD numbers.  See, for
                      example, the description of AAM (ASCII Adjust after
                      Multiply).

See Also: AAS DAA SUB SBB DEC NEG Flags

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson