VT100 emulation

A little note to myself. Because I may need this to attach more terminals to simh/RSTS

If you type man screen…it begins…

SCREEN(1) General Commands Manual SCREEN(1)
NAME screen – screen manager with VT100/ANSI terminal emulation
SYNOPSIS
screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]

DESCRIPTION
Screen is a full-screen window manager that multiplexes a physical ter‐
minal between several processes (typically interactive shells). Each
virtual terminal provides the functions of a DEC VT100 terminal
and, in
addition, several control functions from the ISO 6429 (ECMA 48, ANSI
X3.64) and ISO 2022 standards (e.g. insert/delete line and support for
multiple character sets). There is a scrollback history buffer for
each virtual terminal and a copy-and-paste mechanism that allows moving
text regions between windows.

sim> help dz
DZV11 Terminal Multiplexer (DZ)

The DZV11 is a 4 line terminal multiplexor.  Up to 32 DZV11's (128 lines) are
supported.  The default number of lines is 16.  The number of lines can
be changed with the command

   sim> SET DZ LINES=n            set line count to n

The line count must be a multiple of 4, with a maximum of 128.

The DZV11 supports three character processing modes, 7P, 7B, and 8B:

  mode    input characters    output characters
  =============================================
  7P  high-order bit cleared  high-order bit cleared,
                  non-printing characters suppressed
  7B  high-order bit cleared  high-order bit cleared
  8B  no changes      no changes

The default is 8B.

The DZV11 supports logging on a per-line basis.  The command

   sim> SET DZ LOG=n=filename

enables logging for the specified line(n) to the indicated file.  The command

   sim> SET DZ NOLOG=line

disables logging for the specified line and closes any open log file.  Finally,
the command:

   sim> SHOW DZ LOG

displays logging information for all DZ lines.

Once the DZV11 is attached and the simulator is running, the DZV11 will listen for
connections on the specified port.  It assumes that the incoming connections
are Telnet connections.  The connection remains open until disconnected by the
simulated program, the Telnet client, a SET DZ DISCONNECT command, or a
DETACH DZ command.

Other special DZ commands:

   sim> SHOW DZ CONNECTIONS           show current connections
   sim> SHOW DZ STATISTICS            show statistics for active connections
   sim> SET DZ DISCONNECT=linenumber  disconnects the specified line.


All open connections are lost when the simulator shuts down or the DZ is
detached.

DZ Multiplexer Attach Help

DZ multiplexer lines may be connected to terminal emulators supporting the
Telnet protocol via sockets, or to hardware terminals via host serial
ports.  Concurrent Telnet and serial connections may be mixed on a given
multiplexer.

Modem Control signalling behaviors can be enabled/disabled on a specific
multiplexer line with:

   sim> ATTACH DZ Line=n,Modem
   sim> ATTACH DZ Line=n,NoModem

A Telnet listening port can be configured with:

   sim> ATTACH DZ {interface:}port

The -U switch can be specified on the attach command that specifies
a listening port.  This will allow a listening port to be reused if
some prior connections haven't completely shutdown.

Line buffering for all 16 lines on the DZ device can be configured with:

   sim> ATTACH DZ Buffer{=bufsize}

Line buffering for all 16 lines on the DZ device can be disabled with:

   sim> ATTACH DZ NoBuffer

The default buffer size is 32k bytes, the max buffer size is 1024k bytes

The outbound traffic for the lines of the DZ device can be logged to files
with:

   sim> ATTACH DZ Log=LogFileName

The log file name for each line uses the above LogFileName as a template
for the actual file name which will be LogFileName_n where n is the line
number.

Multiplexer lines may be connected to serial ports on the host system.
Serial ports may be specified as an operating system specific device names
or using simh generic serial names.  simh generic names are of the form
serN, where N is from 0 thru one less than the maximum number of serial
ports on the local system.  The mapping of simh generic port names to OS 
specific names can be displayed using the following command:

   sim> SHOW SERIAL
   Serial devices:
    ser0   COM1 (\Device\Serial0)
    ser1   COM3 (Winachcf0)

   sim> ATTACH DZ Line=n,Connect=ser0

