#include "./platform/drivers/ports.h"
#include "print.h"
#include "./platform/types.h"
#include "./platform/interrupts/int.h"

void dummy_test_entrypoint() {}

void kernel_welcome() {
    print_str("Welcome to ");
    print_set_color(PRINT_COLOR_CYAN, PRINT_COLOR_BLACK);
    print_str("Shade");
	print_set_color(PRINT_COLOR_WHITE, PRINT_COLOR_BLACK);
    print_str("!\n");
	
	print_str("shadeOS kernel version ");
	
	print_set_color(PRINT_COLOR_YELLOW, PRINT_COLOR_BLACK);
	print_str("0.2.2");
	
	print_set_color(PRINT_COLOR_WHITE, PRINT_COLOR_BLACK);
	print_newline();
	
	print_str("Running on ");
	
	print_set_color(PRINT_COLOR_YELLOW, PRINT_COLOR_BLACK);
	print_str("shade-development");

    print_set_color(PRINT_COLOR_WHITE, PRINT_COLOR_BLACK);
	
	print_newline();
}

// kMain
void main() {
    // Initialize screen buffer
	struct Char* buffer = (struct Char*) 0xb8000;
    
    clear_all(); // Clear screen
    set_cursor_pos(0, 0); // Set cursor position
    print_set_color(PRINT_COLOR_WHITE, PRINT_COLOR_BLACK); // Set print color

    // welcome messages
    kernel_msg_ok("Initialized display successfully\n");
    kernel_welcome();

    print_str("Copyright (c) e3team 2022. All rights reserved.\n");
    print_str("This program is provided \"as-is\" and no express or implied warranty is provided.\n");
    print_str("The full license can be found at /sys/LICENCE on this system or ./LICENCE in the source tree.\n");

    idt_init();
    kernel_msg_ok("Interrupts initialized");

    __asm__ __volatile__("int $2");
}