Skip to content

Commit

Permalink
IMLAC: Add breakpoints for memory reads and writes.
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbrinkhoff authored and markpizz committed May 11, 2023
1 parent 399e0f9 commit 1ab4e77
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
20 changes: 13 additions & 7 deletions imlac/imlac_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static uint16 ION;
/* ROM state. */
static int rom_type = ROM_NONE;

static int halt;
static t_stat stop_reason;
uint16 memmask = 017777;

typedef struct {
Expand Down Expand Up @@ -175,12 +175,17 @@ static void memaddr (uint16 addr)
static void memrd (void)
{
MB = M[MA];
if (sim_brk_summ && sim_brk_test(MA, SWMASK('R')))
stop_reason = STOP_DBKPT;
}

static void memwr (void)
{
if (rom_type == ROM_NONE || (MA & 0177740) != 040)
if (rom_type == ROM_NONE || (MA & 0177740) != 040) {
M[MA] = MB;
if (sim_brk_summ && sim_brk_test(MA, SWMASK('W')))
stop_reason = STOP_DBKPT;
}
}

static void cpu_class1 (uint16 insn)
Expand All @@ -200,7 +205,8 @@ static void cpu_class1 (uint16 insn)
AC |= DS;
}

halt = !(insn & 0100000);
if ((insn & 0100000) == 0)
stop_reason = STOP_HALT;
}

static void cpu_ral (int n)
Expand Down Expand Up @@ -443,7 +449,7 @@ t_stat sim_instr (void)
if ((reason = build_dev_tab ()) != SCPE_OK)
return reason;

halt = 0;
stop_reason = 0;

for (;;) {
AIO_CHECK_EVENT;
Expand All @@ -470,8 +476,8 @@ t_stat sim_instr (void)
return SCPE_STEP;
}

if (halt)
return STOP_HALT;
if (stop_reason)
return stop_reason;

if (ion_delay && --ion_delay == 0) {
sim_debug (DBG_IRQ, &irq_dev, "Interrupts on\n");
Expand Down Expand Up @@ -569,7 +575,7 @@ static t_bool cpu_is_pc_a_subroutine_call (t_addr **ret_addrs)
static t_stat
cpu_reset (DEVICE *dptr)
{
sim_brk_types = SWMASK('D') | SWMASK('E');
sim_brk_types = SWMASK('D') | SWMASK('E') | SWMASK('R') | SWMASK('W');
sim_brk_dflt = SWMASK ('E');
sim_vm_is_subroutine_call = &cpu_is_pc_a_subroutine_call;
return SCPE_OK;
Expand Down
3 changes: 2 additions & 1 deletion imlac/imlac_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@

#define STOP_HALT 1
#define STOP_IBKPT 2
#define STOP_ACCESS 3
#define STOP_DBKPT 3
#define STOP_ACCESS 4

#define FLAG_PTR 010000
#define FLAG_PTP 000400
Expand Down
1 change: 1 addition & 0 deletions imlac/imlac_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const char *sim_stop_messages[SCPE_BASE] = {
"Unknown error",
"HALT instruction",
"Breakpoint",
"Watchpoint",
"Invalid access",
};

Expand Down

0 comments on commit 1ab4e77

Please sign in to comment.