1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Adds the 65816 as an in-code option for Oric emulation.

This also means it'll be exposed via the SDL build, but that's okay.
This commit is contained in:
Thomas Harte 2020-10-18 21:43:08 -04:00
parent 76d9893866
commit 1fa94e1b08
2 changed files with 28 additions and 9 deletions

View File

@ -33,8 +33,14 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl<Ta
BD500 BD500
); );
ReflectableEnum(Processor,
MOS6502,
WDC65816
);
ROM rom = ROM::BASIC11; ROM rom = ROM::BASIC11;
DiskInterface disk_interface = DiskInterface::None; DiskInterface disk_interface = DiskInterface::None;
Processor processor = Processor::MOS6502;
std::string loading_command; std::string loading_command;
bool should_start_jasmin = false; bool should_start_jasmin = false;
@ -42,8 +48,10 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl<Ta
if(needs_declare()) { if(needs_declare()) {
DeclareField(rom); DeclareField(rom);
DeclareField(disk_interface); DeclareField(disk_interface);
DeclareField(processor);
AnnounceEnum(ROM); AnnounceEnum(ROM);
AnnounceEnum(DiskInterface); AnnounceEnum(DiskInterface);
AnnounceEnum(Processor);
} }
} }
}; };

View File

@ -20,7 +20,7 @@
#include "../Utility/MemoryFuzzer.hpp" #include "../Utility/MemoryFuzzer.hpp"
#include "../Utility/StringSerialiser.hpp" #include "../Utility/StringSerialiser.hpp"
#include "../../Processors/6502/6502.hpp" #include "../../Processors/6502Esque/6502Selector.hpp"
#include "../../Components/6522/6522.hpp" #include "../../Components/6522/6522.hpp"
#include "../../Components/AY38910/AY38910.hpp" #include "../../Components/AY38910/AY38910.hpp"
#include "../../Components/DiskII/DiskII.hpp" #include "../../Components/DiskII/DiskII.hpp"
@ -41,6 +41,7 @@
namespace Oric { namespace Oric {
using DiskInterface = Analyser::Static::Oric::Target::DiskInterface; using DiskInterface = Analyser::Static::Oric::Target::DiskInterface;
using Processor = Analyser::Static::Oric::Target::Processor;
using AY = GI::AY38910::AY38910<false>; using AY = GI::AY38910::AY38910<false>;
using Speaker = Outputs::Speaker::LowpassSpeaker<AY>; using Speaker = Outputs::Speaker::LowpassSpeaker<AY>;
@ -205,7 +206,7 @@ class VIAPortHandler: public MOS::MOS6522::IRQDelegatePortHandler {
Keyboard &keyboard_; Keyboard &keyboard_;
}; };
template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class ConcreteMachine: template <Analyser::Static::Oric::Target::DiskInterface disk_interface, CPU::MOS6502Esque::Type processor_type> class ConcreteMachine:
public MachineTypes::TimedMachine, public MachineTypes::TimedMachine,
public MachineTypes::ScanProducer, public MachineTypes::ScanProducer,
public MachineTypes::AudioProducer, public MachineTypes::AudioProducer,
@ -656,7 +657,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
const uint16_t basic_invisible_ram_top_ = 0xffff; const uint16_t basic_invisible_ram_top_ = 0xffff;
const uint16_t basic_visible_ram_top_ = 0xbfff; const uint16_t basic_visible_ram_top_ = 0xbfff;
CPU::MOS6502::Processor<CPU::MOS6502::Personality::P6502, ConcreteMachine, false> m6502_; CPU::MOS6502Esque::Processor<processor_type, ConcreteMachine, false> m6502_;
// RAM and ROM // RAM and ROM
std::vector<uint8_t> rom_, disk_rom_; std::vector<uint8_t> rom_, disk_rom_;
@ -759,13 +760,23 @@ using namespace Oric;
Machine *Machine::Oric(const Analyser::Static::Target *target_hint, const ROMMachine::ROMFetcher &rom_fetcher) { Machine *Machine::Oric(const Analyser::Static::Target *target_hint, const ROMMachine::ROMFetcher &rom_fetcher) {
auto *const oric_target = dynamic_cast<const Analyser::Static::Oric::Target *>(target_hint); auto *const oric_target = dynamic_cast<const Analyser::Static::Oric::Target *>(target_hint);
switch(oric_target->disk_interface) {
default: return new ConcreteMachine<DiskInterface::None>(*oric_target, rom_fetcher); #define DiskInterfaceSwitch(processor) \
case DiskInterface::Microdisc: return new ConcreteMachine<DiskInterface::Microdisc>(*oric_target, rom_fetcher); switch(oric_target->disk_interface) { \
case DiskInterface::Pravetz: return new ConcreteMachine<DiskInterface::Pravetz>(*oric_target, rom_fetcher); default: return new ConcreteMachine<DiskInterface::None, processor>(*oric_target, rom_fetcher); \
case DiskInterface::Jasmin: return new ConcreteMachine<DiskInterface::Jasmin>(*oric_target, rom_fetcher); case DiskInterface::Microdisc: return new ConcreteMachine<DiskInterface::Microdisc, processor>(*oric_target, rom_fetcher); \
case DiskInterface::BD500: return new ConcreteMachine<DiskInterface::BD500>(*oric_target, rom_fetcher); case DiskInterface::Pravetz: return new ConcreteMachine<DiskInterface::Pravetz, processor>(*oric_target, rom_fetcher); \
case DiskInterface::Jasmin: return new ConcreteMachine<DiskInterface::Jasmin, processor>(*oric_target, rom_fetcher); \
case DiskInterface::BD500: return new ConcreteMachine<DiskInterface::BD500, processor>(*oric_target, rom_fetcher); \
} }
switch(oric_target->processor) {
case Processor::WDC65816: DiskInterfaceSwitch(CPU::MOS6502Esque::Type::TWDC65816);
case Processor::MOS6502: DiskInterfaceSwitch(CPU::MOS6502Esque::Type::T6502);
}
#undef DiskInterfaceSwitch
} }
Machine::~Machine() {} Machine::~Machine() {}