2018-01-04 22:18:18 -05:00
|
|
|
//
|
|
|
|
// Konami.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 04/01/2018.
|
2018-05-13 15:19:52 -04:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-01-04 22:18:18 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Konami_hpp
|
|
|
|
#define Konami_hpp
|
|
|
|
|
2023-01-12 23:01:11 -05:00
|
|
|
#include "../MemorySlotHandler.hpp"
|
2018-01-04 22:18:18 -05:00
|
|
|
|
|
|
|
namespace MSX {
|
|
|
|
namespace Cartridge {
|
|
|
|
|
2023-01-12 23:02:24 -05:00
|
|
|
class KonamiROMSlotHandler: public MemorySlotHandler {
|
2018-01-04 22:18:18 -05:00
|
|
|
public:
|
2023-01-12 23:01:11 -05:00
|
|
|
KonamiROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
|
2018-01-04 22:18:18 -05:00
|
|
|
|
2020-01-23 22:57:51 -05:00
|
|
|
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
|
2018-01-04 22:18:18 -05:00
|
|
|
switch(address >> 13) {
|
2018-01-22 21:50:56 -05:00
|
|
|
default:
|
2018-02-10 17:11:16 -05:00
|
|
|
if(pc_is_outside_bios) confidence_counter_.add_miss();
|
2018-01-22 21:50:56 -05:00
|
|
|
break;
|
2018-01-04 22:18:18 -05:00
|
|
|
case 3:
|
2018-02-11 20:32:45 -05:00
|
|
|
if(pc_is_outside_bios) {
|
|
|
|
if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
|
|
|
}
|
2023-01-15 22:51:17 -05:00
|
|
|
slot_.map(value * 0x2000, 0x6000, 0x2000);
|
2018-01-04 22:18:18 -05:00
|
|
|
break;
|
|
|
|
case 4:
|
2018-02-11 20:32:45 -05:00
|
|
|
if(pc_is_outside_bios) {
|
|
|
|
if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
|
|
|
}
|
2023-01-15 22:51:17 -05:00
|
|
|
slot_.map(value * 0x2000, 0x8000, 0x2000);
|
2018-01-04 22:18:18 -05:00
|
|
|
break;
|
|
|
|
case 5:
|
2018-02-11 20:32:45 -05:00
|
|
|
if(pc_is_outside_bios) {
|
|
|
|
if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
|
|
|
}
|
2023-01-15 22:51:17 -05:00
|
|
|
slot_.map(value * 0x2000, 0xa000, 0x2000);
|
2018-01-04 22:18:18 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-23 22:57:51 -05:00
|
|
|
virtual std::string debug_type() final {
|
2019-03-02 18:07:05 -05:00
|
|
|
return "K";
|
2018-02-01 07:53:52 -05:00
|
|
|
}
|
2018-01-04 22:18:18 -05:00
|
|
|
private:
|
2023-01-12 23:01:11 -05:00
|
|
|
MSX::MemorySlot &slot_;
|
2018-01-04 22:18:18 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Konami_hpp */
|