Added text cursor enable and disable

This commit is contained in:
2024-03-11 21:15:32 +01:00
parent ac281835db
commit 963bfe7744
3 changed files with 17 additions and 4 deletions
+1
View File
@@ -16,6 +16,7 @@ void main() {
setupKeyboard();
setupTimer();
timerPhase(100); // 1 tick per 10ms
enableCursor(14, 15);
clear(0x0f);
print("kern.\n\n", 0x0f);
+14
View File
@@ -1,5 +1,6 @@
#include "screen.h"
#include "stdint.h"
#include "system.h"
uint16_t cursor = 0;
@@ -79,3 +80,16 @@ uint16_t calcOffset(uint8_t col, uint8_t row) {
return row * COLS + col;
}
void enableCursor(uint8_t start, uint8_t end) {
outb(0x3d4, 0x0a); // Sending cursor start
outb(0x3d5, (inb(0x3d5) & 0xc0) | start);
outb(0x3d4, 0x0b); // Sending cursor end
outb(0x3d5, (inb(0x3d5) & 0xe0) | end);
}
void disableCursor() {
outb(0x3d4, 0x0a);
outb(0x3d4, 0x0b);
}
+2 -4
View File
@@ -14,8 +14,6 @@
#define COLS 80
#define CHARS (ROWS*COLS)
#define CURSOR '_'
void putc(char c, uint8_t attr);
void print(char* s, uint8_t attr);
void putcAt(char c, uint8_t attr, uint8_t row, uint8_t col);
@@ -27,7 +25,7 @@ void setCursorPos(uint16_t offset);
uint16_t getCursorPos();
uint16_t calcOffset(uint8_t row, uint8_t col);
void setCursorChar(char cursor);
char getCursorChar();
void enableCursor(uint8_t start, uint8_t end);
void disableCursor();
#endif