1 | double float to single float conversion routine
3 | written by Kai-Uwe Bloem
(I5110401@dbstu1.bitnet
).
4 | Based on
a 80x86 floating point packet from comp.os.minix
, written by P.Housel
7 | Revision
1.2, kub
01-90 :
8 | added support for denormalized numbers
10 | Revision
1.1, kub
12-89 :
11 | Ported over to
68k assembler
14 | original
8088 code from P.S.Housel
24 lea
%sp@
(4),%a0 | parameter pointer
25 moveml
%d2-
%d5
,%sp@
- | save regs
26 moveml
%a0@
,%d4-
%d5 | get number
28 movew
%a0@
,%d0 | extract exponent
29 movew
%d0
,%d2 | extract sign
31 andw
#0x7ff,%d0 | kill sign bit
33 andl
#0x0fffff,%d4 | remove exponent from mantissa
34 tstw
%d0 | check for zero exponent
- no leading
"1"
35 beq L_0 | for denormalized numbers
36 orl
#0x100000,%d4 | restore implied leading "1"
38 L_0
: addw
#1,%d0 | "normalize" exponent
40 addw
#BIAS4-BIAS8,%d0 | adjust bias
42 addl
%d5
,%d5 | shift up to realign mantissa for floats
49 movel
%d5
,%d1 | set rounding bits
51 andl
#0x00ffffff,%d5 | check to see if sticky bit should be set
53 orb
#1,%d1 | set sticky bit
55 jmp norm_sf |
(leave regs on stack for norm_sf
)