Trailing-Edge
-
PDP-10 Archives
-
BB-4170G-SM
-
sources/phyh2.mac
There are 52 other files named phyh2.mac in the archive. Click here to see a list.
;<3A-NEW>PHYH2.MAC.71, 25-May-78 11:42:23, Edit by FORTMILLER
;ADD CODE FOR DX20
;<3A.MONITOR>PHYH2.MAC.70, 27-Mar-78 18:52:40, EDIT BY BOSACK
;ENSURE NONSKIP RETURN FROM CKERR UNDER ALL ERROR CONDITIONS
;<3A.MONITOR>PHYH2.MAC.69, 23-Mar-78 15:04:40, EDIT BY MILLER
;ADD SOME MORE
;<3A.MONITOR>PHYH2.MAC.68, 23-Mar-78 14:56:51, EDIT BY MILLER
;ADD SOME OPTIONAL DATA TO SOME OF THE BUGCHKS
;<3A.MONITOR>PHYH2.MAC.67, 11-Mar-78 21:05:01, Edit by MCLEAN
;REMOVE CODE THAT DISABLES A CHANNEL IF IT HAS NO UNITS. THIS
;IS FOR THE NEW CODE THAT BRINGS UNITS ON LINE WHEN THEY APPEAR.
;<3A.MONITOR>PHYH2.MAC.66, 8-Mar-78 22:41:59, EDIT BY OPERATOR
;<2BOSACK>PHYH2.MAC.62, 24-Feb-78 01:21:06, EDIT BY BOSACK
;FLAG DEVICE (NOT DATA) ERROR ON CHANNEL ERROR
;<4.MONITOR>PHYH2.MAC.64, 1-Feb-78 14:50:42, Edit by MCLEAN
;FIX PHYALC FOR NEW CALLING SEQ
;<1MCLEAN>PHYH2.MAC.63, 30-Jan-78 21:29:04, Edit by MCLEAN
;ADDITIONS FOR SELECTING UNIT THAT COMES ON LINE
;<3-MONITOR>PHYH2.MAC.61, 30-Nov-77 17:13:51, EDIT BY BOSACK
;CHANGE RH20 RESET ON ERROR FOR M8557 ECO
;<3-MONITOR>PHYH2.MAC.60, 9-Nov-77 09:56:35, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<2BOSACK>PHYH2.MAC.59, 13-Oct-77 01:53:24, EDIT BY BOSACK
;ENABLE COMMAND STACKING
;<3-MONITOR>PHYH2.MAC.58, 12-Oct-77 14:08:34, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<2BOSACK>PHYH2.MAC.57, 21-Sep-77 21:04:45, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.56, 19-Sep-77 01:07:37, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.55, 18-Sep-77 05:34:32, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.54, 16-Sep-77 00:36:24, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.53, 15-Sep-77 05:14:25, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.52, 13-Sep-77 03:12:48, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.51, 10-Sep-77 20:10:52, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.50, 9-Sep-77 12:28:54, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.49, 6-Sep-77 11:04:26, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.48, 6-Sep-77 04:34:39, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.47, 6-Sep-77 01:48:41, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.46, 4-Sep-77 02:31:33, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.45, 4-Sep-77 00:11:54, EDIT BY BOSACK
;DONT LOAD IVIR IN CLRCHL - DO IT IN RST
;<2BOSACK>PHYH2.MAC.44, 28-Jul-77 03:06:39, EDIT BY BOSACK
;CLEAR SEEK ERROR FLAG IN P4 BEFORE RETURNING TO PHYSIO
;<2BOSACK>PHYH2.MAC.43, 19-May-77 22:46:30, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.42, 19-May-77 17:04:26, EDIT BY BOSACK
;TCO 1800 - STORE CDBS IN CHNTAB INDEXED BY CHAN ADDR
;<3-MONITOR>PHYH2.MAC.41, 12-May-77 20:44:29, EDIT BY BOSACK
;<3-MONITOR>PHYH2.MAC.40, 12-May-77 17:02:47, EDIT BY BOSACK
;<3-MONITOR>PHYH2.MAC.39, 2-May-77 18:48:04, EDIT BY HURLEY
;<2BOSACK>PHYH2.MAC.38, 3-Apr-77 17:51:34, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.37, 1-Apr-77 22:01:25, EDIT BY BOSACK
;<2BOSACK>PHYH2.MAC.36, 1-Apr-77 21:24:52, EDIT BY BOSACK
;ADD BLOCKTYPE CODE, CODE FOR TM03, TU77
;<2BOSACK>PHYH2.MAC.35, 30-Mar-77 22:19:10, EDIT BY BOSACK
;FIX REFERENCE TO PHYSICAL CCW ADDRESS TO MAP PAGE FIRST
;<3-MONITOR>PHYH2.MAC.34, 9-Feb-77 15:39:42, EDIT BY BOSACK
;CHANGES TO USE RESIDENT FREEPOOL - MAP CCW LIST ADDRESS IN CHSTRT
;<3-MONITOR>PHYH2.MAC.33, 27-Dec-76 17:35:43, EDIT BY HURLEY
;<3-MONITOR>PHYH2.MAC.32, 27-Dec-76 17:27:21, EDIT BY HURLEY
;<2BOSACK>PHYH2.MAC.30, 19-Dec-76 15:05:07, EDIT BY BOSACK
;TCO 1684 - CAUSE BLKCNT TO ROUND UP ON STRANGE CCW LISTS
;<3-MONITOR>PHYH2.MAC.31, 26-Nov-76 03:48:07, Edit by MCLEAN
;<2BOSACK>PHYH2.MAC.29, 1-Nov-76 20:06:27, EDIT BY BOSACK
;FIX BLKCNT TO ACCOUNT FOR RS04 64WD SECTORS
;<2BOSACK>PHYH2.MAC.28, 6-Sep-76 06:58:51, EDIT BY BOSACK
;FIX PREPARATION REGISTER RESTORE
;<1B-MONITOR>PHYH2.MAC.27, 3-MAY-76 11:42:11, EDIT BY BOSACK
;<1B-MONITOR>PHYH2.MAC.26, 29-APR-76 16:13:44, EDIT BY BOSACK
;TCO 1270 - ADD RP05/6 SUPPORT
;<1B-MONITOR>PHYH2.MAC.25, 1-APR-76 16:37:56, EDIT BY HURLEY
;TCO # 1230 - FIX SPELLING ERRORS IN BUGCHK MESSAGES
;<2MONITOR>PHYH2.MAC.24, 30-MAR-76 03:08:46, EDIT BY BOSACK
;<2MONITOR>PHYH2.MAC.23, 30-MAR-76 02:52:55, EDIT BY BOSACK
;TCO 1269 - ADD RP05/6 SUPPORT
;<2MONITOR>PHYH2.MAC.21, 5-JAN-76 18:13:41, EDIT BY BOSACK
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976, 1977, 1978 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SEARCH PROLOG ;PARAMETER FILE
TTITLE (PHYH2,,< - CHANNEL DEPENDENT CODE FOR RH20 CONTROLLER>)
SUBTTL T. HESS, T. WACHS, L. BOSACK/LB 29-JUL-75
SEARCH PHYPAR ;PHYSIO PARAMETERS
SUBTTL PARAMETERS
;RH20 REGISTERS
DO.BA2==70B5 ;SECONDARY BLOCK ADDRESS
DO.CT2==71B5 ;SECONDARY TRANSFER CONTROL
DO.BA1==72B5 ;PRIMARY BLOCK ADDRESS
DO.CT1==73B5 ;PRIMARY TRANSFER CONTROL
DO.IVI==74B5 ;INTERRUPT VECTOR INDEX
DO.RDR==75B5 ;READ REGISTER
DO.WTR==76B5 ;WRITE REGISTER
DO.DIA==77B5 ;DIAGNOSTIC CONTROL REGISTER
;DEVICE INDEPENDENT REGISTERS
DO.AS==4B5 ;ATTENTION SUMMARY REGISTER
DO.DA==5B5 ;DESIRED ADDRESS REGISTER
DO.DT==6B5 ;DRIVE TYPE REGISTER
DO.LR==1B6 ;LOAD REGISTER ENABLE
DO.DRE==1B9 ;DISABLE RAE STOP
;BITS IN DATAO STCR
DO2RCP==1B7 ;RESET CHANNEL PC
DO2SCS==1B10 ;STORE CHANNEL STATUS
;COMMON DATAI BITS
DI.CPE==1B8 ;CONTROL BUS PARITY ERROR
DI.TRA==1B10 ;TRA (MASSBUSS SIGNAL)
;DEVICE DEPENDENT DEFINITIONS IN THE CDB
RH2CNI==CDBDDP+0 ;CONI RH2,T1
RH2CNO==CDBDDP+1 ;CONO RH2,T2
RH2DTI==CDBDDP+2 ;DATAI RH2,T1
RH2DTO==CDBDDP+3 ;DATAO RH2,T2
L.RH2==CDBDDP+4-CDBINT ;LENGTH OF RH20 CDB
RH2.0==540B11 ;DEVICE CODE OF FIRST RH20
RH2.7==574B11 ;DEVICE CODE OF LAST RH20
RH2.I==0 ;EPT ADDRESS OF FIRST RH20
CHXFR==1B0 ;INDICATE XFER WORD
CHJMP==1B1 ;INDICATE CHANNEL JUMP
CHLST==1B1 ;INDICATE LAST XFER
CHREV==1B2 ;INDICATE REVERSE
CCYADR: POINT 22,T1,35 ;BYTE POINTER TO CCW ADDRESS FIELD
CCYCNT: POINT 11,T1,13 ;BYTE POINTER TO CCW COUNT FIELD
;BITS IN CHANNEL LOGOUT AREA
CS1MPE==1B1 ;MEMORY PARITY ERROR
CS1NSE==1B2 ;NEGATION OF SBUS ERR
CS1NC0==1B3 ;NEGATION OF WORDCOUNT = 0
CS1NXM==1B4 ;NONEXISTANT MEMORY
CS1LTE==1B9 ;LAST TRANSFER ERROR
CS1RHE==1B10 ;RH20 ERROR
CS1LWC==1B11 ;LONG WORD COUNT (RH20 FINISHED BEFORE CHANNEL)
CS1SWC==1B12 ;SHORT WORD COUNT (CHANNEL FINISHED BEFORE RH20)
CS1OVR==1B13 ;OVERRUN (MBOX BUFFER)
;SOFTWARE FLAGS IN FUNCTION (USED BY CHSTRT)
ERETRY==200
;RH20 CONI/CONO BITS
;CONI (RH)
CI.BPE==1B18 ;DATA BUS PARITY ERROR
CI.EXC==1B19 ;EXCEPTION
CI.LWE==1B20 ;LONG WORD COUNT ERROR
CI.SWE==1B21 ;SHORT WORD COUNT ERROR
CI.MBE==1B22 ;MBOX ERROR
CI.DRE==1B23 ;DRIVE RESPONSE ERROR
CI.RAE==1B24 ;REGISTER ACCESS ERROR
CI.MBH==1B25 ;MBOX HALTED
CI.OVR==1B26 ;DATA OVERRUN
CI.MEN==1B27 ;MASSBUS ENABLE
CI.ATN==1B28 ;DRIVE ATTENTION
CI.2RF==1B29 ;SECONDARY COMMAND REGISTER FULL
CI.ATE==1B30 ;ATTENTION ENABLE
CI.1RF==1B31 ;PRIMARY COMMAND REGISTER FULL
CI.DON==1B32 ;CHANNEL DONE
CI.PIA==7 ;PRIORITY ASSIGNMENT
CI.ERR==555000 ;BITS THAT CAUSE ERRORS
;CONO
CO.RAE==1B24 ;CLEAR REGISTER ACCESS ERROR
CO.RST==1B25 ;CONTROLLER RESET
CO.XFR==1B26 ;CLEAR TRANSFER ERROR
CO.MEN==1B27 ;MASSBUS ENABLE
CO.RCL==1B28 ;RESET MBOX COMMAND LIST POINTER
CO.DEL==1B29 ;DELETE SECONDARY COMMAND
CO.ATE==1B30 ;ENABLE ATTENTION INTERRUPTS
CO.STP==1B31 ;STOP CURRENT COMMAND
CO.DON==1B32 ;CLEAR DONE
CO.CLR=005010 ;CLEAR BITS THAT CAUSE INTERRUPTS
;CHANNEL DISPATCH TABLE FOR RH20
RH2DSP::JRST RH2INI ;0 - INITIATION
JRST RH2STK ;1 - STACK SECOND CHANNEL COMMAND
JRST RH2SIO ;2 - START I/O
JRST RH2POS ;3 - POSITION REQUEST
JRST RH2LTM ;4 - RETURN BEST XFER
JRST RH2INT ;5 - INTERRUPT PROCESSING
JRST RH2CCW ;6 - MAKE CHANNEL XFER WORD
JRST RH2HNG ;7 - TRANSFER HUNG
JRST RH2RST ;10 - RESET CHANNEL
JRST RH2CHK ;11 - PERIODIC CHECK
;DUMMIES
RH2LTM: RET
SUBTTL INITIALIZATION
RH2INI: MOVSI Q1,(RH2.0) ;INITIAL CHANNEL DEVICE ADDRESS
PUSH P,Q1 ;SAVE ON PDL
RH2NCH: CALL DEVXCT ;SET PIA
CONO 0,CO.MEN+7
CALL DEVXCT ;READ DEVICE REGISTER
CONI 0,T1 ;STATUS INTO T1
TRNN T1,7 ;EXISTS?
JRST RH2NXT ;NO - TRY NEXT
CALL DEVXCT ;YES - DO CONTROLLER RESET
CONO 0,CO.RST ;...
CALL DEVXCT ;NOW SET MASSBUS ENABLE
CONO 0,CO.MEN
MOVEI T1,L.RH2 ;GET LENGTH OF CDB
CALL PHYALC ;ALLOCATE SOME STORAGE
JRST PA1 ;FAILURE QUIT INITALIZATION
MOVEI P1,-CDBINT(T1) ;CDB BASE ADDRESS TO P1
HRRZ P4,(P) ;GET ACTUAL CHANNEL ADDRESS
MOVEM P1,CHNTAB(P4) ;SAVE CDB IN CHANNEL TABLE
HRRZM P4,CDBADR(P1) ;STORE CHNTAB INDEX
EXCH P1,P3 ;GET CDB IN P3
MOVEI T1,.BTCDB ;MARK AS CDB
DPB T1,USYBKT ; ...
EXCH P1,P3 ;RESTORE
MOVEI T1,.CTRH2 ;SET TYPE
DPB T1,CSYTYP ;..
MOVEI T1,PHYCHN ;*** TEMPORARY ***
DPB T1,CSYPIA ;SET PIA IN CONFIGURATION INFORMATION
MOVSI T1,(CS.STK) ;INDICATE CHANNEL CAN DO COMMAND
IORM T1,CDBSTS(P1) ;STACKING
MOVE T1,[CONO 0,CO.MEN(T2)] ;SET UP IOT'S
IOR T1,Q1 ;WITH CORRECT DEVICE CODES
MOVEM T1,RH2CNO(P1) ;STASH IN CDB
MOVE T1,[CONI 0,T1] ;CONI STATUS
IOR T1,Q1 ;SET DEVICE CODE
MOVEM T1,RH2CNI(P1) ;STORE IN CDB
MOVE T1,[DATAO 0,T2] ;DATAO INSTRUCTION
IOR T1,Q1 ;SET DEVICE CODE
MOVEM T1,RH2DTO(P1) ;STASH IN CDB
MOVE T1,[DATAI 0,T1] ;DATAI INSTRUCTION
IOR T1,Q1 ;SET DEVICE CODE
MOVEM T1,RH2DTI(P1) ;INTO CDB
HRRZ T1,(P) ;GET RH NUMBER
LSH T1,2 ;TIMES 4
MOVEI T2,KIEPT+3(T1) ;IN UNUSED LOGOUT AREA
HRLZM T2,CDBICP(P1) ;AND STORE AS INTERRUPT VECOTOR
MOVEI T3,CDBINT(P1) ;ADDRESS FOR XPCW ON INTERRUPT
HRLI T3,(<XPCW>) ;BUILD INSTRUCTION
MOVEM T3,0(T2) ;STORE IN PAGE 0
MOVEI T3,CDBINT+4(P1) ;SET JUMP ADDRESS
MOVEM T3,CDBINT+3(P1) ;SET IN XFER VECTOR
SETZM CDBINT+2(P1) ;SET FLAGS TO 0
ADDI T1,RH2.I+KIEPT ;ADDRESS OF CHANNEL ICP AREA
HRRM T1,CDBICP(P1) ;STASH IN CDB
; ...
MOVE T1,[MOVEM P1,CDBSVQ]
ADDI T1,0(P1) ;INSTRUCTION TO STORE P1 IN CDB
MOVEM T1,CDBINT+4(P1) ;BUILD INTERRUPT CODE
MOVE T1,[JSP P1,PHYINT]
MOVEM T1,CDBINT+5(P1) ;DISPATCH TO PHYSIO
MOVE T1,[BLT 17,17] ;INSTRUCTION TO RESTORE ACCUMULATORS
MOVEM T1,CDBJEN(P1) ;PUT IN CDB
MOVEI T1,CDBRST(P1) ;BUILD DATAO CDBRST, TO RESET THE
HRLI T1,(DATAO T1,0) ; RH20 PREPARATION REGISTER
IOR T1,Q1
MOVEM T1,CDBJEN+1(P1) ;STORE IT IN THE EXIT SEQUENCE
MOVEI T1,CDBINT(P1) ;ADDRESS OF INTERRUPT PC
HRLI T1,(<XJEN 0>) ;BUILD XJEN INSTRUCTION
MOVEM T1,CDBJEN+2(P1) ;STORE
MOVEI T1,RH2DSP ;INSERT DISPATCH VECTOR
MOVEM T1,CDBDSP(P1) ;SET UP DISPATCH
;NOW FIND UNITS & TYPES
MOVE Q3,[-MAXRH,,CDBUDB] ;AOBJN POINTER TO UDB TABLE
ADDI Q3,0(P1) ;RELOCATE POINTER
MOVEM Q3,CDBCUN(P1) ;STORE IN CDB
MOVEM Q3,CDBIUN(P1) ;...
SETOM CDBXFR(P1) ;INDICATE CHANNEL FREE
MOVEI Q2,0 ;FIRST UNIT #
RH2UNL: MOVEI T2,CO.RAE ;RESET RAE (IN CASE)
XCT RH2CNO(P1)
MOVEI P3,0 ;IN CASE NOT WANTED
CALL RH2UNS ;SEARCH UNIT TYPE
RH2NXU: MOVEM P3,0(Q3) ;STORE IN CDB IF ANY (0 IF NONE)
AOS Q2 ;NEXT UNIT #
AOBJN Q3,RH2UNL ;KEEP GOING
MOVEI T2,CO.RAE ;CLEAR REGISTER ACCESS ERROR
XCT RH2CNO(P1) ;...
MOVEI T1,0 ;CONTROLLER ONLY RESET
CALL RH2RST ; ...
; MOVE T1,CDBIUN(P1) ;CHECK IF ANY DEVICES FOUND.
;RH2CKU: SKIPE (T1) ;UNIT PRESENT?
; JRST RH2NXT ;YES, GO ON TO NEXT CHANNEL
; AOBJN T1,RH2CKU ;NO, LOOP FOR MORE
; MOVSI T1,(CS.OFL) ;NONE PRESENT, MARK OFFLINE.
; IORM T1,CDBSTS(P1) ; ...
; MOVE Q1,(P) ;RECOVER DEVXCT ARGUMENT
; CALL DEVXCT ;COMPLETELY DISABLE RH
; CONO 0,0 ; ...
RH2NXT: AOS Q1,0(P) ;RESTORE DEVICE CODE
ADD Q1,[4B11] ;ADVANCE TO NEXT CHANNEL
MOVEM Q1,0(P) ;STASH NEW ADDRESS
TRZ Q1,-1 ;CLEAR CHANNEL #
CAMLE Q1,[RH2.7] ;BEYOND LAST?
AOJA P4,PA1 ;INCR MAXCHN AND EXIT
JRST RH2NCH ;TRY NEXT
;
; ROUTINE TO DETERMINE THE TYPE OF DISK/TAPE
;
;
RH2UNS: MOVSI T2,(DO.DT) ;DEVICE TYPE REGISTER
TLO T2,(Q2) ;SET UNIT NUMBER
XCT RH2DTO(P1) ;SEND OUT
XCT RH2DTI(P1) ;AND READ BACK
TLNN T1,(DI.TRA) ;NORMAL RESPONSE?
RET ;NO, NEXT UNIT
LDB T1,[POINT 9,T1,35] ;GET DEVICE TYPE CODE
CAIG T1,TY.RPH ;WITHING RP04,5,6 RANGE?
CAIGE T1,TY.RPL ; ??
SKIPA ;NO.
JRST RH2IRP ;YES - INITIALIZE IT
CAIN T1,TY.RS4 ;RS04 TYPE?
JRST RH2IRS ;YES - INITIALIZE IT
CAIN T1,TY.DX2 ;DX20 TYPE?
JRST RH2IDX ;YES - INITIALIZE IT
CAIG T1,TY.T3H ;WITHIN TM03 RANGE
CAIGE T1,TY.T3L ; ???
SKIPA ;NO
JRST RH2ITM ;YES
CAIG T1,TY.T2H ;GREATER THAN HIGHEST TM02 TYPE
CAIGE T1,TY.T2L ;OR LOWER THAN LOWEST?
RET ;YES - NOT TM02
JRST RH2ITM ;IS TM02 - GO INITIALIZE
;ROUTINE TO INVOKE RP04/RS04 INITIATION
RH2IRS: SKIPA T1,[.UTRS4] ;RS04 TYPE
RH2IRP: MOVEI T1,.UTRP4 ;RP04 TYPE
CALL FNDUTP ;FIND TABLE ENTRY
CALL UDSINI(T1) ;CALL INITIALIZE IF FOUND
RET ;ADVANCE TO NEXT UNIT
;HERE TO INITIALIZE A DX20
RH2IDX: MOVX T1,.UTDX2 ;SEARCH FOR DX20
JRST RH2ITD ;GO SEARCH FOR DX20
;HERE TO INITIALIZE A TM02/3
RH2ITM: MOVEI T1,.UTTM2 ;SEARCH FOR TM02
RH2ITD: MOVEI P2,0 ;IN CASE NOT FOUND IN TABLES
CALL FNDUTP ; ...
CALL UDSINI(T1) ;FOUND - CALL INITIALIZE, RETURN KDB IN P2
MOVE P3,P2 ;COPY KDB TO WHERE COMMON CODE WANTS IT
RET ;LOOP FOR MORE
;ROUTINE USED TO EXECUTE IOT FOUND AT CALL+1
;NOTE - INSTRUCTION MUST NOT CAUSE SKIP!
DEVXCT: MOVE T4,@(P) ;FETCH IOT
IOR T4,Q1 ;OR IN DEVICE CODE
XCT T4 ;EXECUTE IT
RETSKP ;RETURN - SKIP OVER INSTRUCTION
;ROUTINE TO SCAN CHANNEL/UNIT TABLES FOR TYPE GIVEN IN T1
;RETURNS TABLE ENTRY IN T1 (SKIP RETURN ON NOT FOUND)
FNDUTP: MOVE T2,[PHYUNL,,PHYUNT] ;ENTRY FOR UNIT TABLE
FNDTPL: HLRZ T3,0(T2) ;GET LH = TYPE CODE
CAME T1,T3 ;TYPES MATCH?
AOBJN T2,FNDTPL ;NO - TRY NEXT
JUMPGE T2,RSKP ;SKIP RETURN IF NO MATCH
HRRZ T1,0(T2) ;MATCH - GET DISPATCH ADDRESS
RET ;RETURN
SUBTTL START I/O AND POSITIONING
;HERE TO START POSITIONING (P3 := UDB)
RH2POS: HRRZ T1,UDBDSP(P3) ;ADDRESS OF DEVICE ROUTINE
CALLRET UDSPOS(T1) ;START IT
;HERE TO START ACTUAL OPERATION (P3 := UDB , P4 := IORB)
RH2SIO: HRRZ T1,CDBICP(P1) ;GET STATUS AREA
SETZM 1(T1) ;CLEAR CS1
HRRZ T1,UDBDSP(P3) ;DISPATCH TO DEVICE CODE
CALL UDSSIO(T1) ;ATTEMPT TO START IO
JRST CLRCHL ;LOSE
RETSKP ;WIN
;HERE TO STACK A SECOND COMMAND TO THE RH20
RH2STK: HRRZ T1,UDBDSP(P3) ;GET UNIT DISPATCH
CALLRET UDSSTK(T1)
SUBTTL HUNG, RESET AND CHECK ENTRIES
;HERE ON A HUNG TRANSFER
;CALLED WITH PI OFF
RH2HNG: MOVEI T1,0 ;CONTROLLER ONLY RESET
; CALLRET RH2RST
;HERE TO RESET THE CHANNEL AND ALL UNITS
;T1/ 0 TO RESET JUST THE CHANNEL
;T1/ 1 FOR FULL RESET
RH2RST: MOVE T4,T1 ;COPY ARG TO SAFE PLACE
MOVEI T1,CO.DEL!CO.DON ;DELETE ANY SECONDARY COMMAND
CALL CHNCNO ;DO CONO
MOVEI T1,CO.STP ;STOP ANY TRANSFER
CALL CHNCNO ;DO CONO
MOVEI T2,CO.RST ;CONO RESET
SKIPE T4 ;IF GENTLE RESET, SKIP MBINIT
XCT RH2CNO(P1) ;DO CONO DIRECTLY
HLRZ T2,CDBICP(P1) ;SETUP INTERRUPT VECTOR ADDRESS
HRLI T2,(DO.IVI)
CALL WTREGX ;WRITE IN CONTROLLER
CALLRET CLRCHL ;AND REINIT CHANNEL
;HERE EVERY NOW AND THEN (ABOUT 1 SEC) TO CHECK PIA.
RH2CHK: XCT RH2CNI(P1) ;GET CONI
ANDI T1,7 ;MASK PIA
LDB T2,CSYPIA ;GET WHAT IT SHOULD BE
CAMN T1,T2 ;ARE THEY THE SAME?
RET ;YES
HRRZ T2,CDBADR(P1) ;GET CHANNEL #
BUG(CHK,PH2PIM,<PHYH2 - RH20 LOST PI ASSIGNMENT>,<T2>)
LDB T2,CSYPIA ;GET CORRECT PIA
MOVSI T1,(CS.ACT) ;IS CHANNEL ACTIVE?
TDNN T1,CDBSTS(P1) ; ??
TRO T2,CO.ATE ;NO, SET ATTENTION EN
XCT RH2CNO(P1) ;SEND TO CHANNEL
RET
SUBTTL CHANNEL UTILITY ROUTINES
;ROUTINE TO READ A MASS-BUSS REGISTER
;CALL - C(T2) := REGISTER TO BE READ
; C(P3) := UDB POINTER
; C(P1) := CDB POINTER
;RETURNS VALUE IN T1 , PRESERVES T4
RDREG:: HRRZ T3,UDBAKA(P3) ;GET UNIT #
SKIPL T2 ;INTERNAL REGISTER?
TLO T2,(DO.DRE) ;NO - TRY FIRST WITH DRAES ON
TLOA T2,(T3) ;SET UNIT NUMBER
RDREG3::TLO T2,<(DO.DRE)>(Q2) ;UNIT # IN Q2
RDREGX: MOVEI T3,^D10 ;INITIALIZE RETRY COUNTER
RDREGL: XCT RH2DTO(P1) ;DATAO RH2,T2
XCT RH2DTI(P1) ;NOW READ REGISTER (DATAI RH2,T1)
PUSH P,T1 ;SAVE RESULT
XCT RH2CNI(P1) ;GET CONI
TRNE T1,CI.RAE ;REGISTER ACC ERR?
JRST RDRAE ;YES - BAD NEWS
RDRAE1: POP P,T1 ;NO - RESTORE RESULT
SKIPGE T2 ;READING AN INTERNAL RH REGISTER?
RET ;YES - DONE
TLNN T1,(DI.CPE) ;CONTROL BUS PAR ERR?
TLNN T1,(DI.TRA) ;OR NOT TRA
JRST RDREGE ;YES - ERROR
RDEXIT: ANDI T1,177777 ; CLEAR OUT GARBAGE
RET ;EXIT
;HERE WHEN CBPE OR MISSING TRA
RDREGE: SOJG T3,RDREGL ;LOOP IF RETRY STILL POSITIVE
TLZ T2,(DO.DRE) ;TRY ONE MORE TIME - IF RAE, BOMB WORLD
JUMPL T3,RDEXIT ;IF NOW NEGATIVE, DEPART, TRAGIC ERROR
JRST RDREGL ;TRY AGAIN
;HERE WHEN A REGISTER ACCESS ERROR IS DETECTED
RDRAE: PUSH P,T2 ;SAVE ANOTHER REGISTER
TLNE T2,(DO.DRE) ;DRAES?
JRST RDRAE2 ;YES - JUST CLEAR RAE
MOVE T2,T1 ;COPY CONI
XCT RH2DTI(P1) ;GET DATAI
PUSH P,T3
HRRZ T3,CDBADR(P1)
BUG(CHK,P2RAE1,<PHYH2 - RH20 REGISTER ACCESS ERROR READING REGISTER>,<T1,T2,T3>)
POP P,T3
CALL CLRRAE ;RESET RAE
POP P,T2 ;RESTORE REGISTERS
POP P,T1 ; ...
JRST RDEXIT ;ALL WE COULD DO...
RDRAE2: CALL CLRRAE ;CLEAR ERROR
POP P,T2
JRST RDRAE1 ;CONTINUE ATTEMPT
;ROUTINE TO WRITE A MASS-BUSS REGISTER
;CALL - C(T2) := REGISTER TO BE WRITTEN & DATA
; C(P1) := CDB , C(P3) := UDB
;PRESERVES T1,T4
WTREG:: HRRZ T3,UDBAKA(P3) ;GET UNIT #
TLOA T2,<(DO.LR)>(T3) ;SET IN LHS AND LR ENABLE
WTREG3::TLO T2,<(DO.LR)>(Q2) ;SET LR AND UNIT NUMBER FROM Q2
WTREGX: TLO T2,(DO.LR) ;WRITE A REGISTER WHEN THE DRIVE NUMBER DOESNT MATTER
XCT RH2DTO(P1) ;ZAP
PUSH P,T1 ;SAVE REGISTER
XCT RH2CNI(P1) ;GET CONI
TRNE T1,CI.RAE ;REGISTER ACC ERR?
JRST WTRAE ;YES - BAD NEWS
POP P,T1 ;NO - RESTORE REGISTER
RET ;RETURN
;HERE WHEN RAE ON WRITE
WTRAE: PUSH P,T3 ;SAVE REGISTER
MOVE T3,T1 ;COPY CONI
XCT RH2DTI(P1) ;GET DATAI
PUSH P,T4
HRRZ T4,CDBADR(P1) ;GET CHANNEL NUMBER
BUG(CHK,P2RAE2,<PHYH2 - REGISTER ACCESS ERR WRITING REG>,<T1,T2,T3,T4>)
POP P,T4 ;RESTORE REG
MOVE T3,T2 ;SAVE ATTEMPTED REGISTER
CALL CLRRAE ;CLEAR RAE
MOVE T2,T3 ;RESTORE
POP P,T3 ;RESTORE
POP P,T1
RET
;HERE TO CLEAR RAE
;USES ONLY T2.
CLRRAE: LDB T2,CSYPIA ;GET PIA
TRO T2,CO.RAE ;CLEAR RAE
XCT RH2CNO(P1) ;DO CLEAR
RET
;ROUTINE TO CLEAR RH20 CONTROLLER OR DO A CONO
;PRESERVES T4
CLRCHL: MOVEI T1,CO.CLR!CO.ATE ;ENABLE FOR ALL INTERRUPTS
CHNCNO: LDB T2,CSYPIA ;GET PI ASSIGNMENT
IOR T2,T1 ;BUILD CONO
XCT RH2CNO(P1) ;...
RET ;RETURN
;ROUTINE TO START CHANNEL I/O
;CALLED WITH PI OFF
;C(T2) := DATAO , C(Q1) := FUNCTION , C(P3) := UDB POINTER
;GIVES SKIP RETURN TO SHOW ALL OK
CHSTRT::SKIPE T2 ;CHECK FOR VALID OPS
SKIPN Q1 ; ...
BUG(HLT,RH2ICF,<PHYRH2 - INVALID CHANNEL FUNCTION>)
HRRZ T1,UDBAKA(P3) ;GET UNIT NUMBER
SKIPL CDBXFR(P1) ;IF NON DATA TRANSFER
CAMN T1,CDBXFR(P1) ;OR SAME AS UNIT HOLDING CHANNEL
SKIPA Q2,[CO.ATE] ;CONSIDER ATTENTION ENABLE
MOVEI Q2,0 ;ELSE DISABLE ATTENTION INTERRUPTS
CAIGE Q1,50 ;DATA TRANSFER OPERATION?
JRST CHST1 ;NO
MOVEI Q2,0 ;OPERATION USES CHANNEL, DISABLE ATTENTION
PUSH P,T2 ;SAVE DATAO
MOVSI T2,(CS.ACL) ;TOGGLE CCW LIST
XORM T2,CDBSTS(P1) ; ..
MOVEI T1,CDBCCL(P1) ;DO SETUP
MOVEI T2,CDBCCL+1(P1)
TRZN Q1,ERETRY ;ECC RETRY?
CALL PHYXFL ;NO - GET HEAD OF TRANSFER LIST
MOVE T4,T1 ;SAVE VIRTUAL ADDRESS
SETMM (T1) ;INSURE REFERENCE
MAP T1,(T1) ;GET PHYSICAL ADDRESS
TLZ T1,777760 ;FLUSH ACCESS BITS ETC
TLO T1,(CHJMP) ;BUILD CHANNEL JUMP
HRRZ T3,CDBICP(P1) ;AND STORE IN
MOVEM T1,(T3) ;CHANNEL ICPC
MOVSI T3,(CHLST) ;SET LAST TRANSFER
IORM T3,-1(T2) ;IN CCW LIST
MOVE T1,T4 ;GET VIRTUAL ADDRESS
CALL BLKCNT ;GET BLOCK COUNT FROM TRANSFER LIST
MOVNS T1 ;AS NEGATIVE NUMBER
DPB T1,[POINT 10,Q1,29] ;STORE IN DATAO STCR
TLO Q1,(DO.CT2!DO2RCP) ;FINISH STCR DATAO
POP P,T2 ;RECOVER DATAO
LDB T1,[POINT 6,T2,5] ;GET REGISTER
CAIN T1,<(DO.DA)>_-^D12 ;DESIRED ADDRESS?
TLC T2,(75B5) ;YES XOR TO PRODUCE SBAR
CHST1: HRRZ T3,UDBAKA(P3) ;GET UNIT ADDRESS
TLO T2,<(DO.LR)>(T3) ;SET UNIT AND LOAD
XCT RH2DTO(P1) ;WRITE REG
MOVE T2,Q1 ;GET CONTROL REGISTER
TLO T2,<(DO.LR)>(T3) ;SET UNIT AND LOAD
MOVEM T2,CDBICR(P1) ;SAVE INITIAL TCR FOR LOGGER
XCT RH2DTO(P1) ;WRITE REG
MOVEI T1,4 ;DELAY **TEMP**
SOJG T1,. ; **TEMP**
LDB T2,CSYPIA ;GET PI ASSIGNMENT
IOR T2,Q2 ;SET ATTENTION ENABLE IF DECIDED ABOVE
XCT RH2CNO(P1) ;DO CONO
RETSKP ;INDICATE SUCCESS
;ROUTINE TO GENERATE A CHANNEL XFER WORD FOR THE RH20
;CALL - C(T1) := MODE,,+COUNT(1B0 IF BACKWARDS) , C(T2) := PHYSICAL-ADDRESS
;RETURNS+1(ALWAYS):
;T1/ CCW FOR THIS TRANSFER
;NOTE: THE MAXIMUM TRANSFER WHICH WILL ALWAYS WORK IS 1 PAGE.
; THE CALLER IS EXPECTED TO WORRY ABOUT PAGE CROSSING PROBLEMS
RH2CCW: PUSH P,T1 ;SAVE ARGUMENT
HRRZ T3,T1 ;GET WORD COUNT
HLRZS T1 ;GET MODE IN CORRECT PLACE
TRZ T1,(1B0) ;CLEAR BACKWARDS BIT FROM MODE
CAIN T1,IRMWRD ;SPECIAL CASE CHECK FOR COMMON CASE
JRST RH2CW1 ;IS WORD MODE, DO IT FAST
SKIPLE T1 ;CHECK MODE FOR LEGALITY
CAILE T1,IRMMAX ; ...
JRST [ BUG(CHK,PH2IHM,<PHYH2 - ILLEGAL HDW MODE - WORD MODE ASSUMED>)
MOVEI T1,IRMWRD ;ASSUME WORD MODE
JRST .+1]
IDIV T3,MODTAB(T1) ;CONVERT TO WORDS
SKIPE T4 ;ROUND?
AOS T3 ;YES
RH2CW1: POP P,T4 ;GET ARGUMENT BACK
MOVSI T1,(CHXFR) ;BUILD CCW
DPB T3,CCYCNT ;STORE COUNT IN T1
DPB T2,CCYADR ;STORE ADDRESS IN T1
SKIPGE T4 ;BACKWARDS?
TLO T1,(CHREV) ;YES
RET ;RETURN
;ROUTINE TO DETERMINE IF ANY CHANNEL DEPENDENT ERROR OCCURED
;RETURN +1 IF ERROR , +2 IF NONE
CKERR:: MOVE T2,CDBCNI(P1) ;GET CONI AT INTERRUPT
ANDI T2,CI.ERR ;ANY ERRORS?
HRRZ T1,CDBICP(P1) ;CHECK CHANNEL
SKIPN T1,1(T1) ;GET STATUS WORD 1
JUMPE T2,RSKP ;IF NO LOGOUT AND NO CONI ERRS, GOOD XFR
SKIPE T2 ;CHAN LOGGED OUT, WERE THERE CONI ERRS?
CALL CKERR1 ;FLAG THEM
TLNE T1,(CS1NSE) ;SBUS ERROR?
TLNE T1,(CS1MPE!CS1NXM!CS1RHE!CS1OVR) ;OR OTHER DEFINITE ERRORS?
JRST [ TLNE T1,(CS1MPE) ;A PARITY ERROR?
AOS CDBPAR(P1) ;YES - NOTE
TLNE T1,(CS1NXM) ;NONEXISTANT MEMORY?
AOS CDBNXM(P1) ;YES - NOTE
TLNE T1,(CS1OVR) ;AN OVERRUN?
AOS CDBOVR(P1) ;YES - NOTE
CALL CKERR1 ;INDICATE SOME ERROR HAPPENED
JRST .+1] ;AND CONTINUE WITH LENGTH ANALYSIS
MOVSI T2,(CS1LWC!CS1SWC) ;WORD COUNT ERROR BITS
MOVSI T3,(US.TAP) ;MAGTAPE?
TDNE T3,UDBSTS(P3) ; ???
TLZ T2,(CS1LWC) ;YES - IGNORE RECORD SHORTER THAN BUFFER
TDNN T1,T2 ;LENGTH ERROR?
JRST CKERR2 ;NO - SEE IF ANY DETECTED
MOVSI T1,(IS.RTL) ;FLAG LENGTH ERROR IN IORB
IORM T1,IRBSTS(P4) ; ...
CKERR1: MOVSI T2,(IS.DVE) ;DECLARE A DEVICE ERROR
IORM T2,IRBSTS(P4) ; ...
RET
CKERR2: MOVSI T1,(IS.DVE) ;WERE ANY ERRORS INDICATED?
TDNE T1,IRBSTS(P4) ; ???
RET ;YES - ERROR
RETSKP ;NO
;ROUTINE TO GET CONI AND DATAI'S ON ERROR
;RETURNS T1=CONI, T2=PTCR, T3=PBAR
ERRCNI::HRRZ T1,CDBICP(P1) ;GET CHANNEL LOGOUT AREA
DMOVE T2,(T1) ; CS0,1
DMOVEM T2,CDBCS0(P1) ;SAVE
MOVE T2,2(T1) ;GET CS2
MOVEM T2,CDBCS2(P1) ;SAVE
MOVE T1,(T1) ;GET ICCW
TLNN T1,(CHXFR) ;IF NOT A JUMP,
JRST ERCNI1 ;DONT TRY FOR CCWS
LDB T1,CCYADR ;GET ADDRESS PART OF JUMP
LSH T1,-PGSFT ;AS A PAGE
PIOFF ;INTERLOCK WINDOW
CALL MAPRCA ;MAP THIS PAGE
HRRZ T2,CDBICP(P1) ;GET CHAN BLOCK AGAIN
MOVE T3,(T2) ;GET JUMP CCW BACK
ANDI T3,777 ;GET ADDRESS WITHIN PAGE
ADD T3,T1 ;GET INDEX INTO WINDOW PAGE
MOVE T4,(T3) ;GET FIRST POSSIBLE CCW
MOVEM T4,CDBCC1(P1) ;SAVE IN CDB
ADDI T3,1 ;INCREMENT POINTER
MOVEI T4,0 ;DONT STORE GARBAGE IF OVERFLOW
TRNE T3,777 ;STILL WITHIN WINDOW BOUND?
MOVE T4,(T3) ;YES - FETCH SECOND POSSIBLE CCW
MOVEM T4,CDBCC1+1(P1) ;SAVE IN CDB
CALL UNMRCA ;FREE WINDOW
PION ;ALLOW INTERRUPTS AGAIN
ERCNI1: MOVSI T2,(DO.BA1) ;READ PRIMARY BLOCK ADDRESS REGISTER
CALL RDREGX
MOVE T4,T1 ;SAVE BAR IN T4
MOVSI T2,(DO.CT1) ;READ PRIMARY TRANSFER CONTROL REGISTER
CALL RDREGX
MOVE T2,T1 ;INTO T2
MOVE T3,T4 ;GET BAR INTO T3
MOVE T1,CDBCNI(P1) ;GET CONI
RET
;P4/ IORB
; CALL BLKCNT
;RETURNS+1(ALWAYS):
;T1/ NUMBER OF DEVICE BLOCKS NEEDED FOR THIS TRANSFER LIST
BLKCNT: MOVSI T2,(US.TAP) ;TAPE?
TDNE T2,UDBSTS(P3) ; ???
JRST BLKCT1 ;YES
MOVE T1,(T1) ;GET CCW
LDB T1,CCYCNT ;EXTRACT COUNT
LDB T2,USYTYP ;GET UNIT TYPE
CAIN T2,.UTRS4 ;RS04?
LSH T1,1 ;YES - HAS 64WD SECTORS
TRNE T1,177 ;IF ANY REMAINDER,
ADDI T1,200 ;ROUND UP
LSH T1,-7 ;ELSE ASSUME 128WD BLOCKS
RET
BLKCT1: MOVEI T1,1 ;MAGTAPE IS ALWAYS 1
RET
SUBTTL INTERRUPT ROUTINE
;ENTER FROM PHYSIO W/ C(P1) := CDB CAUSING INTERRUPT.
RH2INT: XCT RH2DTI(P1) ;GET REGISTER RH WAS CONNECTED TO
TLZ T1,007770 ; CLEAR UNNEEDED BITS
MOVEM T1,CDBRST(P1) ;SAVE FOR EXIT SEQUENCE TO RESTORE (DATA0 RH,CDBRST)
XCT RH2CNI(P1) ;GET CONI
MOVEM T1,CDBCNI(P1) ;AND SAVE FOR ERROR LOGGING, ETC.
TRNN T1,CI.RAE ;IS RAE SET?
JRST RH2IN1 ;NO - GO ON
MOVE T2,T1 ;COPY CONI
XCT RH2DTI(P1) ;GET DATAI
HRRZ T3,CDBADR(P1) ;GET CHANNEL ADDR
BUG(CHK,P2RAE3,<PHYH2 - REGISTER ACC ERR ON DONE OR ATN INTERRUPT>,<T1,T2,T3>)
CALL CLRRAE ;CLEAR RAE
MOVE T1,CDBCNI(P1) ;RECOVER CONI
RH2IN1: MOVEI Q1,0 ;INITIAL UNIT #
TRNN T1,CI.ATN ;ANY ATTENTIONS?
JRST NOATTN ;NO
MOVSI T2,(DO.AS) ;SET TO READ ATTENTION SUMMARY REGISTER
CALL RDREGX ; READ (ANY UNIT WILL DO)
ANDI T1,377 ;MASK OUT IMPOSSIBLE BITS
TRNN T1,377 ;ANY ATTENTION ON?
JRST NOATTN ;NO - CHECK DATA TRANSFER
ATCHKN: LSHC T1,-1 ;SHIFT 1 BIT OVER
JUMPGE T2,ATCHK2 ;JUMP IF NOT THIS UNIT
PUSH P,T1 ;SAVE REMAINDER
HRRZ T1,Q1 ;GET UNIT #
CALL SETUDB ;SET UP P3 := UDB ADDRESS, T2 := DISPATCH
JUMPE P3,ATNXU ;SPURIOUS INTERRUPT IF NO UNIT THERE
SETZ P4, ;P4=0 IF NO ERRORS
CALL UDSATN(T2) ;INFORM LOWER LEVEL
;SETS LH(Q1) TO -1 IF POS DONE INTERRUPT
JUMPN P4,ATNIRB ;JUMP IF IORB DONE OR ERROR
ATCHK1: POP P,T1 ;RESTORE ATTENTION REGISTER
ATCHK2: SKIPE T1 ;DONE IF ZERO
AOJA Q1,ATCHKN ;INCR UNIT # AND TRY NEXT
NOATTN: MOVE T1,CDBCNI(P1) ;GET CONI AT INTERRUPT
SKIPL T4,CDBXFR(P1) ;TRANSFER IN PROGRESS?
JRST XFR ;YES - ANALYZE
TRNE T1,CI.DON ;IS DONE UP NOW?
JRST BADDON ;EVIL EVENT
NOATT1: HLLE P4,Q1 ;NO TRANSFER, SET P4=-1 OR 0
RETSKP ;AND LET PHYSIO DO ITS THING
XFR: TRNN T1,CI.DON ;IS CONTROLLER BUSY?
JRST [ SETZ P4, ;YES, MUST BE FROM ERRPSI (PHYRP4)
RETSKP] ; SO JUST DISMISS THE INTERRUPT
MOVSI T2,(DO.CT1) ;READ RH20 CONTROL REGISTER
CALL RDREGX
LDB T1,[POINT 3,T1,17] ;GET UNIT RH20 IS TALKING TO
CAME T1,T4 ;RIGHT UNIT?
JRST WRNGUN ;NO, TRY AGAIN
CALL SETUDB ;YES, SET UP P3, T2
XFR1: CALL UDSINT(T2) ;CALL INTERRUPT SERVICE
JRST XFR2 ;INDICATE ERRORS
MOVSI T1,(CS.AC2) ;STACKED COMMANDS?
TDNN T1,CDBSTS(P1) ; ??
JRST [ CALL CLRCHL ;NO - RESET CHANNEL
RETSKP] ;INDICATE NO ERRORS
MOVEI T1,CO.DON ;YES - JUST CLEAR DONE
CALL CHNCNO ; ...
RETSKP
;HERE WHEN THERE HAS BEEN AN ERROR DETECTED AT A LOWER LEVEL
XFR2: MOVEI T1,CO.DEL ;DELETE STACKED COMMAND
CALL CHNCNO ; ...
MOVEI T1,CO.DON ;EXPLICITLY CLEAR DONE FIRST
CALL CHNCNO ; ...
CALLRET CLRCHL ;AND RESET ERRORS
;HERE IF AN IORB FINISHES DURING ATTENTION PROCESSING OR
;IF THERE WAS A SEEK ERROR
ATNIRB: HRRZS P4 ;CLEAR ERROR FLAG
POP P,(P) ;SCRAP STACK
RETSKP ;RETURN TO PHYSIO, NEVER SET CHAN ERR
;HERE IF WE GOT AN INTERRUPT FROM THE WRONG DRIVE
WRNGUN: MOVE T1,T4 ;DRIVE PHYSIO IS TALKING TO
CALL SETUDB ;SET UP P3
PUSH P,T2 ;SAVE DISPATCH ADDRESS
CALL SETIRB ;SET UP P4
MOVE T2,IRBSTS(P4) ;DRIVE STATUS
TLOE T2,(IS.WGU!IS.ERR) ;HAVE WE SEEN THIS ERROR BEFORE?
JRST WRNGU1 ;YES, BADNESS
MOVEM T2,IRBSTS(P4) ;NO, SAVE ERROR BITS
POP P,T2 ;RETRIEVE DISPATCH ADDRESS
JRST XFR1 ;AND RETRY THE OPERATION
WRNGU1: MOVEM T2,IRBSTS(P4) ;SAVE ERROR BITS
LDB T2,IRYFCN ;IF THIS IS A WRITE WE'D BETTER HALT
CAIE T2,IRFWRT ;BEFORE WE WIPE OUT SOME DISK
CAIN T2,IRFWTF
BUG (HLT,PH2WUI,<WRONG UNIT INTERRUPTED>)
JRST PA1 ;RETURN AN ERROR
;HERE ON AN INTERRUPT FROM A NONEXISTANT UNIT.
ATNXU: PUSH P,Q1 ;SAVE REGISTER
HRRZ Q2,Q1 ;GET UNIT NUMBER
CALL RH2UNS ;SELECT UNIT
HRRZ Q2,Q1 ;GET UNIT NUMBER
ADD Q2,P1 ;POINT TO CDB+UNIT
MOVEM P3,CDBUDB(Q2) ;STORE NEW ENTRY
POP P,Q1 ;RESTORE REGISTER
MOVEI T2,1 ;CLEAR ATTENTION DIRECTLY
LSH T2,(Q1) ;POSITION BIT
HRLI T2,(DO.AS) ;IN ATTENTION SUMMARY REGISTER
CALL WTREGX ;SPECIAL REGISTER, NEEDS NO UNIT
JRST ATCHK1 ;AND CONTINUE LOOKING
;HERE WHEN DONE IS UP AND THE CHANNEL IS NOT OCCUPIED.
BADDON: HRRZ T2,CDBADR(P1) ;GET CHANNEL #
BUG(INF,PH2DNA,<PHYH2 - DONE INTERRUPT AND CHANNEL NOT ACTIVE>,<T2>)
LDB T2,CSYPIA ;GET PI ASSIGNMENT
TRO T2,CO.RAE!CO.XFR!CO.ATE!CO.DON ;CLEAR RAE,XFRERR,DON.
XCT RH2CNO(P1) ;SEND TO CHANNEL
JRST NOATT1
SUBTTL ECC CHANNEL LOGIC
;THE FOLLOWING ROUTINES, AS IN SEVERAL OTHER PLACES, ASSUME THE
;CCW LIST IS EXACTLY ONE WORD LONG.
;HERE TO RETURN THE PHYSICAL ADDRESS OF THE START OF THE LAST BLOCK
;TRANSFERRED.
; CALL ECCADR
;RETURNS+1(ALWAYS):
;T1/ PHYSICAL ADDRESS OF START OF LAST SECTOR TRANSFERRED
ECCADR::HRRZ T1,CDBICP(P1) ;GET STATUS AREA
MOVE T1,2(T1) ;GET CS2, THE UPDATED CCW
LDB T1,CCYADR ;GET ADDRESS PART
SUBI T1,1 ;BACK UP INTO LAST SECTOR TRANSFERRED
TRZ T1,177 ;MASK TO START OF 128WD BLOCK
RET
;HERE TO UPDATE THE CCW LIST TO TRANSFER ANY DATA AFTER THE SECTOR
;WHICH WAS ECC CORRECTED.
; CALL ECCUCL
;RETURNS+1:
; NO MORE DATA TO TRANSFER
;RETURNS+2:
; UPDATED CCW AT CDBCCL(P1)
;T1/ NUMBER OF WORDS TRANSFERED INCLUDING SECTOR ECC CORRECTED
ECCUCL::HRRZ T4,CDBICP(P1) ;GET STATUS AREA
MOVE T1,2(T4) ;GET UPDATED CCW
LDB T3,CCYCNT ;GET WORD COUNT
JUMPE T3,R ;IF 0, ALL DONE.
TLO T1,(CHXFR!CHLST) ;FORCE LAST TRANSFER
MOVEM T1,CDBCCL(P1) ;STORE IN CDB
SETZM CDBCCL+1(P1) ;CLEAR TAIL
CALL PHYCNT ;GET IORB COUNT
SUB T1,T3 ;LESS WORDS TRANSFERRED
RETSKP
TNXEND
END