Clock ticks for these simulatrs are performed by programmatic setup of the
interval timer device (TMR) and have nothing to do with the TODR which
increments at 100Hz, but doesn't generate ticks to the simulated system.
Windows 10 finally supports ANSI escape sequences in console applications.
Simulators may output appropriate sequences and get useful results, however,
timing of the bytes in the output stream to the console device matters.
This change buffers the data in escape sequences for up to 8ms or until another
escape sequence is presented for output. Once the 8ms elapses, then all output
characters are presented to the windows console subsystem together so they
can be properly interpreted.
- Support for arbitrary long wait intervals in sim_activate_after with
precisely correct delays aligned with the calibrated clock once
per second.
- Proper handling of calls to sim_cancel for calibrated timer units
- Properly allow stopping of calibrated clock by calling sim_rtcn_calb
with a ticksper == 0
- Only schedule asynchronous timer activities for delays longer than
the minimal OS sleep time
- Only wake asynchronous timer thread to queue new timer events
that are shorter than the currently shortest scheduled event
It was defined in lowercase and has now been made upper case for consistency.
The code which performs the match also has been change to do a case
insensitive compare.
commit ef6528bf32 added support for automatic WRU detection for simulators
that don't have a console port, but it was never documented and the addition of
that support potentially interfered with SAVE/RESTORE behavior.
The console connection state is now automatically saved and restored.
Also:
- Avoid potential divide by zero when stopping a running calibrated clock.
- Quickly reflect newly calibrated clock info in additional timers that may be running
Removing pseudo ticking of the TODR improves simulator behavior
when idling. As previously implement, the timing of the TODR and TMR
ticks weren't aligned and and idle simulator would have to wake up to
service both tick activities.
The real hardware has a TODR which changes every 10ms to reflect changes
to wall clock time. This is already completely achieved by referencing the
host system time whenever the TODR register is referenced. No need for
to simulate pseudo ticking.
The real interval timer hardware generates ticks a the rate specifically
programmed in the interval timer device registers. The common cases
programmed the ticks at 10 ms intervals (100Hz), but real operating systems
exist which programmed ticks at 16667 usecs (60Hz).
Also:
- allow a timer to dynamically stop itself (by calling sim_rtcn_calb
with tps=0), and then to start the internal timer to provide a calibration
baseline if necessary.
- Fix coschedule interval computation when the queue is empty.
- Properly select the correct timer for coscheduling without a specific tmr
- Properly adjust the coschedule queue's next time value when entries are
canceled.
- Cleaned up throttling to behave well with all potential throttling rates and
to make visible what is happening when boundaries are reached.
Additionally, calls to sim_activate_after with delay values that exceed
twice the tick size of the calibrated clock are now coscheduled with
the calibrated clock.
Historically, hosts which have a tick size slower than the tick a simulator
wants to implement can't idle effectively and keep good time.
This change allows simulators which call sim_rtcn_tick_ack() to provide
useful idling behavior while still keeping the passage of wall clock time
to time in the simulator accurate.
When the TODR device (CLK) is attached to a state file, it operates in OS
agnostic mode. This file can now be ported between hosts with different
endianness and work consistently to track the time of year.
Additionally, the VAX and VAX750 TODR values now properly don't
progress when they have zero values (or when they overflow back to zero).
The output of remote console commands gets truncated at the configured
buffer size. The default has been raised from 1400 to 8192.
Common remote console usage is from the same host as the simulator and
as such localhost TCP traffic is delivered in chunks at least 8192 so no extra
packets will be involved in transporting the potential extra data and no
transmission delays on the send() call.
The minumum size is now 1400 (which was the prior default).
Also:
- Added more statistics
- Made sleep measurements more precise
- Correct idle sleep decision logic without regard to host tick size
- Fix calibration setup/teardown when host tick size is large (>10ms)
- Generalized large host tick test capability (MS_MIN_GRANULARITY)
- Fixed Windows sim_os_msec() to always use timeGetTime()
- Fixed coschedule routines (that don't mentoin a tmr) to default to
timer 0 and fallback to the internal timer otherwise.
- Removed dependency on sizeof(tv_sec) in timespec structure for MinGW
As reported by Josh Dersch in #358
Read hardware notes:
- While the TCCM error bit is a real flop, it is supposed to reflect
the OR of the TCST error bits at all time, so it is updated on read.
- A read of TCDT while the function is RALL clears DONE.
Write hardware notes:
- The TC11 behaves much more like a traditional DECtape controller
than a typical PDP11 peripheral. In particular, execution is
initiated/controlled by any write to TCCM, rather than setting
the GO (DO) bit. Unless the function is STOP or STOP ALL, writing
TCCM will put the selected tape in motion.
- Writing GO (DO) clears DONE (READY) and the error flops in TCST.
- Writing a 0 to ERROR clears the error flops in TCST. Because it
is write 0 to clear (later controllers used write 1 to clear),
the simulator has to know whether ERROR is actually written.
- STOP ALL ignores select errors. Every other function is rejected
if there is a select error.
- An illegal operation (setting ILO) will stop the selected tape.
- A write of TCDT while the function is RALL, WALL, or WTMK clears
DONE (READY). RALL should not be included, but it saved a gate
not to prevent it.
- Because DONE (READY) may not be clear when an operation completes
and DONE (READY) is set, the DT_SETDONE must test for DONE (READY)
not being already set.