Feat: Better IO functions & Refractor of "colors.h" to "stdio.h"

This commit is contained in:
AfonsoCMSousa
2025-11-20 22:40:00 +00:00
parent 67776035b6
commit b619b9ed1d
5 changed files with 456 additions and 134 deletions
+12 -31
View File
@@ -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) {