Add get_FAC2_via_INDEX

This commit is contained in:
Rikard Nordgren committed 2025-03-04 21:04:21 +01:00
1 parent b521241636
commit a67e6432a0
13 files changed
+85 -49

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
Example code utilizing this routine:
- https://www.lemon64.com/forum/viewtopic.php?t=42934
+30
View File
@@ -0,0 +1,30 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; Math package - fetch FAC2 from memory location
;
; Input:
; - .A - address low byte
; - .Y - address high byte
;
; Output:
; - .A - FAC1 exponent (yes, really - Codebase64 is right)
; - .Y - 0 (experimentation with original ROM)
;
; Preserves:
; - .X - (experimentation with original ROM)
;
; See also:
; - [CM64] Computes Mapping the Commodore 64 - page 114
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
;
mov_MEM_FAC2:
sty INDEX+1
sta INDEX+0
; FALLTHROUGH to get_FAC2_via_INDEX
@@ -1,36 +1,18 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; Math package - fetch FAC2 from memory location
;
; Input:
; - .A - address low byte
; - .Y - address high byte
;
; Output:
; - .A - FAC1 exponent (yes, really - Codebase64 is right)
; - .Y - 0 (experimentation with original ROM)
;
; Preserves:
; - .X - (experimentation with original ROM)
; Math package - Mov MEM to FAC2 with address in INDEX zero page register
;
; See also:
; - [CM64] Computes Mapping the Commodore 64 - page 114
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
; - https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True
;
; XXX test this
; XXX implement, test
mov_MEM_FAC2:
; Original routines use $22/$23 location for a vector too, see here:
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
sty INDEX+1
sta INDEX+0
get_FAC2_via_INDEX:
; Now copy the data from RAM to FAC2, for the format description see:
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic#Representation_in_the_C-64
+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
It's a part oof the ACME assembler SDK, see:
- https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True