.MCALL .MODULE .MODULE MSCPCK,VERSION=15,COMMENT=,AUDIT=YES ; 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. ;++ ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 WLD 10-OCT-1990 Check HW and FW revision ; levels on TUK50. ; 002 WLD 07-JUN-1991 Bypass HW and FW revision ; level checking for the RQZX1. ; 003 WLD 08-AUG-1991 Display information message for the ; RQZX1. ; 004 WLD 19-MAY-1992 Correct display of FW revision level. ; ; 005 WLD 19-MAY-1992 Use correct T/MSCP unit number in ; Get Unit Status Message. ; ; Edit History: ; ; 09 MSS 23-JUN-89 ; (i) Make the string PREFIX include the media type, ; e.g., TK50 or TK70 or TU81 so the user knows ; if he/she should worry about the firmware rev. ; level, anyway. ; ; (ii) Only print the string BADREV once, even if both ; revision numbers are too low, instead of printing ; it once if only one of the rev. numbers is two low ; and twice if both are. ; ; 10 JFW 31-Oct-1990 ; bracket error messages with ;+/;ERROR/.../;- ; 013 WFG 11-Jun-1991 ; ACTION #7479, Add "AUDIT=YES" to .MODULE line. ;-- ;+ ; This program will determine the hardware and firmware revision ; levels of your TK50 devices. For QBUS, the minimum acceptable ; firmware revision level is 4, and the minimum acceptable hardware ; revision level is 6. For UNIBUS, the minimum acceptable firmware ; revision level is 4, and the minimum acceptable hardware revision ; level is 2 ; ; To run this program, type RUN MSCPCK ;- .MCALL .CLOSE,.EXIT,.FETCH,.LOOKUP,.PRINT .MCALL .RELEASE,.SERR,.SPFUN .MCALL SOB .MCALL .CSTAT,.DSTAT SYSPTR =: 54 ;Pointer to base of RMON CONFG2 =: 370 ;Configuration word 2 QBUS$ =: 100 ;Flag set in CONFG2 if Qbus or busless PROS$ =: 20000 ;Flag set in CONFG2 if PRO or busless ERRBYT =: 52 ;User error byte SEQNUM =: -1 ;No rewind HWREVQ =: 6 ;QBUS Hardware revision level FWREVQ =: 4 ;QBUS Firmware revision level HWREVU =: 2 ;UNIBUS Hardware revision level FWREVU =: 4 ;UNIBUS Firmware revision level ; Spfun codes SF.BYP =: 360 ;Bypass SPFUN code ; MSCP communication area M.AREA =: 52. ;MSCP area length RSPLEN =: 48. ;Length of response area CMDLEN =: 48. ;Length of command area M.VID =: 0 ;MSCP virtual circuit id ; Command packet op codes OP.GUS =: 03 ;Get unit status OP.SCC =: 04 ;Set controller characteristics opcode OP.RD =: 41 ;Read command OP.WR =: 42 ;Write command OP.ONL =: 11 ;Online command ; Generic Command Message Offsets P.CRF =: 0 ;Command reference number P.UNIT =: 4 ;MSCP unit number P.OPCD =: 10 ;Opcode P.MOD =: 12 ;Modifiers P.BCNT =: 14 ;Byte count P.DEVD =: 34 ;Device dependent parameters P.BUFF =: 20 ;Buffer descriptor P.LBN =: 34 ;Logical block number P.PART =: 36 ;High order LBN P.CSIZ =: 60 ;48. bytes (total length: 24 words) ; GET UNIT STATUS End Packet Offsets P.MEDI =: 34 ;Media Identifier P.FORM =: 40 ;Tape format P.SPED =: 42 ;Speed P.FMEN =: 44 ;Format Menu ; SET Controller Characteristics End Message Offsets P.STS =: 12 ;Offset to status flags P.CSVR =: 22 ;Controller firmware version P.CHVR =: 23 ;Controller hardware version P.CNTI =: 24 ;Controller Identifier ; RQZX1 Model Number RQZX1 =: 30. ; Tape Identifier Values ; ; MU TA78 066550,010116 PE/GCR, 125 ips start/stop ; MU TK50 066550,130062 100 MB Cartridge Drive ; MU TA81 066550,010121 STI version of the TU81 PART1 = 066550 ;TK50 identifier, word 1 PART2 = 130062 ;TK50 identifier, word 2 MSCPCK: .SERR ;Intercept monitor errors 10$: .DSTAT #DEVSTA,DEVPTR BCS 20$ ;BR if MUn device status unavailable. TST DEVSTA+4 ;Does handler need FETCHing? BNE 30$ ;BR if no. .FETCH #HANLOD,DEVPTR BCC 10$ ;BR if handler FETCHed OK. TSTB @#ERRBYT ;PRINT FETCH error msg? BEQ 20$ ;BR if no. ;+ ;ERROR .PRINT #FETERR ;- 20$: JMP 140$ ;Go try next MUn. 30$: CMPB #50,DEVSTA ;Is device on DU? BNE 40$ ;BR if not. MOV #372,DEVTBC ;Use code=372 for UTT. .LOOKUP #EMTBLK,CHAN,DEVPTR BR 50$ 40$: CMPB #60,DEVSTA ;Is device on MU? BNE 60$ ;BR if not. MOV #352,DEVTBC ;Use code=352 for UTT. .LOOKUP #EMTBLK,CHAN,DEVPTR,#SEQNUM 50$: BCS 20$ ;BR if NFS LOOKUP failed. .CSTAT #EMTBLK,CHAN,#CHNSTA BCS 60$ ;BR if channel status not available. .SPFUN #EMTBLK,CHAN,DEVTBC,#DEVTBL,#1 BCS 60$ ;BR if UTT read failed. MOV CHNSTA+10,R1 ;Get UTT entry for RT-11 device unit. CMP R1,#15. ;Is physical unit number too big? BHI 60$ ;BR if yes. ASL R1 ASL R1 ADD #DEVTBL,R1 TST (R1)+ TST (R1)+ MOV @R1,DEVUNO ;Get MSCP unit number from UTT. CALL BLDPKT ;Initialize BYPASS area. MOV DEVUNO,P.UNIT(R2) ;Set T/MSCP unit number. MOV #OP.GUS,P.OPCD(R2) ;Set GUS with no modifiers. .SPFUN #EMTBLK,CHAN,#SF.BYP,#BUF,#0 BCC 70$ ;BR if success. CMPB @#ERRBYT,#1 ;Hard error? BEQ 60$ ;If yes, go get next channel number ;+ ;ERROR .PRINT #GUSERR ;- 60$: JMP 130$ ;Go try next MUn. 70$: MOV #RBUF,R2 ;Get start of response area (minus ;header words) MOV P.MEDI(R2),DEVNAM ;Save device MOV P.MEDI+2(R2),DEVNAM+2 ; identifier CALL BLDPKT ;Build another packet MOV #OP.SCC,P.OPCD(R2) ; Store the set controller char opcode .SPFUN #EMTBLK,CHAN,#SF.BYP,#BUF,#0 ;Issue EMT BCC 80$ ;+ ;ERROR .PRINT #SCCERR ;- BR 60$ 80$: MOV #RBUF,R5 ;Get start of response area (minus ;header words) MOV CHAN,R0 ;Make channel number into ASCII ADD #60,R0 ;Get channel number MOVB R0,UNIT MOV #4,R0 ;Set up calling sequence to BINDEC CLR R2 ;to convert 3 digits. BISB P.CSVR(R5),R2 ;Get firmware rev level MOV #FWL,R4 CALL BINDEC MOV #4,R0 ;Set up calling sequence to BINDEC CLR R2 ;to convert 3 digits. BISB P.CHVR(R5),R2 ;Get firmware rev level MOV #HWL,R4 CALL BINDEC MOV #DEVID,R4 ;Output device name in ASCII. CALL MEDI ;+ ;ERROR .PRINT #PREFIX ;Print FW level ;- CMPB P.CNTI+6(R5),#RQZX1 ;Is controller an RQZX1? BEQ 130$ ;BR if yes: just exit for now. CMP DEVNAM,#PART2 ;Is this a TK50? BNE 130$ ;if not, branch CMP DEVNAM+2,#PART1 ;Is it really a TK50? BNE 130$ ;If not, branch MOV @#SYSPTR,R4 ;R4= base of RMON BIT #,CONFG2(R4) ;Is this a UNIBUS machine? BEQ 110$ ;If yes, branch BIT #,CONFG2(R4) ;Is this busless? BNE 130$ ;If yes, branch CMPB P.CSVR(R5),#FWREVQ ;QBUS: above FW level 4? BHIS 90$ ;If yes, branch ;+ ;ERROR .PRINT #BADQRL ;Print error message ;- BR 130$ ;do not print same message twice 90$: CMPB P.CHVR(R5),#HWREVQ ;Is this above HW level 6? BHIS 130$ ;If yes, branch ;+ ;ERROR .PRINT #BADQRL ;No, print error message ;- BR 130$ ;BR to examine next channel. 110$: CMPB P.CSVR(R5),#FWREVU ;UNIBUS: above FW level 4? BHIS 120$ ;If yes, branch ;+ ;ERROR .PRINT #BADURL ;Print error message ;- BR 130$ ;do not print same message twice 120$: CMPB P.CHVR(R5),#HWREVU ;Is this above HW level 2? BHIS 130$ ;If yes, branch ;+ ;ERROR .PRINT #BADURL ;No, print error message ;- 130$: .CLOSE CHAN 140$: .RELEASE DEVPTR INC CHAN ;Set to use next channel. ADD #10,DEVPTR ;Set for next MUn. TST @DEVPTR ;Done? BEQ 150$ ;BR if yes. JMP 10$ ;JMP if not. 150$: .EXIT .DSABL LSB .SBTTL BLDPKT - Start building the MSCP command/response block BLDPKT: MOV #BUF,R0 ;Get the MSCP buffer address MOV #M.AREA,R2 ; R2 = size of MSCP block (to clear) 30$: CLR (R0)+ ; Clear location SOB R2,30$ MOV #BUF,R2 ; Get pointer to MSCP area MOV #RSPLEN,(R2)+ ; Store length of response area MOV #M.VID,(R2)+ ; Store virtual circuit id ADD #RSPLEN,R2 ; Point to start of command MOV #CMDLEN,(R2)+ ; Store length of command area CLR (R2)+ ; Store virtual circuit id RETURN .DSABL LSB .SBTTL MEDI - Translate DEVID into ASCII .ENABL LSB MEDI: MOVB #' ,4(R4) ; Ensure that fifth char is blank ; by default. MOV DEVNAM,R2 ; low word ; R0 = ddddeeeeennnnnnn MOV DEVNAM+2,R1 ; high word ; R1 = aaaaabbbbbcccccd MOV R2,-(SP) ; Make a copy ; R2 = ddddeeeeennnnnnn ROR R1 ; Move first char to bottom of high ; R1 = ?aaaaabbbbbccccc [d] ROR R2 ; R2 = dddddeeeeennnnnn [n] MOV R1,R0 CALL ALPHA ; Store first character ROR R2 ; shift high bit from low part ; R2 = ?dddddeeeeennnnn [n] ROR R2 ; shift high bit from low part ; R2 = ??dddddeeeeennnn [n] ROR R2 ; shift high bit from low part ; R2 = ???dddddeeeeennn [n] MOV R2,R1 ; make a copy ; R1 = ???dddddeeeeennn [n] SWAB R2 ; move to the bottom ; R2 = eeeeennn???ddddd MOV R2,R0 CALL ALPHA ; store second character ROR R1 ; R1 = ????dddddeeeeenn [n] ROR R1 ; R1 = ?????dddddeeeeen [n] ROR R1 ; R1 = ??????dddddeeeee [n] MOV R1,R0 CALL ALPHA ; Store third character MOV (SP)+,R0 ; get P.MEDI BIC #^C<177>,R0 ; R0 = 7-bit media number ; R0 = 000000000nnnnnnn CALL DECIMA ; Go convert the two numbers MOVB R1,(R4)+ ; Store first digit MOVB R2,(R4)+ ; Store next... RETURN .DSABL LSB .SBTTL ALPHA - Translate 5-bit value to ASCII character ; ALPHA translates a value in R0 to an alphabetic character. ; A value of ZERO indicates blank, but ALPHA skips blanks ALPHA: BIC #^C<37>,R0 ; mask low 5 bits of alpha value BEQ 100$ BIS #100,R0 ; make it ASCII MOVB R0,(R4)+ ; store character in user buffer 100$: RETURN .DSABL LSB .SBTTL DECIMA - Convert binary to 2-digit ASCII ;+ ; DECIMA - Converts a 7-bit binary to 2-digit ASCII ; ; On entry, R0 contains value to convert. ; On return, R1 contains the low digit, and R2 contains the high digit. ;- .ENABL LSB DECIMA: MOV R0,R2 ; R1 will hold low digit. CLR R1 ; R2 will hold high digit. 10$: INC R1 ; One more unit of 10. in high digit. SUB #10.,R2 ; Subtract it from low digit. BHIS 10$ ; Keep going till all units of 10. ; are gone from low digit. DEC R1 ; We did one unit of 10 too many ; so subtract if from high digit, ADD #10.+'0,R2 ; add it to low digit, & make ascii CMP R1,#10. ; R2 > 10? BLT 20$ ; Yes, we have two digit number.. CLR R1 ; No, this is error, make it 0. 20$: ADD #'0,R1 ; make high digit ascii, too RETURN .DSABL LSB .SBTTL BINDEC - Binary to decimal subroutine ; ENTRY: R2=BINARY NUMBER ; R4=ADDRESS TO OUTPUT TO ; R0=(5-NUMBER OF DIGITS TO OUTPUT)*2 [DECTBL DISPLACEMENT] ; EXIT: R3 AND R5 ARE PRESERVED ; R4 POINTS PAST LAST CHARACTER WRITTEN ; EVERYTHING ELSE DESTROYED BINDEC: ADD PC,R0 ;POINT TO CORRECT PLACE IN DECTBL ADD #DECTBL-.,R0 1$: MOV #'0-1,R1 ;FORM CHARACTER IN R1 2$: INC R1 ;START COUNTING SUB @R0,R2 ;FIND NUMBER OF SUBTRACTIONS FOR THIS POWER OF TEN BPL 2$ ;MORE TO FIND ADD (R0)+,R2 ;FIX NUMBER UP AND POINT TO NEXT POWER OF TEN IN DECTBL MOVB R1,(R4)+ ;MOVE THIS CHARACTER TST @R0 ;ARE WE DONE? BNE 1$ ;NO-GO MAKE A NEW CHARACTER RETURN DECTBL: .WORD 10000.,1000.,100.,10.,1,0 ;POWERS OF TEN TABLE EMTBLK: .BLKW 8. CHAN: .WORD 0 DEVPTR: .WORD DEVLST DEVLST: .RAD50 /MU0/ .WORD 0,0,0 .RAD50 /MU1/ .WORD 0,0,0 .RAD50 /MU2/ .WORD 0,0,0 .RAD50 /MU3/ .WORD 0,0,0 .WORD 0 DEVSTA: .BLKW 4 DEVTBC: .BLKW 1 DEVTBL: .BLKW 2+<2*16.> CHNSTA: .BLKW 6 DEVUNO: .BLKW 1 DEVNAM: .BLKW 2 ;Save the device identifier from the GUS command BUF: .BLKW 2 ;Response buffer header RBUF: .BLKB 60 ;Response buffer start .BLKW 2 ;Command buffer header CBUF: .BLKB 60 ;Command buffer start ;Error messages .NLIST BEX ;+ ;ERROR GUSERR: .ASCIZ /?MSCPCK-W-Get Unit Status error/ SCCERR: .ASCIZ /?MSCPCK-W-Set Controller Char error/ FETERR: .ASCIZ /?MSCPCK-F-MU cannot be fetched/ SPERR: .ASCIZ /?MSCPCK-W-C set on SPFUN return/ BADQRL: .ASCIZ "?MSCPCK-W-TQK50 controller below FW Rev 4/HW Rev 6" BADURL: .ASCIZ "?MSCPCK-W-TUK50 controller below FW Rev 4/HW Rev 2" DUNAM: .ASCII /DU/ ; This is one complete error message, and must stay together PREFIX: .ASCII /?MSCPCK-I-/ UNAM: .ASCII /MU/ UNIT: FWREVM: .ASCII " -" DEVID: .ASCII "TXXXX" .ASCII " FW Rev Level is " FWL: .BLKB 3 HWREVM: .ASCII "/HW Rev Level is " HWL: .BLKB 3 .ASCIZ / / ;- ;end of error message .LIST BEX .EVEN HANLOD: ;Start loading handler here .END MSCPCK