Skip to content

Commit

Permalink
Disk Copy: Simplify volume name case adjust logic
Browse files Browse the repository at this point in the history
Make it more similar to lib/adjustfilecase.s

No functional changes.
  • Loading branch information
inexorabletash committed Mar 3, 2024
1 parent f9b2a59 commit f02cd35
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions disk_copy/auxlc.s
Original file line number Diff line number Diff line change
Expand Up @@ -1369,39 +1369,36 @@ match: clc
.proc AdjustCase
ptr := $A

stx ptr+1
sta ptr
stax ptr
ldy #0
lda (ptr),y
and #NAME_LENGTH_MASK ; handle ON_LINE results, etc
beq done

;; Walk backwards through string. At char N, check char N-1; if
;; it is a letter, and char N is also a letter, lower-case it.
tay
RTS_IF_ZERO

next: dey
loop: dey
beq done
bpl :+
done: rts

: lda (ptr),y
cmp #'/'
beq skip
cmp #'.'
bne CheckAlpha
skip: dey
jmp next

CheckAlpha:
cmp #'A'
bcs check_alpha
dey
bpl loop ; always

check_alpha:
iny
lda (ptr),y
cmp #'A'
bcc :+
cmp #'Z'+1
bcs :+
clc
adc #('a' - 'A') ; convert to lower case
ora #AS_BYTE(~CASE_MASK)
sta (ptr),y
: dey
jmp next
bpl loop ; always
.endproc ; AdjustCase

;;; ============================================================
Expand Down

0 comments on commit f02cd35

Please sign in to comment.