From f92a72bf1fdbdcbfc6e3a05acaaff17e6f188085 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 18 Mar 2022 21:35:04 -0700 Subject: [PATCH] Add constant for max filename length. No binary change. --- common.inc | 1 + desk.acc/find.files.s | 2 +- desktop/main.s | 6 +++--- desktop/ovl_format_erase.s | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common.inc b/common.inc index d219ac01..e642ea36 100644 --- a/common.inc +++ b/common.inc @@ -35,6 +35,7 @@ SELF_MODIFIED_BYTE = $12 kMaxPathLength = 64 kPathBufferSize = 65 kDirStackBufferSize = 170 +kMaxFilenameLength = 15 ;;; ============================================================ diff --git a/desk.acc/find.files.s b/desk.acc/find.files.s index 2262fb27..cd77a961 100644 --- a/desk.acc/find.files.s +++ b/desk.acc/find.files.s @@ -1188,7 +1188,7 @@ ignore_char: lda buf_left clc adc buf_right - cmp #15 ; max length is 15 + cmp #kMaxFilenameLength bcs ret jsr HideIP ; Insert diff --git a/desktop/main.s b/desktop/main.s index 5caef0d2..7ef74866 100644 --- a/desktop/main.s +++ b/desktop/main.s @@ -3307,7 +3307,7 @@ not_file_char: file_char: ldx typedown_buf - cpx #15 + cpx #kMaxFilenameLength bne :+ rts ; Z=1 to consume : @@ -15142,7 +15142,7 @@ LAEC6: jsr PromptInputLoop jsr InputFieldIPEnd lda path_buf1 beq LAEC6 - cmp #16 ; max filename length + 1 + cmp #kMaxFilenameLength+1 bcc LAEE1 LAED6: lda #kErrNameTooLong jsr ShowAlert @@ -16226,7 +16226,7 @@ ip_pos: .word 0 lda path_buf1 clc adc path_buf2 - cmp #15 + cmp #kMaxFilenameLength bcs ret jsr HidePromptIP ; Insert diff --git a/desktop/ovl_format_erase.s b/desktop/ovl_format_erase.s index d21e2453..1a463c43 100644 --- a/desktop/ovl_format_erase.s +++ b/desktop/ovl_format_erase.s @@ -105,7 +105,7 @@ l5: jsr Bell l6: jsr main::InputFieldIPEnd lda path_buf1 beq l5 ; name is empty - cmp #16 + cmp #kMaxFilenameLength+1 bcs l5 ; name > 15 characters jsr main::SetCursorPointerWithFlag @@ -266,7 +266,7 @@ l4: jsr Bell l5: jsr main::InputFieldIPEnd lda path_buf1 beq l4 ; name is empty - cmp #$10 + cmp #kMaxFilenameLength+1 bcs l4 ; name > 15 characters jsr main::SetCursorPointerWithFlag