;*; Updated on 27-Apr-93 at 6:51 PM by James A. Jarboe I V; edit time: 0:39:11
;*************************** AMUS Program Label ******************************
; Filename: FREE.M68 Date: 12/18/91
; Category: UTIL Hash Code: 515-501-722-125 Version: 1.0(105)
; Initials: GR/AM Name: JAMES A. JARBOE IV
; Company: EDUCATIONAL VIDEO NETWORK Telephone #: 4092955767
; Related Files: NONE
; Min. Op. Sys.:1.x and 2.x Expertise Level: BEG
; Special: MUST USE 2.X ASSEMBLER.
; Description: Displays disk usage Statistics on 1.x and 2.x systems.
; Usage: .FREE {DSK#:}, Much more informative than the FREE.LIT provided
; with AMOS 2.x systems and it works with both AMOS 1.x and 2.x.
;*****************************************************************************
;*; Updated on 18-Dec-91 at 10:55 PM by James A. Jarboe I V; edit time: 0:46:11
;*****************************************************************************
; FREE.M68
; Displays Disk Usage Statistics
;
; History:
;
; Written:
; 07-Jun-84 David F. Pallmann
;
; Modified:
; 12/07/85 E. Oulashin - on next word, prev bit being set
; caused contig to be zero'ed when there were
; contiguous blocks.
; 02/24/86 E. Oulashin - corrected percentages on totals,
; also fixed to round properly on percentages.
; 02/25/86 Dave Heyliger - AMUS
; Changed total end-use figure report to produce
; proper disk-use total.
;
; 01/09/89 Ed Schrayer - allow use for a single device only
; or all devices as before, also prevent devide by zero
;
; [105] 18-Dec-91 by James A. Jarboe IV GR/AM
; Neat little program that needed to be upgraded to the 90's
; Made to work on 1.x and 2.x systems.
; Made to not include FOLDER and NRD's in totals for real devices.
; Fixed total percentage rounding.
; Added Version and edit levels.
; Took out internal device offsets as there are now defined in SYSSYM
;
; [106] 12-Mar-93 by James A. Jarboe IV GR/AM
; Update to flag extended devices.
; [107] 27-Apr-93 by James A. Jarboe IV GR/AM
; Updated to not abort when listing CD-ROM devices.
;
SEARCH SYS
SEARCH SYSSYM
DEFINE DIVIDE SRC,DST
DIV SRC,DST
AND #177777,SRC
ENDM
;DEVICE TABLE
;; Comment out as offsets are now defined in SYSSYM for 2.x [105]
; .OFINI
; .OFDEF DV.NXT,4 ;link to next device entry
; .OFDEF DV.FLG,2 ;flags--.
; DV$LOG=10 ; logical unit
; DV$SHR=1000 ; shareable device
; DV$MNT=10000 ; mounted
; .OFDEF DV.DEV,2 ;device code RAD50
; .OFDEF DV.UNT,2 ;drive number RAD50
; .OFSIZ DV.SIZ ; Free device size.
;
;IMPURE AREA
;
.OFINI
.OFDEF DISK, D.DDB ;DDB for reading bitmaps
.OFDEF FR.TBL, 0 ; Start of free table. [105]
.OFDEF FREE, 4 ; Free block count per disk. [105]
.OFDEF CONTIG, 4 ; Contig count per disk. [105]
.OFDEF FR.EXP, DF.SIZ-4. ; End of free table and room. [105]
.OFDEF TFREE, 4 ; Total free count.
.OFDEF TEMP, 4 ; Temporary bitmap count old style.
.OFDEF TCONTG, 4 ; Total contig count
.OFDEF COUNT, 4 ; <- not used
.OFDEF BLOCKS, 4 ; Total blocks per disk
.OFDEF ONEDSK, D.DDB ; DDB for one device.
.OFDEF ONEFLG, 4 ; Flag for one device.
.OFDEF FR.FLG, 4 ; Flags. [105]
FR$S2X = 1_0 ; 2.x System. [105]
FR$FLD = 1_1 ; Folder device. [105]
.OFDEF LABBUF, 26. ; Label display buffer [106]
.OFSIZ MEMSIZ ; End of impure area.
; Make sure 2.x assembler is used so DSKFRE Monitor call and offsets are found.
; FREE will still on AMOS 1.x, this program just needs to be assembled
; with the 2.x assembler or d/SOFT's MACRO.
;
ASSEMB1 = 1
ASSEMB2 = 2
IF EQ, ASSEMB1-ASSEMB2, ASMERP "?Must use 2.x Assembler"
;
CMPB PH.VER+1, #2 ; Is this a 2.x system? [105]
BLO 10$ ; No..do everything the old way.[105]
OR #FR$S2X, FR.FLG(A5) ; Yes..set flag. [105]
10$: CLR COUNT(A5)
CLR TFREE(A5)
CLR TCONTG(A5)
CLR BLOCKS(A5)
CLR ONEFLG(A5)
LIN ; one or all devices ? ES
JEQ LOOP
ONEDEV: BYP ; find first non-blank character
FSPEC ONEDSK(A5) ; Set up DDB area
TST D.FIL+ONEDSK(A5) ; If file name is included,
JNE BADUSE ; reject request.
JOBIDX ; Get current job
TSTW D.DEV+ONEDSK(A5) ; Did user just use ":"
BNE 10$ ; no...
MOVW JOBDEV(A6), D.DEV+ONEDSK(A5) ; yes..set default device.
10$: TSTW D.DRV+ONEDSK(A5) ; Is device set?
BPL 20$ ; Yes..
MOVW JOBDRV(A6), D.DRV+ONEDSK(A5) ; No..set default.
20$: MOV #1,ONEFLG(A5) ; and set a flag for single device
; search only
;SCAN DEVICE TABLE
LOOP: MOV DEVTBL,A4 ;point A4 to first DEVTBL entry
10$: BITW #DV$MNT,DV.FLG(A4) ;is device mounted?
BEQ 20$ ; no
TST ONEFLG(A5) ; are we scanning for only one device?
BEQ 15$ ; if not, report on all devices
CMMW DV.DEV(A4),ONEDSK+D.DEV(A5) ; did we match device name ?
BNE 20$ ; no - keep scanning
CMMW DV.UNT(A4),ONEDSK+D.DRV(A5) ; did we match drive # ?
BNE 20$ ; no - keep scanning
CALL DEVICE ; report on the device and
BR EXIT ; exit to amos
15$:
BIT #<FR$FLD>, FR.FLG(A5) ; Done folder devices? [105]
BNE 18$ ; Yes..bypass DEVTBL check. [105]
MOV A4, D7 ; Get DEVTBL address. [105]
CMP D7, SYSBAS ; Greater than System Base? [105]
BLO 18$ ; No..never mind. [105]
CALL TOTALS ; Yes..do totals for real disks.[105]
OR #FR$FLD, FR.FLG(A5) ; Set must be at folders flag. [105]
CRLF ; Bump screen. [105]
TYPECR <Folder Devices:> ; Tellem.. [105]
CALL HEADER ; Redoe Header table [105]
18$: CALL DEVICE ; process device specs
20$: MOV DV.NXT(A4),D0 ;get link to next device entry
CTRLC 30$ ;if early abort -- jump out
BEQ 30$ ;branch on zero (end of table)
MOV D0,A4 ;set new address into A4
BR 10$ ;and continue processing
30$: CALL TOTALS
HEADER:
TYPECR <Device Size Free In use Contig Label>
PRTTAB -1, 11.
TYPE <------ ------ ------------ ------------ ------ ------------------------>
PRTTAB -1, 12.
CRLF
RTN
BADUSE: CRLF
TYPECR Usage:
TYPECR < FREE - For all devices.>
TYPECR < FREE : - For current device.>
TYPECR < FREE DEV#: - For a single device.>
EXIT
NOREAD: CRLF
PRTTAB -1,11.
TYPE <%>
PRTTAB -1,12.
TYPE <Device >
OFILE ONEDSK(A5),<OT$TRM!OT$OFD>
TYPECR < does not exist.>
EXIT