SCP: Add a special pseudo name "$" which is the value returned from the most recent EXAMINE command which can be used for register (or memory) indirect EXAMINE commands.

To examine the instruction which the PC points at:
   sim> EXAMINE PC
   sim> EXAMINE -m $
This commit is contained in:
Mark Pizzolato 2015-04-01 10:29:14 -07:00
parent 975327dcac
commit d84883a4ce

16
scp.c
View file

@ -491,6 +491,7 @@ static int32 noqueue_time;
volatile int32 stop_cpu = 0; volatile int32 stop_cpu = 0;
static char **sim_argv; static char **sim_argv;
t_value *sim_eval = NULL; t_value *sim_eval = NULL;
t_value sim_last_val;
FILE *sim_log = NULL; /* log file */ FILE *sim_log = NULL; /* log file */
FILEREF *sim_log_ref = NULL; /* log file file reference */ FILEREF *sim_log_ref = NULL; /* log file file reference */
FILE *sim_deb = NULL; /* debug file */ FILE *sim_deb = NULL; /* debug file */
@ -696,6 +697,8 @@ static const char simh_help[] =
"++ but not including address+length\n" "++ but not including address+length\n"
"++STATE all registers in the device\n" "++STATE all registers in the device\n"
"++ALL all locations in the unit\n" "++ALL all locations in the unit\n"
"++$ the last value displayed by an EXAMINE command\n"
" interpreted as an address\n"
"3Switches\n" "3Switches\n"
" Switches can be used to control the format of display information:\n\n" " Switches can be used to control the format of display information:\n\n"
/***************** 80 character line width template *************************/ /***************** 80 character line width template *************************/
@ -6279,7 +6282,7 @@ for (rptr = lowr; rptr <= highr; rptr++) {
else else
Fprintf (ofile, "%s[%d]-%s[%d]: same as above\n", rptr->name, val_start+1, rptr->name, idx-1); Fprintf (ofile, "%s[%d]-%s[%d]: same as above\n", rptr->name, val_start+1, rptr->name, idx-1);
} }
last_val = val; sim_last_val = last_val = val;
val_start = idx; val_start = idx;
reason = ex_reg (ofile, val, flag, rptr, idx); reason = ex_reg (ofile, val, flag, rptr, idx);
if (reason != SCPE_OK) if (reason != SCPE_OK)
@ -6637,7 +6640,7 @@ for (i = 0, j = addr; i < sim_emax; i++, j = j + dptr->aincr) {
} }
} }
} }
sim_eval[i] = sim_eval[i] & mask; sim_last_val = sim_eval[i] = sim_eval[i] & mask;
} }
if ((reason != SCPE_OK) && (i == 0)) if ((reason != SCPE_OK) && (i == 0))
return reason; return reason;
@ -7073,9 +7076,15 @@ if (max && strncmp (cptr, "ALL", strlen ("ALL")) == 0) { /* ALL? */
*hi = max; *hi = max;
} }
else { else {
if (strncmp (cptr, "$", strlen ("$")) == 0) { /* $? */
tptr = cptr + strlen ("$");
*hi = *lo = (t_addr)sim_last_val;
}
else {
if (dptr && sim_vm_parse_addr) /* get low */ if (dptr && sim_vm_parse_addr) /* get low */
*lo = sim_vm_parse_addr (dptr, (char *)cptr, (char **)&tptr); *lo = sim_vm_parse_addr (dptr, (char *)cptr, (char **)&tptr);
else *lo = (t_addr) strtotv (cptr, &tptr, rdx); else
*lo = (t_addr) strtotv (cptr, &tptr, rdx);
if (cptr == tptr) /* error? */ if (cptr == tptr) /* error? */
return NULL; return NULL;
if ((*tptr == '-') || (*tptr == ':')) { /* range? */ if ((*tptr == '-') || (*tptr == ':')) { /* range? */
@ -7097,6 +7106,7 @@ else {
} }
else *hi = *lo; else *hi = *lo;
} }
}
if (term && (*tptr++ != term)) if (term && (*tptr++ != term))
return NULL; return NULL;
return tptr; return tptr;