diff --git a/applications/sh/commands/commands.asm b/applications/sh/commands/commands.asm index ddef996..710b567 100644 --- a/applications/sh/commands/commands.asm +++ b/applications/sh/commands/commands.asm @@ -36,6 +36,11 @@ shell_parse_command: call compare_string ifz jmp shell_help_command + ; rdall + mov r1, shell_rdall_command_string + call compare_string + ifz jmp shell_rdall_command + ; rdnext mov r1, shell_rdnext_command_string call compare_string @@ -69,6 +74,7 @@ shell_invalid_command_string: data.str "invalid command or FXF binary" data.8 10 #include "commands/diskrm.asm" #include "commands/exit.asm" #include "commands/help.asm" + #include "commands/rdall.asm" #include "commands/rdnext.asm" #include "commands/shutdown.asm" #include "commands/type.asm" diff --git a/applications/sh/commands/help.asm b/applications/sh/commands/help.asm index c74d5d4..cdf8cec 100644 --- a/applications/sh/commands/help.asm +++ b/applications/sh/commands/help.asm @@ -22,6 +22,7 @@ shell_help_text: data.str "diskrm | remove disk $0" data.8 10 data.str "exit | exit the shell" data.8 10 data.str "help | show this help text" data.8 10 + data.str "rdall | redirect all IO to $0" data.8 10 data.str "rdnext | redirect the next command's IO" data.8 10 data.str "shutdown| turn the computer off" data.8 10 data.str "type | print contents of file $0" data.8 10 diff --git a/applications/sh/commands/rdall.asm b/applications/sh/commands/rdall.asm new file mode 100644 index 0000000..78cbf1e --- /dev/null +++ b/applications/sh/commands/rdall.asm @@ -0,0 +1,26 @@ +; rdall command + +shell_rdall_command_string: data.strz "rdall" + +shell_rdall_command: + call shell_parse_arguments + push r0 + call get_current_disk_id + mov r1, r0 + pop r0 + mov r2, shell_redirect_stream_struct + call open + cmp r0, 0 + ifz jmp shell_rdall_command_failed_to_open + + mov.8 [shell_redirect_next], 0 + mov [shell_stream_struct_ptr], shell_redirect_stream_struct + + ret + +shell_rdall_command_failed_to_open: + mov r0, shell_rdnext_command_failed_to_open_string + call print_str_to_terminal + ret + +shell_rdall_command_failed_to_open_string: data.str "failed to open file/stream for redirect" data.8 10 data.8 0 diff --git a/applications/sh/commands/rdnext.asm b/applications/sh/commands/rdnext.asm index 296a20c..415344f 100644 --- a/applications/sh/commands/rdnext.asm +++ b/applications/sh/commands/rdnext.asm @@ -26,4 +26,4 @@ shell_rdnext_command_failed_to_open: call print_str_to_terminal ret -shell_rdnext_command_failed_to_open_string: data.str "failed to open file for redirect" data.8 10 data.8 0 +shell_rdnext_command_failed_to_open_string: data.str "failed to open file/stream for redirect" data.8 10 data.8 0