; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; * * ; * D S T A T S * ; * * ; * ZCPR3 Disk/User Statistics Display Utility * ; * * ; * by * ; * Terry Hazen * ; * 21460 Bear Creek Road * ; * Los Gatos, CA 95030-9429 * ; * * ; * Voice.......... (408) 354-7188 * ; * Zee-Machine.... (408) 245-1420 * ; * Ladera Znode... (310) 670-9465 * ; * * ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; ; Revision History ; ---------------- ; ; 11/11/93 Now displays complete label filenames, making it easier ; v1.6 to identify labels differing only in filetype. ; - Terry Hazen ; ; 05/27/93 Fixed a data module number bug causing incorrect file ; v1.5 sizes for files larger than 512k. ; - Terry Hazen ; ; 01/16/93 Fixed a bug in directory size calculation with 1k block ; v1.4 sizes. Changed 'Disk capacity' message to 'Net disk space' ; for greater clarity, since the size shown is total disk ; size minus the directory size. Added 'Directory size' ; display. Help screen filename now displayed correctly ; under GO. Added language-dependent text overlay. ; - Terry Hazen ; ; 07/12/92 Turns off diskmap function when operating under ZSDOS20+ ; v1.3 and gets disk free space using ZSDOS20+ DOS call. ; - Terry Hazen ; ; 08/10/91 Changed the old 'P' option letter in the option parser ; v1.2 to 'D' (like the help screen said it should be!) ; - Terry Hazen ; ; 07/22/91 Changed disk capacity display from maximum (DSM) to net ; v1.1 capacity (DSM minus the disk directory space). Added ; display of maximum disk directory entries. Added space ; used to each user area display line. Added disk free ; space to Free: summary line. ; - Terry Hazen ; ; 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. ; ; Many of the disk statistics routines in DSTATS are derived from ; DSKMAP10. Many of the user statistics routines are derived from Gene ; Pizzetta's UMAP10, including the ZRDOS drive byte correction that Gene ; added in UMAP13. ; ;======================================================================= ; ; Revision ; vers equ 16 month equ 11 day equ 11 year equ 93 ; ; Equates ; bell equ 07 cr equ 13 lf equ 10 bdos equ 05h fcb1 equ 05ch fcb2 equ 06ch cmdbuf equ 80h ; no equ 0 yes equ not no off equ 0 on equ 0ffh ; public envptr ; .request zslib ext gcomnam,comnam .request z3lib ext z3log .request syslib ext cin,cout,eprint,epstr,phldc,crlf,pfn3 ext dparams,blkshf,blkmsk,extent,blkmax,dirmax ; entry: jp start 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 ; cfg: 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 ;======================================================================= ; org entry+20h ; Start of overlay ; ; Include language-dependent text message module ; incl macro msg1,n,msg2 msg1&n&msg2 endm incl ,%vers,<.txt> ; org z3txt+length ; Start of main program ;======================================================================= ; ; Program start ; start: ld hl,data ; Initialize data area ld de,data+1 ld bc,datalen ld (hl),0 ; With nulls ldir ; zinit: ld ix,(envptr) ; Get environment address in IX ld a,(ix+3) ; First character of ID string cp 'Z' jr z,doschk ; Z-system ; ; If not ZCPR3, display error msg using DOS and quit ; ld hl,err00$ call lhlhl ; Get offset ld de,z3txt ; Get base add hl,de ; Add it in ex de,hl ; In DE ld c,9 ; BDOS print string jp bdos ; doschk: ld hl,fnam ; Put current filename in buffer call gcomnam call dispfn ; Display filename and version ld hl,hlp00$ ; Point to vers msg pointer call pstr$ call eprint ; Display version number and make new line db vers/10+'0','.',vers mod 10+'0',cr,lf,0 ; ld c,12 call bdos ; Get DOS ID ld a,l cp 30h ; Check for Z3PLUS jr c,doschk0 ; Not Z3PLUS ; ld (z3plus),a ; Set Z3PLUS flag xor a jr setm ; Skip option parsing ; doschk0:ld c,48 call bdos ; Get extended DOS ID ld a,h cp 'S' ; ZSDOS? jr nz,parse ; No, continue ; ld a,l ; Get version number cp 20h jr c,parse ; 1.x, continue ; ld (z3plus),a ; Skip option parsing ld (xdos),a ; And set free space flag xor a jr setm ; ; Parse for option requests ; parse: ld a,(dcmd) ; 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,(mcmd) ; Map option? call parscl ld a,(amap) ; Get default map flag jr 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: ld hl,hlp01$ call pstr$ ld a,(z3plus) or a jr z,pbm ; Not Z3PLUS or banked ZSDOS20+ ; call crlf jr synt ; No bitmap under Z3PLUS ; pbm: ld hl,hlp02$ call pstr$ call albit ; synt: ld hl,hlp04$ ; Syntax msg call pstr$ ld hl,comnam ; Point to current filename call dispfn ; Display it ; options:ld hl,hlp05$ ; Dir msg call pstr$ ld a,(z3plus) or a jp nz,crlf ; No options under Z3PLUS or ZSDOS20+ ; ld hl,hlp06$ ; Options msg call pstr$ ; ld a,(mcmd) ; Display bitmap option call dash ld a,(mapf) call dont ; Don't msg ld hl,hlp08$ ; Display msg call pstr$ call albit ; call eprint db ' ',0 ld a,(dcmd) ; Paging option call dash ld a,(pausf) call dont ld hl,hlp09$ ; Pause msg call pstr$ ; albit: ld hl,hlp03$ ; And fall thru ; ; Display message whose pointer is at (HL) ; pstr$: push af ; Save registers call lhlhl ; Get message offset ld de,z3txt add hl,de ; Add in base call epstr ; Display message pop af ret ; dont: ld hl,hlp07$ ; Don't msg or a jr nz,pstr$ ret ; ; Display option character and dash ; dash: call cout call eprint db ' - ',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 ; ld hl,err01$ jp pstr$ ; parm: call dparams ld a,(blkshf) cp 7 ; 3>' ; dnnnnnnnnttte u m r wcfcb: db '?????????????',0,'?' ; ; Uninitialized data area ; dseg ds 48 ; Local stack stack: ds 2 ; System stack pointer ; data: alloc: ds 2 ; Address of allocation vectors dirsize:ds 2 ; Directory size dskcap: ds 2 ; Disk capacity (max-dir) freesp: ds 2 ; Disk free space lin: ds 1 ; Lines for alloc map display col: ds 1 ; Columns for alloc map display z3plus: ds 1 ; ON if running under Z3PLUS xdos: ds 1 ; ON if running under banked ZSDOS20+ mapf: ds 1 ; ON to display alloc map pausf: ds 1 ; ON to pause before alloc map display lincnt: ds 1 ; Current line count filcnt: ds 2 ; Current file total entcnt: ds 2 ; Current entry total sizfcb: ds 36 ; Filesize fcb uspace: ds 2 ; Disk space used ; ; Table with a 19 byte entry for each user area: ; DB '-label ' ; 11 byte label filename ; DW Number of directory entries ; DW Number of files ; DW Space used ; DS 2 ; Spare ; cnttbl: ds 32*19 ; 32 users * 19 bytes @ datalen equ $-data end