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 "openmsx.hh"
12 
13 namespace openmsx {
14 
15 class I8255Interface;
16 class CliComm;
17 
18 class I8255
19 {
20 public:
21  I8255(I8255Interface& interf, EmuTime::param time,
22  CliComm& cliComm);
23 
24  void reset(EmuTime::param time);
25 
26  byte read(byte port, EmuTime::param time);
27  byte peek(byte port, EmuTime::param time) const;
28  void write(byte port, byte value, EmuTime::param time);
29 
30  template<typename Archive>
31  void serialize(Archive& ar, unsigned version);
32 
33 private:
34  byte readPortA(EmuTime::param time);
35  byte readPortB(EmuTime::param time);
36  byte readPortC(EmuTime::param time);
37  byte readControlPort(EmuTime::param time) const;
38  byte peekPortA(EmuTime::param time) const;
39  byte peekPortB(EmuTime::param time) const;
40  byte peekPortC(EmuTime::param time) const;
41  void writePortA(byte value, EmuTime::param time);
42  void writePortB(byte value, EmuTime::param time);
43  void writePortC(byte value, EmuTime::param time);
44  void writeControlPort(byte value, EmuTime::param time);
45 
46  byte readC0(EmuTime::param time);
47  byte readC1(EmuTime::param time);
48  byte peekC0(EmuTime::param time) const;
49  byte peekC1(EmuTime::param time) const;
50  void outputPortA(byte value, EmuTime::param time);
51  void outputPortB(byte value, EmuTime::param time);
52  void outputPortC(byte value, EmuTime::param time);
53 
54  I8255Interface& interface;
55  CliComm& cliComm;
56 
57  byte control;
58  byte latchPortA;
59  byte latchPortB;
60  byte latchPortC;
61 
62  bool warningPrinted;
63 };
64 
65 } // namespace openmsx
66 
67 #endif
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
I8255(I8255Interface &interf, EmuTime::param time, CliComm &cliComm)
Definition: I8255.cc:26
byte peek(byte port, EmuTime::param time) const
Definition: I8255.cc:60
void serialize(Archive &ar, unsigned version)
Definition: I8255.cc:364
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
byte read(byte port, EmuTime::param time)
Definition: I8255.cc:43
void reset(EmuTime::param time)
Definition: I8255.cc:34
void write(byte port, byte value, EmuTime::param time)
Definition: I8255.cc:77