diff --git a/STATUS.md b/STATUS.md index cb62be7f..e9a4f499 100644 --- a/STATUS.md +++ b/STATUS.md @@ -236,7 +236,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$BC1B` | `round_FAC1` | PARTIAL | not fully tested yet | | `$BC2B` | `sgn_FAC1_A` | DONE | From the Microsoft BASIC, original name: SIGN | | `$BC39` | `sgn_FAC1` | DONE | From the Microsoft BASIC, original name: SGN | -| `$BC3C` | `convert_A_to_FAC1` | DONE | | +| `$BC3C` | `convert_A_to_FAC1` | DONE | From the Microsoft BASIC, original name: FLOAT | | `$BC44` | `convert_i16_to_FAC1` | DONE | | | `$BC58` | `abs_FAC1` | DONE | From the Microsoft BASIC, original name: ABS | | `$BC5B` | `FCOMP` | DONE | | diff --git a/src/basic/math/bc3c.convert_A_to_FAC1.s b/src/basic/math/bc3c.convert_A_to_FAC1.s index b5e22c2a..a14ad32e 100644 --- a/src/basic/math/bc3c.convert_A_to_FAC1.s +++ b/src/basic/math/bc3c.convert_A_to_FAC1.s @@ -3,22 +3,26 @@ ;; #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 int8 in A to FAC1 ; ; Input: A - int8 to convert to float ; Result: FAC1 ; +; This is verified to be identical to the original Microsoft implementation where it was named FLOAT. +; ; Sets first byte of FAC1 to A, sign extends A into tge second byte and falls through to convert_i16_to_FAC1 ; ; - https://codebase64.org/doku.php?id=base:asm_include_file_for_basic_routines ; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics ; - convert_A_to_FAC1: + sta FAC1_mantissa+0 + lda #0 sta FAC1_mantissa+1 - jsr sign_extend_A_to_Y - sty FAC1_mantissa - +nop ; To not leave a gap to the fallthrough + ldx #$88 + ; Fall through to convert_i16_to_FAC1 diff --git a/src/basic/math/sign_extend_A_to_Y.s b/src/basic/math/sign_extend_A_to_Y.s deleted file mode 100644 index adf05a08..00000000 --- a/src/basic/math/sign_extend_A_to_Y.s +++ /dev/null @@ -1,13 +0,0 @@ -;; #LAYOUT# STD * #TAKE -;; #LAYOUT# * BASIC_0 #TAKE -;; #LAYOUT# * * #IGNORE - -; -; Math package - helper function to sign extend accumulator into Y - -sign_extend_A_to_Y: - cmp #$80 ; Copy sign into carry - ldy #$00 ; Y = $00 - bcc @1 ; Branch if not negative - dey ; Y = $FF -@1: rts diff --git a/tools/similarity.c b/tools/similarity.c index a27c7375..25345ee9 100644 --- a/tools/similarity.c +++ b/tools/similarity.c @@ -28,7 +28,7 @@ unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = { 0xB947, 0xB97D, 0xB983, 0xB9BB, 0xBBA2, 0xBC1A, - 0xBC2B, 0xBC3B, + 0xBC2B, 0xBC43, 0xBC58, 0xBC5A, 0xBC9B, 0xBCF2, };