Files
kernel3/kernel/kmain.c
T

58 lines
1.9 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"
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();
write_to_com(COM1_PORT, "Displaying OS banner.\n");
//draw_rect(20, 5, 50, 7, 0x4, 0xF);
draw_rect(0, 5, 5, 13, 0xF, 0x4);
draw_rect(5, 8, 10, 10, 0x4, 0xF);
draw_rect(10, 5, 15, 13, 0x8, 0x6);
draw_rect(20, 5, 25, 7, 0xF, 0x1);
draw_rect(20, 8, 25, 13, 0x5, 0x3);
set_cursor(0, 14);
move_cursor(0, 14);
move_cursor(0, 15);
draw_string("Test print", 0x8, 0xF);
move_cursor(0, 16);
draw_string("And now the cursor has been moved to y = 16.", 0x1, 0xF);
move_cursor(5, 20);
draw_string("Cursor moved over 5 cells and down 4 cells.", 0xF, 0x0);
draw_string("And the cursor moves to the end of the string", 0x1, 0xF);
draw_string("Now this string should have a newline now:\nAnd now a new line is here.\n", 0xF, 0x0);
//draw_rect(20, 5, 50, 7, 0x4, 0xF);
//draw_rect(20, 5, 50, 7, 0x4, 0xF);
//draw_rect(20, 5, 50, 7, 0x4, 0xF);
//draw_s("Hello, World!", 2, 9);
//row = 2;
///column = 80;
//draw_s("And 2nd Row. Now the 3rd row.", 2, 9);
move_cursor(0, 3);
draw_string("Installing GDT...\n", 0xF, 0x0);
write_to_com(COM1_PORT, "Installing the GDT.\n");
gdt_install();
//move_cursor(0, 4);
//asm("xchg %bx, %bx");
//write_to_com(COM1_PORT, "GDT installed.\n");
//asm("xchg %bx, %bx"); // Boch's break point
//draw_string("Installed GDT\n", 0xf, 0x0);
//asm("xchg %bx, %bx");
idt_install();
write_to_com(COM1_PORT, "IDT installed.\n");
int i = 5 / 0;
asm("hlt");
}