1 #include <lunaix/tty/tty.h>
7 vga_atrributes *buffer = 0xB8000;
9 vga_atrributes theme_color = VGA_COLOR_BLACK;
11 uint32_t TTY_COLUMN = 0;
14 void tty_set_theme(vga_atrributes fg, vga_atrributes bg) {
15 theme_color = (bg << 4 | fg) << 8;
18 void tty_put_char(char chr) {
23 else if (chr == '\r') {
27 *(buffer + TTY_COLUMN + TTY_ROW * TTY_WIDTH) = (theme_color | chr);
29 if (TTY_COLUMN >= TTY_WIDTH) {
35 if (TTY_ROW >= TTY_HEIGHT) {
41 void tty_put_str(char* str) {
42 while (*str != '\0') {
48 void tty_scroll_up() {
53 for (uint32_t x = 0; x < TTY_WIDTH; x++) {
54 for (uint32_t y = 0; y < TTY_HEIGHT; y++) {
55 *(buffer + x + y * TTY_WIDTH) = theme_color;