-
Notifications
You must be signed in to change notification settings - Fork 0
/
kmain.c
54 lines (40 loc) · 883 Bytes
/
kmain.c
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
54
#define WHITE_ON_BLACK 0xF0
#define GREEN_ON_BLACK 0xA0;
#define BLACK_ON_WHITE 0x0F;
#define NULL 0
char *buf = (char*)0x000b8000;
unsigned int curs = 0;
int mem_default_mode = WHITE_ON_BLACK;
void mem_putch(char c, char bg) {
buf[curs++] = c;
buf[curs++] = bg;
}
void mem_init() {
unsigned int r = 0;
unsigned int c = 0;
for(r = 0; r < 60; r++)
for(c = 0; c < 80; c++)
mem_putch(' ', 0xFF);
curs = 0;
}
unsigned int strlen(const char *str) {
register const char *s;
for(s = str; *s; ++s)
;
return (unsigned int)((int)s - (int)str);
}
void putch(char c) {
mem_putch(c, mem_default_mode);
}
void kprintf(const char *str) {
unsigned int i = 0;
unsigned int len = strlen(str);
for(i = 0; i < len; i++) {
putch(str[i]);
}
}
void kmain() {
mem_init();
kprintf("CaOS - v 0.1 alpha");
for(;;);
}