feature: clear added to the shell
This commit is contained in:
parent
a02931a165
commit
e316910581
@ -49,13 +49,14 @@ typedef enum {
|
|||||||
POWEROFF,
|
POWEROFF,
|
||||||
HALT,
|
HALT,
|
||||||
STACK,
|
STACK,
|
||||||
|
CLEAR,
|
||||||
ECHO,
|
ECHO,
|
||||||
COLOR,
|
COLOR,
|
||||||
MERDELLA,
|
MERDELLA,
|
||||||
ERROR
|
ERROR
|
||||||
} CMD_TOK;
|
} CMD_TOK;
|
||||||
|
|
||||||
|
void shell_init(void);
|
||||||
void reboot(void);
|
void reboot(void);
|
||||||
void halt(void);
|
void halt(void);
|
||||||
void shell_init(void);
|
|
||||||
void print_stack(void);
|
void print_stack(void);
|
||||||
|
@ -46,6 +46,7 @@ int terminal_write(const char *data, size_t size);
|
|||||||
int terminal_writestring(const char *data);
|
int terminal_writestring(const char *data);
|
||||||
int terminal_writelong(long number);
|
int terminal_writelong(long number);
|
||||||
void terminal_set_screen(int pos);
|
void terminal_set_screen(int pos);
|
||||||
|
void terminal_clear(void);
|
||||||
struct key_event terminal_getkey(void);
|
struct key_event terminal_getkey(void);
|
||||||
void update_cursor(void);
|
void update_cursor(void);
|
||||||
void move_cursor(int direction);
|
void move_cursor(int direction);
|
||||||
|
@ -31,6 +31,8 @@ static CMD_TOK find_command(char *line)
|
|||||||
command = HALT;
|
command = HALT;
|
||||||
else if (!strcmp(line, "stack"))
|
else if (!strcmp(line, "stack"))
|
||||||
command = STACK;
|
command = STACK;
|
||||||
|
else if (!strcmp(line, "clear"))
|
||||||
|
command = CLEAR;
|
||||||
else if (!strcmp(line, "echo"))
|
else if (!strcmp(line, "echo"))
|
||||||
command = ECHO;
|
command = ECHO;
|
||||||
else if (!strcmp(line, "color"))
|
else if (!strcmp(line, "color"))
|
||||||
@ -100,6 +102,9 @@ void shell_init(void)
|
|||||||
case STACK:
|
case STACK:
|
||||||
print_stack();
|
print_stack();
|
||||||
break;
|
break;
|
||||||
|
case CLEAR:
|
||||||
|
terminal_clear();
|
||||||
|
break;
|
||||||
case ECHO:
|
case ECHO:
|
||||||
kprintf(0, "echoing\n");
|
kprintf(0, "echoing\n");
|
||||||
break;
|
break;
|
||||||
|
@ -76,6 +76,19 @@ static void terminal_new_line(void)
|
|||||||
terminal_scroll();
|
terminal_scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void terminal_clear(void)
|
||||||
|
{
|
||||||
|
for (size_t y = 0; y < VGA_HEIGHT; y++) {
|
||||||
|
for (size_t x = 0; x < VGA_WIDTH; x++) {
|
||||||
|
const size_t index = y * VGA_WIDTH + x;
|
||||||
|
TERM_BUF[index] = vga_entry(' ', VGA_COLOR_WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy(screen->buffer, TERM_BUF, sizeof(screen->buffer));
|
||||||
|
screen->column = 0;
|
||||||
|
screen->row = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int terminal_putchar(char c)
|
int terminal_putchar(char c)
|
||||||
{
|
{
|
||||||
if (c == '\r')
|
if (c == '\r')
|
||||||
|
Loading…
Reference in New Issue
Block a user