diff --git a/STATUS.md b/STATUS.md index 2b26a4e4..2c51de67 100644 --- a/STATUS.md +++ b/STATUS.md @@ -210,6 +210,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$B862` | `add_align_exponents` | DONE | | | `$B867` | `add_MEM_FAC1` | DONE | | | `$B86A` | `add_FAC2_FAC1` | DONE | | +| `$B8D2` | `abs_and_normal_FAC` | DONE | From the Microsoft BASIC, original name: FADFLT | | `$B8FE` | `normal_FAC1` | DONE | | | `$B947` | `inv_FAC1_mantissa` | DONE | From the Microsoft BASIC, original name: NEGFAC | | `$B96F` | `inc_FAC1` | DONE | From the Microsoft BASIC, original name: INCFAC | diff --git a/src/basic/math/b8d2.abs_and_normal.s b/src/basic/math/b8d2.abs_and_normal.s new file mode 100644 index 00000000..b5966620 --- /dev/null +++ b/src/basic/math/b8d2.abs_and_normal.s @@ -0,0 +1,22 @@ +;; #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 - abs and noramlize FAC1 +; +; Input: +; CF - Sign of number +; +; This is verified to be identical to the original Microsoft implementation where it was named FADFLT. +; + +abs_and_normal_FAC1: + + bcs normal_FAC1 ; If CF set only normalize + jsr inv_FAC1 + + ; Fallthrough to normal_FAC1 diff --git a/tools/similarity.c b/tools/similarity.c index 0eadd549..061fb5b7 100644 --- a/tools/similarity.c +++ b/tools/similarity.c @@ -20,10 +20,11 @@ int matches[MAX_SIZE]; int phase_mask[MAX_SIZE+MAX_SIZE]; -#define NUM_CHUNKS 7 +#define NUM_CHUNKS 8 // 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, + 0xB8D2, 0xB8D5, 0xB947, 0xB97D, 0xB983, 0xB9BB, 0xBBA2, 0xBC1A,