Many simulators run instructions one or more orders of magnitude faster
than the original systems did. Limiting simulated serial port input speeds
to legacy bits per second values presents the arriving data much slower
than the original systems ever saw it. Given the processing capacity of the
simulated systems and the fact that the software and device interfaces
only know how to deal with the legacy speed values there is a need to
provide a way to allow input to arrive faster. This problem is solved by
providing a speed factor as a part of a speed specification. For example
a speed can be specified as "speed*factor" or "9600*10".
Each of the speeds greater than 9600bps deliver a character in less than
1ms. Computing inter-character delays in microseconds therefore can't
be precise enough to be well behaved. Measuring the inter-character
delays in instructions (scalled by the calibrated clock) gets us the needed
precision.
A SET CONSOLE SPEED=nnn, where legal values for nnn are common serial
port rates. The speed value will attempt to limit the input data rates to a
simulator to approximately the specified bits per second.
- Accept input comments
- Allow leading and trailing spaces in remote console input commands
- Force prompt to be "sim> " or "SIM> " when in a master mode console session. "SIM> " used during single command mode.
- Enhance performance of single command mode input processing by processing all available input characters before actually flushing output buffers
TMXR API extension to add tmxr_input_pending_ln that reports the existence of additional input data
TMXR also now conforms to revised sim_sock API changes
Ideas based on Dave Bryan's console halt efforts.
sim> SEND {<mux>:line} {DELAY=n,}"string"
Where <mux> is the name of the device pointed to by the TMXR structure. If <mux>:line isn't specified, then the console device is implicitly being referenced.
Delay is optional and once set persists for subsequent SEND operations to the same device. Delay defaults to 1000. The DELAY value is a minimum number of instructions which must execute before the next character in the provided string will be injected to the console port. The DELAY value has effect between the characters delivered as well. "string" requires quotes and within the quoted string, common C escape character syntax is available (\r\r\t, etc.).
Each device (console, and each line in each mux) has a separate value for DELAY.
An arbitrary number of 'expect' conditions can be defined. The command syntax is:
sim> EXPECT {<mux>:line} {[cnt]} "matchstring" {actioncommand {; actioncommand ...}}
Where <mux> is the name of the device pointed to by the TMXR structure. If <mux>:line isn't specified, then the console device is implicitly being referenced.
"matchstring" requires quotes and within the quoted string, common C escape character syntax is available (\r\r\t, etc.). The quotes used can be single or double quotes, but the closing quote must match the opening quote. The match string might be extended to allow the use of perl style regular expressions in the "matchstring" when a -R switch is specified on the command line.
sim> EXPECT "Enter Color: " SEND "Red\r"; g
A specific 'expect' condition can be removed with:
sim> NOEXPECT {<mux>:line} "matchstring"
All 'expect' conditions can be removed with:
sim> NOEXPECT {<mux>:line}
'expect' conditions can be examined with:
sim> SHOW EXPECT {<mux>:line}
Expect rules are one-shots (i.e. they disappear once a match has occurred) unless they are explicitly described as persistent with the -P switch.
The -C switch is available when defining expect rules. The effect of a rule defined with the -C flag is that when an expect match occurs for that rule, ALL rules are cleared for that device (console or <mux>:line).
Now all DDCMP capable devices KDP, DUP and DMC/DMR have access to packet corruption generation to simulate real world imperfect data lines for protocol testing.
- Added halfduplex mode for network connections and corrected modem signal DSR to reflect connection status (vs original attach status), and DCD follows DSR (except in halfduplex mode where it follows CTS).
- Enhance tmxr_set_get_modem_bits to also return the modem DTR and RTS state.
- Separate RTS from DTR when manipulating modem state bits
- Minor fixes to loopback functionality after direct testing with the first loopback client device (DMC11).
- Fix clearing of break input buffer now that input buffers are dynamically allocated
- Changed Modem bit logic to have CTS reflect RTS as expected by devices which may expect this.
- Changed receive buffers to be dynamically allocated and the same size as transmit buffers when transmit buffers are non-default sized.
- Added TMXR line attach in loopback mode. Fixed loopback buffer management
- Added loopback support to TMXR lines
- Added functioning connect poll capability to revised DMC
- Added connection destination display to connection status even when a connection has not yet been established.
- Added extended packet sending and receiving semantics to TMXR allowing for an optional frame byte to exist between length prefixed data packets
Added parsing logic to allow tcp port and connect strings to end in either ";notelnet" or ";telnet" as desired to specifically describe a port setup.
Fixed bug in single line multiplexer attach which returned failed status when it should not have if a tcp connect destination was specified.
Relaxed parsing rules to allow a single line multiplexer to have a listen port specified at either the line level or the mux level.
The is to be used when a mux wants to dynamically change the number of lines it supports. It should explicitly detach an previously configured lines which won't exist after the change prior to changing the line count.
- Added functionality to return the lines with attached serial ports by calling tmxr_poll_conn one time after a serial port is attached.
- Added the ability to close a serial port from the sim> prompt if a device implements a SET dev DISCONNECT=line command. A serial port is closed if the -C switch is specified on the DISCONNECT command line.
- Cleaned up the multiplexer status display based on Dave's recommendations.
scp.c, scp.h
- added sim_uname (Unit Name) API to simplify places which might want to display it (mostly debug messages).
- added support for clock co-scheduling
- added debugging to trace event queue activities
sim_defs.h
- added support for clock co-scheduling
- added support for sim_uname (Thread local storage macro)
- added support for debugging to trace event queue activities
- simplified debug code by using sim_uname
- fixed support macro for sim_is_active when asynch timers are in use
sim_rev.h
- fixed nested comments
sim_tmxr.c, sim_tmxr.h
- added support for clock co-scheduling
- simplified debug code by using sim_uname
- added support for devices which poll for output on different units
sim_timer.c, sim_timer.h
- added support for clock co-scheduling
- fixed asynchronous clock calibration to smooth out calibration adjustments
- simplified debug code by using sim_uname
- added ability (when running with asynchronous support) to explicitly disable or enable asynchronous timer support.
- changed sim_timer_inst_per_sec to return a double value since the result is always used in a double expression and integer overflow could occur under strange timing conditions
vax/vax_stddev.c
- converted from simulator specific clock co-scheduling to generic clock co-scheduling.
vax/vax_cpu.c
- added EVENT and ACTIVATE debug flag (SET CPU DEBUG=EVENT;ACTIVATE) support
pdp11/pdp11_dz.c
- converted from simulator specific clock co-scheduling to generic clock co-scheduling.
pdp11/pdp11_vh.c
- converted from simulator specific clock co-scheduling to generic clock co-scheduling.
pdp11/pdp11_xq.c
- converted from simulator specific clock co-scheduling to generic clock co-scheduling.
Added support for per line tcp listen ports.
Added support for per line outgoing tcp/telnet connections.
Removed DEV_NET from pdp11_dz and pdp11_vh emulators to allow proper restore of
scp.c, scp.h
- Change the sim_clock_queue event list to be terminated by the value QUEUE_LIST_END instead of NULL. This allows easy determination of whether a unit is on a list since when it is not on a list the next pointer is NULL.
- standardized the usage of UPDATE_SIM_TIME
- Added support for internal/pseudo devices to support the TIMER and CON-TEL pseudo devices (to enable and disable debugging)
- Reverted to the prior "SET CONSOLE DEBUG" command semantics since the console debug can be manipulated via the generic "SET <dev> DEBUG" command (i.e. SET CON-TEL DEBUG=TRC;XMT;RCV)
- Changed "SHOW TIMERS" to "SHOW CLOCKS" to display the current calibrated timer information
- Added sim_is_active_bool API to return the boolean active status avoiding the potential work walking the list when most callers aren't interested in the event firing time
- Fixed run_boot_prep to properly record the not queued status of any units which are removed from the sim_clock_queue during initialization
- Added display of DEBUG, NODEBUG options to the SHOW SHOW command
sim_timer.c, sim_timer.h
- Added asynchronous timer capabilities with support for calibration and idling
- Added internal/pseudo device to support debugging of Idle, Calibration and asynch timer activites.
- Added suppression of timer calibration when idling has occurred
sim_tmxr.c, sim_tmxr.h
- Added tmxr_activate_after and macro definition for sim_activate_after to invoke it for proper behavior with multiplexer devices
- Added all polling units to the standard timer queue when dropping back to the simulator command prompt to accommodate the potential to disable asynch mode
- Fixed synchronization to operate with pthread synchronized asynch queue and proper stopping of poll when dropping back to the simulator command prompt
- Fixed calls to select to have a timeout with properly ranged tv_usec values and dealt with possible EINTR return from select
sim_console.c, sim_console.h
- Changed internal/pseudo console telnet device name to CON=TEL
- Reverted to the prior "SET CONSOLE DEBUG" command semantics since the console debug can be manipulated via the generic "SET <dev> DEBUG" command (i.e. SET CON-TEL DEBUG=TRC;XMT;RCV)
- Fixed synchronization to operate with pthread synchronized asynch queue and proper stopping of poll when dropping back to the simulator command prompt
- Fixed calls to select to have a timeout with properly ranged tv_usec values
sim_defs.h
- Added necessary unit fields to support asynchronous timing activities
- Added asynchronous macros to support async timing activities
- Fixed asynch pthread only macros (not using AIO_INTRINSICS).
- Fixed the definition of the UDATA macro which was never adjusted to accommodate the insertion of 2 extra fields in the unit structure and thus made the initialization of the unit wait field meaningless.
- Changed the NOQUEUE_WAIT value from 10000 to 1000000. This is only used when the sim_clock_queue is empty, which normally never happens on any simulator since they all have clocks and/or other frequently polling devices. With asynchronous multiplexer and timing support the queue is often empty and this value is then used when calculating idling delays. If it is too small, idling will be inefficient. Being large should not be a problem otherwise.
Interdata/id16_cpu.c
- removed test of sim_idle_enab before calling sim_idle
Interdata/id32_cpu.c
- removed test of sim_idle_enab before calling sim_idle
vax/vax_cpu.c
- removed test of sim_idle_enab before calling sim_idle
vax/vax_stddev.c
- converted CLK device to use the internal timer service API sim_activate_after to leverage asynchronous timing when available
scp.c, scp.h, sim_defs.h
- Added commands:
SHOW MULTIPLEXER (MUX)
SHOW TIMERS
- Added facilities/APIs:
sim_activate_after - time specific event scheduling (vs instruction scheduling) API visible, optional separate thread implementation in a later revision
- Changed Commands:
SET CONSOLE DEBUG no longer affects global debugging, but merely debugging for the console subsystem. Use SET DEBUG and SET NODEBUG to affect global debugging.
- Added Asynchronous polling support
sim_tmxr.h, sim_tmxr.c
- Added Asynchronous capabilities to the multiplexer subsystem to avoid polling for input and to deliver input data instantly when it arrives instead of delaying for up to one or more full simulated clock ticks.
- Added debug trace support
- Added statistic tracking of total bytes transmitted on each line
- Added more aggressive attempts to flush transmit buffers when they fill before dropping tranmitted characters
- Fixed status return of tmxr_putc_ln to return SCPE_LOST if the transmitting line isn't connected or buffered.
sim_console.h, sim_console.c
- Fixed issue where connections to console telnet sessions would succeed for the first connection, but hang indefinitely for additional connects without rejecting due to all lines being busy. This is handled by using an internal device and unit to hang the required polling on. Connection polls happen once per second.
- Added console debugging/trace support.
- Added Asynchronous capabilities to the console subsystem to avoid polling for input and to deliver input data instantly when it arrives instead of delaying for up to one or more full simulated clock ticks.
- Added tmxr_set_console_input_unit() API to support asynchronous simulator console I/O
sim_timer.h, sim_timer.c
- Added SHOW TIMERS support
- Added mechanism to capture the timer the simulator uses for its clock tick and make this timer globally available for other uses
PDP11/pdp11_dz.c
- Added debug trace support
PDP11/pdp11_vh.c
- Added debug trace support
- Changed timing mechanisms to not assume that the count unit service routine calls measures the passage of time, and created a separate unit to measure time.
VAX/vax_stddev.c
- Added call to tmxr_set_console_input_unit to leverage Asynchronous console I/O
It also modifies the HP 2100 and PDP11 multiplexers to add serial support as demonstrations of the capability that, one day, might be extended to all simulators. I have tested the HP support, but I relied on Holger Veit to test the DEC stuff, so I can't guarantee that it works. I also relied on Holger to test under Linux, so the same caveat applies.
The changes needed in the device simulators are relatively small. For example, if you look at the patches for "hp2100_baci.c", you'll note that most of them are documentation changes. The only things of note are:
- an expansion of the TMXR initializer
- additional code in the "attach" routine to try attaching a serial port
if attaching a socket fails
- additional code in the "detach" routine for the same reasons
The HP MPX device (hp2100_mpx.c) needs a tiny bit of additional support from the ATTACH and DETACH commands. Specifically, SCP was modified to set a flag ("sim_unit_ref") to indicate whether ATTACH MPX or ATTACH MPX0 was done, i.e., to differentiate between a device and a unit attach (recall that SCP treats these as both referring to unit 0). This is needed because the socket attaches (logically) to the device, whereas a serial port attaches to a line. Without this flag, the attach routine cannot differentiate between ATTACH MPX and ATTACH MPX0, as the distinction is lost by the time the VM's attach routine is called. This support isn't needed for the HP MUX device because the socket attaches to a different device than the lines do.
MPX also requires a bit more work due to the capability to mix serial and Telnet lines on the same multiplexer (BACI is a single-line terminal device).
The attached PDF contains revisions to the "Writing a Simulator for the SIMH System" publication that documents the additions and changes to the multiplexer library for serial port support. User documentation for serial port support currently exists only in the initial comments in "sim_tmxr.c"; I will add the appropriate text to the "SIMH User's Guide" if we decide to add this to the release version.
A key capability needed to support simulators running with background
execution is the ability to have a Telnet connected console which isn’t
continuously connected. This feature is called a Buffered Telnet console.
Absolutely nothing changes for someone not interested in using the feature.
However, if someone is interested in the feature, the following SCP
commands are available:
sim> SET CONSOLE TELNET=port ! Unchanged
sim> SET CONSOLE TELNET=BUFFERED{=buffersize} ! buffersize defaults to 32K
sim> SET CONSOLE TELNET=UNBUFFERED ! restores normal behavior
sim> SET CONSOLE TELNET=NOBUFFERED ! synonym for UNBUFFERED
sim> SET CONSOLE TELNET=LOG=logdestination ! enables logging of Telnet session traffic (potentially separate from destination specified by SET CONSOLE LOG=conlogdest)
sim> SET CONSOLE TELNET=NOLOG ! turns off specific logging of Telnet session
sim> SET CONSOLE TELNET=LOG=conlogdest ! turns on logging all console traffic (unless the telnet session logging is also specified).
The logdestinations for any of the logging/debugging commands can
now be:
LOG, DEBUG, STDOUT, STDERR or any file specification (caps are not
required, but these names are reserved to indicate the current
destination of the specified file handles (sim_log, sim_deb,
stdout, stderr).
When a Console Telnet session is Buffered, a simulator will start
(via BOOT CPU or whatever is appropriate for a particular simulator)
without needing to have an active telnet connection. When a Telnet
connection comes along for the telnet port, the contents of the saved
buffer (which wraps on overflow) are presented on the telnet session
as output before session traffic. This allows the connecting telnet
client to see what happened before he connected since the likely
reason he might be connecting to the console of a background
simulator is to troubleshoot unusual behavior.
The current structure has the optional ability to log the Telnet
session separately from the simulator output (i.e. ini file command
execution) is potentially useful when you need to review what the
simulator may have output which may be difficult to find in and
amongst the possibly verbose Operating system console output.
If someone doesn’t use “SET CONSOLE TELNET=LOG=logdestination”,
then the original strategy of logging all output to the target
specified by “SET CONSOLE LOG=logdestination” is preserved. Looking
at the isolated console output might be more interesting if/when
control flow scp commands are ever implemented (ON,GOTO, RETURN, etc.)
The makefile now works for Linux and most Unix's. Howevr, for Solaris
and MacOS, you must first export the OSTYPE environment variable:
> export OSTYPE
> make
Otherwise, you will get build errors.
1. New Features
1.1 3.8-0
1.1.1 SCP and Libraries
- BREAK, NOBREAK, and SHOW BREAK with no argument will set, clear, and
show (respectively) a breakpoint at the current PC.
1.1.2 GRI
- Added support for the GRI-99 processor.
1.1.3 HP2100
- Added support for the BACI terminal interface.
- Added support for RTE OS/VMA/EMA, SIGNAL, VIS firmware extensions.
1.1.4 Nova
- Added support for 64KW memory (implemented in third-party CPU's).
1.1.5 PDP-11
- Added support for DC11, RC11, KE11A, KG11A.
- Added modem control support for DL11.
- Added ASCII character support for all 8b devices.
1.2 3.8-1
1.2.1 SCP and libraries
- Added capability to set line connection order for terminal multiplexers.
1.2.2 HP2100
- Added support for 12620A/12936A privileged interrupt fence.
- Added support for 12792C eight-channel asynchronous multiplexer.
2. Bugs Fixed
Please see the revision history on http://simh.trailing-edge.com or
in the source module sim_rev.h.