15 , cassettePort(getMotherBoard().getCassettePort())
16 , renshaTurbo(getMotherBoard().getRenShaTurbo())
17 , i8255(*this, getCurrentTime(), config.getGlobalSettings().getInvalidPpiModeSetting())
20 config.getMotherBoard(),
21 config.getMotherBoard().getScheduler(),
22 config.getMotherBoard().getCommandController(),
23 config.getMotherBoard().getReactor().getEventDistributor(),
24 config.getMotherBoard().getMSXEventDistributor(),
25 config.getMotherBoard().getStateChangeDistributor(),
53 return i8255.
read(port & 0x03, time);
58 return i8255.
peek(port & 0x03, time);
63 i8255.
write(port & 0x03, value, time);
69byte MSXPPI::readA(EmuTime::param time)
73byte MSXPPI::peekA(EmuTime::param )
const
83void MSXPPI::writeA(
byte value, EmuTime::param )
88byte MSXPPI::readB(EmuTime::param time)
92byte MSXPPI::peekB(EmuTime::param time)
const
94 auto& keyb =
const_cast<Keyboard&
>(keyboard);
95 if (selectedRow != 8) {
96 return keyb.getKeys()[selectedRow];
98 return keyb.getKeys()[8] | (renshaTurbo.
getSignal(time) ? 1:0);
101void MSXPPI::writeB(
byte , EmuTime::param )
106nibble MSXPPI::readC1(EmuTime::param time)
110nibble MSXPPI::peekC1(EmuTime::param )
const
114nibble MSXPPI::readC0(EmuTime::param time)
118nibble MSXPPI::peekC0(EmuTime::param )
const
122void MSXPPI::writeC1(
nibble value, EmuTime::param time)
124 if ((prevBits ^ value) & 1) {
125 cassettePort.
setMotor((value & 1) == 0, time);
127 if ((prevBits ^ value) & 2) {
130 if ((prevBits ^ value) & 4) {
133 if ((prevBits ^ value) & 8) {
134 click.
setClick((value & 8) != 0, time);
138void MSXPPI::writeC0(
nibble value, EmuTime::param )
144template<
typename Archive>
147 ar.template serializeBase<MSXDevice>(*
this);
148 ar.serialize(
"i8255", i8255);
151 auto portC =
byte((prevBits << 4) | (selectedRow << 0));
152 ar.serialize(
"portC", portC);
153 if constexpr (Archive::IS_LOADER) {
154 selectedRow = (portC >> 0) & 0xF;
155 nibble bits = (portC >> 4) & 0xF;
158 ar.serialize(
"keyboard", keyboard);
virtual void cassetteOut(bool output, EmuTime::param time)=0
Writes one bit to the cassette port.
virtual void setMotor(bool status, EmuTime::param time)=0
Sets the cassette motor relay false = off true = on.
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)
void reset(EmuTime::param time)
void setClick(bool status, EmuTime::param time)
void setLed(Led led, bool status)
void setPrimarySlots(byte value)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
LedStatus & getLedStatus() const
EmuTime::param getCurrentTime() const
MSXCPUInterface & getCPUInterface() const
void powerDown(EmuTime::param time) override
This method is called when MSX is powered down.
void reset(EmuTime::param time) override
This method is called on reset.
const Keyboard & getKeyboard() const
MSXPPI(const DeviceConfig &config)
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void serialize(Archive &ar, unsigned version)
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
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.
bool getSignal(EmuTime::param time)
Get the output signal in negative logic.
This file implemented 3 utility functions:
uint8_t byte
8 bit unsigned integer
uint8_t nibble
4 bit integer
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)