OSDN Git Service

[Build][Win32] Separate GUI(and fmgen and emuutils) to separate DLLs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / fmgen / fmtimer.h
1 // ---------------------------------------------------------------------------
2 //      FM sound generator common timer module
3 //      Copyright (C) cisc 1998, 2000.
4 // ---------------------------------------------------------------------------
5 //      $Id: fmtimer.h,v 1.2 2003/04/22 13:12:53 cisc Exp $
6
7 #ifndef FM_TIMER_H
8 #define FM_TIMER_H
9
10 #include "types.h"
11
12 // ---------------------------------------------------------------------------
13
14 namespace FM
15 {
16         class DLL_PREFIX Timer
17         {
18         public:
19                 void    Reset();
20                 bool    Count(int32 clock);
21                 int32   GetNextEvent();
22         
23         protected:
24                 virtual void SetStatus(uint bit) = 0;
25                 virtual void ResetStatus(uint bit) = 0;
26
27                 void    SetTimerPrescaler(int32 p);
28                 void    SetTimerA(uint addr, uint data);
29                 void    SetTimerB(uint data);
30                 void    SetTimerControl(uint data);
31                 
32                 void SaveState(void *f);
33                 bool LoadState(void *f);
34                 
35                 uint8   status;
36                 uint8   regtc;
37         
38         private:
39                 virtual void TimerA() {}
40                 uint8   regta[2];
41                 
42                 int32   timera, timera_count;
43                 int32   timerb, timerb_count;
44                 int32   prescaler;
45         };
46
47 // ---------------------------------------------------------------------------
48 //      \8f\89\8aú\89»
49 //
50 inline void Timer::Reset()
51 {
52         timera_count = 0;
53         timerb_count = 0;
54 }
55
56 } // namespace FM
57
58 #endif // FM_TIMER_H