From 2c768252861a626a7376dd3b756056e35165b812 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 21 Mar 2020 15:20:39 +0100 Subject: [PATCH] fix for FAC1 denormalization --- c64/basic/math/div_FAC1_denorm.s | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/c64/basic/math/div_FAC1_denorm.s b/c64/basic/math/div_FAC1_denorm.s index 4f93c876..fb1150f9 100644 --- a/c64/basic/math/div_FAC1_denorm.s +++ b/c64/basic/math/div_FAC1_denorm.s @@ -17,12 +17,12 @@ div_FAC1_denorm: bne div_FAC1_denorm_by_bit // branch if last byte of mantissa is non-zero lda FAC1_exponent - cmp #$09 - bcc div_FAC1_denorm_by_bit // branch if not suitable to decrement exponent by 8 + cmp #$F8 + bcs div_FAC1_denorm_by_bit // branch if not suitable to increment exponent by 8 - // Decrement exponent + // Increment exponent - sbc #$08 // Carry already set here + adc #$08 // Carry already clear sta FAC1_exponent // Move mantissa bytes @@ -47,12 +47,12 @@ div_FAC1_denorm_by_bit: bne div_FAC1_denorm_done // branch if lowest bit of mantissa is already 1 lda FAC1_exponent - cmp #$02 - bcc div_FAC1_denorm_done // branch if not suitable to decrement exponent + cmp #$FF + beq div_FAC1_denorm_done // branch if not suitable to decrement exponent // Decrement exponent - dec FAC1_exponent + inc FAC1_exponent // Move mantissa bits