11 , i8255(*this, getCurrentTime(), config.getGlobalSettings().getInvalidPpiModeSetting())
12 , rom(
getName() +
" ROM",
"rom", config)
32 if (0x4000 <= address && address < 0x8000) {
33 return rom[address & 0x3FFF];
40 if (0x4000 <= start && start < 0x8000) {
41 return &rom[start & 0x3FFF];
48 return i8255.
read(port & 0x03, time);
53 return i8255.
peek(port & 0x03, time);
58 i8255.
write(port & 0x03, value, time);
63 byte BeerIDE::readA(EmuTime::param time)
67 byte BeerIDE::peekA(EmuTime::param )
const
69 return (dataReg & 0xFF);
71 void BeerIDE::writeA(
byte value, EmuTime::param )
77 byte BeerIDE::readB(EmuTime::param time)
81 byte BeerIDE::peekB(EmuTime::param )
const
83 return (dataReg >> 8);
85 void BeerIDE::writeB(
byte value, EmuTime::param )
88 dataReg |= (value << 8);
91 nibble BeerIDE::readC1(EmuTime::param time)
95 nibble BeerIDE::peekC1(EmuTime::param )
const
99 nibble BeerIDE::readC0(EmuTime::param time)
103 nibble BeerIDE::peekC0(EmuTime::param )
const
107 void BeerIDE::writeC1(
nibble value, EmuTime::param time)
109 changeControl((controlReg & 0x0F) | (value << 4), time);
111 void BeerIDE::writeC0(
nibble value, EmuTime::param time)
113 changeControl((controlReg & 0xF0) | value, time);
115 void BeerIDE::changeControl(
byte value, EmuTime::param time)
117 byte diff = controlReg ^ value;
119 if ((diff & 0xE7) == 0)
return;
121 byte address = controlReg & 7;
122 switch (value & 0xE0) {
125 dataReg = device->readData(time);
127 dataReg = device->readReg(address, time);
132 device->writeData(dataReg, time);
134 device->writeReg(address, dataReg & 0xFF, time);
142 template<
typename Archive>
145 ar.template serializeBase<MSXDevice>(*
this);
146 ar.serialize(
"i8255", i8255);
147 ar.serializePolymorphic(
"device", *device);
148 ar.serialize(
"dataReg", dataReg,
149 "controlReg", controlReg);
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
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 readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void reset(EmuTime::param time) override
This method is called on reset.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
BeerIDE(const DeviceConfig &config)
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)
const XMLElement * findChild(std::string_view name) const
void reset(EmuTime::param time)
byte peek(byte port, EmuTime::param time) const
byte read(byte port, EmuTime::param time)
void write(byte port, byte value, EmuTime::param time)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
virtual void powerUp(EmuTime::param time)
This method is called when MSX is powered up.
static byte unmappedRead[0x10000]
EmuTime::param getCurrentTime() const
std::unique_ptr< IDEDevice > create(const DeviceConfig &config)
std::string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
uint8_t nibble
4 bit integer
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)