From a0761c94b2cabc2083b4b55419235c79f7048cbc Mon Sep 17 00:00:00 2001 From: Cristiano Goncalves Date: Sun, 5 Jan 2025 18:08:37 -0300 Subject: [PATCH] Workaround for leading slashes in the current directory issue (#14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Workaround for leading slashes in the current directory issue * Fix for long current directory string in the boot menu Top header separator line was erased when the length of the current directory was axactly 40 characters. --------- Co-authored-by: NĂ©stor Soriano --- msx/bank1/boot_menu.asm | 42 +++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/msx/bank1/boot_menu.asm b/msx/bank1/boot_menu.asm index ea7801b..ad6408c 100644 --- a/msx/bank1/boot_menu.asm +++ b/msx/bank1/boot_menu.asm @@ -1313,18 +1313,49 @@ BM_PRINT_CUR_DIR: call CHPUT ld a,(iy+BM_CUR_DIR_LENGTH) - cp 40 + cp 39 jr c,_BM_PRINT_CUR_DIR_DIRECT ld hl,BM_DOTS_BAR_S call PRINT + ; Skip leading slash in the last directory part, then print it call BM_GET_LAST_DIR_PNT - call PRINT - jr _BM_PRINT_CUR_DIR_END + jr _BM_PRINT_CUR_DIR_TRUNC _BM_PRINT_CUR_DIR_DIRECT: call BM_GET_CUR_DIR_ADD +_BM_SKIP_LEADING_SLASH: + ld a,(hl) + cp "/" + jr nz,_BM_PRINT_CUR_DIR_PRINT + inc hl + jr _BM_SKIP_LEADING_SLASH + +_BM_PRINT_CUR_DIR_PRINT: + ld a,(hl) + or a + jr z,_BM_PRINT_CUR_DIR_END ; If empty, done (just "/") + + ; Print whatever is left + call PRINT + jr _BM_PRINT_CUR_DIR_END + +_BM_PRINT_CUR_DIR_TRUNC: + ; By default, BM_GET_LAST_DIR_PNT leaves HL pointing + ; at the final name in the path, but let's skip slashes just in case + +_BM_SKIP_LEADING_SLASH_2: + ld a,(hl) + cp "/" + jr nz,_BM_PRINT_CUR_DIR_TRUNC_PRINT + inc hl + jr _BM_SKIP_LEADING_SLASH_2 + +_BM_PRINT_CUR_DIR_TRUNC_PRINT: + ld a,(hl) + or a + jr z,_BM_PRINT_CUR_DIR_END ; If empty, done (just "/.../") call PRINT _BM_PRINT_CUR_DIR_END: @@ -1736,7 +1767,6 @@ _BM_CALC_DIR_LEVEL_END: ret - ;--- Try opening the initial directory ; Output: A = 0 if ok, 1 if error @@ -1834,7 +1864,7 @@ BM_RESETTING_S: db "Resetting computer...",0 BM_DOTS_BAR_S: - db "/.../",0 + db ".../",0 BM_DOTDOT_S: db "..",0 @@ -1957,4 +1987,4 @@ BM_WHERE_CALLED_FROM: equ BM_TEMP+2 BM_BUF: equ BM_WHERE_CALLED_FROM+1 BM_VARS_END: equ BM_BUF+64 -BM_VARS_LEN: equ BM_VARS_END-BM_VARS_START \ No newline at end of file +BM_VARS_LEN: equ BM_VARS_END-BM_VARS_START