Initial checkin.
[seabios.git] / src / clock.c
1 // 16bit code to handle system clocks.
2 //
3 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
4 // Copyright (C) 2002  MandrakeSoft S.A.
5 //
6 // This file may be distributed under the terms of the GNU GPLv3 license.
7
8 #include "biosvar.h" // struct bregs
9 #include "util.h" // debug_enter
10 #include "disk.h" // floppy_tick
11
12 // INT 1Ah Time-of-day Service Entry Point
13 void VISIBLE
14 handle_1a(struct bregs *regs)
15 {
16     debug_enter(regs);
17     set_cf(regs, 1);
18 }
19
20 // User Timer Tick
21 void VISIBLE
22 handle_1c(struct bregs *regs)
23 {
24     debug_enter(regs);
25 }
26
27 // INT 08h System Timer ISR Entry Point
28 void VISIBLE
29 handle_08(struct bregs *regs)
30 {
31 //    debug_enter(regs);
32
33     floppy_tick();
34
35     u32 counter = GET_BDA(timer_counter);
36     counter++;
37     // compare to one days worth of timer ticks at 18.2 hz
38     if (counter >= 0x001800B0) {
39         // there has been a midnight rollover at this point
40         counter = 0;
41         SET_BDA(timer_rollover, GET_BDA(timer_rollover) + 1);
42     }
43
44     SET_BDA(timer_counter, counter);
45     // XXX - int #0x1c
46     eoi_master_pic();
47 }
48
49 // int70h: IRQ8 - CMOS RTC
50 void VISIBLE
51 handle_70(struct bregs *regs)
52 {
53     debug_enter(regs);
54 }