Probably broken memory methods done

This commit is contained in:
Benjamin Kyd
2019-04-25 20:19:31 +01:00
parent 1d4201505e
commit 4bc5392ca7
8 changed files with 53 additions and 48 deletions

View File

@@ -16,26 +16,26 @@ Cursor cursor;
void cls() {
for (uint8_t x = 0; x < TERMINAL_WIDTH; x++)
for (uint8_t y = 0; y < TERMINAL_HEIGHT; y++)
putchar(x, y, ' ', fgColour, clearColour);
puts(x, y, ' ', fgColour, clearColour);
cursor.x = 0; cursor.y = 0;
updateCursor(cursor);
}
void putchar(char input) {
void puts(char input) {
if (cursor.x + 1 > TERMINAL_WIDTH) {
nline();
}
if (input == '\n') {
nline();
} else {
putchar(cursor.x, cursor.y, input, fgColour, bgColour);
puts(cursor.x, cursor.y, input, fgColour, bgColour);
cursor.x++;
}
updateCursor(cursor);
}
void putchar(int x, int y, char c, char foreground, char background) {
void puts(int x, int y, char c, char foreground, char background) {
frameBuffer[(y * TERMINAL_WIDTH) + x].c = c;
frameBuffer[(y * TERMINAL_WIDTH) + x].foreground = foreground;
frameBuffer[(y * TERMINAL_WIDTH) + x].background = background;
@@ -49,7 +49,7 @@ void write(char* input) {
if (input[i] == '\n') {
nline();
} else {
putchar(cursor.x, cursor.y, input[i], fgColour, bgColour);
puts(cursor.x, cursor.y, input[i], fgColour, bgColour);
cursor.x++;
}
}

View File

@@ -33,8 +33,8 @@ struct Cursor {
void cls();
void putchar(char input);
void putchar(int x, int y, char c, char foreground, char background);
void puts(char input);
void puts(int x, int y, char c, char foreground, char background);
void write(char* input);
void writeln(char* input);