openMSX
MSXDeviceSwitch.hh
Go to the documentation of this file.
1#ifndef MSXDEVICESWITCH_HH
2#define MSXDEVICESWITCH_HH
3
4#include "MSXDevice.hh"
5
6namespace openmsx {
7
53class MSXSwitchedDevice;
54
55class MSXDeviceSwitch final : public MSXDevice
56{
57public:
58 explicit MSXDeviceSwitch(const DeviceConfig& config);
59 ~MSXDeviceSwitch() override;
60
61 // (un)register methods for devices
62 void registerDevice(byte id, MSXSwitchedDevice* device);
63 void unregisterDevice(byte id);
64 [[nodiscard]] bool hasRegisteredDevices() const { return count != 0; }
65
66 void reset(EmuTime::param time) override;
67 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
68 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
69 void writeIO(word port, byte value, EmuTime::param time) override;
70
71 template<typename Archive>
72 void serialize(Archive& ar, unsigned version);
73
74private:
75 MSXSwitchedDevice* devices[256];
76 unsigned count;
77 byte selected;
78};
79
80} // namespace openmsx
81
82#endif
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 peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void unregisterDevice(byte id)
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.
MSXDeviceSwitch(const DeviceConfig &config)
bool hasRegisteredDevices() const
void registerDevice(byte id, MSXSwitchedDevice *device)
void serialize(Archive &ar, unsigned version)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29