feature: functional shell with help and merdella commands
TOOD: reboot, poweroff, echo, color
This commit is contained in:
@ -129,3 +129,46 @@ void update_cursor(void)
|
||||
outb(0x3D4, 0x0E);
|
||||
outb(0x3D5, (pos >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
void move_cursor(int direction)
|
||||
{
|
||||
|
||||
switch (direction) {
|
||||
case LEFT:
|
||||
if (screen->column) {
|
||||
screen->column--;
|
||||
} else if (screen->row) {
|
||||
screen->column = VGA_WIDTH - 1;
|
||||
screen->row--;
|
||||
}
|
||||
break;
|
||||
case RIGHT:
|
||||
if (screen->column < VGA_WIDTH - 1) {
|
||||
screen->column++;
|
||||
} else if (screen->row < VGA_HEIGHT - 1) {
|
||||
screen->column = 0;
|
||||
screen->row++;
|
||||
} else {
|
||||
terminal_new_line();
|
||||
}
|
||||
break;
|
||||
case UP:
|
||||
break;
|
||||
case DOWN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint16_t pos = screen->row * VGA_WIDTH + screen->column;
|
||||
|
||||
outb(0x3D4, 0x0F);
|
||||
outb(0x3D5, pos & 0xFF);
|
||||
outb(0x3D4, 0x0E);
|
||||
outb(0x3D5, (pos >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
struct screen *get_screen(void)
|
||||
{
|
||||
return screen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user