From ed564cb8106a38e453fda9e87e42267dffae63e1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 4 Jan 2018 22:18:18 -0500 Subject: [PATCH] Implements the main four cartridge banking schemes. Slightly proof of concept for now. --- Machines/MSX/Cartridges/ASCII16kb.hpp | 42 +++++++ Machines/MSX/Cartridges/ASCII8kb.hpp | 48 ++++++++ Machines/MSX/Cartridges/Konami.hpp | 45 ++++++++ Machines/MSX/Cartridges/KonamiWithSCC.hpp | 48 ++++++++ Machines/MSX/MSX.cpp | 103 ++++++++++++------ Machines/MSX/ROMSlotHandler.hpp | 36 ++++++ .../Clock Signal.xcodeproj/project.pbxproj | 22 +++- .../MSXStaticAnalyserTests.mm | 2 +- StaticAnalyser/MSX/StaticAnalyser.cpp | 24 ++-- StaticAnalyser/StaticAnalyser.hpp | 2 +- 10 files changed, 323 insertions(+), 49 deletions(-) create mode 100644 Machines/MSX/Cartridges/ASCII16kb.hpp create mode 100644 Machines/MSX/Cartridges/ASCII8kb.hpp create mode 100644 Machines/MSX/Cartridges/Konami.hpp create mode 100644 Machines/MSX/Cartridges/KonamiWithSCC.hpp create mode 100644 Machines/MSX/ROMSlotHandler.hpp diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp new file mode 100644 index 000000000..37aa6a70b --- /dev/null +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -0,0 +1,42 @@ +// +// ASCII16kb.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef ASCII16kb_hpp +#define ASCII16kb_hpp + +#include "../ROMSlotHandler.hpp" + +namespace MSX { +namespace Cartridge { + +class ASCII16kbROMSlotHandler: public ROMSlotHandler { + public: + ASCII16kbROMSlotHandler(MSX::MemoryMap &map, int slot) : + map_(map), slot_(slot) {} + + void write(uint16_t address, uint8_t value) { + switch(address >> 11) { + default: break; + case 0xc: + map_.map(slot_, value * 8192, 0x4000, 0x4000); + break; + case 0xe: + map_.map(slot_, value * 8192, 0x8000, 0x4000); + break; + } + } + + private: + MSX::MemoryMap &map_; + int slot_; +}; + +} +} + +#endif /* ASCII16kb_hpp */ diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp new file mode 100644 index 000000000..ab5c515e2 --- /dev/null +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -0,0 +1,48 @@ +// +// ASCII8kb.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef ASCII8kb_hpp +#define ASCII8kb_hpp + +#include "../ROMSlotHandler.hpp" + +namespace MSX { +namespace Cartridge { + +class ASCII8kbROMSlotHandler: public ROMSlotHandler { + public: + ASCII8kbROMSlotHandler(MSX::MemoryMap &map, int slot) : + map_(map), slot_(slot) {} + + void write(uint16_t address, uint8_t value) { + switch(address >> 11) { + default: break; + case 0xc: + map_.map(slot_, value * 8192, 0x4000, 0x2000); + break; + case 0xd: + map_.map(slot_, value * 8192, 0x6000, 0x2000); + break; + case 0xe: + map_.map(slot_, value * 8192, 0x8000, 0x2000); + break; + case 0xf: + map_.map(slot_, value * 8192, 0xa000, 0x2000); + break; + } + } + + private: + MSX::MemoryMap &map_; + int slot_; +}; + +} +} + +#endif /* ASCII8kb_hpp */ diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp new file mode 100644 index 000000000..296f00a97 --- /dev/null +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -0,0 +1,45 @@ +// +// Konami.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef Konami_hpp +#define Konami_hpp + +#include "../ROMSlotHandler.hpp" + +namespace MSX { +namespace Cartridge { + +class KonamiROMSlotHandler: public ROMSlotHandler { + public: + KonamiROMSlotHandler(MSX::MemoryMap &map, int slot) : + map_(map), slot_(slot) {} + + void write(uint16_t address, uint8_t value) { + switch(address >> 13) { + default: break; + case 3: + map_.map(slot_, value * 8192, 0x6000, 0x2000); + break; + case 4: + map_.map(slot_, value * 8192, 0x8000, 0x2000); + break; + case 5: + map_.map(slot_, value * 8192, 0xa000, 0x2000); + break; + } + } + + private: + MSX::MemoryMap &map_; + int slot_; +}; + +} +} + +#endif /* Konami_hpp */ diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp new file mode 100644 index 000000000..f57d33249 --- /dev/null +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -0,0 +1,48 @@ +// +// KonamiWithSCC.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef KonamiWithSCC_hpp +#define KonamiWithSCC_hpp + +#include "../ROMSlotHandler.hpp" + +namespace MSX { +namespace Cartridge { + +class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { + public: + KonamiWithSCCROMSlotHandler(MSX::MemoryMap &map, int slot) : + map_(map), slot_(slot) {} + + void write(uint16_t address, uint8_t value) { + switch(address >> 11) { + default: break; + case 0x0a: + map_.map(slot_, value * 8192, 0x4000, 0x2000); + break; + case 0x0e: + map_.map(slot_, value * 8192, 0x6000, 0x2000); + break; + case 0x12: + map_.map(slot_, value * 8192, 0x8000, 0x2000); + break; + case 0x16: + map_.map(slot_, value * 8192, 0xa000, 0x2000); + break; + } + } + + private: + MSX::MemoryMap &map_; + int slot_; +}; + +} +} + +#endif /* KonamiWithSCC_hpp */ diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 14ff65f82..32c812a69 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -9,6 +9,12 @@ #include "MSX.hpp" #include "Keyboard.hpp" +#include "ROMSlotHandler.hpp" + +#include "Cartridges/ASCII8kb.hpp" +#include "Cartridges/ASCII16kb.hpp" +#include "Cartridges/Konami.hpp" +#include "Cartridges/KonamiWithSCC.hpp" #include "../../Processors/Z80/Z80.hpp" @@ -106,7 +112,8 @@ class ConcreteMachine: public CRTMachine::Machine, public ConfigurationTarget::Machine, public KeyboardMachine::Machine, - public Configurable::Device { + public Configurable::Device, + public MemoryMap { public: ConcreteMachine(): z80_(*this), @@ -152,18 +159,30 @@ class ConcreteMachine: if(target.loading_command.length()) { type_string(target.loading_command); } + + switch(target.msx.cartridge_type) { + default: break; + case StaticAnalyser::MSXCartridgeType::Konami: + memory_slots_[1].handler.reset(new Cartridge::KonamiROMSlotHandler(*this, 1)); + break; + case StaticAnalyser::MSXCartridgeType::KonamiWithSCC: + // TODO: enable an SCC. + memory_slots_[1].handler.reset(new Cartridge::KonamiWithSCCROMSlotHandler(*this, 1)); + break; + case StaticAnalyser::MSXCartridgeType::ASCII8kb: + memory_slots_[1].handler.reset(new Cartridge::ASCII8kbROMSlotHandler(*this, 1)); + break; + case StaticAnalyser::MSXCartridgeType::ASCII16kb: + memory_slots_[1].handler.reset(new Cartridge::ASCII16kbROMSlotHandler(*this, 1)); + break; + } } bool insert_media(const StaticAnalyser::Media &media) override { if(!media.cartridges.empty()) { const auto &segment = media.cartridges.front()->get_segments().front(); - cartridge_ = segment.data; - - // TODO: should clear other page 1 pointers, should allow for paging cartridges, etc. - size_t base = segment.start_address >> 14; - for(size_t c = 0; c < cartridge_.size(); c += 16384) { - memory_slots_[1].read_pointers[(c >> 14) + base] = cartridge_.data() + c; - } + memory_slots_[1].source = segment.data; + map(1, 0, static_cast(segment.start_address), std::min(segment.data.size(), 65536 - segment.start_address)); } if(!media.tapes.empty()) { @@ -177,10 +196,27 @@ class ConcreteMachine: input_text_ += string; } + void map(int slot, std::size_t source_address, uint16_t destination_address, std::size_t length) override { + // TODO: deal with out-of-bounds pages. + assert(!(destination_address & 8191)); + assert(!(length & 8191)); + assert(static_cast(destination_address) + length <= 65536); + + for(std::size_t c = 0; c < (length >> 13); ++c) { + memory_slots_[slot].read_pointers[(destination_address >> 13) + c] = &memory_slots_[slot].source[source_address]; + source_address += 8192; + } + + page_memory(paged_memory_); + } + void page_memory(uint8_t value) { - for(size_t c = 0; c < 4; ++c) { + paged_memory_ = value; + for(std::size_t c = 0; c < 8; c += 2) { read_pointers_[c] = memory_slots_[value & 3].read_pointers[c]; write_pointers_[c] = memory_slots_[value & 3].write_pointers[c]; + read_pointers_[c+1] = memory_slots_[value & 3].read_pointers[c+1]; + write_pointers_[c+1] = memory_slots_[value & 3].write_pointers[c+1]; value >>= 2; } } @@ -196,7 +232,7 @@ class ConcreteMachine: uint16_t address = cycle.address ? *cycle.address : 0x0000; switch(cycle.operation) { case CPU::Z80::PartialMachineCycle::ReadOpcode: - if(use_fast_tape_) { + if(use_fast_tape_ && tape_player_.has_tape()) { if(address == 0x1a63) { // TAPION @@ -251,12 +287,16 @@ class ConcreteMachine: } } case CPU::Z80::PartialMachineCycle::Read: - *cycle.value = read_pointers_[address >> 14][address & 16383]; + *cycle.value = read_pointers_[address >> 13][address & 8191]; break; - case CPU::Z80::PartialMachineCycle::Write: - write_pointers_[address >> 14][address & 16383] = *cycle.value; - break; + case CPU::Z80::PartialMachineCycle::Write: { + write_pointers_[address >> 13][address & 8191] = *cycle.value; + + int slot_hit = (paged_memory_ >> ((address >> 14) * 2)) & 3; + if(memory_slots_[slot_hit].handler) + memory_slots_[slot_hit].handler->write(address, *cycle.value); + } break; case CPU::Z80::PartialMachineCycle::Input: switch(address & 0xff) { @@ -373,26 +413,21 @@ class ConcreteMachine: if(!roms[0]) return false; - rom_ = std::move(*roms[0]); - rom_.resize(32768); + memory_slots_[0].source = std::move(*roms[0]); + memory_slots_[0].source.resize(32768); - for(size_t c = 0; c < 4; ++c) { + for(size_t c = 0; c < 8; ++c) { for(size_t slot = 0; slot < 3; ++slot) { memory_slots_[slot].read_pointers[c] = unpopulated_; memory_slots_[slot].write_pointers[c] = scratch_; } memory_slots_[3].read_pointers[c] = - memory_slots_[3].write_pointers[c] = &ram_[c * 16384]; + memory_slots_[3].write_pointers[c] = &ram_[c * 8192]; } - memory_slots_[0].read_pointers[0] = rom_.data(); - memory_slots_[0].read_pointers[1] = &rom_[16384]; - - for(size_t c = 0; c < 4; ++c) { - read_pointers_[c] = memory_slots_[0].read_pointers[c]; - write_pointers_[c] = memory_slots_[0].write_pointers[c]; - } + map(0, 0, 0, 32768); + page_memory(0); return true; } @@ -514,19 +549,21 @@ class ConcreteMachine: i8255PortHandler i8255_port_handler_; AYPortHandler ay_port_handler_; - uint8_t *read_pointers_[4]; - uint8_t *write_pointers_[4]; + uint8_t paged_memory_ = 0; + uint8_t *read_pointers_[8]; + uint8_t *write_pointers_[8]; struct MemorySlots { - uint8_t *read_pointers[4]; - uint8_t *write_pointers[4]; + uint8_t *read_pointers[8]; + uint8_t *write_pointers[8]; + + std::unique_ptr handler; + std::vector source; } memory_slots_[4]; uint8_t ram_[65536]; - uint8_t scratch_[16384]; - uint8_t unpopulated_[16384]; - std::vector rom_; - std::vector cartridge_; + uint8_t scratch_[8192]; + uint8_t unpopulated_[8192]; HalfCycles time_since_vdp_update_; HalfCycles time_since_ay_update_; diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp new file mode 100644 index 000000000..726519135 --- /dev/null +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -0,0 +1,36 @@ +// +// ROMSlotHandler.hpp +// Clock Signal +// +// Created by Thomas Harte on 03/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef ROMSlotHandler_hpp +#define ROMSlotHandler_hpp + +#include "../../ClockReceiver/ClockReceiver.hpp" + +#include +#include + +/* + Design assumption in this file: to-ROM writes and paging events are 'rare', + so virtual call costs aren't worrisome. +*/ +namespace MSX { + +class MemoryMap { + public: + virtual void map(int slot, std::size_t source_address, uint16_t destination_address, std::size_t length) = 0; +}; + +class ROMSlotHandler { + public: + virtual void run_for(HalfCycles half_cycles) {} + virtual void write(uint16_t address, uint8_t value) = 0; +}; + +} + +#endif /* ROMSlotHandler_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index adad598f0..3ac05131c 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -677,6 +677,10 @@ 4B1497971EE4B97F00CE2596 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/ZX8081Options.xib"; sourceTree = SOURCE_ROOT; }; 4B1558BE1F844ECD006E9A97 /* BitReverse.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = BitReverse.cpp; path = Data/BitReverse.cpp; sourceTree = ""; }; 4B1558BF1F844ECD006E9A97 /* BitReverse.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = BitReverse.hpp; path = Data/BitReverse.hpp; sourceTree = ""; }; + 4B1667F61FFF1E2400A16032 /* Konami.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Konami.hpp; path = MSX/Cartridges/Konami.hpp; sourceTree = ""; }; + 4B1667F91FFF215E00A16032 /* ASCII16kb.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ASCII16kb.hpp; path = MSX/Cartridges/ASCII16kb.hpp; sourceTree = ""; }; + 4B1667FA1FFF215E00A16032 /* ASCII8kb.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ASCII8kb.hpp; path = MSX/Cartridges/ASCII8kb.hpp; sourceTree = ""; }; + 4B1667FB1FFF215F00A16032 /* KonamiWithSCC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = KonamiWithSCC.hpp; path = MSX/Cartridges/KonamiWithSCC.hpp; sourceTree = ""; }; 4B1BA0881FD4967700CB4ADA /* CSMSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMSX.h; sourceTree = ""; }; 4B1BA0891FD4967800CB4ADA /* CSMSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSMSX.mm; sourceTree = ""; }; 4B1BA08C1FD498B000CB4ADA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/MSXOptions.xib"; sourceTree = SOURCE_ROOT; }; @@ -844,6 +848,7 @@ 4B6A4C951F58F09E00E3F787 /* 6502Base.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6502Base.cpp; sourceTree = ""; }; 4B7041271F92C26900735E45 /* JoystickMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = JoystickMachine.hpp; sourceTree = ""; }; 4B70412A1F92C2A700735E45 /* Joystick.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Joystick.hpp; sourceTree = ""; }; + 4B70EF6A1FFDCDF400A3494E /* ROMSlotHandler.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = ROMSlotHandler.hpp; path = MSX/ROMSlotHandler.hpp; sourceTree = ""; }; 4B7136841F78724F008B8ED9 /* Encoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Encoder.cpp; sourceTree = ""; }; 4B7136851F78724F008B8ED9 /* Encoder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Encoder.hpp; sourceTree = ""; }; 4B7136871F78725F008B8ED9 /* Shifter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Shifter.cpp; sourceTree = ""; }; @@ -1463,6 +1468,17 @@ name = ZX8081; sourceTree = ""; }; + 4B1667F81FFF1E2900A16032 /* Cartridges */ = { + isa = PBXGroup; + children = ( + 4B1667FA1FFF215E00A16032 /* ASCII8kb.hpp */, + 4B1667F91FFF215E00A16032 /* ASCII16kb.hpp */, + 4B1667FB1FFF215F00A16032 /* KonamiWithSCC.hpp */, + 4B1667F61FFF1E2400A16032 /* Konami.hpp */, + ); + name = Cartridges; + sourceTree = ""; + }; 4B1E85791D174DEC001EF87D /* 6532 */ = { isa = PBXGroup; children = ( @@ -1984,10 +2000,12 @@ 4B79A4FC1FC8FF9800EEDAD5 /* MSX */ = { isa = PBXGroup; children = ( - 4B79A4FF1FC913C900EEDAD5 /* MSX.cpp */, - 4B79A5001FC913C900EEDAD5 /* MSX.hpp */, 4B12C0EB1FCFA98D005BFD93 /* Keyboard.cpp */, + 4B79A4FF1FC913C900EEDAD5 /* MSX.cpp */, 4B12C0EC1FCFA98D005BFD93 /* Keyboard.hpp */, + 4B79A5001FC913C900EEDAD5 /* MSX.hpp */, + 4B70EF6A1FFDCDF400A3494E /* ROMSlotHandler.hpp */, + 4B1667F81FFF1E2900A16032 /* Cartridges */, ); name = MSX; sourceTree = ""; diff --git a/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm b/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm index 2e31fcfb2..5a628a09d 100644 --- a/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm +++ b/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm @@ -222,7 +222,7 @@ static NSDictionary *romRecordsBySHA1 = @{ // assert equality XCTAssert(!targets.empty(), "%@ should be recognised as an MSX file", testFile); if(!targets.empty()) { - XCTAssert(targets.front().msx.paging_model == romRecord.cartridgeType, @"%@; should be %d, is %d", testFile, romRecord.cartridgeType, targets.front().msx.paging_model); + XCTAssert(targets.front().msx.cartridge_type == romRecord.cartridgeType, @"%@; should be %d, is %d", testFile, romRecord.cartridgeType, targets.front().msx.cartridge_type); } } } diff --git a/StaticAnalyser/MSX/StaticAnalyser.cpp b/StaticAnalyser/MSX/StaticAnalyser.cpp index c456c134c..22d8d9aab 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.cpp +++ b/StaticAnalyser/MSX/StaticAnalyser.cpp @@ -59,7 +59,7 @@ static std::list> // If this ROM is greater than 48kb in size then some sort of MegaROM scheme must // be at play; disassemble to try to figure it out. - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::None; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::None; if(data_size > 0xc000) { std::vector first_16k; first_16k.insert(first_16k.begin(), segment.data.begin(), segment.data.begin() + 8192); @@ -104,17 +104,17 @@ static std::list> switch(iterator->second.operand) { case 0x6000: if(address >= 0x6000 && address < 0x8000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; } break; case 0x6800: if(address >= 0x6000 && address < 0x6800) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::ASCII8kb; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::ASCII8kb; } break; case 0x7000: if(address >= 0x6000 && address < 0x8000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; } if(address >= 0x7000 && address < 0x7800) { is_ascii = true; @@ -122,32 +122,32 @@ static std::list> break; case 0x77ff: if(address >= 0x7000 && address < 0x7800) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::ASCII16kb; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::ASCII16kb; } break; case 0x7800: if(address >= 0xa000 && address < 0xc000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::ASCII8kb; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::ASCII8kb; } break; case 0x8000: if(address >= 0x8000 && address < 0xa000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; } break; case 0x9000: if(address >= 0x8000 && address < 0xa000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; } break; case 0xa000: if(address >= 0xa000 && address < 0xc000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::Konami; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::Konami; } break; case 0xb000: if(address >= 0xa000 && address < 0xc000) { - target.msx.paging_model = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; } break; } @@ -156,7 +156,7 @@ static std::list> iterator = next_iterator; } - if(target.msx.paging_model == StaticAnalyser::MSXCartridgeType::None) { + if(target.msx.cartridge_type == StaticAnalyser::MSXCartridgeType::None) { // Look for LD (nnnn), A instructions, and collate those addresses. std::map address_counts; for(const auto &instruction_pair : instructions) { @@ -180,7 +180,7 @@ static std::list> return a.second > b.second; }); - target.msx.paging_model = possibilities[0].first; + target.msx.cartridge_type = possibilities[0].first; } } diff --git a/StaticAnalyser/StaticAnalyser.hpp b/StaticAnalyser/StaticAnalyser.hpp index 88dbb2aa7..b4bcee655 100644 --- a/StaticAnalyser/StaticAnalyser.hpp +++ b/StaticAnalyser/StaticAnalyser.hpp @@ -124,7 +124,7 @@ struct Target { } amstradcpc; struct { - MSXCartridgeType paging_model; + MSXCartridgeType cartridge_type; } msx; };