SDS: Allow specifying breakpoints as being in monitor, user or normal mode only

Breakpoint logic now allows four execution-type breakpoints:
 -E  as before, break if PC equals address, unqualified by mode
 -M break if PC equals address and machine is in monitor mode
 -N break if PC equals address and machine is in normal (SDS 930) mode
 -U break if PC equals address and machine is in user mode
This commit is contained in:
Mark Emmer 2014-03-02 22:47:39 -06:00
parent 614fe87af4
commit 396e78cb26
3 changed files with 35 additions and 6 deletions

View file

@ -428,9 +428,31 @@ while (reason == 0) { /* loop until halted */
int_reqhi = api_findreq (); /* recalc int req */ int_reqhi = api_findreq (); /* recalc int req */
} }
else { /* normal instr */ else { /* normal instr */
if (sim_brk_summ && sim_brk_test (P, SWMASK ('E'))) { /* breakpoint? */ if (sim_brk_summ) {
reason = STOP_IBKPT; /* stop simulation */ uint32 btyp = SWMASK ('E');
break;
if (nml_mode)
btyp = SWMASK ('E') | SWMASK ('N');
else
btyp = usr_mode ? SWMASK ('E') | SWMASK ('U')
: SWMASK ('E') | SWMASK ('M');
btyp = sim_brk_test (P, btyp);
if (btyp) {
if (btyp & SWMASK ('E')) /* unqualified breakpoint? */
reason = STOP_IBKPT; /* stop simulation */
else switch (btyp) { /* qualified breakpoint */
case SWMASK ('M'): /* monitor mode */
reason = STOP_MBKPT; /* stop simulation */
break;
case SWMASK ('N'): /* normal (SDS 930) mode */
reason = STOP_NBKPT; /* stop simulation */
break;
case SWMASK ('U'): /* user mode */
reason = STOP_UBKPT; /* stop simulation */
break;
}
break;
}
} }
reason = Read (save_P = P, &inst); /* get instr */ reason = Read (save_P = P, &inst); /* get instr */
P = (P + 1) & VA_MASK; /* incr PC */ P = (P + 1) & VA_MASK; /* incr PC */
@ -1473,7 +1495,8 @@ pcq_r = find_reg ("PCQ", NULL, dptr);
if (pcq_r) if (pcq_r)
pcq_r->qptr = 0; pcq_r->qptr = 0;
else return SCPE_IERR; else return SCPE_IERR;
sim_brk_types = sim_brk_dflt = SWMASK ('E'); sim_brk_dflt = SWMASK ('E');
sim_brk_types = SWMASK ('E') | SWMASK ('M') | SWMASK ('N') | SWMASK ('U');
return SCPE_OK; return SCPE_OK;
} }

View file

@ -1,4 +1,4 @@
/* sds_defs.h: SDS 940 simulator definitions /* sds_defs.h: SDS 940 simulator definitions
Copyright (c) 2001-2010, Robert M. Supnik Copyright (c) 2001-2010, Robert M. Supnik
@ -52,6 +52,9 @@
#define STOP_RTCINS 12 /* rtc inst not MIN/SKR */ #define STOP_RTCINS 12 /* rtc inst not MIN/SKR */
#define STOP_ILLVEC 13 /* zero vector */ #define STOP_ILLVEC 13 /* zero vector */
#define STOP_CCT 14 /* runaway CCT */ #define STOP_CCT 14 /* runaway CCT */
#define STOP_MBKPT 15 /* monitor-mode breakpoint */
#define STOP_NBKPT 16 /* normal-mode breakpoint */
#define STOP_UBKPT 17 /* user-mode breakpoint */
/* Trap codes */ /* Trap codes */

View file

@ -96,7 +96,10 @@ const char *sim_stop_messages[] = {
"Trap instruction not BRM", "Trap instruction not BRM",
"RTC instruction not MIN or SKR", "RTC instruction not MIN or SKR",
"Interrupt vector zero", "Interrupt vector zero",
"Runaway carriage control tape" "Runaway carriage control tape",
"Monitor-mode Breakpoint",
"Normal-mode Breakpoint",
"User-mode Breakpoint"
}; };
/* Character conversion tables */ /* Character conversion tables */