Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_SRC_3_19910112
-
mit/monitor/anxphy.mac
There are no other files named anxphy.mac in the archive.
;<5.ISI.MONITOR>ANXPHY.MAC.5350 6-Jan-83 17:19:24 Edit by CLYNN
;#535 Add INETIA to keep 0 instead of intsec,,0
;<5.ISI.MONITOR>ANXPHY.MAC.5330, 4-Jan-83 17:53:51, Edit by CHASE
;#533 In ANXSCK, make sure T1 is saved till after ANOSRT returns.
;<5.ISI.MONITOR>ANXPHY.MAC.5010 19-Nov-82 13:32:46 Edit by JGOLDBERGER
;#501 Version 5 MultiNet without MLC code
;[BBNF]<CLYNN.NEW>ANXPHY.MAC.25, 17-Dec-82 17:46:46, Edit by: CLYNN
; Save T1 over ANOSRT in ANXSCK
;[BBNF]<TAPPAN.NEW>ANXPHY.MAC.20, 8-Oct-82 12:20:24, Edit by: TAPPAN
; clear HSTGDM when bring net back up
;<TAPPAN.NEW>ANXPHY.MAC.11, 15-Jun-82 10:52:13, Edit by TAPPAN
; Use NCPUNQ to get packet in ANOSRT
;<TAPPAN.NEW>ANXPHY.MAC.3, 10-Apr-82 13:02:04, Edit by TAPPAN
; Remove NTBFFL (Preparatory for No-NCP mods)
; Added ANXVEC -- Hardware dispatch vector.
;<TAPPAN.4>ANXPHY.MAC.3, 11-Mar-82 10:33:21, Edit by TAPPAN
; Modify ANISRT so ANSCHK is called PION (so as not to hog the machine)
;<BBN-4-MONITOR>ANXPHY.MAC.3, 28-Aug-81 16:02:00, Edit by TAPPAN
;103: Keep PI's off while hacking output Q's to preserve integrity
;<TAPPAN.4>ANXPHY.MAC.6, 22-Aug-80 11:25:53, Edit by TAPPAN
; Removed TELENET code
;<TAPPAN.4>ANXPHY.MAC.6, 1-Jul-80 16:06:52, Edit by TAPPAN
; Conversion to Multinet, This module now contains only the routines
; needed for driving an AN10/20
;[BBNF]<TCP-BBN-4-MONITOR>IMPANX.MAC.4007, 9-May-80 16:15:27, Ed: PLUMMER
; Make IMISRT call IMPRBF with arg in T2
;[BBNF]<TCP-BBN-4-MONITOR>IMPANX.MAC.4006, 6-May-80 16:54:03, Ed: PLUMMER
;
; MANY CHANGES BETWIXT
;
;<3-CLEMENTS>IMPANX.MAC.2, 8-Jun-78 17:21:55, EDIT BY CLEMENTS
;<3-CLEMENTS>IMPANX.MAC.1, 8-Jun-78 17:07:00, EDIT BY CLEMENTS
; Start converting for release 3, extended addressing. Including
; long leaders, and DEC additions.
SEARCH MNTPAR,IMPPAR
IFNDEF INETN,<INETN==1>
IFG INETN,<SEARCH INPAR>
SEARCH PROLOG,MACSYM,MONSYM
ND MLCN,0
TTITLE (ANXPHY,ANXPHY,<- IMP DRIVER FOR AN20>)
ASCIZ /
ANXPHY
COPYRIGHT (C) 1980,1981,1982,1983 BOLT BERANEK and NEWMAN INC.
/
;BITS IN CONI FOR ANI
ANIMRQ==1B27 ;MSG REQUEST. IMP STARTING TO SEND TO HOST.
ANIBSY==1B26 ;BUSY. HOST IS ACCEPTING A MESSAGE
ANIM36==1B25 ;MESSAGE BEING ASSEMBLED INTO 36 BIT WDS IF 1,
; 32 BIT WORDS IF 0.
ANIWCO==1B24 ;WD COUNT OVERFLOW. MESSAGE PORTION IS DONE.
ANIDON==1B23 ;DONE. IMP SENT LAST BIT.
ANIIID==1B19 ;IMP IS DOWN. (READY LINE OFF)
ANIIWD==1B18 ;IMP WAS DOWN. (READY LINE HAS BEEN OFF)
;BITS IN CONO FOR ANI
ANIRST==1B19 ;RESET THE WHOLE AN10 (EXCEPT HOST READY LINE)
ANICLE==1B18 ;CLEAR ERROR FLAGS IN LH OF CONI, CLR IMP WAS DOWN.
ANXCHS==<IMPCHN>B32+<IMPCHN>B35;TWO ADJACENT PI CHANNELS IN B30-35
;BITS IN CONI FOR ANO
ANOEND==1B27 ;END OF MSG. SEND "LAST" WHEN WD CNT RUNS OUT.
ANOBSY==1B26 ;BUSY. SEND WORDS TO THE IMP.
ANOM36==1B25 ;MODE 36. SEND ALL 36 BITS OF DATA WORDS. ELSE,
; JUST SEND LEFT-HAND 32 BITS.
ANOWCO==1B24 ;WORD COUNT OVERFLOW. THIS MSG PORTION COMPLETED.
ANODON==1B23 ;ALL BITS INCLUDING "LAST" HAVE BEEN SENT.
ANOIID==1B19 ;IMP IS DOWN, SAME AS IN ANI
ANOIWD==1B18 ;IMP WAS DOWN, SAME AS IN ANI
;BITS IN CONO FOR ANO
ANOCLE==1B18 ;CLEAR ERROR BITS, IMP WAS DOWN BIT.
;REGISTER SELECT FIELD, IN BOTH ANO AND ANI CONO'S
; NOTE THESE AREN'T USED MUCH BECAUSE HARDWARE SWITCHES TO
; THE "RIGHT" REGISTER MOST OF THE TIME BY ITSELF.
ANXVAR==2B29 ;VECTOR INTERRUPT ADDRESS REGISTER
ANXWAR==1B29 ;WORD COUNT AND ADDRESS REGISTER
ANXDR==0B29 ;DATA REGISTER.
; BITS IN INPUT DEVICE VECTOR ADDRESS REGISTER
ANIHRL==1B10 ;HOST READY LINE. DATAO A 1 TO BECOME READY.
;MISCELLANEOUS VARIABLES
DEFSTR IMWDCT,,12,12 ;WORD COUNT FOR WC/ADR REGISTER
DEFSTR IMBFAD,,35,23 ;ADDRESS FOR WC/ADR REGISTER
;Device-dependent data for leaders
STY%NP==5 ;Number of Padding words, for H2I NOP
RESCD
;;;
;;; Hardware vector
;;;
ANXVEC::
NCTVEC(ANXVEC,ANXKIL,NTHKIL) ; Kill the hardware
NCTVEC(ANXVEC,ANXINI,NTHINI) ; Init hardware
NCTVEC(ANXVEC,ANXRSS,NTRSRT) ; Restart hardware
NCTVEC(ANXVEC,ANISRT,NTISRT) ; Start input
NCTVEC(ANXVEC,ANOSRT,NTOSRT) ; Start output
NCTVEC(ANXVEC,ANXSCK,NTSCHK) ; Check status
; Start input
; called from process level when buffers made available and input is off
; and from endin processor if more buffers are available
; P1 contains pointer to NCT
ANISRT: CALL ANXSCK ;IS THE IMP UP?
RET ; No, can't do anything
PIOFF
SKIPE NTIB(P1) ;ALREADY DOING INPUT?
SOSA IMPNFI ;Yes, so don't start another
SOSGE IMPNFI ;IS THERE A BUFFER TO READ INTO?
JRST [AOSG IMPNFI ;IF NOT, CORRECT COUNT AND GIVE UP.
SETOM NOIBFS ; Flag (that failed) if no buffers
PION
RET]
MOVE T2,IMPFRI ;THERE ARE SOME, IT SAYS. GRAB ONE.
CALL CHKBUF ; SEE IF BUFFER IS GOOD
JSP CX,IMPFLB ; IMP Free list bad
LOAD T1,NBQUE,(T2) ; Get next free buffer
IFNKA < SKIPE T1 > ; If there's a successor,
SETSEC T1,ANBSEC ; Set section number
MOVEM T1,IMPFRI
SETZRO NBQUE,(T2) ; DeQueue it from any others
MOVEM T2,NTIB(P1) ; Save as input buffer
XMOVEI T1,.NBLD0(T2) ; FIRST WORD TO READ INTO
TXO T1,<<.NBLD2+1>B12> ; Read thru leader and some padding
MOVEM T1,NTINP(P1) ; THIS IS THE FIRST DATAO TO ANXWAR
XMOVEI T1,IMIN0 ; SET STATE TO "WAITING FOR IMP TO GO"
MOVEM T1,NTIDSP(P1) ; In input dispatch word
PION
MOVEI T1,ANICLE+ANXWAR+ANXCHS ;TELL IMP WE ARE READY TO GO.
MNTXCT NTCONO ; Do I/O instruction
RET ; IT WILL INTERRUPT ON FIRST BIT TO US
;;; Pi service for input
;;;
;;; All ACs have been saved by startup routine, we
;;; are dispatched to via the NTIDSP word of the proper NCT
;;;
;;; The following AC usage conventions are adhered to
;;; T1 - Temp - Used to hold I/O instruction arguments
;;; T2 - Points to Buffer if we're working on one
;;; T3,T4,CX - Temp
;;; P - Hold stack pointer
;;;
;;; IF ANIDON IS ON, THEY GO TO IMPEI0 FOR END OF INPUT HANDLING.
;;; For subsequent interrupts, a field will steer the packing and counts.
;;; Values are named .IIxxx for Imp Interrupt dispatch. Store in NTITYP(NCT)
;;; for input and similarly in NTOTYP for output.
.IINC6==0 ;This is a 36 bit NCP message
.IINC2==1 ;This is a 32 bit NCP message
.IITNT==2 ;Telenet link
.IISPQ==3 ;Special queue
.IIINT==4 ;Internet packing
.IIMLC==5 ;MLC (Ptip) format
.IISQ2==6 ;False start on Internet -- Handle as spec. Q.
;;; Here when input has been idle and IMP starts to send bits.
;;; This first interrupt requires us to send over word count and
;;; address. The first count will read the IMP-to-host leader and
;;; a word of padding, in 36 bit mode.
IMIN0: MOVEI T1,ANIMRQ ;MESSAGE REQUEST IS ONLY VALID BIT
MNTXCT NTCNSO ; Check if on
JRST IMIN0X ;IT WASN'T THAT. SOMETHING WIERD.
XMOVEI T1,IMIN1 ;NEXT INTERRUPT WANTED IS THIS
MOVEM T1,NTIDSP(P1) ;SET DISPATCH FOR READING I-H LEADER.
MOVE T1,NTINP(P1) ; Get pointer
MNTXCT NTDATO ; Tell the IMP
MOVEI T1,ANIM36+ANIBSY+ANXCHS ;SET TO READ 36 BITS, THEN PI.
MNTXCT NTCONO ; ..
RET ; And return to caller
;;;IMIN0X - Input interrupt error routine. If the input side of the
;;; ANX has been idle, any interrupt other than MSG REQUEST is an error.
IMIN0X: MNTXCT NTCONI ; Get status for buginf
MNTBUG (INF,IMINX1,<UNUSUAL ANI INTERRUPT, CONI ANI IS>,<<T1,CONIAN>>)
MOVEI T1,0
MNTXCT NTCONO ; Turn off input
MOVEI T1,ANIRST ; And get bits to
MNTXCT NTCONO ; Reset ANI, leave ANIIWD on, imput off
RET ; Back to restore
;;; Here at PI level after IMP leader and a word of padding
;;; have been read. ANIDON on means it wasn't that long.
;;; If not end of message, decide whether to read some more
;;; in 32 or 36 bit mode, based on link and host numbers so far.
;;; For NCP, will still have to read H-H leader and then decide again.
IMIN1: MOVEI T1,ANIDON ; End of message?
MNTXCT NTCNSZ ; ?
JRST IMPEI0 ;Yes, go process short (irreg) msg
MOVE T2,NTIB(P1) ;Point to the input buffer
LOAD T1,IHLNK,(T2) ;Get the link and host numbers
LOAD T3,IHHST,(T2) ; Get full host
IFN MLCN,<
MOVEI T4,(T1) ;Shift for MLC field
LSH T4,-1 ; ..
CAMN T4,MLCHLF ;Right link for MLC?
JRST IMI1ML ;Yes
>
IFN INETN,<
CAIN T1,INTLNK ;Internet Link?
JRST IMI1IN ;Yes.
>
CAIG T1,LLINK ;Check for NCP or not
CAIL T3,FKHOST ; ..
JRST IMI1SQ ;Not NCP. Treat special queues.
IMI1NC: MOVX T4,.IINC6 ;Will want NCP handling
IMIN1A: XMOVEI T1,.NBLD2+2(T2) ;Where next word in goes.
IOR T1,II1WCT(T4) ;Word count
MOVEM T1,NTINP(P1) ;Command for device
MNTXCT NTDATO ; Do DATAO T1
MOVEI T1,@II1CNO(T4) ; Get proper bits
MNTXCT NTCONO ; and make it go
XMOVEI T3,IMIN2 ;Address for next interrupt
MOVEM T3,NTIDSP(P1) ;Save for next interrupt
MOVEM T4,NTITYP(P1) ;Save dispatch code
RET ; And done with this interrupt
IMI1SQ: MOVX T4,.IISPQ ;Special queues
JRST IMIN1A ;Join common code
IFN MLCN,<
IMI1ML: MOVX T4,.IIMLC ;MLC link
JRST IMIN1A ;Join common code
>
IFN INETN,<
IMI1IN: MOVX T4,.IIINT ;Internet code
JRST IMIN1A ;Join common code
>
II1WCT: EXP 2B12 ;TYPE NCP36
EXP 2B12 ;TYPE NCP32
EXP 2B12 ;TYPE TELENET (no longer used)
EXP 1B12 ;TYPE SPECIAL Q
EXP 4B12 ;TYPE Internet
EXP 2B12 ;TYPE MLC
EXP 2B12 ;should not be referenced here
II1CNO: EXP ANIM36+ANIBSY+ANXCHS ;TYPE NCP36
EXP ANIM36+ANIBSY+ANXCHS ;TYPE NCP32
EXP ANIM36+ANIBSY+ANXCHS ;TYPE TELENET (not used)
EXP ANIBSY+ANXCHS ;TYPE SPECIAL Q
EXP ANIBSY+ANXCHS ;TYPE Internet
EXP ANIM36+ANIBSY+ANXCHS ;TYPE MLC
EXP ANIM36+ANIBSY+ANXCHS ;should not be referenced here
IMIN2: MOVEI T1,ANIDON ; End of message yet?
MNTXCT NTCNSZ ; ?
JRST IMPEI0 ;Yes. Go process short message
MOVE T2,NTIB(P1) ;Point to the input buffer
; Padding removal isn't needed if haven't read that much, but it's
; cheaper to always remove it than to test for needing to.
DMOVE T3,.NBLD2+2(T2) ;Crunch out the padding on input
STOR T3,IHPD1,(T2) ;Move this partial word
MOVEM T4,.NBHHL(T2) ; ..
MOVE T4,NTITYP(P1) ;Get type code for this message
IFN INETN,<
CAIE T4,.IIINT ;Inputting possible Internet msg?
JRST IMIN2B ; No
MOVE T1,T2 ; Place buffer in reg for routine
CALL INETIN ;Check further. May change T4,T1.
MOVE T2,T1 ; Restore
>
IMIN2B: LOAD T1,NBBSZ,(T2) ;Get its size
MOVE T3,II2LDT(T4) ;Amount we have used so far
SUBI T1,(T3) ; ..
ASH T1,^D23 ;Position for AN10 word counter
IOR T1,T2 ;Address of the buffer
ADDI T1,(T3) ;Next word to write
MOVEM T1,NTINP(P1) ;Feed this to the hardware
MNTXCT NTDATO ; Tell it
CAIE T4,.IINC6 ;NCP links?
JRST IMIN2A ;No.
LOAD T1,HHSIZ,(T2) ;Yes, see if 32 bit or 36.
CAIN T1,^D36 ;Check connection byte size
JRST IMIN2A ;36 bit connection
MOVEI T4,.IINC2 ;Change type to 32 bit NCP
MOVEM T4,NTITYP(P1) ;Remember dispatch type in core
IMIN2A: MOVEI T1,@II2CNO(T4) ; Make it go
MNTXCT NTCONO ; ..
XMOVEI T1,IMIN3 ;SET DISPATCH FOR NEXT INTERRUPT
MOVEM T1,NTIDSP(P1) ; ..
RET ; Restore ACs and dismiss
;Table of CONO values to read data portion of message, by msg type
II2CNO: EXP ANIM36+ANIBSY+ANXCHS ;TYPE NCP36
EXP ANIBSY+ANXCHS ;TYPE NCP32
EXP ANIM36+ANIBSY+ANXCHS ;TYPE TELENET
EXP ANIBSY+ANXCHS ;TYPE SPECIAL Q
EXP ANIBSY+ANXCHS ;TYPE Internet
EXP ANIM36+ANIBSY+ANXCHS ;TYPE MLC
EXP ANIBSY+ANXCHS ;TYPE SPECIAL Q - false internet
;Table of next word to read into at IMIN2 time, by message type
II2LDT: EXP .NBDW0 ;Type NCP36
EXP .NBDW0 ;Type NCP32
EXP .NBDW0 ;Type TELENET
EXP .NBHHL ;Type SPECIAL QUEUES
EXP .NBHHL+3 ;Type Internet
EXP .NBDW0 ;Type MLC
EXP .NBHHL+3 ;Type Special Q - false Internet
IFN INETN,<
;;; Called from IMIN2 when possible Internet message is coming in.
;;; This routine does the following:
;;; 1. Move the 2 remaining H-H words to the right place
;;; 2. Check for right message type and subtype
;;; 3. Check for right Internet message type
;;; 4. Check for a Internet-supplied buffer being available
;;; If any of those conditions is lacking, input is resumed and the
;;; message is handled as a normal special queue message.
;;; Correction: To avoid waking the NCP it is flushed
;;; If the message is really destined for the gateway (TCP, XNET, ...),
;;; it gets copied into a Internet-supplied buffer and input resumes.
;;; IMPEIN will then queue it for the gateway.
;;;
;;; T1/ Pointer to current NCP-supplied buffer
;;; T4/ .IIINT
;;; CALL INETIN
;;; Ret+1: Always. T4 still .IIINT if I.N. msg to be completed, or .IISQ2
;;; if it will be given to a special Q. NTITYP adjusted.
;;; T1 has the (extended) address of the buffer to be used
INETIN: DMOVE T2,.NBDW0+2(T1) ; Pick up the Internet header
DMOVEM T2,.NBDW0(T1) ; Stash in proper place
LOAD T2,IHFTY,(T1) ; ARPANET message format
LOAD T3,IHMTY,(T1) ; ARPANET message type
CAIN T3,.IHREG ; Regular msg?
CAIE T2,ITY%LL ; Long leader?
JRST INETIC ; No. Let normal code handle it.
LOAD T2,IHSTY,(T1) ; ARPANET subtype
LOAD T3,INPVR,(T1) ; Inet packet version flag (part of 2.5 net)
CAIE T2,STY%FC ; Normal, flow-controlled?
CAIN T2,STY%UC ; or uncontrolled?
CAIE T3,.INTVR ; And right Internet version?
JRST INETIC ; No. Let normal code handle this.
SKIPG INTNFI ; And there is a Internet buffer around?
JRST INETIC ; No. Let normal special queue have it.
;;; All OK for the switch to a Internet buffer. Do it, return the NCP buf.
SOSL INTNFI ; Count down number of free Internet bufs
SKIPN T2,INTFRI ; Get pointer to buffer to use
JSP CX,IMPNIT ; Internet bufferes fouled
IFN MAXLDR-.NBHHL,<
MOVEI T3,.NBHHL ; Correct the pointer
CALL FIXLDR ;(T2,T3) ; ... (saves T1)
>
PUSH P,T2 ; Save new INTSEC pointer
XMOVEI T3,.NBLD0(T2) ; "To" -- into Internet
XMOVEI T2,.NBLD0(T1) ; "From" pointer for BLT
LOAD T1,IMWDCT,II1WCT(T4); Get size of second transfer
ADDI T1,.NBHHL-2 ; Compute count (-2 for fill crunch)
CALL XBLTA ; Copy ARPANET and Internet headers
MOVE T2,INTFRI ; Get the Internet buffer again
LOAD T1,NBQUE,(T2) ; Next Internet free buffer
JUMPE T1,INETIA ;#535 SETSEC might not create an instruction
SETSEC T1,INTSEC
INETIA: SETZRO NBQUE,(T2) ; Clear list pointer
MOVEM T1,INTFRI ; Becomes head of list
POP P,T1 ; Get buffer back
EXCH T1,NTIB(P1) ; Old head is now current input bfr
EXCH T1,IMPFRI ; Old input bfr goes to NCP free list
MOVE T2,IMPFRI ; Get copy for indexing
STOR T1,NBQUE,(T2) ; Old list is off of new head
AOS IMPNFI ; There is now another free input bfr
MOVE T1,NTIB(P1) ; Now think in terms of Internet buffer
RET
; Here when current input is to be continued. Fix to be spec. q. input.
INETIC:
;;; SETOM NTFLS(P1) ; Mark to flush message when complete
MOVEI T2,.IISPQ ; Mark for special Queue dispatch
MOVEM T2,NTITYP(P1) ; On next interrupt
MOVEI T4,.IISQ2 ; Return this to caller
RET
>; End INETN
;;; HERE ON INTERRUPT LEVEL FOR BODY OF MESSAGE FROM IMP.
IMIN3: MOVEI T1,ANIDON ; I hope it fit in a buffer
MNTXCT NTCNSZ ; ..?
JRST IMPEI0 ;GOOD. IT DID.
SETOM NTFLS(P1) ; flag to flush message
MOVE T1,[1B12+IMSTK+NIMSTK-1] ;Use stack as bit bucket
MNTXCT NTDATO ; ...
MOVEI T1,ANIBSY+ANXCHS ; GET BITS
MNTXCT NTCONO ; Keep reading until end comes along
RET ; And return
;;; Here when end msg recd from imp
IMPEI0: MOVEI T1,ANXWAR ; Select WC/ADDR reg, clear PIA
MNTXCT NTCONO ; ..
MNTXCT NTDATI ; Get data
MOVEM T1,NTINP(P1) ; Save it
MNTCALL NTIDUN ; Perform "input done"
RET ; return
;;; Output PI routines
;;; Routine to start msg going out. called at pi level, and at
;;; Main level if no output in progress
ANOSRT: PIOFF
SKIPN NTOB(P1) ; ANY OUTPUT IN PROGRESS?
JRST IMPXO1 ; NO
PION ; YES, TURN PI BACK ON
RET ; AND RETURN
IMPXO1: SETOM NTOB(P1) ; MARK OUTPUT IN PROGRESS
PION ; NOW IT'S OK TO TURN PI BACK ON
SKIPLE NTNOP(P1) ; Any nop's to send?
JRST IOUNOP ; Yes, go send them
CALL NCPUNQ ; Get the next sendable message
JRST [ SKIPLE T2,HSTGDM(P1) ; Need to send host-going-down?
JRST IOUHGD ; Send the host going down msg
SETZ T1, ; CONO a 0
MNTXCT NTOCNO ; ....
XMOVEI T1,IMODN2 ; DISPATCH WHEN IT IS TURNED ON
MOVEM T1,NTODSP(P1) ; ..
SETZM NTOB(P1)
RET]
;;; T1 now has buffer to send
MOVEM T1,NTOB(P1)
MOVMS HSTGDM(P1) ; Enable another going-down if one exists
SETZRO NBQUE,(T1) ; DeQueue buffer from its old chain
;;; SETZRO IHNET,(T1) ; Clear net field for IMP
;;;; Now decide on packing via message type
LOAD T2,IHHST,(T1) ;Check host and link for NCP range
LOAD T3,IHLNK,(T1) ; ..
IFN MLCN,<
MOVEI T4,(T3) ;Get link
LSH T4,-1
CAMN T4,MLCHLF ;PTIP link?
JRST [ MOVEI T3,.IIMLC ;Yes. pack in 36 bit mode
JRST IMPIOD]
>
IFN INETN,<
CAIN T3,INTLNK ; Internet?
JRST [MOVEI T3,.IIINT ; Internet. Set packing mode
JRST IMPIOD]
>
CAIGE T2,FKHOST ;Special to-imp group?
CAILE T3,LLINK ;Or link out of range?
JRST [ MOVEI T3,.IISPQ ;Yes, special queue formatting.
JRST IMPIOD]
LOAD T2,HHSIZ,(T1) ;NCP will have set up packing mode
CAIE T2,^D36 ;Is it 36 bit mode?
SKIPA T3,[.IINC2] ;No, it is 8 or 32.
MOVEI T3,.IINC6 ;Select 36 bit mode
IMPIOD: XMOVEI T2,IMOLDR ;Where to go on next interrupt
MOVEM T2,NTODSP(P1) ; ..
MOVEM T3,NTOTYP(P1) ;Remember packing type decision
MOVEI T1,ANXWAR ; Select WC/ADDR reg
MNTXCT NTOCNO ; Do an Output CONO
MOVE T1,NTOB(P1) ; get buffer back
XMOVEI T1,.NBLD0(T1) ;First word to send out
TXO T1,<<.NBLD2+1>B12> ;Send 1st 3 words and some fills
MNTXCT NTODTO ; Do a DATAO
MOVEI T1,ANOM36+ANOBSY+ANOCLE+ANXCHS ; Send it in 36-bit mode
MNTXCT NTOCNO ; And do output CONO
RET ; Done with start-up-output routine
;;; Here at PI level when leader and first fill word have been sent.
;;; Now re-send some more fill, and send H-H leader.
IMOLDR: XMOVEI T1,IMOLD3 ;Where to come on next interrupt
MOVEM T1,NTODSP(P1) ; ..
MOVE T2,NTOB(P1) ;Buffer we are working on
MOVE T4,NTOTYP(P1) ;Get the packing control
XMOVEI T1,.NBHHL-1(T2) ;Resend another word as pads, then H-H leader
IOR T1,II1WCT(T4) ;Set up right count
MNTXCT NTODTO ; Do output DATAO
MOVE T1,T2 ; Put address in T1
LOAD T3,NBBSZ,(T1) ;That might be all. Check size of buffer
CAILE T3,.NBHHL ;Just that much?
TDZA T1,T1 ;There's more than that.
MOVEI T1,ANOEND ;That's all. Include End of Msg bit
IOR T1,IO1CNO(T4) ;Plus the right word size, etc.
MNTXCT NTOCNO ; Tell interface
RET ; Done with interrupt
IO1CNO: ANOM36+ANOBSY+ANXCHS ;NCP 36 BIT MODE
ANOM36+ANOBSY+ANXCHS ;NCP 32 BIT MODE
ANOM36+ANOBSY+ANXCHS ;TELENET MODE
ANOBSY+ANXCHS ;SPECIAL QUEUES
ANOBSY+ANXCHS ;Internet MODE
ANOM36+ANOBSY+ANXCHS ;MLC/PTIP MODE
ANOM36+ANOBSY+ANXCHS ;Not referenced here
IO2CNO: ANOM36+ANOEND+ANOBSY+ANXCHS ;NCP 36 BIT MODE
ANOEND+ANOBSY+ANXCHS ;NCP 32 BIT MODE
ANOM36+ANOEND+ANOBSY+ANXCHS ;TELENET MODE
ANOEND+ANOBSY+ANXCHS ;SPECIAL QUEUES
ANOEND+ANOBSY+ANXCHS ;Internet MODE
ANOM36+ANOEND+ANOBSY+ANXCHS ;MLC/PTIP MODE
ANOEND+ANOBSY+ANXCHS ;Not referenced here
;;; Here after completing the above, again on PI level. If more
;;; words to send, set them up.
IMOLD3: MOVEI T1,ANODON ; Done bit...
MNTXCT NTOCSZ ; CONSZ, was it a short message
JRST IMODN0 ;Yes, go wrap up. Release buffer, etc.
MOVE T2,NTOB(P1) ;Buffer we have been sending
MOVE T4,NTOTYP(P1) ;Get the packing control
LOAD T1,NBBSZ,(T2) ;How many words in it?
MOVE T3,II2LDT(T4) ;How far we have done so far
SUBI T1,(T3) ;Less those sent above
ASH T1,^D23 ;Position for AN10 word count
IOR T1,T2 ;Next word to go out.
ADDI T1,(T3) ;Adj count
MOVEM T1,NTOUP(P1) ; Save
MNTXCT NTODTO ; Do a DATAO
MOVEI T1,@IO2CNO(T4) ; Get bits for CONO
MNTXCT NTOCNO ; And do it
XMOVEI T3,IMODN0 ;When done, we will release the buffer
MOVEM T3,NTODSP(P1) ; ..
RET ; Done, dismiss interrupt
;Here to make a Host Going Down message
; HSTGDM is 0 if not going down, +N if one needs to be sent, and -N
; if it has been sent. Host going down must be the last thing we tell
; the IMP. Sending after saying HGD means another HGD is needed.
IOUHGD: MOVEI T3,0 ;Build the message in 2 and 3
LSHC T2,-^D8
DMOVEM T2,IIMBUF+1 ;And use the special irreg msg buffer
MOVE T2,H2IHGD ;Pattern for message type
MOVNS HSTGDM(P1) ; Disable subsequent HGDs
MOVEM T2,IIMBUF ; ..
XMOVEI T2,IIMBUF ;Now send this to IMP
JRST IOUIRG ;Go send it
IOUNOP: SOS NTNOP(P1)
MOVMS HSTGDM(P1) ; May now need another going down msg
XMOVEI T2,H2INOP ;Send a NOP message
IOUIRG: TXO T2,<<.NBLD2>B12> ;Length of the msg, data in mon. sec.
MOVEI T1,ANXWAR ; Set for wd ct/addr register
MNTXCT NTOCNO ; Do a CONO (T1) Setting WC/ADDR Reg
MOVE T1,T2 ; Get message pointer
MNTXCT NTODTO ; Do a DATAO ANO,T1
MOVEI T1,ANOM36+ANOBSY+ANOEND+ANXCHS ; Start it 36 bit mode
MNTXCT NTOCNO ; ...
MOVE T1,TODCLK ; Get time now
ADDI T1,^D1000 ; Plus a second
MOVEM T1,NTTOUT(P1) ; and set interface hung timeout
XMOVEI T1,IMODN2 ;When done, no buffer to release
MOVEM T1,NTODSP(P1) ; Set dispatch address
RET
;Prototypes of the two H2I irreg messages we ever send.
;The NOP message has the padding control in it.
H2INOP: BYTE (4)0,ITY%LL (16)0 (8).IHNOP (4)0
EXP 0
BYTE (4)0,STY%NP
H2IHGD: BYTE (4)0,ITY%LL (16)0 (8).IHHGD (4)0
;; BYTE (4)0 (24)0 (3)DayOfWeek (5)Hour
;; BYTE (4)5MinPeriod, Reason
;;; Pi service for output
;;; HERE AFTER "OUT DONE" INTERRUPT FOR A REAL BUFFER
IMODN0: MNTCALL NTODUN ; Do output done instruction
IMPDO4: SETZM NTTOUT(P1) ; CLear output hung timeout
SETZM NTOB(P1) ; Mark no output in progress
CALL ANOSRT ; Start next msg if any
IMPUBO: RET ; And done
;;; HERE AFTER "OUT DONE" INTERRUPT WHEN NO BUFFER TO RELEASE.
IMODN2: JRST IMPDO4
;;; STATUS CHECK SUBROUTINES
ANXSCK: SKIPN NTRDY(P1) ; Hardware on?
RET ; No, return error
PUSH P,T1 ;SAVE AN AC
MNTXCT NTCONI ; Get current status
TXNE T1,<1B4+1B5> ;IS IT POWERED UP, WITH A CABLE IN IT?
TXNE T1,<ANIIID+ANIIWD> ;YES. IS READY LINE ALSO OK?
SETOM NTERRF(P1) ; FLAG AN ERROR
SKIPL NTERRF(P1) ; ERROR SEEN NOW OR BEFORE?
JRST [ POP P,T1
RETSKP]
MOVNI T1,2
MOVEM T1,NTFLS(P1)
MOVEI T1,10
MOVEM T1,NTNOP(P1) ; Send some nops
MNTXCT NTCONI ; See if PIAs are on
ANDI T1,77
MOVEI T1,ANICLE(T1) ; CLear the error flop
MNTXCT NTCONO ; ...
CALL MNTWAK ; Make sure it's noticed by hardware fork
CALL ANOSRT ;#533 Start NOP's moving
POP P,T1 ;#533
RET ;#533
;;; HERE FROM DOWN-SEQUENCE PROCESSING IN MAINTENANCE TO COMPLETELY
;;; SHUT OFF THE HARDWARE DEVICE
ANXKIL: MOVEI T1,0 ; Turn off output side
MNTXCT NTOCNO ; ...
MOVEI T1,ANIRST ; CLear device
MNTXCT NTCONO
MOVEI T1,ANXVAR ; Have to point to where host ready is
MNTXCT NTCONO
XMOVEI T1,NTIINT(P1) ; Clear READY, leave interrupt address alone
MNTXCT NTDATO ; ...
RET
;;; CALL HERE FROM IMPIN0 (ONLY FROM MAINTENANCE) AT INITIALIZATION OF
;;; BACKGROUND FORK - NOT ON EVERY RECYCLE OF READY LINE.
ANXINI: XMOVEI T1,IMIN0X ;RESET DISPATCHES
MOVEM T1,NTIDSP(P1) ;INPUT PI DISPATCH TO SHUT OFF DEVICE
XMOVEI T1,IMODN2 ;OUTPUT PI DISPATCH TO START NEW MSG
MOVEM T1,NTODSP(P1)
RET
;;; CALL HERE FROM MAINTAINANCE FORK, PROCESS LEVEL, WHEN IMP IS WANTED UP
;;; BUT NET IS CURRENTLY DOWN.
ANXRSS: SETZM NTTOUT(P1) ; Clear output hung timeout
MNTXCT NTCONI ; Get status (Into T1)
TXNE T1,<1B4+1B5> ; POWER UP?
TXNE T1,<ANIIID> ; IMP READY?
RET ; No, stop here
SETZM NTERRF(P1) ; Clear notices of IMP ERROR
SETZM HSTGDM(P1) ; and down messages
HRRES NETON(P1) ; and any down requests
MOVEI T1,ANIRST ; CLear device
MNTXCT NTCONO
MOVEI T1,ANXVAR+ANICLE ; Set vector address words
MNTXCT NTCONO ; ...
XMOVEI T1,NTIINT(P1) ; Point to interrupt instruction
TXO T1,ANIHRL ; And Set ready line
MNTXCT NTDATO ; ..
MOVEI T1,ANOCLE+ANXVAR ; Same for output
MNTXCT NTOCNO ; ...
XMOVEI T1,NTOINT(P1) ; Set vector int loc for output
MNTXCT NTODTO ; Do a DATAO on output device
MOVNI T1,2
MOVEM T1,NTFLS(P1) ; Init flush count
MOVEI T1,10
MOVEM T1,NTNOP(P1)
MOVEI T1,^D1000
DISMS ; Allow time for ready line to settle
AOS NTSTCH(P1) ; Cause change in state to be noted
CALL MNTWAK ; by hardware fork
GTAD
MOVEM T1,NTXUPT(P1) ; Save time when it came up
MOVEI T1,ANOBSY+ANXCHS ; Tell output side to go
SKIPE NTOB(P1) ; If there is a buffer in transit
MNTXCT NTOCNO ; Output CONO
SETOM NTRDY(P1) ; Indicate fully up
SETOM NTORDY(P1) ; Allow output
CALL ANOSRT ; Start output if needed
CALLRET ANISRT ; Start input
TNXEND
END ; OF ANXPHY