.TITLE MT(TM-11) RSP-MT PSEUDO-MAGTAPE HANDLER .IDENT /V05.1/ .ENABL LC ; Multiprocessor V5 ; COPYRIGHT (c) 1985 by ; H.H. Klin. Neuro. AZG ; ; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE ; ; Handler-Queue of communcations handler contains pointers to handler ; blocks with the following format: ; ----------------------------------------- ; HDBLK: ! SPFUN CODE 0-377 ! UNIT NR. 0-377 ! ; ----------------------------------------- ; ! Q-ELEMENT POINTER ! ; ----------------------------------------- ; ! RETURN ADRES ! ; ----------------------------------------- ; ! SPFUN DATA ! ; ----------------------------------------- TEST = 0 ;1 enables TEST code CONSOL= 177564 ;XT-console for TEST messages .IIF NDF,TIM$IT TIM$IT= 1 ;Default TIME-OUT support! .IIF NDF,MMG$T MMG$T = 1 ;Default XM support ; >>>> NOTE: this handler can adapt to non-XM with SET XX SYSGEN ! <<<< ; DEFAULTs, may be changed with SET command: ; ======= UNITST = 14. ;Value of first unit nr. of this device UNITNR = 1 ;Total number of units for " " PD$VEC = 270 ;Vector of datacommunication handler(DR=310, WB=270, QN=170) ;======================== Handler header ============================; .MCALL .DRDEF,.PRINT .DRDEF MT,11,SPECL$!SPFUN$,0,0,0 ;======================== Handler SET's =============================; .DRSET SHOW,-1,S.SHOW ;;SHOW .DRSET RSPVEC,477,S.VEC,OCT ;;Vector DC-handler .DRSET UNITS, 7 ,S.US, ;;Set total device unit nrs. .DRSET UNIT0,15.,S.U0, ;;Set RSP UNIT start number .DRSET SYSGEN,-1,S.SYS ;;Set SYSGEN bits NR = 4 ;Total nr. of numbers to be printed. S.SHOW: MOV R4,-(SP) MOV R5,-(SP) MOV PC,R4 ADD #NUMBER-.,R4 MOV PC,R5 ADD #TEXT-.,R5 MOV #NR,R1 MOV PC,R2 ADD #OUTP-.,R2 LOOP: MOV (R4)+,R0 MOV R2,R3 CALL CNV8 .PRINT R5 .PRINT R2 ADD #8.,R5 SOB R1,LOOP MOV PC,R0 ADD #TAIL-.,R0 .PRINT MOV (SP)+,R5 MOV (SP)+,R4 CLC RETURN S.VEC: MOV R0,PDVEC MOV R0,NUMBER ;For SHOW BR ZZZZ S.US: MOV R0,UNITS ;Set No. DEVICE UNITs MOV R0,US ; and for SHOW BR ZZZZ S.U0: CMP R0,R3 BHI ZZZZ ;Not too high! MOV R0,UNIT0 ;Set RSP UNIT START. MOV R0,U0 ;for SET SHOW ZZZZ: CMP R3,R0 RETURN RMON = 54 SYSOP = 372 S.SYS: MOV @#RMON,R3 MOV SYSOP(R3),60 ;SYSGEN options RETURN NUMBER: .WORD PD$VEC .WORD MTSTS U0: .WORD UNITST US: .WORD UNITNR TEXT: .ASCII <12>/RSPvc=/<200> .ASCII /Status=/<200> .ASCII /Unit0 =/<200> .ASCII /Units=/<200> OUTP: .BLKB 9. TAIL: .ASCIZ / MAGTAPE/ .EVEN ; Routine converts bits to octal ASCII string. ; R0; Contains bits to be converted ; R3; Points to output area ; Size of area should be nr. digits plus two ; On return R3 points to string terminator ; Note: Contens of R0, R3 is changed!! CNV8:: MOV R1,-(SP) CALL CONVRT MOVB #' ,(R3)+ MOVB #200,@R3 MOV (SP)+,R1 RETURN CONVRT: MOV R0,R1 CLR R0 DIV #8.,R0 MOV R1,-(SP) TST R0 BEQ DONE CALL CONVRT DONE: MOVB (SP)+,@R3 BISB #'0,(R3)+ RETURN .IIF GT <.-1000>, .ERROR .-1000 ;SET code too big! .SBTTL SOFTWARE DEFINITIONS RENAME = 5 ENTER = 4 ; send 3 w. LOOKUP = 3 ; send 3 w. DELETE = 2 CLOSE = 1 REDWRT = 0 WRTEOF = -1 ;write tapemark FWDSPC = -2 ;go forward, wcnt=nr. blocks BKSPC = -3 ;go backward, wcnt=nr. blocks WTXTD = -4 ;write extended, send 256. REWIND = -5 ;rewind OFFLINE = -6 ;rewind+off-line WTPHY = -7 ;write send 256.*X = Q$WCNT RDPHY = -8. ;read recv 256.*X = Q$WCNT ASYN = -20. ;asynchro. directory SPUSR = 272 CSWHRD = 1 CSWEOF = 20000 MONLOW = 54 QCOMP = 270 .SBTTL DRIVER ENTRY .DRBEG MT RESTRT: CLR ABOFLG ;Reset abort flag. .IF NE,TEST MOVB #'B,R1 ;****TEST**** Identification CALL QPRINT ;****TEST**** .ENDC CLR R3 ;Initialize SPDATA to 0 MOV MTCQE,R4 TSTB Q$FUNC(R4) BEQ RDWT ;Read/write only. BMI SPFUN ;Special function call DIREC: CLR Q$WCNT(R4) CMPB Q$FUNC(R4),#CLOSE BEQ MAKEHD CMPB Q$FUNC(R4),#LOOKUP BEQ LKPMT CMPB Q$FUNC(R4),#ENTER BNE MTERR ;Hard error LKPMT: MOV #-3,Q$WCNT(R4) BR MAKEHD SPFUN: MOV Q$WCNT(R4),R3 ;Save WCNT for SPDATA CLR Q$WCNT(R4) ;Init, each SPF decides for itself. CMPB Q$FUNC(R4),#FWDSPC ;-2 BEQ MAKEHD CMPB Q$FUNC(R4),#BKSPC ;-3 BEQ MAKEHD CMPB Q$FUNC(R4),#WTXTD ;-4 BNE 3$ MOV #-256.,Q$WCNT(R4) BR MAKEHD 3$: CMPB Q$FUNC(R4),#WTPHY ;-7 BNE 4$ MOV R3,Q$WCNT(R4) ;SPFUN supplies positif word count! NEG Q$WCNT(R4) ;Make negatif, so to send data. BR MAKEHD ;-7 used by CP copy program. 4$: CMPB Q$FUNC(R4),#RDPHY ;-8. BNE 5$ MOV R3,Q$WCNT(R4) BR MAKEHD 5$: CMPB Q$FUNC(R4),#ASYN ;-20. BNE 6$ MOV #-6,Q$WCNT(R4) ;Send filename. BR MAKEHD 6$: CMPB Q$FUNC(R4),#REWIND ;-5 BEQ MAKEHD CMPB Q$FUNC(R4),#OFFLINE ;-6. BEQ MAKEHD CMPB Q$FUNC(R4),#WRTEOF ;-1. BNE MTERR ;That were all SPF's BR MAKEHD ; Standard read/write RDWT: TST Q$WCNT(R4) BEQ MTDONE ; Set up HDBLK for this handler. MAKEHD: MOV PC,R2 ;PIC ADD #HDBLK-.,R2 ; of Handler block MOV R2,R0 ;R0 must contain pointer to HDBLK CLR R1 BISB Q$FUNC(R4),R1 ;Get SPFUN code SWAB R1 BISB Q$UNIT(R4),R1 ;Get device UNIT nr. BICB #^C<7>,R1 ;strip to 0-7 CMPB UNITS,R1 ;Valid number? BLOS MTERR ADD UNIT0,R1 ;Make new unit number. MOV R1,(R2)+ ;copy unitnr. in HDBLK MOV R4,(R2)+ ; " Q-pointer " " MOV PC,R1 ADD #MTFIN-.,R1 MOV R1,(R2)+ ;copy return adress in HDBLK MOV R3,(R2) ;SPFUN data word in HDBLK. ; BR MTFIN ;*****TEST****** MOV @PDVEC,R5 ;Get where SYS-handler is. BEQ MTERR ;PD: should be loaded! TST -(R5) ;jump back over abort entry PD JMP -(R5) ;JUMP to SYS-H body. UNIT0: .WORD UNITST ;RSP device unit start nr. UNITS: .WORD UNITNR PDVEC: .WORD PD$VEC HDBLK: .BYTE 0 ;FUNC RSPUNT: .BYTE 0 ;UNITNR .WORD 0,0 ; Q-pointer, RET adres SPDATA: .WORD 0 .SBTTL Abort and Interrupt service: ABORT: INC ABOFLG MOV @PDVEC,R5 ;Get where DC-handler is. JMP -(R5) ;JUMP to abort entry of DC/SYS body. ABOFLG: .WORD 0 BR ABORT ;Abort entry of MT MTINT:: .SBTTL OPERATION COMPLETE MTERR: BIS #HDERR$,@-(R4) BR MTEXIT MTDONE: MTFIN: MOV MTCQE,R4 TST ABOFLG BEQ 1$ CMPB #CLOSE,Q$FUNC(R4) ;Last operation was CLOSE? BEQ 1$ ;BR if so MOVB #CLOSE,Q$FUNC(R4) ;^C^C then do a CLOSE to free MAGTAPE JMP RESTRT 1$: TSTB Q$FUNC(R4) BEQ MTCTRL ;Directory error? BMI MTSPFN MOV @#MONLOW,R4 MOV @SPDATA,SPUSR(R4) ;Special directory error return. BR MTEXIT MTSPFN: CMP Q$BLKN(R4),#1000 ;Error return adres specified? BLO MTCTRL MOV Q$BLKN(R4),R5 MOV @SPDATA,(R5)+ ;OK then give 1 st error word. ADD #2,SPDATA MOV @SPDATA,(R5) ;OK then give 2 nd error word. ; MTCTRL: BIT #CSWEOF,@Q$CSW(R4) ;EOF bit set? BEQ MTEXIT BIC #CSWHRD,@Q$CSW(R4) ;Then clear hard error bit! MTEXIT: .IF NE,TEST MOV R1,-(SP) ;****TEST**** MOVB #'F,R1 ;****TEST**** Identification CALL QPRINT ;****TEST**** MOV (SP)+,R1 ;****TEST**** .ENDC .DRFIN MT ; .IF NE,TEST .SBTTL Print Q-element subroutine QPRINT: MOV R0,-(SP) MOV R2,-(SP) MOV R3,-(SP) MOV R4,-(SP) MOV R5,-(SP) MOV MTCQE,R2 ;Get pointer to Q-element MOV PC,R3 ADD #PRIBLK-.,R3 ;Get address of output area ; MOVB #'C,(R3)+ MOV @Q$CSW(R2),R0 ;Get Channel Status Word CALL CNVOCT ;Convert to octal nr. ; MOVB #'K,(R3)+ MOV Q$BLKN(R2),R0 ;Get physical BLocK nr. CALL CNVDEC ;Convert to decimal nr. ; ; MOVB #'F,(R3)+ MOVB Q$FUNC(R2),R0 ;Get special function code CALL CNVDEC TSTB Q$FUNC(R2) ;Get special function code BPL 50$ ; MOVB #'@,(R3)+ MOV @Q$BLKN(R2),R0 ;Get physical BLocK nr. CALL CNVDEC ;Convert to decimal nr. MOVB #'@,(R3)+ MOV Q$BLKN(R2),R0 ;Get physical BLocK nr. TST (R0)+ MOV (R0),R0 CALL CNVDEC ;Convert to decimal nr. BR 100$ ; 50$: MOVB #'U,(R3)+ MOVB Q$JNUM(R2),R0 ;Get job and unit nr. BIC #177770,R0 ;Get unit nr. CALL CNVDEC ; MOVB #'J,(R3)+ MOVB Q$JNUM(R2),R0 ASH #-3,R0 ;Shift out unit nr. BIC #177761,R0 ;Get job nr. CALL CNVDEC ; 100$: MOVB #'B,(R3)+ MOV Q$BUFF(R2),R0 ;Get user buffer address CALL CNVOCT ; MOVB #'W,(R3)+ MOV Q$WCNT(R2),R0 ;Get Word CouNT CALL CNVDEC ; MOVB #'S,(R3)+ MOV @#MONLOW,R2 MOV SPUSR(R2),R0 ;Get special device error word in R0 CALL CNVOCT MOVB #' ,(R3)+ MOVB R1,(R3)+ ;Identification CLRB @R3 MOV PC,R1 ADD #PRIBLK-.,R1 ;PIC-code!!!!!!!!!! TYPE: TSTB @#CONSOL ;Can we print it? BPL TYPE TSTB @R1 BEQ 1$ MOVB (R1)+,@#CONSOL+2 BR TYPE 1$: MOVB #12,@#CONSOL+2 2$: TSTB @#CONSOL BPL 2$ MOVB #15,@#CONSOL+2 3$: TSTB @#CONSOL BPL 3$ ; MOV (SP)+,R5 MOV (SP)+,R4 MOV (SP)+,R3 MOV (SP)+,R2 MOV (SP)+,R0 RETURN .SBTTL Routine converts bits to decimal ASCII string. ; .TITLE CONVER ; ; Routine converts bits to decimal or octal ASCII string. ; ; R0; Contains bits to be converted ; R3; Points to output area ; Size of area should be nr. digits plus one ; for the string terminator. ; On return R3 points to string terminator!! ; ; Note: Contens of R0, R3, R4 and R5 is changed!! ; Contens of R1 and R2 is saved and restored!! ; FORMAT=8. ;Formatted output??? (I9). FORMAT=FORMAT-1 .IIF LT,FORMAT-6 FORMAT=6 CNVDEC: ;Convert bits to decimal number MOV R2,-(SP) ;Save contens of R2 MOV #10.,R2 ;Do base 10 output MOV R0,R5 BGE GOOO .IIF NDF FORMAT,MOVB #'-,(R3)+ NEG R0 BR GOOO CNVOCT: ;Convert bits to octal number MOV R2,-(SP) ;Save contens of R2 MOV #8.,R2 ;Do base 8 output CLR R5 GOOO: MOV R1,-(SP) ;Save contens of R1 .IIF DF FORMAT,CLR R4 ;Clear char. counter CALL CONVRT CLRB @R3 ;Terminate ASCII string MOV (SP)+,R1 ;Restore R1 and MOV (SP)+,R2 ; R2 RETURN CONVRT: MOV R0,R1 ;Copy number to convert CLR R0 DIV R2,R0 ;Divide by current radix MOV R1,-(SP) ;Save remainder .IIF DF FORMAT,INC R4 ;Count one char. TST R0 ;Anything left to convert? BEQ 1$ ;If EQ no CALL CONVRT ;Else recur 1$: .IF DF FORMAT NEG R4 BEQ 30$ ADD #FORMAT,R4 ;Calculate nr. of blanks BLE 15$ ;No blanks 10$: MOVB #' ,(R3)+ ;Leading blank(s) in output area SOB R4,10$ 15$: TST R5 ;Was value negative BLT 20$ ;Yes it was MOVB #' ,(R3)+ ;No, a blank will do BR 30$ 20$: MOVB #'-,(R3)+ ;Indicate negative value 30$: .ENDC MOVB (SP)+,@R3 ;Move binary byte to output area BISB #'0,(R3)+ ;And make ASCII RETURN PRIBLK: .BLKB 82. ;Print block for Q-elements ;--------------------------------------------------------------------------; .ENDC .DREND MT .END