From d57e17394c53b43741cead1e97ef6d1d2f34023c Mon Sep 17 00:00:00 2001 From: Eduardo Casino Date: Sun, 20 Jul 2025 23:18:00 +0200 Subject: [PATCH 1/4] Add /S option to K-1013 version of IMU.COM --- src/arch/kim-1/k-1013.inc | 1 + src/arch/kim-1/utils/imu-k1013.S | 28 ++++++++++++++++++++++------ src/arch/kim-1/utils/imu-sdshield.S | 3 --- src/arch/kim-1/utils/imu.S | 4 ++++ 4 files changed, 27 insertions(+), 9 deletions(-) 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..b5faf03d 100644 --- a/src/arch/kim-1/utils/imu-k1013.S +++ b/src/arch/kim-1/utils/imu-k1013.S @@ -314,13 +314,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. @@ -741,7 +757,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" From 6bd40fe6cca9243f963f8682c1bf8dde1eb1c794 Mon Sep 17 00:00:00 2001 From: Eduardo Casino Date: Sun, 20 Jul 2025 23:26:46 +0200 Subject: [PATCH 2/4] Update IMU manual page --- src/arch/kim-1/cpmfs/imu.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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. From bc2a5b788924434a927b385968b677e17bab997d Mon Sep 17 00:00:00 2001 From: Eduardo Casino Date: Mon, 28 Jul 2025 11:45:11 +0200 Subject: [PATCH 3/4] Fix IMU /N --- src/arch/kim-1/utils/imu-k1013.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/kim-1/utils/imu-k1013.S b/src/arch/kim-1/utils/imu-k1013.S index b5faf03d..292bbc5e 100644 --- a/src/arch/kim-1/utils/imu-k1013.S +++ b/src/arch/kim-1/utils/imu-k1013.S @@ -392,7 +392,7 @@ zproc create_image ; Set buffer for sending mount info - lda #BUFFER_DMA + lda #DMA_AREA sta ADMA ; Prepare the command data From 2095b008880cd08b7659208d36a003adfc4e6066 Mon Sep 17 00:00:00 2001 From: eduardocasino Date: Sat, 4 Apr 2026 21:43:14 +0200 Subject: [PATCH 4/4] Fix some messages --- src/arch/kim-1/utils/imu-k1013.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/arch/kim-1/utils/imu-k1013.S b/src/arch/kim-1/utils/imu-k1013.S index 292bbc5e..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 @@ -441,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 @@ -509,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