diff --git a/Machines/Atari2600/Cartridges/Cartridge.hpp b/Machines/Atari2600/Cartridges/Cartridge.hpp index 1b3b19890..eaec87913 100644 --- a/Machines/Atari2600/Cartridges/Cartridge.hpp +++ b/Machines/Atari2600/Cartridges/Cartridge.hpp @@ -27,7 +27,7 @@ template class Cartridge: void advance_cycles(int cycles) {} // to satisfy CPU::MOS6502::Processor - unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { + Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { uint8_t returnValue = 0xff; int cycles_run_for = 3; @@ -158,7 +158,7 @@ template class Cartridge: if(!tia_->get_cycles_until_horizontal_blank(cycles_since_video_update_)) CPU::MOS6502::Processor>::set_ready_line(false); - return (unsigned int)(cycles_run_for / 3); + return Cycles(cycles_run_for / 3); } void flush() { diff --git a/Machines/Commodore/1540/C1540.cpp b/Machines/Commodore/1540/C1540.cpp index d8d79cdff..ddaa65eab 100644 --- a/Machines/Commodore/1540/C1540.cpp +++ b/Machines/Commodore/1540/C1540.cpp @@ -34,7 +34,7 @@ void Machine::set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bu Commodore::Serial::AttachPortAndBus(serial_port_, serial_bus); } -unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { +Cycles Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { /* Memory map (given that I'm unsure yet on any potential mirroring): @@ -66,7 +66,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation serial_port_VIA_->run_for(Cycles(1)); drive_VIA_.run_for(Cycles(1)); - return 1; + return Cycles(1); } void Machine::set_rom(const std::vector &rom) { diff --git a/Machines/Commodore/1540/C1540.hpp b/Machines/Commodore/1540/C1540.hpp index af76b1f5b..2cb2cbe7e 100644 --- a/Machines/Commodore/1540/C1540.hpp +++ b/Machines/Commodore/1540/C1540.hpp @@ -142,7 +142,7 @@ class Machine: void set_disk(std::shared_ptr disk); // to satisfy CPU::MOS6502::Processor - unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); + Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); // to satisfy MOS::MOS6522::Delegate virtual void mos6522_did_change_interrupt_status(void *mos6522); diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index e9ba16e8c..1babf5273 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -97,7 +97,7 @@ Machine::~Machine() { delete[] rom_; } -unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { +Cycles Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { // run the phase-1 part of this cycle, in which the VIC accesses memory if(!is_running_at_zero_cost_) mos6560_->run_for(Cycles(1)); @@ -190,7 +190,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation tape_->run_for(Cycles(1)); if(c1540_) c1540_->run_for(Cycles(1)); - return 1; + return Cycles(1); } #pragma mark - 6522 delegate diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index 2bda32a8e..c6ffa22d9 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -166,7 +166,7 @@ class Machine: inline void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } // to satisfy CPU::MOS6502::Processor - unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); + Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); void flush() { mos6560_->flush(); } // to satisfy CRTMachine::Machine diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 0109f614e..b036a553e 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -122,7 +122,7 @@ void Machine::set_rom(ROMSlot slot, std::vector data, bool is_writeable #pragma mark - The bus -unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { +Cycles Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { unsigned int cycles = 1; if(address < 0x8000) { @@ -339,7 +339,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation } } - return cycles; + return Cycles(cycles); } void Machine::flush() { diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 0a2094761..7badbb228 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -86,7 +86,7 @@ class Machine: void configure_as_target(const StaticAnalyser::Target &target); // to satisfy CPU::MOS6502::Processor - unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); + Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); void flush(); // to satisfy CRTMachine::Machine diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index b5525f0fa..614f18e29 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -77,7 +77,7 @@ void Machine::set_rom(ROM rom, const std::vector &data) { } } -unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { +Cycles Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { if(address > ram_top_) { if(isReadOperation(operation)) *value = paged_rom_[address - ram_top_ - 1]; @@ -132,7 +132,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation via_.run_for(Cycles(1)); if(microdisc_is_enabled_) microdisc_.run_for(Cycles(8)); cycles_since_video_update_++; - return 1; + return Cycles(1); } void Machine::flush() { diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index f09cbee1b..f1b1ff37e 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -77,7 +77,7 @@ class Machine: void configure_as_target(const StaticAnalyser::Target &target); // to satisfy CPU::MOS6502::Processor - unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); + Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value); void flush(); // to satisfy CRTMachine::Machine diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme index 0bbefe859..6609a35c0 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme @@ -75,7 +75,6 @@ useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" - enableAddressSanitizer = "YES" debugServiceExtension = "internal" allowLocationSimulation = "NO"> class Processor: public ProcessorBase, public ClockReceiver

class Processor: public ProcessorBase, public ClockReceiver

class Processor: public ProcessorBase, public ClockReceiver

(this)->perform_bus_operation(nextBusOperation, busAddress, busValue); \ nextBusOperation = BusOperation::None; \ - if(number_of_cycles <= 0) break; + if(number_of_cycles <= Cycles(0)) break; checkSchedule(); - int number_of_cycles = cycles.as_int() + cycles_left_to_run_; + Cycles number_of_cycles = cycles + cycles_left_to_run_; - while(number_of_cycles > 0) { + while(number_of_cycles > Cycles(0)) { - while (ready_is_active_ && number_of_cycles > 0) { + while (ready_is_active_ && number_of_cycles > Cycles(0)) { number_of_cycles -= static_cast(this)->perform_bus_operation(BusOperation::Ready, busAddress, busValue); } diff --git a/Processors/6502/6502AllRAM.cpp b/Processors/6502/6502AllRAM.cpp index e706f599f..11ec5cfda 100644 --- a/Processors/6502/6502AllRAM.cpp +++ b/Processors/6502/6502AllRAM.cpp @@ -20,7 +20,7 @@ class ConcreteAllRAMProcessor: public AllRAMProcessor, public Processor