From c6919d4168e039c7704b65bbcd29a6213a8abf4b Mon Sep 17 00:00:00 2001 From: Ry Date: Fri, 25 Nov 2022 17:21:28 -0800 Subject: [PATCH] shell: Add `clear` command --- kernel/shell/commands/clear.asm | 22 ++++++++++++++++++++++ kernel/shell/commands/commands.asm | 6 ++++++ kernel/shell/commands/help.asm | 1 + 3 files changed, 29 insertions(+) create mode 100644 kernel/shell/commands/clear.asm diff --git a/kernel/shell/commands/clear.asm b/kernel/shell/commands/clear.asm new file mode 100644 index 0000000..4fd1069 --- /dev/null +++ b/kernel/shell/commands/clear.asm @@ -0,0 +1,22 @@ +; clear command + +const FILL_TERM: 0xF0 +const MOVE_CURSOR: 0xF1 + +shell_clear_command_string: data.str "clear" data.8 0 + +shell_clear_command: + movz.8 r0, FILL_TERM + call print_character_to_terminal + movz.8 r0, 0 + call print_character_to_terminal + call print_character_to_terminal + + movz.8 r0, MOVE_CURSOR + call print_character_to_terminal + movz.8 r0, 0 + call print_character_to_terminal + movz.8 r0, 0 + call print_character_to_terminal + + ret diff --git a/kernel/shell/commands/commands.asm b/kernel/shell/commands/commands.asm index d6b976e..af40a13 100644 --- a/kernel/shell/commands/commands.asm +++ b/kernel/shell/commands/commands.asm @@ -3,6 +3,11 @@ shell_parse_command: mov r0, shell_text_buf_bottom + ; clear + mov r1, shell_clear_command_string + call compare_string + ifz jmp shell_clear_command + ; dir mov r1, shell_dir_command_string call compare_string @@ -45,6 +50,7 @@ shell_parse_command: shell_invalid_command_string: data.str "invalid command or FXF binary" data.8 10 data.8 0 ; all commands + #include "shell/commands/clear.asm" #include "shell/commands/dir.asm" #include "shell/commands/disk.asm" #include "shell/commands/diskrm.asm" diff --git a/kernel/shell/commands/help.asm b/kernel/shell/commands/help.asm index 4d45a67..2cd8f63 100644 --- a/kernel/shell/commands/help.asm +++ b/kernel/shell/commands/help.asm @@ -14,6 +14,7 @@ shell_help_text: data.str "(in descriptions, $n is argument n)" data.8 10 data.str "command | description" data.8 10 data.str "------- | -----------" data.8 10 + data.str "clear | clear the terminal contents" data.8 10 data.str "dir | show contents of selected disk" data.8 10 data.str "disk | select disk $0" data.8 10 data.str "diskrm | remove disk $0" data.8 10