home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
PUBPATCH
/
PUBPTZ10.LBR
/
PUBLIC.AZM
/
PUBLIC.ASM
Wrap
Assembly Source File
|
2000-06-30
|
6KB
|
476 lines
;PUBLIC.ASM -- From Dr. Dobbs November, 1984.
;
;Utility to set/clear attribute bit 2 of filename.
;For use with PUBlic file BDOS patch.
;
;I have left out the comments to shorten the code file. To supplement
;this file refer to original article referenced above -- pp. 61 - 72.
;
;MAC or RMAC is required for assembly.
;
;USAGE: PUBLIC [d:] -- lists PUBlic files (on d:)
; PUBLIC [d:]file.ext -- makes file.ext PUBlic
; PUBLIC [d:]file.ext X -- makes file.ext private
;
; file.ext must be unambiguous - no wildcards
;
;prints drive/user number of all files of specified name,
;with attribute bits displayed as lower case
;
;
vers equ 1$0
;
maclib z80
;
false equ 0
true equ not false
;
listpubbit equ 0
makpubbit equ 1
fence equ '|'
;
null equ 0
bell equ 'G'-'@'
cr equ 0dh
lf equ 0ah
esc equ 1bh
space equ 20h
del equ 7eh
;
drivefn equ 14
openfn equ 15
closefn equ 16
srchfstfn equ 17
srchnxtfn equ 18
deletefn equ 19
readfn equ 20
writefn equ 21
makefn equ 22
renamefn equ 23
logvecfn equ 24
curdskfn equ 25
dmafn equ 26
setattrfn equ 30
getaddrfn equ 31
userfn equ 32
readrfn equ 33
writerfn equ 34
sizefn equ 35
;
reccnt equ 15
currec equ 32
r0 equ 33
tbuff equ 80h
fcb equ 5ch
fcb2 equ fcb+16
;
boot equ 0000h
bdos equ 0005h
address equ 0ffffh
bdoslen equ 0e00h
;
;
dobdos macro num,arg
if not nul arg
lxi d,arg
endif
mvi c,num
call 5
endm
;
print macro msg
if not nul msg
lxi d,msg
endif
call printde
endm
;
$-macro
;
aseg
org 0100h
;
top: jmp start
banner: db cr,lf,'PUBLIC vers '
db vers/10+'0','.',(vers mod 10)+'0'
db ' (c) 1984 Plu*Perfect Systems$'
;
usage: db cr,lf,lf,'Usage: '
db 'PUBLIC [d:] -- list PUBlic files (on d:)'
db cr,lf,' '
db 'PUBLIC [d:]file.ext -- make file PUBlic'
db cr,lf,' '
db 'PUBLIC [d:]file.ext X -- make file private'
db cr,lf,lf,'$'
;
header: db cr,lf,lf,'The currently PUBlic files are:',cr,lf,'$'
tomsg: db ' set to ==> $'
pubnam: db 'PUBLIC $'
privnam:
db 'PRIVATE $'
ismsg: db ' ==> is already $'
;
multimsg:
db cr,lf,bell,'*** Multiple copies, can''t change!$'
nonemsg:
db cr,lf,bell,'*** No file!$'
cantmsg:
db cr,lf,bell,'*** Can''t make file $'
nopubs: db cr,lf,'(None.)$'
;
;
start:
sspd ustack
lxi sp,stack
print banner
lxi h,fcb+1
mov a,m
cpi space
lxi h,flags
res listpubbit,m
jrnz setup
setb listpubbit,m
print header
;
setup: dobdos dmafn,buf
dobdos curdskfn
sta drive
sta udrive
lda fcb
ora a
jrz savusr
dcr a
sta drive
mov e,a
dobdos drivefn,
;
savusr: dobdos userfn,0ffh
sta uuser
dobdos getaddrfn
inx h
inx h
inx h
inx h
mov a,m
sta extmask
xra a
sta count
lda fcb2+1
cpi 'X'
lxi h,flags
res makpubbit,m
jrz find
setb makpubbit,m
;
find: lxi h,fcb
mvi m,'?'
xchg
dobdos srchfstfn,
sta indx
inr a
jrz done
;
findall:
call chknxt
jrnz findnxt
call savefcb
call setcol
call printentry
lxi h,count
inr m
findnxt:
dobdos srchnxtfn,fcb
sta indx
inr a
jrnz findall
;
nomore: lxi h,flags
bit listpubbit,m
lda count
jrz nom0
ora a
jrnz done
print nopubs
jr done
;
nom0: sui 1
jrc none
jrnz nochanges
lxi h,flags
bit makpubbit,m
jrz nom1
call setpub
jr done
nom1: call setpriv
jr done
;
nochanges:
print multimsg
jr done
;
none: print nonemsg
jr done
;
nopub: lxi d,pubnam
call cant
;
done: lxi h,flags
bit listpubbit,m
jrz done0
print usage
done0: lda udrive
mov e,a
dobdos drivefn,
done1: lda uuser
mov e,a
dobdos userfn,
call crlf
xit: lspd ustack
ret
;
setpub: lxi h,pubfcb+2
bit 7,m
jrnz ispub
setb 7,m
lda pubfcb
mov e,a
dobdos userfn,
lxi h,pubfcb
mvi m,0
xchg
dobdos setattrfn,
inr a
jrz nopub
print tomsg
print pubnam
setpend:
lxi h,pubfcb
jmp printent1
;
ispub: lxi d,pubnam
jmp istype
;
setpriv:
lda pubfcb
mov e,a
dobdos userfn,
lxi h,pubfcb+2
bit 7,m
jrz ispriv
res 7,m
lxi h,pubfcb
mvi m,0
xchg
dobdos setattrfn
inr a
jrz nopriv
print tomsg
print privnam
jr setpend
;
nopriv: lxi d,privnam
jmp cant
;
ispriv: lxi d,privnam
;
istype: push d
print ismsg
pop d
;
printde:
mvi c,9
jmp 5
;
cant: push d
print cantmsg
pop d
jr printde
;
chknxt: call findentry
mov a,m
cpi 0e5h
jrnz chkn0
ora a
ret
chkn0: inx h
lda flags
bit listpubbit,a
jrz chkn1
;
inx h
mov a,m
cma
ani 80h
rnz
lxi d,12-2
dad d
xra a
jr chkn3
;
chkn1: lxi d,fcb+1
mvi b,11
chkn2: ldax d
sub m
ani 7fh
inx h
inx d
rnz
djnz chkn2
ldax d
chkn3: mov c,m
;
samext:
push b
push psw
extmask equ $+1
mvi a,00h
cma
mov b,a
mov a,c
ana b
mov c,a
pop psw
ana b
sub c
ani 1fh
pop b
ret
;
savefcb:
call findentry
mov a,m
sta fileuserno
lxi d,pubfcb
lxi b,32
ldir
ret
;
findentry:
lda indx
add a
add a
add a
add a
add a
lxi h,buf
add l
mov l,a
rnc
inr h
ret
;
setcol: lda count
ani 03h
jz crlf
call twosp
mvi c,fence
call charout
twosp: mvi c,space
call charout
mvi c,space
jmp charout
printentry:
call findentry
printent1:
push h
call printdrv
fileuserno equ $+1
mvi a,00h
call printuser
pop h
;
print$fn:
inx h
mvi b,8
call prfn
mvi c,'.'
call charout
mvi b,3
;
prfn: mov a,m
ani 7fh
cmp m
jrz prfn1
ori 20h
prfn1: mov c,a
call charout
inx h
djnz prfn
ret
;
printdrv:
lda drive
adi 'A'
mov c,a
jr charout
;
crlf: mvi c,cr
call charout
mvi c,lf
;
charout:
push h
push b
push d
mov e,c
mvi c,2
call 5
pop d
pop b
pop h
ret
;
printuser:
cpi 10
jrnc printu1
push psw
mvi c,' '
call charout
pop psw
printu1:
mov l,a
mvi h,0
call printdec
mvi c,':'
jr charout
;
printdec:
decout: push psw
push b
push d
push h
lxi b,-10
lxi d,-1
decou2: dad b
inx d
jc decou2
lxi b,10
dad b
xchg
mov a,h
ora l
cnz decout
mov a,e
adi '0'
mov c,a
call charout
pop h
pop d
pop b
pop psw
ret
;
flags: db 0
indx: db 0
drive: db 0
count: db 0
udrive: db 0
uuser: db 0
ustack: dw 0
pubfcb equ $
stack equ pubfcb+32+48
;
buf equ stack
;
end