DETPROC.ASM 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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/detproc.asm 1.1 1994/04/18 09:13:53 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 S T U D I O S **
  21. ;***************************************************************************
  22. ;* *
  23. ;* Project Name : Westwood Library *
  24. ;* *
  25. ;* File Name : PROC.ASM *
  26. ;* *
  27. ;* Programmer : Joe L. Bostic *
  28. ;* *
  29. ;* Start Date : May 11, 1993 *
  30. ;* *
  31. ;* Last Update : May 11, 1993 [JLB] *
  32. ;* *
  33. ;* Converted to 32Bit -- JAW *
  34. ;* *
  35. ;*-------------------------------------------------------------------------*
  36. ;* Functions: *
  37. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  38. IDEAL
  39. P386
  40. MODEL USE32 FLAT
  41. GLOBAL Processor :NEAR
  42. PROC_80386 equ 0
  43. PROC_80486 equ 1
  44. PROC_80586 equ 2
  45. DATASEG
  46. cpu_id_586 dw 0
  47. CODESEG
  48. PROC Processor C near
  49. USES ebx
  50. LOCAL ptype:WORD
  51. pushfd
  52. ; At least a 386 -- check for 486.
  53. mov [WORD PTR ptype],PROC_80386 ; 80386
  54. pushfd
  55. pop eax
  56. mov ebx,eax
  57. xor eax,40000h
  58. push eax
  59. popfd
  60. pushfd
  61. pop eax
  62. xor eax,ebx
  63. je short ??fini
  64. ; At least a 486 -- check for 586(Pentium)
  65. mov [ptype],PROC_80486 ; 80486
  66. ; Some machines have a problem with this fLAG
  67. ; and thus make us think they are a 586 but they are
  68. ; really a 486. A possible way around this is to
  69. ; capture the Illegal instruction vector, then do
  70. ; an instruction only available on the 586.
  71. ; for now this is just commented out
  72. pushfd
  73. pop eax
  74. mov ebx,eax
  75. xor eax,200000h
  76. push eax
  77. popfd
  78. pushfd
  79. pop eax
  80. xor eax,ebx
  81. je short ??fini
  82. ; At least a 586(Pentium) -- check for higher.
  83. mov [ptype],PROC_80586 ; 80486
  84. ; mov eax,1
  85. ; DW 0fA2h ; CPUID opcode.
  86. ; shr ax,8
  87. ; and ax,0fh
  88. ; inc ax
  89. ; inc ax
  90. ; mov [cpu_id_586],ax
  91. ; Final cleanup and exit.
  92. ??fini:
  93. popfd
  94. sub eax,eax
  95. mov ax,[ptype]
  96. ret
  97. ENDP Processor
  98. END
  99.