home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
utils
/
asmutl
/
buffers.lbr
/
PFNM.MZC
/
PFNM.MAC
Wrap
Text File
|
1987-01-14
|
2KB
|
80 lines
extrn .skipblks, .nextch, .lastch
;
; Parse the next field from the command line (de^) into fcb hl^.
; Drive id is set, name and type are parsed into fname and ftype,
; with any '*'s expanded into '?'s, and the fields are blank padded.
; At exit de points to the field terminating delimiter char, (a) is
; the count of '?' chars in fname & ftype fields, with flags set on
; it. Thus the Z flag on exit indicates no wild cards. (c) contains
; the drive specifier (if any), (b) holds 0 (default user).
; a,f,b,c,d,e,h,l
.pfnm:: call .skipblks
lxi b,0ff00h; default user and drive
inx d
ldax d
dcx d
cpi ':'
jnz .pfnm1; no drive spec
call .nextch
sui '@'; totally undiscriminating
mov c,a
mov m,a
; " "
; Entry here from .pfnmdu ONLY
.pfnm1::
push b
mvi b,8
push h
call ldfld; fill the name field
call .lastch
cpi '.'
cz .nextch; Absorb any name terminating '.'
mvi b,3; (else terminator blank fills)
call ldfld; fill the type field
mvi b,3
parse1: inx h
mvi m,0
dcr b
jnz parse1; zero ex, s2, s1 fields
lxi b,11 shl 8; b := 11, c := 0
pop h
mvi a,'?'
parse2: inx h
cmp m
jnz parse3
inr c
parse3: dcr b
jnz parse2; count the '?'s in fname/ftype
mov a,c
pop b
inr b; map default user to 0
ora a; z flag for no wild cards
ret
;
; load up to (b) chars from (de)^ up to (hl+1)^ up.
; skip to delimiter. Implement any wild cards on "*"
; blank fill if less than (b) chars available.
; Upshift any lower case characters.
; a,f,b,d,e,h,l
ldfld: call .lastch; on (de)^ and load it
jz ldfld4; delimiter
inx h
cpi '*'
jnz ldfld1
mvi m,'?'; expand '*'
jmp ldfld2; dont skip past it
ldfld1: mov m,a
call .nextch
ldfld2: dcr b
jnz ldfld
call .lastch; on (de)^ and load it
rz; a delimiter
ldfld3: call .nextch; else skip to a delimiter
rz
jmp ldfld3
ldfld4: inx h
mvi m,' '; blank fill
dcr b
jnz ldfld4
ret
Θt