1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Allow more chars in filenames

git-svn-id: svn://svn.cc65.org/cc65/trunk@1541 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-11-18 19:37:02 +00:00
parent 3a95ae002b
commit ca905a8705

View File

@ -74,16 +74,23 @@ nameloop:
lda (ptr1),y ; Get next char from filename lda (ptr1),y ; Get next char from filename
beq namedone ; Jump if end of name reached beq namedone ; Jump if end of name reached
; Check for valid chars in the file name ; Check for valid chars in the file name. We allow letters, digits, plus some
; additional chars from a table.
ldx #fncharcount-1
namecheck:
cmp fnchars,x
beq nameok
dex
bpl namecheck
tax tax
lda __ctype,x lda __ctype,x
and #CT_ALNUM ; Letters and digits are allowed and #(CT_LOWER|CT_DIGIT)
beq invalidname beq invalidname
; Check the maximum length, store the character ; Check the maximum length, store the character
ldx fnlen nameok: ldx fnlen
cpx #14 ; Maximum length reached? cpx #14 ; Maximum length reached?
bcs invalidname bcs invalidname
lda (ptr1),y ; Reload char lda (ptr1),y ; Reload char
@ -154,5 +161,9 @@ fnlen: .res 1
fncmd: .byte 's' ; Use as scratch command fncmd: .byte 's' ; Use as scratch command
fnbuf: .res 20 fnbuf: .res 20
.rodata
; Characters that are ok in filenames besides digits and letters
fnchars:.byte ".,-_+()"
fncharcount = *-fnchars