PCMACRO.16 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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. ;***************************************************************************
  19. ;** 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 **
  20. ;***************************************************************************
  21. ;* *
  22. ;* Project Name : 16 bit ASM Macros *
  23. ;* *
  24. ;* File Name : PCMACRO.16 *
  25. ;* *
  26. ;* Programmer : Steve Tall *
  27. ;* *
  28. ;* Start Date : November 17th, 1995 *
  29. ;* *
  30. ;* Last Update : November 20th, 1995 [ST] *
  31. ;* *
  32. ;*-------------------------------------------------------------------------*
  33. ;* Functions: *
  34. ;* *
  35. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  36. saveall macro
  37. save ax,bx,cx,dx,bp,si,di,es,ds
  38. endm
  39. restall macro
  40. restore ax,bx,cx,dx,bp,si,di,es,ds
  41. endm
  42. save macro r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
  43. IFNB <r0>
  44. push r0
  45. save r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
  46. ENDIF
  47. endm
  48. restore macro r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
  49. IFNB <r14>
  50. pop r14
  51. ENDIF
  52. IFNB <r13>
  53. pop r13
  54. ENDIF
  55. IFNB <r12>
  56. pop r12
  57. ENDIF
  58. IFNB <r11>
  59. pop r11
  60. ENDIF
  61. IFNB <r10>
  62. pop r10
  63. ENDIF
  64. IFNB <r9>
  65. pop r9
  66. ENDIF
  67. IFNB <r8>
  68. pop r8
  69. ENDIF
  70. IFNB <r7>
  71. pop r7
  72. ENDIF
  73. IFNB <r6>
  74. pop r6
  75. ENDIF
  76. IFNB <r5>
  77. pop r5
  78. ENDIF
  79. IFNB <r4>
  80. pop r4
  81. ENDIF
  82. IFNB <r3>
  83. pop r3
  84. ENDIF
  85. IFNB <r2>
  86. pop r2
  87. ENDIF
  88. IFNB <r1>
  89. pop r1
  90. ENDIF
  91. IFNB <r0>
  92. pop r0
  93. ENDIF
  94. endm
  95. bhi macro lab
  96. ja lab
  97. endm
  98. bls macro lab
  99. jbe lab
  100. endm
  101. bcc macro lab
  102. jnc lab
  103. endm
  104. bcs macro lab
  105. jc lab
  106. endm
  107. bhs macro lab
  108. jnc lab
  109. endm
  110. blo macro lab
  111. jc lab
  112. endm
  113. bne macro lab
  114. jne lab
  115. endm
  116. beq macro lab
  117. je lab
  118. endm
  119. bpl macro lab
  120. jns lab
  121. endm
  122. bmi macro lab
  123. js lab
  124. endm
  125. bge macro lab
  126. jge lab
  127. endm
  128. blt macro lab
  129. jl lab
  130. endm
  131. bgt macro lab
  132. jg lab
  133. endm
  134. ble macro lab
  135. jle lab
  136. endm
  137. bra macro lab
  138. jmp lab
  139. endm
  140. bhis macro lab
  141. ja lab
  142. endm
  143. blss macro lab
  144. jbe lab
  145. endm
  146. bccs macro lab
  147. jnc lab
  148. endm
  149. bcss macro lab
  150. jc lab
  151. endm
  152. bnes macro lab
  153. jne lab
  154. endm
  155. beqs macro lab
  156. je lab
  157. endm
  158. bpls macro lab
  159. jns lab
  160. endm
  161. bmis macro lab
  162. js lab
  163. endm
  164. bges macro lab
  165. jge lab
  166. endm
  167. blts macro lab
  168. jl lab
  169. endm
  170. bgts macro lab
  171. jg lab
  172. endm
  173. bles macro lab
  174. jle lab
  175. endm
  176. bras macro lab
  177. jmp lab
  178. endm
  179. clear macro first
  180. xor first,first
  181. endm
  182. rts macro
  183. ret
  184. endm
  185. mov_b macro label,label2
  186. mov byte ptr label,byte ptr label2
  187. endm
  188. mov_w macro label,label2
  189. mov word ptr label,word ptr label2
  190. endm
  191. mov_d macro label,label2
  192. mov dword ptr label,dword ptr label2
  193. endm
  194. cmp_b macro label,label2
  195. cmp byte ptr label,byte ptr label2
  196. endm
  197. cmp_w macro label,label2
  198. cmp word ptr label,word ptr label2
  199. endm
  200. cmp_d macro label,label2
  201. cmp dword ptr label,dword ptr label2
  202. endm
  203. add_b macro label,label2
  204. add byte ptr label,byte ptr label2
  205. endm
  206. add_w macro label,label2
  207. add word ptr label,word ptr label2
  208. endm
  209. add_d macro label,label2
  210. add dword ptr label,dword ptr label2
  211. endm
  212. sub_b macro label,label2
  213. sub byte ptr label,byte ptr label2
  214. endm
  215. sub_w macro label,label2
  216. sub word ptr label,word ptr label2
  217. endm
  218. sub_d macro label,label2
  219. sub dword ptr label,dword ptr label2
  220. endm
  221. or_b macro label,label2
  222. or byte ptr label,byte ptr label2
  223. endm
  224. or_w macro label,label2
  225. or word ptr label,word ptr label2
  226. endm
  227. or_d macro label,label2
  228. or dword ptr label,dword ptr label2
  229. endm
  230. xor_b macro label,label2
  231. xor byte ptr label,byte ptr label2
  232. endm
  233. xor_w macro label,label2
  234. xor word ptr label,word ptr label2
  235. endm
  236. xor_d macro label,label2
  237. xor dword ptr label,dword ptr label2
  238. endm
  239. eor_b macro label,label2
  240. xor byte ptr label,byte ptr label2
  241. endm
  242. eor_w macro label,label2
  243. xor word ptr label,word ptr label2
  244. endm
  245. eor_d macro label,label2
  246. xor dword ptr label,dword ptr label2
  247. endm
  248. and_b macro label,label2
  249. and byte ptr label,byte ptr label2
  250. endm
  251. and_w macro label,label2
  252. and word ptr label,word ptr label2
  253. endm
  254. and_d macro label,label2
  255. and dword ptr label,dword ptr label2
  256. endm
  257. test_b macro label,label2
  258. test byte ptr label,byte ptr label2
  259. endm
  260. test_w macro label,label2
  261. test word ptr label,word ptr label2
  262. endm
  263. test_d macro label,label2
  264. test dword ptr label,dword ptr label2
  265. endm
  266. shr_b macro label,label2
  267. shr byte ptr label,label2
  268. endm
  269. shr_w macro label,label2
  270. shr word ptr label,label2
  271. endm
  272. shr_d macro label,label2
  273. shr dword ptr label,label2
  274. endm
  275. shl_b macro label,label2
  276. shl byte ptr label,label2
  277. endm
  278. shl_w macro label,label2
  279. shl word ptr label,label2
  280. endm
  281. shl_d macro label,label2
  282. shl dword ptr label,label2
  283. endm
  284. sar_b macro label,label2
  285. sar byte ptr label,label2
  286. endm
  287. sar_w macro label,label2
  288. sar word ptr label,label2
  289. endm
  290. sar_d macro label,label2
  291. sar dword ptr label,label2
  292. endm
  293. sal_b macro label,label2
  294. sal byte ptr label,label2
  295. endm
  296. sal_w macro label,label2
  297. sal word ptr label,label2
  298. endm
  299. sal_d macro label,label2
  300. sal dword ptr label,label2
  301. endm
  302. inc_b macro label
  303. inc byte ptr label
  304. endm
  305. inc_w macro label
  306. inc word ptr label
  307. endm
  308. inc_d macro label
  309. inc dword ptr label
  310. endm
  311. dec_b macro label
  312. dec byte ptr label
  313. endm
  314. dec_w macro label
  315. dec word ptr label
  316. endm
  317. dec_d macro label
  318. dec dword ptr label
  319. endm
  320. movzx_b macro label,label2
  321. movzx label,byte ptr label2
  322. endm
  323. movzx_w macro label,label2
  324. movzx label,word ptr label2
  325. endm
  326. movsx_b macro label,label2
  327. movsx label,byte ptr label2
  328. endm
  329. movsx_w macro label,label2
  330. movsx label,word ptr label2
  331. endm
  332. mul_b macro label
  333. mul byte ptr label
  334. endm
  335. mul_w macro label
  336. mul word ptr label
  337. endm
  338. div_b macro label
  339. div byte ptr label
  340. endm
  341. div_w macro label
  342. div word ptr label
  343. endm
  344. idiv_b macro label
  345. idiv byte ptr label
  346. endm
  347. idiv_w macro label
  348. idiv word ptr label
  349. endm
  350. tst_b macro label
  351. cmp byte ptr label,0
  352. endm
  353. tst_w macro label
  354. cmp word ptr label,0
  355. endm
  356. tst_d macro label
  357. cmp dword ptr label,0
  358. endm
  359. not_b macro label
  360. not byte ptr label
  361. endm
  362. not_w macro label
  363. not word ptr label
  364. endm
  365. not_d macro label
  366. not dword ptr label
  367. endm
  368. neg_b macro label
  369. neg byte ptr label
  370. endm
  371. neg_w macro label
  372. neg word ptr label
  373. endm
  374. neg_d macro label
  375. neg dword ptr label
  376. endm