From e2cdfae8a701320a87ebe0b76df61baddb5a477a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 15 Nov 2016 10:39:16 +0800 Subject: [PATCH] The emulated Oric now has access to both versions of the BASIC ROM and picks between them based on the static analyser's recommendation. --- Machines/Oric/Oric.cpp | 13 +++++++++++-- Machines/Oric/Oric.hpp | 7 ++++++- .../Mac/Clock Signal/Machine/Wrappers/CSOric.mm | 7 +++++-- StaticAnalyser/Oric/StaticAnalyser.cpp | 1 + 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index fc06421a8..52d7d437a 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -36,11 +36,20 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) { set_typer_for_string(target.loadingCommand.c_str()); } + + if(target.oric.use_atmos_rom) + { + memcpy(_rom, _basic11.data(), std::min(_basic11.size(), sizeof(_rom))); + } + else + { + memcpy(_rom, _basic10.data(), std::min(_basic10.size(), sizeof(_rom))); + } } -void Machine::set_rom(std::vector data) +void Machine::set_rom(ROM rom, const std::vector &data) { - memcpy(_rom, data.data(), std::min(data.size(), sizeof(_rom))); + if(rom == BASIC11) _basic11 = std::move(data); else _basic10 = std::move(data); } unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 7a2939992..000a024b0 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -51,6 +51,10 @@ enum Key: uint16_t { TerminateSequence = 0xffff, NotMapped = 0xfffe }; +enum ROM { + BASIC10, BASIC11 +}; + class Machine: public CPU6502::Processor, public CRTMachine::Machine, @@ -62,7 +66,7 @@ class Machine: public: Machine(); - void set_rom(std::vector data); + void set_rom(ROM rom, const std::vector &data); void set_key_state(uint16_t key, bool isPressed); void clear_all_keys(); @@ -93,6 +97,7 @@ class Machine: private: // RAM and ROM + std::vector _basic11, _basic10; uint8_t _ram[65536], _rom[16384]; int _cycles_since_video_update; inline void update_video(); diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm index f25982c71..5fb0d188a 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm @@ -25,8 +25,11 @@ self = [super init]; if(self) { - NSData *rom = [self rom:@"basic11"]; // test108j - if(rom) _oric.set_rom(rom.stdVector8); + NSData *basic10 = [self rom:@"basic10"]; + NSData *basic11 = [self rom:@"basic11"]; // test108j + + if(basic10) _oric.set_rom(Oric::BASIC10, basic10.stdVector8); + if(basic11) _oric.set_rom(Oric::BASIC11, basic11.stdVector8); } return self; } diff --git a/StaticAnalyser/Oric/StaticAnalyser.cpp b/StaticAnalyser/Oric/StaticAnalyser.cpp index b2e403f7b..ae1bd0815 100644 --- a/StaticAnalyser/Oric/StaticAnalyser.cpp +++ b/StaticAnalyser/Oric/StaticAnalyser.cpp @@ -108,6 +108,7 @@ void StaticAnalyser::Oric::AddTargets( } } + // TODO: really this should add two targets if not all votes agree target.oric.use_atmos_rom = basic11_votes >= basic10_votes; if(target.tapes.size() || target.disks.size() || target.cartridges.size())