11.07.2015 Views

section 7 - Index of

section 7 - Index of

section 7 - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DIV Divide Interation DIVNote that the divide routine used in the previous example assumes that the signextended56-bit signed fractional dividend is stored in the A accumulator and that the 24-bit signed fractional divisor is stored in the XO register. This routine produces a full 24-bitsigned quotient and a 48-bit signed remainder.This routine may be greatly simplified for the case in which only positive, fractional operandsare used to produce a 24-bit positive quotient and a 48-bit positive remainder, asshown in the following example:1-Quadrant division, 24-bit unsigned quotient, 48-bit unsigned remainderAND #$FE,CCR ;clear carry bit C (quotient sign bit)REP #$18;form a 24-bit quotient and remainderDIV XO,A;form quotient in AO, remainder in A1ADD XO,A;restore remainder in A1Note that this routine assumes that the 56-bit positive, fractional, sign-extended dividendis stored in the A accumulator and that the 24-bit positive, fractional divisor is stored inthe XO register. After execution, the 24-bit positive fractional quotient is stored in the AOregister; the LS 24 bits <strong>of</strong> the 48-bit positive fractional remainder are stored in the A 1 register.There are many variations possible when choosing a suitable division routine for a givenapplication. The selection <strong>of</strong> a suitable division routine normally involves specification <strong>of</strong>the following items:1. the number <strong>of</strong> bits <strong>of</strong> precision in the dividend;2. the number <strong>of</strong> bits <strong>of</strong> precision N in the quotient;3. whether the value <strong>of</strong> N is fixed or is variable;4. whether the operands are unsigned or signed;5. whether or not the remainder is to be calculated.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!