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
14namespace openmsx {
15
16class I8255Interface;
17class StringSetting;
18
19class I8255
20{
21public:
22 I8255(I8255Interface& interface, EmuTime::param time,
23 StringSetting& invalidPpiModeSetting);
24
25 // CPU side
26 void reset(EmuTime::param time);
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 // Peripheral side, pull-interface
32 // (the I8255Interface class implements the push-interface)
33 byte getPortA() const;
34 byte getPortB() const;
35 byte getPortC() const;
36
37 template<typename Archive>
38 void serialize(Archive& ar, unsigned version);
39
40private:
41 [[nodiscard]] byte readPortA(EmuTime::param time);
42 [[nodiscard]] byte readPortB(EmuTime::param time);
43 [[nodiscard]] byte readPortC(EmuTime::param time);
44 [[nodiscard]] byte readControlPort(EmuTime::param time) const;
45 [[nodiscard]] byte peekPortA(EmuTime::param time) const;
46 [[nodiscard]] byte peekPortB(EmuTime::param time) const;
47 [[nodiscard]] byte peekPortC(EmuTime::param time) const;
48 void writePortA(byte value, EmuTime::param time);
49 void writePortB(byte value, EmuTime::param time);
50 void writePortC(byte value, EmuTime::param time);
51 void writeControlPort(byte value, EmuTime::param time);
52
53 [[nodiscard]] byte readC0(EmuTime::param time);
54 [[nodiscard]] byte readC1(EmuTime::param time);
55 [[nodiscard]] byte peekC0(EmuTime::param time) const;
56 [[nodiscard]] byte peekC1(EmuTime::param time) const;
57 void outputPortA(byte value, EmuTime::param time);
58 void outputPortB(byte value, EmuTime::param time);
59 void outputPortC(byte value, EmuTime::param time);
60
61private:
62 I8255Interface& interface;
63
64 byte control;
65 byte latchPortA;
66 byte latchPortB;
67 byte latchPortC;
68
69 TclCallback ppiModeCallback;
70};
71
72} // namespace openmsx
73
74#endif
void reset(EmuTime::param time)
Definition I8255.cc:33
byte getPortA() const
Definition I8255.cc:363
byte getPortC() const
Definition I8255.cc:383
byte getPortB() const
Definition I8255.cc:373
byte peek(byte port, EmuTime::param time) const
Definition I8255.cc:58
byte read(byte port, EmuTime::param time)
Definition I8255.cc:42
void serialize(Archive &ar, unsigned version)
Definition I8255.cc:398
void write(byte port, byte value, EmuTime::param time)
Definition I8255.cc:74
This file implemented 3 utility functions:
Definition Autofire.cc:11