aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/arch/i386/tmtty.cpp
diff options
context:
space:
mode:
authorEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2024-05-03 03:39:47 -0400
committerEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2024-05-03 03:39:47 -0400
commit2d59766eb330b9d15a9bcbcd7e1695809fc099c5 (patch)
treeb5abb4d0c0c488cbb44c2c0a54d59b44fe1fc462 /kernel/arch/i386/tmtty.cpp
parent2461cd921d45e3d75245568bc59831c1f0a43331 (diff)
renamed i386 to x86
Diffstat (limited to 'kernel/arch/i386/tmtty.cpp')
-rw-r--r--kernel/arch/i386/tmtty.cpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/kernel/arch/i386/tmtty.cpp b/kernel/arch/i386/tmtty.cpp
deleted file mode 100644
index d4dc772..0000000
--- a/kernel/arch/i386/tmtty.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-#include <arch/i386/tmtty.h>
-
-#include "vga.h"
-
-/* Text mode tty */
-
-static const size_t VGA_WIDTH = 80;
-static const size_t VGA_HEIGHT = 25;
-static uint16_t* const VGA_MEMORY = (uint16_t*) 0xB8000;
-
-size_t terminal_row;
-size_t terminal_column;
-uint8_t terminal_color;
-uint16_t* terminal_buffer;
-
-void terminal_clear(void) {
- terminal_row = 0;
- terminal_column = 0;
- for (size_t y = 0; y < VGA_HEIGHT; y++) {
- for (size_t x = 0; x < VGA_WIDTH; x++) {
- const size_t i = y * VGA_WIDTH + x;
- terminal_buffer[i] = vga_entry(' ', terminal_color);
- }
- }
-}
-
-void terminal_initialize(void) {
- terminal_color = vga_entry_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
- terminal_buffer = VGA_MEMORY;
- terminal_clear();
-}
-
-void terminal_setcolor(uint8_t color) {
- terminal_color = color;
-}
-
-void terminal_putentryat(char c, uint8_t color, size_t x, size_t y) {
- const size_t i = y * VGA_WIDTH + x;
- terminal_buffer[i] = vga_entry(c, color);
-}
-
-void terminal_scroll() {
- memmove(VGA_MEMORY, (VGA_MEMORY + VGA_WIDTH), (VGA_HEIGHT * VGA_WIDTH) - VGA_WIDTH);
- memset(VGA_MEMORY + (VGA_WIDTH * VGA_HEIGHT) - VGA_WIDTH, 0x0, VGA_WIDTH * 2);
- --terminal_row;
-}
-
-void terminal_putchar(char c) {
- unsigned char uc = c;
- if (uc == '\n') {
- terminal_column = 0;
- if (terminal_row++ == VGA_HEIGHT)
- terminal_scroll();
- return;
- }
- terminal_putentryat(uc, terminal_color, terminal_column, terminal_row);
-
- if (++terminal_column == VGA_WIDTH) {
- terminal_column = 0;
- if (++terminal_row == VGA_HEIGHT) {
- terminal_scroll();
- }
- }
-}
-
-void terminal_write(const char* data, size_t size) {
- for (size_t i = 0; i < size; i++) {
- terminal_putchar(data[i]);
- }
-}
-
-void terminal_writestring(const char* data) {
- terminal_write(data, strlen(data));
-} \ No newline at end of file