; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; * * ; * D S T A T S * ; * * ; * ZCPR3 Disk/User Statistics Display Utility * ; * * ; * by * ; * Terry Hazen * ; * 21460 Bear Creek Road * ; * Los Gatos, CA 95030 * ; * * ; * Voice.......... (408) 354-7188 * ; * Zee-Machine.... (408) 245-1420 * ; * Ladera Znode... (213) 670-9465 * ; * * ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; ; Revision History ; ---------------- ; ; 03/30/91 Initial release. ; v1.0 - Terry Hazen ; ;======================================================================= ; ; DSTATS displays disk space and user statistics and the disk allocation ; bitmap. It is for CP/M 2.2 ZCPR3 systems only and won't work with ; Z3PLUS. ; ; DSTATS was written to combine both disk and user statistics displays ; in one 2k utility. I rename it to DISKMAP and use it to check for ; active user areas on hard disk partitions and to check on current ; disk directory statistics and allocation patterns. ; ; The disk statistics routines in DSTATS are derived from DSKMAP10. The ; user statistics routines are derived from Gene Pizzetta's UMAP10, and ; include the ZRDOS drive byte correction that Gene added in UMAP13. ; ;======================================================================= ; ; Revision ; vers equ 10 month equ 03 day equ 30 year equ 91 ; ; Equates ; bell equ 07 cr equ 13 lf equ 10 bdos equ 05h fcb1 equ 05ch fcb2 equ 06ch cmdbuf equ 80h off equ 0 on equ 0ffh ; .request vlib,z3lib,syslib ext z3init,z3log ext cin,cout,eprint,epstr,phldc,padc,crlf ext dparams,blkshf,blkmsk,extent,blkmax,dirmax ; entry: jp start ; Executes under ZCPR33+ db 'Z3ENV' ; ZCPR3 indentifier db 1 ; Type 1 utility envptr: dw 0 ; Z3ENV address ; ; Configuration area: ; ; Set to zero to take default lines and columns from the ZCPR3 ; environment: ; lins: db 0 ; Default screen lines for paging cols: db 50 ; Default screen columns ; ; Default CFG filename and EFCB name buffer ; name: db 'DSTATS' ; 8 characters db vers/10+'0',vers mod 10+'0' db 0 ; Termination ; pause: db on ; ON to pause before allocation map amap: db on ; ON to display allocation map lblflg: db '-' ; Label file flag character ;----------------------------------------------------------------------- ; ; Program start ; start: xor a ; Initialize data area ld hl,data ld de,data+1 ld bc,datalen ld (hl),a ldir ; zinit: ld hl,(envptr) call z3init ; push hl pop ix ; Get environment address in IX ld a,(ix+3) ; First character of ID string cp 'Z' jr z,doschk ; Z-system ; notz: call eprint db cr,lf,'Requires ZCPR3',bell,0 ret ; doschk: ld l,(ix+24h) ; Get EFCB address in HL ld h,(ix+25h) ld a,h or l ; Check for existence jr z,banner ; No EFCB ; inc hl ; Point to filename ld de,name ; Move it to name buffer ld bc,8 ldir ; banner: call eprint db 'DSTATS vers ' db vers/10+'0','.',vers mod 10+'0' db cr,lf,0 ; ; Check for Z3PLUS ; ld c,12 call bdos ; Get system id ld a,l sub 30h jr c,parse ; ld a,on ; Set Z3PLUS flag ld (z3plus),a xor a jr setm ; Skip option parsing ; ; Parse for option requests ; parse: ld a,'P' ; Pause option? call parscl ld a,(pause) ; Get default pause flag jr nz,setp ; Option not found cpl ; Yes, toggle flag ; setp: ld (pausf),a ; Save pause flag ld a,'M' ; Map option? call parscl ld a,(amap) ; Get default map flag jp nz,setm ; Option not found cpl ; Yes, toggle flag ; setm: ld (mapf),a ; Save map flag ; ld hl,fcb1+2 ld a,'/' ; Help request? cp (hl) jp nz,start1 ; No ; help: call eprint db ' Displays disk and user statistics',0 ld a,(z3plus) or a jr nz,synt ; No bitmap under Z3PLUS ; call eprint db ' plus allocation bitmap',0 ; synt: call eprint db cr,lf db 'Syntax:',cr,lf,' ',0 ld hl,name ; Point to current filename ld b,8 ; fnlp: ld a,(hl) ; Display filename inc hl cp ' ' jr z,options ; Quit at first space call cout djnz fnlp ; Quit after b characters ; options:call eprint db ' [dir:]',0 ld a,(z3plus) or a jp nz,crlf ; No options under Z3PLUS, so quit now ; call eprint db ' [[/]options]',cr,lf db 'Options:',cr,lf,' ' db 'M - ',0 ld a,(mapf) call dont call eprint db 'Display allocation map',cr,lf,' ' db 'P - ',0 ld a,(pausf) call dont call eprint db 'Pause before allocation map display',cr,lf,0 ret ; dont: or a ret z call eprint db 'Don''t ',0 ret ; start1: ld (stack),sp ; Save system stack pointer ld sp,stack ; Point to local stack ld hl,exit ; Save exit address on stack push hl ; ld a,(cols) ; Check if column value specified or a jr nz,getlin ; Use default value ; ld a,(ix+49) ; Get columns from env ; getlin: ld (col),a ; Save number of columns inc hl ld a,(lins) ; Check if line value specified or a jr nz,elin ; Use default value ; ld a,(ix+51) ; Get text lines from env ; elin: ld (lin),a ; Save number of lines sub 12 ld (lincnt),a ; Lines for first directory screen ; ld a,(fcb1) ; Check if drive specified or a jr nz,getcd ; Yes ; ld c,25 call bdos ; Get current drive inc a ; Yes, make it A=1 ld (fcb1),a ; Save it ; getcd: ld de,fcb1 call z3log ld a,(fcb1+15) ; Valid directory? or a jr z,parm ; Yes ; call eprint db ' Invalid directory',cr,lf,bell,0 ret ; parm: call dparams ld a,(blkshf) cp 7 ; 3