Update convert_A_to_FAC1

This commit is contained in:
Rikard Nordgren authored and FeralChild64 committed 2026-03-29 21:45:24 +02:00
1 parent dfa61a5acd
commit 64ac8b2073
4 files changed
+11 -20

No files matched your search

+9 -5
View File
@@ -3,22 +3,26 @@
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; This file is under the MIT license, it contains code released by Microsoft Corporation.
; See LICENSE for more information.
; Math package - convert int8 in A to FAC1
;
; Input: A - int8 to convert to float
; Result: FAC1
;
; This is verified to be identical to the original Microsoft implementation where it was named FLOAT.
;
; Sets first byte of FAC1 to A, sign extends A into tge second byte and falls through to convert_i16_to_FAC1
;
; - https://codebase64.org/doku.php?id=base:asm_include_file_for_basic_routines
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
;
convert_A_to_FAC1:
sta FAC1_mantissa+0
lda #0
sta FAC1_mantissa+1
jsr sign_extend_A_to_Y
sty FAC1_mantissa
+nop ; To not leave a gap to the fallthrough
ldx #$88
; Fall through to convert_i16_to_FAC1
-13
View File
@@ -1,13 +0,0 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; Math package - helper function to sign extend accumulator into Y
sign_extend_A_to_Y:
cmp #$80 ; Copy sign into carry
ldy #$00 ; Y = $00
bcc @1 ; Branch if not negative
dey ; Y = $FF
@1: rts