mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Adds some logging preparatory to a MOVE change.
This commit is contained in:
parent
1d3dde32f2
commit
c52da9d802
@ -11,6 +11,8 @@
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
#define LOG_TRACE
|
||||
|
||||
#include "68000.hpp"
|
||||
#include "Comparative68000.hpp"
|
||||
#include "CSROMFetcher.hpp"
|
||||
|
@ -47,6 +47,10 @@
|
||||
template <class T, bool dtack_is_implicit, bool signal_will_perform> void Processor<T, dtack_is_implicit, signal_will_perform>::run_for(HalfCycles duration) {
|
||||
const HalfCycles remaining_duration = duration + half_cycles_left_to_run_;
|
||||
|
||||
#ifdef LOG_TRACE
|
||||
static bool should_log = true;
|
||||
#endif
|
||||
|
||||
// This loop counts upwards rather than downwards because it simplifies calculation of
|
||||
// E as and when required.
|
||||
HalfCycles cycles_run_for;
|
||||
@ -123,7 +127,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
|
||||
}
|
||||
|
||||
#ifdef LOG_TRACE
|
||||
if(!(active_step_->microcycle.operation & Microcycle::IsProgram)) {
|
||||
if(should_log && !(active_step_->microcycle.operation & Microcycle::IsProgram)) {
|
||||
switch(active_step_->microcycle.operation & (Microcycle::SelectWord | Microcycle::SelectByte | Microcycle::Read)) {
|
||||
default: break;
|
||||
|
||||
@ -241,28 +245,40 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
|
||||
populate_trap_steps(9, get_status());
|
||||
} else {
|
||||
#ifdef LOG_TRACE
|
||||
std::cout << std::setfill('0');
|
||||
std::cout << (extend_flag_ ? 'x' : '-') << (negative_flag_ ? 'n' : '-') << (zero_result_ ? '-' : 'z');
|
||||
std::cout << (overflow_flag_ ? 'v' : '-') << (carry_flag_ ? 'c' : '-') << '\t';
|
||||
for(int c = 0; c < 8; ++ c) std::cout << "d" << c << ":" << std::setw(8) << data_[c].full << " ";
|
||||
for(int c = 0; c < 8; ++ c) std::cout << "a" << c << ":" << std::setw(8) << address_[c].full << " ";
|
||||
if(is_supervisor_) {
|
||||
std::cout << "usp:" << std::setw(8) << std::setfill('0') << stack_pointers_[0].full << " ";
|
||||
} else {
|
||||
std::cout << "ssp:" << std::setw(8) << std::setfill('0') << stack_pointers_[1].full << " ";
|
||||
if(should_log) {
|
||||
std::cout << std::setfill('0');
|
||||
std::cout << (extend_flag_ ? 'x' : '-') << (negative_flag_ ? 'n' : '-') << (zero_result_ ? '-' : 'z');
|
||||
std::cout << (overflow_flag_ ? 'v' : '-') << (carry_flag_ ? 'c' : '-') << '\t';
|
||||
for(int c = 0; c < 8; ++ c) std::cout << "d" << c << ":" << std::setw(8) << data_[c].full << " ";
|
||||
for(int c = 0; c < 8; ++ c) std::cout << "a" << c << ":" << std::setw(8) << address_[c].full << " ";
|
||||
if(is_supervisor_) {
|
||||
std::cout << "usp:" << std::setw(8) << std::setfill('0') << stack_pointers_[0].full << " ";
|
||||
} else {
|
||||
std::cout << "ssp:" << std::setw(8) << std::setfill('0') << stack_pointers_[1].full << " ";
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
std::cout << '\n';
|
||||
#endif
|
||||
|
||||
decoded_instruction_.full = prefetch_queue_.halves.high.full;
|
||||
#ifdef LOG_TRACE
|
||||
std::cout << std::hex << (program_counter_.full - 4) << ": " << std::setw(4) << decoded_instruction_.full << '\t';
|
||||
if(should_log) {
|
||||
std::cout << std::hex << (program_counter_.full - 4) << ": " << std::setw(4) << decoded_instruction_.full << '\t';
|
||||
}
|
||||
#endif
|
||||
|
||||
if(signal_will_perform) {
|
||||
bus_handler_.will_perform(program_counter_.full - 4, decoded_instruction_.full);
|
||||
}
|
||||
|
||||
#ifdef LOG_TRACE
|
||||
// should_log |= ((program_counter_.full - 4) == 0x405054);
|
||||
#endif
|
||||
|
||||
if(decoded_instruction_.full == 0x206f) {
|
||||
printf("");
|
||||
}
|
||||
|
||||
if(instructions[decoded_instruction_.full].micro_operations) {
|
||||
if(instructions[decoded_instruction_.full].requires_supervisor && !is_supervisor_) {
|
||||
// A privilege violation has been detected.
|
||||
@ -282,6 +298,10 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
|
||||
// The location of the failed instruction is what should end up on the stack.
|
||||
program_counter_.full -= 4;
|
||||
|
||||
#ifdef LOG_TRACE
|
||||
// should_log = true;
|
||||
#endif
|
||||
|
||||
// The vector used depends on whether this is a vanilla unrecognised instruction,
|
||||
// or one on the A or F lines.
|
||||
switch(decoded_instruction_.full >> 12) {
|
||||
|
Loading…
Reference in New Issue
Block a user