From 4696a209a0b48403b6bd77bf6c4ff3a32f38ce52 Mon Sep 17 00:00:00 2001 From: Rikard Nordgren Date: Mon, 2 Feb 2026 20:28:50 +0100 Subject: [PATCH] Update sub_MEM_FAC1 --- STATUS.md | 2 +- src/basic/math/b850.sub_MEM_FAC1.s | 6 +++++- tools/similarity.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/STATUS.md b/STATUS.md index 0efd5a5b..4df66b0a 100644 --- a/STATUS.md +++ b/STATUS.md @@ -205,7 +205,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$B7B5` | `STRVAL` | PARTIAL | Only for 38k memory model | | `$B7F7` | `convert_FAC1_to_ADDR` | NOT DONE | | | `$B849` | `add_HALF_FAC1` | DONE | From the Microsoft BASIC, original name: FADDH | -| `$B850` | `sub_MEM_FAC1` | DONE | | +| `$B850` | `sub_MEM_FAC1` | DONE | From the Microsoft BASIC, original name: FSUB | | `$B853` | `sub_FAC2_FAC1` | DONE | | | `$B862` | `add_align_exponents` | DONE | | | `$B867` | `add_MEM_FAC1` | DONE | | diff --git a/src/basic/math/b850.sub_MEM_FAC1.s b/src/basic/math/b850.sub_MEM_FAC1.s index c1d759d6..59717516 100644 --- a/src/basic/math/b850.sub_MEM_FAC1.s +++ b/src/basic/math/b850.sub_MEM_FAC1.s @@ -3,13 +3,17 @@ ;; #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 memory variable ; ; Input: ; - .A - address low byte ; - .Y - address high byte ; +; This is verified to be identical to the original Microsoft implementation where it was named FSUB. +; ; See also: ; - [CM64] Computes Mapping the Commodore 64 - page 112 ; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic diff --git a/tools/similarity.c b/tools/similarity.c index 1df1c286..a3b5faeb 100644 --- a/tools/similarity.c +++ b/tools/similarity.c @@ -25,7 +25,7 @@ int phase_mask[MAX_SIZE+MAX_SIZE]; unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = { 0xB391, 0xB39D, 0xB3A2, 0xB3A5, - 0xB849, 0xB84F, + 0xB849, 0xB853, 0xB8D2, 0xB8D5, 0xB947, 0xB97D, 0xB983, 0xB9BB,