Update poly2_FAC1
This commit is contained in:
1 parent
33355766b4
commit
5127e41643
3 files changed
+40
-44
No files matched your search
@@ -258,7 +258,7 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
| `$BFB4` | `toggle_sign_FAC1` | DONE | From the Microsoft BASIC, original name: NEGOP |
|
||||
| `$BFED` | `exp_FAC1` | NOT DONE | |
|
||||
| `$E043` | `poly1_FAC1` | DONE | From the Microsoft BASIC, original name: POLYX |
|
||||
| `$E059` | `poly2_FAC1` | PARTIAL | not fully tested yet |
|
||||
| `$E059` | `poly2_FAC1` | DONE | From the Microsoft BASIC, original name: POLY |
|
||||
| `$E097` | `rnd_FAC1` | DONE | |
|
||||
| `$E09A` | `rnd_A` | DONE | |
|
||||
| `$E0BE` | `rnd_generate` | DONE | |
|
||||
|
||||
@@ -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 and even powers for FAC1 value
|
||||
;
|
||||
; This is verified to be identical to the original Microsoft implementation where it was named POLY.
|
||||
;
|
||||
; Input:
|
||||
; - .A - table address low byte
|
||||
; - .Y - table address low byte
|
||||
@@ -28,48 +32,40 @@
|
||||
|
||||
|
||||
poly2_FAC1:
|
||||
jsr store_YA_in_ZP
|
||||
sta POLYPT
|
||||
sty POLYPT+1
|
||||
|
||||
POLY1:
|
||||
jsr mov_r_FAC1_TMP2 ; Save FAC1
|
||||
lda (POLYPT),Y
|
||||
sta DEGREE
|
||||
ldy POLYPT
|
||||
iny
|
||||
tya
|
||||
bne POLY3
|
||||
inc POLYPT+1
|
||||
POLY3:
|
||||
sta POLYPT
|
||||
ldy POLYPT+1
|
||||
POLY2:
|
||||
jsr mul_MEM_FAC1
|
||||
lda POLYPT ; Get current pointer
|
||||
ldy POLYPT+1
|
||||
clc
|
||||
adc #5
|
||||
bcc POLY4
|
||||
iny
|
||||
POLY4:
|
||||
sta POLYPT
|
||||
sty POLYPT+1
|
||||
jsr add_MEM_FAC1 ; Add in constant
|
||||
lda #<TEMPF2 ; Multiply the original FAC1
|
||||
ldy #>TEMPF2
|
||||
dec DEGREE ; Done?
|
||||
bne POLY2
|
||||
RANDRT:
|
||||
rts ; Yes
|
||||
|
||||
poly2_table_in_index2: ; Called from poly1
|
||||
ldy #$00 ; FAC1 -> TMPF2
|
||||
ldx #TEMPF2
|
||||
jsr mov_FAC1_MEM
|
||||
|
||||
ldx #$80 ; 0 -> FAC1
|
||||
stx FAC1_exponent
|
||||
|
||||
ldx #0
|
||||
lda (INDEX+2, x) ; degree (degree+1 = num coeffs)
|
||||
sta SGNFLG ; number of terms register
|
||||
inc INDEX+2
|
||||
bcc @1
|
||||
inc INDEX+3
|
||||
|
||||
@1:
|
||||
lda INDEX+2
|
||||
ldy INDEX+3
|
||||
jsr add_MEM_FAC1 ; Add with coefficient
|
||||
ldy #$00
|
||||
lda #TEMPF2
|
||||
jsr mul_MEM_FAC1 ; Multiply with x
|
||||
|
||||
clc ; Add 5 to table pointer
|
||||
lda #$05
|
||||
adc INDEX+2
|
||||
sta INDEX+2
|
||||
bcc @2
|
||||
inc INDEX+3
|
||||
|
||||
@2:
|
||||
dec SGNFLG
|
||||
bpl @1
|
||||
rts
|
||||
|
||||
|
||||
store_YA_in_ZP: ; Used also by poly1
|
||||
sty INDEX+3 ; Store YA in second INDEX pointer
|
||||
sta INDEX+2
|
||||
rts
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
|
||||
0xBDB3, 0xBDC1,
|
||||
0xBDDD, 0xBF51,
|
||||
0xBFB4, 0xBFEC,
|
||||
0xE043, 0xE058,
|
||||
0xE043, 0xE08C,
|
||||
0xE264, 0xE2C2, // Two byte gap here is an optimization
|
||||
0xE2C5, 0xE37A,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user