beautypg.com

Motorola DSP96002 User Manual

Page 680

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-161

;

; Round toward -infinity

;

_rminf jclr #31,d6.l,_lmove ; no rounding if positive

_addone move #$800,d7.l ; get increment number

add d7,d1 ; add one to lsb

jcc _acar ; jump if no carry

inc d3 ; increment mantr.high

_acar jcc _lmove ; jump if result normalized

lsr d3 ; shift right mantr.high

ror d1 ; shift right mantr.low

inc d6 ; increment expr

;

; Check if Result is Infinity

;

move #emsk,d7.l ; get exp mask

move d6.l,d5.l ; get expr

and d7,d5 ; delete tags

cmp d7,d5 ; check for max exp

jne _lmove ; jump if no overflow

move #0,d1.l ; set result to infinity

move #0,d1.m ; "

ori #$10,ccr ; set infinity bit

ori #$09,ier ; set OVF and INX bits in IER

ori #$09,er ; set OVF and INX bits in ER

jmp _emove ; get infinity exponent

;

; Get Result in D1

;

_lmove move d3.l,d1.m ; move mantr.high to d1

_emove move d6.l,d1.h ; move expr to d1

_done nop ;

nop ;

nop ;

rts ; end of subroutine

endsec

B.4.2

IEEE Double Precision Subtraction

;

; Double Precision IEEE floating-point Subtraction

;

; D0 - D1

D1

;

;

;

; Alters Data ALU Registers

; d0.h d0.m d0.l

; d1.h d1.m d1.l

; d2.m d2.l

; d3.l