Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Ports: the C++ games on the Casio
Mason36367c8003fcc87
diff --git a/platform/casio-cg/np_casio_cg.c b/platform/casio-cg/np_casio_cg.cindex 5b7e0200..5427881d 100644--- a/platform/casio-cg/np_casio_cg.c+++ b/platform/casio-cg/np_casio_cg.c@@ -273,3 +273,7 @@ void _exit(int c) { (void)c; abort(); }int _kill(int p, int s) { (void)p, (void)s; return -1; }int _getpid(void) { return 1; }int _gettimeofday(void *t, void *z) { (void)t, (void)z; return -1; }+/* (newlib's small printf asks for this to print wide characters; there's nowhere to print them) */+#include <stdio.h>+#include <wchar.h>+wint_t _fputwc_r(struct _reent *r, wchar_t c, FILE *f) { (void)r, (void)f; return (wint_t)c; }diff --git a/platform/casio-cg/np_cxx.cpp b/platform/casio-cg/np_cxx.cppindex 190b08ab..077255bf 100644--- a/platform/casio-cg/np_cxx.cpp+++ b/platform/casio-cg/np_cxx.cpp@@ -1,9 +1,18 @@-// C++'s few needs on the fx-CG, for games with C++ files (no exceptions, no RTTI, no C++ library)+// C++ on the fx-CG for games with C++ files, built without exceptions: the C++ library's error paths stop the add-in+// instead of throwing, so its exception and wide-character I/O machinery stays out of the add-in#include <stdlib.h>-void *operator new(size_t n) { return malloc(n); }-void *operator new[](size_t n) { return malloc(n); }-void operator delete(void *p) noexcept { free(p); }-void operator delete[](void *p) noexcept { free(p); }-void operator delete(void *p, size_t) noexcept { free(p); }-void operator delete[](void *p, size_t) noexcept { free(p); }-extern "C" void __cxa_pure_virtual(void) { abort(); }+namespace std {+[[noreturn]] void __throw_bad_alloc() { abort(); }+[[noreturn]] void __throw_bad_array_new_length() { abort(); }+[[noreturn]] void __throw_bad_function_call() { abort(); }+[[noreturn]] void __throw_length_error(const char *) { abort(); }+[[noreturn]] void __throw_logic_error(const char *) { abort(); }+[[noreturn]] void __throw_out_of_range(const char *) { abort(); }+[[noreturn]] void __throw_out_of_range_fmt(const char *, ...) { abort(); }+[[noreturn]] void __throw_invalid_argument(const char *) { abort(); }+[[noreturn]] void __throw_domain_error(const char *) { abort(); }+[[noreturn]] void __throw_runtime_error(const char *) { abort(); }+[[noreturn]] void __throw_overflow_error(const char *) { abort(); }+[[noreturn]] void __throw_underflow_error(const char *) { abort(); }+[[noreturn]] void __throw_range_error(const char *) { abort(); }+} // namespace stddiff --git a/platform/port.mk b/platform/port.mkindex f1d81e76..cf5a8f99 100644--- a/platform/port.mk+++ b/platform/port.mk@@ -110,7 +110,7 @@ $(PORT_OUT)/$(PORT_ID).g3a: $(CG_SRC) $(PORT_ASM) $(PORT_CXX_OBJ) $(wildcard $(Nfor f in $(CG_CXX); do n=$$((n+1)); objs="$$objs $(CG_DIR)/f$$n.o"; \$(NP_CXX) $(NP_CXXFLAGS) -c $$f -o $(CG_DIR)/f$$n.o || exit 1; done; \PATH="$(CG_PATH):$$PATH" sh3eb-elf-gcc -mb -m4a-nofpu -mhitachi -nostdlib -T$(NP_PLATFORM)/casio-cg/addin.ld \- $$objs $(PORT_CXX_OBJ) -Wl,--gc-sections -Wl,-u,initialize -L$(CG_LIBC)/lib -L$(FXCG)/sdk/lib -lc -lm -lgcc -lfxcg -lc -lgcc \+ $$objs $(PORT_CXX_OBJ) -Wl,--gc-sections -Wl,-u,initialize -L$(CG_LIBC)/lib -L$(FXCG)/sdk/lib $(if $(PORT_CXX),-lstdc++) -lc -lm -lgcc -lfxcg -lc -lgcc \-o $(CG_DIR)/$(PORT_ID).elf$(Q) PATH="$(CG_PATH):$$PATH" sh3eb-elf-objcopy -O binary -R .ilram $(CG_DIR)/$(PORT_ID).elf $(CG_DIR)/$(PORT_ID).bin$(Q) python3 $(NP_PLATFORM)/casio-cg/g3a.py $(CG_DIR)/$(PORT_ID).bin $@ --name "$(PORT_NAME)" --icon src/icon.png