From 9e727697d372fce0803bfd5b5d9ef6ca774ac536 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Tue, 9 Mar 2021 00:24:26 -0600 Subject: [PATCH] Add a helper function to get the sign bit. --- math2.asm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/math2.asm b/math2.asm index 9c9cdc6..3f353b3 100644 --- a/math2.asm +++ b/math2.asm @@ -128,3 +128,28 @@ lb1 sta val creturn 2:val end + +**************************************************************** +* +* int __signbit(long double x); +* +* Get the sign bit of a floating-point value +* +* Inputs: +* val - the number +* +* Outputs: +* 0 if positive, non-zero if negative +* +**************************************************************** +* +__signbit start + + csubroutine (10:val),0 + + lda val+8 + and #$8000 + sta val + + creturn 2:val + end