- Initialize local state variables to 0. Likely non functional changes due
to lack of depth in static analysis scan. Coverity detects real problems
like this.
- Fix inconsistent statement indentation.
This avoids a potential invalid pointer dereference when formatting
the return value from sim_instr() if it is < SCPE_BASE but greater
than the previously defined static array size.sizeof
Update simh.doc to reflect this generic change.
This implements the principle of "least surprise", in that users won't
normally expect to start overwriting an existing file on these devices.
Real hardware didn't behave that way. A new (empty) file can always
be created with the -N switch on the ATTACH.
Although these devices interpret a -A switch at attach time, they are not
sequential output devices and thus don't have an ambiguous interpretation
of the switch.
Incorrectly mentioned in #821
The -A attach time switch implicitly means to open files in append
mode.
Some devices used -A to indicate ASCII data or AUTOSIZE of disk or
fixed size tapes - DECtape. These devices are either read only devices
(Paper tape readers or card readers), so explicit forcing of the attach
to be -R avoids unexpected positioning errors. The random access
Disk and fixed sized tapes buffer the container contents in memory
so append mode isn't relevant, but care must be taken to assure that
the buffer reading starts at the beginning of the file without regard
to the explicit open mode.
As reported in #821
Most history routines defined a local sim_eval of the proper length, but the
erroneous ones were fixed length machines that defined an integer variable
instead of an integer array of length 1. The VAX used the global sim_eval.
The changes follow the VAX practice.
The code is a bit difficult to understand, but it represents the 'normal'
path for processing a DECtape word. The code always flows all the
way to the break.
For start of block, there's extra code to check for a timing error; but
then the first word is processed (case 0).
For a normal word, a 3-cycle data break is done - increment word
count and current address, check for word count overflow, put the
word in the buffer; but then check for end of block (case DTO_WCO).
If the word count has already overflowed, just check for end of block.
So yes, the end of case 0 should be labeled 'fall through' as well.
FNC_WRIT has the same structure and needs the same comment.
For the PDP11, this includes deferring the setting of DONE on an error, allowing RSTS V4 to work correctly.
There was a minor (possibly only theoretical) bug in dt_seterr as well.
dt_seterr is supposed to stop the drive. If the drive is accelerating, at
speed, or stopped, it works fine. But if the drive is decelerating, it did
not clear out the "successor" states. In theory, the drive could be in the
middle of reversing - that is, there are successor states of accelerating
(in reverse) and at speed. So the successor states need to be cleared,
or the drive won't actually stop.
The fifth DECtape controller (the PDP8's TD8E) is much simpler and
doesn't have the problem.
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.
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.
This reverts commit 5551a0dd9c.
The original idea was that the state being put into simh registers would be required to have all useful information available when remote console executed commands. These steps were taken from the code that sim_instr() executed as it was exiting. After this change was made it was realized that once a remote console command executed it might change state that directly affected instruction execution. To solve this, the logic that executes before the instructions in sim_instr() would then need to be executed whenever the event dispatch processing completed. This approach is messy, burdensome and potentially a lot of overhead for every event dispatch even though almost none of the event dispatches would be for remote console command execution. A completely different approach was suggested by J. David Bryan. That alternative approach would be to have remote console commands execute outside of the sim_instr() routine. Thus allowing the existing prelude and postlude code in sim_instr() to be performed naturally and let the remote console activities run in the same context as all other simh commands. Recent changes to scp and sim_console implement this alternative approach and thus these original changes are completely irrelevant and are thus being removed.
The goals here being to simplify calling code while getting consistent output delivered everywhere it may be useful.
Modified most places which explicitly used sim_log or merely called printf to now avoid doing that and merely call sim_printf().