# HG changeset patch # User Daniel Serpell # Date 1260023905 10800 # Branch trunk # Node ID 215f805d6a90e9edca88e91c2db3293b99db9693 # Parent 2d307ef348f4f009f495c416be2585284401bbbd Always allocate 128 bytes for the filename on the stack. diff --git a/libsrc/atari/ucase_fn.s b/libsrc/atari/ucase_fn.s --- a/libsrc/atari/ucase_fn.s +++ b/libsrc/atari/ucase_fn.s @@ -23,7 +23,7 @@ .import __defdev .endif .importzp tmp3,ptr4,sp - .import subysp + .import subysp,addysp .export ucase_fn .proc ucase_fn @@ -50,45 +50,39 @@ hasdev: .endif - ; now we need the length of the name - ldy #0 -loop: lda (ptr4),y - beq str_end -; cmp #ATEOL ; we also accept Atari EOF char as end of string (not!) -; beq str_end - iny - bne loop ; not longer than 255 chars (127 real limit) -toolong:sec ; indicate error - rts - -str_end:iny ; room for terminating zero - bmi toolong ; we only can handle lenght < 128 + ldy #128 sty tmp3 ; save size jsr subysp ; make room on the stack ; copy filename to the temp. place on the stack, also uppercasing it - lda #0 ; end-of-string - sta (sp),y ; Y still contains length + 1 - dey + ldy #0 + loop2: lda (ptr4),y sta (sp),y + beq copy_end bmi L1 ; Not lowercase (also, invalid, should reject) cmp #'a' bcc L1 ; Not lowercase and #$DF ; make upper case char, assume ASCII chars sta (sp),y ; store back L1: - dey + iny bpl loop2 ; bpl: this way we only support a max. length of 127 + ; Filename too long + jsr addysp ; restore the stack + sec ; indicate error + rts + +copy_end: + .ifdef DEFAULT_DEVICE lda tmp2 cmp #1 ; was device present in passed string? beq hasdev2 ; yes, don't prepend something - inc tmp3 ; no, prepend "D:" (or other device) - inc tmp3 ; adjust stack size used - inc tmp3 + ldy #128+3 ; no, prepend "D:" (or other device) + sty tmp3 ; adjust stack size used ldy #3 jsr subysp ; adjust stack pointer dey