git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement shift+<key> support, and ...
[lunaix-os.git]
/
lunaix-os
/
kernel
/
tty
/
tty.c
diff --git
a/lunaix-os/kernel/tty/tty.c
b/lunaix-os/kernel/tty/tty.c
index 1ad0dd47e0390aad672ecd180d09cf1239bde5a3..4a20a77b2a20885e514c589593186145ccfbacdc 100644
(file)
--- a/
lunaix-os/kernel/tty/tty.c
+++ b/
lunaix-os/kernel/tty/tty.c
@@
-1,17
+1,17
@@
-#include <libc/string.h>
+#include <
k
libc/string.h>
#include <lunaix/tty/tty.h>
#include <lunaix/tty/tty.h>
-#include <lunaix/co
nstants
.h>
+#include <lunaix/co
mmon
.h>
#include <stdint.h>
#define TTY_WIDTH 80
#define TTY_HEIGHT 25
#include <stdint.h>
#define TTY_WIDTH 80
#define TTY_HEIGHT 25
-vga_attribute* tty_vga_buffer = (vga_attribute*)VGA_BUFFER_PADDR;
+
static
vga_attribute* tty_vga_buffer = (vga_attribute*)VGA_BUFFER_PADDR;
-vga_attribute tty_theme_color = VGA_COLOR_BLACK;
+
static
vga_attribute tty_theme_color = VGA_COLOR_BLACK;
-uint32_t tty_x = 0;
-uint16_t tty_y = 0;
+
static
uint32_t tty_x = 0;
+
static
uint16_t tty_y = 0;
void tty_init(void* vga_buf) {
tty_vga_buffer = (vga_attribute*)vga_buf;
void tty_init(void* vga_buf) {
tty_vga_buffer = (vga_attribute*)vga_buf;
@@
-41,6
+41,10
@@
tty_put_char(char chr)
case '\r':
tty_x = 0;
break;
case '\r':
tty_x = 0;
break;
+ case '\x08':
+ tty_x = tty_x ? tty_x - 1 : 0;
+ *(tty_vga_buffer + tty_x + tty_y * TTY_WIDTH) = (tty_theme_color | 0x20);
+ break;
default:
*(tty_vga_buffer + tty_x + tty_y * TTY_WIDTH) = (tty_theme_color | chr);
tty_x++;
default:
*(tty_vga_buffer + tty_x + tty_y * TTY_WIDTH) = (tty_theme_color | chr);
tty_x++;
@@
-104,4
+108,9
@@
void
tty_get_cpos(unsigned int* x, unsigned int* y) {
*x = tty_x;
*y = tty_y;
tty_get_cpos(unsigned int* x, unsigned int* y) {
*x = tty_x;
*y = tty_y;
+}
+
+vga_attribute
+tty_get_theme() {
+ return tty_theme_color;
}
\ No newline at end of file
}
\ No newline at end of file