Home > On-Demand Archives > Talks >
Mysteries of the Ancients: Binary-Coded Decimal (BCD)
Clive "Max" Maxfield - Watch Now - EOC 2023 - Duration: 41:44
It has to be acknowledged that growing old is not as much fun as I had hoped it would be. Having said this, one of the great things about being old (I’m clutching at straws) is that you end up having learned a whole lot of “stuff” about a whole lot of “stuff” (some of this stuff may even be useful).
When most people hear the term “binary-coded decimal (BCD),” they think “I know all about that” (they usually don’t) and “no one uses BCD anymore” (you’d be amazed how much they do).
Apart from anything else, engineers in the early days of digital computing had to do a lot of “stuff” using not much “stuff,” as it were. As such, BCD provides a great platform to introduce all sorts of cunning tricks, many of which may prove to be useful in modern designs.
In this presentation, we will dive headfirst into the BCD fray with gusto and abandon (and aplomb, of course). As is usually the case in my presentations, we will be leaping from topic to topic with the agility of young mountain goats, so I urge all attendees to dress appropriately and responsibly.
Hi Michael -- thanks for the kind words -- a lot of the early micros had different ways of handling BCD -- as you say, some had a DAA instruction, others actually offered BCD addition and subtraction operations, and some just gave a soft of half (nybble) carry flag you could use to sort things out yourself.
For some reason, two's complement has always baffled me. I get it now.
My work here is done LOL
Excellent talk on a subject I have dealt with in the past, but not with the same level of detail.
I remember working with an Intel 8042 microcontroller, and saw one of the instructions was DAA, or "decimal adjust accumulator after addition". It was meant to allow the programmer to add 2 packed BCD values using the regular binary ADD instruction, and then correct the result. Here is a WWW link describing this same instruction in the x86 instruction set:
https://www.righto.com/2023/01/understanding-x86s-decimal-adjust-after.html