20 , rom(getName() +
" ROM",
"rom", config)
21 , sram(getName() +
" SRAM", 0x2000, config)
23 if (rom.
size() != 0x10000) {
26 reset(EmuTime::dummy());
37 if (address == 0x7FC0) {
42 if (
byte newBank = value & 0b111; bank != newBank) {
48 }
else if (address == 0x7F00) {
59 }
else if (address == 0x7F40) {
61 selectedNCUreg = value;
63 }
else if ((0x6000 <= address) && (address < 0x8000)) {
64 sram.
write(address & 0x1FFF, value);
73 if ((0x6000 <= address) && (address < 0x8000)) {
86 if (address == 0x7FC0) {
91 }
else if (address == 0x7F00) {
111 static constexpr std::array<byte, 4> ncuRegsRead = {0x00, 0x08, 0x00, 0x00};
113 return ncuRegsRead[selectedNCUreg & 0b11];
114 }
else if ((0x4000 <= address) && (address < 0x6000)) {
115 return rom[bank * 0x2000 + (address & 0x1FFF)];
116 }
else if ((0x6000 <= address) && (address < 0x8000)) {
117 return sram[address & 0x1FFF];
127 if ((0x4000 <= address) && (address < 0x6000)) {
128 return &rom[bank * 0x2000 + (address & 0x1FFF)];
130 if ((0x6000 <= address) && (address < 0x8000)) {
131 return &sram[address & 0x1FFF];
136template<
typename Archive>
139 ar.template serializeBase<MSXDevice>(*
this);
140 ar.serialize(
"SRAM", sram,
142 "selectedNCUreg", selectedNCUreg);
#define REGISTER_MSXDEVICE(CLASS, NAME)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
void invalidateDeviceRCache()
static std::array< byte, 0x10000 > unmappedRead
static std::array< byte, 0x10000 > unmappedWrite
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
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.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
MSXModem(const DeviceConfig &config)
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
void write(size_t addr, byte value)
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)