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