Subject: Re: div by 10 on Z80

Jim Leonard trixter at oldskool.org
Wed Jan 23 18:01:27 CST 2008


Fred Cisin wrote:
> On Mon, 21 Jan 2008, Jim Leonard wrote:
>> Every time I see code like this for processors without a native DIV, I
>> wonder if the same code ported to x86 would indeed outperform the native
>> DIV.  Would it?  I know that on a 286 or higher, where MUL and DIV were
>> greatly optimized to about 12 cycles, no; but what about on the original
>> 808x, where MUL/DIV could take as much as 144 cycles?
> 
> On the 8088, an enormous amount of time is spent fetching instructions -
> so much so that AAM will usually outperform DIV

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?)
-- 
Jim Leonard (trixter at oldskool.org)            http://www.oldskool.org/
Help our electronic games project:           http://www.mobygames.com/
Or check out some trippy MindCandy at     http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.wordpress.com/



More information about the cctalk mailing list