forked from crazyqk2019/libretro-px68k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfmtimer.h
53 lines (42 loc) · 1.11 KB
/
fmtimer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// ---------------------------------------------------------------------------
// FM sound generator common timer module
// Copyright (C) cisc 1998, 2000.
// ---------------------------------------------------------------------------
// $fmgen-Id: fmtimer.h,v 1.2 2003/04/22 13:12:53 cisc Exp $
#ifndef FM_TIMER_H
#define FM_TIMER_H
// ---------------------------------------------------------------------------
namespace FM
{
class Timer
{
public:
void Reset();
bool Count(int32 us);
int32 GetNextEvent();
protected:
virtual void SetStatus(uint bit) = 0;
virtual void ResetStatus(uint bit) = 0;
void SetTimerBase(uint clock);
void SetTimerA(uint addr, uint data);
void SetTimerB(uint data);
void SetTimerControl(uint data);
uint8 status;
uint8 regtc;
private:
virtual void TimerA() {}
uint8 regta[2];
int32 timera, timera_count;
int32 timerb, timerb_count;
int32 timer_step;
};
// ---------------------------------------------------------------------------
// ½é´ü²½
//
inline void Timer::Reset()
{
timera_count = 0;
timerb_count = 0;
}
} // namespace FM
#endif // FM_TIMER_H