> On the 8088, an enormous amount of time is spent
fetching instructions -
> so much so that AAM will usually outperform DIV
On Wed, 23 Jan 2008, Jim Leonard wrote:
You lost me, on several levels :-) For one, that was
part of my
question: since even a specialized "manual" DIV will be 10-20
instructions, that's 40-80 cycles lost right there just fetching
opcodes... so would it truly be faster than a regular DIV?
Second point I got lost: How would AAM be used instead of DIV? I
thought AAM was ASCII Adjust for Multiplication and was used to unpack
packed decimals or something. Is AAM good for a trick or two I don't
know about? If so, is it faster than DIV? (and if so, why?)
AAM is typically the same speed as DIV, but requires fewer bytes, which is
a big issue for 8088, and little else.
Yes, AAM (which is a two byte instruction) takes the value in AL, divides
it by 10, and places the quotient in AH, and the remainder in AL (which is
the opposite of the destination registers of DIV)
BTW, the second byte of AAM ia OAh. (ten decimal).
Guess what happens if you replace that byte with another value!
(watch out for prefetch buffer length!)