Add int to float conversions

This commit is contained in:
Rikard Nordgren committed 2025-01-28 21:07:33 +01:00
1 parent e41558ce33
commit ee736cfcbc
16 files changed
+139 -56

No files matched your search

@@ -0,0 +1,24 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; Math package - convert i16 with exponent in X and sign in C to FAC1
convert_i16_expsign_to_FAC1:
lda #$00
sta FAC1_mantissa+2 ; Clear high bytes of mantissa
sta FAC1_mantissa+3
stx FAC1_exponent
sta FAC1_sign
bcs @1
; Handle signed int
lda FAC1_mantissa+1 ; Clear sign bit of int 16
and #$7F
sta FAC1_mantissa+1
ldy #>CONST_NEG_32768 ; Subtract with 32768 to invert negative number
lda #<CONST_NEG_32768
jsr add_MEM_FAC1
@1: jmp normal_FAC1