h8: Make debug PC adjustment and breakpoints actually work

This commit is contained in:
AJR 2019-10-03 11:50:02 -04:00
parent 7673e5260f
commit c350672a1b
2 changed files with 14 additions and 7 deletions

View File

@ -42,14 +42,21 @@ void h8_device::device_start()
cache = program->cache<1, 0, ENDIANNESS_BIG>();
io = &space(AS_IO);
state_add(STATE_GENPC, "GENPC", NPC).noshow();
state_add(STATE_GENPCBASE, "CURPC", PPC).noshow();
uint32_t pcmask = mode_advanced ? 0xffffff : 0xffff;
state_add<uint32_t>(H8_PC, "PC",
[this]() { return NPC; },
[this](uint32_t pc) { PC = PPC = NPC = pc; prefetch_noirq_notrace(); }
).mask(pcmask);
state_add<uint32_t>(STATE_GENPC, "GENPC",
[this]() { return NPC; },
[this](uint32_t pc) { PC = PPC = NPC = pc; prefetch_noirq_notrace(); }
).mask(pcmask).noshow();
state_add(STATE_GENPCBASE, "CURPC", PPC).mask(pcmask).noshow();
state_add(H8_CCR, "CCR", CCR);
if(has_exr)
state_add(STATE_GENFLAGS, "GENFLAGS", CCR).formatstr("%11s").noshow();
else
state_add(STATE_GENFLAGS, "GENFLAGS", CCR).formatstr("%8s").noshow();
state_add(H8_PC, "PC", NPC);
state_add(H8_CCR, "CCR", CCR);
if(has_exr)
state_add(H8_EXR, "EXR", EXR);
@ -331,7 +338,7 @@ void h8_device::state_string_export(const device_state_entry &entry, std::string
case H8_R6:
case H8_R7: {
int r = entry.index() - H8_R0;
str = string_format("%04x %04x", R[r + 8], R[r]);
str = string_format("%04X %04X", R[r + 8], R[r]);
break;
}
}

View File

@ -164,8 +164,8 @@ protected:
inline void prefetch() { prefetch_start(); prefetch_done(); }
inline void prefetch_noirq() { prefetch_start(); prefetch_done_noirq(); }
inline void prefetch_noirq_notrace() { prefetch_start(); prefetch_done_noirq_notrace(); }
void prefetch_start() { NPC = PC; PIR = fetch(); }
void prefetch_switch(uint32_t pc, uint16_t ir) { NPC = pc; PC = pc+2; PIR = ir; }
void prefetch_start() { NPC = PC & 0xffffff; PIR = fetch(); }
void prefetch_switch(uint32_t pc, uint16_t ir) { NPC = pc & 0xffffff; PC = pc+2; PIR = ir; }
void prefetch_done();
void prefetch_done_noirq();
void prefetch_done_noirq_notrace();