home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 14 / MA_Cover_14.iso / source / c / q1source_amy / qw / client / sys_wina.s < prev    next >
Encoding:
Text File  |  1999-12-21  |  2.0 KB  |  116 lines

  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  12.  
  13. See the GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. */
  20. //
  21. // sys_wina.s
  22. // x86 assembly-language Win-dependent routines.
  23.  
  24. #include "asm_i386.h"
  25. #include "quakeasm.h"
  26.  
  27. //@@@ should be id386-dependent, and have an equivalent C path
  28.  
  29.     .data
  30.  
  31.     .align    4
  32. fpenv:
  33.     .long    0, 0, 0, 0, 0, 0, 0, 0
  34.  
  35.     .text
  36.  
  37. .globl C(MaskExceptions)
  38. C(MaskExceptions):
  39.     fnstenv    fpenv
  40.     orl        $0x3F,fpenv
  41.     fldenv    fpenv
  42.  
  43.     ret
  44.  
  45. #if 0
  46. .globl C(unmaskexceptions)
  47. C(unmaskexceptions):
  48.     fnstenv    fpenv
  49.     andl        $0xFFFFFFE0,fpenv
  50.     fldenv    fpenv
  51.  
  52.     ret
  53. #endif
  54.  
  55.     .data
  56.  
  57.     .align    4
  58. .globl    ceil_cw, single_cw, full_cw, cw, pushed_cw
  59. ceil_cw:    .long    0
  60. single_cw:    .long    0
  61. full_cw:    .long    0
  62. cw:            .long    0
  63. pushed_cw:    .long    0
  64.  
  65.     .text
  66.  
  67. .globl C(Sys_LowFPPrecision)
  68. C(Sys_LowFPPrecision):
  69.     fldcw    single_cw
  70.  
  71.     ret
  72.  
  73. .globl C(Sys_HighFPPrecision)
  74. C(Sys_HighFPPrecision):
  75.     fldcw    full_cw
  76.  
  77.     ret
  78.  
  79. .globl C(Sys_PushFPCW_SetHigh)
  80. C(Sys_PushFPCW_SetHigh):
  81.     fnstcw    pushed_cw
  82.     fldcw    full_cw
  83.  
  84.     ret
  85.  
  86. .globl C(Sys_PopFPCW)
  87. C(Sys_PopFPCW):
  88.     fldcw    pushed_cw
  89.  
  90.     ret
  91.  
  92. .globl C(Sys_SetFPCW)
  93. C(Sys_SetFPCW):
  94.     fnstcw    cw
  95.     movl    cw,%eax
  96. #if    id386
  97.     andb    $0xF0,%ah
  98.     orb        $0x03,%ah    // round mode, 64-bit precision
  99. #endif
  100.     movl    %eax,full_cw
  101.  
  102. #if    id386
  103.     andb    $0xF0,%ah
  104.     orb        $0x0C,%ah    // chop mode, single precision
  105. #endif
  106.     movl    %eax,single_cw
  107.  
  108. #if    id386
  109.     andb    $0xF0,%ah
  110.     orb        $0x08,%ah    // ceil mode, single precision
  111. #endif
  112.     movl    %eax,ceil_cw
  113.  
  114.     ret
  115.  
  116.