1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-26 10:29:31 +00:00

Corrects duration-based iteration.

This commit is contained in:
Thomas Harte 2021-01-21 23:05:43 -05:00
parent adef2e9b4e
commit 6e9ce50569
2 changed files with 4 additions and 2 deletions

View File

@ -108,6 +108,7 @@ template <
// Temporary implementation: just interpret.
program_.clear();
program_index_ = 0;
static_cast<Executor *>(this)->parse(address, ProgramCounterType(max_address));
// const auto page = find_page(address);
@ -149,8 +150,9 @@ template <
while(remaining_duration_ > 0) {
has_branched_ = false;
while(remaining_duration_ > 0 && !has_branched_) {
(static_cast<Executor *>(this)->*performers_[program_index_])();
const auto performer = performers_[program_[program_index_]];
++program_index_;
(static_cast<Executor *>(this)->*performer)();
}
}
}

View File

@ -128,7 +128,7 @@ template<bool is_brk> inline void Executor::perform_interrupt() {
}
template <Operation operation, AddressingMode addressing_mode> void Executor::perform() {
printf("%04x\t%02x\t%d %d\t[x:%02x s:%02x]\n", program_counter_ & 0x1fff, memory_[program_counter_ & 0x1fff], int(operation), int(addressing_mode), x_, s_);
printf("%04x\t%02x\t%d %d\t[x:%02x s:%02x]\t(%s)\n", program_counter_ & 0x1fff, memory_[program_counter_ & 0x1fff], int(operation), int(addressing_mode), x_, s_, __PRETTY_FUNCTION__ );
// Post cycle cost; this emulation _does not provide accurate timing_.
// TODO: post actual cycle counts. For now count instructions only.