14 sram = std::make_unique<SRAM>(
getName() +
" SRAM", 0x1000, config);
15 reset(EmuTime::dummy());
21 for (
auto region :
xrange(4)) {
23 bankSelect[region] = 0;
32 if ((control & 0x04) && ((address & 0x7FF9) == 0x7FF0)) {
35 int bank = (address & 6) / 2;
36 return bankSelect[bank];
38 if ((control & 0x02) && ((address & 0x3FFF) == 0x3FFD)) {
40 return (*
sram)[sramAddr & 0x0FFF];
48 if ((control & 0x02) && ((address & 0x3FFF) == 0x3FFD)) {
66 if (address == 0x6000) {
67 bankSelect[1] = value;
70 }
else if (address == 0x6400) {
71 bankSelect[0] = value;
74 }
else if (address == 0x7000) {
75 bankSelect[2] = value;
78 }
else if (address == 0x7400) {
79 bankSelect[3] = value;
82 }
else if (address == 0x7FF9) {
85 }
else if (control & 0x02) {
87 if (address == 0x3FFA) {
89 sramAddr = (sramAddr & 0x00FFFF) | value << 16;
90 }
else if (address == 0x3FFB) {
92 sramAddr = (sramAddr & 0xFF00FF) | value << 8;
93 }
else if (address == 0x3FFC) {
95 sramAddr = (sramAddr & 0xFFFF00) | value;
96 }
else if (address == 0x3FFD) {
97 sram->write((sramAddr++ & 0x0FFF), value);
117template<
typename Archive>
120 ar.template serializeBase<Rom16kBBlocks>(*
this);
121 ar.serialize(
"control", control,
122 "sramAddr", sramAddr,
123 "bankSelect", bankSelect);
#define REGISTER_MSXDEVICE(CLASS, NAME)
void invalidateDeviceRCache()
virtual const std::string & getName() const
Returns a human-readable name for this device.
static std::array< byte, 0x10000 > unmappedWrite
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
std::unique_ptr< SRAM > sram
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
RomNational(const DeviceConfig &config, Rom &&rom)
void reset(EmuTime::param time) override
This method is called on reset.
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.
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.
void serialize(Archive &ar, unsigned version)
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
constexpr auto xrange(T e)