23 , biosRom(
getName(),
"BIOS ROM", config)
26 throw MSXException(
"ColecoVision BIOS ROM must be exactly 8kB in size.");
45 static constexpr
unsigned translateMainRamAddress(
unsigned address)
53 ramAtBiosEnabled =
false;
61 if ((port & 0xFF) == 0x52) {
69 if ((port & 0xFF) == 0x52) {
77 switch (port & 0xFF) {
79 psgLatch = value & 0x0F;
85 ramEnabled = (value & 1) != 0;
89 ramAtBiosEnabled = (value & 2) == 0;
101 return ramAtBiosEnabled ? sgmRam.
peek(address) : biosRom[address];
104 return sgmRam.
peek(address);
106 return mainRam.
peek(translateMainRamAddress(address));
115 return ramAtBiosEnabled ? sgmRam.
read(address) : biosRom[address];
118 return sgmRam.
read(address);
120 return mainRam.
read(translateMainRamAddress(address));
129 if (ramAtBiosEnabled) {
130 sgmRam.
write(address, value);
134 sgmRam.
write(address, value);
136 mainRam.
write(translateMainRamAddress(address), value);
158 if (ramAtBiosEnabled) {
171 template<
typename Archive>
177 "psgLatch", psgLatch,
178 "ramEnabled", ramEnabled,
179 "ramAtBiosEnabled", ramAtBiosEnabled);
void reset(EmuTime::param time)
byte readRegister(unsigned reg, EmuTime::param time)
byte peekRegister(unsigned reg, EmuTime::param time) const
void writeRegister(unsigned reg, byte value, EmuTime::param time)
const byte * getReadCacheLine(unsigned addr) const
Ram & getUncheckedRam()
Give access to the unchecked Ram.
void write(unsigned addr, byte value)
byte * getWriteCacheLine(unsigned addr) const
byte peek(unsigned addr) const
~ColecoSuperGameModule() override
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
void serialize(Archive &ar, unsigned version)
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
ColecoSuperGameModule(const DeviceConfig &config)
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 peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
byte * getWriteCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void reset(EmuTime::param time) override
This method is called on reset.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
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 register_IO_Out(byte port, MSXDevice *device)
Devices can register their Out ports.
void register_IO_In(byte port, MSXDevice *device)
Devices can register their In ports.
void unregister_IO_In(byte port, MSXDevice *device)
void unregister_IO_Out(byte port, MSXDevice *device)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
static byte unmappedRead[0x10000]
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
EmuTime::param getCurrentTime() const
static byte unmappedWrite[0x10000]
MSXCPUInterface & getCPUInterface() const
std::string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
constexpr unsigned SGM_RAM_SIZE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
constexpr unsigned MAIN_RAM_SIZE
constexpr unsigned BIOS_ROM_SIZE
uint16_t word
16 bit unsigned integer
constexpr unsigned MAIN_RAM_AREA_START
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)