added several floating point constants
This commit is contained in:
1 parent
98ad2952b1
commit
2305856d63
25 files changed
+175
-11
No files matched your search
@@ -16,6 +16,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
|
||||
c64/basic/commands \
|
||||
c64/basic/init \
|
||||
c64/basic/math \
|
||||
c64/basic/math_consts \
|
||||
c64/basic/rom_revision
|
||||
|
||||
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
|
||||
|
||||
@@ -225,6 +225,23 @@ Floating point mathematical routines - not official, but well known and broadly
|
||||
|
||||
<br />
|
||||
|
||||
In addition to the routines, the following floating-number constants are available at their original locations:
|
||||
|
||||
| Address | Name | Status | Remarks |
|
||||
| :-------: | :-------------------- | :------: | :------------------------------------------------: |
|
||||
| `$AEA8` | `const_PI` | DONE | π |
|
||||
| `$B1A5` | `const_NEG_32768` | DONE | -32768 |
|
||||
| `$B9BC` | `const_ONE` | DONE | 1.0 |
|
||||
| `$B9D6` | `const_INV_SQR_2` | DONE | 1 / sqr(2) |
|
||||
| `$B9DB` | `const_SQR_2` | DONE | sqr(2) |
|
||||
| `$B9E0` | `const_NEG_HALF` | DONE | -0.5 |
|
||||
| `$B9E5` | `const_LOG_2` | DONE | log_e(2) |
|
||||
| `$BAF9` | `const_TEN` | DONE | 10.0 |
|
||||
| `$BF11` | `const_HALF` | DONE | 0.5 |
|
||||
| `$BFBF` | `const_INV_LOG_2` | DONE | 1 / log_e(2) |
|
||||
| `$BFE8` | `const_ONE` duplicate | DONE | 1.0 |
|
||||
|
||||
|
||||
### Other unofficial BASIC routines/locations
|
||||
|
||||
Not all of them - only these we want to have implemented.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// - Computes Mapping the Commodore 64, page 103
|
||||
//
|
||||
|
||||
const_PI:
|
||||
|
||||
put_const_PI()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// - Computes Mapping the Commodore 64, page 105
|
||||
//
|
||||
|
||||
CONST_NEG_32768:
|
||||
|
||||
put_const_NEG_32768()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// - Computes Mapping the Commodore 64, page 113
|
||||
//
|
||||
|
||||
const_ONE:
|
||||
|
||||
put_const_ONE()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
//
|
||||
|
||||
const_INV_SQR_2:
|
||||
|
||||
put_const_INV_SQR_2()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
//
|
||||
|
||||
const_SQR_2:
|
||||
|
||||
put_const_SQR_2()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
//
|
||||
|
||||
const_NEG_HALF:
|
||||
|
||||
put_const_NEG_HALF()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
//
|
||||
|
||||
const_LOG_2:
|
||||
|
||||
put_const_LOG_2()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// - Computes Mapping the Commodore 64, page 114
|
||||
//
|
||||
|
||||
const_TEN:
|
||||
|
||||
put_const_TEN()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// - Computes Mapping the Commodore 64, page 116
|
||||
//
|
||||
|
||||
const_HALF:
|
||||
|
||||
put_const_HALF()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
//
|
||||
|
||||
const_INV_LOG_2:
|
||||
|
||||
put_const_INV_LOG_2()
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Math package - a constant, for documentation see:
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
//
|
||||
|
||||
put_const_ONE() // duplicated constant - no label
|
||||
@@ -0,0 +1 @@
|
||||
A well-known floating-point constant, has to be at the same place or we risk hard to debug improper calculation results.
|
||||
+11
-11
@@ -43,17 +43,17 @@ std::vector<ConstEntry> GLOBAL_constants =
|
||||
// - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
// Computes Mapping the Commodore 64, pages 103, 105, 113, 114, 116
|
||||
|
||||
ConstEntry( "HALF", 0.5 ),
|
||||
ConstEntry( "MINUS_HALF", -0.5 ),
|
||||
ConstEntry( "1", 1.0 ),
|
||||
ConstEntry( "10", 10.0 ),
|
||||
ConstEntry( "N32768", -32768.0 ),
|
||||
ConstEntry( "HALF", 0.5 ),
|
||||
ConstEntry( "NEG_HALF", -0.5 ),
|
||||
ConstEntry( "ONE", 1.0 ),
|
||||
ConstEntry( "TEN", 10.0 ),
|
||||
ConstEntry( "NEG_32768", -32768.0 ),
|
||||
|
||||
ConstEntry( "PI", M_PI ),
|
||||
ConstEntry( "SQR_2", std::sqrt(2.0) ),
|
||||
ConstEntry( "1_OVER_SQR_2", 1.0 / std::sqrt(2.0) ),
|
||||
ConstEntry( "LOG_2", std::log(2.0) ),
|
||||
ConstEntry( "1_OVER_LOG_2", 1.0 / std::log(2.0) ),
|
||||
ConstEntry( "PI", M_PI ),
|
||||
ConstEntry( "SQR_2", std::sqrt(2.0) ),
|
||||
ConstEntry( "INV_SQR_2", 1.0 / std::sqrt(2.0) ),
|
||||
ConstEntry( "LOG_2", std::log(2.0) ),
|
||||
ConstEntry( "INV_LOG_2", 1.0 / std::log(2.0) ),
|
||||
};
|
||||
|
||||
//
|
||||
@@ -189,7 +189,7 @@ std::string toAssemblerString(const std::string &constName, double constValue)
|
||||
outFloat[4],
|
||||
constValue);
|
||||
|
||||
std::string outDef = std::string("\n.macro putConst_") + constName + "()\n{\n\t.byte " + buf + "\n}\n";
|
||||
std::string outDef = std::string("\n.macro put_const_") + constName + "()\n{\n\t.byte " + buf + "\n}\n";
|
||||
|
||||
return outDef;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user