kernel_premier/framebuffer.c

18 lines
488 B
C
Raw Normal View History

2023-09-12 23:35:30 +02:00
#include "io.h"
#include "framebuffer.h"
void fb_write_cell(unsigned int i, char c, unsigned char fg, unsigned char bg)
{
char *fb = (char*) 0xB8000; // adresse du framebuffer
*(fb + i) = c;
*(fb + i + 1) = (fg & 0x0F) | ((bg & 0x0F) << 4); // little endian ??
}
void fb_move_cursor(unsigned short pos)
{
outb(FB_COMMAND_PORT, FB_HIGH_BYTE_COMMAND);
outb(FB_DATA_PORT, (pos >> 8) & 0x00FF);
outb(FB_COMMAND_PORT, FB_HIGH_BYTE_COMMAND);
outb(FB_DATA_PORT, pos & 0x00FF);
}