Update poly1_FAC1

This commit is contained in:
Rikard Nordgren authored and FeralChild64 committed 2026-04-29 21:18:16 +02:00
1 parent e7790b7b10
commit 33355766b4
4 files changed
+20 -12

No files matched your search

+1 -1
View File
@@ -257,7 +257,7 @@ Floating point mathematical routines - not official, but well known and broadly
| `$BF7B` | `pwr_FAC2_FAC1` | NOT DONE | |
| `$BFB4` | `toggle_sign_FAC1` | DONE | From the Microsoft BASIC, original name: NEGOP |
| `$BFED` | `exp_FAC1` | NOT DONE | |
| `$E043` | `poly1_FAC1` | PARTIAL | not fully tested yet |
| `$E043` | `poly1_FAC1` | DONE | From the Microsoft BASIC, original name: POLYX |
| `$E059` | `poly2_FAC1` | PARTIAL | not fully tested yet |
| `$E097` | `rnd_FAC1` | DONE | |
| `$E09A` | `rnd_A` | DONE | |
+3 -1
View File
@@ -69,6 +69,7 @@
!addr FAC1_sign = $66
!addr SGNFLG = $67 ; Also used as number of terms of series evaluation
!addr DEGREE = SGNFLG
!addr BITS = $68 ; FAC1 overflow
!addr __FAC2 = $69 ; $69-$6E floating point accumulator 2 [!] also used for memory move pointers
@@ -78,7 +79,8 @@
!addr ARISGN = $6F ; -- NOT IMPLEMENTED --
!addr FACOV = $70 ; FAC1 low order mantissa
!addr FBUFPT = $71 ; $71-$72 -- NOT IMPLEMENTED --
!addr FBUFPT = $71 ; $71-$72
!addr POLYPT = FBUFPT
!addr CHRGET = $73 ; $73-$8A copied from $E3A2 during cold start
!addr CHRGOT = $79 ; same area as CHRGET
!addr TXTPTR = $7A ; $7A-$7B current BASIC statement pointer
+14 -9
View File
@@ -2,9 +2,13 @@
;; #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 - evaluate polynomial with odd powers only for FAC1 value
;
; This is verified to be identical to the original Microsoft implementation where it was named POLYX.
;
; Input:
; - .A - table address low byte
; - .Y - table address low byte
@@ -25,14 +29,15 @@
poly1_FAC1:
jsr store_YA_in_ZP ; Store YA in second INDEX pointer
jsr mov_r_FAC1_TMP1 ; TMPF1 <- FAC1 (rounds)
jsr mov_FAC1_FAC2 ; FAC2 <- FAC1
jsr mul_FAC2_FAC1 ; FAC1 <- FAC1 * FAC2 (x^2)
jsr poly2_table_in_index2 ; poly2: skip storing YA to ZP
ldy #$00 ; FAC1 <- FAC1 * TEMPF1
lda #TEMPF1
jmp mul_MEM_FAC1
sta POLYPT ; Retain polynomial pointer for later
sty POLYPT+1
jsr mov_r_FAC1_TMP1 ; Save FAC1 in TMP1
lda #TEMPF1
jsr mul_MEM_FAC1 ; Compute x^2
jsr POLY1 ; Compute P(x^2)
lda #<TEMPF1
ldy #>TEMPF1
jmp mul_MEM_FAC1 ; Multiply by FAC1 again
} else {
+2 -1
View File
@@ -20,7 +20,7 @@ int matches[MAX_SIZE];
int phase_mask[MAX_SIZE+MAX_SIZE];
#define NUM_CHUNKS 11
#define NUM_CHUNKS 12
// 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,
@@ -32,6 +32,7 @@ unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
0xBDB3, 0xBDC1,
0xBDDD, 0xBF51,
0xBFB4, 0xBFEC,
0xE043, 0xE058,
0xE264, 0xE2C2, // Two byte gap here is an optimization
0xE2C5, 0xE37A,
};