Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_SRC_3_19910112
-
utilities/dmon.fai
There are no other files named dmon.fai in the archive.
;<UTILITIES>DMON.FAI.13, 19-Jun-83 04:38:01, Edit by MRC
; Make all the tables bigger to accomodate Score's monitor
;<UTILITIES>DMON.FAI.12, 19-Jun-83 04:35:10, Edit by MRC
; Flush logging code
;ACCT:<ADMIN.PROGRAMS>DMON.FAI.11, 5-Jun-82 19:24:51, Edit by B.BOMBADIL
; Install logging code to catch ignorant and dishonest wheels
; Set our jobname to DMON, not EXEC.
;ACCT:<ADMIN.PROGRAMS>DMON.FAI.9, 18-Jul-81 19:14:11, Edit by B.BOMBADIL
; snoop symbols everytime we're started - no SSAVE% junk
; set our name to EXEC - screwup subsys name watching programs
;ACCT:<ADMIN.PROGRAMS>DMON.FAI.8, 2-Jul-81 14:04:37, Edit by J.JQJOHNSON
; make rubout print as @i<?>
;ACCT:<ADMIN.PROGRAMS>DMON.FAI.6, 17-Dec-80 15:44:44, Edit by B.BOMBADIL
; set entry vector when SSAVEing self
;ACCT:<ADMIN.PROGRAMS>DMON.FAI.4, 4-Dec-80 15:42:37, Edit by B.BOMBADIL
; fix miscellaneous bugs
;ACCT:<ADMIN.PROGRAMS>DMON.FAI.2, 4-Dec-80 15:10:59, Edit by B.BOMBADIL
; save number of terminal lines at SNOOP% time
; tell user when we are re-initializing because of a new monitor
;<J.JQJOHNSON>DMON.FAI.1, 4-Feb-80 13:27:29, Edit by J.JQJOHNSON
; started modifying for use with display package
extern dpyini,dohome,doil,dodl,doeeol,docp,setcur,dpyout,clrita,setita
extern dpychr,turnof
search monsym,macsym
asuppress
nolit
xall
a=1
b=2
c=3
d=4
t=5
p=17
dpylen=27 ;number of lines on the display
pdlen==100 ;length of push down stack
start: reset% ;reset the world
move p,[iowd pdlen,pdl] ;set up the stack
move a,[sixbit/DMON /] ;our name is DMON
setnm% ;Let everybody know
movei a,.fhslf ;a/ this process
rpcap% ;fetch CAPMSK
move c,b ;c/ mask of potential capabilities
epcap% ;enable everything we have
movei a,.snpsy ;a/ function is to look for symbols
setz c, ;c/ no arguments for this one
movsi t,-nsyms ;t/ form aobjn pointer
snplup: move b,syms(t) ;b/ radix50 value of symbol
snoop% ;look in monitor symbol table
ercal jfatal ;error, probably not a wheel
movem b,snsyms(t) ;save absolute address
aobjn t,snplup ;loop until done
movei 1,1
hrlm 1,ttbigi
move 1,ttbsiz
hrlm 1,ttbbuf
hrroi a,.ttyjo ;want length of TTYJOB table
getab% ;get it
ercal jfatal ;some error
movnm a,nlines ;store number of ttys
;fall through
;drop in and start displaying the world
restrt: call dpyini ;initialize display package
call docp
movn 4,nlines
movss 4
hrri 4,1 ;4/ [-nlines,,1]
setz 5,
cnmlup: skipn platab(4)
jrst ecnmlp
jumpe 5,nocrlf
movei 2,15 ;send a crlf
call dpychr
movei 2,12
call dpychr
nocrlf: addi 5,1
movei 2,(4)
call sndnum ;print the number in 2, followed by ":"
movei 2,(4)
ash 2,7
movei 1,10000(2)
call prints ;print this string
nocrl2: caig 5,dpylen
ecnmlp: aobjn 4,cnmlup
movei 13,1
move 1,ttbigi ;get location of beginning of bigbuf.
movei 2,12
peek
ercal jfatal
movei 11,1(12)
frst: move 1,ttbbuf ;get bigbuf
movei 2,buff
peek
ercal jfatal
loop: camn 11,12 ;any more characters?
jrst wate ; no. Wait 1 sec. If no typein, go to frst
hlrz 4,buff(11) ; yes. Put them in output buffers
aos 2,numb(4) ;increment n of chars in this buffer
cain 2,=75 ;is there room?
jrst bpzro ; no. Clear this buffer.
skipe bytpb(4) ;pick up byte pointer
jrst linok ;it exists. Go output the line.
movei 3,-1(4) ;must create a new line buffer
asnlup: skipn 1,platab(3)
sojg 3,asnlup
movei 1,1(1)
movem 1,platab(4)
caige 1,(13)
movei 13,1(13)
movei 3,1(4)
addlup: cail 3,140
jrst endadd
skipe platab(3)
aos platab(3)
aoja 3,addlup
endadd: move 3,platab(4)
cail 3,(13)
caile 3,dpylen+1(13)
jrst bpzro
setz 2, ;x=0
movei 3,0(3) ;y [xxx]
sub 3,13
call setcur
call doil ;insert a line
movei 2,(4)
call sndnum
bpzro: movei 2,1
movem 2,numb(4)
movei 3,(4)
ash 3,7
movei 3,10000(3)
setzm (3)
movei 5,1(3)
hrli 5,(3)
blt 5,100(3)
hrli 3,(<point 7,0>)
movem 3,bytpb(4)
;add a bigbuf char to a line buffer
; 4/ line number
; 11/ bigbuf position
linok: movei 5,177
and 5,buff(11)
cail 5,177
subi 5,200 ;treat RUB as -1
cail 5,40
jrst chok1
movei 1,"N"-100 ;code for "set italic"
idpb 1,bytpb(4)
movei 1,100(5) ;convert ctrl char to letter
idpb 1,bytpb(4)
movei 1,"O"-100
idpb 1,bytpb(4) ;clear italic
skipa
chok1: idpb 5,bytpb(4)
move 4,platab(4)
caig 4,dpylen(13)
caige 4,(13)
jrst eloop
sub 4,13
caie 2,1
jrst linok1
movei 2,5
movei 3,0(4) ;y position
call setcur
call doeeol
jrst chout
linok1: movei 2,4(2)
movei 2,(2)
movei 3,0(4)
call setcur
chout: cail 5,177 ;rubout?
subi 5,200 ;make it -1
cail 5,40 ;send the character to the display now.
jrst chok
call setita
movei 2,100(5) ;convert from control char to alpha
call dpychr
call clrita
jrst eloop
chok: movei 2,(5)
call dpychr
eloop: call dpyout
aos 11 ;on to the next character in big buf.
caml 11,ttbsiz ;unless we're already at the end.
setz 11,
jrst loop
;wait for 1 sec. If no typein, go to frst
wate: movei 1,1000
disms
movei 1,.priin
sibe
call input
move 1,ttbigi
movei 2,12
peek
ercal jfatal
jrst frst
input: bin
trz 2,200
caie 2,"N"-100 ;^N means down
cain 2,":"
jrst colon
caie 2,"P"-100 ;^P means up
cain 2,";"
jrst semi
caie 2,"L"-100 ;^L means redisplay
cain 2,"^"
jrst refrsh
bkjfn
ercal jfatal
call docp ;end with a clear page
call turnof ;turn off dpy package
movei a,.priou
cfibf
movei a,.priou
movei b,"R"-100
sti
haltf
jrst restrt
;refresh the screen
refrsh: setzm strttb
move 1,[strttb,,strttb+1]
blt 1,endtab
jrst restrt
;up a few lines
semi: cain 13,1
ret
movei 15,-1(13)
movei 13,-20(13)
caige 13,1
movei 13,1
movei 1,(15)
ffsmlp: camle 15,nlines
ret
came 1,platab(15)
aoja 15,ffsmlp
semlup: jumpe 15,semdun
skipn platab(15)
jrst esemlp
move 14,platab(15)
cain 14,-1(13)
ret
call clrita
setz 2,
movei 3,dpylen
call setcur
call dodl
call dohome
call prntit
esemlp: soja 15,semlup
semdun: movei 13,(14)
cpopj: ret
;down a few lines
colon: movei 13,20(13)
movei 15,10(13)
movei 1,(15)
ffcolp: camle 15,nlines
jrst [ movei 13,-20(13)
ret]
came 1,platab(15)
aoja 15,ffcolp
collup: caml 15,nlines
jrst coldun
skipn platab(15)
jrst ecollp
move 14,platab(15)
cain 14,dpylen+1(13)
ret
call clrita
call dohome
call dodl
setz 2,
movei 3,dpylen
call setcur
call prntit
ecollp: aoja 15,collup
coldun: movei 13,-dpylen(14)
ret
;print an existing line buffer
prntit: call doil
movei 2,(15)
call sndnum
movei 16,[byte (7) 15,1,1,1,1,1,0]
call prints
movei 2,(15)
ash 2,7
movei 16,10000(2)
prints: hrli 16,(<point 7,0>)
prntlp: ildb 2,16
jumpe 2,dpyout
call dpychr
jrst prntlp
;print a number
;call: 2/ number to be sent
sndnum: push p,3
call clrita
call octout
movei 2,":"
call dpychr
call doeeol
pop p,3
ret
octout: jumpe 2,cpopj
idivi 2,10 ;in octal
push p,3
call octout
pop p,2
addi 2,"0"
jrst dpychr
;fatal jsys error
jfatal: hrroi 1,[asciz/Fatal error - /]
esout
movei 1,.priou
hrloi 2,.fhslf
setz 3,
erstr
jfcl
jfcl
tmsg < at PC >
movei 1,.priou
move 2,(p)
subi 2,2
movei 3,10
nout
jfcl
tmsg <
>
call turnof
haltf
jrst .-1
Subttl Storage
define snptab <
$r5 ttbbuf
$r5 ttbigi
$r5 ttbsiz
>
define $r5 (sym) <
radix5 0, sym ;;assemble radix50 code for SYM
>
syms: snptab
define $r5 (sym) <
sym: block 1 ;;assemble storage with SYM as the label
>
snsyms: snptab
nsyms==.-snsyms
buff: block 400
nlines: block 1 ;total number of tty lines
strttb: 0
pdl: block pdlen ;pushdown stack
;the following are indexed by terminal number
bytpb: block 400
numb: block 400 ;number of chars in output buffer
platab: block 400
endtab: block 1
end start