diff options
author | Tyler Murphy <=> | 2023-07-16 02:54:32 -0400 |
---|---|---|
committer | Tyler Murphy <=> | 2023-07-16 02:54:32 -0400 |
commit | fbf131b5c043b27e0b1543374bb144e3e426f723 (patch) | |
tree | 07f0ab2fc107b36621d5ae95480e6a91e332548b /kernel/src/tty/cursor.c | |
download | finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.gz finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.bz2 finix-fbf131b5c043b27e0b1543374bb144e3e426f723.zip |
initial
Diffstat (limited to 'kernel/src/tty/cursor.c')
-rw-r--r-- | kernel/src/tty/cursor.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/src/tty/cursor.c b/kernel/src/tty/cursor.c new file mode 100644 index 0000000..3a3888b --- /dev/null +++ b/kernel/src/tty/cursor.c @@ -0,0 +1,30 @@ +#include <sys.h> + +#include "cursor.h" +#include "term.h" + +void cursor_enable(void) { + cursor_setsize(13, 16); +} + +void cursor_disable(void) { + outb(0x3D4, 0x0A); + outb(0x3D5, 0x20); +} + +void cursor_setsize(uint8_t start, uint8_t end) { + outb(0x3D4, 0x0A); + outb(0x3D5, (inb(0x3D5) & 0xC0) | start); + + outb(0x3D4, 0x0B); + outb(0x3D5, (inb(0x3D5) & 0xE0) | end); +} + +void cursor_setpos(uint8_t x, uint8_t y) { +; uint16_t pos = y * TERM_W + x; + + outb(0x3D4, 0x0F); + outb(0x3D5, (uint8_t) (pos & 0xFF)); + outb(0x3D4, 0x0E); + outb(0x3D5, (uint8_t) ((pos >> 8) & 0xFF)); +} |