Update mov_r_FAC1_MEM

This commit is contained in:
Rikard Nordgren authored and FeralChild64 committed 2026-01-28 21:26:20 +01:00
1 parent 23bab154cf
commit e5b02075e0
3 files changed
+31 -8

No files matched your search

+29 -6
View File
@@ -3,16 +3,21 @@
;; #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 - copy FAC1 to memory location, do not round
;
; This is verified to be identical to the original Microsoft implementation where it was named MOVMF.
;
; Input:
; - .X - address low byte
; - .Y - address high byte
;
; Output:
; - .A - FAC1 exponent
;
; - .Y - 0
; See also:
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
@@ -20,7 +25,25 @@
mov_r_FAC1_MEM:
; Start by rounding FAC1
jsr round_FAC1
jmp mov_FAC1_MEM
jsr round_FAC1
stx INDEX+0
sty INDEX+1
ldy #4
lda FAC1_mantissa+3
sta (INDEX),y
dey
lda FAC1_mantissa+2
sta (INDEX),y
dey
lda FAC1_mantissa+1
sta (INDEX),y
dey
lda FAC1_sign
ora #$7F
and FAC1_mantissa
sta (INDEX),y
dey
lda FAC1_exponent
sta (INDEX),y
sty FACOV
rts