SoraOS/kernel.c

54 lines
977 B
C

// File: kernel.c
// SoraOS Kernel - Main entry point
// INFO:
// 0xA0000 for EGA/VGA graphics modes (64 KB)
// 0xB0000 for monochrome text mode (32 KB)
// 0xB8000 for color text mode and CGA-compatible graphics modes (32 KB)
#include "colors.h"
/*
static void __put_char(char c, unsigned char color) {
volatile unsigned short *vga = (volatile unsigned short *)0xB8000;
static int line = 0;
static int column = 2;
if (line >= 16) {
column += 3;
line = 0;
}
line++;
vga[line * 80 + 0 + column] = (0x2F << 8) | line; // White color
vga[line * 80 + 1 + column] = (color << 8) | c; // White color
}
*/
void kmain(void) {
__clear_screen();
_VGA Char;
Char.codepoint = 'T';
Char.color = (WHITE << 4) | BLACK;
_VGA_screen_space Space;
Space.column = 2;
Space.line = 7;
__put_char_VGA_POS(Char, Space, 1);
Space.line = 4;
Space.column = 3;
__put_char_VGA_POS(Char, Space, 0);
// Infinite loop
while (1) {
__asm__ volatile("hlt");
}
}