diff --git a/src/arch/kim-1/cpmfs/imu.txt b/src/arch/kim-1/cpmfs/imu.txt index 77df50fa..bc08c3fc 100644 --- a/src/arch/kim-1/cpmfs/imu.txt +++ b/src/arch/kim-1/cpmfs/imu.txt @@ -1,7 +1,7 @@ Image Manipulation Utility ========================== -Usage: imu [/L] +Usage: imu [{/L | /S}] imu /M [/O] imu /U imu /N [/P] @@ -15,6 +15,8 @@ Options /L - Lists the available disk images on the SD card. +/S - Saves the current mounts to the SD card config file. + /M [/O] - Mounts into . Option /O makes it read-only. diff --git a/src/arch/kim-1/k-1013.inc b/src/arch/kim-1/k-1013.inc index 6e316c2b..69072185 100644 --- a/src/arch/kim-1/k-1013.inc +++ b/src/arch/kim-1/k-1013.inc @@ -35,6 +35,7 @@ EXT_CMD_CPY = 0b00011000 EXT_CMD_MOV = 0b00011100 EXT_CMD_MNT = 0b00100000 EXT_CMD_UMNT = 0b00100100 +EXT_CMD_SAV = 0b00101000 ST4_UNSUPPORTED = 0b10000000 ST4_ABNORMAL_TERM = 0b01000000 diff --git a/src/arch/kim-1/utils/imu-k1013.S b/src/arch/kim-1/utils/imu-k1013.S index 16b5a0a9..1338aac4 100644 --- a/src/arch/kim-1/utils/imu-k1013.S +++ b/src/arch/kim-1/utils/imu-k1013.S @@ -291,6 +291,7 @@ zproc unmount_drive ; Dig further for errors + lda disk_status ; Check for success and #ST4_ABNORMAL_TERM zif ne lda disk_status+1 @@ -314,13 +315,29 @@ zproc unmount_drive jmp inf_done zendproc -; Update config to flash. Not yet supported +; Update the SD config file with the latest mounted drives +; situation. Issues warning if the file could not be +; updated. ; zproc save_config - lda #unknown_msg - jsr err_withchar - jmp err_usage + + ldy #EXT_CMD_SAV + jsr fdc_exec_extended ; Exec SD mounts config save + zif cs + lda #fdc_msg + jmp err_withmsg ; Controller error + zendif + + lda disk_status ; Check for success + and #ST4_ABNORMAL_TERM + zif ne + lda #config_msg + jmp err_withmsg + zendif + + jmp inf_done zendproc ; Create an empty image on the SD card. @@ -376,7 +393,7 @@ zproc create_image ; Set buffer for sending mount info - lda #BUFFER_DMA + lda #DMA_AREA sta ADMA ; Prepare the command data @@ -425,7 +442,7 @@ zproc create_image zendif ; If we are here, there was an unexpected error lda #generic_msg + ldx #>generic_msg jmp err_withmsg zendif @@ -493,7 +510,7 @@ zproc delete_file zendif ; If we are here, there was an unexpected error lda #generic_msg + ldx #>generic_msg jmp err_withmsg zendif @@ -741,7 +758,7 @@ disk_status: .fill 8 ; Result phase readouts from NEC-765 .global usage_msg -usage_msg: .ascii "Usage: imu [/L]\r\n" +usage_msg: .ascii "Usage: imu [{/L | /S}]\r\n" .ascii " imu /M [/O]\r\n" .ascii " imu /U \r\n" .ascii " imu /N [/P]\r\n" diff --git a/src/arch/kim-1/utils/imu-sdshield.S b/src/arch/kim-1/utils/imu-sdshield.S index 6effb7c6..c4dcd60d 100644 --- a/src/arch/kim-1/utils/imu-sdshield.S +++ b/src/arch/kim-1/utils/imu-sdshield.S @@ -609,8 +609,5 @@ imagerr_msg: .ascii "Image name must be in 8.3 format.\r\n" disabled_msg: .ascii "Disabled by hardware. Please flip option switch 2.\r\n" .byte 0 -config_msg: .ascii "Can't update the SD config file.\r\n" - .byte 0 - working_msg: .ascii "On it. May take a while...\r\n" .byte 0 diff --git a/src/arch/kim-1/utils/imu.S b/src/arch/kim-1/utils/imu.S index aaebbcb5..b4119bde 100644 --- a/src/arch/kim-1/utils/imu.S +++ b/src/arch/kim-1/utils/imu.S @@ -481,6 +481,7 @@ zendproc .global unknown_msg, invalid_msg, mounterr_msg, mountederr_msg .global unmnterr_msg, notmntederr_msg, generic_msg, exists_msg + .global config_msg error_msg: .ascii "Error: " .byte 0 @@ -531,6 +532,9 @@ imgmounted_msg: .ascii "Error: Image file '" imgmounted_msg2:.ascii "' already mounted.\r\n" .byte 0 +config_msg: .ascii "Can't update the SD config file.\r\n" + .byte 0 + warning_msg: .ascii "Warning: About to delete file '" .byte 0 warning_msg2: .ascii "'.\r\n"