Provide option to send telnet initialization sequences to console
This commit is contained in:
parent
f278e18b89
commit
aeefc45355
2 changed files with 41 additions and 4 deletions
9
boot.py
9
boot.py
|
@ -308,11 +308,12 @@ def boot_lda(p, fname, /, *, force_run=True, msg=None):
|
|||
return rawaddr
|
||||
|
||||
|
||||
def make_unix_machine(*, loglevel='INFO', drivenames=[], rk=False):
|
||||
def make_unix_machine(*, loglevel='INFO', drivenames=[],
|
||||
rk=False, telnet=False):
|
||||
p = PDP1170(loglevel=loglevel)
|
||||
|
||||
p.associate_device(KW11(p.ub), 'KW') # line clock
|
||||
p.associate_device(KL11(p.ub), 'KL') # console
|
||||
p.associate_device(KL11(p.ub, send_telnet=telnet), 'KL') # console
|
||||
if rk:
|
||||
p.associate_device(RK11(p.ub, *drivenames), 'RK') # disk drive
|
||||
else:
|
||||
|
@ -343,6 +344,8 @@ if __name__ == "__main__":
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--debug', action='store_true')
|
||||
parser.add_argument('--drive', action='append', default=[], dest='drives')
|
||||
parser.add_argument('--telnet', action='store_true',
|
||||
help="Send RFC854 sequences to console on start")
|
||||
parser.add_argument('--rk', action='store_true')
|
||||
parser.add_argument('--instlog', action='store_true')
|
||||
parser.add_argument('--lda', action='store', default=None)
|
||||
|
@ -365,7 +368,7 @@ if __name__ == "__main__":
|
|||
else:
|
||||
runoptions['breakpoint'] = breakpoints.MultiBreakpoint(*bkpts)
|
||||
|
||||
p = make_unix_machine(**pdpoptions, rk=args.rk)
|
||||
p = make_unix_machine(**pdpoptions, rk=args.rk, telnet=args.telnet)
|
||||
|
||||
unixboot_options = {}
|
||||
if args.bootmsg:
|
||||
|
|
36
kl11.py
36
kl11.py
|
@ -46,10 +46,17 @@ class KL11:
|
|||
SERVERHOST = ''
|
||||
SERVERPORT = 1170
|
||||
|
||||
def __init__(self, ub, baseaddr=KL11_DEFAULT):
|
||||
def __init__(self, ub, /, *, baseaddr=KL11_DEFAULT, send_telnet=False):
|
||||
"""Initialize the emulated console. Listens on port 1170.
|
||||
|
||||
Argument send_telnet (True/False, default False): controls whether
|
||||
RFC854 sequences to turn off echo, etc will be sent.
|
||||
"""
|
||||
|
||||
self.addr = baseaddr
|
||||
self.ub = ub
|
||||
self.ub.register(ub.autobyte(self.klregs), baseaddr, 4)
|
||||
self.send_telnet = send_telnet
|
||||
|
||||
# output characters are just queued (via tq) to the output thread
|
||||
# input characters have to undergo a more careful 1-by-1
|
||||
|
@ -71,6 +78,30 @@ class KL11:
|
|||
self._t = threading.Thread(target=self._connectionserver, daemon=True)
|
||||
self._t.start()
|
||||
|
||||
def _telnetsequences(self, s):
|
||||
"""If telnet is being used to connect, turn off local echo etc."""
|
||||
|
||||
dont_auth = bytes((0xff, 0xf4, 0x25))
|
||||
s.sendall(dont_auth)
|
||||
|
||||
suppress_goahead = bytes((0xff, 0xfb, 0x03))
|
||||
s.sendall(suppress_goahead)
|
||||
|
||||
dont_linemode = bytes((0xff, 0xfe, 0x22))
|
||||
s.sendall(dont_linemode)
|
||||
|
||||
dont_new_env = bytes((0xff, 0xfe, 0x27))
|
||||
s.sendall(dont_new_env)
|
||||
|
||||
will_echo = bytes((0xff, 0xfb, 0x01))
|
||||
s.sendall(will_echo)
|
||||
|
||||
dont_echo = bytes((0xff, 0xfe, 0x01))
|
||||
s.sendall(dont_echo)
|
||||
|
||||
noecho = bytes((0xff, 0xfd, 0x2d))
|
||||
s.sendall(noecho)
|
||||
|
||||
def klregs(self, addr, cycle, /, *, value=None):
|
||||
if cycle == BusCycle.RESET:
|
||||
self.rcdone = False
|
||||
|
@ -160,6 +191,9 @@ class KL11:
|
|||
while True:
|
||||
s, addr = serversocket.accept()
|
||||
|
||||
if self.send_telnet:
|
||||
self._telnetsequences(s)
|
||||
|
||||
outthread = threading.Thread(target=_outloop, args=(self.tq, s))
|
||||
inthread = threading.Thread(target=_inloop, args=(s,))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue