PCMACRO.16 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  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. ;$e:\ifil\pcmacro.inc
  19. ;- 16-5-1991 at 10:55:13 by mike
  20. ;- 16-5-1991 at 08:30:30 by mike
  21. ;- 3-5-1991 at 15:39:52 by mike
  22. SUBTTL PCMACRO.INC
  23. .xlist
  24. saveall macro
  25. save ax,bx,cx,dx,bp,si,di,es,ds
  26. endm
  27. restall macro
  28. restore ax,bx,cx,dx,bp,si,di,es,ds
  29. endm
  30. save macro r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
  31. IFNB <r0>
  32. push r0
  33. save r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
  34. ENDIF
  35. endm
  36. restore macro r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
  37. IFNB <r14>
  38. pop r14
  39. ENDIF
  40. IFNB <r13>
  41. pop r13
  42. ENDIF
  43. IFNB <r12>
  44. pop r12
  45. ENDIF
  46. IFNB <r11>
  47. pop r11
  48. ENDIF
  49. IFNB <r10>
  50. pop r10
  51. ENDIF
  52. IFNB <r9>
  53. pop r9
  54. ENDIF
  55. IFNB <r8>
  56. pop r8
  57. ENDIF
  58. IFNB <r7>
  59. pop r7
  60. ENDIF
  61. IFNB <r6>
  62. pop r6
  63. ENDIF
  64. IFNB <r5>
  65. pop r5
  66. ENDIF
  67. IFNB <r4>
  68. pop r4
  69. ENDIF
  70. IFNB <r3>
  71. pop r3
  72. ENDIF
  73. IFNB <r2>
  74. pop r2
  75. ENDIF
  76. IFNB <r1>
  77. pop r1
  78. ENDIF
  79. IFNB <r0>
  80. pop r0
  81. ENDIF
  82. endm
  83. bhi macro lab
  84. ja lab
  85. endm
  86. bls macro lab
  87. jbe lab
  88. endm
  89. bcc macro lab
  90. jnc lab
  91. endm
  92. bcs macro lab
  93. jc lab
  94. endm
  95. bhs macro lab
  96. jnc lab
  97. endm
  98. blo macro lab
  99. jc lab
  100. endm
  101. bne macro lab
  102. jne lab
  103. endm
  104. beq macro lab
  105. je lab
  106. endm
  107. bpl macro lab
  108. jns lab
  109. endm
  110. bmi macro lab
  111. js lab
  112. endm
  113. bge macro lab
  114. jge lab
  115. endm
  116. blt macro lab
  117. jl lab
  118. endm
  119. bgt macro lab
  120. jg lab
  121. endm
  122. ble macro lab
  123. jle lab
  124. endm
  125. bra macro lab
  126. jmp lab
  127. endm
  128. bhis macro lab
  129. ja lab
  130. endm
  131. blss macro lab
  132. jbe lab
  133. endm
  134. bccs macro lab
  135. jnc lab
  136. endm
  137. bcss macro lab
  138. jc lab
  139. endm
  140. bnes macro lab
  141. jne lab
  142. endm
  143. beqs macro lab
  144. je lab
  145. endm
  146. bpls macro lab
  147. jns lab
  148. endm
  149. bmis macro lab
  150. js lab
  151. endm
  152. bges macro lab
  153. jge lab
  154. endm
  155. blts macro lab
  156. jl lab
  157. endm
  158. bgts macro lab
  159. jg lab
  160. endm
  161. bles macro lab
  162. jle lab
  163. endm
  164. bras macro lab
  165. jmp lab
  166. endm
  167. tstb macro e1
  168. IFIDN <e1>,<al>
  169. or e1,e1
  170. EXITM
  171. ENDIF
  172. IFIDN <e1>,<bp>
  173. or e1,e1
  174. EXITM
  175. ENDIF
  176. IFIDN <e1>,<ah>
  177. or e1,e1
  178. EXITM
  179. ENDIF
  180. IFIDN <e1>,<bl>
  181. or e1,e1
  182. EXITM
  183. ENDIF
  184. IFIDN <e1>,<bh>
  185. or e1,e1
  186. EXITM
  187. ENDIF
  188. IFIDN <e1>,<cl>
  189. or e1,e1
  190. EXITM
  191. ENDIF
  192. IFIDN <e1>,<ch>
  193. or e1,e1
  194. EXITM
  195. ENDIF
  196. IFIDN <e1>,<dl>
  197. or e1,e1
  198. EXITM
  199. ENDIF
  200. IFIDN <e1>,<dh>
  201. or e1,e1
  202. EXITM
  203. ENDIF
  204. cmp BYTE PTR e1,0
  205. endm
  206. tstw macro e1
  207. IFIDN <e1>,<ax>
  208. or e1,e1
  209. EXITM
  210. ENDIF
  211. IFIDN <e1>,<bx>
  212. or e1,e1
  213. EXITM
  214. ENDIF
  215. IFIDN <e1>,<cx>
  216. or e1,e1
  217. EXITM
  218. ENDIF
  219. IFIDN <e1>,<dx>
  220. or e1,e1
  221. EXITM
  222. ENDIF
  223. IFIDN <e1>,<bp>
  224. or e1,e1
  225. EXITM
  226. ENDIF
  227. IFIDN <e1>,<si>
  228. or e1,e1
  229. EXITM
  230. ENDIF
  231. IFIDN <e1>,<di>
  232. or e1,e1
  233. EXITM
  234. ENDIF
  235. cmp WORD PTR e1,0
  236. endm
  237. tst macro e1
  238. IFIDN <e1>,<ax>
  239. or e1,e1
  240. EXITM
  241. ENDIF
  242. IFIDN <e1>,<bx>
  243. or e1,e1
  244. EXITM
  245. ENDIF
  246. IFIDN <e1>,<cx>
  247. or e1,e1
  248. EXITM
  249. ENDIF
  250. IFIDN <e1>,<dx>
  251. or e1,e1
  252. EXITM
  253. ENDIF
  254. IFIDN <e1>,<bp>
  255. or e1,e1
  256. EXITM
  257. ENDIF
  258. IFIDN <e1>,<si>
  259. or e1,e1
  260. EXITM
  261. ENDIF
  262. IFIDN <e1>,<di>
  263. or e1,e1
  264. EXITM
  265. ENDIF
  266. IFIDN <e1>,<al>
  267. or e1,e1
  268. EXITM
  269. ENDIF
  270. IFIDN <e1>,<bl>
  271. or e1,e1
  272. EXITM
  273. ENDIF
  274. IFIDN <e1>,<cl>
  275. or e1,e1
  276. EXITM
  277. ENDIF
  278. IFIDN <e1>,<dl>
  279. or e1,e1
  280. EXITM
  281. ENDIF
  282. IFIDN <e1>,<ah>
  283. or e1,e1
  284. EXITM
  285. ENDIF
  286. IFIDN <e1>,<bh>
  287. or e1,e1
  288. EXITM
  289. ENDIF
  290. IFIDN <e1>,<ch>
  291. or e1,e1
  292. EXITM
  293. ENDIF
  294. IFIDN <e1>,<dh>
  295. or e1,e1
  296. EXITM
  297. ENDIF
  298. cmp e1,0
  299. endm
  300. clear macro first
  301. xor first,first
  302. endm
  303. rts macro
  304. ret
  305. endm
  306. bclrb macro e1,e2
  307. btstb e1,e2
  308. pushf
  309. bclrb_sub e1,e2
  310. popf
  311. endm
  312. bclrb_sub macro e1,e2
  313. IFIDN <e1>,<al>
  314. and e1,NOT ( 1 SHL e2 )
  315. EXITM
  316. ENDIF
  317. IFIDN <e1>,<bp>
  318. and e1,NOT ( 1 SHL e2 )
  319. EXITM
  320. ENDIF
  321. IFIDN <e1>,<ah>
  322. and e1,NOT ( 1 SHL e2 )
  323. EXITM
  324. ENDIF
  325. IFIDN <e1>,<bl>
  326. and e1,NOT ( 1 SHL e2 )
  327. EXITM
  328. ENDIF
  329. IFIDN <e1>,<bh>
  330. and e1,NOT ( 1 SHL e2 )
  331. EXITM
  332. ENDIF
  333. IFIDN <e1>,<cl>
  334. and e1,NOT ( 1 SHL e2 )
  335. EXITM
  336. ENDIF
  337. IFIDN <e1>,<ch>
  338. and e1,NOT ( 1 SHL e2 )
  339. EXITM
  340. ENDIF
  341. IFIDN <e1>,<dl>
  342. and e1,NOT ( 1 SHL e2 )
  343. EXITM
  344. ENDIF
  345. IFIDN <e1>,<dh>
  346. and e1,NOT ( 1 SHL e2 )
  347. EXITM
  348. ENDIF
  349. and BYTE PTR e1,NOT ( 1 SHL e2 )
  350. endm
  351. bsetb macro e1,e2
  352. btstb e1,e2
  353. pushf
  354. or BYTE PTR e1,1 SHL e2
  355. popf
  356. endm
  357. bchgb macro e1,e2
  358. btstb e1,e2
  359. pushf
  360. xor BYTE PTR e1,1 SHL e2
  361. popf
  362. endm
  363. mov_b macro label,label2
  364. mov byte ptr label,byte ptr label2
  365. endm
  366. mov_w macro label,label2
  367. mov word ptr label,word ptr label2
  368. endm
  369. mov_d macro label,label2
  370. mov dword ptr label,dword ptr label2
  371. endm
  372. cmp_b macro label,label2
  373. cmp byte ptr label,byte ptr label2
  374. endm
  375. cmp_w macro label,label2
  376. cmp word ptr label,word ptr label2
  377. endm
  378. cmp_d macro label,label2
  379. cmp dword ptr label,dword ptr label2
  380. endm
  381. add_b macro label,label2
  382. add byte ptr label,byte ptr label2
  383. endm
  384. add_w macro label,label2
  385. add word ptr label,word ptr label2
  386. endm
  387. add_d macro label,label2
  388. add dword ptr label,dword ptr label2
  389. endm
  390. sub_b macro label,label2
  391. sub byte ptr label,byte ptr label2
  392. endm
  393. sub_w macro label,label2
  394. sub word ptr label,word ptr label2
  395. endm
  396. sub_d macro label,label2
  397. sub dword ptr label,dword ptr label2
  398. endm
  399. or_b macro label,label2
  400. or byte ptr label,byte ptr label2
  401. endm
  402. or_w macro label,label2
  403. or word ptr label,word ptr label2
  404. endm
  405. or_d macro label,label2
  406. or dword ptr label,dword ptr label2
  407. endm
  408. xor_b macro label,label2
  409. xor byte ptr label,byte ptr label2
  410. endm
  411. xor_w macro label,label2
  412. xor word ptr label,word ptr label2
  413. endm
  414. xor_d macro label,label2
  415. xor dword ptr label,dword ptr label2
  416. endm
  417. eor_b macro label,label2
  418. xor byte ptr label,byte ptr label2
  419. endm
  420. eor_w macro label,label2
  421. xor word ptr label,word ptr label2
  422. endm
  423. eor_d macro label,label2
  424. xor dword ptr label,dword ptr label2
  425. endm
  426. and_b macro label,label2
  427. and byte ptr label,byte ptr label2
  428. endm
  429. and_w macro label,label2
  430. and word ptr label,word ptr label2
  431. endm
  432. and_d macro label,label2
  433. and dword ptr label,dword ptr label2
  434. endm
  435. test_b macro label,label2
  436. test byte ptr label,byte ptr label2
  437. endm
  438. test_w macro label,label2
  439. test word ptr label,word ptr label2
  440. endm
  441. test_d macro label,label2
  442. test dword ptr label,dword ptr label2
  443. endm
  444. shr_b macro label,label2
  445. shr byte ptr label,label2
  446. endm
  447. shr_w macro label,label2
  448. shr word ptr label,label2
  449. endm
  450. shr_d macro label,label2
  451. shr dword ptr label,label2
  452. endm
  453. shl_b macro label,label2
  454. shl byte ptr label,label2
  455. endm
  456. shl_w macro label,label2
  457. shl word ptr label,label2
  458. endm
  459. shl_d macro label,label2
  460. shl dword ptr label,label2
  461. endm
  462. sar_b macro label,label2
  463. sar byte ptr label,label2
  464. endm
  465. sar_w macro label,label2
  466. sar word ptr label,label2
  467. endm
  468. sar_d macro label,label2
  469. sar dword ptr label,label2
  470. endm
  471. sal_b macro label,label2
  472. sal byte ptr label,label2
  473. endm
  474. sal_w macro label,label2
  475. sal word ptr label,label2
  476. endm
  477. sal_d macro label,label2
  478. sal dword ptr label,label2
  479. endm
  480. inc_b macro label
  481. inc byte ptr label
  482. endm
  483. inc_w macro label
  484. inc word ptr label
  485. endm
  486. inc_d macro label
  487. inc dword ptr label
  488. endm
  489. dec_b macro label
  490. dec byte ptr label
  491. endm
  492. dec_w macro label
  493. dec word ptr label
  494. endm
  495. dec_d macro label
  496. dec dword ptr label
  497. endm
  498. movzx_b macro label,label2
  499. movzx label,byte ptr label2
  500. endm
  501. movzx_w macro label,label2
  502. movzx label,word ptr label2
  503. endm
  504. movsx_b macro label,label2
  505. movsx label,byte ptr label2
  506. endm
  507. movsx_w macro label,label2
  508. movsx label,word ptr label2
  509. endm
  510. mul_b macro label
  511. mul byte ptr label
  512. endm
  513. mul_w macro label
  514. mul word ptr label
  515. endm
  516. div_b macro label
  517. div byte ptr label
  518. endm
  519. div_w macro label
  520. div word ptr label
  521. endm
  522. idiv_b macro label
  523. idiv byte ptr label
  524. endm
  525. idiv_w macro label
  526. idiv word ptr label
  527. endm
  528. tst_b macro label
  529. cmp byte ptr label,0
  530. endm
  531. tst_w macro label
  532. cmp word ptr label,0
  533. endm
  534. tst_d macro label
  535. cmp dword ptr label,0
  536. endm
  537. not_b macro label
  538. not byte ptr label
  539. endm
  540. not_w macro label
  541. not word ptr label
  542. endm
  543. not_d macro label
  544. not dword ptr label
  545. endm
  546. neg_b macro label
  547. neg byte ptr label
  548. endm
  549. neg_w macro label
  550. neg word ptr label
  551. endm
  552. neg_d macro label
  553. neg dword ptr label
  554. endm
  555. .list