
DIVXS
DIVXS (DIVide eXtend as Signed)
Divide Signed
Example 2: Sign extend the 8-bit divisor to 16 bits, sign extend the 16-bit dividend to 32 bits, and
then use DIVXS to divide
EXTS.W R0
BEQ ZERODIV
EXTS.L ER1
DIVXS.L R0,ER1
RTS
ZERODIV:
This program leaves the 16-bit quotient in R1 and the 8-bit remainder in E1 (in a 16-bit sign
extended format).
87
R1
ROL
ER1
ER1
R0L
Dividend
Divisor
Sign extension
Divisor
Dividend
Sign extension
Quotient
Remainder