SIMH Global Fixes ================= INCORPORATED FIXES ------------------ The following modifications have been incorporated into the global code base and released to the public: 22. PROBLEM: Doing an EDIT pending line character insert with CTRL+S doesn't work. VERSION: 3.2-1 OBSERVATION: CTRL+S is not passed through to the simulated program. Instead, pressing CTRL+S and typing simply absorbs the first character, and the editor stays in "replace" mode for the succeeding characters. CAUSE: The keyboard "peek" routine that checks for a pending input character does not operate in "raw" mode. The simulator calls "_kbhit" to determine if an input character is pending and "_getch" to retrieve that character. "_getch" calls the Windows routine "SetConsoleMode" to set the input mode to "raw" (i.e., no processing of the input characters). However, "_kbhit" does not, and so the CTRL+S is intercepted and processed by Windows. RESOLUTION: Modify "sim_ttrun" and "sim_ttcmd" (sim_console.c) to switch the console into and out of "raw" mode. This inhibits "_kbhit" from interpreting the input character stream. As an added benefit, CTRL+C is no longer interpreted as SIGINT, so all of the associated signal-handling code ("win_handler", etc.) may be removed. STATUS: Fixed in version 3.2-2. 25. PROBLEM: Logging console output to a file produces CR CR LF as line terminators. VERSION: 3.2-1 OBSERVATION: When console logging is enabled, simulator messages as well as the console output from the simulated system are written to the log file. The former outputs CR LF at the end of each line. The latter outputs CR CR LF. CAUSE: The log file is opened in "text mode" by default, which translates LFs (C newlines) to CR LF sequences. Simulator messages terminate with newlines, and these are translated to CR LF sequences. When the simulated system writes characters to the console, they are also written to the log file. When the simulated system outputs a CR, it is output verbatim. When it follows that with an LF, however, that gets translated into a CR LF, so the log file then has CR CR LF as the end of line sequence. RESOLUTION: Flush the accumulated file stream buffer and change the file mode from TEXT to BINARY in "sim_ttrun" (sim_console.c) when the simulation starts, and then back to TEXT in "sim_ttcmd" when the simulation ends. STATUS: Fixed in version 3.2-2. 27. ENHANCEMENT: Add an "echo" command to print arbitrary strings on the simulation console for use in simulation command files. VERSION: 3.2-2 OBSERVATION: Simulation command files allow automation of complex or tedious simulator setups. Because of the potentially lengthy sequence, it would be helpful if the command file had a way to inform the user where it was in the process. Providing a command to do this allows messages such as "Loading diagnostic," "Configuring diagnostic," etc., to be printed during command file execution. RESOLUTION: Implement an "echo " command (scp.c). STATUS: Fixed in version 3.2-3. 32. PROBLEM: Running the 7970 diagnostic reports "Magtape library I/O error: Invalid argument" when executing Test 4. VERSION: 3.2-2 OBSERVATION: The error occurs when a write is aborted with a clear command. CAUSE: If a CLR command is issued with a write in progress, the simulator attempts to mark the record as bad on the tape by adding the "MTR_ERF" flag to the "sim_tape_wrrecf" call. Unfortunately, that function does not remove the flag before calling "sim_fwrite", and so the eventual OS call sees the equivalent of a very large record length and therefore returns EINVAL. RESOLUTION: Modify "sim_tape_wrrecf" (sim_tape.c) to mask off the "MTR_ERF" flag when determining the record length. STATUS: Fixed in version 3.2-3. OBSERVATION: The library error is not stopping the simulator, even though the STOP_IOE variable is set. CAUSE: "sim_tape_ioerr" is returning "SCPE_IOERR" instead of "MTSE_IOERR", and "ms_map_err" maps this to "SCPE_OK", so the simulator isn't halted. RESOLUTION: Modify "sim_tape_ioerr" (sim_tape.c) to return "MTSE_IOERR" instead of "SCPE_IOERR". STATUS: Fixed in version 3.2-3. 49. PROBLEM: The "do" command does not obey the "-v" ("verbose") option switch when console logging is in effect. VERSION: 3.2-2 OBSERVATION: Command file commands are always written to the console log file, regardless of the setting of the "-v" switch. Commands are only displayed on the console when "-v" is specified. The console log file, therefore, is not a copy of what appeared on the console. CAUSE: Output of the file commands is not conditional on the "-v" switch. RESOLUTION: Modify "do_cmd" (scp.c) to condition writing file commands to the console log on the "-v" switch. STATUS: Fixed in version 3.2-3. 50. PROBLEM: The "echo" command does not echo to the console log file. VERSION: 3.2-2 OBSERVATION: The "echo" command writes its argument only to the console. If logging is in effect, the echoed strings will not appear in the file. CAUSE: This action was omitted. RESOLUTION: Modify "echo_cmd" (scp.c) to copy the echoed argument string to the console log file if logging is in effect. STATUS: Fixed in version 3.2-3. 58. PROBLEM: According to the HELP display, SET , SET , and SET CONSOLE should allow a comma-separated list of parameters, but such commands are rejected with "Non-existent parameter." VERSION: 3.2-3 OBSERVATION: Doing HELP SET lists the following syntax for the above commands: set console arg{,arg...} set console options set arg{,arg...} set device parameters set arg{,arg...} set unit parameters None of these work, however, as each accepts only a single argument. Note that the corresponding SHOWs do accept multiple arguments. CAUSE: The "get_glyph" routines that parse the command parameters are missing the option to indicate that commas are glyph separators. RESOLUTION: Modify the appropriate calls to "get_glyph" (scp.c, sim_console.c) to specify ',' as the "optional end of glyph character" parameter. STATUS: Fixed in version 3.3-0. 68. PROBLEM: Attached device output files and debug log files cannot be examined after a simulation stop. VERSION: 3.2-3 OBSERVATION: After stopping simulation, either via a breakpoint or CTRL+E, viewing attached device output files or the device debug log file reveals incomplete data, limiting the ability to determine what has been output at the point of interruption. CAUSE: All files are buffered, and the last bytes output haven't been flushed to disk. RESOLUTION: Modify "run_cmd" (scp.c) to flush the console log file, the debug log file, and any attached output files before returning. STATUS: Fixed in version 3.3-0. 91. PROBLEM: The DO command does not report errors to the log file. VERSION: 3.3-0 OBSERVATION: Commands contained in a DO file that cause errors do not report the errors to the console log file. They are reported to the console. For example: sim> set console log=wibble.log Logging to file "wibble.log" sim> wibble Unknown command sim> do wibble.sim (contains "wibble" as a command) Unknown command sim> quit Goodbye Log file closed But wibble.log contains: Logging to file "wibble.log" sim> wibble Unknown command sim> do wibble.sim sim> quit Goodbye Log file closed Note that the second "Unknown command" message is missing from the log file. CAUSE: "do_cmd" reports errors to "stdout" only. RESOLUTION: Modify "do_cmd" to report errors to "sim_log" if it is not null. STATUS: Fixed in version 3.3-1. 104. ENHANCEMENT: Add a command to abort command file execution if a specified simulator condition is not met. VERSION: 3.3-1 OBSERVATION: Command files need a means of reacting to unexpected program behavior. Currently, if a program deviates from expected behavior, e.g., if a diagnostic fails, the command file will become unsynchronized with the program, leading to nonsensical operation. To provide an escape mechanism for this situation, a command that tests assertions of the simulator state and aborts a running command file if the assertion fails is needed. The syntax is: ASSERT {} {} If is not specified, CPU is assumed. is a register (scalar or subscripted) belonging to the indicated device. The and optional are the same as those provided by the "examine" and "deposit" commands. The s are expressed in the radix specified for , not in the radix for the device. If the and are specified, the target register value is first altered as indicated. The result is then compared to the via the . If the result is false, an "Assertion failed" message is printed, and any running command file is aborted. Otherwise, the command has no effect. RESOLUTION: Modify "scp.c" to add "assert_cmd" and associated command table entries. STATUS: Fixed in version 3.3-2. 109. ENHANCEMENT: Allow the DO command to nest to some finite level. VERSION: 3.3-2 OBSERVATION: Allowing a limited depth of nested DO invocations is useful for modularizing simulator command files. The current prohibition is not necessary, as "do_cmd" is reentrant. RESOLUTION: Modify "do_cmd" (scp.c) to allow DO command nesting, provide a recursion counter to disallow infinite nesting, and alter the text of the SCPE_NEST error to reflect allowed nesting. STATUS: Fixed in version 3.4-0. 110. PROBLEM: SET DEBUG=n1,n2,... doesn't work. VERSION: 3.3-2 OBSERVATION: For devices with multiple debug flags, trying to set more than one with the above command fails with "Non-existent parameter." Setting the flags one at a time with separate commands works as expected. CAUSE: The command parser breaks SET commands at commas, so "n2" is interpreted as the next top-level SET command, rather than as another debug flag. RESOLUTION: Alter the debug flag separator from "," to ";". STATUS: Fixed in version 3.4-0. 111. ENHANCEMENT: Allow SET DEBUG to mean "set all debug flags." VERSION: 3.3-2 OBSERVATION: Currently, if a device has multiple debug flags, SET DEBUG is rejected. To set all flags, they must be specified individually. RESOLUTION: Alter "set_dev_debug" (scp.c) to set all debug flags if none are specified in the SET DEBUG command. STATUS: Fixed in version 3.4-0. 113. PROBLEM: "SET CONSOLE DEBUG" with no parameter crashes the simulator. VERSION: 3.6-0 OBSERVATION: Entering "SET CONSOLE DEBUG" without the "=" causes the simulator to crash with an access error. CAUSE: Null pointer dereferenced in "sim_set_debon". RESOLUTION: Return SCPE_2FARG if "cptr" is null (no parameter supplied) or points to a null character (empty parameter supplied). STATUS: Fixed in version 3.6-1. 114. PROBLEM: Nested command files do not abort on assertion failure. VERSION: 3.6-0 OBSERVATION: While a failed assertion will abort a running command file, it will not abort if the assertion is in a nested command file invocation. CAUSE: "do_cmd" is always passing back SCPE_OK, regardless of whether an invoked command returns an error status. This is apparently an attempt to avoid duplicate error messages if the last command in a command file fails (the error is printed within "do_cmd" and then again in the main command loop). RESOLUTION: Modify "do_cmd" (scp.c) to return all command error codes and to return SCPE_OK on command file EOF. STATUS: Fixed in version 3.7-0. 115. ENHANCEMENT: Provide an -E switch to DO to abort a command file on any error. VERSION: 3.6-0 OBSERVATION: Current DO processing ignores command errors. That is, if a command returns an error, the error message is printed, but processing continues with the next command in the file. This is inherently risky, as command files must be written with the expectation that every command will succeed (because there is no error trapping or conditional execution). RESOLUTION: Add a new -E switch to cause command file execution to be aborted at the first error encountered. Note that SCPE_STEP is not considered an error, and simulator-specific errors, e.g., "infinite indirect loop," does not cause an error abort (simulator limitation). STATUS: Fixed in version 3.7-0. 116. ENHANCEMENT: Two gcc compiler warnings are corrected. VERSION: 3.6-0 OBSERVATION: Running gcc in strict ISO C99 standard mode (-std=c99 -Wall -pedantic) reveals two warnings: HP2100/hp2100_mux.c:160: warning: missing braces around initializer HP2100/hp2100_mux.c:160: warning: (near initialization for `mux_ldsc[0]') and: sim_ether.c: In function `eth_mac_scan': sim_ether.c:271: warning: short unsigned int format, short int arg (arg 3) CAUSE: The first warning is due to an incompletely specified declaration. The variable is an array of structures, so the (partial) initializer should be "{ { 0 } }" but is actually "{ 0 }". The second warning is due to a mismatch between a "sscanf" format and the corresponding parameter type. The format, "%hx", requires a short unsigned int parameter, but the parameter is declared as short int. RESOLUTION: The code causing the warnings is corrected. STATUS: Fixed in version 3.7-0. 124. PROBLEM: Running FC under RTE aborts the simulation with an "Invalid magtape record length" error. VERSION: 3.6-1 OBSERVATION: Attempting to run the RTE "FC" ("File Copy") tape archive program to generate a tape image fails. The Read command is failing with tape library error 4, "Invalid record length." Enabling the debug mode of the 7970 tape drive simulator reveals that FC is attempting to leave space at the beginning of the tape for the archive directory by issuing a series of GAP commands. After the files are stored, the tape is rewound, and the directory is written, intending to overwrite the erased area. CAUSE: FC writes items to the tape in this order: header, marker, comment, directory, data file(s), and two EOFs. FC is issuing GAP commands to leave space at the start of the tape for the tape header, which must be written after the tape is complete, because the header indicates the number of data files that fit on the tape. The SIMH mag tape library does not implement the "erase gap" feature, and the 7970 simulator treats GAP as a NOP, so no space is reserved at the start of the tape image. When FC rewinds and writes the directory, it overwrites the existing records, resulting in a corrupt tape image. RESOLUTION: Implement an "erase gap" feature in the SIMH tape library by defining GAP metadata markers, adding a "sim_tape_wrgap" command and enhancing the "sim_tape_rdlntf" and "sim_tape_rdlntr" internal functions to skip over GAP metadata markers (sim_tape.c). Alter the 7970 simulator (hp2100_ms.c) to use it. Also, update the "mtdump" utility to report erase gaps in tape images. Note: All HP 7970 mag tape drivers (SIO, BCS, DOS, RTE) employ the GFM (erase gap and write file mark) command to write an EOF to tape. Also, the tape diagnostic tests that an initial gap precedes the first data record or EOF written at BOT (a function of the interface card). Consequently, generated tape images contain substantial amounts of GAP metadata. In almost all cases, they are unnecessary. Therefore, these gaps are written only if the REALTIME option is selected. Note that this does not affect the GAP command itself, which always writes gap metadata to tape images. STATUS: Fixed in version 3.7-0. 131. PROBLEM: Errors in nested command files give no indication where the error occurred. VERSION: 3.6-1 OBSERVATION: Unless the -V switch is specified, errors in command files report the error message but not the offending command. With the advent of nested command files, the problem becomes more acute, as there is no indication in which of perhaps several nested command files the offending command is located, nor even which command is causing the error. And because -V is not transitive, each DO command appearing in each command file must be edited to add the -V switch if the error is to be located. CAUSE: The implication of errors in nested command files was overlooked when nesting was enabled. RESOLUTION: Modify "do_cmd" (scp.c) to echo commands causing errors, regardless of the -V switch, unless -Q (quiet) is supplied when starting SIMH. Also, report the name of the file containing an offending command. Note: because commands returning error status are now displayed, error message processing for the ASSERT command is simplified. In particular, the extra code that merged the assertion into the error message is no longer required. STATUS: Fixed in version 3.7-0. 152. ENHANCEMENT: Add debug printouts to the 12875A Interprocessor Link. VERSION: 3.7-0 OBSERVATION: Debugging HP 2000 Time Shared BASIC systems would be easier if the internal state of the link simulator was observable and recordable. RESOLUTION: Modify "hp2100_ipl.c" to add debug-mode printouts. Modify "sim_defs.h" to add a "DEBUG_PRJ" macro. STATUS: Fixed in version 3.7-1. 156. PROBLEM: Breakpoint actions aren't executed properly if the breakpoint occurs in a DO file. VERSION: 3.7-0 OBSERVATION: Breakpoint actions are not reliably executed if they appear in a DO file. Given this "t.sim" command file: break 100; e 0-1 go break 200; e 2-3 go e 4-5 ...then entering "do t.sim" at the command prompt produces this output: Breakpoint, P: 00100 (NOP) Breakpoint, P: 00200 (NOP) 4: 000000 5: 000000 sim> e 2-3 2: 000000 3: 000000 Note that the "e 0-1" is not executed at all, and the "e 2-3" is executed after the "e 4-5". CAUSE: Breakpoint actions are executed by a call to "sim_brk_getact" in the main execution loop. The call is missing from the execution loop in "do_cmd". In the test case, the "e 2-3" is being executed by the "sim_brk_getact" in the main execution loop after command file execution terminates. This out-of-sequence execution could have serious consequences, e.g. if the command were intended to clear a log file prior to a debug run ("! del big.log") but instead deleted it at the end of the run when the DO file terminated. RESOLUTION: Modify "do_cmd" (scp.c) to incorporate a call to "sim_brk_getact" to process breakpoint commands as they occur. STATUS: Fixed in version 3.7-1. 167. ENHANCEMENT: NOBR with no argument clears breakpoint at the current PC. VERSION: 3.7-0 OBSERVATION: Breakpoints are often required only once, e.g., when establishing which of several paths through a routine is taken. In this case, when a breakpoint is reached, it is immediately removed. The existing breakpoint clear syntax requires specification of the address. It would be helpful if the address defaulted to the current PC, i.e., the location of the breakpoint just hit. RESOLUTION: Modify "ssh_break" (scp.c) to allow omission of the address argument and, if omitted, to clear the breakpoint corresponding to the current PC. STATUS: Fixed in version 3.8-0. 168. ENHANCEMENT: The SHOW VERSION command now reports the patch level. VERSION: 3.3-2 OBSERVATION: Having multiple patched versions of SIMH that report the same version number leads to confusion. But official releases often increment the minor version only. RESOLUTION: Modify "show_version" (scp.c) and "sim_rev.h" to add a reported "patch delta" version number. STATUS: Fixed in version 3.8-0. 176. PROBLEM: The DEPOSIT command will change in some other device if the name is unique to that other device. VERSION: 3.7-3 OBSERVATION: Entering "deposit ptr ppos 0" actually changes the "ppos" register in the "tty" device. It should give an error that "ppos" does not exist in the "ptr" device. CAUSE: The "exdep_cmd" routine is calling "find_reg_glob" if the "find_reg" routine returns a not-found error for the selected device. "find_reg_glob" searches for a unique name among all devices and returns it if found. RESOLUTION: Modify "exdep_cmd" (scp.c) to search for a global register name only if the device was not explicitly specified. STATUS: Fixed in version 3.8-0. 178. PROBLEM: The free HP 700/92 terminal emulator, QCTERM from AICS, does not work with SIMH. VERSION: 3.7-0 OBSERVATION: Attempting to run QCTERM as a Telnet client with SIMH loses characters. Specifically, the first character typed after a CR is lost. CAUSE: QCTERM is sending "bare" carriage-return characters to SIMH. SIMH presumes that CR will always be followed by LF or NUL in text mode, so it simply drops the next character. For QCTERM, this is the first character of the subsequent transmission. Examination of the Telnet connection initiation code shows that SIMH is sending several command sequences but is not checking the client replies (except for binary mode). A correct negotiation mechanism must be implemented to handle the variety of Telnet clients properly. RESOLUTION: Modify the TNS_SKIP case in "tmxr_poll_rx" (sim_txmxr.c) to skip only LF or NUL following CR. Any other character is processed as is. STATUS: Fixed in version 3.8-0. 187. ENHANCEMENT: Report the device and line number for Telnet connections. VERSION: 3.8-0 OBSERVATION: When connecting a Telnet client to a simulator device via the multiplexer library, the client receives a "welcome" message of the format: Connected to the HP2100 simulator It would be helpful if the user knew to which device and line the client had connected. For example: Connected to the HP2100 simulator MUX device, line 3 The report for single-line devices, e.g., additional terminal devices, would suppress the line number: Connected to the HP2100 simulator BACI device RESOLUTION: Modify sim_tmxr.h to add a "DEVICE *dptr" field at the end of the TMXR structure. Change tmxr_attach() to look up the device from the unit via find_dev_from_unit() and set "dptr" to point at the device. Change tmxr_poll_conn() to print the device name and line number (if more than one line defined) in the greeting message. STATUS: Fixed in version 3.8-1. 189. ENHANCEMENT: Add a mechanism to provide a device-specified connection order for terminal multiplexers. VERSION: 3.8-0 OBSERVATION: Some operating systems allow per-line device drivers for multiplexers (e.g., the HP 12792 and 12920 under RTE). These change the line behavior, so that the existing model of multiplexers as pools of identical lines is no longer valid. A method of specifying line connection order is needed, so that connection to specific device drivers is possible. RESOLUTION: Modify the TMXR structure (sim_tmxr.h) to add an "int32 *lnorder" field that points at an array specifying the line connection order. Modify "tmxr_poll_conn" (sim_tmxr.c) to connect in the order given by *lnorder, if defined, else to connect in ascending port number order. Add "tmxr_set_lnorder" and "tmxr_show_lnorder" routines to provide support for SET LINEORDER= and SHOW LINEORDER commands. STATUS: Fixed in version 3.8-1. 192. PROBLEM: Escaping backslashes in DO commands does not work. VERSION: 3.8-0 OBSERVATION: The SIMH User's Guide says in Section 3.13, "Executing Command Files:" The string %n is recognized as meaning argument n from the DO command line. The character \ has the usual UNIX meaning of an escape character; the next character is interpreted literally, even if it is % or \. The sequence "\%" is recognized as a literal "%" character. The sequence "\\" is not recognized as a literal "\" character; instead, it is left unaltered. In fact, "\%" is the only recognized escape; "\" followed by any other character will not be processed, i.e., the "\" and that character will remain. This makes using parameters in Windows file paths impossible, as this: attach dev c:\path\to\\%1 substitutes for "%1" but leaves the double-backslashes, and this: attach dev c:\path\to\%1 ...does not substitute for "%1" and parses as "c:\path\to%1". Actually, the documented behavior (escaping every character) is undesirable, as it will invalidate every current command file that uses Windows path names. Were it implemented as documented, then a path such as "c:\path\to\file" would be parsed as "c:pathtofile". Even restricting the change to escaping just "\" and "%" will still invalidate current command files that use network paths (e.g., "\\server\\share\\path\to\file" will become "\server\share\path\to\file", which is a local path. This at least is fixable, whereas there is no workaround for the current situation. CAUSE: The argument substituter is checking only for the "\%" case. RESOLUTION: Modify "sub_args" (scp.c) to accept "\\" as a literal backslash, in addition to "\%" as a literal percent sign. STATUS: Fixed in version 3.8-1. 194. PROBLEM: Omitted parameters to DO command files do not substitute null strings for the corresponding arguments. VERSION: 3.8-0 OBSERVATION: Given a command file "cmdfile" containing "echo %1 and %2", the command "do cmdfile a b" results in: a and b ...which is as expected. However, "do cmdfile a" results in: a and %2 ...which is unexpected; the expected response is: a and ...i.e., the null string is substituted for "%2". This would be consistent with argument substitution in operating system command shells. CAUSE: Arguments for omitted parameters are not being considered for substitution. RESOLUTION: Modify "do_cmd" (scp.c) to initialize omitted arguments to NULL and modify "sub_args" to skip null arguments during substitution. STATUS: Fixed in version 3.8-1. 208. PROBLEM: Exiting the simulator does not report "Disconnected from the HP 2100 simulator" on MUX sessions. VERSION: 3.8-0 OBSERVATION: Exiting the simulator detaches all devices. Detaching multiplexer-type devices, such as BACI and MPX, reports "Disconnected from the simulator" on each connected Telnet session. However, no such report appears on MUX sessions. Doing a DETACH ALL does report the disconnection on MUX sessions. CAUSE: As part of simulator shutdown, "detach_all" is called with the "shutdown" parameter set to TRUE. This causes the detach routines for non-attachable units to be called. "ds_detach" calls "detach_unit", which returns SCPE_NOATT for unit 8 (the controller unit). "detach_all" exits on a non-zero status return from a device detach routine, so the devices after DS in the device array are never detached. Doing a DETACH ALL calls "detach_all" with the "shutdown" parameter set to FALSE. This calls device detach routines only for attached units. All of these return SCPE_OK, so MUX is eventually detached, and the disconnection reports are sent to the MUX sessions. Note that the same problem would arise if an attached unit fails to detach cleanly, e.g., due to a file write error. The remaining devices would not be detached before simulator exit. RESOLUTION: Modify "detach_all" (scp.c) to ignore errors from device detach routines during shutdown, so that all devices will be detached. STATUS: Fixed in version 3.8-1. 213. PROBLEM: A DO command without a filename prints the wrong error message. VERSION: 3.8-1 OBSERVATION: The DO command requires a file argument and zero or more parameter arguments. Entering DO without the file argument should print "Too few arguments," as other commands that require arguments do (e.g., ATTACH, BOOT, etc.). Instead, it prints "File open error." CAUSE: A test in "do_cmd" attempts to detect when no arguments are passed and return SCPE_2FARG in response, but the test always fails. As a result, "fopen" is called with a NULL filename parameter. The call fails, resulting in the "File open error" message. The test follows the initialization of the "do_arg" array and depends on initialization stopping when a null argument is encountered. The bug fix of 25-Jul-2008 ("DO cmd missing params now default to null string") modified "do_arg" initialization to cover the entire array. Therefore, the test to determine if "do_arg" was not initialized (which implies that the file argument was not passed) never trips. RESOLUTION: Modify "do_arg" (scp.c) to test "do_arg[0]" for NULL and to return SCPE_2FARG if so. STATUS: Fixed in version 3.9-0. 232. PROBLEM: SHOW doesn't show the unit number when all but one unit are disabled. VERSION: 3.8-1 OBSERVATION: For multi-unit devices, the SHOW command prints device information on the first line and then prints each unit's information on succeeding lines. For single-unit devices, the device and unit information are combined on one line, as the device name is allowed as a synonym for unit 0. However, if a multi-unit device has all but one unit disabled, the SHOW command reports the remaining unit as though the device had only one unit, implying that the enabled unit is unit 0. For example, HP device DQC has two units. Attaching a file to unit 1 and disabling unit 0 produces this output for the SHOW DQC command: DQC, devno=24/25, 11MW, attached to file.tmp, heads loaded, write enabled There is no indication that the file is attached to unit 1, and indeed if the attachment and disabled units are reversed, the command output is the same as above. CAUSE: Routine "show_device" (scp.c) combines the device and unit display when a device has only one enabled unit. This is intended to hide the implementation detail of single-unit devices, e.g., paper tape readers, while allowing additional permanently-disabled units to be used by the device for scheduling. However, it should not combine the device and units when user-disabled units exist. RESOLUTION: Modify "show_device" (scp.c) to count units that have been disabled by the user instead of units that may be disabled by the user, and to report the unit number if user-disabled units are present. Also change the count of reported units from the number of enabled units to the sum of the enabled and user-disabled units. STATUS: Fixed in version 3.9-0. 251. PROBLEM: Constants required for exdep_cmd and brk_cmd aren't in scp.h. VERSION: 3.9-0 OBSERVATION: The scp.h header file exports the exdep_cmd and brk_cmd functions, but the constants that must be passed in the "flag" parameters for proper operation are not present. The run_cmd function also requires constants for the "flag" parameter, but these are present. CAUSE: Oversight. RESOLUTION: Move the EX_D, EX_E, EX_I, SSH_ST, SSH_CL, and SSH_SH constants from scp.c to scp.h. STATUS: Fixed in version 4.0-0. 252. PROBLEM: Stop calls VM-provided address printer for PC without REG_VMAD. VERSION: 3.9-0 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. CAUSE: The call to sim_vm_fprint_addr in fprint_stopped_gen is not conditional on the PC register having the REG_VMAD flag. RESOLUTION: Modify "fprint_stopped_gen" (scp.c) to require REG_VMAD before calling the VM-specific address printer for the program counter value. STATUS: Fixed in version 4.0-0. 253. PROBLEM: Cannot show radix, etc. for a device that has no modifiers. VERSION: 3.9-0 OBSERVATION: The default data radix for a device may be set with the SET OCT|DEC|HEX command. However, if the device does not have a modifier table, SHOW RADIX is rejected with "No settable parameters". The same problem occurs for SHOW DEBUG and SHOW NAMES. For a device that provides debug printouts, SHOW MOD will list "DEBUG, NODEBUG" among the modifiers, and the SHOW DEBUG command will display the current debug status. However, if the device does not contain a modifier table, SHOW MOD and SHOW DEBUG will report "No settable parameters", even though SET DEBUG is accepted and works as expected. For such a device, SHOW MOD will show "DEBUG, NODEBUG" as acceptable modifiers. CAUSE: The "show_cmd_fi" routine checks for a modifier table and returns an error without checking for global actions. RESOLUTION: Modify "show_cmd_fi" (scp.c) to continue to process global actions if the modifier table is not defined. STATUS: Fixed in version 4.0-0. 254. PROBLEM: SET and SHOW responses for invalid entry are inconsistent. VERSION: 3.9-0 OBSERVATION: Entering SET where 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 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. CAUSE: Oversight. RESOLUTION: Modify "show_cmd_fi" (scp.c) to return the same status codes as "set_cmd" does. STATUS: Fixed in version 4.0-0. 255. ENHANCEMENT: Add a "-N" (new file) option to the SET CONSOLE LOG and SET CONSOLE DEBUG commands. VERSION: 3.9-0 OBSERVATION: These commands normally append to their respective log files. If the user wants to recreate the log file instead, it must be deleted first with OS-specific commands. Adding a "-N" option to perform the delete removes commands dependent on a specific OS. RESOLUTION: Modify "sim_set_logon" and "sim_set_debon" (sim_console.c) to check for a "-N" option and to open for writing instead of appending if detected. STATUS: Fixed in version 4.0-0. 256. ENHANCEMENT: Add tape runaway support to the simulator tape library. VERSION: 3.9-0 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. STATUS: Fixed in version 4.0-0. 257. ENHANCEMENT: Improve performance when reading or spacing over erase gaps. VERSION: 3.9-0 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. STATUS: Fixed in version 4.0-0. 258. PROBLEM: Writing an end-of-medium positions the tape image after the mark. VERSION: 3.9-0 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. STATUS: Fixed in version 4.0-0. 259. PROBLEM: Reading through an erase gap in reverse may return EOM status. VERSION: 3.9-0 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. STATUS: Fixed in version 4.0-0. 260. PROBLEM: sim_tape_wrgap fails when format is changed from SIMH format. VERSION: 3.9-0 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. STATUS: Fixed in version 4.0-0. 261. PROBLEM: The magnetic tape format of an attached unit may be changed. VERSION: 3.9-0 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 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. STATUS: Fixed in version 4.0-0. 263. ENHANCEMENT: Allow the VM to print simulator stop message information in lieu of, or in addition to, the default message. VERSION: 3.9-0 OBSERVATION: 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. RESOLUTION: Modify "fprint_stopped_gen" (scp.c) to check a VM-specific simulation stop printer pointer ("sim_vm_fprint_stopped") that is initialized to NULL and can be overridden by the VM, and, if overridden, call it after printing the message string and before printing the program counter. If the VM printer returns TRUE, print the comma and the program counter as before. If the VM routine returns FALSE, print just the terminating newline. STATUS: Fixed in version 4.0-0. 264. ENHANCEMENT: Indicate that "examine" is being called for a simulator stop. VERSION: 3.9-0 OBSERVATION: As part of the simulator stop message, the fprint_stopped_gen routine prints the instruction pointed to by the program counter. In addition to the "M" (mnemonic) switch, it passes the SIM_SW_STOP flag to the fprint_sym routine to indicate that it is being called for a simulator stop. This allows the VM-defined routine to take any action specifically appropriate to the stop. To get the instruction value, fprint_stopped_gen calls the CPU's "examine" routine and passes the program counter value as the address. However, interpretation of addresses may differ, depending on context. For example, a given address may be relative to a code, data, or stack space pointer. To attempt to address this, the "examine" call includes the "V" (virtual) switch. However, "virtual" (and the associated "-v" command line switch) may have a different meaning assigned by a given VM. What is needed is an unequivocal indication that a machine instruction value is being retrieved. RESOLUTION: Modify "fprint_stopped_gen" (scp.c) to pass SIM_SW_STOP to "examine" as well as "fprint_sym", so that these routines have unambiguous indications that they are being called in the context of a simulator stop. STATUS: Fixed in version 4.0-0. 268. ENHANCEMENT: Provide "fprint_sym" and "parse_sym" with register-specific information when a register is being examined or deposited. VERSION: 3.9-0 OBSERVATION: When EXAMINE or DEPOSIT specifies a register that has the REG_VMIO flag, "fprint_sym" or "parse_sym", respectively, is called in lieu of "fprint_val" or "get_uint". This allows VM-specific interpretations, such as symbolic display of a status or current instruction register value, by specifying a switch with the command: sim> examine STAT-CIR STAT: 060001 CIR: 030020 sim> examine -s STAT STAT: mITroc CCG 001 sim> examine -m CIR CIR: PAUS 0 The REG definition contains a radix field that allows a register to have a default radix that is different than that of the device. This is particularly helpful in connection with the EXAMINE STATE command, as different registers may have different preferred radices: sim> examine state P: 012077 (defaults to octal) CNTR: 9 (defaults to decimal) MASK: FFF0 (defaults to hex) However, there is no way to specify that the preferred display or input is symbolic. So a CPU state that contains such registers would have to be displayed multiple times -- once to get most of the values in their default forms, and again to display those registers whose preferred form is symbolic: sim> examine state PB: 000100 P: 012077 PL: 023000 STAT: 060001 CIR: 030020 sim> examine -s STAT STAT: mITroc CCG 001 sim> examine -m CIR CIR: PAUS 0 It would be useful if a default symbolic interpretation could be specified in the REG structure and passed to "fprint_sym" and "parse_sym" to be used in the absence of overriding command-line switches. Currently, no information is provided to these routines to indicate which register is being manipulated, so there is no way to provide register-specific default interpretations within the routines. RESOLUTION: Reserve space for register-specific flags in the "flags" field of the REG structure (sim_defs.h) starting at REG_V_UF. Modify "ex_reg" and "dep_reg" (scp.c) to merge the register-specific flags into the radix value passed as the "addr" parameter to "fprint_sym" and "parse_sym". A VM that defines register-specific flags will know to separate them from the passed radix value by the presence of the SIM_SW_REG value in the "switch" parameter. VMs that do not define register-specific flags are not affected by this change. STATUS: Fixed in version 4.0-0. 269. PROBLEM: Tape read reports "end of medium" even if a gap precedes it. VERSION: 4.0-0 OBSERVATION: Calling "sim_tape_rdrecf" to read a tape record sometimes returns MTSE_EOM and sets the "position not updated" (PNU) flag, even when an erase gap precedes the EOM. The correct response should be to return MTSE_RUNAWAY to indicate that spacing over a gap did not end with a data record or tape mark. Moreover, PNU should not be set, as the position has been updated. CAUSE: The routine attempts to handle this case by returning MTSE_RUNAWAY if the EOF was detected while reading a buffer of gap markers. However, if a buffer read ends immediately before an EOM marker or the physical EOF, the next read attempt will return a zero buffer length. The routine misinterprets this to mean that no gap was present and returns MTSE_EOM and sets the PNU flag. RESOLUTION: Modify "sim_tape_rdlntf" (sim_tape.c) to determine whether the EOM marker or physical EOF was seen on the first or a subsequent buffer read, and to return MTSE_EOM with PNU or MTSE_RUNAWAY without PNU, respectively. STATUS: Fixed in version 4.0-0. 270. PROBLEM: A failing command is not echoed if DO -Q is specified. VERSION: 4.0-0 OBSERVATION: The DO command supports the -Q switch to specify that the file should be executed "quietly." This suppresses extraneous messages, such as when ATTACH creates a new file. However, it also suppresses the echo of a failing command. For example, if "bug.sim" contains: attach -e PTR xyz ...and file "xyz" does not exist, then "do bug" prints: bug.sim-1> attach -e PTR xyz File open error But "do -q bug" reports: File open error As a result, the user cannot tell which file command caused the error. CAUSE: Output of the failing command is conditional on -Q not being specified. This is a design error in the implementation change that added the echo of failing commands. Adding -Q should suppress extraneous messages but not those that are needed to understand error messages. RESOLUTION: Modify "do_cmd" (scp.c) to remove the condition that suppressed echo of failing commands if -Q was specified. STATUS: Fixed in version 4.0-0. 271. PROBLEM: A disabled terminal unit may still be attached. VERSION: 4.0-0 OBSERVATION: Attempting to attach a disabled unit controlled by the terminal multiplexer library (sim_tmxr.c) succeeds. Attempting the same operation on any other type of device (e.g., disc, tape) fails with a "Unit disabled" error. CAUSE: The disabled-unit check is in "attach_cmd" which is typically called by devices other than TMXR devices. Terminal devices call "tmxr_attach", which does not perform the check. RESOLUTION: Modify "attach_unit" (scp.c) to remove the check and place it in "scp_attach_unit" instead. STATUS: Fixed in version 4.0-0.