Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.2 KiB

  1. page ,132
  2. title wfpinit - Functions for initializing win87em.exe from a DLL
  3. ;***
  4. ;wfpinit.asm - Functions for initializing win87em.exe from a DLL
  5. ;
  6. ; Copyright (c) 1988-1989, Microsoft Corporation. All rights reserved.
  7. ;
  8. ;Purpose:
  9. ; Defines the initialization and termination routines for the Windows
  10. ; emulator (used in DLLs).
  11. ;
  12. ;Revision History:
  13. ; 04/14/88 WAJ Initial version.
  14. ; 04/06/89 WAJ Cleaned up source.
  15. ; 04/12/90 WAJ Will now work in protected mode.
  16. ;
  17. ;*******************************************************************************
  18. memL = 1
  19. ?PLM = 1 ; Pascal names.
  20. ?WIN = 1 ; Windows calling sequence
  21. .xlist
  22. include cmac_mrt.inc ; old, customized masm510 cmacros
  23. .list
  24. TSKINT equ 3eh ; int 3e is used for the Signal handler
  25. OPSYS equ 21h
  26. SETVECOP equ 25h
  27. GETVECOP equ 35h
  28. externFP __fpmath
  29. externFP __fpsignal
  30. sBegin data
  31. DefaultFPSignal dd __fpsignal ; want to a thunk for this function
  32. sEnd data
  33. sBegin code
  34. assumes cs, code
  35. assumes ds, data
  36. ;***
  37. ; _FPInit -
  38. ;
  39. ;Purpose: Initializes the Windows emulator.
  40. ;
  41. ;Entry:
  42. ;
  43. ;Exit: returns the old signal handler
  44. ;
  45. ;Uses:
  46. ;
  47. ;Exceptions: none
  48. ;
  49. ;*******************************************************************************
  50. cProc _FPINIT,<PUBLIC,FAR>,<>
  51. cBegin
  52. xor bx, bx ; initialize Emulator/Coprocessor
  53. call __fpmath
  54. push ds
  55. mov ax,GETVECOP shl 8 + TSKINT ; get interrupt vector TSKINT
  56. int OPSYS ; Call operating system.
  57. pop ds
  58. push es ; save previous FP signal handler on
  59. push bx ; stack
  60. mov ax, word ptr [DefaultFPSignal]
  61. mov dx, word ptr [DefaultFPSignal+2]
  62. mov bx, 3 ; 3 => set SignalAddress
  63. call __fpmath
  64. pop ax ; get previous FP signal handler off
  65. pop dx ; stack
  66. cEnd
  67. ;***
  68. ; _FPTerm -
  69. ;
  70. ;Purpose: terminates Windows emulator
  71. ;
  72. ;Entry: old floating point signal handler
  73. ;
  74. ;Exit: none
  75. ;
  76. ;Uses:
  77. ;
  78. ;Exceptions: none
  79. ;
  80. ;*******************************************************************************
  81. cProc _FPTERM,<PUBLIC,FAR>,<>
  82. parmD DefaultSignalHandler
  83. cBegin
  84. mov ax, [OFF_DefaultSignalHandler]
  85. mov dx, [SEG_DefaultSignalHandler]
  86. mov bx, 3 ; 3 => set SignalAddress
  87. call __fpmath
  88. mov bx, 2 ; 2 => terminate FP
  89. call __fpmath
  90. cEnd
  91. sEnd code
  92. end