Skip to content

Commit

Permalink
[MC6809E] Fix finding instruction fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Jun 17, 2024
1 parent d0faa46 commit 3dea53e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion debugger/mc6809/pins_mc6809.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void PinsMc6809::suspend(bool show) {
cycle(); // non-VMA
_regs.capture(frame, true);
if (show) {
const auto last = frame->prev(_regs.contextLength() == 14 ? 3 : 2);
const auto last = frame->prev(_regs.contextLength() == 14 ? 4 : 3);
Signals::discard(last);
}
}
Expand Down
24 changes: 11 additions & 13 deletions debugger/mc6809/pins_mc6809e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,23 @@ mc6809::Signals *PinsMc6809E::cycle() const {

const mc6809::Signals *PinsMc6809E::findFetch(
mc6809::Signals *begin, const mc6809::Signals *end) {
const auto cycles = begin->diff(end);
const auto native6309 = _regs.contextLength() == 14;
for (auto i = 0; i < cycles; ++i) {
auto s = begin->next(i);
if (native6309) {
const auto cycles = begin->diff(end);
if (!native6309) {
for (uint8_t i = 1; i <= cycles; ++i) {
auto s = begin->next(cycles - i);
if (s->fetch()) {
s->markFetch(1);
} else {
s->clearFetch();
}
} else {
if (i && s->prev()->fetch()) {
s->markFetch(1);
} else {
s->clearFetch();
s->next()->markFetch(1);
}
}
}
return begin;
for (uint8_t i = 0; i < cycles; ++i) {
const auto s = begin->next(i);
if (s->fetch())
return s;
}
return end;
}

} // namespace mc6809e
Expand Down

0 comments on commit 3dea53e

Please sign in to comment.