1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-18 17:16:59 +00:00
2018-10-08 18:36:19 +02:00

78 lines
1.6 KiB
Groff
Executable File

;-*-midas-*-
title echo
t=10
tt=11
chaich=0
chaoch=1
.insrt system;chsdef
debug: 0
chapkt: block %cpmxw
die: 0
skipn debug
.logout
.value
rcvpkt: setz ? 'pktiot ? movei chaich ? setzi chapkt
sndpkt: setz ? 'pktiot ? movei chaoch ? setzi chapkt
go: .close 1,
.call [setz ? 'chaoso ? movei chaich ? movei chaoch ? setzi 5]
.lose %lssys
move t,[.byte 8 ? %colsn ? 0 ? 0 ? 4]
movem t,chapkt
move t,[.byte 8 ? "E ? "C ? "H ? "O]
movem t,chapkt+%cpkdt
.call sndpkt ;setup listen for connection
.lose %lssys
movei t,60.*60.
skipe debug
hrloi t,177777
.call [setz ? 'netblk ? movei chaich ? movei %cslsn ? t ? setzm t]
.lose %lssys
caie t,%csrfc
jsr die
.call rcvpkt ;get the rfc
.lose %lssys
movei t,%coopn
dpb t,[chapkt+$cpkop]
.call sndpkt ;accept it
.lose %lssys
skipe debug ;debugging?
jrst loop ;yes, dont try to login then
ldb t,[chapkt+$cpksa] ;get source host address
move tt,[sixbit /000C00/] ;convert host number to sixbit
dpb t,[220300,,tt]
lsh t,-3
dpb t,[300300,,tt]
lsh t,-3
dpb t,[360300,,tt]
.suset [.ruind,,t] ;incoroporate user index also
dpb t,[000300,,tt]
lsh t,-3
dpb t,[060300,,tt]
move t,tt ;save copy for xuname
.call [setz
sixbit /LOGIN/
tt ? [sixbit /CHAOS/] ? setz t]
aoja tt,.-1 ;error, perhaps need to try other uname
.suset [.sjname,,[sixbit /ECHO/]]
.call [setz ? 'detach ? movei %jself ? andi 3 ]
jsr die
loop: .call rcvpkt ;get a packet
.lose %lssys
ldb t,[chapkt+$cpkop]
caige t,%codat ;is this data?
jsr die ;no, we are done then
.call sndpkt ;yes, send it right back
.lose %lssys
jrst loop
end go