1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-03 15:22:48 +00:00
Files
PDP-10.its/src/sysen3/whoj.26
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

420 lines
9.4 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 Users on ITS (crock, crock)
;;; This is a little MLDEV crock to keep me less annoyed until the
;;; ITS RSSER stuff gets converted. It takes JCL, which should be
;;; the name of an ITS machine. ---CStacy
;Registers.
X=0 ;Super temporary register.
A=1 ;General
B=2 ;Purpose.
C=3
D=4
E=5
J=6 ;JNAME.
T=7 ;Temporary.
TT=10 ;Temporary, T+1.
CHAR=11 ;Character being manipulated.
BP=12 ;Byte pointer.
P=17 ;Stack pointer.
PDLLEN==32. ;Stack length.
;Channels.
DSKI=14 ;Mldev input.
TTYO=15 ;Typeout.
TTYI=16 ;Typein (for **MORE** and ^G, ^S).
;Buffer size.
BUFLEN=600.
BUFSIZ=5*BUFLEN
;System call.
DEFINE SYSCAL OP,ARGS
.CALL [SETZ ? SIXBIT/OP/ ? ARGS ((SETZ))]
TERMIN
;Type out an ascii string.
DEFINE TYPE CH,&STRING
MOVEI T,<.LENGTH STRING>
MOVE TT,[440700,,[ASCII STRING]]
SYSCAL SIOT,[%CLIMM,,CH ? TT ? T]
.LOSE %LSFIL
TERMIN
;;; Uppercase a character
DEFINE UPPER CHR
CAIL CHR,141
CAILE CHR,172
CAIA
SUBI CHR,40
TERMIN
;;; Print a column.
DEFINE PRINT COLS
MOVSI A,-COLS
SETO X,
PUSHJ P,PRTCOL
TERMIN
;;; Skip a column.
DEFINE SKIP COLS
MOVSI A,-COLS
SETZ X,
PUSHJ P,PRTCOL
TERMIN
;;; Print a line.
DEFINE OUTLIN
SETO X,
PUSHJ P,PRTLIN
TERMIN
;;; Skip a line.
DEFINE FLUSH
SETZ X,
PUSHJ P,PRTLIN
TERMIN
;;; Print out or skip a column from BP.
;;; Width as AOBJN in A.
PRTCOL: ILDB CHAR,BP
CAIN CHAR,^L ;Formfeed ends buffer,
JRST DONE
CAIN CHAR,^C
JRST DONE
CAIN CHAR,^M ;Cariage return ends column.
JRST [ ILDB CHAR,BP
POPJ P, ]
SKIPE X
.IOT TTYO,CHAR
AOBJN A,PRTCOL
POPJ P,
;;; Print out or skip a line from BP.
PRTLIN: ILDB CHAR,BP
CAIN CHAR,^L
JRST DONE
CAIN CHAR,^C
JRST DONE
SKIPE X
.IOT TTYO,CHAR
CAIE CHAR,^J
JRST PRTLIN
POPJ P,
;;;Data
PDL: BLOCK PDLLEN ;The stack.
TCMXH: 0 ;Horizontal screen size.
NUSERS: 0 ;Unames printed this line in :USERS.
JCL: BLOCK 20 ;(Just need two chars.)
DEVTAB: ASCIZ /MC/,[ASCIZ /MCTTY:.FILE. (DIR)/]
ASCIZ /AI/,[ASCIZ /AITTY:.FILE. (DIR)/]
ASCIZ /MX/,[ASCIZ /MXTTY:.FILE. (DIR)/]
ASCIZ /MD/,[ASCIZ /MDTTY:.FILE. (DIR)/]
ASCIZ /ML/,[ASCIZ /MLTTY:.FILE. (DIR)/]
; ASCIZ /DM/,[ASCIZ /DMTTY:.FILE. (DIR)/]
NDEVS==.-DEVTAB
LCLDEV: [ASCIZ /TTY:.FILE. (DIR)/]
SAVEBP: 0
TOTRY: BLOCK 4 ;List of files to read.
LOOPER: 0
MANY: 0
MACNAM: 0 ;ASCII name of this machine.
LINES: 0 ;Number of lines in buffer.
BUFFER: BLOCK BUFLEN+1 ;The buffer.
FORTY: 0
0
-TSINTL,,TSINT
INTACS==T_6+2 ;T and TT saved on interrupt.
TSINT: INTACS,,P
0 ? 1_TTYI ? 0 ? <1_TTYO>\<1_TTYI> ? CHRINT
0 ? 1_TTYO ? 0 ? 0 ? MORINT
TSINTL==:.-TSINT
CHRINT: MOVEI T,TTYI
.ITYIC T,
JRST INTRET
CAIE T,^S
CAIN T,^G
JRST [.RESET TTYO,
SYSCAL TTYFLS,[ %CLBIT,,1 ? %CLIMM,,TTYI]
.LOSE %LSSYS
JRST FLSIT1]
INTRET: SYSCAL DISMIS,[%CLBIT,,INTACS ? P]
.LOSE %LSSYS
MORINT: TYPE TTYO,/--More--/
SYSCAL IOT,[%CLBIT,,%TIPEK ? %CLIMM,,TTYI ? %CLOUT,,T]
.LOSE %LSFIL
CAIE T,40
CAIN T,177
.IOT TTYI,T
CAIE T,40
JRST FLSIT
TYPE TTYO,/A/
JRST INTRET
FLSIT: TYPE TTYO,/Flushed/
FLSIT1: .SUSET [.ROPTION,,T]
TLNN T,%OPBRK
JRST DEATH
.BREAK 16,164000
JRST DEATH
GO: MOVE P,[-PDLLEN,,PDL]
SYSCAL OPEN,[%CLBIT,,<.UAO\%TJDIS> ? %CLIMM,,TTYO ? [SIXBIT /TTY/]]
.LOSE %LSFIL
SYSCAL OPEN,[%CLBIT,,.UAI ? %CLIMM,,TTYI ? [SIXBIT /TTY/]]
.LOSE %LSFIL
SYSCAL CNSGET,[%CLIMM,,TTYO ? %CLOUT,,X ? %CLOUT,,TCMXH]
.LOSE %LSFIL
SYSCAL TTYSET,[%CLIMM,,TTYI ? [222222,,222222] ? [230222,,220222]]
.LOSE %LSFIL
.SUSET [.ROPTION,,A]
.SUSET [.RXJNAME,,J] ;Find out jname.
CAMN J,[SIXBIT /TALK/]
JRST [ TYPE TTYO,/ANetwork comlinks are unimplemented.
To talk to someone on the same machine, use "^_C USER"./
JRST DEATH ]
TLO A,%OPINT\%OPOPC
.SUSET [.S40ADDR,,[20,,FORTY]]
.SUSET [.SOPTION,,A]
.SUSET [.SMSK2,,[<1_TTYI>\<1_TTYO>]]
SYSCAL SSTATU,[ REPEAT 5, %CLOUT,, X ?
%CLOUT,,A]
.LOSE %LSFIL
MOVE BP,[440700,,MACNAM]
MOVE B,[440600,,A]
ILDB CHAR,B
ADDI CHAR,40
IDPB CHAR,BP
ILDB CHAR,B
ADDI CHAR,40
IDPB CHAR,BP ;ITS name now stored in Ascii.
GETJCL: .BREAK 12,[..RJCL,,JCL] ;Read JCL.
SKIPN JCL ;If no JCL given
JRST [ MOVE A,LCLDEV ;Use the local machine.
MOVEM A,TOTRY
JRST DOMAC ]
PARSE: MOVE BP,[440700,,JCL] ;Crockishly parse the JCL.
MOVSI E,-NDEVS ;AOBJN loop for user tokens looked at.
PARSE1: PUSHJ P,PARSE2 ;Parse another TOTRY entry.
JRST PARSE9 ; If no more JCL, quit parsing.
AOBJN E,PARSE1 ;Parse up to 4 hosts.
PARSE9: HRRZ E,E ;See how many entries parsed.
CAILE E,1 ;If more than one
SETOM MANY ; remember we need labeling.
JRST DOMAC ;Now go read tty dirs off machines.
;;; Parse from BP, putting entry in TOTRY table.
;;; Skip return unless end of JCL
PARSE2: MOVEM BP,SAVEBP
MOVSI A,-NDEVS ;AOBJN loop for machines.
PARSE3: MOVE BP,SAVEBP ;Use the original BP.
PUSHJ P,JCLHAK ;Get char from input.
POPJ P,
CAIN CHAR,"* ;A "*" MEANS show all four machines.
JRST [ MOVSI A,-NDEVS ; Try all machines...
HRRZ D,DEVTAB(A)
MOVEM D,TOTRY(A)
AOBJN A,.-2 ; Loop for all machines.
SETOM MANY
JRST DOMAC ] ; Dont look at other JCL.
HRLZI B,440700 ;Make Bp to a machine name.
HRR B,DEVTAB(A)
ILDB C,B ;Get char of machine name,
CAME C,CHAR ;Match?
JRST PARSE4 ; No - punt this machine.
PUSHJ P,JCLHAK ;Yes - get second char from input.
POPJ P,
ILDB C,B ;Get char of machine name,
CAMN C,CHAR ;Match?
JRST [ HRRZ D,DEVTAB(A) ; Yes - Have found a machine.
MOVEM D,TOTRY(E) ; Remember its TTY: directory string.
JRST POPJ1] ; And skip-return with modified BP.
PARSE4: AOBJN A,PARSE3 ;Try the next machine.
TYPE TTYO,/AUnknown ITS name specified./
JRST DEATH
;;; Get next JCL char from BP. Skip-returns if wins.
JCLHAK: ILDB CHAR,BP
JUMPE CHAR,CPOPJ ;^@
CAIN CHAR,40 ;SPACE.
JRST JCLHAK
CAIN CHAR,3 ;^C.
POPJ P,
CAIN CHAR,37 ;^_.
POPJ P,
CAIN CHAR,15 ;^M.
POPJ P,
UPPER CHAR
JFCL
POPJ1: AOS (P)
CPOPJ: POPJ P,
DOMAC: MOVSI A,-NDEVS ;AOBJN pointer to filename addresses.
MLOPN: MOVEM A,LOOPER
HRRZ BP,TOTRY(A)
JUMPE BP,DEATH ;Empty address means end of table.
HRLI BP,440700
SKIPN MANY ;If only one machine
JRST MLOPN1 ; dont bother labeling it.
TYPE TTYO,/A
[MIT-/
ILDB CHAR,BP
.IOT TTYO,CHAR
ILDB CHAR,BP
.IOT TTYO,CHAR
TYPE TTYO,/]A/
HRLI BP,440700
MLOPN1: PUSHJ P, HAKLCL ;Fix up local machine spec if needed.
SETZM BUFFER
MOVE T,[BUFFER,,BUFFER+1]
BLT T,BUFFER+BUFLEN-1 ;Clear out the previous contents.
SYSCAL SOPEN,[%CLBIT,,.UAI ? %CLIMM,,DSKI ? BP]
JRST [ TYPE TTYO,"Unable to reach foreign host with TCP/MLDEV."
JRST DONE ]
MOVE T,[440700,,BUFFER]
MOVEI TT,BUFSIZ
SYSCAL SIOT,[%CLIMM,,DSKI ? T ? TT] ;Slurp in TTY list.
.LOSE %LSFIL
.CLOSE DSKI,
CNTLNS: MOVE BP,[440700,,BUFFER] ;Count number of LINES in buffer.
SETZ A,
CNTLN1: ILDB CHAR,BP
CAIN CHAR,^L
JRST LIST
CAIN CHAR,^J
AOS A
JRST CNTLN1
LIST: SUBI A,2 ;First, last lines have a ^J too.
MOVEM A,LINES ;Save away count.
MOVE BP,[440700,,BUFFER] ;Get BP to buffer.
ILDB CHAR,BP ;Gobble leading
; .IOT TTYO,CHAR ;Ker
ILDB CHAR,BP
; .IOT TTYO,CHAR ;Chink.
CAMN J,[SIXBIT /WHOM/] ;WHOM prints it all.
JRST WHOM
CAME J,[SIXBIT /WHO/] ;WHO prints one column.
CAMN J,[SIXBIT /W/]
JRST WHO
CAME J,[SIXBIT /WW/] ;WHOJ prints two columns.
CAMN J,[SIXBIT /WHOJ/]
JRST WHOJ
CAME J,[SIXBIT /USERS/] ;U is very brief.
CAMN J,[SIXBIT /U/] ;U is very brief.
JRST USERS
JRST DEATH ;Gee, how did we get invoked?
WHOM: SETO X,
WHOM1: PUSHJ P,PRTLIN ;Print every single line.
JRST WHOM1
WHOJ: FLUSH ;Skip first line.
MOVE B,LINES
SUBI B,1 ;Not printing first or last
JUMPE B,DONE
WHOJ1: PRINT 4. ;Print the Tnn.
PRINT 6. ;Print the UNAME.
PRINT 7. ;Print the JNAME.
.IOT TTYO,[^M]
.IOT TTYO,[^J]
FLUSH ;Skip to the end of the line.
SOJN B,WHOJ1
JRST DONE
WHO: FLUSH
MOVE B,LINES
SUBI B,1 ;Not printing first or last
JUMPE B,DONE
WHO1: PRINT 4. ;Print the Tnn.
PRINT 6. ;Print the UNAME.
FLUSH ;Skip to the end of the line.
.IOT TTYO,[^M]
.IOT TTYO,[^J]
SOJN B,WHO1
JRST DONE
USERS: SETZM NUSERS
USERS1: FLUSH ;Next user; skip line.
ILDB CHAR,BP
CAIE CHAR,"T ;If this is not a TTY number
JRST USERS1 ; skip this user, maybe done.
AOS NUSERS ;Count user we're printing.
MOVE T,NUSERS ;Get number of users this line.
IMULI T,9. ;See how wide we are so far.
CAMGE T,TCMXH ;If there is enuf room for uname.
JRST USERS2 ; go print it.
.IOT TTYO,[^M] ;Else go to next line.
.IOT TTYO,[^J]
SETZM NUSERS ;Restart count.
USERS2: ILDB CHAR,BP
ILDB CHAR,BP ;Gobble number and space.
ILDB CHAR,BP
USERS3: ILDB CHAR,BP
CAIN CHAR,^L ;If end of buffer
JRST DONE ; all done.
CAIN CHAR,40 ;If end of uname
JRST [ .IOT TTYO,[^I]
JRST USERS1 ]
.IOT TTYO,CHAR
JRST USERS3 ;Else finish printing uname.
DONE: MOVE A,LOOPER ;Recover AOBJN pointer.
AOBJN A,MLOPN
DEATH: .CLOSE TTYO,
.CLOSE TTYI,
.CLOSE DSKI,
.LOGOUT 1,
;;; This is in case luser explicitly specifies his own machine.
;;; BP has pointer to name we want to open on.
HAKLCL: MOVE B,[440700,,MACNAM]
HAKLC1: ILDB CHAR,BP
ILDB C,B
CAME CHAR,C
JRST HAKLC9
ILDB CHAR,BP
ILDB C,B
CAME CHAR,C
JRST HAKLC9
HRRZ BP,LCLDEV
HAKLC9: HRLI BP,440700
POPJ P,
CONSTANTLY
VARIABLE
END GO