1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Tiny optimizations for multiplication.

This commit is contained in:
IrgendwerA8 2020-08-29 16:21:45 +02:00 committed by Oliver Schmidt
parent 5158ee2092
commit f54e01781b
2 changed files with 5 additions and 6 deletions

View File

@ -63,7 +63,7 @@ L0: lsr tmp4
bcc L1 bcc L1
clc clc
adc ptr3 adc ptr3
pha tax
lda ptr3+1 lda ptr3+1
adc tmp2 adc tmp2
sta tmp2 sta tmp2
@ -73,7 +73,7 @@ L0: lsr tmp4
lda ptr4+1 lda ptr4+1
adc tmp4 adc tmp4
sta tmp4 sta tmp4
pla txa
L1: dey L1: dey
bpl L0 bpl L0
lda ptr1 ; Load the low result word lda ptr1 ; Load the low result word

View File

@ -41,20 +41,19 @@ umul8x16r16m:
.endif .endif
ldy #8 ; Number of bits ldy #8 ; Number of bits
ldx ptr3 ; Get into register for speed
lda ptr1 lda ptr1
ror a ; Get next bit into carry ror a ; Get next bit into carry
@L0: bcc @L1 @L0: bcc @L1
clc clc
pha tax
txa lda ptr3
adc ptr1+1 adc ptr1+1
sta ptr1+1 sta ptr1+1
lda ptr3+1 lda ptr3+1
adc sreg adc sreg
sta sreg sta sreg
pla txa
@L1: ror sreg @L1: ror sreg
ror ptr1+1 ror ptr1+1