If you do want to use different timing, then global variable sim_step is
available with the current step count (0 means not stepping) at entry to
sim_instr. sim_step isn't deliberately global; it just works out that
way. Further, it is NOT maintained as the step count is counted down.
Therefore, you need to pick it up on the way into sim_instr and count it
down yourself. You also need to cancel out the sim_step unit, which will
stop the simulator prematurely. Again, the cancellation routine is
global, although that wasn't deliberate either.
extern void sim_cancel_step (void);
extern int32 sim_step;
:
t_stat sim_instr (void)
{
uint32 step_limit = (uint32) sim_step, i;
sim_cancel_step ();
:
for (i = 0; ((step_limit == 0) || (i < step_limit)); i++) {
t_stat r;
r = cpu_one_instr ();
if (r != SCPE_OK)
return r;
:
}
return SCPE_STEP;
}
Converting sim_step to uint32 should quiesce compilers that are fussy
about integer overflow or wraparound on variable i. Or you can use 64b
integers.
Passing the step count as an argument would require modifying every
simulator. There are lots of SCP variables that may be of interest to a
running simulator; they are declared as globals.
The PDP-10 requires timing by memory reference (or something close to
it), because infinite indirects and XCT * must be interruptible to
prevent system lockup. The 7094 seems to run fine with timing by
instruction.
/Bob
On 1/30/2017 5:33 AM, Rich Cornwell wrote:
I track memory cycles so that I/O is closer to the time that the CPU
expects. This is more important for the I7000 series since
instructions where executed during I/O and some of the code relies on
how many instructions can be executed during a read/write. Also for
some cases during the I7090 I decrement sim_interval during long
instructions to closer simulate the real speed of the machine.
_______________________________________________
Simh mailing list
Simh@trailing-edge.com
http://mailman.trailing-edge.com/mailman/listinfo/simh