speed optimization of multiplication routine
This commit is contained in:
1 parent
a40b419b1f
commit
6afae69a31
2 files changed
+18
-3
No files matched your search
@@ -199,7 +199,7 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$B947` | `inv_FAC1_mantissa` | NOT DONE | |
|
||||
| `$B9EA` | `log_FAC1` | NOT DONE | |
|
||||
| `$BA28` | `mul_MEM_FAC1` | DONE | |
|
||||
| `$BA2B` | `mul_FAC2_FAC1` | PARTIAL | very imprecise; not yet clear, why |
|
||||
| `$BA2B` | `mul_FAC2_FAC1` | PARTIAL | sometime imprecise - like PI*PI |
|
||||
| `$BA8C` | `mov_MEM_FAC2` | DONE | |
|
||||
| `$BA90` | `get_FAC2_via_INDEX` | NOT DONE | |
|
||||
| `$BAE2` | `mul10_FAC1` | DONE | |
|
||||
|
||||
@@ -7,13 +7,20 @@
|
||||
// - https://codebase64.org/doku.php?id=base:8bit_multiplication_16bit_product_fast_no_tables
|
||||
//
|
||||
// input: .A, INDEX+3
|
||||
// output: .X (high byte), .A and INDEX+2 (low byte), carry always clear
|
||||
// output: .X (high byte), .A (low byte), carry always clear
|
||||
//
|
||||
|
||||
mul_FAC2_FAC1_8x8:
|
||||
|
||||
sta INDEX+2
|
||||
|
||||
// Special case (optimization) - handle 0
|
||||
|
||||
lda INDEX+2
|
||||
beq mul_FAC2_FAC1_8x8_zero
|
||||
lda INDEX+3
|
||||
beq mul_FAC2_FAC1_8x8_zero
|
||||
|
||||
lda #$00
|
||||
|
||||
dec INDEX+3 // decrement because we will be adding with carry set for speed (an extra one)
|
||||
@@ -62,6 +69,14 @@ mul_FAC2_FAC1_8x8:
|
||||
|
||||
tax
|
||||
lda INDEX+2
|
||||
clc
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
mul_FAC2_FAC1_8x8_zero:
|
||||
|
||||
lda #$00
|
||||
tax
|
||||
|
||||
clc
|
||||
rts
|
||||
Reference in new issue
Block a user