diff --git a/applications/sh/commands/dir.asm b/applications/sh/commands/dir.asm index 01a9f45..cfd924c 100644 --- a/applications/sh/commands/dir.asm +++ b/applications/sh/commands/dir.asm @@ -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 diff --git a/applications/sh/commands/disk.asm b/applications/sh/commands/disk.asm index 0f3fc0f..c899aa5 100644 --- a/applications/sh/commands/disk.asm +++ b/applications/sh/commands/disk.asm @@ -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 diff --git a/applications/sh/commands/type.asm b/applications/sh/commands/type.asm index fec042e..e3b7371 100644 --- a/applications/sh/commands/type.asm +++ b/applications/sh/commands/type.asm @@ -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 diff --git a/applications/sh/launch.asm b/applications/sh/launch.asm index e583571..b3e0399 100644 --- a/applications/sh/launch.asm +++ b/applications/sh/launch.asm @@ -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 diff --git a/applications/sh/main.asm b/applications/sh/main.asm index ab24809..7d932be 100644 --- a/applications/sh/main.asm +++ b/applications/sh/main.asm @@ -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