Feat: Better IO functions & Refractor of "colors.h" to "stdio.h"
This commit is contained in:
@@ -6,45 +6,26 @@
|
||||
// 0xB0000 for monochrome text mode (32 KB)
|
||||
// 0xB8000 for color text mode and CGA-compatible graphics modes (32 KB)
|
||||
|
||||
#include "colors.h"
|
||||
#include "stdio.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
|
||||
}
|
||||
*/
|
||||
typedef struct user {
|
||||
int id;
|
||||
const char *name;
|
||||
} user;
|
||||
|
||||
void kmain(void) {
|
||||
__clear_screen();
|
||||
|
||||
_VGA Char;
|
||||
Char.codepoint = 'T';
|
||||
Char.color = (WHITE << 4) | BLACK;
|
||||
user current_user;
|
||||
current_user.id = 1;
|
||||
current_user.name = "admin";
|
||||
|
||||
_VGA_screen_space Space;
|
||||
Space.column = 2;
|
||||
Space.line = 7;
|
||||
printf("SoraOS Kernel Initialized!\n");
|
||||
|
||||
__put_char_VGA_POS(Char, Space, 1);
|
||||
printf("\tUser name:\t%s\n", current_user.name);
|
||||
printf("\tUser id:\t%d\n", current_user.id);
|
||||
|
||||
Space.line = 4;
|
||||
Space.column = 3;
|
||||
|
||||
__put_char_VGA_POS(Char, Space, 0);
|
||||
vga_set_cursor(0, 0);
|
||||
|
||||
// Infinite loop
|
||||
while (1) {
|
||||
|
||||
Reference in New Issue
Block a user