CnC_Red_Alert/LAUNCH/PCMACRO.16

779 lines
8.4 KiB
Plaintext

;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;$e:\ifil\pcmacro.inc
;- 16-5-1991 at 10:55:13 by mike
;- 16-5-1991 at 08:30:30 by mike
;- 3-5-1991 at 15:39:52 by mike
SUBTTL PCMACRO.INC
.xlist
saveall macro
save ax,bx,cx,dx,bp,si,di,es,ds
endm
restall macro
restore ax,bx,cx,dx,bp,si,di,es,ds
endm
save macro r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
IFNB <r0>
push r0
save r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
ENDIF
endm
restore macro r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
IFNB <r14>
pop r14
ENDIF
IFNB <r13>
pop r13
ENDIF
IFNB <r12>
pop r12
ENDIF
IFNB <r11>
pop r11
ENDIF
IFNB <r10>
pop r10
ENDIF
IFNB <r9>
pop r9
ENDIF
IFNB <r8>
pop r8
ENDIF
IFNB <r7>
pop r7
ENDIF
IFNB <r6>
pop r6
ENDIF
IFNB <r5>
pop r5
ENDIF
IFNB <r4>
pop r4
ENDIF
IFNB <r3>
pop r3
ENDIF
IFNB <r2>
pop r2
ENDIF
IFNB <r1>
pop r1
ENDIF
IFNB <r0>
pop r0
ENDIF
endm
bhi macro lab
ja lab
endm
bls macro lab
jbe lab
endm
bcc macro lab
jnc lab
endm
bcs macro lab
jc lab
endm
bhs macro lab
jnc lab
endm
blo macro lab
jc lab
endm
bne macro lab
jne lab
endm
beq macro lab
je lab
endm
bpl macro lab
jns lab
endm
bmi macro lab
js lab
endm
bge macro lab
jge lab
endm
blt macro lab
jl lab
endm
bgt macro lab
jg lab
endm
ble macro lab
jle lab
endm
bra macro lab
jmp lab
endm
bhis macro lab
ja lab
endm
blss macro lab
jbe lab
endm
bccs macro lab
jnc lab
endm
bcss macro lab
jc lab
endm
bnes macro lab
jne lab
endm
beqs macro lab
je lab
endm
bpls macro lab
jns lab
endm
bmis macro lab
js lab
endm
bges macro lab
jge lab
endm
blts macro lab
jl lab
endm
bgts macro lab
jg lab
endm
bles macro lab
jle lab
endm
bras macro lab
jmp lab
endm
tstb macro e1
IFIDN <e1>,<al>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bp>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<ah>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bl>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bh>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<cl>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<ch>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<dl>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<dh>
or e1,e1
EXITM
ENDIF
cmp BYTE PTR e1,0
endm
tstw macro e1
IFIDN <e1>,<ax>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bx>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<cx>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<dx>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bp>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<si>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<di>
or e1,e1
EXITM
ENDIF
cmp WORD PTR e1,0
endm
tst macro e1
IFIDN <e1>,<ax>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bx>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<cx>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<dx>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bp>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<si>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<di>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<al>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bl>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<cl>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<dl>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<ah>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<bh>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<ch>
or e1,e1
EXITM
ENDIF
IFIDN <e1>,<dh>
or e1,e1
EXITM
ENDIF
cmp e1,0
endm
clear macro first
xor first,first
endm
rts macro
ret
endm
bclrb macro e1,e2
btstb e1,e2
pushf
bclrb_sub e1,e2
popf
endm
bclrb_sub macro e1,e2
IFIDN <e1>,<al>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<bp>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<ah>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<bl>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<bh>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<cl>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<ch>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<dl>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
IFIDN <e1>,<dh>
and e1,NOT ( 1 SHL e2 )
EXITM
ENDIF
and BYTE PTR e1,NOT ( 1 SHL e2 )
endm
bsetb macro e1,e2
btstb e1,e2
pushf
or BYTE PTR e1,1 SHL e2
popf
endm
bchgb macro e1,e2
btstb e1,e2
pushf
xor BYTE PTR e1,1 SHL e2
popf
endm
mov_b macro label,label2
mov byte ptr label,byte ptr label2
endm
mov_w macro label,label2
mov word ptr label,word ptr label2
endm
mov_d macro label,label2
mov dword ptr label,dword ptr label2
endm
cmp_b macro label,label2
cmp byte ptr label,byte ptr label2
endm
cmp_w macro label,label2
cmp word ptr label,word ptr label2
endm
cmp_d macro label,label2
cmp dword ptr label,dword ptr label2
endm
add_b macro label,label2
add byte ptr label,byte ptr label2
endm
add_w macro label,label2
add word ptr label,word ptr label2
endm
add_d macro label,label2
add dword ptr label,dword ptr label2
endm
sub_b macro label,label2
sub byte ptr label,byte ptr label2
endm
sub_w macro label,label2
sub word ptr label,word ptr label2
endm
sub_d macro label,label2
sub dword ptr label,dword ptr label2
endm
or_b macro label,label2
or byte ptr label,byte ptr label2
endm
or_w macro label,label2
or word ptr label,word ptr label2
endm
or_d macro label,label2
or dword ptr label,dword ptr label2
endm
xor_b macro label,label2
xor byte ptr label,byte ptr label2
endm
xor_w macro label,label2
xor word ptr label,word ptr label2
endm
xor_d macro label,label2
xor dword ptr label,dword ptr label2
endm
eor_b macro label,label2
xor byte ptr label,byte ptr label2
endm
eor_w macro label,label2
xor word ptr label,word ptr label2
endm
eor_d macro label,label2
xor dword ptr label,dword ptr label2
endm
and_b macro label,label2
and byte ptr label,byte ptr label2
endm
and_w macro label,label2
and word ptr label,word ptr label2
endm
and_d macro label,label2
and dword ptr label,dword ptr label2
endm
test_b macro label,label2
test byte ptr label,byte ptr label2
endm
test_w macro label,label2
test word ptr label,word ptr label2
endm
test_d macro label,label2
test dword ptr label,dword ptr label2
endm
shr_b macro label,label2
shr byte ptr label,label2
endm
shr_w macro label,label2
shr word ptr label,label2
endm
shr_d macro label,label2
shr dword ptr label,label2
endm
shl_b macro label,label2
shl byte ptr label,label2
endm
shl_w macro label,label2
shl word ptr label,label2
endm
shl_d macro label,label2
shl dword ptr label,label2
endm
sar_b macro label,label2
sar byte ptr label,label2
endm
sar_w macro label,label2
sar word ptr label,label2
endm
sar_d macro label,label2
sar dword ptr label,label2
endm
sal_b macro label,label2
sal byte ptr label,label2
endm
sal_w macro label,label2
sal word ptr label,label2
endm
sal_d macro label,label2
sal dword ptr label,label2
endm
inc_b macro label
inc byte ptr label
endm
inc_w macro label
inc word ptr label
endm
inc_d macro label
inc dword ptr label
endm
dec_b macro label
dec byte ptr label
endm
dec_w macro label
dec word ptr label
endm
dec_d macro label
dec dword ptr label
endm
movzx_b macro label,label2
movzx label,byte ptr label2
endm
movzx_w macro label,label2
movzx label,word ptr label2
endm
movsx_b macro label,label2
movsx label,byte ptr label2
endm
movsx_w macro label,label2
movsx label,word ptr label2
endm
mul_b macro label
mul byte ptr label
endm
mul_w macro label
mul word ptr label
endm
div_b macro label
div byte ptr label
endm
div_w macro label
div word ptr label
endm
idiv_b macro label
idiv byte ptr label
endm
idiv_w macro label
idiv word ptr label
endm
tst_b macro label
cmp byte ptr label,0
endm
tst_w macro label
cmp word ptr label,0
endm
tst_d macro label
cmp dword ptr label,0
endm
not_b macro label
not byte ptr label
endm
not_w macro label
not word ptr label
endm
not_d macro label
not dword ptr label
endm
neg_b macro label
neg byte ptr label
endm
neg_w macro label
neg word ptr label
endm
neg_d macro label
neg dword ptr label
endm
.list