Commit graph

144 commits

Author SHA1 Message Date
Mark Pizzolato
cf1e7b9cca SCP, PDP11: Added HELP CPU BREAK to display info about breakpoint types 2016-10-06 13:25:54 -07:00
Mark Pizzolato
222ae77436 SCP: Add sim_brk_message() to facilitate easy reporting of matched breakpoints.
Also extended the optional VM supplied routines to include sim_vm_sprint_addr.
Simulators which provide sim_vm_fprint_addr should also provide
sim_vm_sprint_addr with sim_vm_fprint_addr reworked to leverage
sim_vm_sprint_addr internally.  sim_vm_sprint_addr is currently only used by
sim_brk_message() which is an API which a simulator may choose to use if
it supports multiple breakpoint types,
2016-09-01 14:32:01 -07:00
Mark Pizzolato
f82d3f8994 SCP: Breakpoint enhancements
- Reliable support for multiple breakpoint types
- Optional separate breakpoint types defined concurrently with the same address
2016-08-31 08:10:38 -07:00
Mark Pizzolato
b4f3d6c6d8 SCP: Breakpoint cleanup.
- Add detailed error message info while parsing breakpoint commands
 - Properly limit breakpoint class values to reflect available mask bits
 - Declare globally sim_brk_npc since it is a documented API
 - Revise simh_breakpoints.doc to reflect current behavior
2016-08-26 14:35:00 -07:00
Mark Pizzolato
c5ee1ad971 SCP: Enhance EXPECT support to allow multiple rules with the same match string
Multiple rules with the same match string are processed in the order the EXPECT
commands are entered.  NOEXPECT will remove all pending EXPECT rules which
have the match string provided on the NOEXPECT line.
2016-06-05 01:40:38 -07:00
Mark Pizzolato
e67bf602a0 SCP: Added shutdown flag for detach_all 2016-05-28 13:32:15 -07:00
Mark Pizzolato
5531ccb175 ALL: Massive 'const' cleanup
These changes facilitate more robust parameter type checking and helps
to identify unexpected coding errors.

Most simulators can now also be compiled with a C++ compiler without
warnings.

Additionally, these changes have also been configured to facilitate easier
backporting of simulator and device simulation modules to run under the
simh v3.9+ SCP framework.
2016-05-15 15:25:33 -07:00
Mark Pizzolato
fc4171140a SCP: Add BINRDATA, BINRDATAD and BINRDATADF REG initialization macros.
These describe a register which is to be displayed in binary.
2016-03-23 00:43:36 -07:00
Mark Pizzolato
3ff89074f5 SCP: Add generic REGDATA register populating macro.
This allows simulator code to be insulated from any changes which may
be made to the REG structure in the future.  The REGDATA macro will be
update as needed to avoid any changes in simulator specific code.
2016-03-17 10:45:45 -07:00
Mark Pizzolato
329f42a1fc SCP: Rework newly added REG macro definitions to avoid problems with prior declarations
Fix #288
2016-03-16 20:33:41 -07:00
Mark Pizzolato
58925f7672 SCP: Assure that a failure message is emitted before calling abort(). 2016-03-14 22:57:46 -07:00
Mark Pizzolato
37733cabee SCP: Add support REGister data in arrays of arbitrary structures. 2016-03-14 15:07:22 -07:00
Mark Pizzolato
de0d251c75 TIMER, SCP: Change the sim_activate_after APIs to pass the delay value as uint32.
Also change all sim_defs.h structure declarations and references of sim_
structures to use the typedef names everywhere.
2015-12-10 06:33:59 -08:00
Mark Pizzolato
f1d9e749f6 DISK: Add disk content validation checking
When creating a new disk image the new disk image can be populated with
unique data in each sector.  The data is the logical block address of the sector
in a 4 byte little-endian value.  This is enabled when the -I switch is specified
on the ATTACH command.  To leverage this, a -K flag is interpreted on the
ATTACH command which will validate the entire disk contents actually
contains the expected value at attach time and also will validate that any data
written to the disk during simulator operation also contains the same logical
block address values.
2015-12-06 16:26:11 -08:00
Mark Pizzolato
0938d31e59 PDP11, VAX: MUX input rate limiting works correctly with input arriving on multiple lines concurrently. 2015-11-28 12:49:54 -08:00
Mark Pizzolato
7266304105 ALL: changed ASSURE macro to leverage sim_printf for log and debug output. 2015-10-27 21:07:03 -07:00
Mark Pizzolato
1ef6c3d6b9 SCP: Added REG_V_UF and REG_UFMASK to support user-defined register flags. From Dave Bryan
Altered the calling sequences to fprint_sym and parse_sym in ex_reg and dep_reg to merge user-defined register flags with the radix in the addr parameter.  This allows the print and parse routines to identify the register or determine how it is to be handled.  These are called in lieu of the standard print and parse routines if a register has REG_VMIO or at least one user-defined flag set.
2015-09-20 14:04:24 -07:00
Mark Pizzolato
bd2f592918 Revert "SCP: Remove ASCII source code character set dependency"
This reverts commit 7c7b44e409.

