diff --git a/STATUS.md b/STATUS.md index 53bab291..f6d74d3f 100644 --- a/STATUS.md +++ b/STATUS.md @@ -255,7 +255,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$E0BE` | `rnd_generate` | DONE | | | `$E264` | `cos_FAC1` | PARTIAL | needs `sin_FAC1` | | `$E26B` | `sin_FAC1` | NOT DONE | some work already started | -| `$E2B4` | `tan_FAC1` | NOT DONE | | +| `$E2B4` | `tan_FAC1` | PARTIAL | not fully tested yet | | `$E30E` | `atn_FAC1` | NOT DONE | |
diff --git a/src/basic/,stubs_math/e2b4.tan_FAC1.s b/src/basic/,stubs_math/e2b4.tan_FAC1.s deleted file mode 100644 index 778ffa21..00000000 --- a/src/basic/,stubs_math/e2b4.tan_FAC1.s +++ /dev/null @@ -1,18 +0,0 @@ -;; #LAYOUT# STD * #TAKE -;; #LAYOUT# * BASIC_0 #TAKE -;; #LAYOUT# * * #IGNORE - -; -; Math package - tangent of FAC1 in radians -; -; See also: -; - [CM64] Computes Mapping the Commodore 64 - page 210 -; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic -; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics -; - -; XXX provide implementation - -tan_FAC1: - - +STUB_IMPLEMENTATION diff --git a/src/basic/,stubs_math/e2b4.interop b/src/basic/math/e2b4.interop similarity index 100% rename from src/basic/,stubs_math/e2b4.interop rename to src/basic/math/e2b4.interop diff --git a/src/basic/math/e2b4.tan_FAC1.s b/src/basic/math/e2b4.tan_FAC1.s new file mode 100644 index 00000000..7a9c6538 --- /dev/null +++ b/src/basic/math/e2b4.tan_FAC1.s @@ -0,0 +1,27 @@ +;; #LAYOUT# STD * #TAKE +;; #LAYOUT# * BASIC_0 #TAKE +;; #LAYOUT# * * #IGNORE + +; +; Math package - tangent of FAC1 in radians +; +; See also: +; - [CM64] Computes Mapping the Commodore 64 - page 210 +; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +; - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +; - https://www.c64-wiki.com/wiki/TAN + +; tan(x) = sin(x) / cos(x) + +tan_FAC1: + jsr mov_r_FAC1_TMP1 ; TMP1 = x + jsr sin_FAC1 ; FAC1 = sin(x) + jsr mov_r_FAC1_TMP2 ; TMP2 = sin(x) + lda #TEMPF1 + ldy #0 + jsr mov_MEM_FAC1 ; FAC1 = x + jsr COS ; FAC1 = cos(x) + lda #TEMPF2 + ldy #0 + jsr mov_MEM_FAC2 ; FAC2 = sin(x) + jmp div_FAC2_FAC1 ; FAC1 = tan(x) diff --git a/strings/0020A2BB b/strings/0020A2BB new file mode 100644 index 00000000..d49cc082 --- /dev/null +++ b/strings/0020A2BB @@ -0,0 +1,3 @@ +$00 + JSR $BBA2 + +Fragment + call to well known floating point function diff --git a/strings/1860202E b/strings/1860202E new file mode 100644 index 00000000..7d6bffa4 --- /dev/null +++ b/strings/1860202E @@ -0,0 +1,3 @@ +CLC + RTS + JSR fragment + +Fragment of ending one function and beginning the next diff --git a/strings/A957A000 b/strings/A957A000 new file mode 100644 index 00000000..b39ab76d --- /dev/null +++ b/strings/A957A000 @@ -0,0 +1,3 @@ +LDA #$57 + LDY #$00 + +Load address of known zero page temporary floating point register into YA diff --git a/strings/A957A00020A2BB b/strings/A957A00020A2BB new file mode 100644 index 00000000..35470763 --- /dev/null +++ b/strings/A957A00020A2BB @@ -0,0 +1,3 @@ +LDA #$57 + LDY #$00 + JSR $BBA2 + +Load adress of known temporary floating point register in zero page and call well known floating point function diff --git a/strings/A95CA000 b/strings/A95CA000 new file mode 100644 index 00000000..ddd31646 --- /dev/null +++ b/strings/A95CA000 @@ -0,0 +1,3 @@ +LDA #$5C + LDY #$00 + +Load address of known zero page temporary floating point register into YA diff --git a/strings/FFFF0000000000000000000000000000000000 b/strings/FFFF0000000000000000000000000000000000 new file mode 100644 index 00000000..caf8de5c --- /dev/null +++ b/strings/FFFF0000000000000000000000000000000000 @@ -0,0 +1,3 @@ +$FF followed by multiple 0's + +Meaningless - results of both ROM sets having empty space.