fox32os/applications/sh/commands/diskrm.asm
jn ffdda5eaca Make use of data.strz
The filesystem image is the same before and after this commit:

$ sha256sum fox32os-orig.img fox32os.img
abc77bd6310b8eb6bcde0a8a442ca8bab071307a6cf5155ea606578435f77d27  fox32os-orig.img
abc77bd6310b8eb6bcde0a8a442ca8bab071307a6cf5155ea606578435f77d27  fox32os.img


The conversion was performed with a few sed commands:

find -name '*.asm' | xargs sed -i -e 's/data.str \("[^"]*"\) data.8 0$/data.strz \1/g'
find -name '*.asm' | xargs sed -i -e 's/data.str \("[^"]*"\) data.8 0 /data.strz \1 /g'
find -name '*.asm' | xargs sed -i -e 's/data.str \("[^"]*"\) data.8 0x00 /data.strz \1 /g'
2023-02-02 03:03:07 +01:00

31 lines
596 B
NASM

; eject command
shell_diskrm_command_string: data.strz "diskrm"
shell_diskrm_command:
call shell_parse_arguments
mov r1, 10
call string_to_int
; r0: disk ID
; check if it's in range
cmp r0, 3
ifgt jmp shell_diskrm_command_out_of_range
; OR it with the IO port to remove a disk
or r0, 0x80005000
; remove disk
out r0, 0
ret
shell_diskrm_command_out_of_range:
mov r0, shell_diskrm_command_out_of_range_string
call print_str_to_terminal
ret
shell_diskrm_command_out_of_range_string: data.str "invalid disk ID" data.8 10 data.8 0