interrupts, timer, keyboard, segments, lots of kernel code
[bootcensus] / src / kmain.c
1 #include <stdio.h>
2 #include <ctype.h>
3 #include "segm.h"
4 #include "intr.h"
5 #include "keyb.h"
6 #include "timer.h"
7 #include "contty.h"
8
9 void set_mode13h(void);
10 void logohack(void);
11
12 void pcboot_main(void)
13 {
14         init_segm();
15         init_intr();
16         kb_init();
17         con_init();
18
19         /* initialize the timer */
20         init_timer();
21
22         enable_intr();
23
24         printf("PCBoot kernel initialized\n");
25
26         for(;;) {
27                 int c;
28
29                 halt_cpu();
30                 while((c = kb_getkey()) >= 0) {
31                         if(c >= KB_F1 && c <= KB_F12) {
32                                 set_mode13h();
33                                 logohack();
34                         }
35                         if(isprint(c)) {
36                                 printf("key: %d '%c'       \n", c, (char)c);
37                         } else {
38                                 printf("key: %d            \n", c);
39                         }
40                 }
41                 if((nticks % 250) == 0) {
42                         printf("ticks: %ld\r", nticks);
43                 }
44         }
45 }