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
NumPlay installs on calculator software 23.2 and 24 again: 147 KB of fixed RAM, under the 148928 bytes the oldest gives apps
Mason Chene69efa9f5c74
diff --git a/Makefile b/Makefileindex 09ffaec2..cd4c6758 100644--- a/Makefile+++ b/Makefile@@ -16,7 +16,8 @@ ARM_OBJCOPY = arm-none-eabi-objcopyPY ?= python3CARGO ?= cargoB = build-RAM_LIMIT = 153676+# the RAM the oldest calculator software that runs apps gives them (23.2: 148928 bytes; 25.2 gives 153676)+RAM_LIMIT = 148928# the calculator's space for installed apps (0x90200000 to 0x903F0000 in its flash)APP_SPACE = 2031616# Upsilon, the N0110 and N0115's custom software, gives .nwa apps less RAM: NumPlay-Upsilon.nwa hasdiff --git a/games/numblocks/src/render.c b/games/numblocks/src/render.cindex 3cf91eee..b5072097 100644--- a/games/numblocks/src/render.c+++ b/games/numblocks/src/render.c@@ -13,7 +13,10 @@#include "nb.h"#define SR 4 /* picture rows per strip (8 screen rows) */-static uint16_t strip[SCREEN_W * SR * 2] __attribute__((aligned(4)));+#define STRIP_N (SCREEN_W * SR * 2)+/* the strip sent to the screen: on render_frame's stack (the calculator gives apps 32 KB of it, the+ * game uses a few), not in the RAM that calculator software since 23.2 gives apps (148928 bytes) */+static uint16_t *strip;static uint16_t cbuf[SR][RW]; /* a strip of the picture */static float zbuf[SR][RW]; /* and how far each pixel's ray went (entities are hidden behind) */@@ -1893,7 +1896,7 @@ static bool shown_ok;static uint32_t strip_hash(void) {const uint32_t *w = (const uint32_t *)strip;uint32_t h = 2166136261u;- for (unsigned k = 0; k < sizeof strip / 4; k++) h = (h ^ w[k]) * 16777619u;+ for (unsigned k = 0; k < STRIP_N / 2; k++) h = (h ^ w[k]) * 16777619u;return h;}static bool still_screen(void) {@@ -1911,6 +1914,8 @@ static void send_strip(int py, bool still) {static void strips_sent(bool still) { shown_ok = still; }void render_frame(const Camera *c, uint32_t tod) {+ uint16_t buf[STRIP_N] __attribute__((aligned(4)));+ strip = buf;bool still = still_screen();static int last_gui;bool opening_pause = gui == GUI_PAUSE && last_gui == GUI_NONE && c;@@ -1939,7 +1944,7 @@ void render_frame(const Camera *c, uint32_t tod) {if (!c) {/* no world: only what the screens draw */for (int py = 0; py < RH; py += SR) {- memset(strip, 0, sizeof strip);+ memset(strip, 0, STRIP_N * sizeof *strip);hud_strip(strip, py * 2, SR * 2);send_strip(py, still);}diff --git a/games/numdrive/src/render.c b/games/numdrive/src/render.cindex 54c15070..f62c3c76 100644--- a/games/numdrive/src/render.c+++ b/games/numdrive/src/render.c@@ -26,7 +26,9 @@ static const float AMB[3] = {0.764f, 0.773f, 0.839f};static const float LEFF[3] = {0.444f, 0.423f, 0.304f};static uint16_t cbuf[SCREEN_W * STRIP_H] __attribute__((aligned(4)));-static uint16_t zbuf[SCREEN_W * STRIP_H] __attribute__((aligned(4)));+/* the depth of the strip being drawn: on render_strip's stack (the calculator gives apps 32 KB of it,+ * the game uses a few), not in the RAM that calculator software since 23.2 gives apps (148928 bytes) */+static uint16_t *zbuf;typedef uint32_t __attribute__((may_alias)) u32a;static int strip_y0, strip_y1; /* current strip rows [y0, y1) */static int clip_x0, clip_x1;@@ -729,9 +731,10 @@ void render_prepare(int rx0, int rx1) {}uint16_t *render_buffer(void) { return cbuf; }-void *render_scratch(void) { return zbuf; } /* depth buffer, free between frames */uint16_t *render_strip(int sy, int n, int x0, int x1) {+ uint16_t depth[SCREEN_W * STRIP_H] __attribute__((aligned(4)));+ zbuf = depth;strip_y0 = sy;strip_y1 = sy + n;clip_x0 = x0;@@ -756,6 +759,7 @@ uint16_t *render_strip(int sy, int n, int x0, int x1) {draw_object(&objs[i], r);}draw_shadows();+ zbuf = NULL;return cbuf;}diff --git a/games/numdrive/src/render.h b/games/numdrive/src/render.hindex 48c926cd..2536973f 100644--- a/games/numdrive/src/render.h+++ b/games/numdrive/src/render.h@@ -27,7 +27,6 @@ void render_frame(void (*post)(uint16_t *px, int y, int n)); /* full screen, posvoid render_prepare(int x0, int x1); /* per-view object culling */uint16_t *render_strip(int y, int n, int x0, int x1); /* world into the strip buffer */uint16_t *render_buffer(void);-void *render_scratch(void); /* SCREEN_W * STRIP_H * 2 bytes, free outside rendering */void cam_default(void);void cam_view(float cx, float cy, float zoom_mul, float roll);void cam_update(void);diff --git a/games/numdrive/src/ui.c b/games/numdrive/src/ui.cindex ba9d420b..57c0b954 100644--- a/games/numdrive/src/ui.c+++ b/games/numdrive/src/ui.c@@ -215,7 +215,7 @@ void ui_capture_background(void) {}}/* soften: two separable box passes */- uint8_t(*t)[BW][3] = render_scratch();+ uint8_t t[BH][BW][3];for (int pass = 0; pass < 2; pass++) {for (int y = 0; y < BH; y++)for (int x = 0; x < BW; x++)