14 config.getMotherBoard(),
15 config.getMotherBoard().getScheduler(),
16 config.getMotherBoard().getCommandController(),
17 config.getMotherBoard().getReactor().getEventDistributor(),
18 config.getMotherBoard().getMSXEventDistributor(),
19 config.getMotherBoard().getStateChangeDistributor(),
28 port->
write(0xFB, time);
40 const int joyPort = (port >> 1) & 1;
41 const byte joyStatus = ports[joyPort]->
read(time);
42 const byte* keys = keyboard.
getKeys();
48 unsigned keypadStatus = ~(
49 keys[joyPort * 2 + 2] | (keys[joyPort * 2 + 3] << 8)
51 constexpr
byte keyEnc[] = {
52 0xF, 0xA, 0xD, 0x7, 0xC, 0x2, 0x3, 0xE, 0x5, 0x1, 0xB, 0x9, 0x6
56 | ((joyStatus << 1) & (keys[joyPort] >> 1) & 0x40);
61 | ((joyStatus >> 2) & 0x02)
62 | ((joyStatus << 1) & 0x04)
63 | ((joyStatus << 1) & 0x08)
65 | ((joyStatus << 2) & 0x40)
70 return value & (keys[joyPort] | ~0x4F);
81 joyMode = (port >> 6) & 1;
84 template<
typename Archive>
87 ar.template serializeBase<MSXDevice>(*
this);
88 ar.serialize(
"joyMode", joyMode);
89 if (ar.versionAtLeast(version, 2)) {
90 ar.serialize(
"keyboard", keyboard);
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.
ColecoJoystickIO(const DeviceConfig &config)
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 reset(EmuTime::param time) override
This method is called on reset.
virtual void write(byte value, EmuTime::param time)=0
virtual byte read(EmuTime::param time)=0
const byte * getKeys() const
Returns a pointer to the current KeyBoard matrix.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
EmuTime::param getCurrentTime() const
JoystickPortIf & getJoystickPort(unsigned port)
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
unsigned findFirstSet(uint32_t x)
Find the least significant bit that is set.
This file implemented 3 utility functions:
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)