1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-14 12:04:03 +00:00
Files
PDP-10.its/src/sysen3/nicwho.30
Lars Brinkhoff e954553d3a Extract source files from archives; put them in SYSEN3.
Remove archive files from alan, cstacy, and sra.
2016-12-20 07:48:18 -08:00

227 lines
5.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;-*- Mode: Midas -*-
TITLE NICWHO - Look up someone in the ARPAnet directory
;CStacy, 2/1/84
SUBTTL Basic definitions
;;; Registers.
X=0 ;Super temporary register.
A=1 ;General registers.
B=2
C=3
D=4
E=5
BP=6 ;Byte pointer.
CHAR=7 ;Character being manipulated.
T=10 ;Temporary
TT=11 ;Temporary+1.
OC==12 ;OUT register.
U1==13 ;4 UUO Registers.
U2==14
U3==15
U4==16
P=17 ;Stack pointer.
;;; I/O Channels
DSKI==12 ;Disk input for host table.
NETI=13 ;Network input.
NETO=14 ;Network output.
TTYO=15 ;TTY typeout.
TTYI=16 ;TTY typein.
NICNAM==43. ;NICNAME TCP server port.
;;; Macros and output routines.
$$OUT==1
.INSRT KSC;MACROS >
.INSRT KSC;IVORY >
.INSRT KSC;OUT >
SUBTTL Interrupt Handler and various returns
POPJ1: AOS (P) ;Skip
CPOPJ: RET ;Return
SYSLOS::
AUTPSY: 0 ;Fatal error JSR here.
DEATH: SKIPE DEBUG ;Come here to log out.
.VALUE [0]
.LOGOUT 1,
TMPLOC 42,{-TSINTL,,TSINT} ;New style interrupts.
INTACS==T_6+7 ;T,TT, and OUT registers preserved.
TSINT: INTACS,,P
0 ? 1_TTYI ? 0 ? <1_TTYO>\<1_TTYI> ? CHRINT
0 ? 1_TTYO ? 0 ? 0 ? MORINT
TSINTL==:.-TSINT
;;; Interrupt dismissal
INTRET: SYSCAL DISMIS,[%CLBIT,,INTACS ? P]
JSR SYSLOS
;;; Console interrupts.
CHRINT: MOVEI T,TTYI ;INTERRUPT CHAR.
.ITYIC T,
JRST INTRET
CAIE T,^S
CAIN T,^G
JRST [.RESET TTYO,
SYSCAL TTYFLS,[ %CLBIT,,1 ? %CLIMM,,TTYI]
.LOSE %LSSYS
JRST FLSIT1]
JRST INTRET
MORINT: OUT(TTYO,("--More--")) ;MORE BREAK.
SYSCAL IOT,[%CLBIT,,%TIPEK ? %CLIMM,,TTYI ? %CLOUT,,T]
.LOSE %LSFIL
CAIE T,40
CAIN T,177
.IOT TTYI,T
CAIE T,40
JRST FLSIT
OUT(TTYO,("A"))
JRST INTRET
FLSIT: OUT(TTYO,("Flushed"))
FLSIT1: JRST DEATH ;means we are done.
SUBTTL Main program
GO: MOVE P,[-PDLLEN,,PDL-1] ;Init the stack.
MOVEI A,LSTPAG
MOVEM A,FREPAG ;Remember where unallocated core is.
SYSCAL OPEN,[%CLBIT,,<.UAO\%TJDIS> ? %CLIMM,,TTYO ? [SIXBIT /TTY/]]
.LOSE %LSFIL
SYSCAL RFNAME,[%CLIMM,,TTYO ? %CLOUT,,B]
.LOSE %LSFIL ;Get truename of TTY.
CAMN B,['TTY,,] ;If device not "TTY"
JRST [ SETOM TRITTY ; must have been translated.
SYSCAL OPEN,[%CLBIT,,.UAI ? %CLIMM,,TTYI ? [SIXBIT /TTY/]]
.LOSE %LSFIL
SYSCAL TTYSET,[ %CLIMM,,TTYI
[222222,,222222]
[230222,,220222]]
NOP ; Failure just means no interrupts.
JRST .+1 ]
GO1: .SUSET [.ROPTION,,A] ;Read job option bits.
TLO A,%OPINT\%OPOPC ;Turn on winning-PC and new interrupts.
.SUSET [.SOPTION,,A] ;Set option bits.
.SUSET [.SMASK,,[%PIPDL]] ;PDL overflows are fatal (sure, why not?)
SKIPN TRITTY
.SUSET [.SMSK2,,[<1_TTYI>\<1_TTYO>]] ;Arm TTY interrupts.
OUT(TTYO,OPEN(UC$IOT))
OUT(,CH(TTYO)) ;Open typeout display as default device.
TLNN A,OPTCMD ;If user forgot JCL
JRST [ OUT(,("AUsage is :NICWHO <ident>.
Do :NICWHO ? for help."))
JRST DEATH ]
.BREAK 12,[..RJCL,,JCLBUF] ;Slurp JCL into buffer.
SETZ A, ;Count characters of JCL.
MOVE BP,[440700,,JCLBUF]
GETJCL: ILDB CHAR,BP
JUMPE CHAR, ENDJCL ;A ^@ ends JCL.
CAIN CHAR,^M ;So do these...
JRST ENDJCL
CAIN CHAR,^_
JRST ENDJCL
CAIN CHAR,^C
JRST ENDJCL
AOS A
JRST GETJCL
ENDJCL: MOVEM A,JCLLEN ;Remember how long tiz.
LOOKUP: MOVEI B,DSKI ;Find the NIC's Internet host address.
MOVE A,FREPAG ;Find free page to use.
CALL NETWRK"HSTMAP ;Map in the host table.
JSR AUTPSY
HRRZM A,FREPAG
AOS FREPAG ;Remember where next free page is.
MOVE A,[440700,,[ASCIZ /SRI-NIC/]]
CALL NETWRK"HSTLOO ;There's only one NICNAME server...
JSR AUTPSY
MOVEM A,SRINIC ;Remember the address.
CONECT: MOVEI A,NETI
MOVEI B,NETO
SYSCAL TCPOPN,[ A ? B ? [-1] ? %CLIMM,,NICNAM ? SRINIC ]
JSR NETLUZ
NETHANG 900.,B,%NSRFS,[%NSOPN,%NSRFN] ;Wait until established.
JSR NETLUZ
OUT(NETO,OPEN(UC$IOT)) ;Open network output channel.
COMAND: HRRZI B,JCLBUF
HRL B,JCLLEN
OUT(NETO,TC(B),EOL) ;Send the JCL to the server.
OUT(NETO,FRC) ; Ensure buffer forced out
SYSCAL FINISH,[%CLIMM,,NETO] ; Wait for transmission ACK
JSR AUTPSY
ANSWR: .IOT NETI,A ;Get character.
JUMPL A,DEATH ;If EOF, channel closed.
.IOT TTYO,A ;Print it on our console.
JRST ANSWR ;Not the most efficient thing...
;;; JSR here for network errors.
;;; NETLUZ, expects (input) channel number in A.
;;; Network errors are fatal and are handled in the standard fashion.
NETLUZ: 0
CALL NETWRK"ANALYZ
JSR AUTPSY
JRST DEATH
PUTCHR: .IOT TTYO,T
RET
SUBTTL Storage
PDLLEN==64. ;Stack length.
LSRPGS==220. ;Number of pages reserved for LSR1.
JCLBFL==10. ;Number of words for JCL buffer.
PDL: BLOCK PDLLEN ;The stack.
DEBUG: 0 ;-1 iff debugging.
JCLBUF: BLOCK JCLBFL ;JCL buffer.
JCLLEN: 0 ;Length of JCL.
TRITTY: 0 ;-1 iff TTY input translated
FREPAG: 0 ;Page number of next free page.
SRINIC: 0 ;Host address of SRI-NIC.
CONSTANTS
VARIABLES
VARCHK
;;; Include network hacking routines:
$$HST3==1
$$HSTMAP==1 ;HOSTS3 file.
$$ARPA==1 ;Hack the ARPA Internet.
$$TCP==1 ;Use TCP/IP.
$$HOSTNM==1 ;Host name file lookup routines.
$$SYMLOOK==1 ;table lookup routine.
$$ANALYZE==1 ;Network Error Analysis Routine
.INSRT SYSENG;NETWRK >
CONSTANTS
VARIABLES
LSTPAG==<.+1777>/2000
END GO