2022-10-15 01:53:41 +02:00
|
|
|
; disk command
|
|
|
|
|
2023-02-02 00:08:22 +01:00
|
|
|
shell_disk_command_string: data.strz "disk"
|
2022-10-15 01:53:41 +02:00
|
|
|
|
|
|
|
shell_disk_command:
|
|
|
|
call shell_parse_arguments
|
|
|
|
mov r1, 10
|
|
|
|
call string_to_int
|
|
|
|
|
|
|
|
; r0: disk ID
|
|
|
|
|
|
|
|
; check if it's in range
|
2023-03-05 08:35:54 +01:00
|
|
|
cmp r0, 4
|
2022-10-15 01:53:41 +02:00
|
|
|
ifgt jmp shell_disk_command_out_of_range
|
2023-03-06 02:39:29 +01:00
|
|
|
ifnz jmp shell_disk_command_is_disk
|
2022-10-15 01:53:41 +02:00
|
|
|
|
2023-03-05 08:35:54 +01:00
|
|
|
call is_romdisk_available
|
|
|
|
ifnz ret
|
|
|
|
jmp shell_disk_command_is_romdisk
|
|
|
|
shell_disk_command_is_disk:
|
2022-10-15 01:53:41 +02:00
|
|
|
; OR it with the IO port to get the current insert state of a disk
|
|
|
|
or r0, 0x80001000
|
|
|
|
in r1, r0
|
|
|
|
cmp r1, 0
|
2022-12-27 03:26:27 +01:00
|
|
|
ifz ret
|
2023-03-05 08:35:54 +01:00
|
|
|
shell_disk_command_is_romdisk:
|
2022-10-15 01:53:41 +02:00
|
|
|
; set the current disk ID
|
2023-03-05 08:35:54 +01:00
|
|
|
call set_current_disk_id
|
2022-10-15 01:53:41 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
shell_disk_command_out_of_range:
|
|
|
|
mov r0, shell_disk_command_out_of_range_string
|
|
|
|
call print_str_to_terminal
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
shell_disk_command_out_of_range_string: data.str "invalid disk ID" data.8 10 data.8 0
|