146 Assembly Language Programming for the 68000 Family
pair is used for signed values. Unlike addition and subtraction, signed
and unsigned multiplies and divides require different instructions. The
four instructions are:
MULU -unsigned multiply
MULS -signed multiply
DIVU -unsigned divide
DIVS -signed divide
A property of the multiplication of two numbers of a given precision is
that the result of the multiplication can have a precision equal to the sum
of the precisions of the two numbers. This means that the multiplication
of two bytes yields a result up to two bytes or one word in length; and the
multiplication of two words, a result up to four bytes or one longword
in length.
The general form of the multiplication instructions is:
MULU <ea>,Dn
MULS <ea>,Dn
The size of the source and destination operands is always a word. If the
operand comes from a register, only the low-order 16 bits are used. The
remainder of the bits are ignored. The product is stored in all 32 bits of
the destination register.
Unlike addition and subtraction in two’s complement representation,
the result of a multiplication or division will be different for signed and
unsigned numbers. A simple example will illustrate. We will assume 4-bit
numbers. If we multiply —1 by —1, the signed result should be +1. In
binary this is:
n il
x 1111
oooooooi
Notice that I have shown the 8-bit result. Now, an unsigned value of
11112 is actually 1510, so this multiplication would be 15 X 15 = 225. Our
answer should be:
m i
X 1111
11100001
A similar situation exists for division. Therefore, the proper instruction,
signed or unsigned, must be used.
The following instruction multiplies the two signed words contained
in registers DO and Dl:
MULS DO fDl
Comments to this Manuals