The prior commit didn't work for static initializers.  There are other ASCII dependencies in simh.  They should all be solved together or not at all.
2015-08-07 00:54:23 -07:00
Mark Pizzolato
7c7b44e409 SCP: Remove ASCII source code character set dependency
Provide reasonable behavior on any platform which doesn't use ASCII as a character set.  Method suggested by Dave G4UGM.
2015-08-03 12:35:08 -07:00
Mark Pizzolato
ef6528bf32 SCP: Added automatic saving of console WRU, DEL, BRK and PCHAR console variables and provided a way for a simulator to declare that is doesn't have a console port so automatic WRU detection can be performed. 2015-04-03 16:05:01 -07:00
Mark Pizzolato
2c2ffe39bf Remote Console: Restructured so that commands are not executed within the sim_instr() routine.
This approach removes the burden from any simulator code to perform instruction execution postlude before calling sim_process_event and prelude activites when sim_process_event returns.

Remote Console commands are now executed from the same simulator context as if entered from the initial sim> prompt.
2015-02-15 11:00:01 -08:00
Mark Pizzolato
ef9d1adce1 PDP10, PDP11, VAX: const cleanup 2015-02-13 06:18:24 -08:00
Mark Pizzolato
4fbf8f36db SCP: Fix timer initialization logic when CAS intrinsic instructions aren't available for Lock Free queue insertion 2015-01-19 16:36:19 -08:00
Mark Pizzolato
6f1e8377c9 SCP: Added -T switch to the EXPECT, SEND and STEP commands to specify that the units of delay/stepping are in microseconds rather than instructions. 2015-01-09 04:52:21 -08:00
Mark Pizzolato
e37d0658fa SCP: Fix clock initialization in AIO_INIT when __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 are not available. 2015-01-08 19:51:01 -08:00
Mark Pizzolato
4381f9acc1 SCP: Added definition of SIM_INLINE when compiling with MSVC, gcc and clang 2014-12-30 18:46:43 -08:00
Mark Pizzolato
1d530cc48d SCP: Enhanced ASSERT/IF to support expressions which test memory contents. Also enhanced EXAMINE's search capabilities to be able to match multi-byte patterns for VMs which are byte addressable. 2014-12-25 06:19:59 -08:00
Mark Pizzolato
afb5d6277d TAPE: Extensive cleanup of tape operations (gap, end of medium, format change, etc.) from Dave Bryan
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.
2014-12-22 05:48:13 -08:00
Mark Pizzolato
20637cc0df TAPE: Corrected debug output of tape position to be independent of the size of t_addr 2014-12-14 13:13:25 -08:00
Mark Pizzolato
4eed007607 SCP: Restructured timer/co-scheduling activities to support co-scheduling on specific timers 2014-12-02 05:33:59 -08:00
Mark Pizzolato
916bab3c2a SCP: Cleaned up help for EXPECT and SEND commands. Added optional case insensitive match option to regular expression EXPECT rules. 2014-10-22 11:27:38 -07:00
Mark Pizzolato
5a4bbbad8d SCP: Extended EXPECT and SEND to have more flexible activation delays
- EXPECT will now tolerate a HALTAFTER=n parameter which delay the simulator stopping execution for n instructions.  Unpredictable behavior will happen if multiple EXPECT conditions see matching data before the first actualy halt occurs.
- SEND has an AFTER=n argument which delays the initial stuffed data from being input for at least n instructions.  It also has a DELAY=m argument which specifies the minimum number of instructions which must execute between stuffed input data.
- Changed run_cmd() to no longer clear pending breakpoint actions before starting instruction execution.
- Added a -Q switch to the commands which dispatch through run_cmd() (RUN, STEP, NEXT, GO, BOOT, etc.).  This switch will suppress status output when execution stops.  This will allow sequences of breakpoint action commands to silently execute when needed.
2014-10-20 16:47:33 -07:00
Mark Pizzolato
5af6210ed9 SCP: Add RegEx support to EXPECT string processing 2014-10-20 04:42:25 -07:00
Mark Pizzolato
ddc29fb2c9 SCP: Added debugging support for EXPECT and SEND activities. Fixed SEND buffer queuing bug. 2014-10-17 11:34:06 -07:00
Mark Pizzolato
02e90de6a4 SCP: Added EXPECT and SEND commands to react to data from and inject data into the simulated console port (and other MUX ports)
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).
2014-10-14 10:49:24 -07:00
Mark Pizzolato
c0f9c2e86c PDP11, VAX: Better support for various positioning operations which different OS drivers use. Fix to properly record/tolerate skip n records reaching a tape mark. Fix to #139 2014-05-16 12:46:08 -07:00
Mark Pizzolato
8f3e6438a3 SCP: Added the NEXT command. This command provides the ability for a simulator to step over subroutine calls. 2014-04-14 14:22:18 -07:00
Mark Pizzolato
98ac7af6fa PDP11, VAX: Fix differencing virtual disk corruption during creation problems 2014-03-16 01:11:35 -07:00
Mark Pizzolato
93b68432f2 AltairZ80, PDP10, PDP11, VAX: Fix incorrect sense of test on expression value in th ASSURE macro. Fix issue #126 2014-03-08 06:01:21 -08:00
Mark Pizzolato
879e2b9554 PDP11, PDP10, VAX, AltairZ80: enhanced the macro which aborts on an unexpected status from an expression with side effects to also write a message to sim_log or sim_deb if they happen to be open. 2014-03-02 14:50:43 +01:00
Mark Pizzolato
9320c56f3f PDP11, PDP10, AltairZ80: Fixed cases where assert() macro is called with an expression which has side effects and therefore wouldn't get executed if compiled with NDEBUG defined. 2014-03-02 14:50:43 +01:00
Mark Pizzolato
59d0602b0d PDP8: Add device buffer flush capability and keep track of data written state in the device buffer. Fixes #87
Finishing the last DECtape device which was missed when this functionality was added to pdp11_dt, pdp18b_dt and pdp8_dt
in commits: 2934112a70 and c9e8121c16

