Implement Backspace (0x08)

This commit is contained in:
Logan Joy-Koer (SuperbeeLavaman)
2025-04-19 19:40:42 -07:00
parent e0ec6c33ca
commit 8843e09663
+11 -37
View File
@@ -96,43 +96,7 @@ uint8_t keyboardState = 0x00;
bool newTiles = true; bool newTiles = true;
const char* keyactions[1024] = { const char* keyactions[1024];
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xFD, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0xFE,
" ", 0, 0, 0, 0, 0, 0, 0,
";", 0, 0, 0, 0, 0, 0, 0,
"?", 0, 0, 0, 0, 0, 0, 0,
0x0D, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xFC, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0xFE,
" ", 0, 0, 0, 0, 0, 0, 0,
":", 0, 0, 0, 0, 0, 0, 0,
"!", 0, 0, 0, 0, 0, 0, 0,
0x0D, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xFF, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0xFC,
"0", "1", "4", "7", ",", 0, 0, 0,
".", "2", "5", "8", "(", 0, 0, 0,
0, "3", "6", "9", ")", 0, 0, 0,
0x0D, "+", "-", "*", "/", "^", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xFE, 0x03, 0x16,
0, 0, 0, 0, 0, 0, 0, 0xFC,
"~", 0, 0, 0, 0, 0, 0, 0,
"<", 0, 0, 0, 0, 0, 0, 0,
">", 0, 0, 0, 0, 0, 0, 0,
0x0D, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
int begin() { int begin() {
kb_EnableOnLatch(); kb_EnableOnLatch();
@@ -194,6 +158,7 @@ bool step() {
idx = 0; idx = 0;
char symbol; char symbol;
char escape_code[16]; char escape_code[16];
bool bs = false;
while (idx < bytes_read) { while (idx < bytes_read) {
symbol = in_buf[idx]; symbol = in_buf[idx];
int increment_X = 1; int increment_X = 1;
@@ -214,6 +179,13 @@ bool step() {
increment_X = 0; increment_X = 0;
symbol = 0x20; symbol = 0x20;
} }
if (symbol == 0x08) {
if (cursorX != 0) {
cursorX -= 1;
}
symbol = 0x20;
bs = true;
}
if (cursorX >= 40) { if (cursorX >= 40) {
cursorX = 0; cursorX = 0;
cursorY += 1; cursorY += 1;
@@ -223,7 +195,9 @@ bool step() {
cursorY = 25; cursorY = 25;
} }
renderGoal[((40 * (cursorY+2)) + cursorX)] = (256*symbol+0xF0); renderGoal[((40 * (cursorY+2)) + cursorX)] = (256*symbol+0xF0);
if (!bs) {
cursorX += increment_X; cursorX += increment_X;
}
idx += 1; idx += 1;
} }
newTiles = true; newTiles = true;