diff --git a/src/cursor.c b/src/cursor.c index 77b69e5..6961bc5 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -2,6 +2,8 @@ #include "io.h" +static uint8_t r10 = 0; + void cursor_setRaw(uint16_t address) { io_out(0xA0, 14); io_out(0xA1, (address >> 8) & 0xff); @@ -15,8 +17,10 @@ void cursor_setXY(uint8_t x, uint8_t y) { void cursor_setStartRaster(uint8_t start) { start &= 0x1f; + r10 &= ~0x1f; + r10 |= start; io_out(0xA0, 10); - io_out(0xA1, start); + io_out(0xA1, r10); } void cursor_setEndRaster(uint8_t end) { @@ -33,4 +37,12 @@ void cursor_enable(bool enable) { cursor_setStartRaster(0xd); cursor_setEndRaster(0x0); } -} \ No newline at end of file +} + +void cursor_blink(enum cursor_blink_t blink) { + blink &= 0x60; + r10 &= ~0x60; + r10 |= blink; + io_out(0xA0, 10); + io_out(0xA1, r10); +} diff --git a/src/cursor.h b/src/cursor.h index a0ecc51..1174569 100644 --- a/src/cursor.h +++ b/src/cursor.h @@ -4,6 +4,12 @@ #include #include +enum cursor_blink_t { + CURSOR_BLINK_NONE = 0x00, + CURSOR_BLINK_SLOW = 0x40, + CURSOR_BLINK_FAST = 0x60, +}; + void cursor_setRaw(uint16_t address); void cursor_setXY(uint8_t x, uint8_t y); @@ -14,4 +20,6 @@ void cursor_setEndRaster(uint8_t end); void cursor_enable(bool enable); +void cursor_blink(enum cursor_blink_t blink); + #endif