1 ! bcc 386 floating point routines (version 2)
2 ! --- fpdenormal, fperror, fpinfinity, fpNaN, fpoverflow, fpunderflow,fpdivzero
10 ! Cause a denormal-operand exception
11 ! Preserves all general registers if signal handler returns
24 ! Cause an exception with error code eax, preserving all genregs except eax
29 push ebp ! set up usual frame ...
30 mov ebp,esp ! ... for debugging
31 push edx ! save default
33 push eax ! error code is arg to C routine
36 pop ecx ! restore default
43 mov ecx,#D_HUGE_LOW ! prepare number +-HUGEVAL
44 or edx,#D_HUGE_HIGH ! ... in case signal handler returns
47 ! Cause an infinite-operand exception
48 ! Return +-HUGEVAL in edx:ecx with sign from edx
54 jmp fphuge ! almost right
56 ! Cause an NaN-operand exception
57 ! Return +-HUGEVAL in edx:ecx with sign from edx
62 mov eax,#EFNAN ! there are different types of NaNs but...
65 ! Cause an overflow exception
66 ! Return +-HUGEVAL in edx:ecx with sign from edx
72 jmp fphuge ! almost right
74 ! Cause an underflow exception (actually assume it is masked for now)
75 ! Return denormal or 0.0 in edx:ecx
76 ! XXX - this should cause a denormal exception or none for the denormal case
77 ! Args: sign in edx, fraction in esi:eax, right shift in edi
78 ! Returns: denormalized number in edx:eax
94 denormalize_underflow:
110 jz denormalize_underflow
115 ! Cause an fp division by zero exception
116 ! Return +-HUGEVAL in edx:ecx with sign from edx
123 jnz fphuge ! almost right