summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-10-03 11:50:02 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-10-03 11:50:02 -0400
commitc350672a1b93dbb34612e4586be436ca92fdefba (patch)
treef5da7c3f6c04f2ef08fd788bda8d68fa53a0bf89
parent7673e5260ffa1b11d9aa763bfaaeec9eb12fe2dd (diff)
h8: Make debug PC adjustment and breakpoints actually work
-rw-r--r--src/devices/cpu/h8/h8.cpp17
-rw-r--r--src/devices/cpu/h8/h8.h4
2 files changed, 14 insertions, 7 deletions
diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp
index 1d78fa4ba62..154d941148d 100644
--- a/src/devices/cpu/h8/h8.cpp
+++ b/src/devices/cpu/h8/h8.cpp
@@ -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;
}
}
diff --git a/src/devices/cpu/h8/h8.h b/src/devices/cpu/h8/h8.h
index 06a38225a30..ddde514f476 100644
--- a/src/devices/cpu/h8/h8.h
+++ b/src/devices/cpu/h8/h8.h
@@ -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();