SCP: Allow "STEP -T nnn" to work
Delay scheduling of long duration calibration events until a calibrated timer is established.
This commit is contained in:
parent
7984074f5f
commit
b38cc8a367
2 changed files with 17 additions and 14 deletions
22
scp.c
22
scp.c
|
@ -2788,7 +2788,6 @@ for (i=0; i<cmd_cnt; ++i) {
|
|||
}
|
||||
free (hlp_cmdp);
|
||||
fprintf (st, "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
static void fprint_header (FILE *st, t_bool *pdone, char *context)
|
||||
|
@ -4189,7 +4188,6 @@ for (; *ip && (op < oend); ) {
|
|||
sim_sub_instr_off[outstr_off] = 0;
|
||||
strcpy (instr, tmpbuf);
|
||||
free (tmpbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
t_stat shift_args (char *do_arg[], size_t arg_count)
|
||||
|
@ -7732,9 +7730,8 @@ else if ((flag == RU_STEP) ||
|
|||
if ((r != SCPE_OK) || (sim_step <= 0)) /* error? */
|
||||
return SCPE_ARG;
|
||||
}
|
||||
else sim_step = 1;
|
||||
if ((flag == RU_STEP) && (sim_switches & SWMASK ('T')))
|
||||
sim_step = (int32)((sim_timer_inst_per_sec ()*sim_step)/1000000.0);
|
||||
else
|
||||
sim_step = 1;
|
||||
}
|
||||
else if (flag == RU_NEXT) { /* next */
|
||||
t_addr *addrs;
|
||||
|
@ -7822,10 +7819,14 @@ if (signal (SIGTERM, int_handler) == SIG_ERR) { /* set WRU */
|
|||
sim_ttcmd ();
|
||||
return r;
|
||||
}
|
||||
if (sim_step) { /* set step timer */
|
||||
if (sim_switches & SWMASK ('T')) /* stepping for elapsed time? */
|
||||
sim_activate_after (&sim_step_unit, (uint32)sim_step);/* wall clock based step */
|
||||
else
|
||||
sim_activate (&sim_step_unit, sim_step); /* instruction based step */
|
||||
}
|
||||
stop_cpu = FALSE;
|
||||
sim_is_running = TRUE; /* flag running */
|
||||
if (sim_step) /* set step timer */
|
||||
sim_activate (&sim_step_unit, sim_step);
|
||||
fflush(stdout); /* flush stdout */
|
||||
if (sim_log) /* flush log if enabled */
|
||||
fflush (sim_log);
|
||||
|
@ -8014,7 +8015,6 @@ fprintf (st, "\n");
|
|||
void fprint_stopped (FILE *st, t_stat v)
|
||||
{
|
||||
fprint_stopped_gen (st, v, sim_PC, sim_dflt_dev);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Unit service for step timeout, originally scheduled by STEP n command
|
||||
|
@ -8045,7 +8045,6 @@ return sim_cancel (&sim_step_unit);
|
|||
void int_handler (int sig)
|
||||
{
|
||||
stop_cpu = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Examine/deposit commands
|
||||
|
@ -10738,7 +10737,7 @@ else
|
|||
|
||||
t_stat sim_activate_after_abs (UNIT *uptr, uint32 usec_delay)
|
||||
{
|
||||
return _sim_activate_after_abs (uptr, usec_delay);
|
||||
return _sim_activate_after_abs (uptr, (double)usec_delay);
|
||||
}
|
||||
|
||||
t_stat sim_activate_after_abs_d (UNIT *uptr, double usec_delay)
|
||||
|
@ -12921,7 +12920,6 @@ topic->text = newt;
|
|||
memcpy (newt + topic->len, text, len);
|
||||
topic->len +=len;
|
||||
newt[topic->len] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
/* Release memory held by a topic and its children.
|
||||
|
@ -12940,7 +12938,6 @@ for (i = 0; i < topic->kids; i++) {
|
|||
free (child);
|
||||
}
|
||||
free (topic->children);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build a help tree from a string.
|
||||
|
@ -13295,7 +13292,6 @@ fclose (tmp);
|
|||
remove (tmpnam);
|
||||
free (tmpnam);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
/* Flatten and display help for those who say they prefer it.
|
||||
*/
|
||||
|
|
|
@ -2562,7 +2562,12 @@ if (usec_delay < 0.0) {
|
|||
sim_debug (DBG_QUE, &sim_timer_dev, "sim_timer_activate_after(%s, %.0f usecs) - surprising usec value\n",
|
||||
sim_uname(uptr), usec_delay);
|
||||
}
|
||||
if ((sim_is_running) || (tmr <= SIM_NTIMERS))
|
||||
uptr->usecs_remaining = 0.0;
|
||||
else { /* defer non timer wallclock activations until a calibrated timer is in effect */
|
||||
uptr->usecs_remaining = usec_delay;
|
||||
usec_delay = 0;
|
||||
}
|
||||
/*
|
||||
* Handle long delays by aligning with the calibrated timer's calibration
|
||||
* activities. Delays which would expire prior to the next calibration
|
||||
|
@ -2577,6 +2582,8 @@ inst_delay_d = floor(inst_per_usec * usec_delay);
|
|||
inst_delay = (int32)inst_delay_d;
|
||||
if ((inst_delay == 0) && (usec_delay != 0))
|
||||
inst_delay_d = inst_delay = 1; /* Minimum non-zero delay is 1 instruction */
|
||||
if (uptr->usecs_remaining != 0.0) /* No calibrated timer yet, wait one cycle */
|
||||
inst_delay_d = inst_delay = 1; /* Minimum non-zero delay is 1 instruction */
|
||||
if ((sim_calb_tmr != -1) && (rtc_hz[sim_calb_tmr])) { /* Calibrated Timer available? */
|
||||
int32 inst_til_tick = sim_activate_time (&sim_timer_units[sim_calb_tmr]) - 1;
|
||||
int32 ticks_til_calib = rtc_hz[sim_calb_tmr] - rtc_ticks[sim_calb_tmr];
|
||||
|
|
Loading…
Add table
Reference in a new issue