12 , i8255(*this, getCurrentTime(), config.getGlobalSettings().getInvalidPpiModeSetting())
13 , rom(getName() +
" ROM",
"rom", config)
33 if (0x4000 <= address && address < 0x8000) {
34 return rom[address & 0x3FFF];
41 if (0x4000 <= start && start < 0x8000) {
42 return &rom[start & 0x3FFF];
49 return i8255.
read(port & 0x03, time);
54 return i8255.
peek(port & 0x03, time);
59 i8255.
write(port & 0x03, value, time);
64byte BeerIDE::readA(EmuTime::param time)
68byte BeerIDE::peekA(EmuTime::param )
const
70 return narrow_cast<byte>(dataReg & 0xFF);
72void BeerIDE::writeA(
byte value, EmuTime::param )
78byte BeerIDE::readB(EmuTime::param time)
82byte BeerIDE::peekB(EmuTime::param )
const
84 return narrow_cast<byte>(dataReg >> 8);
86void BeerIDE::writeB(
byte value, EmuTime::param )
89 dataReg |= (value << 8);
92nibble BeerIDE::readC1(EmuTime::param time)
96nibble BeerIDE::peekC1(EmuTime::param )
const
100nibble BeerIDE::readC0(EmuTime::param time)
104nibble BeerIDE::peekC0(EmuTime::param )
const
108void BeerIDE::writeC1(
nibble value, EmuTime::param time)
110 changeControl(
byte((controlReg & 0x0F) | (value << 4)), time);
112void BeerIDE::writeC0(
nibble value, EmuTime::param time)
114 changeControl((controlReg & 0xF0) | value, time);
116void BeerIDE::changeControl(
byte value, EmuTime::param time)
118 byte diff = controlReg ^ value;
120 if ((diff & 0xE7) == 0)
return;
122 byte address = controlReg & 7;
123 switch (value & 0xE0) {
126 dataReg = device->readData(time);
128 dataReg = device->readReg(address, time);
133 device->writeData(dataReg, time);
135 device->writeReg(address, narrow_cast<byte>(dataReg & 0xFF), time);
143template<
typename Archive>
146 ar.template serializeBase<MSXDevice>(*
this);
147 ar.serialize(
"i8255", i8255);
148 ar.serializePolymorphic(
"device", *device);
149 ar.serialize(
"dataReg", dataReg,
150 "controlReg", controlReg);
#define REGISTER_MSXDEVICE(CLASS, NAME)
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 std::array< byte, 0x10000 > unmappedRead
EmuTime::param getCurrentTime() const
std::unique_ptr< IDEDevice > create(const DeviceConfig &config)
This file implemented 3 utility functions:
uint8_t nibble
4 bit integer
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)