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 |
|
| `$BA2B` | `mul_FAC2_FAC1` | DONE | From the Microsoft BASIC, original name: FMULTT |
|
||||||
| `$BA8C` | `mov_MEM_FAC2` | DONE | From the Microsoft BASIC, original name: CONUPK |
|
| `$BA8C` | `mov_MEM_FAC2` | DONE | From the Microsoft BASIC, original name: CONUPK |
|
||||||
| `$BA90` | `get_FAC2_via_INDEX` | DONE | From the Microsoft BASIC, no label |
|
| `$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 | |
|
| `$BAFE` | `div10_FAC1_p` | DONE | |
|
||||||
| `$BB0F` | `div_MEM_FAC1` | DONE | |
|
| `$BB0F` | `div_MEM_FAC1` | DONE | |
|
||||||
| `$BB12` | `div_FAC2_FAC1` | DONE | |
|
| `$BB12` | `div_FAC2_FAC1` | DONE | |
|
||||||
|
|||||||
@@ -3,9 +3,13 @@
|
|||||||
;; #LAYOUT# * BASIC_0 #TAKE
|
;; #LAYOUT# * BASIC_0 #TAKE
|
||||||
;; #LAYOUT# * * #IGNORE
|
;; #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
|
; Math package - multiply FAC1 by 10
|
||||||
;
|
;
|
||||||
|
; This is verified to be identical to the original Microsoft implementation where it was named MUL10
|
||||||
|
;
|
||||||
; See also:
|
; See also:
|
||||||
; - [CM64] Computes Mapping the Commodore 64 - page 114
|
; - [CM64] Computes Mapping the Commodore 64 - page 114
|
||||||
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||||
@@ -14,28 +18,17 @@
|
|||||||
|
|
||||||
mul10_FAC1:
|
mul10_FAC1:
|
||||||
|
|
||||||
; Handle special case of FAC1 equal 0
|
MUL10:
|
||||||
|
|
||||||
lda FAC1_exponent
|
jsr mov_r_FAC1_FAC2
|
||||||
beq mul10_FAC1_done
|
tax
|
||||||
|
beq MUL10R
|
||||||
; Start by multiplying FAC1 by 2
|
clc
|
||||||
|
adc #2
|
||||||
jsr mul10_FAC1_mul2
|
bcs GOOVER ; Closest jmp to overflow
|
||||||
|
FINML6: ldx #0
|
||||||
; Move FAC1 to FAC2, so that FAC1 = FAC2 = 2 * initial
|
stx ARISGN
|
||||||
|
jsr FADDC
|
||||||
jsr mov_FAC1_FAC2
|
inc FAC1_exponent
|
||||||
|
beq GOOVER
|
||||||
; Multiply FAC1 by 4
|
MUL10R: rts
|
||||||
|
|
||||||
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
|
|
||||||
+1
-1
@@ -27,7 +27,7 @@ unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
|
|||||||
0xB3A2, 0xB3A5,
|
0xB3A2, 0xB3A5,
|
||||||
0xB849, 0xB97D,
|
0xB849, 0xB97D,
|
||||||
0xB983, 0xB9BB,
|
0xB983, 0xB9BB,
|
||||||
0xBA28, 0xBAE1,
|
0xBA28, 0xBAF8,
|
||||||
0xBB8F, 0xBCF2,
|
0xBB8F, 0xBCF2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user