home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------dfp2sfp routine begins--------------------------+
- ; ROUTINE FOR CONVERSION FROM DOUBLE PRECISION TO SINGLE PRECISION
- ;
- ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
- ; page : 113
- ;
- ; NAME DFP2SFP
- ;
- ; FUNCTION: This routine converts from double precision binary floating point
- ; to internal double precision floating point.
- ;
- ; INPUT: Upon entry a internal double precision binary floating point
- ; number is stored in DFPBUFF. The internal double precision floating point
- ; number has a 40-bit binary mantissa, a sign bit,and an 8-bit exponent
- ; biased by 128 (See fig 5-8).
- ;
- ; OUTPUT: Upon exit a number is stored in single precision binary floating
- ; point form in SFPBUFF. The single precision binary floating point number
- ; has a 24-bit binary mantissa, a sign bit, and an 8-bit exponent biased by
- ; 128 (See fig 5-3).
- ;
- ; REGISTERS USED: No registers are modified.
- ;
- ; SEGMENTS REFERENCED: Upon entry the data segment must contain the
- ; storage for the variables SFPBUFF and DFPBUFF.
- ;
- ; ROUTINES CALLED: None
- ;
- ; SPECIAL NOTES: Equates are used to shorten address fields.
- ;
- ; ROUTINE TO CONVERT FROM INTERNAL DOUBLE PRECISION FLOATING POINT TO
- ; INTERNAL SINGLE PRECISION FLOATING POINT
- ;
- dfp2sfp proc far
- ;
- push ax ; save registers
- ;
- mov ax,dfpbuffw4 ; get word from double precision
- mov sfpbuffw0,ax ; put in single precision
- ;
- mov ax,dfpbuffw6 ; get word from double precision
- mov sfpbuffw2,ax ; put in single precision
- ;
- pop ax ; restore registers
- ret ; return
- ;
- dfp2sfp endp
- ;-------------------------dfp2sfp routine ends---------------------------+
-