From 5404a40b128aeb89469b03f0814abe08df2c238b Mon Sep 17 00:00:00 2001 From: Rikard Nordgren Date: Mon, 7 Apr 2025 18:54:06 +0200 Subject: [PATCH] Set flags correctly at return of FCOMP Flags now directly reflect the results of the comparison --- src/basic/math/FCOMP.s | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/basic/math/FCOMP.s b/src/basic/math/FCOMP.s index 1a754efd..9c38d69d 100644 --- a/src/basic/math/FCOMP.s +++ b/src/basic/math/FCOMP.s @@ -12,7 +12,7 @@ ; ; Output: ; - .A - $00 for equal, $01 for FAC1 > RAM, $FF for FAC1 < RAM -; - flags N/Z, depending on whether FAC1 is 0, positive, or negative +; - flags N/Z, Z=1 if equal, N=1 if FAC1 < RAM, Z=0, N=0 if FAC1 > RAM ; ; Notes: ; - uses vector at $24, leaves FAC1 and FAC2 unchanged (Codebase64) @@ -28,9 +28,6 @@ FCOMP: sta INDEX+2 sty INDEX+3 - jsr sgn_FAC1_A ; Set N/Z flag for FAC1 and store on stack - php - ldy #$01 lda (INDEX+2),Y eor FAC1_sign ; Check if signs are different @@ -69,7 +66,6 @@ FCOMP: FCOMP_equal: lda #$00 - plp rts @@ -78,7 +74,6 @@ FCOMP_less_than: bpl FCOMP_FF FCOMP_01: lda #$01 - plp rts FCOMP_greater_than: @@ -86,5 +81,4 @@ FCOMP_greater_than: bpl FCOMP_01 FCOMP_FF: lda #$FF - plp rts