or equivalently:

   sim> ATTACH DZ Line=n,Connect=COM1

Valid line numbers are from 0 thru 15

The data rates for the lines of the DZ device are set
programmatically within the running simulator.  When connected
via telnet sessions, a speed increase factor can be specified with
a SPEED=*factor on the ATTACH command.

Some simulated systems run very much faster than the original system
which is being simulated.  To accommodate this, multiplexer lines 
connected via telnet sessions may include a factor which will increase
the input and output data delivery rates by the specified factor.
A factor is specified with a speed value of the form "*factor"
Factor values can range from 1 thru 32.
Example:

   sim> ATTACH DZ 1234,SPEED=*8
   sim> ATTACH DZ Line=2,SPEED=*4

If an attach command specifies a speed multiply factor, that value will
persist independent of any programatic action by the simulated system to
change the port speed.

An attachment to a serial port with the '-V' switch will cause a
connection message to be output to the connected serial port.
This will help to confirm the correct port has been connected and
that the port settings are reasonable for the connected device.
This would be done as:

   sim> ATTACH -V DZ Line=n,Connect=SerN

Line specific tcp listening ports are supported.  These are configured
using commands of the form:

   sim> ATTACH DZ Line=n,{interface:}port{;notelnet}|{;nomessage}

Connections to the specified port, by default, will be unrestricted.
Connections from particular IPv4 or IPv6 addresses can be restricted
or allowed based on rules you can add to the "{interface:}port"
specifier on the attach command.  You can add as many rules as you need
to the attach command specified with ";ACCEPT=rule-detail" or
";REJECT=rule-detail" where rule-detail can be an IP address, hostname
or network block in CIDR form.  Rules are interpreted in order and if,
while processing the list, the end is reached the connection will be
rejected.

Direct computer to computer connections (Virutal Null Modem cables) may
be established using the telnet protocol or via raw tcp sockets.

   sim> ATTACH DZ Line=n,Connect=host:port{;notelnet}|{;nomessage}

Computer to computer virtual connections can be one way (as illustrated
above) or symmetric.  A symmetric connection is configured by combining
a one way connection with a tcp listening port on the same line:

   sim> ATTACH DZ Line=n,listenport,Connect=host:port

When symmetric virtual connections are configured, incoming connections
on the specified listening port are checked to assure that they actually
come from the specified connection destination host system.

A line on the DZ device can be attached in LOOPBACK mode:

   sim> ATTACH DZ Line=n,Loopback

A line on the DZ device can be specifically disabled:

   sim> ATTACH DZ Line=n,Disable

When operating in LOOPBACK mode, all outgoing data arrives as input and
outgoing modem signals (if enabled) (DTR and RTS) are reflected in the
incoming modem signals (DTR->(DCD and DSR), RTS->CTS)

All connections configured for the DZ device are unconfigured by:

   sim> DETACH DZ

A specific line on the DZ device can be disconnected with:

   sim> SET DZ DISCONNECT=n

This will cause a telnet connection to be closed, but a serial port will
normally have DTR dropped for 500ms and raised again (thus hanging up a
modem on that serial port).

Any lines connected to serial port can be manually closed by unplugging
the serial cable from the host computer.  Dynamically adding or removing
a serial port from a mux while the simulated operating system is running
is guaranteed to have an inconsistent state between the running OS and
the simulated port state.  Restart the simulator without the serial port
attached.

The terminal lines perform input and output through Telnet sessions connected
to a user-specified port.  The ATTACH command specifies the port to be used:

   sim> ATTACH {-am} DZ {interface:}port      set up listening port

where port is a decimal number between 1 and 65535 that is not being used for
other TCP/IP activities.  The optional switch -m turns on the DZV11's modem
controls; the optional switch -a turns on active disconnects (disconnect
session if computer clears Data Terminal Ready).  Without modem control, the
DZV11 behaves as though terminals were directly connected; disconnecting the
Telnet session does not cause any operating system-visible change in line
status.

sim>