changeset 108:b1958992a66a

Properly initialize result for integer multiplication
author William Astle <lost@l-w.ca>
date Sun, 03 Dec 2023 14:57:19 -0700
parents 1f2f6c2a1fde
children 1a5da3594a9e
files src/int.s
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/int.s	Mon Oct 30 22:26:44 2023 -0600
+++ b/src/int.s	Sun Dec 03 14:57:19 2023 -0700
@@ -204,8 +204,9 @@
 ;
 ; The agorithm is simply this: zero out the result, then multiply fpa0 by each byte of fpa1 and then add the result
 ; to the result location. This yields a 64 bit product which is somewhat wasteful.
-util_mul32      ldd zero                        ;* zero out result bits; low 16 bits don't need to be cleared and
-                stb fpaextra+3                  ;* upper 24 bits also don't
+util_mul32      ldd zero                        ;* zero out result bits; low 16 bits don't need to be cleared
+                std fpaextra
+                std fpaextra+2
                 std fpaextra+4
                 ldb fpa1+fpa.sig+3              ; multiply by low byte of fpa1 - no carries possible for this iteration
                 lda fpa0+fpa.sig+3