Performance improved mult_16 without changing behaviour

This commit is contained in:
hugova 2025-03-25 21:40:40 +01:00
parent 7a5585d2c4
commit 41b8fec7a8
2 changed files with 14 additions and 10 deletions

View file

@ -69,13 +69,17 @@
;; Multiplication of 2
;; a = a*2
.macro mult_16 low_, hi_, fast_unsafe
;; IF to run it fast
.macro mult_16 low_, hi_, NOT_ROL
;; IF NOT_ROL
.ifblank fast_unsafe
CLC
.endif
ROL low_
ASL low_
ROL hi_
.else
ROL low_
ROL hi_
.endif
.endmacro
;;Larger then operation, uses the A register

View file

@ -62,16 +62,16 @@ end__:
;;We need to calculate C*40. 40 = 2*2*2*(2^2 +1)
;; _*2^2
mult_16 >C, <C, !
mult_16 >C, <C, !
mult_16 >C, <C
mult_16 >C, <C
;; + _*1
Add_16 >C, <C, >B, <B, !
;; *2*2*2
mult_16 >C, <C, !
mult_16 >C, <C, !
mult_16 >C, <C, !
mult_16 >C, <C
mult_16 >C, <C
mult_16 >C, <C
Add_16 >btp_mem_pos, <btp_mem_pos, >C, <C, !