home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
commercial-software
/
programming
/
Z80TOOLS.ZIP
/
DISK1.ZIP
/
ENVIRON.LIB
< prev
next >
Wrap
Text File
|
1998-07-30
|
23KB
|
1,394 lines
CpmLevel equ 22h
true equ 0ffffh
false equ 00000h
WarmStart equ 0000h
BdosJump equ 0005h
BdosAddress equ 0006h
CpmPass1 equ 0051h
CpmPass1Len equ 0053h
CpmPass2 equ 0054h
CpmPass2Len equ 0056h
CpmFcb equ 005Ch
CpmFcb2 equ CpmFcb+10h
CpmBuffer equ 0080h
CpmTailLen equ CpmBuffer
CpmTail equ CpmBuffer+1
TransientArea equ 0100h
AsciiBEL equ 07h
AsciiBS equ 08h
AsciiTAB equ 09h
AsciiLF equ 0Ah
AsciiFF equ 0Ch
AsciiCR equ 0Dh
AsciiSO equ 0Eh
AsciiSI equ 0Fh
AsciiDC1 equ 11h
AsciiDC2 equ 12h
AsciiDC3 equ 13h
AsciiDC4 equ 14h
CpmEof equ 1Ah
AsciiESC equ 1Bh
AsciiBlank equ 20h
AsciiDEL equ 7Fh
FcrLen equ 40h
FilePMread equ 80h
FilePMwrite equ 40h
FilePMdelete equ 20h
FileAttF1 equ 40h
FileAttF2 equ 20h
FileAttF3 equ 10h
FileAttF4 equ 08h
FileAttRO equ 04h
FileAttSY equ 02h
FileAttAR equ 01h
ckdisp macro ?disp
if (?disp gt 7fh) and (?disp lt 0ff80h)
++ displacement &disp too large
endif
endm
lxix macro addr
db 0ddh,21h
dw addr
endm
lded macro addr
db 0edh,5bh
dw addr
endm
lbcd macro addr
db 0edh,4bh
dw addr
endm
lspd macro addr
db 0edh,07bh
dw addr
endm
lixd macro addr
db 0ddh,2ah
dw addr
endm
sbcd macro addr
db 0edh,43h
dw addr
endm
sded macro addr
db 0edh,53h
dw addr
endm
sspd macro addr
db 0edh,73h
dw addr
endm
sixd macro addr
db 0ddh,22h
dw addr
endm
pushix macro
db 0ddh,0e5h
endm
popix macro
db 0ddh,0e1h
endm
xtix macro
db 0ddh,0e3h
endm
ldi macro
db 0edh,0a0h
endm
ldir macro
db 0edh,0b0h
endm
ldd macro
db 0edh,0a8h
endm
lddr macro
db 0edh,0b8h
endm
cmpi macro
db 0edh,0a1h
endm
cpir macro
db 0edh,0b1h
endm
ldx macro reg,disp
ckdisp disp
db 0ddh,reg*8+46h,disp
endm
stx macro reg,disp
ckdisp disp
db 0ddh,70h+reg,disp
endm
mvix macro byte,disp
ckdisp disp
db 0ddh,36h,disp,byte
endm
addx macro disp
ckdisp disp
db 0ddh,86h,disp
endm
adcx macro disp
ckdisp disp
db 0ddh,8eh,disp
endm
subx macro disp
ckdisp disp
db 0ddh,96h,disp
endm
sbcx macro disp
ckdisp disp
db 0ddh,9eh,disp
endm
andx macro disp
ckdisp disp
db 0ddh,0a6h,disp
endm
xorx macro disp
ckdisp disp
db 0ddh,0aeh,disp
endm
orx macro disp
ckdisp disp
db 0ddh,0b6h,disp
endm
cmpx macro disp
ckdisp disp
db 0ddh,0beh,disp
endm
inrx macro disp
ckdisp disp
db 0ddh,34h,disp
endm
dcrx macro disp
ckdisp disp
db 0ddh,035h,disp
endm
neg macro
db 0edh,44h
endm
dadc macro dreg
db 0edh,dreg*8+4ah
endm
dsbc macro dreg
db 0edh,dreg*8+42h
endm
dadx macro dreg
db 0ddh,dreg*8+09h
endm
inxix macro
db 0ddh,23h
endm
dcxix macro
db 0ddh,2bh
endm
ldbwx macro dreg,disp
ckdisp disp+1
db 0ddh,(dreg+1)*8+46h,disp
db 0ddh,dreg*8+46h,disp+1
endm
stbwx macro dreg,disp
ckdisp disp+1
db 0ddh,70h+dreg+1,disp
db 0ddh,70h+dreg,disp+1
endm
BIT7 EQU 7
BIT6 EQU 6
BIT5 EQU 5
BIT4 EQU 4
BIT3 EQU 3
BIT2 EQU 2
BIT1 EQU 1
BIT0 EQU 0
bit macro bit,reg
db 0cbh,bit*8+reg+40h
endm
bset macro bit,reg
db 0cbh,bit*8+reg+0c0h
endm
bres macro bit,reg
db 0cbh,bit*8+reg+80h
endm
bitx macro bit,disp
ckdisp disp
db 0ddh,0cbh,disp,bit*8+46h
endm
bsetx macro bit,disp
ckdisp disp
db 0ddh,0cbh,disp,bit*8+0c6h
endm
bresx macro bit,disp
ckdisp disp
db 0ddh,0cbh,disp,bit*8+86h
endm
@jr macro label,op
local disp
disp set label-$-2
ckdisp disp
db op,disp
endm
jr macro label
@jr label,18h
endm
jrc macro label
@jr label,38h
endm
jrnc macro label
@jr label,30h
endm
jrz macro label
@jr label,28h
endm
jrnz macro label
@jr label,20h
endm
djnz macro label
@jr label,10h
endm
rlcr macro reg
db 0cbh,00h+reg
endm
rlcx macro disp
ckdisp disp
db 0ddh,0cbh,disp,06h
endm
ralr macro reg
db 0cbh, 10h+reg
endm
ralx macro disp
ckdisp disp
db 0ddh,0cbh,disp,16h
endm
rrcr macro reg
db 0cbh,08h+reg
endm
rrcx macro disp
ckdisp disp
db 0ddh,0cbh,disp,0eh
endm
rarr macro reg
db 0cbh,18h+reg
endm
rarx macro disp
ckdisp disp
db 0ddh,0cbh,disp,1eh
endm
slar macro reg
db 0cbh,20h+reg
endm
slax macro disp
ckdisp disp
db 0ddh,0cbh,disp,26h
endm
srar macro reg
db 0cbh,28h+reg
endm
srax macro disp
ckdisp disp
db 0ddh,0cbh,disp,2eh
endm
srlr macro reg
db 0cbh,38h+reg
endm
srlx macro disp
ckdisp disp
db 0ddh,0cbh,disp,3eh
endm
rld macro
db 0edh,6fh
endm
rrd macro
db 0edh,67h
endm
@A equ 0ffffh
@H equ 0fffeh
@Hupdate equ 0fffdh
@D equ 0fffch
@Dupdate equ 0fffbh
@B equ 0fffah
@@UNREL macro anything
@unrel set anything
endm
@baka set false
@bakb set false
@bakd set false
@bakh set false
@opwr macro op,reg,msg,save?
if not nul op
@@unrel %op
if @unrel ne @®
if save?
@bak® set true
push reg
endif
lxi reg,op
endif
else
+++ operand required as MSG or '@®&'
endif
endm
@opwu macro op,reg,msg
if not nul op
@@unrel %op
if @unrel ne @®&update
@bak® set true
push reg
if @unrel ne @®
lxi reg,op
endif
endif
else
+++ operand required as MSG, '@®&', or '@®&update'
endif
endm
@opca macro op,msg,save?
if not nul op
if op ne @A
if save?
@baka set true
push psw
endif
mvi a,op
endif
else
+++ operand required as MSG or '@A'
endif
endm
@bakem macro list
irp r,<list>
if @bak&r
if r ne a
pop r
else
pop psw
endif
@bak&r set false
endif
endm
endm
PROLOG macro
local Start,SetRet
extrn @ZZPRG
extrn @RAMAA
lhld BdosAddress
mvi l,0
sphl
dcr h
lxi d,@ZZPRG
call @RAMAA
call Start
if CpmLevel gt 22h
lxi d,0
SetRet equ $
mvi c,108
call BdosJump
endif
jmp WarmStart
public @ERROR
@ERROR: nop
pop h
pop d
mov a,d! ora e
mvi c,9
cnz BdosJump
if CpmLevel gt 22h
lxi d,0fff0h
jmp SetRet
else
jmp WarmStart
endif
public @BDOS
@BDOS: push b
push d
db 0ddh
push h
db 0fdh
push h
call BdosJump
db 0fdh
pop h
db 0ddh
pop h
pop d
pop b
ret
Start equ $
endm
ENTERSUB MACRO
extrn @ERROR
extrn @BDOS
endm
ABORT macro ?cond,?msg
local do,dont
if not nul ?cond
j&?cond do
jr dont
do equ $
endif
if not nul ?msg
@@unrel %?msg
if @unrel eq @D
push d
else
push h
lxi h,?msg
xthl
endif
else
push h
lxi h,0
xthl
endif
call @ERROR
if not nul ?cond
dont equ $
endif
endm
SAVETAIL macro
extrn @CMSAV
call @CMSAV
endm
TAILTOKN macro ?number
@opca ?number,<token number>,true
extrn @CMTOK
call @CMTOK
@bakem <A>
endm
FILLBLOK macro ?adr,?len,?byte
@opwu ?adr,D,<block address>
@opwr ?len,B,length,true
@opca ?byte,<fill byte>,true
extrn @RAMFL
call @RAMFL
@bakem <A,B,D>
endm
COPYBLOK macro ?to,?frm,?len
@opwu ?to,D,target
@opwu ?frm,H,source
@opwr ?len,B,length,true
ldir
@bakem <B,H,D>
endm
TESTCON macro
push h
push psw
mvi c,11
call @BDOS
ora a
pop h
mov a,h
pop h
endm
DSLOW macro ?size
@opwr ?size,B,length,true
extrn @RAMLO
call @RAMLO
@bakem <B>
endm
DSHIGH macro ?size
@opwr ?size,B,length,true
extrn @RAMHI
call @RAMHI
@bakem <B>
endm
SPACE? macro ?size
@opwr ?size,B,length,true
extrn @RAMCK
call @RAMCK
endm
DSLOCK macro
extrn @RAMLK
call @RAMLK
endm
DSUNLOCK macro ?low,?high
@opwr ?low,D,<low boundary>,true
@opwr ?high,H,<high boundary>,true
extrn @RAMAA
call @RAMAA
@bakem <H,D>
endm
FILEDEF macro ?size,?drive,?name,?type,?pass
local here,size,there,drive
if not nul ?size
if ?size lt 128
+++ buffer size set to 128
size set 128
else
if ?size gt 07F80h
+++ buffer size is limited to 32,640
size set 32640
else
size set (?size+127) and 07F80h
endif
endif
else
size set 128
+++ buffer size assumed as 128
endif
here equ $
db 0
db ' '
db ' '
db 0,0,0,0
dw 0,0,0,0,0,0,0,0
db 0,0,0,0
db 0,0
dw size
dw 0,0,0
dw 128
ds 4
db ' '
ds 4
there equ $
if not nul ?drive
drive set '&?drive'
if (drive ge 'A') and (drive le 'P')
org here
db drive-'A'+1
else
+++ drive must be single letter between A and P
exitm
endif
endif
if not nul ?name
org here+1
db '&?name'
endif
if not nul ?type
org here+9
db '&?type'
endif
if not nul ?pass
org here+38h
db '&?pass'
endif
org there
endm
CONFILE macro
local here,there
here set $
filedef 128,,CON:
there set $
org here+24h
db 11000100b
org here+28h
dw there
org here+30h
db 1,2
org there
ds 128
endm
MSGFILE macro
local here,there
here set $
filedef 128,,CON:
there set $
org here+24h
db 01000100b
org here+30h
db 1,2
org there
endm
LSTFILE macro
local here,there
here set $
filedef 128,,LST:
there set $
org here+24h
db 01000010b
org here+30h
db 0,5
org there
endm
AUXFILE macro
local here,there
here set $
filedef 128,,AUX:
there set $
org here+24h
db 11000001b
org here+48
db 3,4
endm
FASSIGN macro ?file,?string,?default,?parts
@opwr ?file,D,file,true
@opwu ?string,H,string
if not nul ?default
@opwr ?default,B,<default file>,true
else
@opwr 0,B,,true
endif
if not nul ?parts
@opca ?parts,<bitmask>,false
else
mvi a,01111b
endif
extrn @FASGN
call @FASGN
@bakem <B,H,D>
endm
FGETSPEC macro ?file,?string,?parts
@opwr ?file,D,file,true
@opwu ?string,H,string
if not nul ?parts
@opca ?parts,bitmask,true
else
@opca 01111b,,true
endif
extrn @FSTSP
call @FSTSP
@bakem <A,H,D>
endm
FDIRBEGN macro ?file1,?file2
@opwr ?file1,D,<comparison file>,true
@opwr ?file2,H,<target file>,true
extrn @FDIR1
call @FDIR1
@bakem <H,D>
endm
FDIRCONT macro ?file1,?file2
@opwr ?file1,D,<comparison file>,true
@opwr ?file2,H,<target file>,true
extrn @FDIR2
call @FDIR2
@bakem <H,D>
endm
FGETATTR macro ?file
@opwr ?file,D,file,true
extrn @FGATT
call @FGATT
@bakem <D>
endm
FPUTATTR macro ?file,?bits
@opwr ?file,D,file,true
@opca ?bits,constant,true
extrn @FPATT
call @FPATT
@bakem <A,D>
endm
FRESET macro ?file
@opwr ?file,D,file,true
extrn @FOPNI
call @FOPNI
@bakem <D>
endm
@openo macro ?file,?fill,?call
@opwr ?file,D,file,true
if not nul ?fill
@opca ?fill,constant,true
else
@opca CpmEof,constant,true
endif
extrn ?call
call ?call
@bakem <A,D>
endm
FREWRITE macro ?file,?fill
@openo ?file,?fill,@FOPNO
endm
FAPPEND macro ?file,?fill
@openo ?file,?fill,@FOPNA
endm
FUPDATE macro ?file,?fill
@openo ?file,?fill,@FOPNU
endm
FRECLEN macro ?file,?rlen
@opwr ?file,D,file,true
@opwr ?rlen,H,<record length>,true
extrn @FRLEN
call @FRLEN
@bakem <H,D>
endm
FCLOSE macro ?file
@opwr ?file,D,file,true
extrn @FCLOS
call @FCLOS
@bakem <D>
endm
FSIZE macro ?file,?lw
@opwr ?file,D,file,true
@opwu ?lw,H,<longword address>,true
extrn @FSIZE
call @FSIZE
@bakem <H,D>
endm
FNOTE macro ?file,?lw
@opwr ?file,D,file,true
@opwu ?lw,H,<longword address>,true
extrn @FNOTE
call @FNOTE
@bakem <H,D>
endm
FSEEK macro ?file,?lw
@opwr ?file,D,file,true
@opwu ?lw,H,<longword address>,true
extrn @FSEEK
call @FSEEK
@bakem <H,D>
endm
FRECSEEK macro ?file,?rnum
@opwr ?file,D,file,true
@opwr ?rnum,H,<record number>,true
extrn @FRSEK
call @FRSEK
@bakem <H,D>
endm
FREWIND macro ?file
@opwr ?file,D,file,true
extrn @FCKPT
call @FCKPT
extrn @FRWND
call @FRWND
@bakem <D>
endm
FEOF? macro ?file
@opwr ?file,D,file,true
extrn @FQEOF
call @FQEOF
@bakem <H,D>
endm
@bitst macro ?file,?bit
@opwr ?file,D,file,true
push h
lxi h,36
dad d
mov a,m
ani ?bit
pop h
@bakem <D>
endm
FRDONLY? macro ?file
@bitst ?file,20h
endm
FDEVICE? macro ?file
@bitst ?file,40h
endm
FCHECKPT macro ?file
@opwr ?file,D,file,true
extrn @FCKPT
call @FCKPT
@bakem <D>
endm
FGETBYTE macro ?file
@opwr ?file,D,file,true
extrn @FSGBB
call @FSGBB
@bakem <D>
endm
FPUTBYTE macro ?file,?byte
@opwr ?file,D,file,true
@opca ?byte,constant,true
extrn @FSPBB
call @FSPBB
@bakem <A,D>
endm
FGETWORD macro ?file
@opwr ?file,D,file,true
extrn @FSG2B
call @FSG2B
@bakem <D>
endm
FPUTWORD macro ?file,?word
@opwr ?file,D,file,true
@opwr ?word,H,constant,true
extrn @FSP2B
call @FSP2B
@bakem <H,D>
endm
FGETLW macro ?file,?lw
@opwr ?file,D,file,true
@opwu ?lw,H,<longword address>,true
extrn @FSG4B
call @FSG4B
@bakem <H,D>
endm
FPUTLW macro ?file,?lw
@opwr ?file,D,file,true
@opwr ?lw,H,<longword address>,true
extrn @FSP4B
call @FSP4B
@bakem <H,D>
endm
FGETBLOK macro ?file,?adr,?len
@opwr ?file,D,file,true
@opwu ?adr,H,<target block>
@opwr ?len,B,blocksize,false
extrn @FSGBK
call @FSGBK
@bakem <H,D>
endm
FPUTBLOK macro ?file,?adr,?len
@opwr ?file,D,file,true
@opwu ?adr,H,<source block>
@opwr ?len,B,blocksize,true
extrn @FSPBK
call @FSPBK
@bakem <B,H,D>
endm
FGETCHAR macro ?file
@opwr ?file,D,file,true
extrn @FSGAC
call @FSGAC
@bakem <D>
endm
FPUTCHAR macro ?file,?byte
@opwr ?file,D,file,true
@opca ?byte,constant,true
extrn @FSPAC
call @FSPAC
@bakem <A,D>
endm
FGETSTR macro ?file,?str,?len
@opwr ?file,D,file,true
@opwu ?str,H,<target string>
@opwr ?len,B,<max length>,false
extrn @FSGST
call @FSGST
@bakem <H,D>
endm
FPUTSTR macro ?file,?str
@opwr ?file,D,file,true
@opwu ?str,H,<source string>
extrn @FSPST
call @FSPST
@bakem <H,D>
endm
FPUTLINE macro ?file,?str
@opwr ?file,D,file,true
@opwu ?str,H,<source string>
extrn @FSPST
call @FSPST
push psw
mvi a,13
extrn @FSPAC
call @FSPAC
pop psw
@bakem <H,D>
endm
FSKIP macro ?file
@opwr ?file,D,file,true
extrn @FSKIP
call @FSKIP
@bakem <D>
endm
FGETAXBW macro ?file
@opwr ?file,D,file,true
extrn @FSGXW
call @FSGXW
@bakem <D>
endm
FGETADBW macro ?file
@opwr ?file,D,file,true
extrn @FSGBW
call @FSGBW
@bakem <D>
endm
FGETADSW macro ?file
@opwr ?file,D,file,true
extrn @FSGSW
call @FSGSW
@bakem <D>
endm
FPUTBBAX macro ?file,?byte
@opwr ?file,D,file,true
@opca ?byte,constant,true
extrn @FSPBX
call @FSPBX
@bakem <A,D>
endm
FPUTBBAD macro ?file,?byte
@opwr ?file,D,file,true
@opca ?byte,constant,true
extrn @FSPBD
call @FSPBD
@bakem <A,D>
endm
FPUTBWAX macro ?file,?word
@opwr ?file,D,file,true
@opwr ?word,H,constant,true
extrn @FSPWX
call @FSPWX
@bakem <H,D>
endm
FPUTBWAD macro ?file,?word,?width
@opwr ?file,D,file,true
@opwr ?word,H,constant,true
@opca ?width,<field width>,true
extrn @FSPBW
call @FSPBW
@bakem <A,H,D>
endm
FPUTSWAD macro ?file,?word,?width
@opwr ?file,D,file,true
@opwr ?word,H,constant,true
@opca ?width,<field width>,true
extrn @FSPSW
call @FSPSW
@bakem <A,H,D>
endm
FPUTLWAX macro ?file,?lw
@opwr ?file,D,file,true
@opwu ?lw,H,<longword address>,true
extrn @FSPLX
call @FSPLX
@bakem <H,D>
endm
FPUTLWAD macro ?file,?lw,?width
@opwr ?file,D,file,true
@opwu ?lw,H,<longword address>,true
@opca ?width,<field width>,true
extrn @FSPLD
call @FSPLD
@bakem <A,H,D>
endm
STRSPACE macro ?len
db 0
ds ?len
endm
STRCONST macro ?literal,?len
local here
here set $
db ?literal
db 0
if not nul ?len
org here+?len
endif
endm
STRTABLE macro ?count
local tabend
tabend set $+(2*?count+1)
db ?count
@tabnxt set $
rept ?count
dw tabend
endm
db 0
endm
STRENTRY macro ?literal
local here
here set $
org @tabnxt
dw here
@tabnxt set $
org here
db ?literal
db 0
endm
STRNULL macro ?str
if not nul ?str
@@unrel %?str
if (@unrel eq @D) or (@unrel eq @Dupdate)
xchg
mvi m,0
xchg
else
push h
lxi h,?str
mvi m,0
pop h
endif
else
+++ string required as label or '@D'
endif
endm
STREND macro ?str
if not nul ?str
@@unrel %?str
if @unrel eq @Dupdate
extrn @STEND
call @STEND
else
+++ operand must be '@Dupdate'
endif
else
+++ operand required as '@Dupdate'
endif
endm
STRSKIP macro ?str
if not nul ?str
@@unrel %?str
if @unrel eq @Dupdate
extrn @STSKP
call @STSKP
else
+++ operand must be '@Dupdate'
endif
else
+++ operand required as '@Dupdate'
endif
endm
STRLEN macro ?str
@opwu ?str,D,address
extrn @STLEN
call @STLEN
@bakem <D>
endm
STRLOOK macro ?str,?tab
@opwu ?str,D,<string address>
@opwu ?tab,H,<table address>
extrn @STLOK
call @STLOK
@bakem <H,D>
endm
STRAPPND macro ?st1,?st2
@opwu ?st1,D,<target string>
@opwu ?st2,H,<source string>
extrn @STAPP
call @STAPP
@bakem <H,D>
endm
STRCOPY macro ?st1,?st2
@opwu ?st1,D,<target string>
@opwu ?st2,H,<source string>
xchg
mvi m,0
xchg
extrn @STAPP
call @STAPP
@bakem <H,D>
endm
STRTAKE macro ?st1,?st2,?len,?pad
@opwu ?st1,D,<target string>
if not nul ?st2
@opwu ?st2,H,
else
local nulbyte
nulbyte: nop
@opwu nulbyte,H,
endif
@opwr ?len,B,<output length>,true
if not nul ?pad
@opca ?pad,,true
else
@opca 020h,,true
endif
extrn @STAKE
call @STAKE
@bakem <A,B,H,D>
endm
STRAPTXT macro ?str,?txt
@opwu ?str,D,<target string>
@opwu ?txt,H,<source text>
extrn @STTXT
call @STTXT
@bakem <H,D>
endm
STRCMP macro ?st1,?st2
@opwu ?st1,D,<first string>
@opwu ?st2,H,<second string>
extrn @STCMP
call @STCMP
@bakem <H,D>
endm
STRPUT macro ?st1,?byte
@opwu ?st1,D,<target string>
@opca ?byte,constant,true
extrn @STPUT
call @STPUT
@bakem <A,D>
endm
STRAXBW macro ?str
@opwu ?str,D,<numeric string>
extrn @STGXW
call @STGXW
@bakem <D>
endm
STRADBW macro ?str
@opwu ?str,D,<numeric string>
extrn @STGBW
call @STGBW
@bakem <D>
endm
STRADSW macro ?str
@opwu ?str,D,<numeric string>
extrn @STGSW
call @STGSW
@bakem <D>
endm
STRBBAX macro ?str,?byte
@opwu ?str,D,<target string>
@opca ?byte,constant,true
extrn @STPBX
call @STPBX
@bakem <A,D>
endm
STRBWAX macro ?str,?wrd
@opwu ?str,D,<target string>
@opwr ?wrd,H,constant,true
extrn @STPWX
call @STPWX
@bakem <H,D>
endm
STRLWAX macro ?str,?lw
@opwu ?str,D,<target string>
@opwu ?lw,H,<longword address>,true
extrn @STPLX
call @STPLX
@bakem <H,D>
endm
STRBBAD macro ?str,?val
@opwu ?str,D,<target string>
@opca ?val,constant,true
extrn @STPBB
call @STPBB
@bakem <A,D>
endm
STRBWAD macro ?str,?wrd,?len
@opwu ?str,D,<target string>
@opwr ?wrd,H,constant,true
@opca ?len,fieldsize,true
extrn @STPBW
call @STPBW
@bakem <A,H,D>
endm
STRSWAD macro ?str,?wrd,?len
@opwu ?str,D,<target string>
@opwr ?wrd,H,constant,true
@opca ?len,fieldsize,true
extrn @STPSW
call @STPSW
@bakem <A,H,D>
endm
STRLWAD macro ?str,?lw,?len
@opwu ?str,D,<target string>
@opwu ?lw,H,<longword address>,true
@opca ?len,fieldsize,true
extrn @STPLW
call @STPLW
@bakem <A,H,D>
endm
@loada macro ?arg
if ?arg ne @A
if ?arg ne @D
if ?arg ne @H
+++ operand of '@A', '@D', or '@H' required
exitm
else
mov a,m
endif
else
ldax d
endif
endif
endm
toupper macro ?arg
@loada ?arg
extrn @TOUPR
call @TOUPR
endm
graphic? macro ?arg
@loada ?arg
extrn @CKGRP
call @CKGRP
endm
control? macro ?arg
@loada ?arg
extrn @CKCTL
call @CKCTL
endm
white? macro ?arg
@loada ?arg
extrn @CKWHT
call @CKWHT
endm
alnum? macro ?arg
@loada ?arg
extrn @CKALN
call @CKALN
endm
alpha? macro ?arg
@loada ?arg
extrn @CKALF
call @CKALF
endm
upper? macro ?arg
@loada ?arg
extrn @CKUPR
call @CKUPR
endm
lower? macro ?arg
@loada ?arg
extrn @CKLWR
call @CKLWR
endm
hdigit? macro ?arg
@loada ?arg
extrn @CKHEX
call @CKHEX
endm
digit? macro ?arg
@loada ?arg
extrn @CKDIG
call @CKDIG
endm
delim? macro ?arg
@loada ?arg
extrn @CKDLM
call @CKDLM
endm
fdelim? macro ?arg
@loada ?arg
extrn @CKFLM
call @CKFLM
endm
ADDHLA macro
extrn @ADDAH
call @ADDAH
endm
ADDHL2A macro
extrn @ADD2A
call @ADD2A
endm
MPY816 macro ?op1,?op2
@opwr ?op1,H,constant,false
@opca ?op2,constant,true
extrn @MPYBB
call @MPYBB
@bakem <A>
endm
DIV816 macro ?op1,?op2
@opwr ?op1,H,constant,false
@opca ?op2,constant,false
extrn @DIVBB
call @DIVBB
endm
CPLBW macro ?op1
@opwr ?op1,H,constant,false
extrn @CPLBW
call @CPLBW
endm
CMPBW macro ?op1,?op2
@opwr ?op1,H,constant,true
@opwr ?op2,D,constant,true
ora a
if not @bakh
push h
endif
dsbc d
if not @bakh
pop h
endif
@bakem <D,H>
endm
CMPSW macro ?op1,?op2
@opwr ?op1,H,constant,true
@opwr ?op2,D,constant,true
extrn @CMPSW
call @CMPSW
@bakem <D,H>
endm
@arith macro ?op1,?op2,?mod
@opwr ?op1,H,constant,false
@opwr ?op2,D,constant,false
extrn ?mod
call ?mod
endm
MPYBW macro ?op1,?op2
@arith ?op1,?op2,@MPYBW
endm
MPYSW macro ?op1,?op2
@arith ?op1,?op2,@MPYSW
endm
DIVBW macro ?op1,?op2
@arith ?op1,?op2,@DIVBW
endm
DIVSW macro ?op1,?op2
@arith ?op1,?op2,@DIVSW
endm
STORELW macro ?where
@opwr ?where,B,<target address>,true
extrn @STOLW
call @STOLW
@bakem <B>
endm
LOADLW macro ?where
@opwr ?where,B,<source address>,true
extrn @LODLW
call @LODLW
@bakem <B>
endm
SRLLW macro
srlr d
rarr e
rarr h
rarr l
endm
SLLLW macro
dad h
xchg
dadc h
xchg
endm
CPLLW macro
extrn @CPLLW
call @CPLLW
endm
DIVLWBW macro ?dvsr
@opwr ?dvsr,B,divisor,true
extrn @DIVLW
call @DIVLW
@bakem <B>
endm
ADDLWBW macro ?value
local skip
@opwr ?value,B,<added word>,true
dad b
jrnc skip
inx d
skip equ $
@bakem <B>
endm
SUBLWBW macro ?value
local skip
@opwr ?value,B,<subtracted word>,true
ora a
dsbc b
jrnc skip
dcx d
skip equ $
@bakem <B>
endm
ADDLW macro ?lw
@opwr ?lw,B,<storage longword>,true
extrn @ADDLW
call @ADDLW
@bakem <B>
endm
SUBLW macro ?lw
@opwr ?lw,B,<storage longword>,true
extrn @SUBLW
call @SUBLW
@bakem <B>
endm
CMPLW macro ?lw
@opwr ?lw,B,<storage longword>,true
extrn @CMPLW
call @CMPLW
@bakem <B>
endm
RANDBW macro
extrn @PRIBW
call @PRIBW
endm
RANDMOD macro ?mod
@opwr ?mod,D,<modulus value>,true
extrn @PRIMD
call @PRIMD
@bakem <D>
endm
RANDLW macro
extrn @PRILW
call @PRILW
endm
RANDSDLW macro
extrn @PRSDL
call @PRSDL
endm
RANDSDBW macro ?seed
@opwr ?seed,H,<seed value>,true
extrn @PRSDW
call @PRSDW
@bakem <H>
endm
call @PRSDL
endm
RANDSDBW macro ?seed
@opwr ?seed,H,<seed va