floating point add/subtract written, but not tested yet

This commit is contained in:
FeralChild64 committed 2020-02-12 21:17:39 +01:00
1 parent a665967e17
commit 0e867480e9
4 files changed
+115 -58

No files matched your search

@@ -1,57 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - add FAC2 to FAC1
//
// Input:
// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag
//
// Note:
// - load FAC2 after FAC1, or mimic the Kernals sign comparison (XXX do we need it?)
//
// See also:
// - [CM64] Computes Mapping the Commodore 64 - page 112
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
//
// XXX provide implementation
add_FAC2_FAC1:
// Check if FAC2 is 0; if so, leave FAC1 without changes
lda FAC2_exponent
beq add_FAC2_FAC1_done
// If FAC1 is 0, just copy FAC2 to FAC1
lda FAC1_exponent
beq_16 mov_FAC2_FAC1
// Make sure the exponents are aligned
jsr add_align_exponents
// Check whether signs are the same
lda FAC1_sign
eor FAC2_sign
bmi add_FAC2_FAC1_sub // branch if signs are opposite
add_FAC2_FAC1_sub:
STUB_IMPLEMENTATION()
add_FAC2_FAC1_done:
rts
-3
View File
@@ -1,3 +0,0 @@
This is an important floating point math routine, documented in many places.
XXX - try to find real-life example