openMSX
SVIPPI.hh
Go to the documentation of this file.
1 // This class implements the mapping of the PPI (8255) into the SVI machine.
2 
3 #ifndef SVIPPI_HH
4 #define SVIPPI_HH
5 
6 #include "MSXDevice.hh"
7 #include "I8255Interface.hh"
8 #include "I8255.hh"
9 #include "Keyboard.hh"
10 #include "KeyClick.hh"
11 
12 namespace openmsx {
13 
14 class CassettePortInterface;
15 class JoystickPortIf;
16 
17 class SVIPPI final : public MSXDevice, public I8255Interface
18 {
19 public:
20  SVIPPI(const DeviceConfig& config);
21 
22  void reset(EmuTime::param time) override;
23  [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
24  [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
25  void writeIO(word port, byte value, EmuTime::param time) override;
26 
27  template<typename Archive>
28  void serialize(Archive& ar, unsigned version);
29 
30 private:
31  // I8255Interface
32  [[nodiscard]] byte readA(EmuTime::param time) override;
33  [[nodiscard]] byte readB(EmuTime::param time) override;
34  [[nodiscard]] nibble readC0(EmuTime::param time) override;
35  [[nodiscard]] nibble readC1(EmuTime::param time) override;
36  [[nodiscard]] byte peekA(EmuTime::param time) const override;
37  [[nodiscard]] byte peekB(EmuTime::param time) const override;
38  [[nodiscard]] nibble peekC0(EmuTime::param time) const override;
39  [[nodiscard]] nibble peekC1(EmuTime::param time) const override;
40  void writeA(byte value, EmuTime::param time) override;
41  void writeB(byte value, EmuTime::param time) override;
42  void writeC0(nibble value, EmuTime::param time) override;
43  void writeC1(nibble value, EmuTime::param time) override;
44 
45 private:
46  CassettePortInterface& cassettePort;
47  I8255 i8255;
48  KeyClick click;
49  Keyboard keyboard;
50  JoystickPortIf* ports[2];
51  nibble prevBits;
52  nibble selectedRow;
53 };
54 
55 } // namespace openmsx
56 
57 #endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
void reset(EmuTime::param time) override
This method is called on reset.
Definition: SVIPPI.cc:95
void serialize(Archive &ar, unsigned version)
Definition: SVIPPI.cc:190
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.
Definition: SVIPPI.cc:111
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: SVIPPI.cc:101
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: SVIPPI.cc:106
SVIPPI(const DeviceConfig &config)
Definition: SVIPPI.cc:69
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint8_t nibble
4 bit integer
Definition: openmsx.hh:23
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29