got the screen cleared, vga cursor moving, looking good

This commit is contained in:
2026-07-12 11:42:49 -05:00
parent d60036a4bd
commit e2ab130324
4 changed files with 21 additions and 2 deletions

View File

@@ -3,7 +3,9 @@
#include <lib/stream.h>
#include "vga.h"
#include <drivers/vga/vga.h>
#include <common.h>
#define VGA_WIDTH 80
#define VGA_HEIGHT 25
@@ -43,7 +45,21 @@ static inline uint16_t vga_entry(unsigned char uc, uint8_t color)
return (uint16_t) uc | (uint16_t) color << 8;
}
static void update_cursor()
{
uint16_t pos = terminal_row * VGA_WIDTH + terminal_column;
outb(0x3D4, 0x0F);
outb(0x3D5, (uint8_t) (pos & 0xFF));
outb(0x3D4, 0x0E);
outb(0x3D5, (uint8_t) ((pos >> 8) & 0xFF));
}
void vga_init() {
outb(0x3D4, 0x0A);
outb(0x3D5, (inb(0x3D5) & 0xC0) | 14);
outb(0x3D4, 0x0B);
outb(0x3D5, (inb(0x3D5) & 0xE0) | 15);
terminal_row = 0;
terminal_column = 0;
terminal_color = vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK);
@@ -89,5 +105,6 @@ uint32_t vga_write(vfs_node_t* node, uint32_t offset, uint32_t size, uint8_t* bu
for (uint32_t i = 0; i < size; i++) {
vga_putchar((char)buf[i]);
}
update_cursor();
return size;
}