.MCALL .MODULE .MODULE RESDEV,VERSION=13,COMMENT=,IDENT=NO ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SbTtl Edit History ;++ ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 WLD 16-NOV-90 Eliminate reference to C1.SJFB ; (FBMON$). ; 002 WLD 09-APR-92 For SHOW DEV:DU ; Use CLR/BISB for partition number. ; Expand MSCP unit and RT-11 partition ; fields displayed by one character. ;-- ; Edit History: ; 001 George Stevens Overlaid version of RESORC. Created from RESORC ; Version 97 ; 002 George Stevens Added code for SHOW DEVICE:MU ; 003 George Stevens Added code to SHOW DEVICE to display the installable ; status of a handler (Not KMON installable, ; Not BSTRAP installable) ; 007 George Stevens Added symbols for data tables - SPFUN SF.TAB,SF.MTB ; 009 George Stevens Added code to check handler revision and bypass ; some operations if pre V5.3 handler. ; (011) 04-Apr-91 MBG Fix for SHOW DEV:LS on PRO when SET LS MTTY is in ; effect ; .SbTtl Post Release Edit History ;+ ; ; (12/01) 22-Sep-1995 Megan Gentry ; Correction to SHO DEV:DU so that partitions are printed ; in decimal rather than octal (units are in decimal and ; argument for SET DU PART is decimal). ; 013 13-jan-1998 TDS Bump version number for RT 5.7 release ; ;- .NLIST .INCLUDE /SRC:RESPFX.MAC/ .LIST SF.TAB= 372 ; Disk data table SF.MTB= 352 ; Magtape data table .SBTTL DEVICE - List handler information ;+ ; This routine lists the vector and status of all handlers on a ; system. It does this by doing a .LOOKUP on all files of the form xx.SYS (or ; xxX.SYS if running under XM) and reading the .ASECT, and approriate use of ; .DSTATUS. ;- ORIGIN RESDEV .ENABL LSB DEVICE::MOVB #BLANK,HSTR1 ;Default to a blank for third character. .GVAL #AREA,#HSUFFX ;Get RAD50 suffix for this monitor BCS 50$ ;IF CS ERROR MOV R0,HSR ;SAVE THE RAD50 BEQ 40$ ;IF EQ YES CMP R0,#32 ;IS IT A LETTER? BLOS 10$ ;IF LOS YES ADD #22,R0 ;ASSUME # CMP #60,R0 ;IS IT A VALID #? BLO 50$ ;IF LO NO BR 30$ ;MERGE 10$: TST DDEV ;Has the user asked for a specific device? BEQ 20$ ;No, then continue. ADD R0,DDEV ;Yes, then add the suffix to the device name. 20$: ADD #100,R0 ;Convert to ASCII letter. 30$: MOVB R0,HSTR1 ;Fill in the third character. 40$: MOV #HNDLST,R2 ;Point R2 at handler name save area .LOOKUP #AREA,#0,#SYSDEV ;Non-file structured lookup on system device BCC 60$ ;Branch if no error 50$: CALLR SEVER ;Else call the error routine 60$: CALL GETFIL ;Point R1 at a filename BCS 80$ ;Branch if no more files TST DE.NM2(R1) ;Is the second half of the filename blank? BNE 60$ ;Branch if not... Can't be a handler CMP #<^RSYS>,DE.TYP(R1) ;Is the extension "SYS"? BNE 60$ ;Branch if not... Still not a handler TST DDEV ;Does he want only one device reported? BEQ 70$ ;No, then go report all. CMP DE.NM1(R1),DDEV ;Yes, then is this the one he wants. BNE 60$ ;No, continue looking. 70$: CALL MATCH1 ;Go see if it is xx.SYS (or xxX.SYS) BCS 60$ ;Branch if not MOV DE.NM1(R1),(R2)+ ;Save the name BR 60$ ; and go get any more that exist 80$: .PURGE #0 ;Clear the channel CLR @R2 ;Mark the end of the list MOV #HNDLST,R2 ;Point the the handler names TST @R2 ;Any there? BEQ 140$ ;Branch if not .PRINT #HNDHED ;Print the header 90$: MOV #DEFEXT,R3 ;Build the handler filename here MOV SYSDEV,(R3)+ ;All handlers are on the system device MOV @R2,(R3)+ ;Move in the name BEQ 150$ ;Branch if end of list CLR (R3)+ ;Second word is always 0 MOV #<^RSYS>,@R3 ;Filetype is always .SYS .LOOKUP #AREA,#0,#DEFEXT ;Lookup the handler BCC 100$ ;Branch if no error CALLR SEVER ;Else fatal "System error" 100$: MOV INBUFF,R4 ;Point to the input buffer MOV R4,BUFEND ;Save buffer end pointer .READW #AREA,#0,R4,#INBFSZ,#0 ;Read the first 2 blocks of the handler BCC 110$ ;Branch if no error $ERROR INE,LEVEL=FATAL,RETURN=YES,FILE=DEFEXT ;Give "Input error" BR 120$ ; and go do the next one 110$: MOV R0,-(SP) ;Save R0 DEC R0 ;Decrement word count ASL R0 ;Make it a byte count ADD R0,BUFEND ;Point to last word read MOV (SP)+,R0 ;Restore R0 CALL LSTDEV ;Go list the info 120$: .PURGE #0 ;Purge the channel. CMPB #MUID,DEVID ;Is it MU? BEQ 125$ ;Branch if so CMPB #DUID,DEVID ;Is it DU? BNE 130$ ;Branch if not 125$: TST DDEV ;Is this DEV:DU or DEV:MU? BEQ 130$ ;Branch if not CALL DUDEV ;Print the DU translation table CLRB DEVID ;Clear for next time 130$: TST (R2)+ ;Bump the pointer BR 90$ ;Branch... More to come 140$: TST DDEV ;Did he do dev/:nn? BEQ 150$ ;No, doing SHOW/dev .PRINT #AUDNSD ; Tell him no such device or file. RETURN 150$: .PRINT #CRLF ;SD RETURN .DSABL LSB .SBTTL DUDEV - List the DU/MU translation table ;+ ; List the PORT/UNIT/PART table for a handler with the DU ; device code. ; ; List the PORT/UNIT/JOB table for a handler with the MU ; device code. ; ; The format of the DU translation table is as follows: ; ; +-------------------------------+ ; | DU.ID | 2 word header ; +---------------+---------------+ ; | RESERVED | DU.NUM | ; +---------------+---------------+ ; | DU.UNI | 2 word entry ; +---------------+---------------+ up to 64. entries ; | DU.POR | DU.PAR | corresponding to RT-11 ; +---------------+---------------+ unit numbers 0 thru 77 octal ; ; DU.ID = Radix-50 value for characters DU ; DU.NUM = Byte containing number of entries in table ; DU.UNI = Physical MSCP unit number ; DU.PAR = Byte containing parition number ; DU.POR = Byte containing MSCP port (controller) number ;- .ENABLE LSB DUDEV:: CALL $SAVAL ;Save all regs CALL INIPTR ;Get address & size of device tables CLR DIRTY ;All ports available (for now) SUB HSR,DEFEXT+2 ;Remove handler suffix .DSTAT #DSAREA,#DEFEXT+2 ;Find the DU/MU handler BCS 20$ ;Branch if error TST DSAREA+4 ;Is it loaded? BNE 10$ ;Branch if so .FETCH HILMIT,#DEFEXT+2 ;Else load it BCS 20$ ;Branch on error 10$: .LOOKUP #AREA,#1,#DEFEXT+2,#-1 ;Open DU/MU BCS 20$ ;Branch if error MOV #SF.TAB,-(SP) ;Assume DU translation table CMPB #DUID,DEVID ;Is it DU? BEQ 15$ ;Branch if so MOV #SF.MTB,(SP) ;Use MU translation table 15$: .SPFUN #AREA,#1,(SP)+,#JBUF,#<64.+1>*2 ;Read in the table BCC 30$ ;Branch if no error 20$: CALLR SEVER ;Report severe error 30$: .PURGE #1 ;Close the handler .RELEAS #DEFEXT+2 ;Release the handler MOV DEFEXT+2,R0 ;R0 = device name (DU/MU) CALL INI64U ;Get dev index and init 64-unit info ;+ ; Setup for display loop ;- MOV #JBUF,R1 ;R1 -> translation buffer .PRINT #CRLF ;blank line TST (R1)+ ;skip ID CLR R2 ;Get unit count - BISB (R1)+,R2 ; no sign extension TSTB (R1)+ ;skip reserved byte ;+ ; Display DU/MU translation information loop ; ; R1 = pointer to DU/MU translation table entry ; R2 = number of entries in DU/MU translation table ; R3 = scratch ; R4 = scratch ; R5 = scratch ;- CLR UNIT ;Start at unit 0 40$: MOV R2,-(SP) ;Save table unit count CALL GENPHY ;Setup 1-char and 2-char dev names MOVB #' ,R2 ;Assume no asterisk MOV (R1)+,R3 ;R3 = MSCP unit CLR R4 BISB (R1)+,R4 ;R4 = partition MOVB (R1)+,R5 ;R5 = port BGE 50$ ;Branch if valid port BIC #177774,R5 ;Clear out all but two low bits MOVB #'*,R2 ;Move in an asterisk MOV SP,DIRTY ;Need footnote 50$: FORMAT #BUFFER,< [R]: is set PORT = [A*][O], UNIT = [U2]>,<#PHYNAM,#1,R2,R5,R3> CMPB #DUID,DEVID ;Is this SHOW DEVICE:DU? BNE 55$ ;Branch if not FORMAT ,<, PART = [U2]> 55$: .PRINT #BUFFER ;Print the buffer MOV (SP)+,R2 ;Restore table unit count DEC R2 ;Decrement unit count BEQ 60$ ;Exit if done with all units INC UNIT ;+ ; Exit loop after displaying first 8 units if monitor only supports 8 units. ;- CMP UNIT,UNITMX ;More units possible? BHIS 60$ ;Branch if not CMP R1,#JBUFE ;At end of buffer? BLO 40$ ;No, loop till done 60$: TST DIRTY ;Any missing ports? BEQ 70$ ;no FORMAT #BUFFER+10,< * Port unavailable> .PRINT #BUFFER+10 ; print final message 70$: RETURN .DSABL LSB .SBTTL GETFIL - Get a directory entry ;+ ; This routine points R1 at the next permanent file entry in the directory. ; If no directory segment has been read in yet, the first segment is read. ; If the next entry is the end of the segment, the next segment is read. ;- .ENABL LSB GETFIL::TST HISEG ;Have we got a segment? BNE 4$ ;Branch if yes 1$: MOV NXTDSE,RBLK ;Get the next directory segment BNE 2$ ;If NE then we're not at end SEC ;Flag no more entries BR 5$ ; and return to caller 2$: ASL RBLK ;Each directory segment is 2 blocks ADD #4,RBLK ;Offset to block 6 for 1st one MOV INBUFF,R1 ;Point R1 at the input buffer MOV R1,NXTFIL ;Set the pointer to the next file ADD #DH.SIZ,NXTFIL ;Skip the header words .READW #AREA,#0,R1,#INBFSZ,RBLK ;Read a directory segment BCC 3$ ;Branch if no error $ERROR ERD,LEVEL=FATAL,RETURN=NO 3$: MOV DH.EXB(R1),XTRABY ;Set the number of extra bytes MOV DH.NXT(R1),NXTDSE ;Set the next directory segment TST HISEG ;Is this the first segment? BNE 4$ ;Branch if not MOV DH.HI(R1),HISEG ;Else get the highest segment open 4$: MOV NXTFIL,R1 ;Point R1 at the next entry BIT #DS.EOS,@R1 ;Is this the end of segment BNE 1$ ;Brancg if yes ADD #DE.SIZ,NXTFIL ;Point to the next file entry for next loop ADD XTRABY,NXTFIL ;Don't forget extra bytes BIT #,@R1 ;Is it a permanent file? BNE 4$ ;Branch if not CLC ;Clear the carry bit 5$: RETURN .DSABL LSB .SBTTL MATCH1 - Check for a matching filename ;+ ; This routine sets up a call to MATCH to determine if the first word of ; a filename contained in DE.FN1(R1) matches the character string contained ; in HSTR. The carry bit is set if there is no match. ;- MATCH1::.SAVRG ;Save the volatile registers MOV R1,-(SP) ;Save R1 MOV R2,-(SP) ; and R2 MOV DE.NM1(R1),R0 ;Get the filename and set up for $R50AS MOV #ASCVRT,R1 ;Store the converted ASCII here MOV R1,R2 ;Save the pointer CALL $R50AS ;Convert one word from RAD50 to ASCII MOVB #BLANK,@R1 ;Mark the end of the string MOV #HSTR,R1 ;Point to the pattern string CALL MATCH ; and go do the pattern match MOV (SP)+,R2 ;Restore R2 MOV (SP)+,R1 ; and R1 SUB #1,R0 ;Set or clear C bit RETURN ; and return to caller .SBTTL MATCH - Pattern match routine ;+ ; This routine does a wildcard pattern match against an ASCII pattern string ; pointed to by R1 and a test string pointed to by R2. The matchable ; wildcards are: ; "%" => match any non-null, non-blank character ; "*" => match any string ; Both strings must end in an ASCII blank. ; If there is a match, R0 returns as >= 0. ; R1 and R2 are altered. ;- MATCH:: .SAVRG CLR R0 ;Assume failure MOV #BLANK,R4 ;An ASCII blank is often used 1$: MOVB (R1)+,R3 ;Get the next pattern character CMPB #'*,R3 ;Is it a "*"? BNE 2$ ;Branch if not CMPB @R1,R4 ;Are we at the end of the string? BEQ 3$ ;Branch if so. We have a match 2$: CMPB @R2,R4 ;Is this the end of the test string? BNE 4$ ;Branch if not CMPB R3,R4 ;At the end of the pattern string? BNE 6$ ;Branch if not. Return a level 3$: INC R0 ;Else it matched!!! BR 6$ ;Return a level 4$: CMPB R3,R4 ;Is this the end of the pattern string? BEQ 6$ ;Branch if so CMPB #'*,R3 ;Is the pattern character a "*"? BEQ 5$ ;Branch if so CMPB (R2)+,R3 ;Does test char match pattern char? BEQ 1$ ;Branch if yes CMPB #'%,R3 ;Is the pattern char a "%"? BEQ 1$ ;Branch if so. It matches. BR 6$ ;Else return to caller 5$: MOV R1,-(SP) ;Save R1 MOV R2,-(SP) ; and R2 CALL 1$ ;And call self!!!! MOV (SP)+,R2 ;Restore R2 MOV (SP)+,R1 ; and R1 TST R0 ;Did the strings match? BNE 6$ ;Branch if so CMPB (R2)+,R4 ;At the end of the test string yet? BNE 5$ ;Branch if not 6$: RETURN ;Return a level .SBTTL LSTDEV - List the device handler information ;+ ; This routine lists the handler information. ; Inputs: ; R2 -> the device name in RAD50 ; R4 -> INBUFF which contains the first 2 blocks of the handler ; R5 -> base of the RMON ; The handler file open on channel 0 ;- .ENABL LSB LSTDEV::.SAVRG ;Save the registers SUB HSR,@R2 ;SUBTRACT LAST CHARACTER ;SHD04 FORMAT #BUFFER,< [R] >, ;Put the handler name in buffer. MOV R0,-(SP) ;Save the buffer pointer .DSTAT #DSAREA+1,R2 ;Get the handler status information ; real devices/not logical names MOV (SP)+,R0 ;Restore R0 BCS 4$ ;Branch if not installed MOVB #BLANK,(R0)+ ;Else put a blank in the buffer MOVB DSAREA,DEVID ;Save the device id MOV DSAREA+4,R3 ;Get the handler entry point BEQ 6$ ;If equal, then not loaded CMP R3,R5 ;Is it resident? BLO 5$ ;Branch if not FORMAT , ;Handler is resident BR 9$ ;Continue 4$: CMPB $HDOPT(R4),$SYSGN(R5) ;Do the SYSGEN options match? BEQ 7$ ;Branch if yes MOVB #'-,(R0)+ ;Else mark it as not installable BR 8$ ;Not installed, if not installable! 5$: FORMAT ,<[B] >, ;Handler is loaded BR 9$ ; 6$: FORMAT , ;Handler is installed BR 9$ ; 7$: MOVB #BLANK,(R0)+ ;Else put a blank in the buffer CMP #^RHAN,(R4) ;Is this a pre-V5.3 handler? BNE 8$ ;Branch if so BIT #HS2.BI!HS2.KI,H.STS2(R4) ;Is handler KMON and BSTRAP installable? BEQ 8$ ;Branch if so BIT #HS2.KI,H.STS2(R4) ;Is handler KMON installable? BNE 72$ ;Branch if not FORMAT , ;Handler not installed BR 9$ 72$: BIT #HS2.BI,H.STS2(R4) ;Is handler BSTRAP installable? BNE 74$ ;Branch if not FORMAT , ;Handler not installed BR 9$ 74$: FORMAT , ;Handler not installed BR 9$ 8$: FORMAT , ;Handler is not installed 9$: CALL LSTVEC ;Go list the interrupt vector(s). .PRINT #BUFFER ;Print the line 10$: RETURN .DSABL LSB .SBTTL LSTVEC - List a handler's CSR and interrupt vector(s) ;+ ; This routine does the actual listing of the handler's CSR and vector(s). ; In cases of multiple vectored handlers (such as PC), it tracks the ; vector table down and prints all the vectors. ;- .ENABL LSB LSTVEC:: MOV $HDCSR(R4),R3 ;Get the CSR value BNE 1$ ;Found one CMP #^RHAN,(R4) ;Is this a pre-V5.3 handler BNE 1$ ;Branch if so MOV $DDCSR(R4),R3 ;Try a display CSR 1$: ;>>> add multiple CSR display in the future MOV $HDCQE(R4),DIRTY ;save possible HDCQE value ;>>> begin LS HACK for displaying PRO CSR and vector BIC #100000,DIRTY ;Insure "LS" bit is cleared MOV R0,-(SP) ;save buffer pointer CMPB #DEV.LS,$HDDST(R4) ;is this LS? BNE 2$ ;no MOV @#$SYPTR,R0 ;point to RMON BIT #C2.PC,$CNFG2(R0) ;Are we running on a PRO? BEQ 2$ ;no BIT #C2.BUS,$CNFG2(R0) BNE 2$ ;no ;Else, fake LS CSR now, and vector later MOV #LC.CSR,R3 ;;; BIS #100000,DIRTY ;mark for faking vector later 2$: MOV (SP)+,R0 ;restore R0 ;>>> end LS HACK for displaying PRO CSR and vector MOV $HDVEC(R4),R1 ;Get the vector or pointer BMI 3$ ;Branch if device multi-vectored FORMAT ,< [B] >, ;Put CSR value in the buffer. FORMAT ,< 00[O1]>, ;Put single vector in the buffer. BR 8$ ; and return 3$: CLR INCNT ;Clear the handler input block count CLR BASVEC ;Assume a fixed vector list MOV R3,BASCSR ;Save CSR MOV R0,R3 ;Save the output line buffer pointer ASL R1 ;Make the pointer a word offset and clear flag ADD #<$HDVEC+2>,R1 ;Point to table vector ADD R4,R1 ;Point to where the vector should be CALL ADJPTR ;Get data in buffer and make R1 point to it MOV R3,R0 ;R0 = the output line buffer pointer TST @R1 ;Is this a list of fixed vectors? BPL 6$ ;Branch if it is a fixed list TST (R1)+ ;Point to hardware device id CALL ADJPTR ;Get data in buffer and make R1 point to it MOV R3,-(SP) ;Save output line buffer pointer MOV @R1,-(SP) ;Get hardware device id MOV @#$SYPTR,R0 ;R0 -> $RMON MOV GETVEC(R0),R0 ;R0 -> $GTVEC CALL @R0 ;Find base vector of device MOV (SP)+,R3 ;R3 = base vector BCS 4$ ;If error, base vector remains zero MOV R3,BASVEC ;Update base vector 4$: MOV (R1)+,-(SP) ;Get hardware device id TST (R0)+ ;R0 -> $GTCSR CALL @R0 ;Find device CSR MOV (SP)+,BASCSR ;Save device CSR BCC 5$ ;Branch on success CLR BASCSR ;If error, set CSR to zero 5$: MOV (SP)+,R0 ;Restore output line buffer pointer 6$: MOV BASCSR,R3 ;R3 = CSR FORMAT ,< [B] >, ;Put CSR value in the buffer MOV R0,R3 ;Save output line buffer pointer 7$: CALL ADJPTR ;Get data in buffer and make R1 point to it ADD BASVEC,@R1 ;Add in base vector (0 if fixed vector list) BLE 8$ ;Branch if end of vectors FORMAT R3,< 00[O1]>,<@R1> ;Put the vector in the buffer MOV R0,R3 ;Save the buffer pointer ADD #$HDVTS,R1 ;Point to the next vector BR 7$ ;And continue 8$: ;;;;>>> begin LS HACK for displaying PRO vector ;;;;;; BIT #$HDVC2,DIRTY ;is there a second table? BIT #$HDVC2!100000,DIRTY ;is there a second table or is this LS? ;;; BMI 9$ ;LS on a PRO ;;;;>>> end LS HACK for displaying PRO CSR and vector BEQ 10$ ;no, done TST (R1)+ ;skip prev terminator CLR DIRTY ;Prevent recursion BR 7$ ;do next table ;;;;>>> more LS HACK for displaying PRO CSR and vector ;;;9$: ;;; MOV #LC.VEC,R1 ;first fake vector ;;; FORMAT R3,< 00[O1]>, ;Put the vector in the buffer ;;; MOV R0,R3 ;Save the buffer pointer ;;; MOV #LC.VEC+4,R1 ;first fake vector ;;; FORMAT R3,< 00[O1]>, ;Put the vector in the buffer ;;; MOV R0,R3 ;Save the buffer pointer ;;;;>>> end more LS HACK for displaying PRO CSR and vector 10$: RETURN ADJPTR: CMP BUFEND,R1 ;Is it in the buffer? BHIS 13$ ;Branch if it is SUB #INBFSZ*2,R1 ;Back the pointer off MOV INBUFF,BUFEND ;Reset the buffer end pointer ADD #INBFSZ/256.,INCNT ;Bump the input block count .READW #AREA,#0,R4,#INBFSZ,INCNT ;Read the next blocks of the handler BCS 11$ ;Branch if error DEC R0 ;Decrement word count ASL R0 ;Make it a byte count ADD R0,BUFEND ;Point to last word read BR ADJPTR ;Continue 11$: TSTB @#$EMTER ;What kind of error BNE 12$ ;Branch if hard input error CALLR SEVER ;Else end of file (we blew it) 12$: $ERROR INE,LEVEL=FATAL,RETURN=YES,FILE=DEFEXT ;Give "input error" CMP (SP)+,(SP)+ ;Return to DEVICE 13$: RETURN .DSABL LSB .END