diff options
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)); +} |