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
/
ZCPR33
/
A-R
/
PWD14.LBR
/
PWD14.ZZ0
/
PWD14.Z80
Wrap
Windows Setup INFormation
|
2000-06-30
|
12KB
|
477 lines
;
; Program: PWD
; Author: Richard Conn
; Version: 1.0
; Date: 5 Mar 84
;
version equ 14
;
; The purpose of PWD is to display the names of the named directories.
; If the option PASS (P) is given, then the passwords to the directories will
; be displayed as well IF the Wheel Byte is Available and Set. If the Wheel
; Byte is not available, the passwords will be displayed without question.
;
; April 3, 1988 (v1.4)
; Type 3 format with safety header, smart help screen, made both RAS-oriented
; options patchable at 102H. For a "normal" PWD command, 102H=00H, for BYE
; detection and obedience, 102H=80H, for hiding passworded directories from
; non-wheels, 102H=01H, for both RAS options, 102H=81H.
; Bruce Morgen
; 11/21/86 (v1.3)
; Translated source to permit assembly with ZAS. No other changes.
; - D.McCord
;
; 06/03/85
; Consolidated Jay's and Dave's separate PWD11s into a `universal' PWD for
; remote use. Both mods work very well, Jay's - controlled by the `hidepw'
; equate - allows the sysop or privileged user see all passworded named
; directories and their passwords but keeps non-wheels in the dark, while
; Dave's - controlled by the `chkbye' equate - follows what BYE dictates and
; provides a more `absolute' kind of protection since no directory beyond
; what BYE allows shows up regardless of the state of the wheel byte. The
; routines seem to co-exist with no conflict and may be chosen separately or
; together. No new code has been added for PWD12. Bruce Morgen
;
; 02/13/85 Jay Sage
; Modified to suppress display of directories that are passworded when the
; user is not a wheel. changes marked with <JPS>.
; This is the second PWD11. - b/m
;
; 10-30-84
; Version 1.1 originated by D. McCord. Added findbye routine and other code
; so that when used in rcp/m application, users will only be shown directories
; that they have access to under BYE.
; This is the debugged (by the author) version of the first PWD11. - b/m
;
; Basic Equates
;
z3env defl 0fe00h ; Address of ZCPR3 Environment
fcb equ 5ch
cr equ 0dh
lf equ 0ah
;
; Conditional equates for remote use, setting both of these to 0 results in
; a `vanilla' PWD.COM - it will be essentially version 1.0. - b/m
;
byechk equ 80h ; 80H = suppress display of all directories where
; Login is disallowed by an active BYE, 0 = display
; all named directories unless suppressed by the
; next equate (DM)
hidepw equ 01h ; 01H = suppress display of passworded directories
; If not a wheel, 0 = do not suppress display of
; passworded directories, but don't display passwords
; (`P' option) unless wheel byte is set <JPS>
;
; External References
;
extrn z3init
extrn cout,crlf,print,padc
extrn qprint,qcrlf
extrn getndr,getwhl,getefcb
;
; Environment Definition
;
; TYPE 3 HEADER
; Code modified as suggested by Charles Irvine to function correctly with
; interrupts enabled. Program will abort with an error message when not
; loaded to the correct address (attempt to run it under CP/M or Z30).
entry:
jr start0 ; Must use relative jump
option: db byechk+hidepw ; Option byte
db 'Z3ENV',3 ; Type-3 environment
z3eadr:
dw z3env ; Filled in by Z33
dw entry ; Intended load address
start0:
ld hl,0 ; Point to warmboot entry
ld a,(hl) ; Save the byte there
di ; Protect against interrupts
ld (hl),0c9h ; Replace warmboot with a return opcode
rst 0 ; Call address 0, pushing RETADDR
; Onto stack
retaddr:
ld (hl),a ; Restore byte at 0
dec sp ; Get stack pointer to point
dec sp ; To the value of RETADDR
pop hl ; Get it into HL and restore stack
ei ; We can allow interrupts again
ld de,retaddr ; This is where we should be
xor a ; Clear carry flag
push hl ; Save address again
sbc hl,de ; Subtract -- we should have 0 now
pop hl ; Restore value of RETADDR
jr z,start ; If addresses matched, begin real code
ld de,notz33msg-retaddr ; Offset to message
add hl,de
ex de,hl ; Switch pointer to message into DE
ld c,9
jp 0005h ; Return via BDOS print string function
notz33msg:
db 'Not Z33+$' ; Abort message if not Z33-compatible
start:
ld hl,(z3eadr) ; Pt to ZCPR3 environment
;
; Start of Program -- Initialize ZCPR3 Environment
;
call z3init ; Initialize the ZCPR3 Env and the VLIB Env
;
; Print Banner
;
call qprint ; Check quiet flag
db 'PWD, Version '
db [version/10]+'0','.',[version mod 10]+'0'
db 0
ld a,(option)
or a
jr z,optchk
bit 0,a
jr z,znodeb
call getwhl
jr z,znode
jr optchk
znodeb: bit 7,a
jr z,optchk
call findbye
or a
jr z,optchk
znode: call qprint
db ' for Z-Node System' ; <JPS>
db 0
;
; Check for options
;
optchk: call qcrlf
ld hl,fcb+1 ; Pt to option char
ld a,(hl) ; Get option char
cp '/' ; Help?
jp z,prhelp
cp ' ' ; No option?
jr z,namedir
cp 'P' ; Passwords?
jp nz,invopt ; Bad option if not
;
; Prepare to process passwords - check for authorization
;
call getwhl ; Get wheel byte
jr nz,namedir ; Permission granted
call print
db ' Password Request Denied - Not Wheel',cr,lf,0
ld (hl),' ' ; Clear option
;
; Print Named Directory Info
;
namedir:
call getndr ; Get location of directory
jr nz,ndir1
call print
db ' Named Directory Buffer Not Available',0
ret
;
; Print Names of Directory Elements
;
ndir1:
ld a,(fcb+1) ; See if passwords included
cp 'P'
jr z,ndir1p
;
; Print Header if Not Quiet for Non-Password Entries
;
ld b,4 ; 4 times
ndir1a:
call qprint ; Print banner (optional)
db ' DU : DIR Name ',0
djnz ndir1a ; Count down
call qcrlf ; New line
ld b,4 ; 4 more times
ndir1b:
call qprint
db '---- -------- ',0
djnz ndir1b ; Count down
call qcrlf ; New line
jr ndir1z
;
; Print Header if Not Quiet for Password Entries
;
ndir1p:
ld b,2 ; 2 times
ndir1c:
call qprint
db ' DU : DIR Name - Password ',0
djnz ndir1c ; Count down
call qcrlf
ld b,2
ndir1d:
call qprint
db '---- -------- -------- ',0
djnz ndir1d ; Count down
call qcrlf
;
; Begin Output Processing
;
ndir1z:
ld a,(option)
call nz,findbye
ld c,0 ; Set entry count
ld b,1 ; Set disk 1
;
; Print Each Resident Command Name
;
;
ndir2:
ld a,(option)
bit 0,a
jr z,ndir2a
;<JPS> block added
ex de,hl ; Address of NDR in DE
ld hl,10 ; Offset to password
add hl,de ; Hl points to password
ex de,hl ; Hl as before, de=password
;<JPS> end of block
;
ndir2a:
ld a,(hl) ; Get table entry
or a ; End of table?
ret z ; Exit
cp b ; Same disk?
jr z,ndir3
;
; Advance to Next Set of Entries for New Disk
;
ld b,a ; Set new disk
ld a,c ; Get count
and 3 ; See if newline already given
call nz,crlf ; Complete current line
call crlf ; 1 additional line
ld c,0 ; Reset count
ndir3:
push bc ; Save counters
;<JPS> block added
ld a,(option)
bit 0,a
jr z,ndir3a
call getwhl
jr nz,ndir3a ; Skip all this if a wheel
ld a,(de) ; Check for presence of password
cp ' '
jr z,ndir3a ; If not, go on as before
ld bc,18 ; Skip this directory entry
add hl,bc
pop bc ; Restore counter and drive value
jr ndir2 ; Back for another try
ndir3a:
;<JPS> end of block
;
;
; Print DU:
;
ld b,(hl) ; Get disk
;
; Here are the major Ver 1.1 changes (DM)
;
ld a,(option)
bit 7,a
jr z,bygone
ld a,(byeflag) ; Check if bye was found
or a ; Test for zero
jr z,bygone ; BYE not active if zero
ld a,(maxdrive) ; Get BYE max drive
cp b ; Compare them
ld a,b ; Restore sysndr drive back to A
jr nc,drvok ; If a is greater than or equal to b in cmp, then we
; Are OK
notok: ld bc,18 ; Prepare to skip rest of entry
add hl,bc ; Make hl point to next entry
pop bc ; Make sure stack is right
jr ndir2 ; Go back and get next entry
drvok: inc hl ; Let's look at user from sysndr
ld b,(hl) ; Put it in b
dec hl ; Restore hl
ld a,(maxuser) ; Get BYE maxuser
cp b ; Compare BYE maxuser and sysndr user
ld a,(hl) ; Put drive from sysndr back in A if we pass
jr nc,usrok ; If a was equal to or greater than b in cmp, we pass
jr notok ; We failed
bygone: ld a,b
usrok:
;
add '@' ; Convert to letter (A to P)
call cout
inc hl ; Pt to user
ld a,(hl) ; Get user
call padc ; Print user number
call print ; Print separator
db ': ',0
inc hl ; Pt to name
;
; Print DIR
;
call prname ; Print name of directory
ld a,(fcb+1) ; Check for password option
cp 'P'
jr nz,ndir4
call print
db ' - ',0
call prname ; Print name of password
pop bc ; Get counters
inc c ; Another entry
push bc ; Save counters
jr ndir5
;
; Advance to Next and Print Separator
;
ndir4:
ld bc,8 ; Skip over password
add hl,bc
;
; Print Separator
;
ndir5:
call print ; Print separator
db ' ',0
pop bc ; Get counters
;
; New Line Counter
;
inc c ; Increment entry counter
ld a,c ; Check for done
and 3 ; Every 4
call z,crlf ; New line
jp ndir2
;
; Print 8-char name (directory or password) and advance ptr
;
prname:
ld b,8 ; Print name
prn1:
ld a,(hl) ; Get char
call cout
inc hl ; Pt to next
djnz prn1 ; Count down
ret
;
; Print Invalid Option and then Help Messages
;
invopt:
call print
db cr,lf,'Invalid Option',cr,lf,0 ; Fall thru to PRHELP
;
; Print Help Message
;
prhelp:
call print
db cr,lf,'PWD - Print Working Directories',cr,lf
db cr,lf,'PWD Syntax:'
db cr,lf,' ',0
call comnam
call getwhl
jr z,nwhl1
call print
db ' or ',0
call comnam
call print
db ' P',0
nwhl1: call print
db cr,lf
db cr,lf,'"',0
call comnam
call print
db '" prints the names of the directories',0
call getwhl
ret z
call print
db cr,lf,'and'
db ' "',0
call comnam
call print
db ' P[ASSWORD]" prints the names and'
db cr,lf,'passwords of the directories'
db cr,lf,'(if the user has Wheel Powers)',0
ret
comnam: call getefcb
jr z,noefcb
ld b,8
cmnmlp: inc hl
ld a,(hl)
and 7fh
cp ' '
call nz,cout
djnz cmnmlp
ret
noefcb: call print
db 'PWD',0
ret
;
; Added FINDBYE routine for use in RCP/M mode. This routine determines
; whether BYE is active or not, if it is, then extracts MAXUSR and MAXDRV
; from the BYE parameter block. (DM)
;
;
findbye:
push de
push hl
ld hl,(1) ; Get BYE or maybe warmboot vector
dec hl ; If BYE active,
ld d,(hl) ; Pick up pointer to BYE parameters
dec hl
ld e,(hl)
ld hl,17 ; Skip over possible parameter block to check
; For string "BYE" or "Bye"
; (the value of 17 may vary in different versions
; Of BYE. 17 is valid for BYE3-26)
add hl,de
ld a,(hl) ; Get letter
cp 'B'
jr nz,nobye ; BYE not active
inc hl
ld a,(hl) ; Get second letter
and 5fh ; Force upper case
cp 'Y'
jr nz,nobye
inc hl
ld a,(hl) ; Get third letter
and 5fh ; Force upper case
cp 'E'
jr nz,nobye
;
; If we get here, BYE is active, and the beginning address is in DE
;
ld hl,6 ; Offset from beginning of BYE to MXUSR
add hl,de
ld a,(hl) ; Get it into A
ld (maxuser),a ; Save it
inc hl ; Point to MXDRV
ld a,(hl) ; Get it
ld (maxdrive),a ; Save it
ld a,0ffh ;
ld (byeflag),a ; Indicate we found BYE
jr endfind
;
nobye: xor a ; Zero a
ld (byeflag),a
endfind:
pop hl
pop de
ret
dseg
byeflag: ds 1 ; Bye not active
maxdrive: ds 1 ; This gets changed anyway if BYE is active
maxuser: ds 1 ; And so does this
end