From 6f44c6402989c4a31779d092e653822106a3ac03 Mon Sep 17 00:00:00 2001 From: rosshjb Date: Thu, 7 Nov 2024 15:16:04 +0900 Subject: [PATCH] fix: fpcomp example --- Chapter 12/fpcomp.s | 2 +- Chapter 12/maincomp.s | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Chapter 12/fpcomp.s b/Chapter 12/fpcomp.s index eecb931..12199ad 100644 --- a/Chapter 12/fpcomp.s +++ b/Chapter 12/fpcomp.s @@ -21,7 +21,7 @@ fpcomp: // load the 3 numbers FSUB S3, S1, S0 FABS S3, S3 FCMP S3, S2 - B.LE notequal + B.GE notequal MOV X0, #1 B done diff --git a/Chapter 12/maincomp.s b/Chapter 12/maincomp.s index 4d85ee7..31da847 100644 --- a/Chapter 12/maincomp.s +++ b/Chapter 12/maincomp.s @@ -31,6 +31,11 @@ loop: SUBS W19, W19, #1 // decrement loop counter B.NE loop // loop if more points +// Store running sum for later use + ADRP X0, runsum@PAGE + ADD X0, X0, runsum@PAGEOFF + STR S1, [X0] + // compare running sum to real sum FCMP S1, S2 // print if the numbers are equal or not