PLAYCD.ASM 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. IDEAL
  19. P386
  20. MODEL USE32 FLAT
  21. LOCALS ??
  22. DPMI_INTR equ 031h
  23. GLOBAL DPMI_real_alloc : near
  24. GLOBAL DPMI_real_free : near
  25. GLOBAL DPMI_real_intr : near
  26. GLOBAL DPMI_real_call : near
  27. STRUC SEGSEL
  28. segmen dw ?
  29. select dw ?
  30. ENDS
  31. STRUC REGS
  32. _eax dd ?
  33. _ebx dd ?
  34. _ecx dd ?
  35. _edx dd ?
  36. _esi dd ?
  37. _edi dd ?
  38. _cflag dd ?
  39. ENDS
  40. STRUC SREGS
  41. _es dw ?
  42. _cs dw ?
  43. _ss dw ?
  44. _ds dw ?
  45. _fs dw ?
  46. _gs dw ?
  47. ENDS
  48. STRUC DPMI_REGS
  49. _edi dd ?
  50. _esi dd ?
  51. _ebp dd ?
  52. dd ?
  53. _ebx dd ?
  54. _edx dd ?
  55. _ecx dd ?
  56. _eax dd ?
  57. Flags dw ?
  58. _es dw ?
  59. _ds dw ?
  60. _fs dw ?
  61. _gs dw ?
  62. _ip dw ?
  63. _cs dw ?
  64. _sp dw ?
  65. _ss dw ?
  66. dd ?
  67. dd ?
  68. size_ref db ?
  69. ENDS
  70. CODESEG
  71. ; int DPMI_real_alloc ( UINT , SEGREG * , USHORT * ) ;
  72. PROC DPMI_real_alloc C near
  73. USES ebx , edx
  74. ARG paragra : DWORD
  75. ARG blk_segptr : DWORD
  76. ARG largest_blkptr : DWORD
  77. mov eax, 0100h
  78. mov ebx, [paragra]
  79. int DPMI_INTR
  80. jnc ??dpmi_succed
  81. mov ebx, [largest_blkptr]
  82. mov [ word ptr ebx ] , bx
  83. movzx eax , al
  84. ret
  85. ??dpmi_succed:
  86. mov ebx, [blk_segptr]
  87. mov [(type SEGSEL ptr ebx). segmen ] , ax
  88. mov [(type SEGSEL ptr ebx). select ] , dx
  89. xor eax , eax
  90. ret
  91. ENDP DPMI_real_alloc
  92. ;**************************************************************************
  93. ; int DPMI_real_free ( UINT ) ;
  94. PROC DPMI_real_free C near
  95. USES eax , edx
  96. ARG blk_selec : DWORD
  97. mov eax, 0101h
  98. mov edx, [blk_selec]
  99. shr edx , 16
  100. int DPMI_INTR
  101. ret
  102. ENDP DPMI_real_free
  103. PROC DPMI_real_intr C near
  104. USES eax , ebx , ecx , edx , edi , esi
  105. ARG vector : dword
  106. ARG regs_ptr: dword
  107. ARG sreg_ptr: dword
  108. LOCAL regblk : DPMI_REGS
  109. lea edi , [ regblk ]
  110. xor eax , eax
  111. lea ecx , [ regblk . size_ref ]
  112. sub ecx , edi
  113. shr ecx , 2
  114. rep stosd
  115. mov ebx , [ regs_ptr ]
  116. mov eax , [ (type REGS ptr ebx) . _eax ]
  117. mov [ regblk . _eax ] , eax
  118. mov eax , [ (type REGS ptr ebx) . _ebx ]
  119. mov [ regblk . _ebx ] , eax
  120. mov eax , [ (type REGS ptr ebx) . _ecx ]
  121. mov [ regblk . _ecx ] , eax
  122. mov eax , [ (type REGS ptr ebx) . _edx ]
  123. mov [ regblk . _edx ] , eax
  124. mov eax , [ (type REGS ptr ebx) . _esi ]
  125. mov [ regblk . _esi ] , eax
  126. mov eax , [ (type REGS ptr ebx) . _edi ]
  127. mov [ regblk . _edi ] , eax
  128. mov ebx , [ sreg_ptr ]
  129. mov ax , [ (type SREGS ptr ebx) . _es ]
  130. mov [ regblk . _es ] , ax
  131. mov ax , [ (type SREGS ptr ebx) . _ds ]
  132. mov [ regblk . _ds ] , ax
  133. mov eax , 0300h
  134. mov ebx , [ vector ]
  135. xor bh , bh
  136. xor ecx , ecx
  137. lea edi , [ regblk ]
  138. int DPMI_INTR
  139. mov ebx , [ regs_ptr ]
  140. mov eax , [ regblk . _eax ]
  141. mov [ (type REGS ptr ebx) . _eax ] , eax
  142. mov eax , [ regblk . _ebx ]
  143. mov [ (type REGS ptr ebx) . _ebx ] , eax
  144. mov eax , [ regblk . _ecx ]
  145. mov [ (type REGS ptr ebx) . _ecx ] , eax
  146. mov eax , [ regblk . _edx ]
  147. mov [ (type REGS ptr ebx) . _edx ] , eax
  148. mov eax , [ regblk . _esi ]
  149. mov [ (type REGS ptr ebx) . _esi ] , eax
  150. mov eax , [ regblk . _edi ]
  151. mov [ (type REGS ptr ebx) . _edi ] , eax
  152. mov ebx , [ sreg_ptr ]
  153. mov ax , [ regblk . _es ]
  154. mov [ (type SREGS ptr ebx) . _es ] , ax
  155. mov ax , [ regblk . _ds ]
  156. mov [ (type SREGS ptr ebx) . _ds ] , ax
  157. ret
  158. ENDP DPMI_real_intr
  159. PROC DPMI_real_call C near
  160. USES eax , ebx , ecx , edx , edi , esi
  161. ARG vector : dword
  162. ARG regs_ptr: dword
  163. ARG sreg_ptr: dword
  164. LOCAL regblk : DPMI_REGS
  165. lea edi , [ regblk ]
  166. xor al , al
  167. lea ecx , [ regblk . size_ref ]
  168. sub ecx , edi
  169. rep movsb
  170. mov ebx , [ regs_ptr ]
  171. mov eax , [ (type REGS ptr ebx) . _eax ]
  172. mov [ regblk . _eax ] , eax
  173. mov eax , [ (type REGS ptr ebx) . _ebx ]
  174. mov [ regblk . _ebx ] , eax
  175. mov eax , [ (type REGS ptr ebx) . _ecx ]
  176. mov [ regblk . _ecx ] , eax
  177. mov eax , [ (type REGS ptr ebx) . _edx ]
  178. mov [ regblk . _edx ] , eax
  179. mov eax , [ (type REGS ptr ebx) . _esi ]
  180. mov [ regblk . _esi ] , eax
  181. mov eax , [ (type REGS ptr ebx) . _edi ]
  182. mov [ regblk . _edi ] , eax
  183. mov ebx , [ sreg_ptr ]
  184. mov ax , [ (type SREGS ptr ebx) . _es ]
  185. mov [ regblk . _es ] , ax
  186. mov ax , [ (type SREGS ptr ebx) . _ds ]
  187. mov [ regblk . _ds ] , ax
  188. ; mov eax , 0300h
  189. ; mov ebx , [ vector ]
  190. ; xor bh , bh
  191. ; xor ecx , ecx
  192. ; lea edi , [ regblk ]
  193. ; int DPMI_INTR
  194. mov ebx , [ regs_ptr ]
  195. mov eax , [ regblk . _eax ]
  196. mov [ (type REGS ptr ebx) . _eax ] , eax
  197. mov eax , [ regblk . _ebx ]
  198. mov [ (type REGS ptr ebx) . _ebx ] , eax
  199. mov eax , [ regblk . _ecx ]
  200. mov [ (type REGS ptr ebx) . _ecx ] , eax
  201. mov eax , [ regblk . _edx ]
  202. mov [ (type REGS ptr ebx) . _edx ] , eax
  203. mov eax , [ regblk . _esi ]
  204. mov [ (type REGS ptr ebx) . _esi ] , eax
  205. mov eax , [ regblk . _edi ]
  206. mov [ (type REGS ptr ebx) . _edi ] , eax
  207. mov ebx , [ sreg_ptr ]
  208. mov ax , [ regblk . _es ]
  209. mov [ (type SREGS ptr ebx) . _es ] , ax
  210. mov ax , [ regblk . _ds ]
  211. mov [ (type SREGS ptr ebx) . _ds ] , ax
  212. ret
  213. ENDP DPMI_real_call
  214. END
  215.