Newer
Older
tree-os / src / kernel / drivers / textMode / cursor.c
#include <cursor.h>
#include <ports.h>
#include <stdint.h>
#include <stdio.h>

void setCursorOffset(uint16_t offset) {
    outb(0x3D4, 0x0F);
    outb(0x3D5, (uint8_t)(offset & 0xFF));
    outb(0x3D4, 0x0E);
    outb(0x3D5, (uint8_t)((offset >> 8) & 0xFF));
}

uint16_t getCursorOffset() {
    uint16_t result = 0;
    outb(0x3D4, 0x0F);
    result |= inb(0x3D5);
    outb(0x3D4, 0x0E);
    result |= ((uint16_t)inb(0x3D5)) << 8;
    return result;
}