openMSX
I8255.hh
Go to the documentation of this file.
1 // This class implements the Intel 8255 chip
2 //
3 // * Only the 8255 is emulated, no surrounding hardware.
4 // Use the class I8255Interface to do that.
5 // * Only mode 0 (basic input/output) is implemented
6 
7 #ifndef I8255_HH
8 #define I8255_HH
9 
10 #include "EmuTime.hh"
11 #include "TclCallback.hh"
12 #include "openmsx.hh"
13 
14 namespace openmsx {
15 
16 class I8255Interface;
17 class StringSetting;
18 
19 class I8255
20 {
21 public:
22  I8255(I8255Interface& interf, EmuTime::param time,
23  StringSetting& invalidPpiModeSetting);
24 
25  void reset(EmuTime::param time);
26 
27  [[nodiscard]] byte read(byte port, EmuTime::param time);
28  [[nodiscard]] byte peek(byte port, EmuTime::param time) const;
29  void write(byte port, byte value, EmuTime::param time);
30 
31  template<typename Archive>
32  void serialize(Archive& ar, unsigned version);
33 
34 private:
35  [[nodiscard]] byte readPortA(EmuTime::param time);
36  [[nodiscard]] byte readPortB(EmuTime::param time);
37  [[nodiscard]] byte readPortC(EmuTime::param time);
38  [[nodiscard]] byte readControlPort(EmuTime::param time) const;
39  [[nodiscard]] byte peekPortA(EmuTime::param time) const;
40  [[nodiscard]] byte peekPortB(EmuTime::param time) const;
41  [[nodiscard]] byte peekPortC(EmuTime::param time) const;
42  void writePortA(byte value, EmuTime::param time);
43  void writePortB(byte value, EmuTime::param time);
44  void writePortC(byte value, EmuTime::param time);
45  void writeControlPort(byte value, EmuTime::param time);
46 
47  [[nodiscard]] byte readC0(EmuTime::param time);
48  [[nodiscard]] byte readC1(EmuTime::param time);
49  [[nodiscard]] byte peekC0(EmuTime::param time) const;
50  [[nodiscard]] byte peekC1(EmuTime::param time) const;
51  void outputPortA(byte value, EmuTime::param time);
52  void outputPortB(byte value, EmuTime::param time);
53  void outputPortC(byte value, EmuTime::param time);
54 
55 private:
56  I8255Interface& interface;
57 
58  byte control;
59  byte latchPortA;
60  byte latchPortB;
61  byte latchPortC;
62 
63  TclCallback ppiModeCallback;
64 };
65 
66 } // namespace openmsx
67 
68 #endif
void reset(EmuTime::param time)
Definition: I8255.cc:33
I8255(I8255Interface &interf, EmuTime::param time, StringSetting &invalidPpiModeSetting)
Definition: I8255.cc:25
byte peek(byte port, EmuTime::param time) const
Definition: I8255.cc:59
byte read(byte port, EmuTime::param time)
Definition: I8255.cc:42
void serialize(Archive &ar, unsigned version)
Definition: I8255.cc:360
void write(byte port, byte value, EmuTime::param time)
Definition: I8255.cc:76
This file implemented 3 utility functions:
Definition: Autofire.cc:9