diff --git a/Makefile b/Makefile index 39657674..04430306 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ SRC = syseng sysen1 sysen2 sysen3 sysnet kshack dragon channa \ draw wl taa tj6 budd sharem ucode rvb kldcp math as imsrc gls demo \ macsym lmcons dmcg hack hibou agb gt40 rug maeda ms kle aap common \ fonts zork 11logo kmp info aplogo bkph bbn pdp11 chsncp sca music1 \ - moon teach ken lmio1 llogo chsgtv clib sys3 lmio turnip mits_s + moon teach ken lmio1 llogo chsgtv clib sys3 lmio turnip mits_s rab DOC = info _info_ sysdoc sysnet syshst kshack _teco_ emacs emacs1 c kcc \ chprog sail draw wl pc tj6 share _glpr_ _xgpr_ inquir mudman system \ xfont maxout ucode moon acount alan channa fonts games graphs humor \ diff --git a/build/misc.tcl b/build/misc.tcl index f6e2045a..c303bd78 100644 --- a/build/misc.tcl +++ b/build/misc.tcl @@ -940,6 +940,10 @@ respond "*" ":link sys3;ts vrfy,sys3;ts expn\r" respond "*" ":midas sys2;ts wholin_sysen2;wholin\r" expect ":KILL" +# LINE +respond "*" ":midas sys2;ts line_rab;line\r" +expect ":KILL" + # WHOIML respond "*" ":midas sysbin;_sysen1; whoiml\r" respond "FILE:" "whoiml\r" diff --git a/doc/programs.md b/doc/programs.md index ca62651d..eff5a577 100644 --- a/doc/programs.md +++ b/doc/programs.md @@ -148,6 +148,7 @@ - KN10, KS10 frontend software. - LAY, SUDS layout program. - LD10, Lisp display slave. +- LINE, display wholine. - LINK-10, DEC linker. - LIMERI, print limericks. - LIMSER, Chaosnet limerick service. diff --git a/src/rab/line.2 b/src/rab/line.2 new file mode 100644 index 00000000..dcb991e0 --- /dev/null +++ b/src/rab/line.2 @@ -0,0 +1,504 @@ + title WHOLINE display + subttl Definitions + +; Reconstructed 2018 from disassembly of SYS2; TS LINE dated +; 1977-09-05, by editing SYSEN2; WHOLIN 53 dated 1977-12-16. + +; I make no claims that this crock is at all well-written. + +.insrt MRC;MACROS + +; Assembly switches + +nd. slptim==5. ; seconds of sleep time + +; Accumulators + +acdef. [x y z v u w b c j t l] + +acdef. [wrd chr unm jnm f sp d e ptr str] + +; I/O channels + +acdef. [tto] +.hkill tto + +define type string + irpc char,foo,[string] + movx x,<"char> + chrout x + termin termin + +; No attempt is made to optimize the AOS'ing of the character count, since +; this way it is more straightforward and anybody who cares about a few extra +; words or a couple of usecs saved is obviously losing! + +define chrout ac + idpb ac,b + addx c,1 +termin + +line: block 20. ; who-line block + + subttl Main program + +; Start of program + +wholin: .open tto,[%tjdis\.uao,,'TTY] ; get a TTY output channel + .lose ; failed + movx x,%zeros ; initialize page counter + syscal CORBLK,[ clarg. (%cbred) ; get read access + clarg. %jself ; this job + clarg. 777600000200; top half of a moby + clarg. 400000 ; system job + %clarg x] ; page counter + .lose %lssys ; failed? + skipn debug + movx l, + .eval l, + .lose + movx c, + .eval c, + .lose + imul c,l + movem c,ptrmax + movx c, + .eval c, + .lose + hrrz c,c + addm c,findjl + addm c,notty + movx c, + .eval c, + .lose %lssys + hrrz c,c + addm c,sjname + +jclget: move sp,[-10,,mystak] + .break 12,[5,,jcl] + .value [asciz \:forget +:Vk \] + skipn jcl + jrst gogogo + setom jclsw +parse: move str,[440700,,jcl] +nxtokn: pushj sp,gtname + cain chr," + jrst unameg +jnameg: movem wrd,fjname + .suset [.runame,,funame] + jrst findj +unameg: movem wrd,funame + pushj sp,gtname + movem wrd,fjname +findj: movei ptr,0 + move unm,funame + move jnm,fjname +findjl: camn unm,400000(ptr) +sjname: came jnm,400000(ptr) + jrst [add ptr,l ? caml ptr,ptrmax ? jrst dieloc ? jrst findjl] + jrst gogogo + +gtname: movni d,6 + move e,[440600,,wrd] + movei wrd,0 + hrrzi f,0 +nam1: ildb chr,str + caie chr," + jrst nsp + caie wrd,0 + jrst nam2 + jrst nam1 +nsp: cain chr,^M + jrst nam2 + cain chr,^C + jrst nam2 + caig chr,140 + subi chr,40 + idpb chr,e + aojl d,nam1 + move e,[440000,,0] + movni d,777777 + movni f,1 + jrst nam1 + +nam2: caie f,0 + popj sp, + idpb f,e + aojge d,gotnam + idpb f,e + aojl f,.-1 + +gotnam: popj sp, + +funame: 0 +fjname: 0 + +gogogo: + +; Fetch symbols from ITS + +irps sym,,[UNAME JNAME USYSNM TTYSTS USTP FLSINS USWST JTMU UTRNTM NMPGS NSWPGS UPC SV40 OPTION UUOSXB LSCALL OPRSXB UUAC IOCHNM IOTTB CLSTB JBDEV DCHSTB CALSXB] + movx x, + .eval x, ; get value of this symbol + .lose ; failed? + addx x,400000 ; offset to where I have ITS mapped + addm x,sym ; save index +termin +irps sym,,[NUUOSX MXOPR %CLSJ %IOTOT] + movx x, + .eval x, ; get value of this symbol + .lose ; failed? + addm x,sym ; save index +termin + +; Set up for the next who-line + +wholup: skipe jclsw + jrst notty + uget CNSL,t ; get my TTY # + jumpl t,zzz ; no TTY, back to sleep +TTYSTS: hrrz j,(t) ; get job number + jrst lgo + +notty: skipn 400000(ptr) + jrst dieloc + move ptr,ptr + jrst lgo +lgo: + +; Initialize the who-line + + store %zeros,line,line+19. ; clear prototype who-line + movx b,line(440700) ; load line pointer + movx c,%zeros ; no characters yet + type [SZL] ; position who-line + +; Date and time + + .rdatim y, ; get date/time + exch y,z ; want date first + rot y,wid. '_'_ ; convert YYMMDD to MMDDYY + repeat 3,[ + repeat 2,[ + movx x,%zeros ; flush original cruft + lshc x,wid. '_ ; gobble down a character + addx x,<" > ; ASCIIify + chrout x ; output the character + ] ; repeat 2 + ifn 2-.rpcnt,movx x,"/ ; delimiter between fields + .else movx x,<" > ; delimiter between items + chrout x ; output whatever + ] ; repeat 3 + repeat 3,[ + repeat 2,[ + movx y,%zeros ; flush original cruft + lshc y,wid. '_ ; gobble down a character + addx y,<" > ; ASCIIify + chrout y ; output the character + ] ; repeat 2 + ifn 2-.rpcnt,movx x,": ; delimiter between fields + .else movx x,<" > ; delimiter between items + chrout x ; output whatever + ] ; repeat 3 + +; User index + + move x,j ; just user index + idiv x,l ; index, not table pointer + idivx x,100 ; high order + jumpe x,morder + addx x,"0 ; ASCIIify + chrout x ; output the character + +morder: idivi y,10 + jumpe y,lorder + addi y,"0 + chrout y +lorder: addx z,"0 ; ASCIIify + chrout z ; output low order digit + movx x,<" > ; space + chrout x ; output delimiter + +; UNAME + +UNAME: move y,(j) ; get user name +unmlup: movx x,%zeros ; zap out old cruft + lshc x,wid. '_ ; siphon out a character + addx x,<" > ; ASCIIify + chrout x ; output the frob + jumpn y,unmlup ; loop until done + movx x,<" > ; delimit with space + chrout x ; output it + +; JNAME + +JNAME: move y,(j) ; get job name +jnmlup: movx x,%zeros ; zap out old cruft + lshc x,wid. '_ ; siphon out a character + addx x,<" > ; ASCIIify + chrout x ; output the frob + jumpn y,jnmlup ; loop until done + movx x,<" > ; delimit with space + chrout x ; output it + +; SNAME + +USYSNM: move y,(j) ; get system name +snmlup: movx x,%zeros ; zap out old cruft + lshc x,wid. '_ ; siphon out a character + addx x,<" > ; ASCIIify + chrout x ; output the frob + jumpn y,snmlup ; loop until done + movx x,<" > ; delimit with space + chrout x ; output it + +; Status + + movx z,sixbit/STOP/ ; default to not running +USTP: skipe (j) ; running? + jrst gotsts ; got the status + movx z,('RUN) ; runnable, try RUN status +FLSINS: skipn (j) ; is job waiting? + jrst chkrun ; no, what type of run? + movx z,sixbit/PAGE/ ; could be paging +USWST: movx x,(j) ; get swapping status + txnn x,(200000) ; are we paging? + jrst chkrna ; no, maybe some kind of run + +; Got status + +gotsts: movx y,%zeros ; zap out old cruft + lshc y,wid. '_ ; siphon out a character + addx y,<" > ; ASCIIify + chrout y ; output the frob + jumpn z,gotsts ; loop until done + movx x,<" > ; delimit with space + chrout x ; output it + +; % runtime + +JTMU: move x,(j) ; compute from scheduler priority + mulx x,100. + divx x,2.^6 + idivx x,10. ; split off digits + jumpe x,lord1 ; no leading zeros + addx x,"0 ; ASCIIify high order + chrout x ; stick in who line +lord1: addx y,"0 ; ASCIIify low order + chrout y ; ditto for low order + movx x,"% ; funny character + chrout x ; stick it in who line too + movx x,<" > ; delimit with space + chrout x ; output delimiter + +; Runtime + +UTRNTM: move x,(j) ; get job runtime + idivx x,25000. ; now in units of .1 seconds + idivx x,36000. ; hours + move z,y ; save other cruft + idivx x,10. + addx x,"0 + chrout x + addx y,"0 + chrout y + movx x,": + chrout x + move x,z + idivx x,600. ; minutes + move z,y ; save seconds and tenths + idivx x,10. + addx x,"0 + chrout x + addx y,"0 + chrout y + movx x,": + chrout x + move x,z + idivx x,10. ; seconds + move z,y ; save tenths + idivx x,10. + addx x,"0 + chrout x + addx y,"0 + chrout y + movx x,". + chrout x + addx z,"0 ; finally ASCIIify tenths + chrout z ; and output it + movx x,<" > + chrout x + +; Real and virtual pages + +NMPGS: move w,(j) ; job virtual pages +NSWPGS: move x,(j) ; pages out + subm w,x ; pages in + idivx x,100. + idivx y,10. + jumpe x,mord2 + addx x,"0 + chrout x +mord2: jumpe y,lord2 + addx y,"0 + chrout y +lord2: addx z,"0 + chrout z + movx x,"/ ; delimiter + chrout x + move x,w ; get number of virtual again + idivx x,100. + idivx y,10. + jumpe x,mord3 + addx x,"0 + chrout x +mord3: jumpe y,lord3 + addx y,"0 + chrout y +lord3: addx z,"0 + chrout z + movx x,"K ; indicate what this is + chrout x + +; Computed it, output the who-line + + type [R] ; restore cursor position + movx b,line(440700) ; start at BOL + syscal SIOT,[ clarg. tto ; output to TTY output channel + b ? c] ; with normal randomness + .lose %lssys ; sigh + +; All done, back to sleep + +zzz: movx x,slptim*30. ; get number of frobs to sleep + .sleep x, ; and sleep until time out + jrst wholup ; and try try again + + subttl Status suboutines + +chkrun: +UPC: move x,(j) ; job running: user mode? + txne x,(%pcusr) ; if so, status is "RUN" + jrst gotsts ; yup +chkrna: +SV40: move x,(j) ; else decode system call to get status + hlrz y,x + caxn y,(.call) + jrst chkcal ; symbolic system call + txz y,17_5 ; mask out AC field +OPTION: move w,(j) + txnn w,(%opdec) ; in 10/50 compatability mode? + jrst itsuuo ; nope + caxe y,40_9 ; INIT? + caxn y,41_9 ; OPEN? + jrst rnduuo ; random UUO + caxn y,47_9 ; CALLI? + jrst rnduuo +itsuuo: caxn y,(.iot) ; .IOT  decode device in use + jrst chkdev + caxn y,(.oper) ; .OPER  decode address field + jrst chkopr + caxn y,(.call) ; .CALL but not symbolic  decode address + jrst chkncl + lsh y,-9 ; get number of this UUO + subx y,40 + caxl y, +NUUOSX: cail y, +rnduuo: skipa z,['UUO,,] ; random UUO +UUOSXB: move z,(y) + jrst uuosts + +; Symbolic system call + +chkcal: +LSCALL: move z,(j) ; use system call name as status + caxe z,sixbit/SIOT/ + caxn z,('IOT) + jrst chksdv ; IOT, decode device name +uuosts: skipe @FLSINS ; running? + jrst gotsts + lsh z,- ; stick + if running in system + iorx z,sixbit/+/ ; (exec mode or hung) + jrst gotsts ; and return + +; New system call did an IOT + +chksdv: +UUAC: skipl y,(j) + jrst uuosts ; getting arguments, UUAC not set up yet + move w,z ; save name + jrst chkdv1 + +; Old system call IOT + +chkdev: ldb y,[270400,,x] ; .IOT channel + movx w,%zeros ; no saved name +chkdv1: +IOCHNM: addi y,(j) ; get IOCHNM word addr for channel + move y,(y) ; get word contents + hlrz z,y +IOTTB: hll y,(y) ; LH gets direction, block/unit bits + movx v,%zeros +CLSTB: hll z,(y) +%CLSJ: tlne z, ; job device? +JBDEV: skipa z,(z) ; job device name +DCHSTB: hllz z,(y) ; device name + move x,[360600,,z] + ildb u,x ; find first space in the name + jumpn u,.-1 + jumpge y,chkdv2 ; %iotbk  bit 4.9 + movx u,'B ; block mode + dpb u,x + ibp x +chkdv2: caxe w,sixbit/SIOT/ + jrst chkdv3 + movx u,'S + dpb u,x + ibp x +chkdv3: movx u,'O ; follow with O or I for direction +%IOTOT: tlnn y, + movx u,'I + dpb u,x + jrst uuosts + +; .OPER + +chkopr: hrrz y,x ; job is doing a .OPER +MXOPR: cail y, + jrst rnduuo +OPRSXB: move z,(y) + jrst uuosts + +; .CALL + +chkncl: ldb y,[270400,,x] ; get AC field of .CALL +CALSXB: move z,(y) ; sixbit name of .CALL + jrst uuosts + +dieloc: move str,[440700,,errmes] + movei y,leng + syscal SIOT,[ clarg. tto + str ? y ] + .lose %lssys + movei y,10.*30. + .sleep y, + move str,[440700,,errmes] + movei y,leng + syscal SIOT,[ clarg. tto + str ? y ] + .lose %lssys + .logout 1, + +leng=101 +errmes: asciz /STLGUESS WHAT!ZLYour program has gone into HYPERSPACE !! R/ +ptrmax: 0 +debug: 0 +jclsw: 0 +mystak: block 10 +jcl: block 100 + + variables + constants + + end wholin