mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Added text cursor enable and disable
This commit is contained in:
@@ -16,6 +16,7 @@ void main() {
|
|||||||
setupKeyboard();
|
setupKeyboard();
|
||||||
setupTimer();
|
setupTimer();
|
||||||
timerPhase(100); // 1 tick per 10ms
|
timerPhase(100); // 1 tick per 10ms
|
||||||
|
enableCursor(14, 15);
|
||||||
|
|
||||||
clear(0x0f);
|
clear(0x0f);
|
||||||
print("kern.\n\n", 0x0f);
|
print("kern.\n\n", 0x0f);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
uint16_t cursor = 0;
|
uint16_t cursor = 0;
|
||||||
|
|
||||||
@@ -79,3 +80,16 @@ uint16_t calcOffset(uint8_t col, uint8_t row) {
|
|||||||
return row * COLS + col;
|
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
@@ -14,8 +14,6 @@
|
|||||||
#define COLS 80
|
#define COLS 80
|
||||||
#define CHARS (ROWS*COLS)
|
#define CHARS (ROWS*COLS)
|
||||||
|
|
||||||
#define CURSOR '_'
|
|
||||||
|
|
||||||
void putc(char c, uint8_t attr);
|
void putc(char c, uint8_t attr);
|
||||||
void print(char* s, uint8_t attr);
|
void print(char* s, uint8_t attr);
|
||||||
void putcAt(char c, uint8_t attr, uint8_t row, uint8_t col);
|
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 getCursorPos();
|
||||||
uint16_t calcOffset(uint8_t row, uint8_t col);
|
uint16_t calcOffset(uint8_t row, uint8_t col);
|
||||||
|
|
||||||
void setCursorChar(char cursor);
|
void enableCursor(uint8_t start, uint8_t end);
|
||||||
char getCursorChar();
|
void disableCursor();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user