Cleaned up the pdp11, pdp18b and other pdp8 implementations to make backporting cleaner.
Made sure that buffer flushing happens correctly when simulation returns to the sim> prompt.
2014-02-12 21:08:18 -08:00
Mark Pizzolato
c9e8121c16 PDP8: Add device buffer flush capability and keep track of data written state in the device buffer. Fixes #87 2014-02-05 10:30:22 -08:00
Mark Pizzolato
eaae19463c SCP: Initial merge of old style single line help with hierarchical help 2014-02-01 07:04:44 -08:00
Mark Pizzolato
e1b0a416a9 SCP: Generalized DATE and TIME variable insertion adding support for ISO 8601 date values. Inspired by Christian Gauger-Cosgrove.
ISO 8601 support without requiring C99 strftime functionality.

          %DATE%                yyyy-mm-dd
          %TIME%                 hh:mm:ss
          %DATETIME%       yyyy-mm-ddThh:mm:ss
          %LDATE%               mm/dd/yy (Locale Formatted)
          %LTIME%               hh:mm:ss am/pm (Locale Formatted)
          %CTIME%               Www Mmm dd hh:mm:ss yyyy (Locale Formatted)
          %DATE_YYYY%     yyyy              (0000-9999)
          %DATE_YY%          yy                  (00-99)
          %DATE_MM%       mm               (01-12)
          %DATE_DD%         dd                  (01-31)
          %DATE_WW%       ww                 (01-53)     ISO 8601 week number
          %DATE_WYYYY%  yyyy              (0000-9999) ISO 8601 week year number
          %DATE_D%            d                    (1-7)       ISO 8601 day of week
          %DATE_JJJ%           jjj                   (001-366) day of year
          %TIME_HH%         hh                  (00-23)
          %TIME_MM%        mm               (00-59)
          %TIME_SS%            ss                  (00-59)
2014-01-11 11:13:25 -08:00
Mark Pizzolato
00afa58bc4 SCP: Added hierarchical help capability (from Timothe Litt) 2013-11-22 06:08:03 -08:00
Mark Pizzolato
e65aa904e7 SCP: Fix various missing log output 2013-11-20 15:09:43 -08:00
Mark Pizzolato
2e85e74699 SCP: Various cleanups.
- Avoid assignments of void * values.  Cast all memory allocation return values to appropriate types.
- Add output to sim_log where missing in various places.
- Fixed issue with lost file positions after a restore for devices which leverage the UNIT_SEQ flag.
2013-11-20 09:13:27 -08:00
Mark Pizzolato
c0b82b9adf SCP: Add comments describing the various REG initialization macros. 2013-09-08 17:27:17 -07:00
Mark Pizzolato
97eb58cfc4 Added a device flag which can be used to avoid auto detach at device attach time. 2013-06-17 21:17:49 -07:00