diff --git a/STATUS.md b/STATUS.md index 9ac6c490..f74abcf2 100644 --- a/STATUS.md +++ b/STATUS.md @@ -200,7 +200,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$B1AA` | `FACINX` | NOT DONE | convert FAC1 to 16-bit signed integer | | `$B1BF` | `convert_FAC1_to_s16` | NOT DONE | | | `$B391` | `GIVAYF` | PARTIAL | not fully tested yet | -| `$B3A2` | `convert_Y_to_FAC1` | DONE | | +| `$B3A2` | `convert_Y_to_FAC1` | DONE | From the Microsoft BASIC, original name: SNGFLT | | `$B794` | `convert_u8_A_to_FAC1` | DONE | | | `$B7B5` | `STRVAL` | PARTIAL | Only for 38k memory model | | `$B7F7` | `convert_FAC1_to_ADDR` | NOT DONE | | diff --git a/src/basic/math/b3a2.convert_Y_to_FAC1.s b/src/basic/math/b3a2.convert_Y_to_FAC1.s index 167ad4b0..b8d12294 100644 --- a/src/basic/math/b3a2.convert_Y_to_FAC1.s +++ b/src/basic/math/b3a2.convert_Y_to_FAC1.s @@ -3,7 +3,9 @@ ;; #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 - convert uint8 in Y to FAC1 ; ; Input: Y - uint8 to convert to float @@ -11,6 +13,8 @@ ; ; Stores Y into first FAC1 mantissa byte, clears the second and calls convert_i16_to_FAC1 ; +; This is verified to be identical to the original Microsoft implementation where it was named SNGFLT. +; ; - https://www.c64-wiki.com/wiki/BASIC-ROM ; - https://sta.c64.org/cbm64basconv.html ; - https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True @@ -18,7 +22,5 @@ ; convert_Y_to_FAC1: - sty FAC1_mantissa+1 - lda #$00 - sta FAC1_mantissa - jmp convert_i16_to_FAC1 + lda #0 + beq GIVAYF ; Always branches diff --git a/tools/similarity.c b/tools/similarity.c index 42e4f792..6dfd16ac 100644 --- a/tools/similarity.c +++ b/tools/similarity.c @@ -20,9 +20,10 @@ int matches[MAX_SIZE]; int phase_mask[MAX_SIZE+MAX_SIZE]; -#define NUM_CHUNKS 6 +#define NUM_CHUNKS 7 // Pairs of start, end memory addresses of known exact similarity with the open source Microsoft BASIC unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = { + 0xB3A2, 0xB3A5, 0xB849, 0xB84F, 0xB8D2, 0xB8D5, 0xB947, 0xB97D,