aboutsummaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-11-03 15:56:05 +0200
committeraqua <aqua@iserlohn-fortress.net>2022-11-03 15:56:05 +0200
commit956bc514ff1860ca6122000a0ffe75427e2fde39 (patch)
tree4783d1f082b3797fa795ba26d06b02295fc8a370 /devices
parentfix compiler warnings (diff)
downloadkernel-956bc514ff1860ca6122000a0ffe75427e2fde39.tar.xz
vga: fix text mode cursor
outb parameters are (value, port) and not (port, value)
Diffstat (limited to 'devices')
-rw-r--r--devices/vga.c36
1 files changed, 18 insertions, 18 deletions
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 <stdint.h>
#include <sys/io.h>
-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);
}