@@ -291,6 +291,7 @@ zproc unmount_drive
291291
292292 ; Dig further for errors
293293
294+ lda disk_status ; Check for success
294295 and #ST4_ABNORMAL_TERM
295296 zif ne
296297 lda disk_status+1
@@ -314,13 +315,29 @@ zproc unmount_drive
314315 jmp inf_done
315316zendproc
316317
317- ; Update config to flash. Not yet supported
318+ ; Update the SD config file with the latest mounted drives
319+ ; situation. Issues warning if the file could not be
320+ ; updated.
318321;
319322zproc save_config
320- lda #<unknown_msg
321- ldy #>unknown_msg
322- jsr err_withchar
323- jmp err_usage
323+
324+ ldy #EXT_CMD_SAV
325+ jsr fdc_exec_extended ; Exec SD mounts config save
326+ zif cs
327+ lda #<fdc_msg
328+ ldx #>fdc_msg
329+ jmp err_withmsg ; Controller error
330+ zendif
331+
332+ lda disk_status ; Check for success
333+ and #ST4_ABNORMAL_TERM
334+ zif ne
335+ lda #<config_msg
336+ ldx #>config_msg
337+ jmp err_withmsg
338+ zendif
339+
340+ jmp inf_done
324341zendproc
325342
326343; Create an empty image on the SD card.
@@ -376,7 +393,7 @@ zproc create_image
376393
377394 ; Set buffer for sending mount info
378395
379- lda #BUFFER_DMA
396+ lda #DMA_AREA
380397 sta ADMA
381398
382399 ; Prepare the command data
@@ -425,7 +442,7 @@ zproc create_image
425442 zendif
426443 ; If we are here, there was an unexpected error
427444 lda #<generic_msg
428- ldy #>generic_msg
445+ ldx #>generic_msg
429446 jmp err_withmsg
430447 zendif
431448
@@ -493,7 +510,7 @@ zproc delete_file
493510 zendif
494511 ; If we are here, there was an unexpected error
495512 lda #<generic_msg
496- ldy #>generic_msg
513+ ldx #>generic_msg
497514 jmp err_withmsg
498515 zendif
499516
@@ -741,7 +758,7 @@ disk_status: .fill 8 ; Result phase readouts from NEC-765
741758
742759 .global usage_msg
743760
744- usage_msg: .ascii "Usage: imu [/L ]\r\n"
761+ usage_msg: .ascii "Usage: imu [{/L | /S} ]\r\n"
745762 .ascii " imu /M <drive> [/O]\r\n"
746763 .ascii " imu /U <drive>\r\n"
747764 .ascii " imu /N <image> [/P]\r\n"
0 commit comments