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
/
DIRATR12.LBR
/
DIRATR12.MZC
/
DIRATR12.MAC
Wrap
Text File
|
2000-06-30
|
7KB
|
424 lines
;Program: DIRATR.COM
;Purpose: Directory display showing file Attributes a la NSWEEP
;Author: Rob Friefeld
;Date: 25 Nov 1987
;Comment: Runs under Z33 at 8000h
; Attributes shown in standout video
;
;History: v1.2 - 17 Apr 1988 - Al Heynneman
; added support for dim terminals
; added calls to clear the screen
; print header at top of each new screen
;
; v1.1 - 27 Mar 1988 - Al Heynneman
; cleaned up code for m80 (wouldn't assemble with ZAS)
; changed 'add b' to 'add a,b'
; added 'jp start' that was missing for non-ZCPR33 mode
; setup for ZCPR30 mode
;
vers equ 12
true equ -1
false equ 0
zcpr33 equ false ; If true, use type 3 header
;
; Set to true if you wish to have the set attributes displayed in normal
; video, and the rest in dim video, on a normal/dim type terminal.
;
dim equ true
; If you have a Wyse, a line is drawn in graphics mode
; Also, the alternate video sequence is hard-coded. Take a look even if you
; aren't using a Wyse.
wyse equ false
if zcpr33
progloc equ 8000h
else
progloc equ 100h
endif
stkloc equ progloc+1500h
; SLR linker commands
; .request vlib,z3lib,syslib
ext z3vinit
if not wyse
ext stndout,stndend
endif
ext cls
ext dundr
ext condin,crlf,cout,phldc,phlfdc,pafdc
ext dfree,fsize,dparams,dirqs
ext logud,retud,codend
bdos equ 5
fcb equ 5ch
fcb2 equ 6ch
; ASCII
bell equ 7
tab equ 9
lf equ 0ah
cr equ 0dh
esc equ 1bh
if not zcpr33
jp start
db 'Z3ENV'
db 1
else
jp start
db 'Z3ENV'
db 3
endif
z3eadr:
dw 0fe00h
dw progloc
start:
ld (stksav),sp
ld sp,stkloc
ld hl,(z3eadr)
call z3vinit ; set up vid pointers
call retud ; get and save current du
ld (udsav),bc
ld hl,0 ; init running kbyte counter
ld (total),hl
ld hl,fcb+1
ld a,(hl)
cp '/' ; help
jp z,info
cp ' ' ; blank file name?
jr nz,ud0
fcblod:
ld b,11 ; Load ambig file ref
fcbl1: ld (hl),'?'
inc hl
djnz fcbl1
ud0: ld a,(fcb) ; new disk?
or a
jr z,load ; yes, log new disk
newud: ld b,a ; log a new du
dec b
ld a,(fcb+13)
ld c,a
call logud
load:
call codend ; locate name buffer
call dparams ; get disk params
ld a,11000000b
ld de,fcb
sel1: call dirqs ; directory sort
sel3: ld (fcount),bc ; save file count
ld (filcnt),bc ; and running counter
ld a,b ; check file count
or c
jp z,footer ; no files
; Figure out format of display
; Four columns, alphabetized vertically
xor a
srl b ; bc / 2
rr c
jr nc,dir2 ; if not even, a is flag
dec a
dir2: srl b ; again
rr c
jr nc,dir3
dec a
dir3: or a ; was there a carry?
jr z,dir4 ; no
inc bc ; yes, inc row count
dir4: ld (rdisp),bc ; save row displacement (file # at each column)
ld a,4 ; row count x 16 (16 byte filename entry)
dir5: sla c
rl b
dec a
jr nz,dir5
ld (edisp),bc ; save entry displacement
ld bc,1 ; initialize row number
ld (rownum),bc
call cls
call print
db 'DIRATR '
db vers/10+'0','.',vers mod 10 +'0'
db 0
call line ; display a divider
if dim
call stndout
endif
screenful:
ld b,4 ; pause when screen full
sloop: push bc
block:
ld b,4 ; print groups of 4 rows sep by crlf
bloop: push bc
call row ; process a row
pop bc
djnz bloop
call crlf
pop bc
djnz sloop
if dim
call stndend
endif
call print
db 'More... ',0
call condin ; pause for key strike
jr z,$-3
call crlf
call cls
call print
db 'DIRATR '
db vers/10+'0','.',vers mod 10 +'0'
db 0
call line ; display a divider
if dim
call stndout
endif
jr screenful ; next screen
; Print a row of entries
row:
push hl ; save current entry pointer
ld bc,(rownum) ; update row number
ld (rowpos),bc
inc bc
ld (rownum),bc
ld b,4 ; 4 entries max per line
rloop:
push bc
call entry ; display an entry in the table
push hl
ld hl,(rowpos) ; compute number of next entry
ld de,(rdisp)
add hl,de
ld (rowpos),hl ; save it
ex de,hl ; is there such an entry #?
ld hl,(fcount)
xor a
sbc hl,de
pop hl
pop bc
jr c,rexit ; no
ld de,(edisp) ; compute position of next table entry
add hl,de
djnz rloop
rexit:
pop hl ; move pointer to first entry, next row
ld de,16
add hl,de
jp crlf
entry:
ld a,' ' ; format and display entry
call cout
ld a,4
cp b
jr z,pentry ; no fence on last column
call print
db '| ',0
pentry:
push hl
inc hl
call pfn
pop hl
push hl
call fsize
ld hl,(total)
add hl,de
ld (total),hl
ex de,hl
call phldc
pop hl
ld bc,(filcnt)
dec bc
ld (filcnt),bc
ld a,b
or c
jp z,footer ; exits
ret
pfn: ld b,8
call pfn01
ld a,'.'
call cout
ld b,3
pfn01: ld a,(hl)
and 0ffh
push af
if dim
call m,stndend
else
call m,stndout
endif
pop af
call cout
if dim
call m,stndout
else
call m,stndend
endif
inc hl
djnz pfn01
ret
; Make a line across the screen
line:
if not wyse
call crlf
push bc
ld b,79
ld a,'-'
call cout
djnz $-3
pop bc
jp crlf
else
; Wyse
call crlf
call print
db esc,'H',2,0 ; graphics mode on
push bc
ld b,79
ld a,':'
call cout
djnz $-3
pop bc
call print
db esc,'H',3,cr,lf,0 ; graphics mode off
ret
endif ; not wyse
footer:
if dim
call stndend
endif
call line
call retud ; Print DU
ld a,'A'
add a,b ; rah
call cout
ld a,c
call pafdc
ld a,':'
call cout
inc b ; Print DIR
call dundr
jr z,ftr1
inc hl
ld b,8
ftr0: inc hl
ld a,(hl)
; cp ' '
; jr z,ftr1
call cout
djnz ftr0
ftr1: call print
db ' Files: ',0
ld hl,(fcount)
call phlfdc
call print
db ' Use: ',0
ld hl,(total)
call phlfdc
call print
db ' k Free: ',0
call dfree
ex de,hl
call phlfdc
call print
db ' k',0
call line
exit:
ld sp,(stksav)
ld bc,(udsav)
jp logud
info:
call print
db 'DIRATR '
db vers/10+'0','.',vers mod 10 +'0'
db 0
jr exit
print: ex (sp),hl
ld a,(hl)
inc hl
ex (sp),hl
or a
ret z
call cout
jr print
if wyse
stndout:
call print
db esc,')',0
ret
stndend:
call print
db esc,'(',0
ret
endif
; Data seg thrown up above program
stksav equ stkloc+2
udsav equ stkloc+4
edisp equ stkloc+6
rdisp equ stkloc+8
rownum equ stkloc+10
rowpos equ stkloc+12
total equ stkloc+14
fcount equ stkloc+16
filcnt equ stkloc+18
end start