diff options
| author | Aleksa Vučković <aleksav013@gmail.com> | 2022-06-29 17:23:50 +0200 |
|---|---|---|
| committer | Aleksa Vučković <aleksav013@gmail.com> | 2022-06-29 17:23:50 +0200 |
| commit | 987d6c6e5e931f349a3f48b890a2ab9ee0c430b4 (patch) | |
| tree | 209d9bc6210edcee3cf7c3e229e81cba6f64a891 /src/c/cursor.c | |
| parent | 1f57e99720c4bc5e3e27a88ff469cef43c202a43 (diff) | |
Diffstat (limited to 'src/c/cursor.c')
| -rw-r--r-- | src/c/cursor.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/c/cursor.c b/src/c/cursor.c new file mode 100644 index 0000000..328b424 --- /dev/null +++ b/src/c/cursor.c @@ -0,0 +1,27 @@ +#include<source/cursor.h> +#include<asm.h> + +void enable_cursor(uint32_t cursor_start, uint32_t cursor_end) +{ + ioport_out(0x3D4, 0x0A); + ioport_out(0x3D5, (ioport_in(0x3D5) & 0xC0) | cursor_start); + + ioport_out(0x3D4, 0x0B); + ioport_out(0x3D5, (ioport_in(0x3D5) & 0xE0) | cursor_end); +} + +void disable_cursor() +{ + ioport_out(0x3D4, 0x0A); + ioport_out(0x3D5, 0x20); +} + +uint16_t get_cursor_position(void) +{ + uint16_t pos = 0; + ioport_out(0x3D4, 0x0F); + pos |= (uint16_t)ioport_in(0x3D5); + ioport_out(0x3D4, 0x0E); + pos |= (uint16_t)(ioport_in(0x3D5) << 8); + return pos; +} |
