OPSYS.ASM 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; 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, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ; $Header: g:/library/wwlib32/system/rcs/opsys.asm 1.1 1994/04/18 09:14:12 jeff_wilson Exp $
  19. ;***************************************************************************
  20. ;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  21. ;***************************************************************************
  22. ;* *
  23. ;* Project Name : Operating System Flags *
  24. ;* *
  25. ;* File Name : OPSYS.ASM *
  26. ;* *
  27. ;* Programmer : Scott Bowen *
  28. ;* *
  29. ;* Start Date : January 26, 1993 *
  30. ;* *
  31. ;* Last Update : January 26, 1993 [SB] *
  32. ;* *
  33. ;* Updated to 32bit protected mode JAW *
  34. ;* *
  35. ;*-------------------------------------------------------------------------*
  36. ;* Functions: *
  37. ;* Operating_System -- Determines what the operating system is. *
  38. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  39. IDEAL
  40. P386
  41. MODEL USE32 FLAT
  42. GLOBAL Operating_System :NEAR
  43. GLOBAL OperatingSystem :WORD
  44. DOS equ 1
  45. WIN31STD equ 2
  46. WIN31ENH equ 3
  47. WIN30ENH equ 4
  48. WIN30STD equ 5
  49. WIN30REAL equ 6
  50. DATASEG
  51. OperatingSystem dw 0
  52. CODESEG
  53. ;***************************************************************************
  54. ;* Operating_System -- Determines what the operating system is. *
  55. ;* *
  56. ;* INPUT: NONE. *
  57. ;* *
  58. ;* OUTPUT: *
  59. ;* *
  60. ;* WARNINGS: *
  61. ;* *
  62. ;* HISTORY: *
  63. ;* 01/26/1993 SB : Created. *
  64. ;*=========================================================================*
  65. PROC Operating_System C near
  66. USES ebx,ecx,edx,es,edi
  67. ; Check for Windows 3.1
  68. mov eax,160Ah ; WIN31CHECK
  69. int 2fh
  70. or ax,ax
  71. jz short RunningUnderWin31
  72. ;check for Windows 3.0 enhanced mode
  73. mov eax,1600h ; WIN386CHECK
  74. int 2fh
  75. mov bl,al
  76. mov eax,WIN30ENH
  77. test bl,7fh
  78. jnz short Exit
  79. ;check for 3.0 WINOLDAP
  80. mov eax,4680h ; IS_WINOLDAP_ACTIVE
  81. int 2fh
  82. or eax,eax
  83. jnz short NotRunningUnderWin
  84. ; rule out MS-DOS 5.0 task switcher
  85. mov eax,4b02h ; detect switcher
  86. push ebx
  87. push es
  88. push edi
  89. xor ebx,ebx
  90. mov edi,ebx
  91. mov es,bx
  92. int 2fh
  93. pop edi
  94. pop es
  95. pop ebx
  96. or eax,eax
  97. jz short NotRunningUnderWin ; MS-DOS 5.0 task switcher found.
  98. ; check for standrd mode Windows 3.0
  99. mov eax,1605h ;PMODE_START
  100. int 2fh
  101. mov eax,WIN30STD
  102. cmp ecx,-1
  103. jz short Exit
  104. ;check for real mode Windows 3.0
  105. mov eax,1606h ; PMODE_STOP
  106. int 2fh
  107. mov eax,WIN30REAL
  108. jmp SHORT Exit
  109. RunningUnderWin31:
  110. ; At this point: CX == 3 means Windows 3.1 enhanced mode.
  111. ; CX == 2 means Windows 3.1 standard mode.
  112. mov eax,WIN31STD
  113. cmp ecx,2
  114. je short Exit
  115. mov eax,WIN31ENH
  116. jmp SHORT Exit
  117. NotRunningUnderWin:
  118. mov eax,DOS
  119. Exit:
  120. mov [WORD PTR OperatingSystem], ax
  121. ret
  122. ENDP Operating_System
  123. ;----------------------------------------------------------------------------
  124. END
  125.