5 static unsigned int prev_time;
6 static unsigned short ticks = 0;
7 static unsigned int reload;
8 static unsigned int reloaded;
10 static unsigned char tac;
11 static unsigned int started;
12 static unsigned int speed;
13 static unsigned short counter;
14 static unsigned int modulo;
17 void timer_set_div(
unsigned char v)
37 unsigned char timer_get_div(
void)
42 void timer_set_counter(
unsigned char v)
50 unsigned char timer_get_counter(
void)
55 void timer_set_modulo(
unsigned char v)
62 unsigned char timer_get_modulo(
void)
67 void timer_set_tac(
unsigned char v)
69 int speeds[] = {1024, 16, 64, 256};
76 if(ticks & (speed >> 1))
87 if(ticks & (speed >> 1) && !(ticks & (speeds[v&3]>>1)))
101 unsigned char timer_get_tac(
void)
106 static void timer_tick(
int delta)
110 unsigned int old_ticks;
120 interrupt(INTR_TIMER);
130 if(((old_ticks & (speed>>1)))
131 && (ticks & (speed>>1)) == 0)
142 void timer_cycle(
void)
147 delta = cpu_get_cycles() - prev_time;
148 prev_time = cpu_get_cycles();