Re: LF: DIVU Instruction


[Prev][Next][Index][Thread]

Re: LF: DIVU Instruction



>Shawn Walker wrote:
>> 
>> On Tue, 10 Dec 1996 JBridge21@aol.com wrote:
>> 
>> > I have been working on a Sierpinski hexagon, and I have to use the DIVU
>> > instruction to divide by 3. I tried it like this:
>> >    move.l #3,d5
>> >    divu.l d4, d5
>> > and I always get a divide by zero. not only is the reset problem
annoying
>> > (about 5 min. delay), but no matter how I change it, I keep on getting a
>> > divide by zero. So, the instruction divides the first thing by the
second,
>> > right? and stores the answer in the first, right? help is appreciated.
>> >
>> > Tilde,
>> > Jeffrey :j
>> > JBridge21@aol.com
>> >
>> The way I understand it, that instruction puts d5/d4 -> d5.  It takes the
>> long in d5, divides by the word in d4, stores the quotient long in d5.
>
>Not really, divu d4,d5 (.l is not needed, it always divides a longword with
>a word) stores the truncated quotient d5/d4 in the lower word in d5 and
>the remainder at the higher word in d5 (to get the remainder, use SWAP d5
>and the two words will exchange). If the answer is bigger than 16 bits,
>the V flag is set (overflow), and the N- and Z-flag is undefined.
>
>-- 
>Jimmy Mårdell               "Breaking your trust in sorrow, until you face
>mailto:mja@algonet.se        the dreams of tomorrow, has taken place
>http://www.algonet.se/~mja   Your life has been turning, inside your head
>IRC: Yarin                   The truth will be burning, until your dead"


Thank you for your input, and here is the result. :)

Tilde,
Jeffrey :j
JBridge21@aol.com

SIERPIN6.92P