diff --git a/OSBindings/Mac/Clock SignalTests/65816ComparativeTests.mm b/OSBindings/Mac/Clock SignalTests/65816ComparativeTests.mm index b2a8137b3..9426756d8 100644 --- a/OSBindings/Mac/Clock SignalTests/65816ComparativeTests.mm +++ b/OSBindings/Mac/Clock SignalTests/65816ComparativeTests.mm @@ -32,7 +32,9 @@ struct BusHandler: public CPU::MOS6502Esque::BusHandlerT { // Record the basics of the operation. auto &cycle = cycles.emplace_back(); cycle.operation = operation; - cycle.extended_bus = processor.get_extended_bus_output(); + if constexpr (has_extended_bus_output(type)) { + cycle.extended_bus = processor.get_extended_bus_output(); + } // Perform the operation, and fill in the cycle's value. using BusOperation = CPU::MOS6502Esque::BusOperation; @@ -113,7 +115,7 @@ struct BusHandler: public CPU::MOS6502Esque::BusHandlerT { CPU::MOS6502Esque::BusOperation operation; std::optional address; std::optional value; - int extended_bus; + int extended_bus = 0; }; std::vector cycles; @@ -263,12 +265,6 @@ template void generate() { assert(false); } - using ExtendedBusOutput = CPU::WDC65816::ExtendedBusOutput; - const bool emulation = cycle.extended_bus & ExtendedBusOutput::Emulation; - const bool memory_size = cycle.extended_bus & ExtendedBusOutput::MemorySize; - const bool index_size = cycle.extended_bus & ExtendedBusOutput::IndexSize; - const bool memory_lock = cycle.extended_bus & ExtendedBusOutput::MemoryLock; - fprintf(target, "["); if(cycle.address) { fprintf(target, "%d, ", *cycle.address); @@ -280,16 +276,31 @@ template void generate() { } else { fprintf(target, "null, "); } - fprintf(target, "\"%c%c%c%c%c%c%c%c\"]", - vda ? 'd' : '-', - vpa ? 'p' : '-', - vpb ? 'v' : '-', - wait ? '-' : (read ? 'r' : 'w'), - wait ? '-' : (emulation ? 'e' : '-'), - wait ? '-' : (memory_size ? 'm' : '-'), - wait ? '-' : (index_size ? 'x' : '-'), - wait ? '-' : (memory_lock ? 'l' : '-') - ); + + if(has_emulation) { + using ExtendedBusOutput = CPU::WDC65816::ExtendedBusOutput; + const bool emulation = cycle.extended_bus & ExtendedBusOutput::Emulation; + const bool memory_size = cycle.extended_bus & ExtendedBusOutput::MemorySize; + const bool index_size = cycle.extended_bus & ExtendedBusOutput::IndexSize; + const bool memory_lock = cycle.extended_bus & ExtendedBusOutput::MemoryLock; + + fprintf(target, "\"%c%c%c%c%c%c%c%c\"]", + vda ? 'd' : '-', + vpa ? 'p' : '-', + vpb ? 'v' : '-', + wait ? '-' : (read ? 'r' : 'w'), + wait ? '-' : (emulation ? 'e' : '-'), + wait ? '-' : (memory_size ? 'm' : '-'), + wait ? '-' : (index_size ? 'x' : '-'), + wait ? '-' : (memory_lock ? 'l' : '-') + ); + } else { + if(read) { + fprintf(target, "\"read\"]"); + } else { + fprintf(target, "\"write\"]"); + } + } } // Terminate object. diff --git a/Processors/6502Esque/6502Selector.hpp b/Processors/6502Esque/6502Selector.hpp index 642eb71eb..31bf93eaa 100644 --- a/Processors/6502Esque/6502Selector.hpp +++ b/Processors/6502Esque/6502Selector.hpp @@ -68,6 +68,10 @@ constexpr bool has(Type processor_type, Register r) { } } +constexpr bool has_extended_bus_output(Type processor_type) { + return processor_type == Type::TWDC65816; +} + } #endif /* _502Selector_h */