+#include <stdio.h>
#include <string.h>
#include <stdint.h>
-
-void clearscr(void)
-{
- memset((void*)0xb8000, 0, 80 * 25 * 2);
-}
+#include "vga.h"
void drawtext(int x, int y, const char *s)
{
- uint16_t *vptr = (uint16_t*)0xb8000 + y * 80 + x;
-
while(*s) {
- *vptr++ = 0x0c00 | *s++;
+ vga_drawchar(x++, y, *s++);
}
}
void kmain(void)
{
- clearscr();
- drawtext(10, 5, "3sys kernel 1");
+ char buf[64];
+
+ vga_reset();
+ vga_setcolor(VGA_YELLOW | VGA_BRIGHT, VGA_BLACK);
+
+ sprintf(buf, "kmain addr: %p", (void*)kmain);
+ drawtext(10, 5, buf);
}