From 0305d5751b11b0b75624fb2197956302dcba2296 Mon Sep 17 00:00:00 2001 From: Ry Date: Sat, 4 May 2024 12:52:36 -0700 Subject: [PATCH] sh: `del` command --- applications/sh/commands/commands.asm | 6 ++++++ applications/sh/commands/del.asm | 21 +++++++++++++++++++++ applications/sh/commands/help.asm | 1 + 3 files changed, 28 insertions(+) create mode 100644 applications/sh/commands/del.asm diff --git a/applications/sh/commands/commands.asm b/applications/sh/commands/commands.asm index d8efe72..e11d496 100644 --- a/applications/sh/commands/commands.asm +++ b/applications/sh/commands/commands.asm @@ -11,6 +11,11 @@ shell_parse_command: call compare_string ifz jmp shell_clear_command + ; del + mov r1, shell_del_command_string + call compare_string + ifz jmp shell_del_command + ; dir mov r1, shell_dir_command_string call compare_string @@ -74,6 +79,7 @@ shell_invalid_command_string: data.str "invalid command or FXF binary" data.8 10 ; all commands #include "commands/clear.asm" + #include "commands/del.asm" #include "commands/dir.asm" #include "commands/disk.asm" #include "commands/diskrm.asm" diff --git a/applications/sh/commands/del.asm b/applications/sh/commands/del.asm new file mode 100644 index 0000000..07a44d2 --- /dev/null +++ b/applications/sh/commands/del.asm @@ -0,0 +1,21 @@ +; del command + +shell_del_command_string: data.strz "del" + +shell_del_command: + call shell_parse_arguments + + mov r3, r0 + + call get_current_disk_id + mov r1, r0 + mov r0, r3 + mov r2, shell_type_command_file_struct + call open + cmp r0, 0 + ifz jmp shell_type_command_file_not_found + + mov r0, shell_type_command_file_struct + call delete + + ret diff --git a/applications/sh/commands/help.asm b/applications/sh/commands/help.asm index 7048997..8d2d200 100644 --- a/applications/sh/commands/help.asm +++ b/applications/sh/commands/help.asm @@ -17,6 +17,7 @@ shell_help_text: data.str "command | description" data.8 10 data.str "------- | -----------" data.8 10 data.str "clear | clear the terminal contents" data.8 10 + data.str "del | delete file $0" 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