Skip to content

Commit

Permalink
Workaround for leading slashes in the current directory issue (#14)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
cristianoag and Konamiman authored Jan 5, 2025
1 parent 9ea1ebf commit a0761c9
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions msx/bank1/boot_menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -1736,7 +1767,6 @@ _BM_CALC_DIR_LEVEL_END:

ret


;--- Try opening the initial directory
; Output: A = 0 if ok, 1 if error

Expand Down Expand Up @@ -1834,7 +1864,7 @@ BM_RESETTING_S:
db "Resetting computer...",0

BM_DOTS_BAR_S:
db "/.../",0
db ".../",0

BM_DOTDOT_S:
db "..",0
Expand Down Expand Up @@ -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
BM_VARS_LEN: equ BM_VARS_END-BM_VARS_START

0 comments on commit a0761c9

Please sign in to comment.