;*************************** AMUS Program Label ****************************** ; Filename: FLDDIR.M68 Date: 5/23/92 ; Category: UTIL Hash Code: 573-657-436-067 Version: 1.2(109) ; Initials: GR/AM Name: James A. Jarboe IV ; Company: Educational Video Network, Inc. Telephone #: 4092955767 ; Related Files: FOLDER.LIT, FLDDIR.HLP ; Min. Op. Sys.: 1.3 Expertise Level: BEG ; Special: Must LNKLIT FILDIR. Must also have FOLDER.LIT ; Description: Displays a Directory of Soft Machines FOLDER files. ; Now uses CMDLIN.SYS. Now displays "*" for extended directory folders. ; ;***************************************************************************** ;*; Updated on 23-May-92 at 11:46 PM by James A. Jarboe I V; edit time: 0:17:17 ;*************************************************************************** ; * ; FLDDIR.M68 * ; * ; Written By: James A. Jarboe IV * ; 1401 19th Street * ; Huntsville, TX 77340 * ; 409-295-5767 * ; * ; Updated 23-May-92 * ; 23-Oct-88 * ; GR/AM * ;*************************************************************************** ; Comments and Suggestions are always welcome ! ; ; Description: Displays a Directory of Soft Machines FOLDERS files. ; Displays LABEL data and number of Blocks and number of ; free Blocks for each FOLDERS file on a specified device. ; Optionally will display date Folder was created. ; Optionally will display all information on terminals with ; 132 column display capabilities. ; Extended directory folders flagged with "*". ; ; --NOTE-- FOLDERS is a Disk Organizer program by Soft Machines. ; P O Box 3701 ; Champaign, IL 61821 ; (217)-351-7199 ; ; Options: ; /? - Display help. ; /H - Display help. ; /C - Creation date of FOLDER is displayed. ; /W - 132 column full label display of FOLDER file. ; ESC - Exit FLDDIR and keep current screen display. ; ASMMSG "( )" ASMMSG "( FLDDIR )" ASMMSG "( By James A. Jarboe IV )" ASMMSG "( )" ASMMSG "( Now uses CMDLIN.SYS for wildcarding. )" ASMMSG "( )" ASMMSG "( Must LNKLIT FLDDIR, to make FLDDIR.LIT )" ASMMSG "( )" ASMMSG "( FLDDIR.HLP should be located on DSK0:[7,1] )" ASMMSG "( Use FLDDIR/? for HELP )" ASMMSG "( )" ;************************************************************************** ; * ; S T A N D A R D S Y M B O L I C S * ; * ;************************************************************************** ; SEARCH SYS ; Get standard Sys. SEARCH SYSSYM ; Get standard System symbolics. SEARCH TRM ; Get terminal symbolics. COPY CMDSYM/L ; Copy CMDLIN.SYS symbolics. EXTERN $ODTIM ; Output day/time. ;************************************************************************** ; * ; C U R R E N T V E R S I O N * ; * ;************************************************************************** ; ; Edit History: ; ; [109] 23-May-92 - Added "*" for extended directory folder. [JAJ] ; - Added ESCAPE to exit message. ; (Leaves current screen displayed). ; [108] 04 February 1991 13:30 Edited by Bob Rubendunst ; Fixed endpoint problem caused by LWORD fetch of bitmap structure. ; (Fixed by SWAPing LWORD ) ; [107] 25-Feb-90 - Display Created date tag correctly. [JAJ] ; [106] 08-Dec-89 - Use proper disk label mneumonics. ; Fixed possible address error if file not found ; during lookup. Do header in wide if already set ; in wide mode. Display created header correctly [JAJ] ;2[105] 09-Nov-89 - Now uses AMOS CMDLIN.SYS instead of WLDSCN. [JAJ] ; ; [104] 01-Nov-89 - Fixed Free blocks information to reflect correct ; amount on FOLDERS larger than 4096 blocks. ; Use TRMRST & TRMWST for Terminal status. [JAJ] ;1[103] 30-Oct-89 - Properly support mode & field terminals. (AM65) ; Support row & column handling with TRMCHR. ; Add independent help instead of within program. [JAJ] ; ; [102] 18-Apr-89 - Fixed problem with displaying free blocks ; over 64 words. Changed D2 to 512. [JAJ] ; [101] 15-Mar-89 - Save & restore current base. ; Escape key will leave screen visable & quit. ; Made PRTTAB Macro more efficient . ; Thanks to Creed Erickson for Suggestions. [JAJ] ; [100] 23-Oct-88 - Created. [JAJ] ; VMAJOR = 1. ; Written James A. Jarboe IV 10/23/88 VMINOR = 2. ; Minor modifications made at [105]. VEDIT = 109. ; Current release. 23-May-92 VSUB = 0. VWHO = 0. ;************************************************************************** ; * ; M A C R O D E F I N I T I O N S * ; * ;************************************************************************** ;***************** ; PRTTAB * ;***************** ; ; Similar to basic "print tab" directive. ; Where: ; ROW = row number to print on or -TCRT preset. ; COL = column number to print on or TCRT call. ; ; D1 is destroyed. ; DEFINE PRTTAB ROW, COL MOVW #, D1 TCRT ENDM ;***************** ; DING * ;***************** ; ; Rings terminal bell. ; ; D1 is destroyed. ; DEFINE DING MOVB #7, D1 ; Set bell. TTY ; Ring bell. ENDM ;************************************************************************** ;* * ;* C O N S T A N T V A L U E S * ;* * ;************************************************************************** ; ; Define label sizes. S..HDR = 4. ; Size of Header (bytes). S..VLN = 40. ; Size of Volume name. S..VID = 10. ; Size of Volume ID. S..CRE = 30. ; Size of Creator. S..INS = 30. ; Size of Installation S..SYS = 30. ; Size of System. S..CRD = 4. ; Size of Creation date. S..ACD = 4. ; Size of Access date. ; Define Disk Noise words NOIS.1 = ^O125252 ; First noise word. (octal) NOIS.2 = ^O052525 ; Second noise word. (octal) ; Define true/false. TRUE = -1 ; Logical true. FALSE = 0 ; Logical false. ; Define characters. ; $LF = 10. ; The Linefeed character. $CR = 13. ; The Carriage Return character. $ESC = 27. ; The Escape character. $SPACE = 32. ; Space character. $STAR = 42. ; The "*" character. [109] $SLASH = 47. ; The "/" character. $QUEST = 63. ; The "?" character. $NO = 78. ; The "N" character. $YES = 89. ; The "Y" character. $LFBR = 91. ; The "[" character. $RTBR = 93. ; The "]" character. $DEL = 127. ; The "DEL" character. ; Add check for extended directory flag in case assembled under 1.x [109] ; IF NDF, LB$14D, LB$14D = 4 ;************************************************************************** ; * ; I M P U R E A R E A O F F S E T S * ; * ;************************************************************************** ; ; CMDLIN.SYS requires that an allocated work space be specified. ; Thus the .OFINI with IMP.SZ !! ; .OFINI IMP.SZ ; ALLOCATE CMDLIN.SYS WORK AREA !!!!! .OFDEF INPDDB, D.DDB ; Input file DDB. .OFDEF OUTDDB, D.DDB ; Output file DDB. .OFDEF TRMCAP, TC.SIZ ; Terminal capabilities storage. .OFDEF PBUF, 80. ; Print buffer. .OFDEF LSTDEV, 2 ; Last device of last file accessed. .OFDEF LSTDRV, 2 ; Last drive of last file accessed. .OFDEF LSTPPN, 2 ; Last PPN of last file accessed. .OFDEF COUNT, 2 ; Number of files on screen. .OFDEF BEGRTN, 2 ; Pause return routine flag. .OFDEF FREE, 4 ; Free block count. .OFDEF BLOCKS, 4 ; Number of available blocks. .OFDEF FG.WID, 4 ; Global wide flag, multiple entry. .OFDEF CURBAS, 2 ; Save current base buffer. .OFDEF ORGCOL, 2 ; Original number of columns. .OFDEF MAXROW, 2 ; Maximum number of usable rows buf. .OFDEF LSTCHR, 1 ; Last char input storage. .OFDEF SPARE, 1 ; Even things up. ; Point to top of CMDLIN.SYS switch table. ; .OFDEF FT.SWV, 0 ; Start of CMDLIN.SYS switch values. .OFDEF FT.HLP, 4 ; /? help requested. .OFDEF FT.DAT, 4 ; /C creation date requested. .OFDEF FT.PAS, 4 ; /P no pause on []. .OFDEF FT.WID, 4 ; /W wide terminal display. .OFSIZ S..IMP ; Impure area size. ;************************************************************************** ;* * ;* S T A R T O F P R O G R A M * ;* * ;************************************************************************** ; ;**************************** ; START - Initial set up area ;**************************** ; ; Description: Initialize job, set hex, image mode, noecho ; store terminal capabilities, store original column width. ; ; A5 -> impure area. ; START: PHDR -1, PV$RPD!PV$RSM, PH$REE!PH$REU ; Program header. GETIMP S..IMP, A5 ; Allocate local memory. ; Here we save current JOBTYP, Set OCTAL for PPN output, Set no echo, image ; mode, and save original number of columns in case /W switch is used. ; JOBIDX ; Point to JCB. MOVW JOBTYP(A6), CURBAS(A5) ; Save current jobtyp. ANDW #^C, JOBTYP(A6) ; Set OCTAL base. TRMRST D7 ; Read terminal status. ORW #, D7 ; Set echo suppress and image mode. TRMWST D7 ; Write terminal status. TRMCHR TRMCAP(A5), 0 ; Get terminal capabilities. MOVW TC.COL+TRMCAP(A5), ORGCOL(A5) ; Save original column number. PRTTAB -1, 29. ; Turn off cursor. ; Check first of command line for obvious help request. ; CMDLIN.SYS does not accept "?" as a valid option for a switch and I like ; to use it for help. ; BYP ; Bypass white space. CMPB @A2, #$SLASH ; Is this an option? BNE CMDLIN ; No..process with CMDLIN.SYS BYP ; Bypass white space. CMPB 1(A2), #$QUEST ; User wants help? JEQ HELP ; Yes..process help ;;; BR CMDLIN ; No..process command line. ;+************************+ ; CMDLIN * ;+************************+ ; Locate and set up CMDLIN.SYS. (CMDLIN.sys set up.) ; ; Overview: ; ; Sets up CMDLIN.SYS with .CMLOC and .CMINI library calls. Reports ; errors. ; ; Arguments: ; ; A0 => Indexes default command line. ; A2 => Indexes real command line. ; A5 => Indexes Base of impure memory. ; ; Returned: ; ; Dependencies: ; ; NOTE: A5 *MUST* point to the impure area used by CMDLIN.SYS ; ; Side Effects: ; ; A6, D6, D7 may be destroyed. ; CMDLIN: .CMLOC INPDDB(A5) ; Locate CMDLIN.SYS. LEA A0, DEFCMD ; Point to default command line. MOV #, D7 ; Print errors. No special OPR: ; Here we initialize CMDLIN.SYS, check for the real /HELP and any errors ; that may have occured on command line. ; .CMINI SWTDEF, FT.SWV(A5) ; Initialize CMDLIN.SYS JNE HELP ; Finish on error. TST FT.HLP(A5) ; User requested help? JNE HELP ; Yes...show help. ; Command line succesfully initialized, preclear count and first time flag. ; 10$: CLRW COUNT(A5) ; Pre-clear file count. CLRW BEGRTN(A5) ; Flag no return first time through. ; CMNXT is called here for the first time to see if any requested files ; exist. ; .CMNXT INPDDB(A5), OUTDDB(A5) ; Get next file. JNE HELP ; Bad option, give help. MOV CM.NXT(A5), D7 ; Get CMDLIN.SYS error flags. AND #NX$ERR, D7 ; Was there an error? JNE FINISH ; Yes, done (CMDLIN reports error.) MOV CM.NXT(A5), D7 ; Get CMDLIN flags. AND #NX$END, D7 ; Any matches? JEQ 20$ ; Yes...process them. CALL NOFOLD ; No...but report no folders. JMP FINISH ; Finish process. 20$: CALL HEAD1 ; Display header data. CALL THEDIR ; Print current directory. JMP LOOP2 ; Process file. PAGE ;***************** ; LOOP * ;***************** ; ; Main processing loop to find Folder files. ; LOOP: CTRLC CLRFIN ; Branch on ^C. .CMNXT INPDDB(A5), OUTDDB(A5) ; Get next file that matches spec. JNE HELP ; Bad option, exit. TSTB CM.ERR(A5) ; Was there an error? JNE FINISH ; Yes, give up. MOV CM.NXT(A5), D7 ; Get cmdlin flags. AND #NX$END, D7 ; Are we done? JEQ LOOP2 ; No..process folder. CMPW COUNT(A5), #0 ; Any folders displayed? BNE 10$ ; Yes..leave program correctly. CALL NOFOLD ; No..show no folders. MOVW #1, COUNT(A5) ; Fake pause out to pause. CALL PAUSE ; Call pause. MOVW #0, COUNT(A5) ; Reset no count. 10$: JMP LEAVE ; Exit program correctly. PAGE ;***************** ; LOOP2 * ;***************** ; ; Jumped here for first time through after set up. ; Copy all pertinant info from wildcard scanner table. ; LOOP2: CMMW COUNT(A5), MAXROW(A5) ; Is the screen full ? BLOS 30$ ; No...continue. ; Pause to display screen and check for user input. ; 20$: CTRLC CLRFIN ; Finish on ^C. CALL PAUSE ; Yes...wait for user. CMPB LSTCHR(A5), #$ESC ; User press ESCape? JEQ FINISH ; Yes.. finish clean. CALL THEDIR ; Redisplay header and clear screen. CLRW COUNT(A5) ; Pre-clear file count. ; Check to see if we entered a new PPn. ; 30$: MOV CM.NXT(A5), D7 ; Get current status. AND #NX$DEV, D7 ; Still on same device? BNE 35$ ; No..we need to reset. MOV CM.NXT(A5), D7 ; Get current status. AND #NX$UNT, D7 ; Still on same drive? BNE 35$ ; No..we need to reset. MOV CM.NXT(A5), D7 ; Get current status. AND #NX$PRJ, D7 ; Still on same Project? BNE 35$ ; No..we need to reset. MOV CM.NXT(A5), D7 ; Get current status. AND #NX$PRG, D7 ; Still on same Programmer? BEQ 50$ ; Yes..proceed as normal. ; Reset the "I changed" flag, then process the pause and everything. ; 35$: CLR CM.NXT(A5) ; Don't repeat process for change. BR 20$ ; Process the change. ; Show file information on screen. ; 50$: CTRLC CLRFIN ; Allow control C. JMP PRFILE ; Show file name. PAGE ;***************** ; LEAVE * ;***************** ; ; Clean up all operations and displays before exiting program. ; LEAVE: TST FT.PAS(A5) ; Was pause selected? BEQ 10$ ; No..go check for any count. CALL PAUSE ; Call pause. CMPB LSTCHR(A5), #$ESC ; Leave screen up? BEQ FINISH ; Yes..don't clean up screen. BR CLRFIN ; No..Clean up screen display. 10$: CMPW COUNT(A5), #0 ; Any folders displayed? BEQ CLRFIN ; No...Exit. CALL PAUSE ; Yes..Pause for user input. CMPB LSTCHR(A5), #$ESC ; Leave screen up? BEQ FINISH ; Yes..don't clean up screen. PAGE ;***************** ; CLRFIN * ;***************** ; ; Clear screen before finishing. ; CLRFIN: PRTTAB -1, 0 ; Clear screen. PAGE ;***************** ; FINISH * ;***************** ; ; Final clean up before exiting program. ; FINISH: JOBIDX ; Point to JCB. MOVW CURBAS(A5), JOBTYP(A6) ; Restore original Base. ANDW #^C, JOBSTS(A6) ; Clear any pending CTRLC's. PRTTAB -1, 28. ; Turn cursor back on. CMPB LSTCHR(A5), #$ESC ; Test for escape character pressed. BEQ 10$ ; Leave wide, if we asked for it. CMMW ORGCOL(A5), TC.COL+TRMCAP(A5) ; Was orignal width the same? BEQ 10$ ; Yes...don't switch screen width. PRTTAB -1, 81. ; No..reset width. 10$: EXIT ; Back to AMOS. PAGE ;***************** ; PRFILE * ;***************** ; ; Print the current file name on the screen. ; PRFILE: LOOKUP INPDDB(A5) ; Does file exist? JNE LOOP ; No...then next do next one. CMP INPDDB+D.LSZ(A5), #-1 ; Is file Random? JCC LOOP ; No... then do next one. ; Open file if possible ; ORB #, D.FLG+INPDDB(A5); No error messages on DDB. OPENR INPDDB(A5) ; Open the file. JNE LOOP ; May be in use. READ INPDDB(A5) ; Read the file. MOV INPDDB+D.BUF(A5), A1 ; Index file input buffer. ; We will treat the found file as a Device since a Folder should be treated ; like one. Leave A2 pointing to LB.VLN. CMPW LB.HDR(A1), #NOIS.1 ; Is first word valid noise word? JNE CFILE ; No..try another file. CMPW LB.HDR+2(A1), #NOIS.2 ; Is second word valid noise word? JNE CFILE ; No..try another file. ; Output file name to buffer so that we can format i the way we want, ; rather than OFILE style with a dot. ; PUSH A1 ; Save them goodies. LEA A2, PBUF(A5) ; Point to print out buffer. LEA A1, D.FIL+INPDDB(A5) ; Get filename. UNPACK ; Unpack the first 3. UNPACK ; Unpack the second 3. MOVB #$SPACE, (A2)+ ; Put in a space. UNPACK ; Unpack the extension. CLRB @A2 ; Clear current location. ; Added check for extended directory folders. POP A1 ; Restore buffer address. MOV #$SPACE, D1 ; Set space in case not extended. MOVW LB.FLG(A1), D7 ; Get label flag. ANDW #LB$14D, D7 ; Is extended directory folder? BEQ 10$ ; No..output space. MOV #$STAR, D1 ; Set star flag for extended display. 10$: TTY ; Output space or star. ;[109] TYPE < > ; Offset term output by one column. PRTTAB -1, 11. ; Dim screen. TTYL PBUF(A5) ; Print the filename out. PRTTAB -1, 12. ; Bright screen. ;[109] POP A1 ; Restore the goodies. ; Output label information. ; TYPE < > ; Output a space. CMPB LB.VLN(A1), #0 ; Is the folder labeled? BNE ALBL ; Yes..output label. TYPE < -------- not labeled -------- > JMP VOLID ; Do volume & Id. PAGE ;***************** ; ALBL * ;***************** ; ; Print out Label data. ; ALBL: MOV #S..VLN, D0 ; Preset volume name size. LEA A2, LB.VLN(A1) ; Index Volumn name data. 10$: MOVB (A2)+, D1 ; Get next byte. CMPB D1, #$SPACE ; Is it printable? BLT 20$ ; No...print a space. CMPB D1, #$DEL ; Is it printable? BGE 20$ ; No...print a space. TTY ; Print out normal data. BR 30$ ; Do another character. 20$: TYPE < > ; Print a space instead of null. 30$: SOB D0, 10$ ; Do another character. PAGE ;***************** ; VOLID * ;***************** ; ; Output folder volume & Id. ; VOLID: PRTTAB -1, 11. ; Dim screen display. TYPE < (> ; Output seperator. PRTTAB -1, 12. ; Bright screen. MOV #S..VID, D0 ; Preset Volume ID count. LEA A2, LB.VID(A1) ; Index Volume ID. 10$: TST D0 ; End of Volume Id count? BEQ 20$ ; Yes..output terminator. CMPB @A2, #0 ; Is character a null? BEQ 20$ ; Yes..must be through. MOVB (A2)+, D1 ; No...Set up character. TTY ; Output character. SUB #1, D0 ; Decrease volume Id count. BR 10$ ; Get next character. ; Output termination of volume ID data. ; 20$: PRTTAB -1, 11. ; Dim screen display. TYPE <) > ; End volume data. PRTTAB -1, 12. ; Bright screen. ; Offset output of volume Id if all 10 places of volume Id was not used. ; 30$: TST D0 ; End of Volume id data? BEQ CHKWID ; Yes..check wide status. MOVB #$SPACE, D1 ; No..set up a space. TTY ; Output space. SUB #1, D0 ; Decrease Volume id size count. BR 30$ ; Do another space. PAGE ;***************** ; CHKWID * ;***************** ; ; Check if width flag was set to possibly display more data. ; CHKWID: PRTTAB -1, 11. ; Dim screen display. TST FG.WID(A5) ; Was wide mode set? BEQ CHKCRD ; No..wide not possible. MOV #S..CRE, D0 ; Preset creator size. LEA A2, LB.CRE(A1) ; Index Creator data. 10$: MOVB (A2)+, D1 ; Get next character. CMPB D1, #$SPACE ; Is character printable? BLT 20$ ; No...output a space. CMPB D1, #$DEL ; Is character printable? BGE 20$ ; No...output a space. TTY ; Output data. BR 30$ ; Do another character. 20$: TYPE < > ; Print a space instead of null. 30$: SOB D0, 10$ ; Do entire size of Creator. PAGE ;***************** ; CHKCRD * ;***************** ; ; Check to see if creation date should be output. ; CHKCRD: TST FG.WID(A5) ; Was wide set? BNE 20$ ; Yes...output creation date. TST FT.DAT(A5) ; Was creation date requested? BEQ 30$ ; Yes...output block info. 20$: TYPE < > ; Output a space. MOV LB.CRD(A1), D3 ; Set creation date. SAVE A2, D3, D4, D5 ; Save registers for $ODTIM. SUB A2, A2 ; Set A2 to 0. MOV #1000, D5 ; Set date output bits. CALL $ODTIM ; Output creation date. REST A2, D3, D4, D5 ; Restore registers. TST FG.WID(A5) ; Was wide set? BEQ 50$ ; No..then through with output. TYPE < > ; Yes...even up output. 30$: MOV INPDDB+D.FSZ(A5), D1 ; Set up number of blocks in folder. DCVT 6, OT$TRM!OT$ZER!OT$TSP ; Output number of blocks. CALL FREBLK ; Find out number of free blocks. 50$: PRTTAB -1, 12. ; Bright screen. INCW COUNT(A5) ; Bump folders display counter. CRLF ; Set up next line. PAGE ;***************** ; CFILE * ;***************** ; ; Close opened file. ; CFILE: CLOSE INPDDB(A5) ; Close file. JMP LOOP ; Try for next folder. PAGE ;************************* ; HEAD1 - Displays the header ;************************* ; ; Correct graphics for mode and field terminals is handled manually ; rather than using TCRT codes 106-119 for mode terminals. ; HEAD1: CTRLC CLRFIN ; Allow exit. PRTTAB -1, 0 ; Clear screen. PRTTAB -1, 14. ; Disable protected fields. PRTTAB -1, 12. ; Set bright. ; If terminal is already in wide mode then set wide flag. ; MOVW TC.COL+TRMCAP(A5), D7 ; Get current column numbers. CMPW D7, #80. ; Greater than 80 columns? BHI 5$ ; Yes.. then side wide. TST FT.WID(A5) ; Is wide flag set? BEQ 15$ ; No...don't set wide. 5$: MOV #0, FT.WID(A5) ; Pre-clear wide mode. TRMCHR TRMCAP(A5), 0 ; Get terminal capabilities MOV TC.FLG+TRMCAP(A5), D7 ; Get terminal flags. AND #TD$132, D7 ; Do we have 132 columns? BEQ 15$ ; No.. no wide. PRTTAB -1, 80. ; Yes...Set wide screen. PRTTAB -1, 0 ; Clean up Screen. MOV #TRUE, FT.WID(A5) ; Set wide flag. MOV #TRUE, FG.WID(A5) ; Set wide in case of multiples. 15$: TRMCHR TRMCAP(A5), 0 ; Capabilites may have changed. MOVW #1, D1 ; Set up row #. CALL LSTCOL ; Set last column. PRTTAB -1, 33. ; Reverse video off at last col. PRTTAB 1, 1 ; Set up row & column. PRTTAB -1, 32. ; Reverse video on at row & col. CLR D2 ; Pre-clear column count. MOVW TC.COL+TRMCAP(A5), D2 ; Set up number of columns. SUBW #2, D2 ; Subtract 2 columns. CLR D1 ; Pre-clear counter. MOVB #$SPACE, D1 ; Set up space character. 25$: TTY ; Output spaces for reverse. SOB D2, 25$ ; Do all columns. PRTTAB 1, 2. ; Set row & column. TYPE < - FLDDIR > ; Output program name. VCVT START+2, OT$TRM ; Display program version data. TYPE < - > ; Output seperator. TST FT.WID(A5) ; Is wide set? BEQ 30$ ; No..bypass full info. TYPE ; By Me! PRTTAB 1, 96. ; Set location for wide display. BR 40$ ; Set date. 30$: PRTTAB 1, 68. ; Set location for norm display. 40$: SAVE A2, D3, D4, D5 ; Save registers. SUB A2, A2 ; Pre-clear A2 CLR D3 ; Clear D3 to get sys date. MOV #1366, D5 ; Set date flags. TST FT.WID(A5) ; Is wide set? BNE 50$ ; Yes...output full date. CLR D5 ; No...output short date. MOV #1000, D5 ; Set output bits. 50$: CALL $ODTIM ; Printout date. REST A2, D3, D4, D5 ; Restore registers. MOVW #1, D1 ; Set up row 1. CALL LSTCOL ; Set last column. PRTTAB -1, 33. ; Turn reverse off. MOVW #2, D1 ; Set up row 2. CALL LSTCOL ; Set last column. PRTTAB -1, 33. ; Turn reverse off. PRTTAB 2, 1 ; Set up row 2, column 1 PRTTAB -1, 32. ; Turn reverse on. PRTTAB -1, 11. ; Turn low intensity on. TYPE < Filename > ; TYPE < Volume Name > TYPE < Vol ID > TST FT.WID(A5) ; Has wide been set? BEQ 65$ ; No..bypass full output. TYPE < Creator Created Blocks Free > BR 80$ ; Bypass short output. 65$: TST FT.DAT(A5) ; Creation date requested? BNE 70$ ; No..output creation date. TYPE < Blocks Free> ; Yes..set block free header. BR 80$ ; Finish up. 70$: TYPE < Created > 80$: PRTTAB -1, 12. ; Turn high intensity on. MOVW #2, D1 ; Set up row 2. CALL LSTCOL ; Set up last column. PRTTAB -1, 33. ; Turn reverse off. MOVW TC.ROW+TRMCAP(A5), D2 ; Get number of possible rows. SUBW #6, D2 ; Offset by six rows for headers. MOVW D2, MAXROW(A5) ; Store maximum usable rows. RTN ; Return. PAGE ;***************** ; THEDIR * ;***************** ; ; Displays the current Device specification. ; THEDIR: PRTTAB 3., 1 ; Set up row 3, column 1. PRTTAB -1, 10. ; Clear to bottom of screen. PRTTAB 1, 1 ; Set up row 1, column 1. PRTTAB -1, 32. ; Turn reverse on. PRTTAB 1, 22. ; Set Normal row & column. TST FG.WID(A5) ; Is wide mode set? BEQ 5$ ; No..bypass wide set up. PRTTAB 1, 47. ; Set Wide row & column. 5$: PRTTAB -1, 11. ; Dim display. TYPE < Directory of FOLDERS on > ; Save info we might modify ; PUSHW D.DEV+INPDDB(A5) ; Save Device. PUSHW D.DRV+INPDDB(A5) ; Save drive. PUSHW D.PPN+INPDDB(A5) ; Save PPN. PUSH D.FIL+INPDDB(A5) ; Save filename. CLR D.FIL+INPDDB(A5) ; Pre-clear file name. ; Check to make sure we have a device to print. ; JOBIDX ; Index the JCB. TSTW D.DEV+INPDDB(A5) ; Is there a DDB specified ? BNE 10$ ; Yes...use it. MOVW JOBDEV(A6), D.DEV+INPDDB(A5); No...use default device. MOVW JOBDRV(A6), D.DRV+INPDDB(A5); No...use default drive. ; Print device. ; 10$: PFILE INPDDB(A5) ; Display device. POP D.FIL+INPDDB(A5) ; Restore file name. TYPE <[> ; Start of ppn area. ; Check to see that we have a PPn to print ; TSTW D.PPN+INPDDB(A5) ; Is a PPN loaded ? BNE 20$ ; Yes...use it. PUSH A6 ; Save register. JOBIDX ; Index job. MOVW JOBUSR(A6), D.PPN+INPDDB(A5); No...use default. POP A6 ; Restore register. ; Print our PPn ; 20$: PRPPN D.PPN+INPDDB(A5) ; Print the PPN. TYPE <] > ; End of PPn display. POPW D.PPN+INPDDB(A5) ; Restore PPN. POPW D.DRV+INPDDB(A5) ; Restore Drive. POPW D.DEV+INPDDB(A5) ; Restore Device. PRTTAB -1, 12. ; Set Bright mode. MOVW #1, D1 ; Set row one. CALL LSTCOL ; Set last column. PRTTAB -1, 33. ; Turn reverse off. PRTTAB 4., 1 ; Set row 4 column 1 for display. 30$: RTN ; Return. PAGE ;***************** ; PAUSE * ;***************** ; ; Pause and wait for user input. ; PAUSE: CALL LSTROW ; Set up last row. MOVB #1, D1 ; Set up column. TCRT ; Output row & column. CMMW COUNT(A5), #0 ; Any folders displayed yet? JNE 10$ ; Yes...prompt user. TST FT.PAS(A5) ; Is pause set? JEQ 20$ ; No..bypass user input. DING ; Ring bell. PRTTAB -1, 11. ; Set dim. TYPE ; PRTTAB -1, 12. ; Set bright. TYPE ; PRTTAB -1, 11. ; Set dim. TYPE < found in this account. > PRTTAB -1, 12. ; Set bright. 10$: PRTTAB -1, 11. ; Set dim. TYPE < Press > ; PRTTAB -1, 12. ; Set bright. TYPE ; PRTTAB -1, 11. ; Set dim. TYPE PRTTAB -1, 12. ; Set bright. TYPE PRTTAB -1, 11. TYPE PRTTAB -1, 12. PRTTAB -1, 28. ; Turn cursor on. KBD ; Wait for any key. MOVB D1, LSTCHR(A5) ; Save last character input. CALL LSTROW ; Set up last row. MOVB #1, D1 ; Set up column. TCRT ; Output row & col PRTTAB -1, 9. ; Clear prompt. PRTTAB -1, 29. ; Turn cursor off. 20$: MOVW #-1, BEGRTN(A5) ; Set no longer first time through. RTN ; Return. PAGE ;***************** ; HELP * ;***************** ; ; Display user help. ; If FLDDIR.HLP is available on DSK0:[7, 1] or in users device & PPN ; then prompt user for availability of additional help. ; HELP: CRLF ; CR LF pair. PRTTAB -1, 11. ; Set dim. TYPE <%USAGE: > ; PRTTAB -1, 12. ; Set bright. TYPE ; PRTTAB -1, 11. ; Set dim. TYPE <{DeviceSpecification}{> CALL SLASH ; Output "/". TYPECR ; Output text. CRLF LEA A0, SWTDEF ; Point to switch table. LEA A1, SWTDES ; Point to switch descriptions. CALL CMDHLP ; Display CMDLIN switches. CRLF ; CR LF pair. LEA A2, HLPFIL ; Point to help file name. LEA A3, INPDDB(A5) ; Point to DDB. INIT @A3 ; Init lookup DDB. ORB #, D.FLG(A3); No errors. FSPEC @A3 ; Get filespec to DDB. CLR D.DVR(A3) ; Pre-clear driver address. LOOKUP @A3 ; Is help file in HLP:? BEQ 50$ ; Yes...Prompt user. CLRW D.DEV(A3) ; Clear device. CLRW D.DRV(A3) ; Clear drive. CLRW D.PPN(A3) ; Clear PPN. CLR D.DVR(A3) ; Clear driver address. LOOKUP @A3 ; Is help file in default account? BNE 99$ ; No...then no additional help. 50$: PRTTAB -1, 11. ; Dim. TYPE ; PRTTAB -1, 12. ; Set bright. TYPE PRTTAB -1, 11. ; Set dim. TYPE PRTTAB -1, 12. ; Set bright. PRTTAB -1, 28. ; Turn cursor on. CALL YNTEST ; Ask user for response. BNE 99$ ; Negative response, no help. PUSH A5 ; Save base address. LEA A2, HLPCMD ; Point to Help Command. AMOS ; Let AMOS handle system help. POP A5 ; Restore base address. 99$: JMP FINISH ; Finish out. PAGE ;+************************+ ; YNTEST * ;+************************+ ; Request a Y/N answer and return condition upon answer. ; ; Overview: ; ; Call this routine to request a Yes or No response. ; The job will be put in image mode, no echo and a Y ,N ,ESC ; or ^C is required before returning to caller. ; Y will return Z flag set. N, ESC, ^C will return Z flag clear. ; Terminal status will be returned to previous status. ; ^C will be cleared. ; ; Arguments: ; ; None required. ; ; Returned: ; ; Z-flag := Reset on N, ESC, or ^C (negative response). ; Set on Y (affirmative response). ; ; Dependencies: ; ; NOTE: Requires AMOS 1.3, uses GTLANG call. ; ; Side Effects: ; ; A6, D6, D7 may be destroyed. ; ; Example: ; ; CALL YNTEST ; Request a response. ; BNE 10$ ; Answer was negative. ; TYPE ; Positive answer. ; BR 20$ ; ; 10$: TYPE ; Negative answer. ; 20$: CRLF ; New line. ; (process the file...) ; ; Keyword Index: ; ; YESNO, Request Y/N response. ; ; ; User is required to respond with Y, N, ^C, or ESC. ; YNTEST: GTLANG A0 ; Get current language. 10$: KBD 20$ ; Allow ^C to get out. UCS ; Upper case D1. CMMB D1, LD.YCH(A0) ; Is response a "Y"? JEQ 30$ ; Yes...Set positive response. CMMB D1, LD.NCH(A0) ; Is response a "N"? BEQ 20$ ; Yes...Set negative response. CMPB D1, #$ESC ; Is response a ESCape key? BEQ 20$ ; Yes...Set negative response. DING ; Ring bell. BR 10$ ; Try again. 20$: LEA A0, LD.NO(A0) ; Point to No response. CALL OUTPYN ; Output response correctly. LCC #0 ; Set Negative response. BR 99$ ; Return. 30$: LEA A0, LD.YES(A0) ; Point to Yes response. CALL OUTPYN ; Output response correctly. LCC #PS.Z ; Set positive response. 99$: RTN ; Return. OUTPYN: PRTTAB -1, 12. ; Set bright mode. MOVB (A0)+, D1 ; Set up first character. TTY ; Output character. PRTTAB -1, 11. ; Set dim mode. 10$: MOVB (A0)+, D1 ; Get next character. LCS ; Make it lower case. TTY ; Output character. TSTB @A0 ; End of Y/N? BNE 10$ ; No..get next character. 99$: TYPE <.> ; Yes..correct grammer. PRTTAB -1, 12. ; Set bright mode. CRLF RTN ; Return to caller. PAGE ;***************** ; SLASH * ;***************** ; ; Output a "/". ; SLASH: MOVB #$SLASH, D1 ; Set up "/" TTY ; Output character. RTN ; Return. PAGE ;***************** ; FREBLK * ;***************** ; ; Count & display free blocks in FOLDER file. ; FREBLK: MOV INPDDB+D.FSZ(A5), D5 ; Get # blocks in the file. ADD #1, INPDDB+D.REC(A5) ; Point to MFD record (bitmap - 1). CLR D1 ; Preclear temp count. ; Read each record of the bitmap and determine the free space. ; 10$: ADD #1, INPDDB+D.REC(A5) ; Bump to next bitmap record. READ INPDDB(A5) ; Get the record buffered. MOV INPDDB+D.BUF(A5), A6 ; Index the buffer. MOV INPDDB+D.SIZ(A5), D2 ; Get the block size. LSR D2, #1 ; Divide by 2 for # of words. SUB #1, D2 ; Adjust word count for DBF loop. ; Cycle through all long words of this record. ; 20$: MOVW (A6)+, D0 ; Get next word of bitmap record. MOV #<16.-1>, D6 ; Init for # of bits, DBF adjusted. ; Count the bits in this long word. ; 30$: LSL D0, #1 ; Shift a bit to the left. BCS 40$ ; Don't count set bits. ADD #1, D1 ; Bump temp free count. 40$: SUB #1, D5 ; One less block to go. BEQ 90$ ; All done, break from loops. DBF D6, 30$ ; Loop for all bits. DBF D2, 20$ ; Loop for all lwords. BR 10$ ; Get another bitmap record. ; The number of free blocks has been computed into D1, display it. ; 90$: DCVT 6, OT$TRM!OT$ZER ; Output in 6 char field. RTN ; Return to caller. PAGE ;***************** ; NOFOLD * ;***************** ; ; Report no folders exist. ; NOFOLD: CRLF ; Cr linfeed pair. PRTTAB -1, 11. ; Dim Display. TYPE ; PRTTAB -1, 12. ; Bright display. TYPE PRTTAB -1, 11. ; Dim display. TYPE 99$: PRTTAB -1, 12. ; Bright. CRLF ; Cr linefeed pair. RTN PAGE ;***************** ; LSTCOL * ;***************** ; ; Set last possible column. ; LSTCOL: LSLW D1, #8. ; Set up row. MOVW TC.COL+TRMCAP(A5), D2 ; Get last column. MOVB D2, D1 ; Set up column. TCRT ; Output row & column. RTN ; Return. PAGE ;***************** ; LSTROW * ;***************** ; ; Set last possible row. ; LSTROW: MOVW TC.ROW+TRMCAP(A5), D1 ; Get last row. LSLW D1, #8. ; Set up last row. RTN ; Return for column number. ;+************************+ ; CMDHLP * ;+************************+ ; Display usage switch options for CMDLIN.SYS. ; Option names are taken from CMDLIN.SYS table and descriptions are ; taken from CMDLIN.SYS description table. Description table is not ; a required CMDLIN.SYS table, but takes on the same format and order ; to give a description of each switch option. ; ; Overview: ; ; Displays switch names and descriptions for CMDLIN.SYS options. ; ; Arguments: ; ; A0 -> Address of CMDLIN.SYS Option names. ; A1 -> Address of CMDLIN.SYS Option descriptions (not standard). ; ; Returned: ; ; None ; ; Dependencies: ; ; ; ; Side Effects: ; ; D0, D1, D7, A0, A1, are destroyed. ; ; Example: ; ; LEA A0, SWTDEF ; Point to Switch table. ; LEA A1, SWTDES ; Index switch desription data. ; CALL CMDHLP ; Display CMDLIN.SYS switches. ; JMP ALLDUN ; Exit program. ; {Rest of program.} ; ; Keyword Index: ; ; CMDLIN.SYS, Help display. ; CMDHLP: CLR D0 ; Preclear number of switches. MOVW @A0, D0 ; Get number of switches. SUB #1, D0 ; Set up for DBF. CLR D1 ; Clear d1 MOVW 10(A0), D1 ; Get address of switch names. ADD D1, A0 ; Point to switch names 10$: PRTTAB -1, 11. ; Dim. TYPE < > ; Offset display. MOVB #$SLASH, D1 ; Set up slash. TTY ; Output slash. PRTTAB -1, 12. ; Dim. 20$: MOVB (A0)+, D1 ; Get switch name. TTY ; Output character. TSTB @A0 ; End of switch name? BNE 20$ ; No..get next character. ADD #1, A0 ; Yes..bump to next switch. PRTTAB -1, 11. ; Dim. 30$: MOVB (A1)+, D1 ; Get switch description. TTY ; Output character. TSTB @A1 ; End of switch description? BNE 30$ ; No..get next character. ADD #1, A1 ; Yes..bump to next description. PRTTAB -1, 12. ; Dim. CRLF ; Output CRLF pair. DBF D0, 10$ ; Do this for number of switches. RTN ; Return to caller. PAGE ;***************** ; SWTDEF * ;***************** ; ; CMDLIN.SYS Switch definition table. ; ; ; SWTDEF: WORD 4 ; Four possible switches. WORD SWTTYP-SWTDEF ; TYPE of switch offset values. WORD SWTOFF-SWTDEF ; OFF offset values. WORD SWTON-SWTDEF ; ON offset values. WORD SWTTXT-SWTDEF ; TEXT values. SWTTYP: WORD SW$GLB ; HELP is a global switch. WORD SW$GLB ; CREATION is a global switch. WORD SW$GLB ; PAUSE is a global switch. WORD SW$GLB ; WIDE is a global switch. SWTOFF: LWORD FALSE ; All switches return 0 if off LWORD FALSE ; LWORD FALSE ; LWORD FALSE ; SWTON: LWORD TRUE ; ? is on/off. LWORD TRUE ; C is on/off. LWORD TRUE ; N is on/off. LWORD TRUE ; W is on/off. ; SWTTXT ASCIZ data is padded to be the same size so help display will ; be correctly registered. ; SWTTXT: ASCIZ /HELP / ; Asked for help. ASCIZ /CREATE/ ; Wants creation date display. ASCIZ /PAUSE / ; Pause on wildcard *.*[]. ASCIZ /WIDE / ; Wide screen display. ; SWTDES is not a CMDLIN.SYS requirement, although I use it to describe ; the actions in SWTTXT and SWTDES is also displayed on a /help option. ; SWTDES: ASCIZ / - Displays help./ ASCIZ / - Displays FOLDER creation date instead of free blocks./ ASCIZ / - Pause on accounts with no FOLDERS on wildcard *.*[]./ ASCIZ / - Display all possible label information (132 column)./ EVEN PAGE ;***************** ; DEFCMD * ;***************** ; ; Default command line. ; DEFCMD: ASCII /=*.FLD/ ; Look for folder files. BYTE $CR, 0 ; CR linefeed. EVEN ; Even up. PAGE ;******************************************************************** ; H E L P V A R I A B L E S A N D C O M M A N D * ;******************************************************************** ; ; HLPFIL: ASCII \HLP:FLDDIR.HLP\ BYTE 0 HLPCMD: ASCII \HELP FLDDIR\ BYTE $CR, $LF, 0 EVEN END .