From 9de9a6c0a707ce3b38c0170fdca72b7a359868e5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 29 Jan 2020 18:24:31 +0100 Subject: [PATCH] several more stubs for math routines --- STATUS.md | 41 +++++++++++++++-------------- c64/basic/,stubs_math/b1aa.FACINX.s | 20 ++++++++++++++ c64/basic/,stubs_math/b1aa.interop | 3 +++ c64/basic/,stubs_math/b850.FSUB.s | 21 +++++++++++++++ c64/basic/,stubs_math/b850.interop | 3 +++ c64/basic/,stubs_math/b853.FSUBT.s | 23 ++++++++++++++++ c64/basic/,stubs_math/b853.interop | 3 +++ c64/basic/,stubs_math/b867.FADD.s | 21 +++++++++++++++ c64/basic/,stubs_math/b867.interop | 3 +++ c64/basic/,stubs_math/b86a.FADDT.s | 23 ++++++++++++++++ c64/basic/,stubs_math/b86a.interop | 3 +++ c64/basic/,stubs_math/ba28.FMUL.s | 24 +++++++++++++++++ c64/basic/,stubs_math/ba28.interop | 3 +++ c64/basic/,stubs_math/ba2b.FMULT.s | 23 ++++++++++++++++ c64/basic/,stubs_math/ba2b.interop | 3 +++ c64/basic/,stubs_math/bae2.MUL10.s | 17 ++++++++++++ c64/basic/,stubs_math/bae2.interop | 3 +++ c64/basic/,stubs_math/bafe.DIV10.s | 21 +++++++++++++++ c64/basic/,stubs_math/bafe.interop | 3 +++ c64/basic/,stubs_math/bb0f.FDIV.c | 21 +++++++++++++++ c64/basic/,stubs_math/bb0f.interop | 3 +++ c64/basic/,stubs_math/bb12.FDIVT.s | 23 ++++++++++++++++ c64/basic/,stubs_math/bb12.interop | 3 +++ c64/basic/,stubs_math/bc2b.SIGN.s | 20 ++++++++++++++ c64/basic/,stubs_math/bc2b.interop | 3 +++ c64/basic/,stubs_math/bc5b.FCOMP.s | 28 ++++++++++++++++++++ c64/basic/,stubs_math/bc5b.interop | 3 +++ c64/basic/,stubs_math/bf78.FPWR.s | 21 +++++++++++++++ c64/basic/,stubs_math/bf78.interop | 3 +++ c64/basic/,stubs_math/bf7b.FPWRT.s | 24 +++++++++++++++++ c64/basic/,stubs_math/bf7b.interop | 3 +++ c64/basic/,stubs_math/bfb4.NEGOP.s | 16 +++++++++++ c64/basic/,stubs_math/bfb4.interop | 3 +++ c64/basic/,stubs_math/e043.POLY1.s | 27 +++++++++++++++++++ c64/basic/,stubs_math/e043.interop | 3 +++ c64/basic/,stubs_math/e059.POLY2.s | 27 +++++++++++++++++++ c64/basic/,stubs_math/e059.interop | 3 +++ c64/basic/,stubs_math/e264.COS.s | 17 ++++++++++++ c64/basic/,stubs_math/e264.interop | 3 +++ c64/basic/,stubs_math/e26b.SIN.s | 17 ++++++++++++ c64/basic/,stubs_math/e26b.interop | 3 +++ c64/basic/,stubs_math/e2b4.TAN.s | 17 ++++++++++++ c64/basic/,stubs_math/e2b4.interop | 3 +++ 43 files changed, 535 insertions(+), 20 deletions(-) create mode 100644 c64/basic/,stubs_math/b1aa.FACINX.s create mode 100644 c64/basic/,stubs_math/b1aa.interop create mode 100644 c64/basic/,stubs_math/b850.FSUB.s create mode 100644 c64/basic/,stubs_math/b850.interop create mode 100644 c64/basic/,stubs_math/b853.FSUBT.s create mode 100644 c64/basic/,stubs_math/b853.interop create mode 100644 c64/basic/,stubs_math/b867.FADD.s create mode 100644 c64/basic/,stubs_math/b867.interop create mode 100644 c64/basic/,stubs_math/b86a.FADDT.s create mode 100644 c64/basic/,stubs_math/b86a.interop create mode 100644 c64/basic/,stubs_math/ba28.FMUL.s create mode 100644 c64/basic/,stubs_math/ba28.interop create mode 100644 c64/basic/,stubs_math/ba2b.FMULT.s create mode 100644 c64/basic/,stubs_math/ba2b.interop create mode 100644 c64/basic/,stubs_math/bae2.MUL10.s create mode 100644 c64/basic/,stubs_math/bae2.interop create mode 100644 c64/basic/,stubs_math/bafe.DIV10.s create mode 100644 c64/basic/,stubs_math/bafe.interop create mode 100644 c64/basic/,stubs_math/bb0f.FDIV.c create mode 100644 c64/basic/,stubs_math/bb0f.interop create mode 100644 c64/basic/,stubs_math/bb12.FDIVT.s create mode 100644 c64/basic/,stubs_math/bb12.interop create mode 100644 c64/basic/,stubs_math/bc2b.SIGN.s create mode 100644 c64/basic/,stubs_math/bc2b.interop create mode 100644 c64/basic/,stubs_math/bc5b.FCOMP.s create mode 100644 c64/basic/,stubs_math/bc5b.interop create mode 100644 c64/basic/,stubs_math/bf78.FPWR.s create mode 100644 c64/basic/,stubs_math/bf78.interop create mode 100644 c64/basic/,stubs_math/bf7b.FPWRT.s create mode 100644 c64/basic/,stubs_math/bf7b.interop create mode 100644 c64/basic/,stubs_math/bfb4.NEGOP.s create mode 100644 c64/basic/,stubs_math/bfb4.interop create mode 100644 c64/basic/,stubs_math/e043.POLY1.s create mode 100644 c64/basic/,stubs_math/e043.interop create mode 100644 c64/basic/,stubs_math/e059.POLY2.s create mode 100644 c64/basic/,stubs_math/e059.interop create mode 100644 c64/basic/,stubs_math/e264.COS.s create mode 100644 c64/basic/,stubs_math/e264.interop create mode 100644 c64/basic/,stubs_math/e26b.SIN.s create mode 100644 c64/basic/,stubs_math/e26b.interop create mode 100644 c64/basic/,stubs_math/e2b4.TAN.s create mode 100644 c64/basic/,stubs_math/e2b4.interop diff --git a/STATUS.md b/STATUS.md index 399d06c6..ec4a88fe 100644 --- a/STATUS.md +++ b/STATUS.md @@ -176,42 +176,43 @@ Floating point mathematical routines - not official, but well known and broadly | Address | Name | Status | Remarks | | :-------: | :----------- | :------: | :------------------------------------------------: | -| `$B1AA` | `FACINX` | NOT DONE | XXX - no stub added yet | +| `$B1AA` | `FACINX` | NOT DONE | convert FAC1 to 16-bit signed integer | | `$B391` | `GIVAYF` | NOT DONE | XXX - no stub added yet | | `$B7B5` | `STRVAL` | NOT DONE | XXX - no stub added yet | -| `$B850` | `FSUB` | NOT DONE | XXX - no stub added yet | -| `$B853` | `FSUBT` | NOT DONE | XXX - no stub added yet | -| `$B867` | `FADD` | NOT DONE | XXX - no stub added yet | -| `$B86A` | `FADDT` | NOT DONE | XXX - no stub added yet | +| `$B850` | `FSUB` | NOT DONE | subtract FAC1 from RAM | +| `$B853` | `FSUBT` | NOT DONE | subtract FAC1 from FAC2 | +| `$B867` | `FADD` | NOT DONE | add RAM to FAC1 | +| `$B86A` | `FADDT` | NOT DONE | add FAC2 to FAC1 | | `$B9EA` | `LOG` | NOT DONE | XXX - no stub added yet | -| `$BA28` | `FMULT` | NOT DONE | XXX - no stub added yet | +| `$BA28` | `FMUL` | NOT DONE | multiplies FAC1 by RAM | +| `$BA2B` | `FMULT` | NOT DONE | multiplies FAC1 by FAC2 | | `$BA8C` | `CONUPK` | NOT DONE | fetch FAC2 from RAM location | -| `$BAE2` | `MUL10` | NOT DONE | XXX - no stub added yet | -| `$BAFE` | `DIV10` | NOT DONE | XXX - no stub added yet | -| `$BB0F` | `FDIV` | NOT DONE | XXX - no stub added yet | -| `$BB12` | `FDIVT` | NOT DONE | XXX - no stub added yet | +| `$BAE2` | `MUL10` | NOT DONE | multiply FAC1 by 10 | +| `$BAFE` | `DIV10` | NOT DONE | divide FAC1 by 10, result is always positive | +| `$BB0F` | `FDIV` | NOT DONE | divide RAM by FAC1 | +| `$BB12` | `FDIVT` | NOT DONE | divide FAC2 by FAC1, ignores sign | | `$BBA2` | `MOVFM` | NOT DONE | fetch FAC1 from RAM location | | `$BBD4` | `MOVMF` | NOT DONE | copy FAC1 to memory location, rounds if asked | | `$BBFC` | `MOVEF` | NOT DONE | copy FAC2 to FAC1 | | `$BC0F` | `MOVFA` | NOT DONE | copy FAC1 to FAC2, skips rounding | -| `$BC2B` | `SIGN` | NOT DONE | XXX - no stub added yet | +| `$BC2B` | `SIGN` | NOT DONE | evaluate FAC1 sign | | `$BC39` | `SGN` | NOT DONE | XXX - no stub added yet | | `$BC58` | `ABS` | NOT DONE | XXX - no stub added yet | -| `$BC5B` | `FCOMP` | NOT DONE | XXX - no stub added yet | +| `$BC5B` | `FCOMP` | NOT DONE | compare FAC1 with RAM location | | `$BC9B` | `QINT` | NOT DONE | XXX - no stub added yet | | `$BCCC` | `INT` | NOT DONE | XXX - no stub added yet | | `$BCF3` | `FIN` | NOT DONE | XXX - no stub added yet | | `$BDDD` | `FOUT` | NOT DONE | XXX - no stub added yet | | `$BF71` | `SQR` | NOT DONE | XXX - no stub added yet | -| `$BF78` | `FPWR` | NOT DONE | XXX - no stub added yet | -| `$BF7B` | `FPWRT` | NOT DONE | XXX - no stub added yet | -| `$BFB4` | `NEGOP` | NOT DONE | XXX - no stub added yet | +| `$BF78` | `FPWR` | NOT DONE | set FAC1 as RAM raised to the power of FAC1 | +| `$BF7B` | `FPWRT` | NOT DONE | set FAC1 as FAC2 raised to the power of FAC1 | +| `$BFB4` | `NEGOP` | NOT DONE | toggle FAC1 sign (if not 0) | | `$BFED` | `EXP` | NOT DONE | XXX - no stub added yet | -| `$E043` | `POLY1` | NOT DONE | XXX - no stub added yet | -| `$E059` | `POLY2` | NOT DONE | XXX - no stub added yet | -| `$E264` | `COS` | NOT DONE | XXX - no stub added yet | -| `$E26B` | `SIN` | NOT DONE | XXX - no stub added yet | -| `$E2B4` | `TAN` | NOT DONE | XXX - no stub added yet | +| `$E043` | `POLY1` | NOT DONE | evaluate polynomial with odd powers only | +| `$E059` | `POLY2` | NOT DONE | evaluate polynomial with odd and even powers | +| `$E264` | `COS` | NOT DONE | cosine of FAC1 in radians | +| `$E26B` | `SIN` | NOT DONE | sine of FAC1 in radians | +| `$E2B4` | `TAN` | NOT DONE | tangent of FAC1 in radians | | `$E30E` | `ATN` | NOT DONE | XXX - no stub added yet |
diff --git a/c64/basic/,stubs_math/b1aa.FACINX.s b/c64/basic/,stubs_math/b1aa.FACINX.s new file mode 100644 index 00000000..9769eeea --- /dev/null +++ b/c64/basic/,stubs_math/b1aa.FACINX.s @@ -0,0 +1,20 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - convert FAC1 to 16-bit signed integer +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 105 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// + +// XXX provide implementation + +FACINX: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/b1aa.interop b/c64/basic/,stubs_math/b1aa.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/b1aa.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/b850.FSUB.s b/c64/basic/,stubs_math/b850.FSUB.s new file mode 100644 index 00000000..b5f3dc11 --- /dev/null +++ b/c64/basic/,stubs_math/b850.FSUB.s @@ -0,0 +1,21 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - subtract FAC1 from RAM +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 112 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FSUB: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/b850.interop b/c64/basic/,stubs_math/b850.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/b850.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/b853.FSUBT.s b/c64/basic/,stubs_math/b853.FSUBT.s new file mode 100644 index 00000000..6e19e784 --- /dev/null +++ b/c64/basic/,stubs_math/b853.FSUBT.s @@ -0,0 +1,23 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - subtract FAC1 from FAC2 +// +// Input: +// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag +// +// Note: +// - load FAC2 after FAC1, or mimic the Kernals sign comparison +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 112 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FSUBT: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/b853.interop b/c64/basic/,stubs_math/b853.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/b853.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/b867.FADD.s b/c64/basic/,stubs_math/b867.FADD.s new file mode 100644 index 00000000..8187d247 --- /dev/null +++ b/c64/basic/,stubs_math/b867.FADD.s @@ -0,0 +1,21 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - add RAM to FAC1 +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 112 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FADD: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/b867.interop b/c64/basic/,stubs_math/b867.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/b867.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/b86a.FADDT.s b/c64/basic/,stubs_math/b86a.FADDT.s new file mode 100644 index 00000000..a1cf6d08 --- /dev/null +++ b/c64/basic/,stubs_math/b86a.FADDT.s @@ -0,0 +1,23 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - add FAC2 to FAC1 +// +// Input: +// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag +// +// Note: +// - load FAC2 after FAC1, or mimic the Kernals sign comparison +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 112 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FADDT: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/b86a.interop b/c64/basic/,stubs_math/b86a.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/b86a.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/ba28.FMUL.s b/c64/basic/,stubs_math/ba28.FMUL.s new file mode 100644 index 00000000..f79b830b --- /dev/null +++ b/c64/basic/,stubs_math/ba28.FMUL.s @@ -0,0 +1,24 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - multiplies FAC1 by RAM +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// Note: +// - C64 Wiki calls it FMULT, this looks like a mistake +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 113 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FMUL: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/ba28.interop b/c64/basic/,stubs_math/ba28.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/ba28.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/ba2b.FMULT.s b/c64/basic/,stubs_math/ba2b.FMULT.s new file mode 100644 index 00000000..1a3ef3ab --- /dev/null +++ b/c64/basic/,stubs_math/ba2b.FMULT.s @@ -0,0 +1,23 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - multiplies FAC1 by FAC2 +// +// Input: +// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag +// +// Note: +// - load FAC2 after FAC1, or mimic the Kernals sign comparison +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 113 XXX address does not match +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FMULT: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/ba2b.interop b/c64/basic/,stubs_math/ba2b.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/ba2b.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bae2.MUL10.s b/c64/basic/,stubs_math/bae2.MUL10.s new file mode 100644 index 00000000..3fde16d3 --- /dev/null +++ b/c64/basic/,stubs_math/bae2.MUL10.s @@ -0,0 +1,17 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - multiply FAC1 by 10 +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 114 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +MUL10: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bae2.interop b/c64/basic/,stubs_math/bae2.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bae2.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bafe.DIV10.s b/c64/basic/,stubs_math/bafe.DIV10.s new file mode 100644 index 00000000..3d59810d --- /dev/null +++ b/c64/basic/,stubs_math/bafe.DIV10.s @@ -0,0 +1,21 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - divide FAC1 by 10, result is always positive +// +// Notes: +// - shifts FAC1 to FAC2, loads FAC1 with the constant 10, falls through to the division routine + +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 114 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +DIV10: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bafe.interop b/c64/basic/,stubs_math/bafe.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bafe.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bb0f.FDIV.c b/c64/basic/,stubs_math/bb0f.FDIV.c new file mode 100644 index 00000000..386c63d5 --- /dev/null +++ b/c64/basic/,stubs_math/bb0f.FDIV.c @@ -0,0 +1,21 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - divide RAM by FAC1 +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 114 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FDIV: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bb0f.interop b/c64/basic/,stubs_math/bb0f.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bb0f.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bb12.FDIVT.s b/c64/basic/,stubs_math/bb12.FDIVT.s new file mode 100644 index 00000000..d02ef219 --- /dev/null +++ b/c64/basic/,stubs_math/bb12.FDIVT.s @@ -0,0 +1,23 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - divide FAC2 by FAC1, ignores sign +// +// Input: +// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag +// +// Output: +// - leaves the quotient FAC1 and the remainder in FAC2 +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 114 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FDIVT: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bb12.interop b/c64/basic/,stubs_math/bb12.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bb12.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bc2b.SIGN.s b/c64/basic/,stubs_math/bc2b.SIGN.s new file mode 100644 index 00000000..e0a98612 --- /dev/null +++ b/c64/basic/,stubs_math/bc2b.SIGN.s @@ -0,0 +1,20 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - evaluate FAC1 sign +// +// Output: +// - .A - $00 for equal, $01 for FAC1 > RAM, $FF for FAC1 < RAM +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 115 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +SIGN: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bc2b.interop b/c64/basic/,stubs_math/bc2b.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bc2b.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bc5b.FCOMP.s b/c64/basic/,stubs_math/bc5b.FCOMP.s new file mode 100644 index 00000000..c73858b7 --- /dev/null +++ b/c64/basic/,stubs_math/bc5b.FCOMP.s @@ -0,0 +1,28 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - compare FAC1 with RAM location +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// Output: +// - .A - $00 for equal, $01 for FAC1 > RAM, $FF for FAC1 < RAM +// - flags N/Z, depending on whether FAC1 is 0, positive, or negative +// +// Notes: +// - uses vector at $24, leaves FAC1 and FAC2 unchanged (Codebase64) +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 115 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FCOMP: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bc5b.interop b/c64/basic/,stubs_math/bc5b.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bc5b.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bf78.FPWR.s b/c64/basic/,stubs_math/bf78.FPWR.s new file mode 100644 index 00000000..42226482 --- /dev/null +++ b/c64/basic/,stubs_math/bf78.FPWR.s @@ -0,0 +1,21 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - set FAC1 as RAM raised to the power of FAC1 +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 117 (FPWRT) +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FPWR: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bf78.interop b/c64/basic/,stubs_math/bf78.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bf78.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bf7b.FPWRT.s b/c64/basic/,stubs_math/bf7b.FPWRT.s new file mode 100644 index 00000000..7dfbc8c9 --- /dev/null +++ b/c64/basic/,stubs_math/bf7b.FPWRT.s @@ -0,0 +1,24 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - set FAC1 as FAC2 raised to the power of FAC1 +// +// Input: +// - .A - must load FAC1 exponent ($61) beforehand to set the zero flag +// +// Note: +// - load FAC2 after FAC1, or mimic the Kernals sign comparison +// - uses exp(x*log(y)) formula to calculate y^x; slow and inaccurate +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 117 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +FPWRT: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bf7b.interop b/c64/basic/,stubs_math/bf7b.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bf7b.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/bfb4.NEGOP.s b/c64/basic/,stubs_math/bfb4.NEGOP.s new file mode 100644 index 00000000..838f92c5 --- /dev/null +++ b/c64/basic/,stubs_math/bfb4.NEGOP.s @@ -0,0 +1,16 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - toggle FAC1 sign (if not 0) +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 117 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// + +// XXX provide implementation + +NEGOP: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bfb4.interop b/c64/basic/,stubs_math/bfb4.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bfb4.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/e043.POLY1.s b/c64/basic/,stubs_math/e043.POLY1.s new file mode 100644 index 00000000..c4042bc8 --- /dev/null +++ b/c64/basic/,stubs_math/e043.POLY1.s @@ -0,0 +1,27 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - evaluate polynomial with odd powers only for FAC1 value +// +// Input: +// - .A - table address low byte +// - .Y - table address low byte +// - table format: +// - polynomial degree (8 bit integer) +// - oefficients (floats), starting from highest degree, times 1+degree +// +// Notes: +// - calls POLY2(table, X*X)*X +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 206 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://www.c64-wiki.com/wiki/POLY1 +// + +// XXX provide implementation + +POLY1: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e043.interop b/c64/basic/,stubs_math/e043.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/e043.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/e059.POLY2.s b/c64/basic/,stubs_math/e059.POLY2.s new file mode 100644 index 00000000..b2d94100 --- /dev/null +++ b/c64/basic/,stubs_math/e059.POLY2.s @@ -0,0 +1,27 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - evaluate polynomial with odd and even powers for FAC1 value +// +// Input: +// - .A - table address low byte +// - .Y - table address low byte +// - table format: +// - polynomial degree (8 bit integer) +// - oefficients (floats), starting from highest degree, times 1+degree +// +// Notes: +// - uses Horner method +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 207 +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://www.c64-wiki.com/wiki/POLY1 +// + +// XXX provide implementation + +POLY2: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e059.interop b/c64/basic/,stubs_math/e059.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/e059.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/e264.COS.s b/c64/basic/,stubs_math/e264.COS.s new file mode 100644 index 00000000..bdf0b761 --- /dev/null +++ b/c64/basic/,stubs_math/e264.COS.s @@ -0,0 +1,17 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - cosine 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 + +COS: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e264.interop b/c64/basic/,stubs_math/e264.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/e264.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/e26b.SIN.s b/c64/basic/,stubs_math/e26b.SIN.s new file mode 100644 index 00000000..5ca46126 --- /dev/null +++ b/c64/basic/,stubs_math/e26b.SIN.s @@ -0,0 +1,17 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - sine of FAC1 in radians +// +// See also: +// - [CM64] Computes Mapping the Commodore 64 - page 210 - XXX address does not match +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +SIN: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e26b.interop b/c64/basic/,stubs_math/e26b.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/e26b.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example diff --git a/c64/basic/,stubs_math/e2b4.TAN.s b/c64/basic/,stubs_math/e2b4.TAN.s new file mode 100644 index 00000000..d0cc416d --- /dev/null +++ b/c64/basic/,stubs_math/e2b4.TAN.s @@ -0,0 +1,17 @@ +// #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: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e2b4.interop b/c64/basic/,stubs_math/e2b4.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/e2b4.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example