24 , debuggable(getMotherBoard(), getName())
25 , flash(rom, AmdFlashChip::S29GL064S70TFI040, {}, config)
38unsigned RomAscii16X::getFlashAddr(
word addr)
const
40 word bank = bankRegs[((addr >> 14) & 1) ^ 1];
41 return (bank << 14) | (addr & 0x3FFF);
46 return flash.
read(getFlashAddr(addr));
51 return flash.
peek(getFlashAddr(addr));
61 flash.
write(getFlashAddr(addr), value);
63 if ((addr & 0x3FFF) >= 0x2000) {
64 const word index = (addr >> 12) & 1;
65 bankRegs[index] = (addr & 0x0F00) | value;
77 const std::string& name_)
78 :
SimpleDebuggable(motherBoard_, name_ +
" regs",
"ASCII16-X bank registers", 4)
82byte RomAscii16X::Debuggable::read(
unsigned address)
84 auto& outer =
OUTER(RomAscii16X, debuggable);
85 word bank = outer.bankRegs[(address >> 1) & 1];
86 return narrow<byte>(address & 1 ? bank >> 8 : bank & 0xFF);
89void RomAscii16X::Debuggable::write(
unsigned address,
byte value,
92 auto& outer =
OUTER(RomAscii16X, debuggable);
93 word& bank = outer.bankRegs[(address >> 1) & 1];
95 bank = (bank & 0x00FF) | narrow<word>((value << 8) & 0x0F00);
97 bank = (bank & 0x0F00) | value;
100 outer.invalidateDeviceRCache();
103template<
typename Archive>
107 ar.template serializeBase<MSXDevice>(*
this);
109 ar.serialize(
"flash", flash,
110 "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 invalidateDeviceRCache()
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
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.
RomAscii16X(const DeviceConfig &config, Rom &&rom)
void reset(EmuTime::param time) override
This method is called on reset.
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.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
constexpr void iota(ForwardIt first, ForwardIt last, T value)
#define OUTER(type, member)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)