Re: A83: DAA and BCD.


[Prev][Next][Index][Thread]

Re: A83: DAA and BCD.




James Matthews wrote:
> 
> Ok, can someone explain to me what is BCD format, and what does DAA do?!

BCD means Binary Coded Decimal (there abouts).  It's a numerical format
used to express decimal numbers more conveniently in a binary system. 
Typically, a number will be represented as 1 or 2 decimal digits per
byte.  1 digit per byte is very inefficient spacewise, but it's very
easy to work with decimal numbers in this form.  2 digits per byte
(packed BCD) is more efficient, but more difficult to work with.

In either case, BCD is less efficient spacewise than storing the number
in native binary, but this is the trade off for ease of use.

The floating point format used in the TI-83 is similar to BCD format
because it stores decimal digits individually, similarly to packed BCD.

DAA, interpreting the instruction set list I'm reading, converts a into
BCD after a BCD operation performed on a.  Adding or subtracting BCD
numbers isn't as simple as an add or sub instruction - I'm guessing that
one must add the two numbers and then use DAA to convert the result back
to BCD format.

-- 
John Kugelman.  kugelman@mnsinc.com

I believe we can change anything.
I believe in my dream.
    - Joe Satriani


References: