diff --git a/desktop/desktop_main.s b/desktop/desktop_main.s index 840559e..a82737a 100644 --- a/desktop/desktop_main.s +++ b/desktop/desktop_main.s @@ -8103,30 +8103,27 @@ next: dey bpl :+ done: rts - ;; Ignore punctuation : lda (ptr),y - and #CHAR_MASK + and #CHAR_MASK ; convert to ASCII cmp #'/' beq skip - cmp #' ' - beq skip + cmp #' ' ; (these two lines are not present + beq skip ; in most filename case adjust procs) cmp #'.' - bne check + bne check_alpha skip: dey jmp next - ;; Look at previous character - is it a letter? -check: iny +check_alpha: + iny lda (ptr),y and #CHAR_MASK cmp #'A' bcc :+ - cmp #'Z' + 1 + cmp #'Z'+1 bcs :+ - - ;; Yes - uppercase it. clc - adc #$20 + adc #('a' - 'A') ; convert to lower case sta (ptr),y : dey jmp next @@ -13219,18 +13216,19 @@ LB76C: stax $06 tay bne loop rts + loop: dey beq done bpl :+ done: rts : lda (ptr),y - and #CHAR_MASK + and #CHAR_MASK ; convert to ASCII cmp #'/' - beq :+ + beq next cmp #'.' bne check_alpha -: dey +next: dey jmp loop check_alpha: @@ -13242,7 +13240,7 @@ check_alpha: cmp #'Z'+1 bcs :+ clc - adc #('a' - 'A') ; Lowercase + adc #('a' - 'A') ; convert to lower case sta (ptr),y : dey jmp loop diff --git a/desktop/ovl1b.s b/desktop/ovl1b.s index 7deb4fa..e15b608 100644 --- a/desktop/ovl1b.s +++ b/desktop/ovl1b.s @@ -874,7 +874,7 @@ LD77E: lda $1300 LD798: lda $1300 and #$0F sta $1300 - addr_call LE0FE, $1300 + addr_call adjust_case, $1300 jsr LE674 jsr LE559 LD7AD: lda LD417 @@ -935,7 +935,7 @@ LD817: lda $1300 jmp LD83C LD82C: sta $1300 - addr_call LE0FE, $1300 + addr_call adjust_case, $1300 ldx #$00 ldy #$13 lda #$02 @@ -1724,40 +1724,50 @@ LE0B4: stax $06 rts LE0FD: .byte 0 -LE0FE: stx $0B - sta $0A - ldy #$00 - lda ($0A),y + +;;; ============================================================ + +.proc adjust_case + ptr := $A + + stx ptr+1 + sta ptr + ldy #0 + lda (ptr),y tay - bne LE10A + bne next rts -LE10A: dey - beq LE10F - bpl LE110 -LE10F: rts +next: dey + beq done + bpl :+ +done: rts -LE110: lda ($0A),y - and #CHAR_MASK +: lda (ptr),y + and #CHAR_MASK ; convert to ASCII cmp #'/' - beq LE11C + beq skip cmp #'.' - bne LE120 -LE11C: dey - jmp LE10A + bne check_alpha +skip: dey + jmp next -LE120: iny - lda ($0A),y +check_alpha: + iny + lda (ptr),y and #CHAR_MASK cmp #'A' - bcc LE132 + bcc :+ cmp #'Z'+1 - bcs LE132 + bcs :+ clc - adc #('a' - 'A') - sta ($0A),y -LE132: dey - jmp LE10A + adc #('a' - 'A') ; convert to lower case + sta (ptr),y +: dey + jmp next +.endproc + +;;; ============================================================ .byte 0 LE137: sta getwinport_params::window_id @@ -2026,7 +2036,7 @@ LE31B: sta LE399 sta $07 lda $06 ldx $07 - jsr LE0FE + jsr adjust_case lda $06 ldx $07 jsr draw_text diff --git a/desktop/ovl4.s b/desktop/ovl4.s index 6c5bec9..dd8a937 100644 --- a/desktop/ovl4.s +++ b/desktop/ovl4.s @@ -1666,10 +1666,12 @@ L6128: .byte 0 ;;; ============================================================ .proc adjust_filename_case - stx $0A+1 - sta $0A + ptr := $A + + stx ptr+1 + sta ptr ldy #0 - lda ($0A),y + lda (ptr),y tay bne loop rts @@ -1678,26 +1680,28 @@ loop: dey beq done bpl :+ done: rts -: lda ($0A),y + +: lda (ptr),y and #CHAR_MASK ; convert to ASCII cmp #'/' beq next cmp #'.' - bne check + bne check_alpha next: dey jmp loop -check: iny - lda ($0A),y +check_alpha: + iny + lda (ptr),y and #CHAR_MASK cmp #'A' - bcc L615D + bcc :+ cmp #'Z'+1 - bcs L615D + bcs :+ clc - adc #$20 ; convert to lower case - sta ($0A),y -L615D: dey + adc #('a' - 'A') ; convert to lower case + sta (ptr),y +: dey jmp loop .endproc