Merge pull request #104 from rikardn/trans

Add config option for transcendental BASIC functions
This commit is contained in:
FeralChild64 authored and GitHub committed 2025-04-22 19:08:06 +00:00
commit 0e6e0a5fc4
35 files changed
+152

No files matched your search

+1
View File
@@ -35,6 +35,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
src/basic/math \
src/basic/math_consts \
src/basic/math_mov \
src/basic/math_trans \
src/basic/memory \
src/basic/print \
src/basic/rom_revision \
+5
View File
@@ -114,6 +114,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND NO
+5
View File
@@ -51,6 +51,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND NO
+5
View File
@@ -105,6 +105,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND YES
+5
View File
@@ -88,6 +88,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Built-in DOS configuration
;; #CONFIG# UNIT_SDCARD 27
+5
View File
@@ -103,6 +103,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND NO
+5
View File
@@ -103,6 +103,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND NO
+5
View File
@@ -93,6 +93,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND YES
+5
View File
@@ -95,6 +95,11 @@
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
; --- BASIC features
;; #CONFIG# TRANSCENDENTAL_FUNCTIONS NO
; --- Eye candy
;; #CONFIG# COLORS_BRAND YES
File renamed without changes.
@@ -22,6 +22,8 @@
; 5. Multiply by LOG(2) giving LOG(X)
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
log_FAC1:
lda FAC1_exponent ; Store exponent for later
@@ -62,3 +64,8 @@ log_FAC1:
ldy #>const_LOG_2 ; FAC1 <- FAC1 * log(2.0)
lda #<const_LOG_2
jmp mul_MEM_FAC1
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
@@ -15,8 +15,16 @@
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
;
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
sqr_FAC1:
jsr mov_FAC1_FAC2
; FALLLTROUGH to sqr_FAC2
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
@@ -17,8 +17,16 @@
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
;
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
pwr_FAC2_MEM:
jsr mov_MEM_FAC1
; FALLTROUGH to pwr_FAC2_FAC1
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
@@ -21,6 +21,9 @@
; - https://www.c64-wiki.com/wiki/POLY1
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
poly1_FAC1:
jsr store_YA_in_ZP ; Store YA in second INDEX pointer
jsr mov_r_FAC1_TMP1 ; TMPF1 <- FAC1 (rounds)
@@ -30,3 +33,8 @@ poly1_FAC1:
ldy #$00 ; FAC1 <- FAC1 * TEMPF1
lda #TEMPF1
jmp mul_MEM_FAC1
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
@@ -24,6 +24,9 @@
;
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
poly2_FAC1:
jsr store_YA_in_ZP
@@ -67,3 +70,8 @@ store_YA_in_ZP: ; Used also by poly1
sty INDEX+3 ; Store YA in second INDEX pointer
sta INDEX+2
rts
} else {
jmp do_NOT_IMPLEMENTED_error
}
@@ -13,9 +13,18 @@
; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
;
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
COS:
ldy #>const_HALF_PI
lda #<const_HALF_PI
jsr add_MEM_FAC1
; FALLTHROUGH to SIN
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
File renamed without changes.
@@ -12,6 +12,8 @@
; - https://www.c64-wiki.com/wiki/SIN
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
sin_FAC1:
@@ -53,3 +55,8 @@ sin_next:
ldy #>poly_sin
lda #<poly_sin
jmp poly1_FAC1
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
@@ -13,6 +13,10 @@
; tan(x) = sin(x) / cos(x)
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
tan_FAC1:
jsr mov_r_FAC1_TMP1 ; TMP1 = x
jsr sin_FAC1 ; FAC1 = sin(x)
@@ -25,3 +29,8 @@ tan_FAC1:
ldy #0
jsr mov_MEM_FAC2 ; FAC2 = sin(x)
jmp div_FAC2_FAC1 ; FAC1 = tan(x)
} else {
jmp do_NOT_IMPLEMENTED_error
}
@@ -19,6 +19,9 @@
; 5. Adjust sign of result and offset with pi/2 if needed as per above
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
atn_FAC1:
lda FAC1_sign ; Save sign of FAC1 on the stack
pha
@@ -55,3 +58,8 @@ atn_skipoffset:
atn_out:
rts
} else {
jmp do_NOT_IMPLEMENTED_error
}
File renamed without changes.
@@ -5,6 +5,10 @@
; Polynomial for the atn function
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
poly_atn:
!byte $0B ; series length - 1
@@ -21,3 +25,6 @@ poly_atn:
+PUT_CONST_POLY_ATN_10
+PUT_CONST_POLY_ATN_11
+PUT_CONST_POLY_ATN_12
}
@@ -5,6 +5,10 @@
; Polynomial for the exponential function
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
poly_exp:
!byte $07 ; series length - 1
@@ -17,3 +21,6 @@ poly_exp:
+PUT_CONST_POLY_EXP_6
+PUT_CONST_POLY_EXP_7
+PUT_CONST_POLY_EXP_8
}
@@ -5,6 +5,10 @@
; Polynomial for the logarithm function
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
poly_log:
!byte $03 ; series length - 1
@@ -13,3 +17,6 @@ poly_log:
+PUT_CONST_POLY_LOG_2
+PUT_CONST_POLY_LOG_3
+PUT_CONST_POLY_LOG_4
}
@@ -6,6 +6,9 @@
; Polynomial for the sine function
!ifdef CONFIG_TRANSCENDENTAL_FUNCTIONS {
poly_sin:
!byte $05 ; series length - 1
@@ -21,3 +24,6 @@ poly_sin:
; Constant 0.75 needed for sine calculation
sin_three_quarters:
!byte $80, $40, $00, $00, $00
}
+3
View File
@@ -0,0 +1,3 @@
$A3 + BCC $03 + JMP fragment
Fragments
+3
View File
@@ -0,0 +1,3 @@
$A6 + LDA #$01 + BIT fragment
Fragments
+3
View File
@@ -0,0 +1,3 @@
$B0 + LDA #$00 + STA fragment
Fragments
+3
View File
@@ -0,0 +1,3 @@
$E0 + LDA #$00 + JSR fragment
Fragments