16 , rom(
getName() +
" ROM",
"rom", config)
17 , flashConfig(rom.getSize() / 0x10000, {0x10000,
false})
18 , flash(rom, flashConfig, 0x01A4,
23 nowindsInUse = getMotherBoard().getSharedStuff<NowindsInUse>(
"nowindsInUse");
26 while ((*nowindsInUse)[i]) {
27 if (++i == MAX_NOWINDS) {
31 (*nowindsInUse)[i] =
true;
32 basename[6] = char(
'a' + i);
34 command.emplace(basename, getCommandController(), *
this);
37 auto drive = command->createDiskChanger(basename, 0, getMotherBoard());
38 drive->createCommand();
39 drives.push_back(std::move(drive));
41 reset(EmuTime::dummy());
46 unsigned i = basename[6] -
'a';
47 assert((*nowindsInUse)[i]);
48 (*nowindsInUse)[i] =
false;
63 if (((0x2000 <= address) && (address < 0x4000)) ||
64 ((0x8000 <= address) && (address < 0xA000))) {
66 }
else if ((0x4000 <= address) && (address < 0xC000)) {
68 return flash.
peek(bank * 0x4000 + (address & 0x3FFF));
76 if (((0x2000 <= address) && (address < 0x4000)) ||
77 ((0x8000 <= address) && (address < 0xA000))) {
79 }
else if ((0x4000 <= address) && (address < 0xC000)) {
81 return flash.
read(bank * 0x4000 + (address & 0x3FFF));
89 if (((0x2000 <= address) && (address < 0x4000)) ||
90 ((0x8000 <= address) && (address < 0xA000))) {
93 }
else if ((0x4000 <= address) && (address < 0xC000)) {
103 if (address < 0x4000) {
104 flash.
write(bank * 0x4000 + address, value);
105 }
else if (((0x4000 <= address) && (address < 0x6000)) ||
106 ((0x8000 <= address) && (address < 0xA000))) {
108 host.
write(value, clock.getTicksTill(time));
109 }
else if (((0x6000 <= address) && (address < 0x8000)) ||
110 ((0xA000 <= address) && (address < 0xC000))) {
112 bank = (value <
max) ? value : value & (
max - 1);
120 if (address < 0xC000) {
129 template<
typename Archive>
132 ar.template serializeBase<MSXDevice>(*
this);
133 ar.serialize(
"flash", flash);
135 ar.serialize(
"nowindhost", host,
void write(unsigned address, byte value)
byte peek(unsigned address) const
byte read(unsigned address) const
const byte * getReadCacheLine(unsigned address) const
Represents a clock with a fixed frequency.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
void invalidateDeviceRCache()
static byte unmappedRead[0x10000]
static byte unmappedWrite[0x10000]
void write(byte data, unsigned time)
~NowindInterface() override
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) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
void reset(EmuTime::param time) override
This method is called on reset.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
NowindInterface(const DeviceConfig &config)
void serialize(Archive &ar, unsigned version)
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.
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
std::string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)