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 "noncopyable.hh"
12 #include <memory>
13 
14 namespace openmsx {
15 
16 class Scheduler;
17 class Counter;
18 class ClockPin;
19 class ClockPinListener;
20 
21 class I8254 : private noncopyable
22 {
23 public:
24  I8254(Scheduler& scheduler, ClockPinListener* output0,
25  ClockPinListener* output1, ClockPinListener* output2,
26  EmuTime::param time);
27  ~I8254();
28 
29  void reset(EmuTime::param time);
30  byte readIO(word port, EmuTime::param time);
31  byte peekIO(word port, EmuTime::param time) const;
32  void writeIO(word port, byte value, EmuTime::param time);
33 
34  void setGate(unsigned counter, bool status, EmuTime::param time);
35  ClockPin& getClockPin(unsigned cntr);
36  ClockPin& getOutputPin(unsigned cntr);
37 
38  template<typename Archive>
39  void serialize(Archive& ar, unsigned version);
40 
41 private:
42  void readBackHelper(byte value, unsigned cntr, EmuTime::param time);
43 
44  std::unique_ptr<Counter> counter[3];
45 };
46 
47 } // namespace openmsx
48 
49 #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
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:33
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:7
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:38
ClockPin & getClockPin(unsigned cntr)
Definition: I8254.cc:169
Based on boost::noncopyable, see boost documentation: http://www.boost.org/libs/utility.
Definition: noncopyable.hh:12
I8254(Scheduler &scheduler, ClockPinListener *output0, ClockPinListener *output1, ClockPinListener *output2, EmuTime::param time)
Definition: I8254.cc:75