1 #ifndef MEGAFLASHROMSCCPLUSSD_HH
2 #define MEGAFLASHROMSCCPLUSSD_HH
22 void powerUp(EmuTime::param time)
override;
23 void reset(EmuTime::param time)
override;
24 [[nodiscard]]
byte peekMem(
word address, EmuTime::param time)
const override;
25 [[nodiscard]]
byte readMem(
word address, EmuTime::param time)
override;
27 void writeMem(
word address,
byte value, EmuTime::param time)
override;
30 void writeIO(
word port,
byte value, EmuTime::param time)
override;
32 template<
typename Archive>
33 void serialize(Archive& ar,
unsigned version);
36 enum SCCEnable { EN_NONE, EN_SCC, EN_SCCPLUS };
37 [[nodiscard]] SCCEnable getSCCEnable()
const;
38 void updateConfigReg(
byte value);
40 [[nodiscard]]
byte getSubSlot(
unsigned addr)
const;
45 void writeToFlash(
unsigned addr,
byte value);
50 [[nodiscard]]
byte readMemSubSlot0(
word address);
51 [[nodiscard]]
byte peekMemSubSlot0(
word address)
const;
52 [[nodiscard]]
const byte* getReadCacheLineSubSlot0(
word address)
const;
53 [[nodiscard]]
byte* getWriteCacheLineSubSlot0(
word address)
const;
54 void writeMemSubSlot0(
word address,
byte value);
58 [[nodiscard]]
byte readMemSubSlot1(
word address, EmuTime::param time);
59 [[nodiscard]]
byte peekMemSubSlot1(
word address, EmuTime::param time)
const;
60 [[nodiscard]]
const byte* getReadCacheLineSubSlot1(
word address)
const;
61 [[nodiscard]]
byte* getWriteCacheLineSubSlot1(
word address)
const;
62 void writeMemSubSlot1(
word address,
byte value, EmuTime::param time);
63 [[nodiscard]]
unsigned getFlashAddrSubSlot1(
unsigned addr)
const;
69 [[nodiscard]]
bool is64KmapperConfigured()
const {
return (mapperReg & 0xC0) == 0x40; }
70 [[nodiscard]]
bool isKonamiSCCmapperConfigured()
const {
return (mapperReg & 0xE0) == 0x00; }
71 [[nodiscard]]
bool isWritingKonamiBankRegisterDisabled()
const {
return (mapperReg & 0x08) != 0; }
72 [[nodiscard]]
bool isMapperRegisterDisabled()
const {
return (mapperReg & 0x04) != 0; }
73 [[nodiscard]]
bool areBankRegsAndOffsetRegsDisabled()
const {
return (mapperReg & 0x02) != 0; }
74 [[nodiscard]]
bool areKonamiMapperLimitsEnabled()
const {
return (mapperReg & 0x01) != 0; }
78 [[nodiscard]]
bool isConfigRegDisabled()
const {
return (configReg & 0x80) != 0; }
79 [[nodiscard]]
bool isMemoryMapperEnabled()
const {
return ((configReg & 0x20) == 0) && checkedRam; }
80 [[nodiscard]]
bool isDSKmodeEnabled()
const {
return (configReg & 0x10) != 0; }
81 [[nodiscard]]
bool isPSGalsoMappedToNormalPorts()
const {
return (configReg & 0x08) != 0; }
82 [[nodiscard]]
bool isSlotExpanderEnabled()
const {
return (configReg & 0x04) == 0; }
83 [[nodiscard]]
bool isFlashRomBlockProtectEnabled()
const {
return (configReg & 0x02) != 0; }
84 [[nodiscard]]
bool isFlashRomWriteEnabled()
const {
return (configReg & 0x01) != 0; }
86 byte bankRegsSubSlot1[4];
93 [[nodiscard]]
byte readMemSubSlot2(
word address);
94 [[nodiscard]]
byte peekMemSubSlot2(
word address)
const;
95 [[nodiscard]]
const byte* getReadCacheLineSubSlot2(
word address)
const;
96 [[nodiscard]]
byte* getWriteCacheLineSubSlot2(
word address)
const;
97 void writeMemSubSlot2(
word address,
byte value);
99 [[nodiscard]]
unsigned calcMemMapperAddress(
word address)
const;
100 [[nodiscard]]
unsigned calcAddress(
word address)
const;
110 [[nodiscard]]
byte readIO(
word port, EmuTime::param time)
override;
111 [[nodiscard]]
byte peekIO(
word port, EmuTime::param time)
const override;
112 void writeIO(
word port,
byte value, EmuTime::param time)
override;
113 [[nodiscard]]
byte getSelectedSegment(
byte page)
const override;
118 const std::unique_ptr<CheckedRam> checkedRam;
119 const std::unique_ptr<MapperIO> mapperIO;
120 byte memMapperRegs[4];
123 [[nodiscard]]
byte readMemSubSlot3(
word address, EmuTime::param time);
124 [[nodiscard]]
byte peekMemSubSlot3(
word address, EmuTime::param time)
const;
125 [[nodiscard]]
const byte* getReadCacheLineSubSlot3(
word address)
const;
126 [[nodiscard]]
byte* getWriteCacheLineSubSlot3(
word address)
const;
127 void writeMemSubSlot3(
word address,
byte value, EmuTime::param time);
128 [[nodiscard]]
unsigned getFlashAddrSubSlot3(
unsigned addr)
const;
130 byte bankRegsSubSlot3[4];
133 std::unique_ptr<SdCard> sdCard[2];
This class implements the AY-3-8910 sound chip.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
virtual byte peekIO(word port, EmuTime::param time) const
Read a byte from a given IO port.
virtual byte readIO(word port, EmuTime::param time)
Read a byte from an IO port at a certain time from this device.
void serialize(Archive &ar, unsigned version)
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
void reset(EmuTime::param time) override
This method is called on reset.
MegaFlashRomSCCPlusSD(const DeviceConfig &config)
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
~MegaFlashRomSCCPlusSD() override
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer