THIPX.ASM 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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 Tue Mar 12 13:23:57 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 014cdch ;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. public _IPX_Close_Socket95@4
  119. _IPX_Close_Socket95@4:
  120. mov cl,7
  121. jmp II_IPX_Close_Socket95@4
  122. public _IPX_Open_Socket95@4
  123. _IPX_Open_Socket95@4:
  124. mov cl,8
  125. ; _IPX_Close_Socket95(16) = _IPX_Close_Socket95(32) {}
  126. ;
  127. ; dword ptr [ebp+8]: param1
  128. ;
  129. public II_IPX_Close_Socket95@4
  130. II_IPX_Close_Socket95@4:
  131. push ebp
  132. mov ebp,esp
  133. push ecx
  134. sub esp,60
  135. push word ptr [ebp+8] ;param1: dword->word
  136. call dword ptr [pfnQT_Thunk_Thipx]
  137. cwde
  138. leave
  139. retn 4
  140. ;
  141. public _IPX_Send_Packet95@20
  142. _IPX_Send_Packet95@20:
  143. mov cl,5
  144. ; _IPX_Send_Packet95(16) = _IPX_Send_Packet95(32) {}
  145. ;
  146. ; dword ptr [ebp+8]: address
  147. ; dword ptr [ebp+12]: buffer
  148. ; dword ptr [ebp+16]: param3
  149. ; dword ptr [ebp+20]: net
  150. ; dword ptr [ebp+24]: node
  151. ;
  152. public II_IPX_Send_Packet95@20
  153. II_IPX_Send_Packet95@20:
  154. push ebp
  155. mov ebp,esp
  156. push ecx
  157. sub esp,60
  158. call SMapLS_IP_EBP_8
  159. push eax
  160. call SMapLS_IP_EBP_12
  161. push eax
  162. push word ptr [ebp+16] ;param3: dword->word
  163. call SMapLS_IP_EBP_20
  164. push eax
  165. call SMapLS_IP_EBP_24
  166. push eax
  167. call dword ptr [pfnQT_Thunk_Thipx]
  168. cwde
  169. call SUnMapLS_IP_EBP_8
  170. call SUnMapLS_IP_EBP_12
  171. call SUnMapLS_IP_EBP_20
  172. call SUnMapLS_IP_EBP_24
  173. leave
  174. retn 20
  175. ;
  176. public _IPX_Broadcast_Packet95@8
  177. _IPX_Broadcast_Packet95@8:
  178. mov cl,4
  179. ; _IPX_Broadcast_Packet95(16) = _IPX_Broadcast_Packet95(32) {}
  180. ;
  181. ; dword ptr [ebp+8]: buffer
  182. ; dword ptr [ebp+12]: param2
  183. ;
  184. public II_IPX_Broadcast_Packet95@8
  185. II_IPX_Broadcast_Packet95@8:
  186. push ebp
  187. mov ebp,esp
  188. push ecx
  189. sub esp,60
  190. call SMapLS_IP_EBP_8
  191. push eax
  192. push word ptr [ebp+12] ;param2: dword->word
  193. call dword ptr [pfnQT_Thunk_Thipx]
  194. cwde
  195. call SUnMapLS_IP_EBP_8
  196. leave
  197. retn 8
  198. ;
  199. public _IPX_Get_Local_Target95@16
  200. _IPX_Get_Local_Target95@16:
  201. mov cl,3
  202. ; _IPX_Get_Local_Target95(16) = _IPX_Get_Local_Target95(32) {}
  203. ;
  204. ; dword ptr [ebp+8]: netnum
  205. ; dword ptr [ebp+12]: node
  206. ; dword ptr [ebp+16]: param3
  207. ; dword ptr [ebp+20]: address
  208. ;
  209. public II_IPX_Get_Local_Target95@16
  210. II_IPX_Get_Local_Target95@16:
  211. push ebp
  212. mov ebp,esp
  213. push ecx
  214. sub esp,60
  215. call SMapLS_IP_EBP_8
  216. push eax
  217. call SMapLS_IP_EBP_12
  218. push eax
  219. push word ptr [ebp+16] ;param3: dword->word
  220. call SMapLS_IP_EBP_20
  221. push eax
  222. call dword ptr [pfnQT_Thunk_Thipx]
  223. cwde
  224. call SUnMapLS_IP_EBP_8
  225. call SUnMapLS_IP_EBP_12
  226. call SUnMapLS_IP_EBP_20
  227. leave
  228. retn 16
  229. ;
  230. public _IPX_Shut_Down95@0
  231. _IPX_Shut_Down95@0:
  232. mov cl,1
  233. jmp II_IPX_Shut_Down95@0
  234. public _IPX_Initialise@0
  235. _IPX_Initialise@0:
  236. mov cl,9
  237. jmp II_IPX_Shut_Down95@0
  238. public _IPX_Get_Connection_Number95@0
  239. _IPX_Get_Connection_Number95@0:
  240. mov cl,6
  241. jmp II_IPX_Shut_Down95@0
  242. public _IPX_Start_Listening95@0
  243. _IPX_Start_Listening95@0:
  244. mov cl,2
  245. ; _IPX_Shut_Down95(16) = _IPX_Shut_Down95(32) {}
  246. ;
  247. ;
  248. public II_IPX_Shut_Down95@0
  249. II_IPX_Shut_Down95@0:
  250. push ebp
  251. mov ebp,esp
  252. push ecx
  253. sub esp,60
  254. call dword ptr [pfnQT_Thunk_Thipx]
  255. cwde
  256. leave
  257. retn
  258. ;
  259. public _IPX_Get_Outstanding_Buffer95@4
  260. _IPX_Get_Outstanding_Buffer95@4:
  261. mov cl,0
  262. ; _IPX_Get_Outstanding_Buffer95(16) = _IPX_Get_Outstanding_Buffer95(32) {}
  263. ;
  264. ; dword ptr [ebp+8]: buffer
  265. ;
  266. public II_IPX_Get_Outstanding_Buffer95@4
  267. II_IPX_Get_Outstanding_Buffer95@4:
  268. push ebp
  269. mov ebp,esp
  270. push ecx
  271. sub esp,60
  272. call SMapLS_IP_EBP_8
  273. push eax
  274. call dword ptr [pfnQT_Thunk_Thipx]
  275. cwde
  276. call SUnMapLS_IP_EBP_8
  277. leave
  278. retn 4
  279. ELSE
  280. ;************************* START OF 16-BIT CODE *************************
  281. OPTION SEGMENT:USE16
  282. .model LARGE,PASCAL
  283. .code
  284. externDef _IPX_Get_Outstanding_Buffer95:far16
  285. externDef _IPX_Shut_Down95:far16
  286. externDef _IPX_Start_Listening95:far16
  287. externDef _IPX_Get_Local_Target95:far16
  288. externDef _IPX_Broadcast_Packet95:far16
  289. externDef _IPX_Send_Packet95:far16
  290. externDef _IPX_Get_Connection_Number95:far16
  291. externDef _IPX_Close_Socket95:far16
  292. externDef _IPX_Open_Socket95:far16
  293. externDef _IPX_Initialise:far16
  294. FT_ThipxTargetTable label word
  295. dw offset _IPX_Get_Outstanding_Buffer95
  296. dw seg _IPX_Get_Outstanding_Buffer95
  297. dw offset _IPX_Shut_Down95
  298. dw seg _IPX_Shut_Down95
  299. dw offset _IPX_Start_Listening95
  300. dw seg _IPX_Start_Listening95
  301. dw offset _IPX_Get_Local_Target95
  302. dw seg _IPX_Get_Local_Target95
  303. dw offset _IPX_Broadcast_Packet95
  304. dw seg _IPX_Broadcast_Packet95
  305. dw offset _IPX_Send_Packet95
  306. dw seg _IPX_Send_Packet95
  307. dw offset _IPX_Get_Connection_Number95
  308. dw seg _IPX_Get_Connection_Number95
  309. dw offset _IPX_Close_Socket95
  310. dw seg _IPX_Close_Socket95
  311. dw offset _IPX_Open_Socket95
  312. dw seg _IPX_Open_Socket95
  313. dw offset _IPX_Initialise
  314. dw seg _IPX_Initialise
  315. .data
  316. public Thipx_ThunkData16 ;This symbol must be exported.
  317. Thipx_ThunkData16 dd 3130534ch ;Protocol 'LS01'
  318. dd 014cdch ;Checksum
  319. dw offset FT_ThipxTargetTable
  320. dw seg FT_ThipxTargetTable
  321. dd 0 ;First-time flag.
  322. .code
  323. externDef ThunkConnect16:far16
  324. public Thipx_ThunkConnect16
  325. Thipx_ThunkConnect16:
  326. pop ax
  327. pop dx
  328. push seg Thipx_ThunkData16
  329. push offset Thipx_ThunkData16
  330. push seg Thipx_ThkData32
  331. push offset Thipx_ThkData32
  332. push cs
  333. push dx
  334. push ax
  335. jmp ThunkConnect16
  336. Thipx_ThkData32 label byte
  337. db "Thipx_ThunkData32",0
  338. ENDIF
  339. END