sh: Add rdall command

This commit is contained in:
Ry 2023-04-02 13:09:32 -07:00
parent 3870289252
commit 7a2f96717e
4 changed files with 34 additions and 1 deletions

View File

@ -36,6 +36,11 @@ shell_parse_command:
call compare_string call compare_string
ifz jmp shell_help_command ifz jmp shell_help_command
; rdall
mov r1, shell_rdall_command_string
call compare_string
ifz jmp shell_rdall_command
; rdnext ; rdnext
mov r1, shell_rdnext_command_string mov r1, shell_rdnext_command_string
call compare_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/diskrm.asm"
#include "commands/exit.asm" #include "commands/exit.asm"
#include "commands/help.asm" #include "commands/help.asm"
#include "commands/rdall.asm"
#include "commands/rdnext.asm" #include "commands/rdnext.asm"
#include "commands/shutdown.asm" #include "commands/shutdown.asm"
#include "commands/type.asm" #include "commands/type.asm"

View File

@ -22,6 +22,7 @@ shell_help_text:
data.str "diskrm | remove disk $0" data.8 10 data.str "diskrm | remove disk $0" data.8 10
data.str "exit | exit the shell" data.8 10 data.str "exit | exit the shell" data.8 10
data.str "help | show this help text" 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 "rdnext | redirect the next command's IO" data.8 10
data.str "shutdown| turn the computer off" data.8 10 data.str "shutdown| turn the computer off" data.8 10
data.str "type | print contents of file $0" data.8 10 data.str "type | print contents of file $0" data.8 10

View File

@ -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

View File

@ -26,4 +26,4 @@ shell_rdnext_command_failed_to_open:
call print_str_to_terminal call print_str_to_terminal
ret 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