Add SGN FAC1

This commit is contained in:
Rikard Nordgren committed 2025-02-02 13:30:33 +01:00
1 parent bedfdee531
commit 4ac8de0a86
4 files changed
+6 -4

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
Example code utilizing this routine:
- https://github.com/irmen/prog8/blob/master/compiler/res/prog8lib/c64flt.p8
+20
View File
@@ -0,0 +1,20 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; Math package - evaluate FAC1 sign, to FAC1
;
; Output:
; - FAC1 - 0 for FAC1 equal 0, 1 for FAC1 > 0, -1 for FAC1 < 0
;
; See also:
; - [CM64] Computes Mapping the Commodore 64 - page 115
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
;
sgn_FAC1:
jsr sgn_FAC1_A
; Fallthrough to convert_A_to_FAC1