Browse Source

Fix an infinite loop bug if rounding overflowed in calculator.asm

master
Juhani Krekelä 4 months ago
parent
commit
9cc8cdef5f
  1. 11
      calculator.asm

11
calculator.asm

@ -1,5 +1,10 @@
org 0
load r0, fResultPtr+0
load r1, fResultPtr+1
cleq r0, r0, pushWord
cleq r0, r0, dumpFloat
cleq r0, r0, normalize
load r0, fResultPtr+0
@ -459,7 +464,7 @@ fResult:
data 05 ; exponent
data 00
data 00
data 00 ; overflow
data 09 ; overflow
data 09 ; mantissa
data 09
data 09
@ -886,6 +891,10 @@ normalizeRoundUpEnd:
cleq r0, r0, popWord
cleq r0, r0, popWord
; Zero out the rounding digit
xor r0, r0
store fResult+11, r0
; We might have ended up with a digit in the overflow
breq r0, r0, normalize

Loading…
Cancel
Save