LF: DIVU Instruction
[Prev][Next][Index][Thread]
LF: DIVU Instruction
You've reversed the order.
divu.w #3,d4
is probably what you wanted, although I don't remember if divu.l is
supported. The div instructions are a little complicated -- you'll have to
check the Motorola pdf.
for example,
divu.w d0,d1
divides the full 32 bit value of d1 by the lower 16 bit word of d0 leaving
the result in the lower word of d1 and the remainder (modulus or % in the C
language) in the upper word. You can go "swap d1" to reverse the words.
Note that the result -must- fit into 16 bits or it won't work. Again, see
Jimmy Mardell's 68000 guide or the Motorola info.
-Kevin
khuber@mr.net
JBridge21@aol.com writes:
> 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.
References: