| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- (* Release 3.10 *)
- (*-------------------------------------------------------------------------*
- * *
- * WINFLOAT.A - emulator support for Windows *
- * *
- * COPYRIGHT (C) 1989..1992 Clarion Software Corporation. *
- * All Rights Reserved *
- * *
- *--------------------------------------------------------------------------*)
- module winfloat
- (*emuinit2*)
- public FIDRQQ = 00000H
- public FIWRQQ = 00000H
- public FIERQQ = 00000H
- public FIARQQ = 00000H
- public FISRQQ = 00000H
- public FICRQQ = 00000H
- public FJERQQ = 00000H
- public FJARQQ = 00000H
- public FJSRQQ = 00000H
- public FJCRQQ = 00000H
- public FIXRQQ = 0 (* brings this module in - known to linker *)
- segment _DATA(DATA,68H)
- segment _TEXT(CODE,28H)
- extrn __fp_1
- extrn __real_in
- extrn __real_out
- extrn __real_pdef
- extrn __real_sdef
- extrn __FPMATH
- extrn __sigFpWin
- ProcessFloat = 14
- public __FloatInit:
- push ax
- push bx
- push cx
- push dx
- xor bx,bx (* __FPMATH sub-function 0 *)
- call far __FPMATH (* initialize __FPMATH *)
- mov dx, seg __sigFpWin
- mov ax,__sigFpWin
- mov bx,3 (* __FPMATH sub-function 3 *)
- call far __FPMATH (* give __FPMATH float exception handler address *)
- call far __fp_1
- mov ax,1F22H (* affine,chop,64 bit precision,denorm & precision masked *)
- call far __FloatLoadCW (* load jpi standard CW *)
- pop dx
- pop cx
- pop bx
- pop ax
- ret far 0
- public __FloatFinish:
- push ax
- push bx
- push cx
- push dx
- mov bx, 2 (* __FPMATH sub-function 2 *)
- call far __FPMATH
- pop dx
- pop cx
- pop bx
- pop ax
- ret far 0
- public __FloatStoreSW :
- push bp
- mov bp,sp
- push ax
- fstsw [bp][-2]
- fwait
- pop ax
- pop bp
- ret far 0
- public __FloatStoreCW :
- push bp
- mov bp,sp
- push ax
- fstcw [bp][-2]
- fwait
- pop ax
- pop bp
- ret far 0
- public __FloatLoadCW :
- push bp
- mov bp,sp
- push ax
- fldcw [bp][-2]
- pop ax
- pop bp
- ret far 0
- public __FloatExecSave :
- public __FloatExecRestore :
- ret far 0
- public __FloatSave :
- fsave es:[ProcessFloat]
- ret far 0
- public __FloatRestore :
- frstor ds:[ProcessFloat]
- ret far 0
- public __FloatJmpSave :
- st1_reg = 20
- st2_reg = 30
- fld st(0), st(1)
- fstp tbyte es:[di][st1_reg], st(0)
- fld st(0), st(2)
- fstp tbyte es:[di][st2_reg], st(0)
- ret far 0
- public __FloatJmpRestore :
- fld tbyte st(0), ds:[si][st1_reg]
- fstp st(2), st(0)
- fld tbyte st(0), ds:[si][st2_reg]
- fstp st(3), st(0)
- ret far 0
- extrn __math_excep
- public __FloatMathExcepOs2 :
- (* always far called from coresig *)
- (*
- stack contains far return address to signal handler, then status word,
- then far return address to error location, the iret flags.
- This is how __math_excep likes it, so just jump there.
- *)
- fclex
- jmp far __math_excep
- public __FloatMathExcepDos :
- (*
- the stack contains a FAR return address to signal handler, then
- the far address of the point of exception, then the iret flags
- *)
- push ax (* make room for status word *)
- push bp
- mov bp,sp
- push ax
- mov ax,[bp][4] (* return ip *)
- mov [bp][2],ax
- mov ax,[bp][6] (* return cs *)
- mov [bp][4],ax
- fstsw [bp][6] (* will bring in emulator ! *)
- pop ax
- pop bp
- fclex
- jmp far __math_excep
- end
|