News for hackers. Stuff that matters.
Re:Understanding the x86's Decimal Adjust after Addition (DA... by atq2119 on Tuesday January 31, 2023 @08:38AM (#34594846)
Since reverse engineering the 8086 is your thing, I was really hoping for this blog post to go into how the instruction is actually implemented. Is it all fixed function in the ALU? Is it micro-coded and if so, how?
Re:Understanding the x86's Decimal Adjust after Addition (DA... by userbinator on Tuesday January 31, 2023 @09:22AM (#34595313)
Given that it's a 4-cycle instruction (and a reg-reg add is 3), it seems rather quick to be microcoded.

(As an aside, Google gives absolutely horrible results if you search for "8086 DAA instruction timing". At least half the ones on the first page seem to be for the 8085, there's also this article itself and the discussion on HN, neither of which have the information.)

Re:Understanding the x86's Decimal Adjust after Addition (DA... by kens on Tuesday January 31, 2023 @11:36AM (#34597390)
This article is sort of a prelude to looking at the 8086's hardware. (I was looking at the Intel documentation and realized it was confusing and slightly wrong, so needed to figure out what is really happening.)

The 8086 implements the instruction in microcode, but like all the arithmetic operations, the interesting stuff happens in the ALU. In particular, the ALU hardware has a DAA instruction that figures out what correction value is needed and adjusts the flags appropriately. Another microcode instruction performs the addition. So the microcode is just four instructions long.