Add clear_FAC1

This commit is contained in:
Rikard Nordgren authored and FeralChild64 committed 2026-02-01 18:35:00 +01:00
1 parent db26e17fb5
commit 00c74cdd48
3 files changed
+32 -2

No files matched your search

+1
View File
@@ -241,6 +241,7 @@ Floating point mathematical routines - not official, but well known and broadly
| `$BC5B` | `FCOMP` | DONE | |
| `$BC9B` | `QINT` | NOT DONE | convert FAC1 to 32 bit signed integer |
| `$BCCC` | `int_FAC1` | DONE | |
| `$BCE9` | `clear_FAC1` | DONE | From the Microsoft BASIC, original name: CLRFAC |
| `$BCF3` | `FIN` | PARTIAL | Only for 38k memory model + not fully tested yet |
| `$BD7E` | `FINLOG` | DONE | |
| `$BDDD` | `FOUT` | NOT DONE | outputs FAC1 to string at $0100 |
+28
View File
@@ -0,0 +1,28 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #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 - clear FAC1
;
; Set each byte of the mantissa of FAC1 to the value of A
;
; This is verified to be identical to the original Microsoft implementation where it was named CLRFAC.
;
; See also:
; - https://www.c64-wiki.com/wiki/BASIC-ROM
; - https://sta.c64.org/cbm64basconv.html
;
clear_FAC1:
sta FAC1_mantissa+0
sta FAC1_mantissa+1
sta FAC1_mantissa+2
sta FAC1_mantissa+3
tay
clear_FAC1_rts: ; Return point needed elsewhere
rts
+3 -2
View File
@@ -20,14 +20,15 @@ int matches[MAX_SIZE];
int phase_mask[MAX_SIZE+MAX_SIZE];
#define NUM_CHUNKS 5
#define NUM_CHUNKS 6
// Pairs of start, end memory addresses of known exact similarity with the open source Microsoft BASIC
unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
0xB849, 0xB84F,
0xB947, 0xB97D,
0xB983, 0xB9BB,
0xBBA2, 0xBC1A,
0xBC58, 0xBC5A
0xBC58, 0xBC5A,
0xBCE9, 0xBCF2,
};