Update mov_FAC2_FAC1 to match the original implementation
This commit is contained in:
1 parent
ee3c8cb11d
commit
c9e4a09594
4 files changed
+43
-53
No files matched your search
@@ -3,6 +3,45 @@
|
||||
;; #LAYOUT# * BASIC_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
; Just a compatibility jump - our routine is longer than original one
|
||||
; This file is under the MIT license, it contains code released by Microsoft Corporation.
|
||||
; See LICENSE for more information.
|
||||
|
||||
jmp mov_FAC2_FAC1
|
||||
; Math package - Copy FAC2 to FAC1
|
||||
;
|
||||
; This is verified to be identical to the original Microsoft implementation where it was named MOVFA.
|
||||
;
|
||||
; It has an alternative entry point at mov_FAC2_FAC1_sign (original: MOVFA1) that instead of copying the sign uses A for the copied sign.
|
||||
;
|
||||
; Output (found by experimentation):
|
||||
; - .A - FAC1 exponent
|
||||
; - .X - always 0
|
||||
;
|
||||
; Preserves:
|
||||
; - .Y
|
||||
;
|
||||
; See also:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 115
|
||||
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
;
|
||||
|
||||
|
||||
mov_FAC2_FAC1:
|
||||
; Copy the sign
|
||||
|
||||
lda FAC2_sign
|
||||
|
||||
mov_FAC2_FAC1_sign:
|
||||
sta FAC2_sign
|
||||
|
||||
; Copy the mantissa and the exponent
|
||||
|
||||
ldx #5
|
||||
|
||||
@1
|
||||
lda FAC2_exponent - 1,X
|
||||
sta FAC1_exponent - 1,X
|
||||
dex
|
||||
bne @1
|
||||
stx FACOV ; Always 0
|
||||
rts
|
||||
@@ -1,49 +0,0 @@
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * BASIC_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
;
|
||||
; Math package - copy FAC2 to FAC1
|
||||
;
|
||||
; Output (found by experimentation):
|
||||
; - .A - FAC1 exponent
|
||||
; - .X - always 0
|
||||
;
|
||||
; Preserves:
|
||||
; - .Y
|
||||
;
|
||||
; See also:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 115
|
||||
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
|
||||
;
|
||||
|
||||
mov_FAC2_FAC1:
|
||||
|
||||
; Copy the mantissa
|
||||
|
||||
lda FAC2_mantissa+3
|
||||
sta FAC1_mantissa+3
|
||||
lda FAC2_mantissa+2
|
||||
sta FAC1_mantissa+2
|
||||
lda FAC2_mantissa+1
|
||||
sta FAC1_mantissa+1
|
||||
lda FAC2_mantissa+0
|
||||
sta FAC1_mantissa+0
|
||||
|
||||
; Copy the sign
|
||||
|
||||
lda FAC2_sign
|
||||
sta FAC1_sign
|
||||
|
||||
; Copy the exponent
|
||||
|
||||
lda FAC2_exponent
|
||||
sta FAC1_exponent
|
||||
|
||||
; Clear FACOV
|
||||
|
||||
ldx #$00
|
||||
stx FACOV
|
||||
|
||||
rts
|
||||
Reference in new issue
Block a user