41 , flash(rom, AmdFlashChip::M29W640GB, {}, config)
43 , dac(
"KUC DAC",
"Konami Ultimate Collection DAC", config)
67unsigned KonamiUltimateCollection::getFlashAddr(
unsigned addr)
const
69 unsigned page8kB = (addr >> 13) - 2;
70 if (page8kB >= 4)
return unsigned(-1);
72 byte bank = bankRegs[page8kB] + offsetReg;
73 return ((mapperReg & 0xC0) << (21 - 6)) | (bank << 13) | (addr & 0x1FFF);
76bool KonamiUltimateCollection::isSCCAccess(
word addr)
const
78 if (sccMode & 0x10)
return false;
90 return (bankRegs[3] & 0x80) && (0xB800 <= addr) && (addr < 0xBFFE);
93 return ((bankRegs[2] & 0x3F) == 0x3F) && (0x9800 <= addr) && (addr < 0x9FFE);
99 if (isSCCAccess(addr)) {
100 return scc.
readMem(narrow_cast<uint8_t>(addr & 0xFF), time);
103 unsigned flashAddr = getFlashAddr(addr);
104 return (flashAddr !=
unsigned(-1))
105 ? flash.
read(flashAddr)
111 if (isSCCAccess(addr)) {
112 return scc.
peekMem(narrow_cast<uint8_t>(addr & 0xFF), time);
115 unsigned flashAddr = getFlashAddr(addr);
116 return (flashAddr !=
unsigned(-1))
117 ? flash.
peek(flashAddr)
123 if (isSCCAccess(addr))
return nullptr;
125 unsigned flashAddr = getFlashAddr(addr);
126 return (flashAddr !=
unsigned(-1))
133 unsigned page8kB = (addr >> 13) - 2;
134 if (page8kB >= 4)
return;
143 if (isSCCAccess(addr)) {
144 scc.
writeMem(narrow_cast<uint8_t>(addr & 0xFF), value, time);
149 unsigned flashAddr = getFlashAddr(addr);
152 if (isMapperRegisterEnabled()) {
153 if (addr == 0x7FFF) {
155 }
else if (addr == 0x7FFE) {
163 if (isBank0Disabled() && (addr < 0x6000) && ((addr & 0x0010) == 0)) {
167 if (areBankRegsEnabled()) {
169 if (isKonamiSCCmode()) {
171 if ((addr & 0x1800) == 0x1000) {
175 bankRegs[page8kB] = value;
180 if (isBank0Disabled() && (addr < 0x6000)) {
185 if (!((addr < 0x5000) || ((0x5800 <= addr) && (addr < 0x6000)))) {
187 bankRegs[page8kB] = value;
194 if ((addr & 0xFFFE) == 0xBFFE) {
203 if ((flashAddr !=
unsigned(-1)) && isFlashRomWriteEnabled()) {
204 flash.
write(flashAddr, value);
210 return ((0x4000 <= addr) && (addr < 0xC000))
215template<
typename Archive>
219 ar.template serializeBase<MSXDevice>(*
this);
221 ar.serialize(
"flash", flash,
224 "mapperReg", mapperReg,
225 "offsetReg", offsetReg,
227 "bankRegs", bankRegs);
#define REGISTER_MSXDEVICE(CLASS, NAME)
void write(size_t address, uint8_t value)
const uint8_t * getReadCacheLine(size_t address) const
uint8_t read(size_t address)
uint8_t peek(size_t address) const
void reset(EmuTime::param time)
void writeDAC(uint8_t value, EmuTime::param time)
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
KonamiUltimateCollection(const DeviceConfig &config, Rom &&rom)
void reset(EmuTime::param time) override
This method is called on reset.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void serialize(Archive &ar, unsigned version)
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
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 invalidateDeviceRCache()
static std::array< byte, 0x10000 > unmappedRead
static std::array< byte, 0x10000 > unmappedWrite
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
EmuTime::param getCurrentTime() const
void setMode(Mode newMode)
void powerUp(EmuTime::param time)
uint8_t readMem(uint8_t address, EmuTime::param time)
void reset(EmuTime::param time)
uint8_t peekMem(uint8_t address, EmuTime::param time) const
void writeMem(uint8_t address, uint8_t value, EmuTime::param time)
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
constexpr void iota(ForwardIt first, ForwardIt last, T value)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)