diff --git a/STATUS.md b/STATUS.md index f74abcf2..34e90738 100644 --- a/STATUS.md +++ b/STATUS.md @@ -199,7 +199,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$AF9A` | `compute_ST` | DONE | | | `$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 | +| `$B391` | `GIVAYF` | DONE | From the Microsoft BASIC, original name: GIVAYF | | `$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 | diff --git a/src/basic/math/b391.GIVAYF.s b/src/basic/math/b391.GIVAYF.s index 92ccbb9c..ddd974ab 100644 --- a/src/basic/math/b391.GIVAYF.s +++ b/src/basic/math/b391.GIVAYF.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 - 16-bit signed integer to FAC1 ; ; Output: @@ -13,6 +15,8 @@ ; Sets the data type flag at $0D to "numeric", stores the number in the FAC1 mantissa ; then calls convert_i16_to_FAC1 ; +; This is verified to be identical to the original Microsoft implementation where it was named GIVAYF. +; ; See also: ; - [CM64] Computes Mapping the Commodore 64 - page 107 ; - https://www.c64-wiki.com/wiki/GIVAYF @@ -20,8 +24,9 @@ GIVAYF: - ldx #$00 - stx $0D - sty FAC1_mantissa - sta FAC1_mantissa+1 + ldx #0 + stx VALTYP + sta FAC1_mantissa+0 + sty FAC1_mantissa+1 + ldx #$90 jmp convert_i16_to_FAC1 diff --git a/tools/similarity.c b/tools/similarity.c index 6dfd16ac..713deee0 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 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] = { + 0xB391, 0xB39D, 0xB3A2, 0xB3A5, 0xB849, 0xB84F, 0xB8D2, 0xB8D5,