mirror of
https://github.com/wwarthen/RomWBW.git
synced 2026-02-06 22:43:15 -06:00
249 lines
4.6 KiB
Plaintext
249 lines
4.6 KiB
Plaintext
;
|
||
; Program: PWD
|
||
; Author: Richard Conn
|
||
; Version: 1.0
|
||
; Date: 5 Mar 84
|
||
;
|
||
version equ 10
|
||
|
||
;
|
||
; 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.
|
||
;
|
||
|
||
;
|
||
; Basic Equates
|
||
;
|
||
z3env SET 0f400h ;address of ZCPR3 Environment
|
||
fcb equ 5ch
|
||
cr equ 0dh
|
||
lf equ 0ah
|
||
|
||
;
|
||
; External References
|
||
;
|
||
ext z3init
|
||
ext cout,crlf,print,padc
|
||
ext qprint,qcrlf
|
||
ext getndr,getwhl
|
||
|
||
;
|
||
; Environment Definition
|
||
;
|
||
if z3env ne 0
|
||
;
|
||
; External ZCPR3 Environment Descriptor
|
||
;
|
||
jmp start
|
||
db 'Z3ENV' ;This is a ZCPR3 Utility
|
||
db 1 ;External Environment Descriptor
|
||
z3eadr:
|
||
dw z3env
|
||
start:
|
||
lhld z3eadr ;pt to ZCPR3 environment
|
||
;
|
||
else
|
||
;
|
||
; Internal ZCPR3 Environment Descriptor
|
||
;
|
||
MACLIB Z3BASE.LIB
|
||
MACLIB SYSENV.LIB
|
||
z3eadr:
|
||
jmp start
|
||
SYSENV
|
||
start:
|
||
lxi h,z3eadr ;pt to ZCPR3 environment
|
||
endif
|
||
|
||
;
|
||
; 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 cr,lf,0
|
||
;
|
||
; Check for options
|
||
;
|
||
lxi h,fcb+1 ;pt to option char
|
||
mov a,m ;get option char
|
||
cpi '/' ;help?
|
||
jz prhelp
|
||
cpi ' ' ;no option?
|
||
jz namedir
|
||
cpi 'P' ;passwords?
|
||
jnz invopt ;bad option if not
|
||
;
|
||
; Prepare to process passwords - check for authorization
|
||
;
|
||
call getwhl ;get wheel byte
|
||
jnz namedir ;permission granted
|
||
call print
|
||
db ' Password Request Denied - Not Wheel',cr,lf,0
|
||
mvi m,' ' ;clear option
|
||
;
|
||
; Print Named Directory Info
|
||
;
|
||
namedir:
|
||
call getndr ;get location of directory
|
||
jnz ndir1
|
||
call print
|
||
db ' Named Directory Buffer Not Available',0
|
||
ret
|
||
;
|
||
; Print Names of Directory Elements
|
||
;
|
||
ndir1:
|
||
lda fcb+1 ;see if passwords included
|
||
cpi 'P'
|
||
jz ndir1p
|
||
;
|
||
; Print Header if Not Quiet for Non-Password Entries
|
||
;
|
||
mvi b,4 ;4 times
|
||
ndir1a:
|
||
call qprint ;print banner (optional)
|
||
db ' DU : DIR Name ',0
|
||
dcr b ;count down
|
||
jnz ndir1a
|
||
call qcrlf ;new line
|
||
mvi b,4 ;4 more times
|
||
ndir1b:
|
||
call qprint
|
||
db '---- -------- ',0
|
||
dcr b ;count down
|
||
jnz ndir1b
|
||
call qcrlf ;new line
|
||
jmp ndir1z
|
||
;
|
||
; Print Header if Not Quiet for Password Entries
|
||
;
|
||
ndir1p:
|
||
mvi b,2 ;2 times
|
||
ndir1c:
|
||
call qprint
|
||
db ' DU : DIR Name - Password ',0
|
||
dcr b ;count down
|
||
jnz ndir1c
|
||
call qcrlf
|
||
mvi b,2
|
||
ndir1d:
|
||
call qprint
|
||
db '---- -------- -------- ',0
|
||
dcr b ;count down
|
||
jnz ndir1d
|
||
call qcrlf
|
||
;
|
||
; Begin Output Processing
|
||
;
|
||
ndir1z:
|
||
mvi c,0 ;set entry count
|
||
mvi b,1 ;set disk 1
|
||
;
|
||
; Print Each Resident Command Name
|
||
;
|
||
ndir2:
|
||
mov a,m ;get table entry
|
||
ora a ;end of table?
|
||
rz ;exit
|
||
cmp b ;same disk?
|
||
jz ndir3
|
||
;
|
||
; Advance to Next Set of Entries for New Disk
|
||
;
|
||
mov b,a ;set new disk
|
||
mov a,c ;get count
|
||
ani 3 ;see if newline already given
|
||
cnz crlf ;complete current line
|
||
call crlf ;1 additional line
|
||
mvi c,0 ;reset count
|
||
ndir3:
|
||
push b ;save counters
|
||
;
|
||
; Print DU:
|
||
;
|
||
mov a,m ;get disk
|
||
adi '@' ;convert to letter (A to P)
|
||
call cout
|
||
inx h ;pt to user
|
||
mov a,m ;get user
|
||
call padc ;print user number
|
||
call print ;print separator
|
||
db ': ',0
|
||
inx h ;pt to name
|
||
;
|
||
; Print DIR
|
||
;
|
||
call prname ;print name of directory
|
||
lda fcb+1 ;check for password option
|
||
cpi 'P'
|
||
jnz ndir4
|
||
call print
|
||
db ' - ',0
|
||
call prname ;print name of password
|
||
pop b ;get counters
|
||
inr c ;another entry
|
||
push b ;save counters
|
||
jmp ndir5
|
||
;
|
||
; Advance to Next and Print Separator
|
||
;
|
||
ndir4:
|
||
lxi b,8 ;skip over password
|
||
dad b
|
||
;
|
||
; Print Separator
|
||
;
|
||
ndir5:
|
||
call print ;print separator
|
||
db ' ',0
|
||
pop b ;get counters
|
||
;
|
||
; New Line Counter
|
||
;
|
||
inr c ;increment entry counter
|
||
mov a,c ;check for done
|
||
ani 3 ;every 4
|
||
cz crlf ;new line
|
||
jmp ndir2
|
||
;
|
||
; Print 8-char name (directory or password) and advance ptr
|
||
;
|
||
prname:
|
||
mvi b,8 ;print name
|
||
prn1:
|
||
mov a,m ;get char
|
||
call cout
|
||
inx h ;pt to next
|
||
dcr b ;count down
|
||
jnz prn1
|
||
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,' PWD or PWD P'
|
||
db cr,lf
|
||
db cr,lf,'where just "PWD" prints the names of the directories'
|
||
db cr,lf,'and "PWD P" (for PWD PASSWORD) prints the names and'
|
||
db cr,lf,'passwords of the directories if the user has Wheel'
|
||
db cr,lf,'Powers',0
|
||
ret
|
||
|
||
end
|
||
|