Files
blankos/stdio.c
2024-05-19 14:31:10 +02:00

28 lines
547 B
C

#include "io.h"
#include "stdio.h"
#include "string.h"
char* fb = (char *) 0x000B8000;
void move_cursor(unsigned short pos)
{
outb(FB_CMD_PORT, FB_HIGH_BYTE_CMD);
outb(FB_DATA_PORT, ((pos >> 8) & 0x00FF));
outb(FB_CMD_PORT, FB_LOW_BYTE_CMD);
outb(FB_DATA_PORT, pos & 0x00FF);
}
void putchar(unsigned int i, char c, unsigned char fg, unsigned char bg)
{
fb[i] = c;
fb [i+1] = ((fg & 0x0F) << 4 | (bg & 0x0F));
}
void write(char *buf)
{
for (int i=0; i<strlen(buf); i++)
{
putchar(2*i, buf[i], FB_GREEN, FB_DARK_GREY);
}
}