2022-06-17 12:28:24 +02:00
|
|
|
#include "vga.h"
|
2022-06-17 12:47:57 +02:00
|
|
|
#include "../arch/i686/io.h"
|
2022-06-17 12:28:24 +02:00
|
|
|
|
|
|
|
void set_char(int x, int y, char c){
|
|
|
|
VGA_MEMORY[(x+y*VGA_WIDTH)*2] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_color(int x, int y, uint8_t color){
|
|
|
|
VGA_MEMORY[(x+y*VGA_WIDTH)*2+1] = color;
|
|
|
|
}
|
2022-06-17 12:47:57 +02:00
|
|
|
|
|
|
|
void set_cursor(int offset){
|
|
|
|
i686_outb(VGA_PORT_CTRL, 14);
|
|
|
|
i686_outb(VGA_PORT_DATA, (uint8_t)(offset >> 8));
|
|
|
|
i686_outb(VGA_PORT_CTRL, 15);
|
|
|
|
i686_outb(VGA_PORT_DATA, (uint8_t)(offset & 0xff));
|
|
|
|
}
|
|
|
|
|
|
|
|
int get_cursor(){
|
|
|
|
i686_outb(VGA_PORT_CTRL, 14);
|
|
|
|
int offset = i686_inb(VGA_PORT_DATA) << 8; // High byte
|
|
|
|
i686_outb(VGA_PORT_CTRL, 15);
|
|
|
|
offset += i686_inb(VGA_PORT_DATA); // Low byte
|
|
|
|
return offset;
|
|
|
|
}
|