From 4673f825afcbed1dbbe5ee9f2857b06e64d094f5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 1 Feb 2020 22:01:14 +0100 Subject: [PATCH] naming cleanup in math routines --- STATUS.md | 90 +++++++++---------- .../{b86a.FADDT.s => b86a.add_FAC2_FAC1.s} | 2 +- .../{b9ea.LOG.s => b9ea.log_FAC1.s} | 2 +- .../{ba2b.FMULT.s => ba2b.mul_FAC2_FAC1.s} | 2 +- .../{bae2.MUL10.s => bae2.mul10_FAC1.s} | 2 +- .../{bafe.DIV10.s => bafe.div10_FAC1_p.s} | 2 +- .../{bb12.FDIVT.s => bb12.div_FAC2_FAC1.s} | 2 +- .../{bc2b.SIGN.s => bc2b.sgn_FAC1_A.s} | 2 +- .../{bc39.SGN.s => bc39.sgn_FAC1.s} | 2 +- .../{bc58.ABS.s => bc58.abs_FAC1.s} | 2 +- .../{bccc.INT.s => bccc.int_FAC1.s} | 2 +- .../{bf71.SQR.s => bf71.sqr_FAC1.s} | 2 +- .../{bf74.SQR2.s => bf74.sqr_FAC2.s} | 2 +- .../{bfed.EXP.s => bfed.exp_FAC1.s} | 2 +- .../{e043.POLY1.s => e043.poly1_FAC1.s} | 2 +- .../{e059.POLY2.s => e059.poly2_FAC1.s} | 2 +- .../{e264.COS.s => e264.cos_FAC1.s} | 0 .../{e26b.SIN.s => e26b.sin_FAC1.s} | 2 +- .../{e2b4.TAN.s => e2b4.tan_FAC1.s} | 2 +- .../{e30e.ATN.s => e30e.atn_FAC1.s} | 2 +- .../math/{b867.FADD.s => b850.sub_MEM_FAC1.s} | 8 +- c64/basic/{,stubs_math => math}/b853.interop | 0 .../b853.sub_FAC2_FAC1.s} | 19 ++-- .../math/{b850.FSUB.s => b867.add_MEM_FAC1.s} | 8 +- ...fe.NORMAL.jmp.s => b8fe.normal_FAC1.jmp.s} | 2 +- .../math/{ba28.FMUL.s => ba28.mul_MEM_FAC1.s} | 6 +- ...c.CONUPK.jmp.s => ba8c.mov_MEM_FAC2.jmp.s} | 2 +- .../math/{bb0f.FDIV.s => bb0f.div_MEM_FAC1.s} | 6 +- ...a2.MOVFM.jmp.s => bba2.mov_MEM_FAC1.jmp.s} | 2 +- .../{bc0c.MOVAF.s => bc0c.mov_r_FAC1_FAC2.s} | 6 +- c64/basic/math/bc0f.mov_FAC1_FAC2.jmp.s | 7 ++ c64/basic/math/bc1b.ROUND.jmp.s | 7 -- ...bc0f.MOVFA.jmp.s => bc1b.round_FAC1.jmp.s} | 3 +- .../{bfb4.NEGOP.s => bfb4.toggle_sign_FAC1.s} | 2 +- c64/basic/math/{MOVFA.s => mov_FAC1_FAC2.s} | 2 +- c64/basic/math/{MOVFM.s => mov_MEM_FAC1.s} | 2 +- c64/basic/math/{CONUPK.s => mov_MEM_FAC2.s} | 4 +- c64/basic/math/{NORMAL.s => normal_FAC1.s} | 20 ++--- c64/basic/math/{ROUND.s => round_FAC1.s} | 20 ++--- 39 files changed, 127 insertions(+), 125 deletions(-) rename c64/basic/,stubs_math/{b86a.FADDT.s => b86a.add_FAC2_FAC1.s} (97%) rename c64/basic/,stubs_math/{b9ea.LOG.s => b9ea.log_FAC1.s} (97%) rename c64/basic/,stubs_math/{ba2b.FMULT.s => ba2b.mul_FAC2_FAC1.s} (97%) rename c64/basic/,stubs_math/{bae2.MUL10.s => bae2.mul10_FAC1.s} (97%) rename c64/basic/,stubs_math/{bafe.DIV10.s => bafe.div10_FAC1_p.s} (97%) rename c64/basic/,stubs_math/{bb12.FDIVT.s => bb12.div_FAC2_FAC1.s} (97%) rename c64/basic/,stubs_math/{bc2b.SIGN.s => bc2b.sgn_FAC1_A.s} (97%) rename c64/basic/,stubs_math/{bc39.SGN.s => bc39.sgn_FAC1.s} (98%) rename c64/basic/,stubs_math/{bc58.ABS.s => bc58.abs_FAC1.s} (97%) rename c64/basic/,stubs_math/{bccc.INT.s => bccc.int_FAC1.s} (97%) rename c64/basic/,stubs_math/{bf71.SQR.s => bf71.sqr_FAC1.s} (97%) rename c64/basic/,stubs_math/{bf74.SQR2.s => bf74.sqr_FAC2.s} (98%) rename c64/basic/,stubs_math/{bfed.EXP.s => bfed.exp_FAC1.s} (97%) rename c64/basic/,stubs_math/{e043.POLY1.s => e043.poly1_FAC1.s} (98%) rename c64/basic/,stubs_math/{e059.POLY2.s => e059.poly2_FAC1.s} (98%) rename c64/basic/,stubs_math/{e264.COS.s => e264.cos_FAC1.s} (100%) rename c64/basic/,stubs_math/{e26b.SIN.s => e26b.sin_FAC1.s} (97%) rename c64/basic/,stubs_math/{e2b4.TAN.s => e2b4.tan_FAC1.s} (97%) rename c64/basic/,stubs_math/{e30e.ATN.s => e30e.atn_FAC1.s} (97%) rename c64/basic/math/{b867.FADD.s => b850.sub_MEM_FAC1.s} (76%) rename c64/basic/{,stubs_math => math}/b853.interop (100%) rename c64/basic/{,stubs_math/b853.FSUBT.s => math/b853.sub_FAC2_FAC1.s} (59%) rename c64/basic/math/{b850.FSUB.s => b867.add_MEM_FAC1.s} (77%) rename c64/basic/math/{b8fe.NORMAL.jmp.s => b8fe.normal_FAC1.jmp.s} (90%) rename c64/basic/math/{ba28.FMUL.s => ba28.mul_MEM_FAC1.s} (88%) rename c64/basic/math/{ba8c.CONUPK.jmp.s => ba8c.mov_MEM_FAC2.jmp.s} (90%) rename c64/basic/math/{bb0f.FDIV.s => bb0f.div_MEM_FAC1.s} (86%) rename c64/basic/math/{bba2.MOVFM.jmp.s => bba2.mov_MEM_FAC1.jmp.s} (90%) rename c64/basic/math/{bc0c.MOVAF.s => bc0c.mov_r_FAC1_FAC2.s} (85%) create mode 100644 c64/basic/math/bc0f.mov_FAC1_FAC2.jmp.s delete mode 100644 c64/basic/math/bc1b.ROUND.jmp.s rename c64/basic/math/{bc0f.MOVFA.jmp.s => bc1b.round_FAC1.jmp.s} (90%) rename c64/basic/math/{bfb4.NEGOP.s => bfb4.toggle_sign_FAC1.s} (95%) rename c64/basic/math/{MOVFA.s => mov_FAC1_FAC2.s} (98%) rename c64/basic/math/{MOVFM.s => mov_MEM_FAC1.s} (99%) rename c64/basic/math/{CONUPK.s => mov_MEM_FAC2.s} (96%) rename c64/basic/math/{NORMAL.s => normal_FAC1.s} (74%) rename c64/basic/math/{ROUND.s => round_FAC1.s} (77%) diff --git a/STATUS.md b/STATUS.md index 73c892fc..9b2d1f73 100644 --- a/STATUS.md +++ b/STATUS.md @@ -170,54 +170,54 @@ For the current status of the low memory location implementation andd usage chec ### Math package -Floating point mathematical routines - not official, but well known and broadly used. +Floating point mathematical routines - not official, but well known and broadly used. Note: there is an awful mess regarding naming (sometimes same name references different routines in different sources), so a custom naming scheme was applied.
-| Address | Name | Status | Remarks | -| :-------: | :----------- | :------: | :------------------------------------------------: | -| `$B1AA` | `FACINX` | NOT DONE | convert FAC1 to 16-bit signed integer | -| `$B391` | `GIVAYF` | NOT DONE | 16-bit signed integer to FAC1 | -| `$B7B5` | `STRVAL` | NOT DONE | imports string to FAC1 | -| `$B850` | `FSUB` | PARTIAL | needs `FSUBT` | -| `$B853` | `FSUBT` | NOT DONE | subtract FAC1 from FAC2 | -| `$B867` | `FADD` | PARTIAL | needs `FADDT` | -| `$B86A` | `FADDT` | NOT DONE | add FAC2 to FAC1 | -| `$B8FE` | `NORMAL` | PARTIAL | not tested yet | -| `$B9EA` | `LOG` | NOT DONE | natural logarigthm | -| `$BA28` | `FMUL` | PARTIAL | needs `FMULT` | -| `$BA2B` | `FMULT` | NOT DONE | multiplies FAC1 by FAC2 | -| `$BA8C` | `CONUPK` | PARTIAL | not fully tested yet | -| `$BAE2` | `MUL10` | NOT DONE | multiply FAC1 by 10 | -| `$BAFE` | `DIV10` | NOT DONE | divide FAC1 by 10, result is always positive | -| `$BB0F` | `FDIV` | PARTIAL | needs `FDIVT` | -| `$BB12` | `FDIVT` | NOT DONE | divide FAC2 by FAC1, ignores sign | -| `$BBA2` | `MOVFM` | PARTIAL | not fully tested yet | -| `$BBD4` | `MOVFM2` | NOT DONE | copy FAC1 to memory location, rounds if asked | -| `$BBFC` | `MOVEF` | NOT DONE | copy FAC2 to FAC1 | -| `$BC0C` | `MOVAF` | PARTIAL | not fully tested | -| `$BC0F` | `MOVFA` | DONE | | -| `$BC1B` | `ROUND` | PARTIAL | not tested | -| `$BC2B` | `SIGN` | NOT DONE | evaluate FAC1 sign | -| `$BC39` | `SGN` | NOT DONE | evaluate FAC1 sign, to FAC1 | -| `$BC58` | `ABS` | NOT DONE | absolute value | -| `$BC5B` | `FCOMP` | NOT DONE | compare FAC1 with RAM location | -| `$BC9B` | `QINT` | NOT DONE | convert FAC1 to 32 bit signed integer | -| `$BCCC` | `INT` | NOT DONE | rounds away the decimal to make an integer | -| `$BCF3` | `FIN` | NOT DONE | imports string to FAC1, ignores spaces | -| `$BDDD` | `FOUT` | NOT DONE | outputs FAC1 to string at $0100 | -| `$BF71` | `SQR` | NOT DONE | square root of FAC1 | -| `$BF74` | `SQR2` | NOT DONE | square root of FAC2 | -| `$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` | DONE | | -| `$BFED` | `EXP` | NOT DONE | exponential function, e raised to FAC1 power | -| `$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 | arc tangent of FAC1 | +| Address | Name | Status | Remarks | +| :-------: | :----------------- | :------: | :------------------------------------------------: | +| `$B1AA` | `FACINX` | NOT DONE | convert FAC1 to 16-bit signed integer | +| `$B391` | `GIVAYF` | NOT DONE | 16-bit signed integer to FAC1 | +| `$B7B5` | `STRVAL` | NOT DONE | imports string to FAC1 | +| `$B850` | `sub_MEM_FAC1` | PARTIAL | needs `sub_FAC2_FAC1` | +| `$B853` | `sub_FAC2_FAC1` | PARTIAL | needs `add_FAC2_FAC1` | +| `$B867` | `add_MEM_FAC1` | PARTIAL | needs `add_FAC2_FAC1` | +| `$B86A` | `add_FAC2_FAC1` | NOT DONE | | +| `$B8FE` | `normal_FAC1` | PARTIAL | not tested yet | +| `$B9EA` | `log_FAC1` | NOT DONE | | +| `$BA28` | `mul_MEM_FAC1` | PARTIAL | needs `mul_FAC2_FAC1` | +| `$BA2B` | `mul_FAC2_FAC1` | NOT DONE | | +| `$BA8C` | `mov_MEM_FAC2` | PARTIAL | not fully tested yet | +| `$BAE2` | `mul10_FAC1` | NOT DONE | | +| `$BAFE` | `div10_FAC1_p` | NOT DONE | | +| `$BB0F` | `div_MEM_FAC1` | PARTIAL | needs `div_FAC2_FAC1` | +| `$BB12` | `div_FAC2_FAC1` | NOT DONE | | +| `$BBA2` | `mov_MEM_FAC1` | PARTIAL | not fully tested yet | +| `$BBD4` | `MOVFM2` | NOT DONE | copy FAC1 to memory location, rounds if asked | +| `$BBFC` | `MOVEF` | NOT DONE | copy FAC2 to FAC1 | +| `$BC0C` | `mov_r_FAC1_FAC2` | PARTIAL | not fully tested | +| `$BC0F` | `mov_FAC1_FAC2` | DONE | | +| `$BC1B` | `round_FAC1` | PARTIAL | not tested | +| `$BC2B` | `sgn_FAC1_A` | NOT DONE | | +| `$BC39` | `sgn_FAC1` | NOT DONE | | +| `$BC58` | `abs_FAC1` | NOT DONE | | +| `$BC5B` | `FCOMP` | NOT DONE | compare FAC1 with RAM location | +| `$BC9B` | `QINT` | NOT DONE | convert FAC1 to 32 bit signed integer | +| `$BCCC` | `int_FAC1` | NOT DONE | | +| `$BCF3` | `FIN` | NOT DONE | imports string to FAC1, ignores spaces | +| `$BDDD` | `FOUT` | NOT DONE | outputs FAC1 to string at $0100 | +| `$BF71` | `sqr_FAC1` | NOT DONE | | +| `$BF74` | `sqr_FAC2` | NOT DONE | | +| `$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` | `toggle_sign_FAC1` | DONE | | +| `$BFED` | `exp_FAC1` | NOT DONE | | +| `$E043` | `poly1_FAC1` | NOT DONE | | +| `$E059` | `poly2_FAC1` | NOT DONE | | +| `$E264` | `cos_FAC1` | NOT DONE | | +| `$E26B` | `sin_FAC1` | NOT DONE | | +| `$E2B4` | `tan_FAC1` | NOT DONE | | +| `$E30E` | `atn_FAC1` | NOT DONE | |
diff --git a/c64/basic/,stubs_math/b86a.FADDT.s b/c64/basic/,stubs_math/b86a.add_FAC2_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/b86a.FADDT.s rename to c64/basic/,stubs_math/b86a.add_FAC2_FAC1.s index c48274a3..a88305d8 100644 --- a/c64/basic/,stubs_math/b86a.FADDT.s +++ b/c64/basic/,stubs_math/b86a.add_FAC2_FAC1.s @@ -19,5 +19,5 @@ // XXX provide implementation -FADDT: +add_FAC2_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/b9ea.LOG.s b/c64/basic/,stubs_math/b9ea.log_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/b9ea.LOG.s rename to c64/basic/,stubs_math/b9ea.log_FAC1.s index 3fc121a7..295fdf19 100644 --- a/c64/basic/,stubs_math/b9ea.LOG.s +++ b/c64/basic/,stubs_math/b9ea.log_FAC1.s @@ -14,5 +14,5 @@ // XXX provide implementation -LOG: +log_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/ba2b.FMULT.s b/c64/basic/,stubs_math/ba2b.mul_FAC2_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/ba2b.FMULT.s rename to c64/basic/,stubs_math/ba2b.mul_FAC2_FAC1.s index 0344f167..bc78e2fb 100644 --- a/c64/basic/,stubs_math/ba2b.FMULT.s +++ b/c64/basic/,stubs_math/ba2b.mul_FAC2_FAC1.s @@ -19,5 +19,5 @@ // XXX provide implementation -FMULT: +mul_FAC2_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bae2.MUL10.s b/c64/basic/,stubs_math/bae2.mul10_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/bae2.MUL10.s rename to c64/basic/,stubs_math/bae2.mul10_FAC1.s index 3fde16d3..8413a242 100644 --- a/c64/basic/,stubs_math/bae2.MUL10.s +++ b/c64/basic/,stubs_math/bae2.mul10_FAC1.s @@ -13,5 +13,5 @@ // XXX provide implementation -MUL10: +mul10_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bafe.DIV10.s b/c64/basic/,stubs_math/bafe.div10_FAC1_p.s similarity index 97% rename from c64/basic/,stubs_math/bafe.DIV10.s rename to c64/basic/,stubs_math/bafe.div10_FAC1_p.s index 3d59810d..e3cc5252 100644 --- a/c64/basic/,stubs_math/bafe.DIV10.s +++ b/c64/basic/,stubs_math/bafe.div10_FAC1_p.s @@ -17,5 +17,5 @@ // XXX provide implementation -DIV10: +div10_FAC1_p: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bb12.FDIVT.s b/c64/basic/,stubs_math/bb12.div_FAC2_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/bb12.FDIVT.s rename to c64/basic/,stubs_math/bb12.div_FAC2_FAC1.s index d02ef219..987eed74 100644 --- a/c64/basic/,stubs_math/bb12.FDIVT.s +++ b/c64/basic/,stubs_math/bb12.div_FAC2_FAC1.s @@ -19,5 +19,5 @@ // XXX provide implementation -FDIVT: +div_FAC2_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bc2b.SIGN.s b/c64/basic/,stubs_math/bc2b.sgn_FAC1_A.s similarity index 97% rename from c64/basic/,stubs_math/bc2b.SIGN.s rename to c64/basic/,stubs_math/bc2b.sgn_FAC1_A.s index 151b25d5..b5e630c5 100644 --- a/c64/basic/,stubs_math/bc2b.SIGN.s +++ b/c64/basic/,stubs_math/bc2b.sgn_FAC1_A.s @@ -16,5 +16,5 @@ // XXX provide implementation -SIGN: +sgn_FAC1_A: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bc39.SGN.s b/c64/basic/,stubs_math/bc39.sgn_FAC1.s similarity index 98% rename from c64/basic/,stubs_math/bc39.SGN.s rename to c64/basic/,stubs_math/bc39.sgn_FAC1.s index 1b53f34c..ca081a8e 100644 --- a/c64/basic/,stubs_math/bc39.SGN.s +++ b/c64/basic/,stubs_math/bc39.sgn_FAC1.s @@ -16,5 +16,5 @@ // XXX provide implementation -SGN: +sgn_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bc58.ABS.s b/c64/basic/,stubs_math/bc58.abs_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/bc58.ABS.s rename to c64/basic/,stubs_math/bc58.abs_FAC1.s index a152eb7e..2d4117c6 100644 --- a/c64/basic/,stubs_math/bc58.ABS.s +++ b/c64/basic/,stubs_math/bc58.abs_FAC1.s @@ -13,5 +13,5 @@ // XXX provide implementation -ABS: +abs_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bccc.INT.s b/c64/basic/,stubs_math/bccc.int_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/bccc.INT.s rename to c64/basic/,stubs_math/bccc.int_FAC1.s index a693a85d..ad25b646 100644 --- a/c64/basic/,stubs_math/bccc.INT.s +++ b/c64/basic/,stubs_math/bccc.int_FAC1.s @@ -13,5 +13,5 @@ // XXX provide implementation -INT: +int_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bf71.SQR.s b/c64/basic/,stubs_math/bf71.sqr_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/bf71.SQR.s rename to c64/basic/,stubs_math/bf71.sqr_FAC1.s index 4e1a3115..ca2091c3 100644 --- a/c64/basic/,stubs_math/bf71.SQR.s +++ b/c64/basic/,stubs_math/bf71.sqr_FAC1.s @@ -16,5 +16,5 @@ // XXX provide implementation -SQR: +sqr_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bf74.SQR2.s b/c64/basic/,stubs_math/bf74.sqr_FAC2.s similarity index 98% rename from c64/basic/,stubs_math/bf74.SQR2.s rename to c64/basic/,stubs_math/bf74.sqr_FAC2.s index abf1fc2d..ab99c98f 100644 --- a/c64/basic/,stubs_math/bf74.SQR2.s +++ b/c64/basic/,stubs_math/bf74.sqr_FAC2.s @@ -16,5 +16,5 @@ // XXX provide implementation -SQR2: +sqr_FAC2: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/bfed.EXP.s b/c64/basic/,stubs_math/bfed.exp_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/bfed.EXP.s rename to c64/basic/,stubs_math/bfed.exp_FAC1.s index 7ad24634..9e392ad8 100644 --- a/c64/basic/,stubs_math/bfed.EXP.s +++ b/c64/basic/,stubs_math/bfed.exp_FAC1.s @@ -14,5 +14,5 @@ // XXX provide implementation -EXP: +exp_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e043.POLY1.s b/c64/basic/,stubs_math/e043.poly1_FAC1.s similarity index 98% rename from c64/basic/,stubs_math/e043.POLY1.s rename to c64/basic/,stubs_math/e043.poly1_FAC1.s index c4042bc8..94639620 100644 --- a/c64/basic/,stubs_math/e043.POLY1.s +++ b/c64/basic/,stubs_math/e043.poly1_FAC1.s @@ -23,5 +23,5 @@ // XXX provide implementation -POLY1: +poly1_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e059.POLY2.s b/c64/basic/,stubs_math/e059.poly2_FAC1.s similarity index 98% rename from c64/basic/,stubs_math/e059.POLY2.s rename to c64/basic/,stubs_math/e059.poly2_FAC1.s index b2d94100..226c61b3 100644 --- a/c64/basic/,stubs_math/e059.POLY2.s +++ b/c64/basic/,stubs_math/e059.poly2_FAC1.s @@ -23,5 +23,5 @@ // XXX provide implementation -POLY2: +poly2_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e264.COS.s b/c64/basic/,stubs_math/e264.cos_FAC1.s similarity index 100% rename from c64/basic/,stubs_math/e264.COS.s rename to c64/basic/,stubs_math/e264.cos_FAC1.s diff --git a/c64/basic/,stubs_math/e26b.SIN.s b/c64/basic/,stubs_math/e26b.sin_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/e26b.SIN.s rename to c64/basic/,stubs_math/e26b.sin_FAC1.s index 5ca46126..99eb4569 100644 --- a/c64/basic/,stubs_math/e26b.SIN.s +++ b/c64/basic/,stubs_math/e26b.sin_FAC1.s @@ -13,5 +13,5 @@ // XXX provide implementation -SIN: +sin_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e2b4.TAN.s b/c64/basic/,stubs_math/e2b4.tan_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/e2b4.TAN.s rename to c64/basic/,stubs_math/e2b4.tan_FAC1.s index d0cc416d..480991fc 100644 --- a/c64/basic/,stubs_math/e2b4.TAN.s +++ b/c64/basic/,stubs_math/e2b4.tan_FAC1.s @@ -13,5 +13,5 @@ // XXX provide implementation -TAN: +tan_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/,stubs_math/e30e.ATN.s b/c64/basic/,stubs_math/e30e.atn_FAC1.s similarity index 97% rename from c64/basic/,stubs_math/e30e.ATN.s rename to c64/basic/,stubs_math/e30e.atn_FAC1.s index 642cea97..1fc04501 100644 --- a/c64/basic/,stubs_math/e30e.ATN.s +++ b/c64/basic/,stubs_math/e30e.atn_FAC1.s @@ -13,5 +13,5 @@ // XXX provide implementation -ATN: +atn_FAC1: STUB_IMPLEMENTATION() diff --git a/c64/basic/math/b867.FADD.s b/c64/basic/math/b850.sub_MEM_FAC1.s similarity index 76% rename from c64/basic/math/b867.FADD.s rename to c64/basic/math/b850.sub_MEM_FAC1.s index e5bd97b3..a5f15869 100644 --- a/c64/basic/math/b867.FADD.s +++ b/c64/basic/math/b850.sub_MEM_FAC1.s @@ -3,7 +3,7 @@ // #LAYOUT# * * #IGNORE // -// Math package - add RAM to FAC1 +// Math package - subtract FAC1 from memory variable // // Input: // - .A - address low byte @@ -15,8 +15,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -FADD: +sub_MEM_FAC1: - jsr CONUPK + jsr mov_MEM_FAC2 - // FALLTROUGH to FADDT + // FALLTROUGH to sub_FAC2_FAC1 diff --git a/c64/basic/,stubs_math/b853.interop b/c64/basic/math/b853.interop similarity index 100% rename from c64/basic/,stubs_math/b853.interop rename to c64/basic/math/b853.interop diff --git a/c64/basic/,stubs_math/b853.FSUBT.s b/c64/basic/math/b853.sub_FAC2_FAC1.s similarity index 59% rename from c64/basic/,stubs_math/b853.FSUBT.s rename to c64/basic/math/b853.sub_FAC2_FAC1.s index 58b4a4db..49f699e9 100644 --- a/c64/basic/,stubs_math/b853.FSUBT.s +++ b/c64/basic/math/b853.sub_FAC2_FAC1.s @@ -5,19 +5,20 @@ // // 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 (XXX do we need it?) -// // 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 +// XXX test this -FSUBT: - STUB_IMPLEMENTATION() +sub_FAC2_FAC1: + + // Toggle FAC1 sign + lda FAC1_sign + eor #$FF + sta FAC1_sign + + // Perform addition + jmp add_FAC2_FAC1 diff --git a/c64/basic/math/b850.FSUB.s b/c64/basic/math/b867.add_MEM_FAC1.s similarity index 77% rename from c64/basic/math/b850.FSUB.s rename to c64/basic/math/b867.add_MEM_FAC1.s index ca6d9488..9ed42325 100644 --- a/c64/basic/math/b850.FSUB.s +++ b/c64/basic/math/b867.add_MEM_FAC1.s @@ -3,7 +3,7 @@ // #LAYOUT# * * #IGNORE // -// Math package - subtract FAC1 from RAM +// Math package - add memory variable to FAC1 // // Input: // - .A - address low byte @@ -15,8 +15,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -FSUB: +add_MEM_FAC1: - jsr CONUPK + jsr mov_MEM_FAC2 - // FALLTROUGH to FSUBT + // FALLTROUGH to add_FAC2_FAC1 diff --git a/c64/basic/math/b8fe.NORMAL.jmp.s b/c64/basic/math/b8fe.normal_FAC1.jmp.s similarity index 90% rename from c64/basic/math/b8fe.NORMAL.jmp.s rename to c64/basic/math/b8fe.normal_FAC1.jmp.s index 7c5c26b8..a9fd1d5c 100644 --- a/c64/basic/math/b8fe.NORMAL.jmp.s +++ b/c64/basic/math/b8fe.normal_FAC1.jmp.s @@ -4,4 +4,4 @@ // Just a compatibility jump - our routine is longer than original one - jmp NORMAL + jmp normal_FAC1 diff --git a/c64/basic/math/ba28.FMUL.s b/c64/basic/math/ba28.mul_MEM_FAC1.s similarity index 88% rename from c64/basic/math/ba28.FMUL.s rename to c64/basic/math/ba28.mul_MEM_FAC1.s index 3e02237a..3a5c5f08 100644 --- a/c64/basic/math/ba28.FMUL.s +++ b/c64/basic/math/ba28.mul_MEM_FAC1.s @@ -18,8 +18,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -FMUL: +mul_MEM_FAC1: - jsr CONUPK + jsr mov_MEM_FAC2 - // FALLTROUGH to FMULT + // FALLTROUGH to mul_FAC2_FAC1 diff --git a/c64/basic/math/ba8c.CONUPK.jmp.s b/c64/basic/math/ba8c.mov_MEM_FAC2.jmp.s similarity index 90% rename from c64/basic/math/ba8c.CONUPK.jmp.s rename to c64/basic/math/ba8c.mov_MEM_FAC2.jmp.s index 53809055..2e2bdffc 100644 --- a/c64/basic/math/ba8c.CONUPK.jmp.s +++ b/c64/basic/math/ba8c.mov_MEM_FAC2.jmp.s @@ -4,4 +4,4 @@ // Just a compatibility jump - our routine is longer than original one - jmp CONUPK + jmp mov_MEM_FAC2 diff --git a/c64/basic/math/bb0f.FDIV.s b/c64/basic/math/bb0f.div_MEM_FAC1.s similarity index 86% rename from c64/basic/math/bb0f.FDIV.s rename to c64/basic/math/bb0f.div_MEM_FAC1.s index cce82469..37fc4c6a 100644 --- a/c64/basic/math/bb0f.FDIV.s +++ b/c64/basic/math/bb0f.div_MEM_FAC1.s @@ -15,8 +15,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -FDIV: +div_MEM_FAC1: - jsr CONUPK + jsr mov_MEM_FAC2 - // FALLTROUGH to FDIVT + // FALLTROUGH to div_FAC2_FAC1 diff --git a/c64/basic/math/bba2.MOVFM.jmp.s b/c64/basic/math/bba2.mov_MEM_FAC1.jmp.s similarity index 90% rename from c64/basic/math/bba2.MOVFM.jmp.s rename to c64/basic/math/bba2.mov_MEM_FAC1.jmp.s index 424296fb..71b6fe4a 100644 --- a/c64/basic/math/bba2.MOVFM.jmp.s +++ b/c64/basic/math/bba2.mov_MEM_FAC1.jmp.s @@ -4,4 +4,4 @@ // Just a compatibility jump - our routine is longer than original one - jmp MOVFM + jmp mov_MEM_FAC1 diff --git a/c64/basic/math/bc0c.MOVAF.s b/c64/basic/math/bc0c.mov_r_FAC1_FAC2.s similarity index 85% rename from c64/basic/math/bc0c.MOVAF.s rename to c64/basic/math/bc0c.mov_r_FAC1_FAC2.s index 9f0d836e..6dd59663 100644 --- a/c64/basic/math/bc0c.MOVAF.s +++ b/c64/basic/math/bc0c.mov_r_FAC1_FAC2.s @@ -14,9 +14,9 @@ // - https://www.c64-wiki.com/wiki/Floating_point_arithmetic // -MOVAF: +movr_FAC1_FAC2: // First round FAC1 - jsr ROUND + jsr round_FAC1 - // FALLTROUGH to MOVFA \ No newline at end of file + // FALLTROUGH to mov_FAC1_FAC2 diff --git a/c64/basic/math/bc0f.mov_FAC1_FAC2.jmp.s b/c64/basic/math/bc0f.mov_FAC1_FAC2.jmp.s new file mode 100644 index 00000000..dde35453 --- /dev/null +++ b/c64/basic/math/bc0f.mov_FAC1_FAC2.jmp.s @@ -0,0 +1,7 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// Just a compatibility jump - our routine is longer than original one + + jmp mov_FAC1_FAC2 diff --git a/c64/basic/math/bc1b.ROUND.jmp.s b/c64/basic/math/bc1b.ROUND.jmp.s deleted file mode 100644 index e6306152..00000000 --- a/c64/basic/math/bc1b.ROUND.jmp.s +++ /dev/null @@ -1,7 +0,0 @@ -// #LAYOUT# STD * #TAKE -// #LAYOUT# * BASIC_0 #TAKE -// #LAYOUT# * * #IGNORE - -// Just a compatibility jump - our routine is longer than original one - - jmp ROUND diff --git a/c64/basic/math/bc0f.MOVFA.jmp.s b/c64/basic/math/bc1b.round_FAC1.jmp.s similarity index 90% rename from c64/basic/math/bc0f.MOVFA.jmp.s rename to c64/basic/math/bc1b.round_FAC1.jmp.s index e4efb535..1c04b38e 100644 --- a/c64/basic/math/bc0f.MOVFA.jmp.s +++ b/c64/basic/math/bc1b.round_FAC1.jmp.s @@ -4,4 +4,5 @@ // Just a compatibility jump - our routine is longer than original one - jmp MOVFA + jmp round_FAC1 + diff --git a/c64/basic/math/bfb4.NEGOP.s b/c64/basic/math/bfb4.toggle_sign_FAC1.s similarity index 95% rename from c64/basic/math/bfb4.NEGOP.s rename to c64/basic/math/bfb4.toggle_sign_FAC1.s index c231407b..bfa61cc5 100644 --- a/c64/basic/math/bfb4.NEGOP.s +++ b/c64/basic/math/bfb4.toggle_sign_FAC1.s @@ -10,7 +10,7 @@ // - https://www.c64-wiki.com/wiki/Floating_point_arithmetic // -NEGOP: +toggle_sign_FAC1: lda FAC1_exponent beq !+ // do not toggle the sign if value is 0 diff --git a/c64/basic/math/MOVFA.s b/c64/basic/math/mov_FAC1_FAC2.s similarity index 98% rename from c64/basic/math/MOVFA.s rename to c64/basic/math/mov_FAC1_FAC2.s index afc70c4e..8ce497d5 100644 --- a/c64/basic/math/MOVFA.s +++ b/c64/basic/math/mov_FAC1_FAC2.s @@ -21,7 +21,7 @@ // - https://www.c64-wiki.com/wiki/Floating_point_arithmetic // -MOVFA: +mov_FAC1_FAC2: // Copy the exponent lda FAC1_exponent diff --git a/c64/basic/math/MOVFM.s b/c64/basic/math/mov_MEM_FAC1.s similarity index 99% rename from c64/basic/math/MOVFM.s rename to c64/basic/math/mov_MEM_FAC1.s index 93090f85..14ceb648 100644 --- a/c64/basic/math/MOVFM.s +++ b/c64/basic/math/mov_MEM_FAC1.s @@ -21,7 +21,7 @@ // XXX test this -MOVFM: +mov_MEM_FAC1: // Checked in the available documentation: // - https://www.c64-wiki.com/wiki/Floating_point_arithmetic diff --git a/c64/basic/math/CONUPK.s b/c64/basic/math/mov_MEM_FAC2.s similarity index 96% rename from c64/basic/math/CONUPK.s rename to c64/basic/math/mov_MEM_FAC2.s index 1b721579..0258c041 100644 --- a/c64/basic/math/CONUPK.s +++ b/c64/basic/math/mov_MEM_FAC2.s @@ -3,7 +3,7 @@ // #LAYOUT# * * #IGNORE // -// Math package - fetch FAC2 from RAM location +// Math package - fetch FAC2 from memory location // // Input: // - .A - address low byte @@ -24,7 +24,7 @@ // XXX test this -CONUPK: +mov_MEM_FAC2: // Checked in the available documentation: // - https://www.c64-wiki.com/wiki/Floating_point_arithmetic diff --git a/c64/basic/math/NORMAL.s b/c64/basic/math/normal_FAC1.s similarity index 74% rename from c64/basic/math/NORMAL.s rename to c64/basic/math/normal_FAC1.s index 6edbafde..0dda7581 100644 --- a/c64/basic/math/NORMAL.s +++ b/c64/basic/math/normal_FAC1.s @@ -13,20 +13,20 @@ // XXX test this -NORMAL: +normal_FAC1: lda FAC1_exponent - beq normal_end // branch if our float is 0 + beq normal_FAC1_end // branch if our float is 0 lda FAC1_mantissa+3 - beq normal_by_byte // branch if we can move the whole byte + beq normal_FAC1_by_byte // branch if we can move the whole byte and #$80 - bne normal_end // branch if already normalized + bne normal_FAC1_end // branch if already normalized // FALLTROUGH -normal_by_bit: +normal_FAC1_by_bit: // First check the current exponent @@ -49,10 +49,10 @@ normal_by_bit: rol FAC1_mantissa+1 rol FAC1_mantissa+0 - bcc NORMAL // branch if next iteration needed + bcc normal_FAC1 // branch if next iteration needed rts -normal_by_byte: +normal_FAC1_by_byte: // First decrement the exponent by 8, but not below 0 @@ -63,7 +63,7 @@ normal_by_byte: lda #$00 !: sta FAC1_exponent - beq normal_end // branch if our float reached 0 + beq normal_FAC1_end // branch if our float reached 0 // Now multiply the mantissa by 8 by moving the whole bytes @@ -87,7 +87,7 @@ normal_by_byte: ora FAC1_mantissa+2 ora FAC1_mantissa+3 - bne NORMAL // not 0 - branch to next iteration + bne normal_FAC1 // not 0 - branch to next iteration // Our mantissa reached 0 - mark exponent as 0 and finish @@ -95,6 +95,6 @@ normal_by_byte: // FALLTROUGH -normal_end: +normal_FAC1_end: rts diff --git a/c64/basic/math/ROUND.s b/c64/basic/math/round_FAC1.s similarity index 77% rename from c64/basic/math/ROUND.s rename to c64/basic/math/round_FAC1.s index c044abf4..7cef4a05 100644 --- a/c64/basic/math/ROUND.s +++ b/c64/basic/math/round_FAC1.s @@ -12,15 +12,15 @@ // XXX test this -ROUND: +round_FAC1: // If number is 0, do not do anything lda FAC1_exponent - beq round_done + beq round_FAC1_done lda FACOV - bpl round_zero_FACOV // branch if it is enough to clear FACOV + bpl round_FAC1_zero_FACOV // branch if it is enough to clear FACOV // Increment the 4 bytes of matissa @@ -28,20 +28,20 @@ ROUND: // we could have used INW on 65C02 and above, the code would have been smaller! inc FAC1_mantissa+3 - bne round_zero_FACOV + bne round_FAC1_zero_FACOV inc FAC1_mantissa+2 - bne round_zero_FACOV + bne round_FAC1_zero_FACOV inc FAC1_mantissa+1 - bne round_zero_FACOV + bne round_FAC1_zero_FACOV inc FAC1_mantissa+0 - bne round_zero_FACOV + bne round_FAC1_zero_FACOV // If we are here, it means mantissa is 0; put it to minimum allowed and increment exponent lda #$80 sta FAC1_mantissa+0 inc FAC1_exponent - bne round_zero_FACOV + bne round_FAC1_zero_FACOV // If we are here, it means the exponent wrapped around to $00; put it back to $FF @@ -49,13 +49,13 @@ ROUND: // FALLTROUGH -round_zero_FACOV: +round_FAC1_zero_FACOV: lda #$00 sta FACOV // FALLTROUGH -round_done: +round_FAC1_done: rts