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