sh: Use the "current" disk id

This commit is contained in:
Ry 2023-03-04 23:35:54 -08:00
parent 31b19537c8
commit ebbc2fa81e
5 changed files with 17 additions and 10 deletions

View File

@ -6,8 +6,9 @@ shell_dir_command:
mov r0, shell_dir_command_header_string
call print_str_to_terminal
call get_current_disk_id
mov r1, r0
mov r0, shell_dir_command_list_buffer
movz.8 r1, [shell_current_disk]
call ryfs_get_file_list
cmp r0, 0
ifz ret
@ -52,9 +53,10 @@ shell_dir_command_loop:
call print_character_to_terminal
; get and print the file size
call get_current_disk_id
mov r1, r0
mov r0, shell_dir_command_list_buffer
add r0, r3
movz.8 r1, [shell_current_disk]
mov r2, shell_dir_command_temp_file_struct
call open
cmp r0, 0

View File

@ -10,17 +10,22 @@ shell_disk_command:
; r0: disk ID
; check if it's in range
cmp r0, 3
cmp r0, 4
ifgt jmp shell_disk_command_out_of_range
ifz jmp shell_disk_command_is_disk
call is_romdisk_available
ifnz ret
jmp shell_disk_command_is_romdisk
shell_disk_command_is_disk:
; OR it with the IO port to get the current insert state of a disk
or r0, 0x80001000
in r1, r0
cmp r1, 0
ifz ret
shell_disk_command_is_romdisk:
; set the current disk ID
mov.8 [shell_current_disk], r0
call set_current_disk_id
ret

View File

@ -31,8 +31,9 @@ shell_type_command:
mov.8 [r1], 0
; open the file
call get_current_disk_id
mov r1, r0
mov r0, shell_type_command_file
movz.8 r1, [shell_current_disk]
mov r2, shell_type_command_file_struct
call open
cmp r0, 0

View File

@ -35,8 +35,9 @@ launch_fxf_name_loop:
loop launch_fxf_name_loop
launch_fxf_name_loop_done:
; open the file
call get_current_disk_id
mov r1, r0
mov r0, launch_fxf_name
movz.8 r1, [shell_current_disk]
mov r2, launch_fxf_struct
call open
cmp r0, 0

View File

@ -95,7 +95,7 @@ shell_key_down_backspace:
ret
shell_print_prompt:
movz.8 r0, [shell_current_disk]
call get_current_disk_id
add r0, '0'
call print_character_to_terminal
mov r0, shell_prompt
@ -309,8 +309,6 @@ shell_text_buf_top:
shell_text_buf_ptr: data.32 0 ; pointer to the current input character
shell_args_ptr: data.32 0 ; pointer to the beginning of the command arguments
shell_current_disk: data.8 0
shell_prompt: data.str "> " data.8 CURSOR data.8 0
shell_terminal_stream_struct_ptr: data.32 0