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 row = keyboard.
getKeys()[selectedRow];
95 if (selectedRow == 8) {
96 row |= renshaTurbo.
getSignal(time) ? 1 : 0;
100void MSXPPI::writeB(
byte , EmuTime::param )
105nibble MSXPPI::readC1(EmuTime::param time)
109nibble MSXPPI::peekC1(EmuTime::param )
const
113nibble MSXPPI::readC0(EmuTime::param time)
117nibble MSXPPI::peekC0(EmuTime::param )
const
121void MSXPPI::writeC1(
nibble value, EmuTime::param time)
123 if ((prevBits ^ value) & 1) {
124 cassettePort.
setMotor((value & 1) == 0, time);
126 if ((prevBits ^ value) & 2) {
129 if ((prevBits ^ value) & 4) {
132 if ((prevBits ^ value) & 8) {
133 click.
setClick((value & 8) != 0, time);
137void MSXPPI::writeC0(
nibble value, EmuTime::param )
143template<
typename Archive>
146 ar.template serializeBase<MSXDevice>(*
this);
147 ar.serialize(
"i8255", i8255);
150 auto portC =
byte((prevBits << 4) | (selectedRow << 0));
151 ar.serialize(
"portC", portC);
152 if constexpr (Archive::IS_LOADER) {
153 selectedRow = (portC >> 0) & 0xF;
154 nibble bits = (portC >> 4) & 0xF;
157 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.
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
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)