Update sub_FAC2_FAC1

This commit is contained in:
Rikard Nordgren authored and FeralChild64 committed 2026-03-29 21:45:24 +02:00
1 parent 4696a209a0
commit ab4615bb3e
3 files changed
+15 -9

No files matched your search

+1 -1
View File
@@ -206,7 +206,7 @@ Floating point mathematical routines - not official, but well known and broadly
| `$B7F7` | `convert_FAC1_to_ADDR` | NOT DONE | |
| `$B849` | `add_HALF_FAC1` | DONE | From the Microsoft BASIC, original name: FADDH |
| `$B850` | `sub_MEM_FAC1` | DONE | From the Microsoft BASIC, original name: FSUB |
| `$B853` | `sub_FAC2_FAC1` | DONE | |
| `$B853` | `sub_FAC2_FAC1` | DONE | From the Microsoft BASIC, original name: FSUBT |
| `$B862` | `add_align_exponents` | DONE | |
| `$B867` | `add_MEM_FAC1` | DONE | |
| `$B86A` | `add_FAC2_FAC1` | DONE | |
+13 -7
View File
@@ -3,23 +3,29 @@
;; #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 - subtract FAC1 from FAC2
;
; This is verified to be identical to the original Microsoft implementation where it was named FSUBT.
;
; 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 test this
sub_FAC2_FAC1:
; Toggle FAC1 sign
lda FAC1_sign
eor #$FF
sta FAC1_sign
; Toggle FAC1 sign
lda FAC1_sign
eor #$FF
sta FAC1_sign
eor FAC2_sign
sta ARISGN
lda FAC1_exponent ; Set flags from exponent
; Perform addition
jmp add_FAC2_FAC1
jmp add_FAC2_FAC1
+1 -1
View File
@@ -25,7 +25,7 @@ int phase_mask[MAX_SIZE+MAX_SIZE];
unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
0xB391, 0xB39D,
0xB3A2, 0xB3A5,
0xB849, 0xB853,
0xB849, 0xB861,
0xB8D2, 0xB8D5,
0xB947, 0xB97D,
0xB983, 0xB9BB,