sh/dir: Add a space between the file name and type, and show a header

This commit is contained in:
Ry 2023-02-04 16:37:34 -08:00
parent f37c9b37bd
commit 6c4790cd5f

View File

@ -3,6 +3,9 @@
shell_dir_command_string: data.strz "dir" shell_dir_command_string: data.strz "dir"
shell_dir_command: shell_dir_command:
mov r0, shell_dir_command_header_string
call print_str_to_terminal
mov r0, shell_dir_command_list_buffer mov r0, shell_dir_command_list_buffer
movz.8 r1, [shell_current_disk] movz.8 r1, [shell_current_disk]
call ryfs_get_file_list call ryfs_get_file_list
@ -16,15 +19,33 @@ shell_dir_command_loop:
mov r0, shell_dir_command_list_buffer mov r0, shell_dir_command_list_buffer
add r0, r3 add r0, r3
mov r1, shell_dir_command_file_buffer mov r1, shell_dir_command_file_buffer
mov r2, 11 mov r2, 8
call copy_memory_bytes call copy_memory_bytes
add r1, 11 add r1, 8
mov.8 [r1], 0 mov.8 [r1], 0
; then print the file name to the terminal ; copy file type from the list buffer to the type buffer
mov r0, shell_dir_command_list_buffer
add r0, r3
add r0, 8
mov r1, shell_dir_command_type_buffer
mov r2, 3
call copy_memory_bytes
add r1, 3
mov.8 [r1], 0
; print the file name to the terminal
mov r0, shell_dir_command_file_buffer mov r0, shell_dir_command_file_buffer
call print_str_to_terminal call print_str_to_terminal
; space
mov r0, ' '
call print_character_to_terminal
; print the file type to the terminal
mov r0, shell_dir_command_type_buffer
call print_str_to_terminal
; new line ; new line
mov r0, 10 mov r0, 10
call print_character_to_terminal call print_character_to_terminal
@ -36,4 +57,10 @@ shell_dir_command_loop:
ret ret
shell_dir_command_list_buffer: data.fill 0, 341 shell_dir_command_list_buffer: data.fill 0, 341
shell_dir_command_file_buffer: data.fill 0, 12 shell_dir_command_file_buffer: data.fill 0, 9
shell_dir_command_type_buffer: data.fill 0, 4
shell_dir_command_header_string:
data.8 SET_COLOR data.8 0x20 data.8 1 ; set the color to green
data.str "file type" data.8 10
data.8 SET_COLOR data.8 0x70 data.8 1 ; set the color to white
data.8 0