forked from PoliEcho-holding-org/kern
Added cursor rendering (kinda badly, will delete any characters under it)
This commit is contained in:
@@ -48,9 +48,11 @@ void printAt(const char* str, uint32_t x, uint32_t y) {
|
||||
|
||||
void putc(char c) {
|
||||
if (c == '\n') {
|
||||
putcAt(' ', cursor.x, cursor.y); // Make sure we don't leave an extra cursor
|
||||
cursor.y++;
|
||||
cursor.x = 0;
|
||||
} else if (c == '\b') {
|
||||
putcAt(' ', cursor.x, cursor.y); // Make sure we don't leave an extra cursor TODO: make this better
|
||||
cursor.x--;
|
||||
putcAt(' ', cursor.x, cursor.y);
|
||||
} else {
|
||||
|
||||
+7
-1
@@ -6,12 +6,18 @@
|
||||
#include "irq.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
#define INPUT_CLK 1193180
|
||||
|
||||
uint32_t timerTicks = 0;
|
||||
|
||||
void timerHandler() {
|
||||
timerTicks++;
|
||||
|
||||
// TODO: Improve the cursor rendering
|
||||
if (timerTicks % 500 == 0) putcAt(127, cursor.x, cursor.y);
|
||||
else if (timerTicks % 250 == 0) putcAt(' ', cursor.x, cursor.y);
|
||||
}
|
||||
|
||||
void setupTimer() {
|
||||
@@ -30,7 +36,7 @@ void timerPhase(uint32_t hz) {
|
||||
void sleep(uint32_t ticks) {
|
||||
uint32_t eticks = ticks + timerTicks;
|
||||
|
||||
while (timerTicks != eticks); // Should avoid overflows unlike '<'
|
||||
while (timerTicks != eticks); // Should ignore overflows unlike '<'
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user