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(),
49 return i8255.
read(port & 0x03, time);
54 return i8255.
peek(port & 0x03, time);
59 i8255.
write(port & 0x03, value, time);
65byte MSXPPI::readA(EmuTime::param time)
69byte MSXPPI::peekA(EmuTime::param )
const
79void MSXPPI::writeA(
byte value, EmuTime::param )
84byte MSXPPI::readB(EmuTime::param time)
88byte MSXPPI::peekB(EmuTime::param time)
const
90 auto row = keyboard.
getKeys()[selectedRow];
91 if (selectedRow == 8) {
92 row |= renshaTurbo.
getSignal(time) ? 1 : 0;
96void MSXPPI::writeB(
byte , EmuTime::param )
101nibble MSXPPI::readC1(EmuTime::param time)
105nibble MSXPPI::peekC1(EmuTime::param )
const
109nibble MSXPPI::readC0(EmuTime::param time)
113nibble MSXPPI::peekC0(EmuTime::param )
const
117void MSXPPI::writeC1(
nibble value, EmuTime::param time)
119 if ((prevBits ^ value) & 1) {
120 cassettePort.
setMotor((value & 1) == 0, time);
122 if ((prevBits ^ value) & 2) {
125 if ((prevBits ^ value) & 4) {
128 if ((prevBits ^ value) & 8) {
129 click.
setClick((value & 8) != 0, time);
133void MSXPPI::writeC0(
nibble value, EmuTime::param )
139template<
typename Archive>
142 ar.template serializeBase<MSXDevice>(*
this);
143 ar.serialize(
"i8255", i8255);
146 auto portC =
byte((prevBits << 4) | (selectedRow << 0));
147 ar.serialize(
"portC", portC);
148 if constexpr (Archive::IS_LOADER) {
149 selectedRow = (portC >> 0) & 0xF;
150 nibble bits = (portC >> 4) & 0xF;
153 ar.serialize(
"keyboard", keyboard);
#define REGISTER_MSXDEVICE(CLASS, NAME)
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)
std::span< const uint8_t, KeyMatrixPosition::NUM_ROWS > getKeys() const
Returns a pointer to the current KeyBoard matrix.
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.
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
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)