diff --git a/Makefile b/Makefile index 439cf4d0..45114ca3 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ SRCDIR_COMMON = c64/aliases SRCDIR_BASIC = $(SRCDIR_COMMON) \ c64/basic \ c64/basic/,stubs \ + c64/basic/,stubs_math \ c64/basic/commands \ c64/basic/init \ c64/basic/rom_revision diff --git a/STATUS.md b/STATUS.md index d1cdaa6c..76fbb50e 100644 --- a/STATUS.md +++ b/STATUS.md @@ -144,7 +144,56 @@ For the current status of the low memory location implementation andd usage chec
-### Unofficial BASIC routines/locations + +### Math package + +Floating point mathematical routines - not official, but well known and broadly used. + +
+ +| Address | Name | Status | Remarks | +| :-------: | :----------- | :------: | :------------------------------------------------: | +| `$B1AA` | `FACINX` | NOT DONE | XXX - no stub added yet | +| `$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 | +| `$B9EA` | `LOG` | NOT DONE | XXX - no stub added yet | +| `$BA28` | `FMULT` | NOT DONE | XXX - no stub added yet | +| `$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 | +| `$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 | +| `$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 | +| `$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 | +| `$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 | +| `$E30E` | `ATN` | NOT DONE | XXX - no stub added yet | + +
+ +### Other unofficial BASIC routines/locations Not all of them - only these we want to have implemented. diff --git a/c64/basic/,stubs_math/ba8c.CONUPK.s b/c64/basic/,stubs_math/ba8c.CONUPK.s new file mode 100644 index 00000000..f31ee902 --- /dev/null +++ b/c64/basic/,stubs_math/ba8c.CONUPK.s @@ -0,0 +1,24 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - fetch FAC2 from RAM location +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// Output: +// - .A - FAC1 exponent (XXX really FAC1?) +// +// 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 + +CONUPK: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/ba8c.interop b/c64/basic/,stubs_math/ba8c.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/ba8c.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/bba2.MOVFM.s b/c64/basic/,stubs_math/bba2.MOVFM.s new file mode 100644 index 00000000..8be43857 --- /dev/null +++ b/c64/basic/,stubs_math/bba2.MOVFM.s @@ -0,0 +1,25 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - copy FAC1 to memory location, rounds if asked +// +// Input: +// - .X - address low byte +// - .Y - address high byte +// - $70 - if MSB is set performs rouding +// +// Output: +// - .A - FAC1 exponent +// +// 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 + +MOVMF: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bba2.interop b/c64/basic/,stubs_math/bba2.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bba2.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/bbd4.MOVMF.s b/c64/basic/,stubs_math/bbd4.MOVMF.s new file mode 100644 index 00000000..a144da44 --- /dev/null +++ b/c64/basic/,stubs_math/bbd4.MOVMF.s @@ -0,0 +1,24 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - fetch FAC1 from RAM location +// +// Input: +// - .A - address low byte +// - .Y - address high byte +// +// Output: +// - .A - FAC1 exponent, affects status flags +// - .Y - always 0 +// +// See also: +// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic +// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics +// + +// XXX provide implementation + +MOVFM: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bbd4.interop b/c64/basic/,stubs_math/bbd4.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bbd4.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/bbfc.MOVEF.s b/c64/basic/,stubs_math/bbfc.MOVEF.s new file mode 100644 index 00000000..b04de5b6 --- /dev/null +++ b/c64/basic/,stubs_math/bbfc.MOVEF.s @@ -0,0 +1,17 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - copy FAC2 to FAC1 +// +// 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 + +MOVEF: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bbfc.interop b/c64/basic/,stubs_math/bbfc.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bbfc.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/bc0f.MOVFA.s b/c64/basic/,stubs_math/bc0f.MOVFA.s new file mode 100644 index 00000000..fbc9087e --- /dev/null +++ b/c64/basic/,stubs_math/bc0f.MOVFA.s @@ -0,0 +1,17 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Math package - copy FAC1 to FAC2, skips rounding +// +// 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 + +MOVFA: + STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bc0f.interop b/c64/basic/,stubs_math/bc0f.interop new file mode 100644 index 00000000..0d18777c --- /dev/null +++ b/c64/basic/,stubs_math/bc0f.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, documented in many places. + +XXX - try to find real-life example