diff --git a/Makefile b/Makefile index 84736f02..4b7a420f 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \ c64/basic/,stubs_math \ c64/basic/commands \ c64/basic/init \ + c64/basic/math \ c64/basic/rom_revision SRCDIR_KERNAL = $(SRCDIR_COMMON) \ diff --git a/STATUS.md b/STATUS.md index ec4a88fe..236285dc 100644 --- a/STATUS.md +++ b/STATUS.md @@ -179,17 +179,17 @@ Floating point mathematical routines - not official, but well known and broadly | `$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 | subtract FAC1 from RAM | +| `$B850` | `FSUB` | PARTIAL | needs `CONUPK` and `FSUBT` | | `$B853` | `FSUBT` | NOT DONE | subtract FAC1 from FAC2 | -| `$B867` | `FADD` | NOT DONE | add RAM to FAC1 | +| `$B867` | `FADD` | PARTIAL | needs `CONUPK` and `FADDT` | | `$B86A` | `FADDT` | NOT DONE | add FAC2 to FAC1 | | `$B9EA` | `LOG` | NOT DONE | XXX - no stub added yet | -| `$BA28` | `FMUL` | NOT DONE | multiplies FAC1 by RAM | +| `$BA28` | `FMUL` | PARTIAL | needs `CONUPK` and `FMULT` | | `$BA2B` | `FMULT` | NOT DONE | multiplies FAC1 by FAC2 | | `$BA8C` | `CONUPK` | NOT DONE | fetch FAC2 from RAM location | | `$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 | +| `$BB0F` | `FDIV` | PARTIAL | needs `CONUPK` and `FDIVT` | | `$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 | diff --git a/c64/basic/,stubs_math/b850.FSUB.s b/c64/basic/math/b850.FSUB.s similarity index 89% rename from c64/basic/,stubs_math/b850.FSUB.s rename to c64/basic/math/b850.FSUB.s index b5f3dc11..ca6d9488 100644 --- a/c64/basic/,stubs_math/b850.FSUB.s +++ b/c64/basic/math/b850.FSUB.s @@ -15,7 +15,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -// XXX provide implementation - FSUB: - STUB_IMPLEMENTATION() + + jsr CONUPK + + // FALLTROUGH to FSUBT diff --git a/c64/basic/,stubs_math/b850.interop b/c64/basic/math/b850.interop similarity index 100% rename from c64/basic/,stubs_math/b850.interop rename to c64/basic/math/b850.interop diff --git a/c64/basic/,stubs_math/b867.FADD.s b/c64/basic/math/b867.FADD.s similarity index 88% rename from c64/basic/,stubs_math/b867.FADD.s rename to c64/basic/math/b867.FADD.s index 8187d247..e5bd97b3 100644 --- a/c64/basic/,stubs_math/b867.FADD.s +++ b/c64/basic/math/b867.FADD.s @@ -15,7 +15,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -// XXX provide implementation - FADD: - STUB_IMPLEMENTATION() + + jsr CONUPK + + // FALLTROUGH to FADDT diff --git a/c64/basic/,stubs_math/b867.interop b/c64/basic/math/b867.interop similarity index 100% rename from c64/basic/,stubs_math/b867.interop rename to c64/basic/math/b867.interop diff --git a/c64/basic/,stubs_math/ba28.FMUL.s b/c64/basic/math/ba28.FMUL.s similarity index 90% rename from c64/basic/,stubs_math/ba28.FMUL.s rename to c64/basic/math/ba28.FMUL.s index f79b830b..3e02237a 100644 --- a/c64/basic/,stubs_math/ba28.FMUL.s +++ b/c64/basic/math/ba28.FMUL.s @@ -18,7 +18,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -// XXX provide implementation - FMUL: - STUB_IMPLEMENTATION() + + jsr CONUPK + + // FALLTROUGH to FMULT diff --git a/c64/basic/,stubs_math/ba28.interop b/c64/basic/math/ba28.interop similarity index 100% rename from c64/basic/,stubs_math/ba28.interop rename to c64/basic/math/ba28.interop diff --git a/c64/basic/,stubs_math/bb0f.FDIV.c b/c64/basic/math/bb0f.FDIV.s similarity index 88% rename from c64/basic/,stubs_math/bb0f.FDIV.c rename to c64/basic/math/bb0f.FDIV.s index 386c63d5..cce82469 100644 --- a/c64/basic/,stubs_math/bb0f.FDIV.c +++ b/c64/basic/math/bb0f.FDIV.s @@ -15,7 +15,8 @@ // - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics // -// XXX provide implementation - FDIV: - STUB_IMPLEMENTATION() + + jsr CONUPK + + // FALLTROUGH to FDIVT diff --git a/c64/basic/,stubs_math/bb0f.interop b/c64/basic/math/bb0f.interop similarity index 100% rename from c64/basic/,stubs_math/bb0f.interop rename to c64/basic/math/bb0f.interop