! DSKUSE.BAS Counts up how much disk space you're using & how ! many bytes that is, & how much it would cost. ! If you want to change the cost, the variable's name ! is MEGABYTE'COST. Right now it's set to $50.00 per month ! per megabyte ! Built August 23, 1980 ! by Stephan K. Elliott ! This process consists of three files DSKUSE.HLP in [7,1] ! all on DSK0: DSKUSE.CMD in [2,2] ! DSKUSE.RUN in [7,0] MAP1 DIRECTORY'STRING,S,150 MAP1 TOTAL'BLOCKS,F MAP1 TOTAL'BYTES,F MAP1 MEGABYTE'COST,F,,50 ! $ per month charged for storage ($50 here) MAP1 COST,F MAP1 MONTH,S,2 MAP1 DAY,S,2 MAP1 YEAR,S,2 MAP1 BLOCK'STRING,S,10 MAP1 DUMMY,S,1 MAP1 DOLLARS,S,9,"$#,###.##" MAP1 NUMBERS,S,11,"###,###,###" INITIALIZATION: ! DSKUSE.CMD has already cleared the screen and printed a title ? TAB(4,1); TAB(-1,10) MONTH = BYTE(86) DAY = BYTE(87) YEAR = BYTE(88) ? TAB(10,10); "DISK USAGE AS OF ";MONTH;"/";DAY;"/";YEAR ? TAB(12,10); "FILES ON DISK:" CALL DOES'FILE'EXIST OPEN #1, "USE.DIR", INPUT MAIN'PROCESS: CALL SEARCH'FOR'TOTAL CALL CALCULATIONS CALL DISPLAY'RESULTS TIDY'UP: CLOSE #1 KILL "USE.DIR" ? TAB(23,10); "DONE" END ! ********************** LEVEL 1 **************************************** DOES'FILE'EXIST: LOOKUP "USE.DIR", FILE'THERE ! If the program was run from the command file, USE.DIR should have ! already been erased, if it hasn't, send 'em back to the command file IF FILE'THERE <= 0 & THEN & ? TAB(15,10); "ONE MOMENT, PLEASE WHILE I LOOK UP A FILE" : & CHAIN "DSKUSE.CMD" RETURN SEARCH'FOR'TOTAL: INPUT LINE #1, DIRECTORY'STRING ? TAB(13,10); TAB(-1,9); ? TAB(13,10);DIRECTORY'STRING X = INSTR(1,DIRECTORY'STRING,"Total of") IF EOF(1) = 1 & THEN & ? "SORRY, MY MISTAKE" : & END IF X = 0 & THEN & GOTO SEARCH'FOR'TOTAL Y = INSTR(1,DIRECTORY'STRING,"in") Z = INSTR(1,DIRECTORY'STRING,"block") BLOCK'STRING = DIRECTORY'STRING[Y+3,Z-1] TOTAL'BLOCKS = VAL(BLOCK'STRING) RETURN CALCULATIONS: TOTAL'BYTES = TOTAL'BLOCKS * 512 COST = (MEGABYTE'COST * TOTAL'BYTES) / 1000000 RETURN DISPLAY'RESULTS: ? TAB(17,10);"TOTAL BYTES IN USE =";TOTAL'BYTES USING NUMBERS ? TAB(19,10);" MONTHLY COST =";COST USING DOLLARS RETURN