1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-23 10:59:24 +00:00

Added PORTS.

Resolves #123.
This commit is contained in:
Eric Swenson 2016-12-18 15:07:36 -08:00
parent 1a44275dc1
commit ce4f8a168c
3 changed files with 113 additions and 0 deletions

View File

@ -169,6 +169,7 @@ A list of [known ITS machines](doc/machines.md).
- PEEK, system monitoring.
- PFTHMG, Puff the magic dragon.
- PHOTO, capture STY session output.
- PORTS, display free network ports.
- PR, print out various system documentation.
- PROBE, probe inside job and display various information about it.
- PRUFD, list files on disk volume.

View File

@ -752,6 +752,10 @@ expect ":KILL"
respond "*" ":midas sys1;ts timoon_syseng;timoon\r"
expect ":KILL"
# ports
respond "*" ":midas sys2;ts ports_sysen2;ports\r"
expect ":KILL"
# sysmsg
respond "*" ":midas sys1;ts sysmsg_sysen1;sysmsg\r"
expect ":KILL"

108
src/sysen2/ports.1 Executable file
View File

@ -0,0 +1,108 @@
;-*-midas-*-
title ports-> print number of free net ports.
;Stolen from RMS's LOADP, and prettied up a bit.
a=1
b=2
c=3
d=4
e=5
f=6
g=7
h=10
i=11
j=12
k=13
l=14
m=15
n=16
p=17
t1=20
t2=21
chttyo==1
define syscal a,b
.call [setz ? sixbit/a/ ? b ((setz))]
termin
DEFINE TCAL OP,ARGS
.CALL [SETZ ? SIXBIT /OP/ ? ARGS ((SETZ))]
TERMIN
DEFINE TYPE CHNL,&STRING
MOVEI T1,<.LENGTH STRING>
MOVE T2,[440700,,[ASCII STRING]]
TCAL SIOT,[%CLIMM,,CHNL ? T2 ? T1]
.LOSE %LSFIL
TERMIN
beg: move p,[-lpdl,,pdl]
.open chttyo,[.uao,,'tty]
.lose
movei b,0 ;B indexes which tty we are looking at.
setzm nfstys ;Initialize counters: # of free stys
count: syscal ttyget,[%climm,,400000(b) ;D gets TTYST var - negative for free tty.
%clout,,a ? %clout,,a ? %clout,,d]
jrst print ;Error means we have run out of tty numbers.
syscal ttyvar,[%climm,,400000(b) ? [sixbit/ttytyp/]
%clout,,a]
.lose %lsfil
trnn a,%tysty ;If it's a sty, is it free?
jrst notfre
jumpge d,notfre
aos nfstys
notfre: aoja b,count ;ok, it isn't free, ignore it.
ascout: hrli a,440700
ascou1: ildb b,a
jumpe b,cpopj
.iot chttyo,b
jrst ascou1
decout: idivi a,10.
hrlm b,(p)
skipe a
pushj p,decout
hlrz b,(p)
addi b,"0
.iot chttyo,b
cpopj: popj p,
;Having collected the data, print it out.
print: move a,nfstys
cain a,0
jrst print0
cain a,1
jrst print1
movei a,[asciz/There are /]
pushj p,ascout
move a,nfstys
pushj p,decout
movei a,[asciz/ free net ports.
/]
pushj p,ascout
.logout 1,
print1: movei a,[asciz/There is 1 free net port.
/]
pushj p,ascout
.logout 1,
print0: movei a,[asciz/There are no free net ports.
/]
pushj p,ascout
.logout 1,
nfstys: 0
pat: patch:
block 40
epatch: -1
lpdl=10
pdl: block lpdl
end beg