1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-29 00:29:34 +00:00
CLK/Machines/MSX/Cartridges/ASCII8kb.hpp

60 lines
1.5 KiB
C++
Raw Normal View History

//
// ASCII8kb.hpp
// Clock Signal
//
// Created by Thomas Harte on 04/01/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#pragma once
#include "../MemorySlotHandler.hpp"
namespace MSX::Cartridge {
2023-01-13 04:02:24 +00:00
class ASCII8kbROMSlotHandler: public MemorySlotHandler {
public:
ASCII8kbROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
switch(address >> 11) {
default:
if(pc_is_outside_bios) confidence_counter_.add_miss();
break;
case 0xc:
2018-02-12 01:32:45 +00:00
if(pc_is_outside_bios) {
if(address == 0x6000 || address == 0x60ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
}
2023-01-16 03:51:17 +00:00
slot_.map(value * 0x2000, 0x4000, 0x2000);
break;
case 0xd:
2018-02-12 01:32:45 +00:00
if(pc_is_outside_bios) {
if(address == 0x6800 || address == 0x68ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
}
2023-01-16 03:51:17 +00:00
slot_.map(value * 0x2000, 0x6000, 0x2000);
break;
case 0xe:
2018-02-12 01:32:45 +00:00
if(pc_is_outside_bios) {
if(address == 0x7000 || address == 0x70ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
}
2023-01-16 03:51:17 +00:00
slot_.map(value * 0x2000, 0x8000, 0x2000);
break;
case 0xf:
2018-02-12 01:32:45 +00:00
if(pc_is_outside_bios) {
if(address == 0x7800 || address == 0x78ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
}
2023-01-16 03:51:17 +00:00
slot_.map(value * 0x2000, 0xa000, 0x2000);
break;
}
}
virtual std::string debug_type() final {
2019-03-02 23:07:05 +00:00
return "A8";
}
private:
MSX::MemorySlot &slot_;
};
}