OLTHIPX.ASM 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. page ,132
  19. ;Thunk Compiler Version 1.8 May 11 1995 13:16:19
  20. ;File Compiled Wed Jan 17 14:56:34 1996
  21. ;Command Line: C:\BIN\THUNK.EXE Thipx.thk
  22. TITLE $Thipx.asm
  23. .386
  24. OPTION READONLY
  25. OPTION OLDSTRUCTS
  26. IFNDEF IS_16
  27. IFNDEF IS_32
  28. %out command line error: specify one of -DIS_16, -DIS_32
  29. .err
  30. ENDIF ;IS_32
  31. ENDIF ;IS_16
  32. IFDEF IS_32
  33. IFDEF IS_16
  34. %out command line error: you can't specify both -DIS_16 and -DIS_32
  35. .err
  36. ENDIF ;IS_16
  37. ;************************* START OF 32-BIT CODE *************************
  38. .model FLAT,STDCALL
  39. ;-- Import common flat thunk routines (in k32)
  40. externDef MapHInstLS :near32
  41. externDef MapHInstLS_PN :near32
  42. externDef MapHInstSL :near32
  43. externDef MapHInstSL_PN :near32
  44. externDef FT_Prolog :near32
  45. externDef FT_Thunk :near32
  46. externDef QT_Thunk :near32
  47. externDef FT_Exit0 :near32
  48. externDef FT_Exit4 :near32
  49. externDef FT_Exit8 :near32
  50. externDef FT_Exit12 :near32
  51. externDef FT_Exit16 :near32
  52. externDef FT_Exit20 :near32
  53. externDef FT_Exit24 :near32
  54. externDef FT_Exit28 :near32
  55. externDef FT_Exit32 :near32
  56. externDef FT_Exit36 :near32
  57. externDef FT_Exit40 :near32
  58. externDef FT_Exit44 :near32
  59. externDef FT_Exit48 :near32
  60. externDef FT_Exit52 :near32
  61. externDef FT_Exit56 :near32
  62. externDef SMapLS :near32
  63. externDef SUnMapLS :near32
  64. externDef SMapLS_IP_EBP_8 :near32
  65. externDef SUnMapLS_IP_EBP_8 :near32
  66. externDef SMapLS_IP_EBP_12 :near32
  67. externDef SUnMapLS_IP_EBP_12 :near32
  68. externDef SMapLS_IP_EBP_16 :near32
  69. externDef SUnMapLS_IP_EBP_16 :near32
  70. externDef SMapLS_IP_EBP_20 :near32
  71. externDef SUnMapLS_IP_EBP_20 :near32
  72. externDef SMapLS_IP_EBP_24 :near32
  73. externDef SUnMapLS_IP_EBP_24 :near32
  74. externDef SMapLS_IP_EBP_28 :near32
  75. externDef SUnMapLS_IP_EBP_28 :near32
  76. externDef SMapLS_IP_EBP_32 :near32
  77. externDef SUnMapLS_IP_EBP_32 :near32
  78. externDef SMapLS_IP_EBP_36 :near32
  79. externDef SUnMapLS_IP_EBP_36 :near32
  80. externDef SMapLS_IP_EBP_40 :near32
  81. externDef SUnMapLS_IP_EBP_40 :near32
  82. MapSL PROTO NEAR STDCALL p32:DWORD
  83. .code
  84. ;************************* COMMON PER-MODULE ROUTINES *************************
  85. .data
  86. public Thipx_ThunkData32 ;This symbol must be exported.
  87. Thipx_ThunkData32 label dword
  88. dd 3130534ch ;Protocol 'LS01'
  89. dd 0e71h ;Checksum
  90. dd 0 ;Jump table address.
  91. dd 3130424ch ;'LB01'
  92. dd 0 ;Flags
  93. dd 0 ;Reserved (MUST BE 0)
  94. dd 0 ;Reserved (MUST BE 0)
  95. dd offset QT_Thunk_Thipx - offset Thipx_ThunkData32
  96. dd offset FT_Prolog_Thipx - offset Thipx_ThunkData32
  97. .code
  98. externDef ThunkConnect32@24:near32
  99. public Thipx_ThunkConnect32@16
  100. Thipx_ThunkConnect32@16:
  101. pop edx
  102. push offset Thipx_ThkData16
  103. push offset Thipx_ThunkData32
  104. push edx
  105. jmp ThunkConnect32@24
  106. Thipx_ThkData16 label byte
  107. db "Thipx_ThunkData16",0
  108. pfnQT_Thunk_Thipx dd offset QT_Thunk_Thipx
  109. pfnFT_Prolog_Thipx dd offset FT_Prolog_Thipx
  110. .data
  111. QT_Thunk_Thipx label byte
  112. db 32 dup(0cch) ;Patch space.
  113. FT_Prolog_Thipx label byte
  114. db 32 dup(0cch) ;Patch space.
  115. .code
  116. ;************************ START OF THUNK BODIES************************
  117. ;
  118. ;For some reason, inserting these lines makes it assemble correctly
  119. ;
  120. Externdef IPX_Initialise:near
  121. IPX_Initialise label near
  122. _IPX_Initialise@4:
  123. mov cl,1
  124. ; _IPX_Initialise(16) = _IPX_Initialise(32) {}
  125. ;
  126. ; dword ptr [ebp+8]: param1
  127. ;
  128. public II_IPX_Initialise@4
  129. II_IPX_Initialise@4:
  130. push ebp
  131. mov ebp,esp
  132. push ecx
  133. sub esp,60
  134. push word ptr [ebp+8] ;param1: dword->word
  135. call dword ptr [pfnQT_Thunk_Thipx]
  136. cwde
  137. leave
  138. retn 4
  139. ;
  140. externdef IPX_Uninitialise:near
  141. IPX_Uninitialise label near
  142. _IPX_Uninitialise@0:
  143. mov cl,0
  144. ; _IPX_Uninitialise(16) = _IPX_Uninitialise(32) {}
  145. ;
  146. ;
  147. public II_IPX_Uninitialise@0
  148. II_IPX_Uninitialise@0:
  149. push ebp
  150. mov ebp,esp
  151. push ecx
  152. sub esp,60
  153. call dword ptr [pfnQT_Thunk_Thipx]
  154. cwde
  155. leave
  156. retn
  157. ELSE
  158. ;************************* START OF 16-BIT CODE *************************
  159. OPTION SEGMENT:USE16
  160. .model LARGE,PASCAL
  161. .code
  162. externDef _IPX_Uninitialise:far16
  163. externDef _IPX_Initialise:far16
  164. FT_ThipxTargetTable label word
  165. dw offset _IPX_Uninitialise
  166. dw seg _IPX_Uninitialise
  167. dw offset _IPX_Initialise
  168. dw seg _IPX_Initialise
  169. .data
  170. public Thipx_ThunkData16 ;This symbol must be exported.
  171. Thipx_ThunkData16 dd 3130534ch ;Protocol 'LS01'
  172. dd 0e71h ;Checksum
  173. dw offset FT_ThipxTargetTable
  174. dw seg FT_ThipxTargetTable
  175. dd 0 ;First-time flag.
  176. .code
  177. externDef ThunkConnect16:far16
  178. public Thipx_ThunkConnect16
  179. Thipx_ThunkConnect16:
  180. pop ax
  181. pop dx
  182. push seg Thipx_ThunkData16
  183. push offset Thipx_ThunkData16
  184. push seg Thipx_ThkData32
  185. push offset Thipx_ThkData32
  186. push cs
  187. push dx
  188. push ax
  189. jmp ThunkConnect16
  190. Thipx_ThkData32 label byte
  191. db "Thipx_ThunkData32",0
  192. ENDIF
  193. END
  194. �������������������������������������