Optimize strcmp_mem

This commit is contained in:
Natt Akuma 2022-02-04 22:07:03 +07:00
parent 7c70c79a84
commit 49d37c016e

View File

@ -1121,17 +1121,15 @@ strcmp_mem .proc
; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y.
sta P8ZP_SCRATCH_W1 sta P8ZP_SCRATCH_W1
sty P8ZP_SCRATCH_W1+1 sty P8ZP_SCRATCH_W1+1
_loop ldy #0 ldy #0
lda (P8ZP_SCRATCH_W1),y _loop lda (P8ZP_SCRATCH_W1),y
bne + bne +
lda (P8ZP_SCRATCH_W2),y lda (P8ZP_SCRATCH_W2),y
bne _return_minusone bne _return_minusone
beq _return beq _return
+ lda (P8ZP_SCRATCH_W2),y + cmp (P8ZP_SCRATCH_W2),y
sec bcc _return_minusone
sbc (P8ZP_SCRATCH_W1),y bne _return_one
bmi _return_one
bne _return_minusone
inc P8ZP_SCRATCH_W1 inc P8ZP_SCRATCH_W1
bne + bne +
inc P8ZP_SCRATCH_W1+1 inc P8ZP_SCRATCH_W1+1