added multiplication by 10 routine, not yet tested

This commit is contained in:
FeralChild64 committed 2020-02-27 17:35:22 +01:00
1 parent 6f7e099004
commit d8bb2ba403
5 files changed
+69 -19

No files matched your search

+1 -1
View File
@@ -202,7 +202,7 @@ Floating point mathematical routines - not official, but well known and broadly
| `$BA2B` | `mul_FAC2_FAC1` | PARTIAL | not testeed yet |
| `$BA8C` | `mov_MEM_FAC2` | DONE | |
| `$BA90` | `get_FAC2_via_INDEX` | NOT DONE | |
| `$BAE2` | `mul10_FAC1` | NOT DONE | |
| `$BAE2` | `mul10_FAC1` | PARTIAL | not tested yet |
| `$BAFE` | `div10_FAC1_p` | PARTIAL | needs `div_FAC2_FAC1` |
| `$BB0F` | `div_MEM_FAC1` | PARTIAL | needs `div_FAC2_FAC1` |
| `$BB12` | `div_FAC2_FAC1` | NOT DONE | some work already started |
-18
View File
@@ -1,18 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - multiply FAC1 by 10
//
// 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
//
// XXX provide implementation
mul10_FAC1:
STUB_IMPLEMENTATION()
File renamed without changes.
+43
View File
@@ -0,0 +1,43 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - multiply FAC1 by 10
//
// 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
//
// XXX test this
mul10_FAC1:
// Handle special case of FAC1 equal 0
lda FAC1_exponent
beq mul10_FAC1_done
// Start by multiplying FAC1 by 2
jsr mul10_FAC1_mul2
// Move FAC1 to FAC2, so that FAC1 = FAC2 = 2 * initial
jsr mov_FAC1_FAC2
// Multiply FAC1 by 4
jsr mul10_FAC1_mul2
jsr mul10_FAC1_mul2
// Now we have FAC1 = 8 * initial and FAC2 = 2 * initial; so just add these 2 values
jmp add_FAC2_FAC1
mul10_FAC1_done:
rts
+25
View File
@@ -0,0 +1,25 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Multiply FAC1 by 2, do not normalize
//
mul10_FAC1_mul2:
// First handle the mantissa
asl FACOV
rol FAC1_mantissa+3
rol FAC1_mantissa+2
rol FAC1_mantissa+1
rol FAC1_mantissa+0
bcc !+
// We need to increment the exponent
inc FAC1_exponent
bcs_16 set_FAC1_max
rts