Files

51 lines
1.2 KiB
C

#include "../includes/io.h"
#include "../includes/gdt.h"
#include "../includes/idt.h"
#include "../includes/serial.h"
#include "../includes/screen.h"
#include "../includes/loader.h"
#include "../includes/pic.h"
#include "../includes/kb.h"
struct multiboot_header header __attribute((section(".multiboot"))) = (struct multiboot_header) {.magic = 0x1BADB002, .flags = 0x1, .checksum = -464367619};
void kmain()
{
set_serial_baud_rate(COM1_PORT, 0x03);
configure_serial_line(COM1_PORT);
write_to_com(COM1_PORT, "Set up COM1 for messaging.\n");
clear_screen();
write_to_com(COM1_PORT, "Clearing screen.\n");
print_banner();
print_message("Displaying OS banner.\n", 0xF, 0x0);
print_message("Installing GDT...\n", 0xF, 0x0);
gdt_install();
print_message("GDT installed!\n", 0xF, 0x0);
//asm("xchg %bx, %bx"); // Boch's break point
print_message("Installing IDT...\n", 0xF, 0x0);
idt_install();
print_message("IDT installed.\n", 0xF, 0x0);
//asm("xchg %bx, %bx"); // Boch's break point
setup_pics();
//kb
init_kb();
//asm("xchg %bx, %bx");
asm("sti");
//for(;;);
idle();
}
void print_message(unsigned char* msg, unsigned char fg, unsigned char bg)
{
write_to_com(COM1_PORT, msg);
draw_string(msg, fg, bg);
}
void idle()
{
for(;;) asm("hlt");
}