1
0
mirror of https://github.com/PDP-10/stacken.git synced 2026-01-28 12:39:06 +00:00
Files
PDP-10.stacken/files/stacken-tape-backup/dskb:1_2/tt.mac
Lars Brinkhoff 6e18f5ebef Extract files from tape images.
Some tapes could not be extracted.
2021-01-29 10:47:33 +01:00

216 lines
4.1 KiB
Plaintext

title tt -- tcp: test program.
search jobdat, uuosym,macten
.text "/symseg:low/locals"
opdef tcp. [call [sixbit "tcp."]]
define ipaddr(a,b,c,d),<byte (8) ^D'a,^D'b,^D'c,^D'd>
define error(msg),<
jrst[ outstr[ asciz "msg"]
outstr[ byte (7) 15, 12, 0]
jrst quit]
>;error macro
tty==1
tcp==2
t1==1
t2==2
t3==3
t4==4
p==17
dummy: block 1
rport: exp ^D9 ;Discard, default port.
raddr: bygg2 ;Default remote address.
pc2: ipaddr (192,168,111,58)
bygg2: ipaddr (192,168,111,59)
topsy: ipaddr (192,168,111,60)
paf.se: ipaddr (66,125,125,88)
ipaddr (64,168,243,36)
spare: exp 0
tib: block 3 ;TCP: input buffer header.
tob: block 3 ;TCP: output buffer header.
tcb: phase 0
.tcfnc:!block 1 ;Function code.
.tcfoa==0 ; Open active.
.tcfop==1 ; Open passive.
.tcfcl==2 ; Close.
.tcfab==3 ; Abort.
.tcfgs==4 ; Get status.
.tcdev:!block 1 ;Device/channel.
.tcflg:!block 1 ;Flags etc.
.tclad:!block 1 ;local address.
.tcrad:!block 1 ;remote address.
.tclpr:!block 1 ;local port.
.tcrpr:!block 1 ;remote port.
.tcbuf:!block 1 ;status buffer ptr.
.tccnt:!block 1 ;status buffer size.
dephase
dirty: exp 0 ;TCP: buffer has data, needs dumping.
ttyflg: exp 0 ;TTY: input done flag.
slploc: sleep t1, ;Race condition workaround.
vector:
vectcp: exp tcpint, 0, 0, 0
vectty: exp ttyint, 0, 0, 0
tt:: jfcl
reset
movei t1,vector
piini. t1,
jfcl
movx t1,ps.fon
pisys. t1,
jfcl
open tcp,[
exp uu.aio+.iobyt
sixbit 'tcp'
xwd tob, tib]
error(Can't open TCP:)
move t1,[
ps.fac+[exp tcp
xwd <vectcp-vector>,ps.rid!ps.rod!ps.rdo!ps.rol!ps.rsw
xwd 0,0]]
pisys. t1,
jfcl
open tty,[
exp uu.aio+.ioasl
sixbit 'tty'
xwd 0, 0] ;Do TTCALLs.
error(Can't open TTY:)
move t1,[
ps.fac+[exp tty
xwd <vectty-vector>,ps.rid!ps.rod!ps.ria
xwd 0,0]]
pisys. t1,
jfcl
skpinl ;Prime the pump.
jfcl ; . . .
movei t1,.tcfoa
movem t1,tcb+.tcfnc ;Function, open active.
movei t1,tcp
movem t1,tcb+.tcdev ;Device/channel.
setzm tcb+.tcflg ;No flags.
setzm tcb+.tclad ;Default the local address.
mstime t1, ;Get some random value.
andi t1,177776 ;Mask down to 16 bits, -
addi t1,1 ; and a non-zero value.
movem t1,tcb+.tclpr ;This is our local port.
move t1,rport
movem t1,tcb+.tcrpr ;Set up our remote port.
move t1,@raddr
movem t1,tcb+.tcrad ;Set up our remote address.
setzm tcb+.tcbuf ;No buffer.
movei t1,tcb ;Try to connect.
tcp. t1,
error(Can't open tcp connection)
loop: move t2,[sleep t1,]
movem t2,slploc
skipe ttyflg
jrst ttcopy
movei t1,^D60
xct slploc
jrst loop
ttcopy: setzm ttyflg
setzm dirty
tloop: inchsl t3
jrst tlo.4
tlo.2: sosge tob+.bfctr
jrst[ out tcp,
jrst tlo.2
movei t2,1
sleep t2,
jrst .]
idpb t3,tob+.bfptr
setom dirty
jrst tloop
tlo.4: skipe dirty
out tcp,
jrst loop
movei t2,1
sleep t2,
jrst tlo.4
quit: monrt.
jrst tt
tcpint: jrst handler ;Use old one for now.
outstr[ asciz "tcp: interrupt
"]
jrst dismis
ttyint: setom ttyflg
dismis: movem t1,slploc
movsi t1,(jfcl)
exch t1,slploc
debrk.
jfcl
error(DEBRK. returned!)
handler:
move t1,vectcp+.psvfl
trnn t1,ps.rsw
jrst hand.2
movei t1,[
exp 4
exp tcp
repeat 10,<0>]
tcp. t1,
halt
cail t1,0
caile t1,^D10
movei t1,^D11
outstr[ asciz "state: "]
outstr@[exp[ asciz "closed"]
exp[ asciz "listen"]
exp[ asciz "syn-sent"]
exp[ asciz "syn-received"]
exp[ asciz "established"]
exp[ asciz "fin-wait 1"]
exp[ asciz "fin-wait 2"]
exp[ asciz "closing"]
exp[ asciz "time-wait"]
exp[ asciz "close-wait"]
exp[ asciz "last-ack"]
exp[ asciz "???"]](1)
outstr[ byte (7) 15, 12, 0]
hand.2: move t1,vectcp+.psvfl
trnn t1,ps.rid
jrst hand.3
copy: sosge tib+.bfctr
jrst nxtbuf
ildb t1,tib+.bfptr
outchr 1
jrst copy
nxtbuf: statz tcp,io.eof
jrst hand.4
in tcp,
jrst copy
hand.3: statz tcp,io.eof
hand.4: outstr[asciz "EOF
"]
movei t1,^D60
debrk.
jfcl
halt
end tt