From 956bc514ff1860ca6122000a0ffe75427e2fde39 Mon Sep 17 00:00:00 2001 From: aqua Date: Thu, 3 Nov 2022 15:56:05 +0200 Subject: vga: fix text mode cursor outb parameters are (value, port) and not (port, value) --- devices/vga.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'devices') diff --git a/devices/vga.c b/devices/vga.c index aeda483..39370ba 100644 --- a/devices/vga.c +++ b/devices/vga.c @@ -2,14 +2,14 @@ #include #include -const uint16_t cga_idx_port = 0x3d4; -const uint16_t cga_dat_port = 0x3d5; +#define cga_idx_port 0x3d4 +#define cga_dat_port 0x3d5 -const uint8_t cursor_start = 0xa; -const uint8_t cursor_end = 0xb; -const uint8_t cursor_addr_h = 0xe; -const uint8_t cursor_addr_l = 0xf; -const uint8_t cursor_hide = 0x20; +#define cursor_start 0x0a +#define cursor_end 0x0b +#define cursor_addr_h 0x0e +#define cursor_addr_l 0x0f +#define cursor_hide 0x20 struct __attribute__((packed)) VGAEntry { unsigned char text; @@ -29,18 +29,18 @@ int row = 0; void vga_enable_cursor(unsigned char start, unsigned char end) { - outb(cga_idx_port, cursor_start); - outb(cga_dat_port, (inb(cga_dat_port) & 0xc0) | start); + outb(cursor_start, cga_idx_port); + outb((inb(cga_dat_port) & 0xc0) | start, cga_dat_port); - outb(cga_idx_port, cursor_end); - outb(cga_dat_port, (inb(cga_dat_port) & 0xe0) | end); + outb(cursor_end, cga_idx_port); + outb((inb(cga_dat_port) & 0xe0) | end, cga_dat_port); } void vga_disable_cursor() { - outb(cga_idx_port, cursor_start); - outb(cga_dat_port, cursor_hide); + outb(cursor_start, cga_idx_port); + outb(cursor_hide, cga_dat_port); } void @@ -48,11 +48,11 @@ vga_update_cursor() { const uint16_t pos = row * width + col; - outb(cga_idx_port, cursor_addr_l); - outb(cga_dat_port, pos & 0xff); + outb(cursor_addr_l, cga_idx_port); + outb(pos & 0xff, cga_dat_port); - outb(cga_idx_port, cursor_addr_h); - outb(cga_dat_port, (pos >> 8) & 0xff); + outb(cursor_addr_h, cga_idx_port); + outb((pos >> 8) & 0xff, cga_dat_port); } // *** Text Mode *** @@ -60,7 +60,7 @@ void vga_init() { buffer = (struct VGAEntry *)0xc03ff000; - vga_enable_cursor(0, 15); + vga_enable_cursor(14, 15); vga_clear(VGA_COLOR_LIGHT_BLUE, VGA_COLOR_LIGHT_GREY); } -- cgit v1.2.1