Add cursor module.

This commit is contained in:
giomba 2023-10-15 15:09:01 +02:00
parent 5a7203ebda
commit bf1b651ec5
2 changed files with 40 additions and 0 deletions

26
src/cursor.c Normal file
View File

@ -0,0 +1,26 @@
#include "cursor.h"
#include "io.h"
void cursor_setRaw(uint16_t address) {
io_out(0xA0, 14);
io_out(0xA1, (address >> 8) & 0xff);
io_out(0xA0, 15);
io_out(0xA1, address & 0xff);
}
void cursor_setXY(uint8_t x, uint8_t y) {
cursor_setRaw((uint16_t)y * 80 + x);
}
void cursor_setStartRaster(uint8_t start) {
start &= 0x1f;
io_out(0xA0, 10);
io_out(0xA1, start);
}
void cursor_setEndRaster(uint8_t end) {
end &= 0x1f;
io_out(0xA0, 11);
io_out(0xA1, end);
}

14
src/cursor.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef CEDA_CURSOR_H
#define CEDA_CURSOR_H
#include <stdint.h>
void cursor_setRaw(uint16_t address);
void cursor_setXY(uint8_t x, uint8_t y);
void cursor_setStartRaster(uint8_t start);
void cursor_setEndRaster(uint8_t end);
#endif