openMSX
I8254.hh
Go to the documentation of this file.
1 // This class implements the Intel 8254 chip (and 8253)
2 //
3 // * Only the 8254 is emulated, no surrounding hardware.
4 // Use the class I8254Interface to do that.
5 
6 #ifndef I8254_HH
7 #define I8254_HH
8 
9 #include "EmuTime.hh"
10 #include "openmsx.hh"
11 #include <memory>
12 
13 namespace openmsx {
14 
15 class Scheduler;
16 class Counter;
17 class ClockPin;
18 class ClockPinListener;
19 
20 class I8254
21 {
22 public:
23  I8254(Scheduler& scheduler, ClockPinListener* output0,
24  ClockPinListener* output1, ClockPinListener* output2,
25  EmuTime::param time);
26  ~I8254();
27 
28  void reset(EmuTime::param time);
29  byte readIO(word port, EmuTime::param time);
30  byte peekIO(word port, EmuTime::param time) const;
31  void writeIO(word port, byte value, EmuTime::param time);
32 
33  void setGate(unsigned counter, bool status, EmuTime::param time);
34  ClockPin& getClockPin(unsigned cntr);
35  ClockPin& getOutputPin(unsigned cntr);
36 
37  template<typename Archive>
38  void serialize(Archive& ar, unsigned version);
39 
40 private:
41  void readBackHelper(byte value, unsigned cntr, EmuTime::param time);
42 
43  std::unique_ptr<Counter> counter[3];
44 };
45 
46 } // namespace openmsx
47 
48 #endif
byte readIO(word port, EmuTime::param time)
Definition: I8254.cc:95
ClockPin & getOutputPin(unsigned cntr)
Definition: I8254.cc:175
void setGate(unsigned counter, bool status, EmuTime::param time)
Definition: I8254.cc:163
byte peekIO(word port, EmuTime::param time) const
Definition: I8254.cc:108
void reset(EmuTime::param time)
Definition: I8254.cc:88
void writeIO(word port, byte value, EmuTime::param time)
Definition: I8254.cc:121
void serialize(Archive &ar, unsigned version)
Definition: I8254.cc:540
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:25
ClockPin & getClockPin(unsigned cntr)
Definition: I8254.cc:169
I8254(Scheduler &scheduler, ClockPinListener *output0, ClockPinListener *output1, ClockPinListener *output2, EmuTime::param time)
Definition: I8254.cc:75
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:28