256. ENHANCEMENT: Add tape runaway support to the simulator tape library.
OBSERVATION: The ANSI specifications for NRZI, PE, and GCR tape recording
mandate a maximum length of 25 feet for erase gaps. Currently, an erase
gap of any length is ignored when reading or spacing. To allow detection
of non-compliant tape images, the simulator tape library is enhanced to
halt positioning and return tape runaway status if a gap of 25 feet or more
is encountered.
Runaway detection is enabled by calling the tape library to set the tape
density in bits per inch. If this call is not made, erase gaps present in
a tape image are effectively ignored. Also, with the addition of a
separate "set density" call, it is no longer necessary to supply the
density when writing erase gaps.
RESOLUTION: Modify "sim_tape_rdlntf" and "sim_tape_rdlntr" (sim_tape.c) to
detect tape runaway, and add a new MTSE_RUNAWAY status to sim_tape.h. Add
new "sim_tape_set_dens" and "sim_tape_show_dens" functions to set and show
the bits per inch for a unit, respectively, and eliminate the "bpi"
parameter to "sim_tape_wrgap" in preference to using the density
established by a previous "sim_tape_set_dens" call. Add named constants
to "sim_tape.h" that specify the density.
257. ENHANCEMENT: Improve performance when reading or spacing over erase gaps.
OBSERVATION: Performance when reading or spacing over erase gaps is poor,
especially in the reverse direction. Currently, each 4-byte gap marker is
read individually, and in the reverse direction, each read is preceded by a
seek to move the file pointer backward. This combination causes stream
cache invalidation and a physical disc access for each gap marker. As a
single gap consists of over 1000 markers, performance is far worse than if
a gap was read as a block.
RESOLUTION: Modify "sim_tape_rdlntf" and "sim_tape_rdlntr" (sim_tape.c) to
buffer reads of gap markers. Using a 128-element buffer, performance
improves about thirty-fold.
258. PROBLEM: Writing an end-of-medium positions the tape image after the mark.
OBSERVATION: The "sim_tape_wreom" simulator tape library function writes
an end-of-medium marker on the tape image. The intent is to erase the
remainder of the tape. The "SIMH Magtape Representation and Handling"
document states that the tape position is not updated by this function.
However, the function leaves the tape positioned after the marker.
A subsequent read would stop at the EOM marker. However, writing a new
marker over that one would then allow reading of the data following the EOM
that supposedly had been erased by the original "sim_tape_wreom" call.
CAUSE: The tape position is updated by the internal "sim_tape_wrdata" call
that is used to write the EOM marker, but it is not reset afterward by the
function.
RESOLUTION: Modify "sim_tape_wreom" (sim_tape.c) to reset the tape
position to point at the EOM marker before returning. This prevents
reading past an EOM marker, and a subsequent write will overwrite the
marker rather than embed it between data records.
259. PROBLEM: Reading through an erase gap in reverse may return EOM status.
OBSERVATION: A reverse read or spacing operation through an erase gap may
return end-of-medium status. Reading or spacing forward through the same
gap works properly.
CAUSE: Writing an erase gap over existing records may produce a gap that
is longer than requested. This occurs when truncating the last record to
be overlaid by the gap would leave a record that is shorter than the
minimum size allowed (eight bytes for the length words plus two bytes for
the data). In this case, the gap is lengthened to overlay the entire
record. If the new gap size is not evenly divisible by four, a half-gap is
metadata marker of value 0xFFFF added to the beginning of the gap.
If a gap that begins with a half-gap marker is written immediately after
a previous gap, the "seam" between gaps will contain the bytes FE FF FF FF
( FF FF ) FE FF FF FF.... Reading forward across this seam will yield a
metadata value of 0xFFFEFFFF, which is recognized and handled by seeking
two bytes back to resynchronize reading. However, reading in reverse will
yield the value 0xFFFFFFFF, which is interpreted as end-of-medium.
RESOLUTION: Modify "sim_tape_rdlntr" (sim_tape.c) to recognize 0xFFFFFFFF
as a half-gap marker and resynchronize in response. End of medium cannot
occur when reading in reverse, as it is impossible to position the tape
image beyond an EOM marker. Therefore, any 0xFFFFFFFF value encountered
must be a half-gap "seam" originating as above.
260. PROBLEM: sim_tape_wrgap fails when format is changed from SIMH format.
OBSERVATION: The HP 2100 magnetic tape simulator supports erase gaps and
calls sim_tape_wrgap when commanded to write a gap. However, if a tape
format other than SIMH format is selected, the call fails with MTSE_FMT.
CAUSE: Erase gaps are not supported in formats other than SIMH, but the
call should not fail. Instead, the call should be a "no-operation" if the
underlying format does not support gaps.
RESOLUTION: Modify "sim_tape_wrgap" (sim_tape.c) to return MTSE_OK with no
action performed if a tape format other than SIMH is selected.
261. PROBLEM: The magnetic tape format of an attached unit may be changed.
OBSERVATION: The magnetic tape library supports several tape image
formats. The format to use may be specified either by an "ATTACH -F"
command or by a "SET <unit> FORMAT" command. The latter calls the
"sim_tape_set_fmt" function, which allows the format of a file currently
attached to be changed. However, the format is an intrinsic property of
the tape image file, so changing it once the file has been attached makes
no sense.
CAUSE: Oversight.
RESOLUTION: Modify "sim_tape_set_fmt" (sim_tape.c) to return an error
(SCPE_ALATT, "Unit already attached") if the unit is attached.
The current implementation of "run_cmd" in scp.c calls "fprint_stopped_gen" (via "fprint_stopped") to print the message associated with the "sim_instr" return status. Messages associated with VM stops must be provided to the SCP via the "sim_stop_messages" array.
"fprint_stopped_gen" prints the status message in a rigid format: the message string, a comma, the program counter register name, a colon, the current PC value, and the instruction at that address in symbolic format.
For example:
HALT instruction, P: 24713 (LDA 1)
Only the message string is under the control of the VM. If additional information is needed, it can only be added before the first comma.
The HP2100 simulator does this for halt instructions, which contain device select code and flag hold/clear bit fields that, in practice, are used to communicate to the operator the significance of the particular halt encountered, rather than to affect the device interface:
HALT instruction 102077, P: 24713 (LDA 1)
To implement this, the simulator must define the message as a variable and then copy the formatted octal value into the buffer at the appropriate location before returning from "sim_instr".
However, if the VM wants to display a different register value, e.g.:
Self test #13 complete, STAT: 000020
...this cannot be done without also displaying the program counter, which may be irrelevant for the given stop condition.
001. PROBLEM: Cannot show radix, etc. for a device that has no modifiers.
OBSERVATION: The default data radix for a device may be set with the SET
<dev> OCT|DEC|HEX command. However, if the device does not have a modifier
table, SHOW <dev> RADIX is rejected with "No settable parameters".
The same problem occurs for SHOW <dev> DEBUG and SHOW <dev> NAMES. For a
device that provides debug printouts, SHOW <dev> MOD will list "DEBUG,
NODEBUG" among the modifiers, and the SHOW <dev> DEBUG command will display
the current debug status. However, if the device does not contain a
modifier table, SHOW <dev> MOD and SHOW <dev> DEBUG will report "No
settable parameters", even though SET <dev> DEBUG is accepted and works as
expected. For such a device, SHOW MOD will show "DEBUG, NODEBUG" as
acceptable modifiers.
002. PROBLEM: SET and SHOW responses for invalid entry are inconsistent.
OBSERVATION: Entering SET <dev> <mod> where <mod> is not defined in the
device's modifier table displays "Non-existent parameter." Entering SHOW
with the same parameters displays "Invalid argument."
Similarly, entering SET <dev> DEBUG for a device that does not have
debugging capability displays "Command not allowed." Entering SHOW with
the same parameters displays nothing.
In both cases, the messages displayed should be the same for the same
error.
OBSERVATION: For a simulator stop, sim_vm_fprint_addr (if defined) is
called to print the value of the program counter, regardless of whether or
not the register was defined with REG_VMAD. However, displaying the PC
value with "examine" calls sim_vm_fprint_addr only if the REG_VMAD flag is
present. The displayed value of the PC should be the same in both cases.
Make sure to properly support multiple receive buffers by correctly setting the data length read and the appropriate buffer descriptor status bits for each buffer descriptor that is used to hold a packet.
- removed cycle counting in CPU, the sim_interval issue
- fixed the Console multiplexer logic; it now works with SET REMOTE TELNET= and SET CONSOLE TELNET=
- commented testhdt.sim
- changed run.cmd to try to execute either VStudio or mingw executable, in this order.
- changed printf messages to use sim_printf
Possible issues remaining:
- timer device polling, not yet debugged, the rate of 1.25MHz is likely still incorrect, so UCSD wall clock is surely wrong
- few instructions still to be trapped by opcode.debug - I haven't seen them in life code yet
- HD device still not yet finished; I'll pick this up again soon