Motorola DSP96002 User Manual
Page 702
MOTOROLA
DSP96002 USER’S MANUAL
B-183
page
;
; MOTOROLA DSP96002 DPLIB - VERSION 1.0
;
; DPLIB2IEEE - Convert internal double precision format to a double
; precision format in d0.
;
; Entry point: dplib2ieee: d0
←
convert(c(r0))
;
; Input: r0 contains the lowest address of the 4-word internal
; extended precision number
;
; Output: The returned format is DSP96002 extended precision
; floating-point format. Typical calling sequences:
;
; jsr dplib2ieee ;convert to register format
; move d0.d,L:0 ;save as dp format
;
; jsr dplib2ieee ;convert to register format
; ftfr.s d0,d0 ;round to sp
; move d0.s,x:0 ;save as sp format
;
; jsr dplib2ieee ;convert to register format
; move d0.d,d0.ml ;convert to IEEE dp format
; move d0.ml,l:0 ;save IEEE dp format
;
; Alters: D0.L,D1.L,D0.M,D0.H
;
dplib2ieee
move x:(r0),d0.l ;get internal exponent
move #$200003fe,d1.l ;max limit for register
cmp d1,d0 #$1ffffc01,d1.l ;compare to max, get min
jhi _setinf ;too big for register, set inf
cmp d1,d0 #$1ffffc00,d1.l ;compare to min, get adjust
jlo _setzero ;return zero
sub d1,d0 x:(r0+ms),d0.m ;adjust exponent, get ms
move d0.l,d0.h ;move exponent
move x:(r0+ls),d0.l ;get ls part
_fixsign move x:(r0+sign),d1.l ;get sign
jclr #0,d1.l,_ok ;jump if bit clear
bset #31,d0.h ;set negative
_ok rts
_setinf move #$7f800000,d0.s ;get infinity
jmp _fixsign
_setzero fclr d0 ;get 0
jmp _fixsign
page
;
; MOTOROLA DSP96002 DPLIB - VERSION 1.0
;
; DP_ABS _ Absolute value of a double precision number
;
; Entry point: dp_abs: c(r0+sign)
←
0 (make the number positive);