"Chris Antos" <[EMAIL PROTECTED]> wrote:
> hm.  i suppose i could do that.  you have to be careful about division,
> though.  i'm not sure about 68k series, but the x86 series does 64 bit
> division, but considers it an overflow if either the quotient or remainder
> exceeds 32bits (or maybe i'm even more dated than i realize - i'm going by
> the 386 reference, and maybe the Pentium has a way around this, i don't
> know).

The MC68000 (that's the CPU core at the heart of the MC68328) can do 
only 32-bit multiplication and division. (Actually, it can multiply two 
16-bit numbers giving a 32-bit result, and divide a 32-bit by a 16-bit, 
giving 16-bit quotient and remainder.) Anything beyond that has to be 
handled by some kind of library routine.

Writing a little routine to multiply two 32-bit values into a 64-bit 
intermediate product, then dividing by a 32-bit scale factor, is a 
technique I've used successfully on a couple of projects. I stole the 
idea from Forth's */ operator.

--
Roger Chaplin
<[EMAIL PROTECTED]>

Reply via email to