changeset 79:df86e6d64ce2

Flag handling fix and tweaking in number handling
author William Astle <lost@l-w.ca>
date Sun, 10 Sep 2023 23:18:17 -0600
parents 718f9b7381b3
children bb50ac9fdf37
files src/number.s
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/number.s	Sun Sep 10 20:05:47 2023 -0600
+++ b/src/number.s	Sun Sep 10 23:18:17 2023 -0600
@@ -189,7 +189,7 @@
 fp_add2         cmpb #32                        ; are we shifting more than 32 bits?
                 blo fp_add0                     ; brif so - we're effectively adding zero so bail out
 fp_add3         cmpb #8                         ; have 8 bits to move?
-                bhs fp_add5                     ; brif not
+                blo fp_add5                     ; brif not
                 lda val.fpmant+2,x              ; shift 8 bits right
                 sta val.fpmant+3,x
                 lda val.fpmant+1,x
@@ -218,7 +218,7 @@
                 adcb val.fpmant+1,x
                 adca val.fpmant,x
                 std val.fpmant,y
-                clrb                            ; clear extra precision bits
+                ldb #0                          ; clear extra precision bits (preserve carry)
                 bcc fp_add7                     ; brif no carry
                 ror val.fpmant,y                ; shift carry into mantissa
                 ror val.fpmant+1,y
@@ -226,7 +226,7 @@
                 ror val.fpmant+3,y
                 rorb                            ; keep bits for founding
                 inc val.fpexp,y                 ; bump exponent to account for shift
-                lbeq OVERROR                    ; brif it overflowed
+                beq OVERROR2                    ; brif it overflowed
 fp_add7         leax ,y                         ; point to result
                 jmp fp_normalize                ; go normalize the result
 fp_add8         ldd val.fpmant+2,u              ; subtract operands