From ec353ce6638562bdd40f957bc547aab76c25a73e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 27 Mar 2018 21:52:52 -0400 Subject: [PATCH 1/3] Makes minor Vic-20 optimisations. Specifically: the 6560 is updated only upon writes (more nuance can arrive), and tape sleeps are observed. --- Machines/Commodore/Vic-20/Vic20.cpp | 43 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 094a259f4..c5fd3a487 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -299,7 +299,8 @@ class ConcreteMachine: public MOS::MOS6522::IRQDelegatePortHandler::Delegate, public Utility::TypeRecipient, public Storage::Tape::BinaryTapePlayer::Delegate, - public Machine { + public Machine, + public Sleeper::SleepObserver { public: ConcreteMachine() : m6502_(*this), @@ -325,15 +326,12 @@ class ConcreteMachine: user_port_via_port_handler_->set_interrupt_delegate(this); keyboard_via_port_handler_->set_interrupt_delegate(this); tape_->set_delegate(this); + tape_->set_sleep_observer(this); // install a joystick joysticks_.emplace_back(new Joystick(*user_port_via_port_handler_, *keyboard_via_port_handler_)); } - ~ConcreteMachine() { - delete[] rom_; - } - // Obtains the system ROMs. bool set_rom_fetcher(const std::function>>(const std::string &machine, const std::vector &names)> &roms_with_names) override { rom_fetcher_ = roms_with_names; @@ -405,9 +403,8 @@ class ConcreteMachine: std::vector rom_image = media.cartridges.front()->get_segments().front().data; rom_length_ = static_cast(rom_image.size()); - rom_ = new uint8_t[0x2000]; - std::memcpy(rom_, rom_image.data(), rom_image.size()); - write_to_map(processor_read_memory_map_, rom_, rom_address_, 0x2000); + rom_ = rom_image; + rom_.resize(0x2000); } set_use_fast_tape(); @@ -517,15 +514,15 @@ class ConcreteMachine: write_to_map(processor_read_memory_map_, roms_[kernel_rom].data(), 0xe000, static_cast(roms_[kernel_rom].size())); // install the inserted ROM if there is one - if(rom_) { - write_to_map(processor_read_memory_map_, rom_, rom_address_, rom_length_); + if(!rom_.empty()) { + write_to_map(processor_read_memory_map_, rom_.data(), rom_address_, rom_length_); } } // to satisfy CPU::MOS6502::Processor forceinline Cycles 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)); + cycles_since_mos6560_update_++; // run the phase-2 part of the cycle, which is whatever the 6502 said it should be if(isReadOperation(operation)) { @@ -537,10 +534,7 @@ class ConcreteMachine: } *value = result; - // This combined with the stuff below constitutes the fast tape hack. Performed here: if the - // PC hits the start of the loop that just waits for an interesting tape interrupt to have - // occurred then skip both 6522s and the tape ahead to the next interrupt without any further - // CPU or 6560 costs. + // Consider applying the fast tape hack. if(use_fast_tape_hack_ && operation == CPU::MOS6502::BusOperation::ReadOpcode) { if(address == 0xf7b2) { // Address 0xf7b2 contains a JSR to 0xf8c0 that will fill the tape buffer with the next header. @@ -601,6 +595,8 @@ class ConcreteMachine: } } } else { + mos6560_->run_for(cycles_since_mos6560_update_.flush()); + uint8_t *ram = processor_write_memory_map_[address >> 10]; if(ram) ram[address & 0x3ff] = *value; if((address&0xfc00) == 0x9000) { @@ -618,13 +614,14 @@ class ConcreteMachine: typer_.reset(); } } - tape_->run_for(Cycles(1)); + if(!tape_is_sleeping_) tape_->run_for(Cycles(1)); if(c1540_) c1540_->run_for(Cycles(1)); return Cycles(1); } - forceinline void flush() { + void flush() { + mos6560_->run_for(cycles_since_mos6560_update_.flush()); mos6560_->flush(); } @@ -694,6 +691,11 @@ class ConcreteMachine: return selection_set; } + void set_component_is_sleeping(void *component, bool is_sleeping) override { + tape_is_sleeping_ = is_sleeping; + set_use_fast_tape(); + } + private: Analyser::Static::Commodore::Target commodore_target_; @@ -706,7 +708,7 @@ class ConcreteMachine: std::vector kernel_rom_; uint8_t expansion_ram_[0x8000]; - uint8_t *rom_ = nullptr; + std::vector rom_; uint16_t rom_address_, rom_length_; uint8_t user_basic_memory_[0x0400]; @@ -730,6 +732,7 @@ class ConcreteMachine: Commodore::Vic20::KeyboardMapper keyboard_mapper_; std::vector> joysticks_; + Cycles cycles_since_mos6560_update_; std::unique_ptr mos6560_; std::shared_ptr user_port_via_port_handler_; std::shared_ptr keyboard_via_port_handler_; @@ -743,9 +746,9 @@ class ConcreteMachine: std::shared_ptr tape_; bool use_fast_tape_hack_ = false; bool allow_fast_tape_hack_ = false; - bool is_running_at_zero_cost_ = false; + bool tape_is_sleeping_ = true; void set_use_fast_tape() { - use_fast_tape_hack_ = allow_fast_tape_hack_ && tape_->has_tape(); + use_fast_tape_hack_ = !tape_is_sleeping_ && allow_fast_tape_hack_ && tape_->has_tape(); } // Disk From f3fe16215ab099521a45484a89c16f479c38883c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 27 Mar 2018 21:55:43 -0400 Subject: [PATCH 2/3] Reintroduces options for the Vic-20, now tape loading speed only. --- .../Clock Signal.xcodeproj/project.pbxproj | 26 +++--- .../Base.lproj/QuickLoadOptions.xib | 49 ++++++++++ .../Clock Signal/Base.lproj/Vic20Options.xib | 92 ------------------- .../StaticAnalyser/CSStaticAnalyser.mm | 2 +- 4 files changed, 63 insertions(+), 106 deletions(-) create mode 100644 OSBindings/Mac/Clock Signal/Base.lproj/QuickLoadOptions.xib delete mode 100644 OSBindings/Mac/Clock Signal/Base.lproj/Vic20Options.xib diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 3deb8c746..38df9ccb5 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -280,7 +280,6 @@ 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; }; 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */; }; - 4B8FE21E1DA19D5F0090D3CE /* Vic20Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2191DA19D5F0090D3CE /* Vic20Options.xib */; }; 4B8FE2221DA19FB20090D3CE /* MachinePanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE2211DA19FB20090D3CE /* MachinePanel.swift */; }; 4B8FE2271DA1DE2D0090D3CE /* NSBundle+DataResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE2261DA1DE2D0090D3CE /* NSBundle+DataResource.m */; }; 4B924E991E74D22700B76AF1 /* AtariStaticAnalyserTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B924E981E74D22700B76AF1 /* AtariStaticAnalyserTests.mm */; }; @@ -605,6 +604,7 @@ 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD468F51D8DF41D0084958B /* 1770.cpp */; }; 4BD4A8D01E077FD20020D856 /* PCMTrackTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4A8CF1E077FD20020D856 /* PCMTrackTests.mm */; }; 4BD5F1951D13528900631CD1 /* CSBestEffortUpdater.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BD5F1941D13528900631CD1 /* CSBestEffortUpdater.mm */; }; + 4BD61664206B2AC800236112 /* QuickLoadOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BD61662206B2AC700236112 /* QuickLoadOptions.xib */; }; 4BDB61EB2032806E0048AF91 /* CSAtari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */; }; 4BDB61EC203285AE0048AF91 /* Atari2600OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE21F1DA19D7C0090D3CE /* Atari2600OptionsPanel.swift */; }; 4BDDBA991EF3451200347E61 /* Z80MachineCycleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */; }; @@ -963,7 +963,6 @@ 4B8FE2141DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Atari2600Options.xib"; sourceTree = SOURCE_ROOT; }; 4B8FE2161DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/MachineDocument.xib"; sourceTree = SOURCE_ROOT; }; 4B8FE2181DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/QuickLoadCompositeOptions.xib"; sourceTree = SOURCE_ROOT; }; - 4B8FE21A1DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Vic20Options.xib"; sourceTree = SOURCE_ROOT; }; 4B8FE21F1DA19D7C0090D3CE /* Atari2600OptionsPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Atari2600OptionsPanel.swift; sourceTree = ""; }; 4B8FE2211DA19FB20090D3CE /* MachinePanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MachinePanel.swift; sourceTree = ""; }; 4B8FE2251DA1DE2D0090D3CE /* NSBundle+DataResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+DataResource.h"; sourceTree = ""; }; @@ -1328,6 +1327,7 @@ 4BD4A8CF1E077FD20020D856 /* PCMTrackTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PCMTrackTests.mm; sourceTree = ""; }; 4BD5F1931D13528900631CD1 /* CSBestEffortUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSBestEffortUpdater.h; path = Updater/CSBestEffortUpdater.h; sourceTree = ""; }; 4BD5F1941D13528900631CD1 /* CSBestEffortUpdater.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CSBestEffortUpdater.mm; path = Updater/CSBestEffortUpdater.mm; sourceTree = ""; }; + 4BD61663206B2AC700236112 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/QuickLoadOptions.xib"; sourceTree = SOURCE_ROOT; }; 4BD9137D1F311BC5009BCF85 /* i8255.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = i8255.hpp; path = 8255/i8255.hpp; sourceTree = ""; }; 4BDCC5F81FB27A5E001220C5 /* ROMMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ROMMachine.hpp; sourceTree = ""; }; 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MachineCycleTests.swift; sourceTree = ""; }; @@ -1885,10 +1885,10 @@ 4B95FA9C1F11893B0008E395 /* ZX8081OptionsPanel.swift */, 4B38F34D1F2EC6BA00D9235D /* AmstradCPCOptions.xib */, 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */, - 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */, 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */, 4B2A332B1DB86821002876E3 /* OricOptions.xib */, - 4B8FE2191DA19D5F0090D3CE /* Vic20Options.xib */, + 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */, + 4BD61662206B2AC700236112 /* QuickLoadOptions.xib */, 4B1497961EE4B97F00CE2596 /* ZX8081Options.xib */, ); path = Documents; @@ -3127,10 +3127,10 @@ 4B79E4451E3AF38600141F11 /* floppy35.png in Resources */, 4B1EDB451E39A0AC009D6819 /* chip.png in Resources */, 4B2A332D1DB86821002876E3 /* OricOptions.xib in Resources */, + 4BD61664206B2AC800236112 /* QuickLoadOptions.xib in Resources */, 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */, 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */, 4B79E4441E3AF38600141F11 /* cassette.png in Resources */, - 4B8FE21E1DA19D5F0090D3CE /* Vic20Options.xib in Resources */, 4BB73EAC1B587A5100552FC2 /* MainMenu.xib in Resources */, 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */, 4B79E4461E3AF38600141F11 /* floppy525.png in Resources */, @@ -3849,14 +3849,6 @@ name = QuickLoadCompositeOptions.xib; sourceTree = ""; }; - 4B8FE2191DA19D5F0090D3CE /* Vic20Options.xib */ = { - isa = PBXVariantGroup; - children = ( - 4B8FE21A1DA19D5F0090D3CE /* Base */, - ); - name = Vic20Options.xib; - sourceTree = ""; - }; 4BB73EAA1B587A5100552FC2 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( @@ -3865,6 +3857,14 @@ name = MainMenu.xib; sourceTree = ""; }; + 4BD61662206B2AC700236112 /* QuickLoadOptions.xib */ = { + isa = PBXVariantGroup; + children = ( + 4BD61663206B2AC700236112 /* Base */, + ); + name = QuickLoadOptions.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ diff --git a/OSBindings/Mac/Clock Signal/Base.lproj/QuickLoadOptions.xib b/OSBindings/Mac/Clock Signal/Base.lproj/QuickLoadOptions.xib new file mode 100644 index 000000000..b9a1927af --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Base.lproj/QuickLoadOptions.xib @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OSBindings/Mac/Clock Signal/Base.lproj/Vic20Options.xib b/OSBindings/Mac/Clock Signal/Base.lproj/Vic20Options.xib deleted file mode 100644 index c578c2188..000000000 --- a/OSBindings/Mac/Clock Signal/Base.lproj/Vic20Options.xib +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 403991e97..88235235a 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -39,7 +39,7 @@ case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions"; case Analyser::Machine::MSX: return @"QuickLoadCompositeOptions"; case Analyser::Machine::Oric: return @"OricOptions"; - case Analyser::Machine::Vic20: return nil; //return @"Vic20Options"; + case Analyser::Machine::Vic20: return @"QuickLoadOptions"; case Analyser::Machine::ZX8081: return @"ZX8081Options"; default: return nil; } From 0869213c55519df430d8b4b7ecb27d1696d5ce07 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 27 Mar 2018 22:00:13 -0400 Subject: [PATCH 3/3] Cuts detritus. --- .../Clock Signal.xcodeproj/project.pbxproj | 8 -- .../ClockSignal-Bridging-Header.h | 1 - .../Documents/Vic20OptionsPanel.swift | 97 ------------------- .../Clock Signal/Machine/Wrappers/CSVic20.h | 35 ------- .../Clock Signal/Machine/Wrappers/CSVic20.mm | 66 ------------- .../Machine/Wrappers/CSZX8081+Instantiation.h | 16 --- 6 files changed, 223 deletions(-) delete mode 100644 OSBindings/Mac/Clock Signal/Documents/Vic20OptionsPanel.swift delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.h delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 38df9ccb5..4687fe9c1 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -723,8 +723,6 @@ 4B2A53971D117D36003C6002 /* KeyCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyCodes.h; sourceTree = ""; }; 4B2A53991D117D36003C6002 /* CSAtari2600.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAtari2600.h; sourceTree = ""; }; 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSAtari2600.mm; sourceTree = ""; }; - 4B2A539D1D117D36003C6002 /* CSVic20.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSVic20.h; sourceTree = ""; }; - 4B2A539E1D117D36003C6002 /* CSVic20.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSVic20.mm; sourceTree = ""; }; 4B2AF8681E513FC20027EE29 /* TIATests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TIATests.mm; sourceTree = ""; }; 4B2B3A471F9B8FA70062DABF /* Typer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Typer.cpp; sourceTree = ""; }; 4B2B3A481F9B8FA70062DABF /* MemoryFuzzer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryFuzzer.cpp; sourceTree = ""; }; @@ -977,7 +975,6 @@ 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "MSX ROMs"; sourceTree = ""; }; 4B9BE3FE203A0C0600FFAE60 /* MultiSpeaker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiSpeaker.cpp; sourceTree = ""; }; 4B9BE3FF203A0C0600FFAE60 /* MultiSpeaker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiSpeaker.hpp; sourceTree = ""; }; - 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vic20OptionsPanel.swift; sourceTree = ""; }; 4BA0F68C1EEA0E8400E9489E /* ZX8081.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ZX8081.cpp; path = Data/ZX8081.cpp; sourceTree = ""; }; 4BA0F68D1EEA0E8400E9489E /* ZX8081.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ZX8081.hpp; path = Data/ZX8081.hpp; sourceTree = ""; }; 4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+StdVector.h"; sourceTree = ""; }; @@ -1375,7 +1372,6 @@ 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DigitalPhaseLockedLoopBridge.mm; sourceTree = ""; }; 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DPLLTests.swift; sourceTree = ""; }; 4BF4A2D91F534DB300B171F4 /* TargetPlatforms.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TargetPlatforms.hpp; sourceTree = ""; }; - 4BF4A2DA1F5365C600B171F4 /* CSZX8081+Instantiation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CSZX8081+Instantiation.h"; sourceTree = ""; }; 4BF6606A1F281573002CB053 /* ClockReceiver.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ClockReceiver.hpp; sourceTree = ""; }; 4BF8295F1D8F3C87001BAE39 /* CRC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CRC.hpp; path = ../../NumberTheory/CRC.hpp; sourceTree = ""; }; 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllRAMProcessor.cpp; sourceTree = ""; }; @@ -1581,11 +1577,8 @@ isa = PBXGroup; children = ( 4B2A53991D117D36003C6002 /* CSAtari2600.h */, - 4B2A539D1D117D36003C6002 /* CSVic20.h */, 4B14978D1EE4B4D200CE2596 /* CSZX8081.h */, - 4BF4A2DA1F5365C600B171F4 /* CSZX8081+Instantiation.h */, 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */, - 4B2A539E1D117D36003C6002 /* CSVic20.mm */, 4B14978E1EE4B4D200CE2596 /* CSZX8081.mm */, ); path = Wrappers; @@ -1881,7 +1874,6 @@ 4B8FE21F1DA19D7C0090D3CE /* Atari2600OptionsPanel.swift */, 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */, 4B8FE2211DA19FB20090D3CE /* MachinePanel.swift */, - 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */, 4B95FA9C1F11893B0008E395 /* ZX8081OptionsPanel.swift */, 4B38F34D1F2EC6BA00D9235D /* AmstradCPCOptions.xib */, 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */, diff --git a/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h b/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h index 18f0f2e7d..e993b600d 100644 --- a/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h +++ b/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h @@ -6,7 +6,6 @@ #import "CSFastLoading.h" #import "CSAtari2600.h" -#import "CSVic20.h" #import "CSZX8081.h" #import "CSStaticAnalyser.h" diff --git a/OSBindings/Mac/Clock Signal/Documents/Vic20OptionsPanel.swift b/OSBindings/Mac/Clock Signal/Documents/Vic20OptionsPanel.swift deleted file mode 100644 index c7b02bd6d..000000000 --- a/OSBindings/Mac/Clock Signal/Documents/Vic20OptionsPanel.swift +++ /dev/null @@ -1,97 +0,0 @@ -// -// Vic20OptionsPanel.swift -// Clock Signal -// -// Created by Thomas Harte on 03/10/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -class Vic20OptionsPanel: MachinePanel { - var vic20: CSVic20! { - get { - return self.machine as! CSVic20 - } - } - - // MARK: country selector - @IBOutlet var countryButton: NSPopUpButton? - var countryUserDefaultsKey: String { - get { return prefixedUserDefaultsKey("country") } - } - - @IBAction func setCountry(_ sender: NSPopUpButton!) { - UserDefaults.standard.set(sender.indexOfSelectedItem, forKey: self.countryUserDefaultsKey) - setCountry(sender.indexOfSelectedItem) - } - - fileprivate func setCountry(_ countryID: Int) { - switch countryID { - case 0: // Danish - vic20.country = .danish - case 1: // European - vic20.country = .european - case 2: // Japanese - vic20.country = .japanese - case 3: // Swedish - vic20.country = .swedish - case 4: // US - vic20.country = .american - default: break - } - } - - // MARK: memory model selector - @IBOutlet var memorySizeButton: NSPopUpButton? - var memorySizeUserDefaultsKey: String { - get { return prefixedUserDefaultsKey("memorySize") } - } - - @IBAction func setMemorySize(_ sender: NSPopUpButton!) { - var selectedSize: Int? - switch sender.indexOfSelectedItem { - case 0: selectedSize = 5 - case 1: selectedSize = 8 - case 2: selectedSize = 32 - default: break - } - if let selectedSize = selectedSize { - UserDefaults.standard.set(selectedSize, forKey: self.memorySizeUserDefaultsKey) - setMemorySize(sender.indexOfSelectedItem) - } - } - fileprivate func setMemorySize(_ sizeIndex: Int) { - switch sizeIndex { - case 2: vic20.memorySize = .size32Kb - case 1: vic20.memorySize = .size8Kb - default: vic20.memorySize = .size5Kb - } - } - - // MARK: option restoration - override func establishStoredOptions() { - super.establishStoredOptions() - - let standardUserDefaults = UserDefaults.standard - standardUserDefaults.register(defaults: [ - self.memorySizeUserDefaultsKey: 5, - self.countryUserDefaultsKey: 1 - ]) - -// let memorySize = standardUserDefaults.integer(forKey: self.memorySizeUserDefaultsKey) -// var indexToSelect: Int? -// switch memorySize { -// case 32: indexToSelect = 2 -// case 8: indexToSelect = 1 -// default: indexToSelect = 0 -// } -// if let indexToSelect = indexToSelect { -// self.memorySizeButton?.selectItem(at: indexToSelect) -// setMemorySize(indexToSelect) -// } - - // TODO: this should be part of the configuration - let country = standardUserDefaults.integer(forKey: self.countryUserDefaultsKey) - setCountry(country) - self.countryButton?.selectItem(at: country) - } -} diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.h deleted file mode 100644 index 13dcc4733..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// CSVic20.h -// Clock Signal -// -// Created by Thomas Harte on 04/06/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSMachine.h" -#import "CSFastLoading.h" - -typedef NS_ENUM(NSInteger, CSVic20Country) -{ - CSVic20CountryAmerican, - CSVic20CountryDanish, - CSVic20CountryEuropean, - CSVic20CountryJapanese, - CSVic20CountrySwedish -}; - -typedef NS_ENUM(NSInteger, CSVic20MemorySize) -{ - CSVic20MemorySize5Kb, - CSVic20MemorySize8Kb, - CSVic20MemorySize32Kb, -}; - -@interface CSVic20 : CSMachine - -- (instancetype)init; - -@property (nonatomic, assign) CSVic20Country country; -@property (nonatomic, assign) CSVic20MemorySize memorySize; - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm deleted file mode 100644 index 58755b490..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm +++ /dev/null @@ -1,66 +0,0 @@ -// -// CSVic20.m -// Clock Signal -// -// Created by Thomas Harte on 04/06/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSVic20.h" - -#include "Vic20.hpp" -#include "TypedDynamicMachine.hpp" - -@implementation CSVic20 { - Machine::TypedDynamicMachine _vic20; -} - -- (instancetype)init { - _vic20 = Machine::TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); - return nil;//[super initWithMachine:&_vic20]; -} - -- (NSString *)userDefaultsPrefix { return @"vic20"; } - -#pragma mark - Keyboard map - -/*- (void)setKey:(uint16_t)key isPressed:(BOOL)isPressed { - switch(key) { - case VK_UpArrow: _vic20->set_joystick_state(JoystickInput::Up, isPressed); break; - case VK_DownArrow: _vic20->set_joystick_state(JoystickInput::Down, isPressed); break; - case VK_LeftArrow: _vic20->set_joystick_state(JoystickInput::Left, isPressed); break; - case VK_RightArrow: _vic20->set_joystick_state(JoystickInput::Right, isPressed); break; - case VK_ANSI_A: _vic20->set_joystick_state(JoystickInput::Fire, isPressed); break; - } -}*/ - -#pragma mark - Public configuration options - -- (void)setCountry:(CSVic20Country)country { - _country = country; - Commodore::Vic20::Region region; - switch(country) { - case CSVic20CountryDanish: region = Commodore::Vic20::Danish; break; - case CSVic20CountryEuropean: region = Commodore::Vic20::European; break; - case CSVic20CountryJapanese: region = Commodore::Vic20::Japanese; break; - case CSVic20CountrySwedish: region = Commodore::Vic20::Swedish; break; - case CSVic20CountryAmerican: region = Commodore::Vic20::American; break; - } - - @synchronized(self) { - _vic20.get()->set_region(region); - } -} - -- (void)setMemorySize:(CSVic20MemorySize)memorySize { - _memorySize = memorySize; - @synchronized(self) { - switch(memorySize) { - case CSVic20MemorySize5Kb: _vic20.get()->set_memory_size(Commodore::Vic20::Default); break; - case CSVic20MemorySize8Kb: _vic20.get()->set_memory_size(Commodore::Vic20::ThreeKB); break; - case CSVic20MemorySize32Kb: _vic20.get()->set_memory_size(Commodore::Vic20::ThirtyTwoKB); break; - } - } -} - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h deleted file mode 100644 index 600046fb2..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CSZX8081+Instantiation.h -// Clock Signal -// -// Created by Thomas Harte on 27/08/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#include "StaticAnalyser.hpp" -#import "CSZX8081.h" - -@interface CSZX8081 (Instantiation) - -- (instancetype)initWithIntendedTarget:(const Analyser::Static::Target &)target; - -@end