From 949cfcfa6906dfad041068596e27779bc561a389 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 9 Dec 2024 17:31:00 -0500 Subject: [PATCH] Load ROMs. --- Machines/Commodore/Plus4/Plus4.cpp | 14 ++++++++++++-- Machines/Utility/ROMCatalogue.hpp | 4 ++-- ROMImages/Plus4/readme.txt | 12 ++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 ROMImages/Plus4/readme.txt diff --git a/Machines/Commodore/Plus4/Plus4.cpp b/Machines/Commodore/Plus4/Plus4.cpp index 7832c35d7..a3506bb1f 100644 --- a/Machines/Commodore/Plus4/Plus4.cpp +++ b/Machines/Commodore/Plus4/Plus4.cpp @@ -19,11 +19,17 @@ namespace { class ConcreteMachine: public MachineTypes::TimedMachine, public MachineTypes::ScanProducer, + public MachineTypes::MediaTarget, public Machine { public: ConcreteMachine(const Analyser::Static::Commodore::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) { - (void)target; - (void)rom_fetcher; + const ROM::Request request = ROM::Request(ROM::Name::Plus4BASIC) && ROM::Request(ROM::Name::Plus4KernelPALv5); + auto roms = rom_fetcher(request); + if(!request.validate(roms)) { + throw ROMMachine::Error::MissingROMs; + } + + insert_media(target.media); } private: @@ -36,6 +42,10 @@ private: void run_for(const Cycles) final { } + + bool insert_media(const Analyser::Static::Media &) final { + return true; + } }; } diff --git a/Machines/Utility/ROMCatalogue.hpp b/Machines/Utility/ROMCatalogue.hpp index 67ffe2423..d366e0d2e 100644 --- a/Machines/Utility/ROMCatalogue.hpp +++ b/Machines/Utility/ROMCatalogue.hpp @@ -256,7 +256,7 @@ struct Request { bool empty(); /// @returns what remains of this ROM request given that everything in @c map has been found. - Request subtract(const ROM::Map &map) const; + Request subtract(const Map &map) const; enum class ListType { Any, All, Single @@ -303,7 +303,7 @@ private: const std::function &exit_list, const std::function &add_item ) const; - bool subtract(const ROM::Map &map); + bool subtract(const Map &map); void sort() { // Don't do a full sort, but move anything optional to the back. // This makes them print more nicely; it's a human-facing tweak only. diff --git a/ROMImages/Plus4/readme.txt b/ROMImages/Plus4/readme.txt new file mode 100644 index 000000000..0a42cb185 --- /dev/null +++ b/ROMImages/Plus4/readme.txt @@ -0,0 +1,12 @@ +ROM files would ordinarily go here; the copyright status of these is uncertain so they have not been included in this repository. + +Expected files: + +At least one of: +kernal.318004-03.bin — the PAL kernel, v3; +kernal.318004-04.bin — the PAL kernel, v4; and +kernal.318004-05.bin — the PAL kernel, v5. + + +And: +basic.318006-01.bin — the BASIC 3.5 ROM.