Fix for the problem that SDL applications exited
[AROS-Contrib.git] / Games / Quake / sys_dosa.s
blob7b0ea6189af8dc6835690532e4bf929a77021363
1 //
2 // sys_dosa.s
3 // x86 assembly-language DOS-dependent routines.
5 #include "asm_i386.h"
6 #include "quakeasm.h"
9 .data
11 .align 4
12 fpenv:
13 .long 0, 0, 0, 0, 0, 0, 0, 0
15 .text
17 .globl C(MaskExceptions)
18 C(MaskExceptions):
19 fnstenv fpenv
20 orl $0x3F,fpenv
21 fldenv fpenv
23 ret
25 #if 0
26 .globl C(unmaskexceptions)
27 C(unmaskexceptions):
28 fnstenv fpenv
29 andl $0xFFFFFFE0,fpenv
30 fldenv fpenv
32 ret
33 #endif
35 .data
37 .align 4
38 .globl ceil_cw, single_cw, full_cw, cw, pushed_cw
39 ceil_cw: .long 0
40 single_cw: .long 0
41 full_cw: .long 0
42 cw: .long 0
43 pushed_cw: .long 0
45 .text
47 .globl C(Sys_LowFPPrecision)
48 C(Sys_LowFPPrecision):
49 fldcw single_cw
51 ret
53 .globl C(Sys_HighFPPrecision)
54 C(Sys_HighFPPrecision):
55 fldcw full_cw
57 ret
59 .globl C(Sys_PushFPCW_SetHigh)
60 C(Sys_PushFPCW_SetHigh):
61 fnstcw pushed_cw
62 fldcw full_cw
64 ret
66 .globl C(Sys_PopFPCW)
67 C(Sys_PopFPCW):
68 fldcw pushed_cw
70 ret
72 .globl C(Sys_SetFPCW)
73 C(Sys_SetFPCW):
74 fnstcw cw
75 movl cw,%eax
76 #if id386
77 andb $0xF0,%ah
78 orb $0x03,%ah // round mode, 64-bit precision
79 #endif
80 movl %eax,full_cw
82 #if id386
83 andb $0xF0,%ah
84 orb $0x0C,%ah // chop mode, single precision
85 #endif
86 movl %eax,single_cw
88 #if id386
89 andb $0xF0,%ah
90 orb $0x08,%ah // ceil mode, single precision
91 #endif
92 movl %eax,ceil_cw
94 ret