diff options
-rw-r--r-- | src/devices/cpu/h8/h8.cpp | 17 | ||||
-rw-r--r-- | src/devices/cpu/h8/h8.h | 4 |
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(); |