Update MUL10
This commit is contained in:
1 parent
582ecedbd1
commit
76d30af5cd
3 files changed
+20
-27
No files matched your search
@@ -223,7 +223,7 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$BA2B` | `mul_FAC2_FAC1` | DONE | From the Microsoft BASIC, original name: FMULTT |
|
||||
| `$BA8C` | `mov_MEM_FAC2` | DONE | From the Microsoft BASIC, original name: CONUPK |
|
||||
| `$BA90` | `get_FAC2_via_INDEX` | DONE | From the Microsoft BASIC, no label |
|
||||
| `$BAE2` | `mul10_FAC1` | DONE | |
|
||||
| `$BAE2` | `mul10_FAC1` | DONE | From the Microsoft BASIC, original name: MUL10 |
|
||||
| `$BAFE` | `div10_FAC1_p` | DONE | |
|
||||
| `$BB0F` | `div_MEM_FAC1` | DONE | |
|
||||
| `$BB12` | `div_FAC2_FAC1` | DONE | |
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
;; #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 - multiply FAC1 by 10
|
||||
;
|
||||
; This is verified to be identical to the original Microsoft implementation where it was named MUL10
|
||||
;
|
||||
; See also:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 114
|
||||
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
@@ -14,28 +18,17 @@
|
||||
|
||||
mul10_FAC1:
|
||||
|
||||
; Handle special case of FAC1 equal 0
|
||||
MUL10:
|
||||
|
||||
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
|
||||
jsr mov_r_FAC1_FAC2
|
||||
tax
|
||||
beq MUL10R
|
||||
clc
|
||||
adc #2
|
||||
bcs GOOVER ; Closest jmp to overflow
|
||||
FINML6: ldx #0
|
||||
stx ARISGN
|
||||
jsr FADDC
|
||||
inc FAC1_exponent
|
||||
beq GOOVER
|
||||
MUL10R: rts
|
||||
+1
-1
@@ -27,7 +27,7 @@ unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
|
||||
0xB3A2, 0xB3A5,
|
||||
0xB849, 0xB97D,
|
||||
0xB983, 0xB9BB,
|
||||
0xBA28, 0xBAE1,
|
||||
0xBA28, 0xBAF8,
|
||||
0xBB8F, 0xBCF2,
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user