further multiplication fixes

This commit is contained in:
FeralChild64 committed 2020-02-27 19:22:24 +01:00
1 parent 6afae69a31
commit 9f29d058dd
2 files changed
+25 -27

No files matched your search

+4 -9
View File
@@ -6,21 +6,16 @@
// Helper routine, based on code by djmips from:
// - https://codebase64.org/doku.php?id=base:8bit_multiplication_16bit_product_fast_no_tables
//
// input: .A, INDEX+3
// input: .A (and Zero flag set according to .A), INDEX+3
// output: .X (high byte), .A (low byte), carry always clear
//
mul_FAC2_FAC1_8x8:
// Special case (optimization) - handle 0 in INDEX+2
beq mul_FAC2_FAC1_8x8_zero
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)