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
TI-84 CE: Flappy Bird, 2 Players, Portal, Minesweeper, NumVisuals, Meowdoku and UNO
Mason363b9a5774477eb
diff --git a/games/flappybird/src/main.c b/games/flappybird/src/main.cindex b7ae7e43..05947a07 100644--- a/games/flappybird/src/main.c+++ b/games/flappybird/src/main.c@@ -840,7 +840,7 @@ static void play_step(void) {int target = spd0 * (w == EV_TAIL ? 422 : w == EV_HEAD ? 154 : 256) >> 8;spd += (target - spd) / 12 + (target > spd) - (target < spd);gx += spd, gph = (int)(gx >> 8) % 14;- int32_t right = -(1 << 30);+ int32_t right = -((int32_t)1 << 30);int gt = gap_target();for (int i = 0; i < NP; i++) {pipe_t *p = &P[i];@@ -867,7 +867,7 @@ static void play_step(void) {int sp = dense_now() ? space * 174 >> 8 : space;for (int i = 0; i < NP; i++)if (!P[i].on) {- spawn(&P[i], right < -(1 << 29) ? W << 8 : right + (sp << 8));+ spawn(&P[i], right < -((int32_t)1 << 29) ? W << 8 : right + (sp << 8));break;}}diff --git a/games/meowdoku/src/main.c b/games/meowdoku/src/main.cindex d638df6c..589f8ca5 100644--- a/games/meowdoku/src/main.c+++ b/games/meowdoku/src/main.c@@ -394,9 +394,9 @@ static uint16_t has_cat[3]; /* the rows, columns and colours with a cat */(colours) get X's. Units of type a picked, their candidates spanning units of type b. */static int set_k, set_a, set_b;static bool sets(int from, int k, uint32_t pick, uint32_t span) {- if (__builtin_popcount(span) > set_k) return false;+ if (__builtin_popcountl(span) > set_k) return false;if (k == set_k) {- if (__builtin_popcount(span) != k) return false;+ if (__builtin_popcountl(span) != k) return false;bool any = false;for (int i = 0; i < n * n; i++) {int in_b = span >> (unit_of(set_b, i) - set_b * n) & 1, in_a = pick >> (unit_of(set_a, i) - set_a * n) & 1;diff --git a/games/minesweeper/src/main.c b/games/minesweeper/src/main.cindex 5630ff13..02437a4b 100644--- a/games/minesweeper/src/main.c+++ b/games/minesweeper/src/main.c@@ -643,7 +643,7 @@ static void game_counters(int f) {}/* ------------------------------------------------------------------ playing */-static int pressed_until, win_at; /* win_at: when the game that ended takes OK again (a win shows its box) */+static int32_t pressed_until, win_at; /* win_at: when the game that ended takes OK again (a win shows its box) */static uint32_t last; /* the last frame's time */static void new_game(void) {gs = G_NEW, elapsed = 0, flags = 0, win_at = 0, cur_on = true;@@ -685,7 +685,7 @@ static int last_time, new_best;static void ended(int c) {cur_on = false, dirty(cur);ripple(c);- win_at = (int)now + 700;+ win_at = (int32_t)now + 700;save();}static void won(void) {@@ -1046,11 +1046,11 @@ int main(void) {}if (ok) {if (gs < G_WON) grip = state(cur) == OPEN ? cur : -1, play(cur);- else if (!win_at) pressed_until = (int)now + 120, start(V.diff); /* like clicking the face */+ else if (!win_at) pressed_until = (int32_t)now + 120, start(V.diff); /* like clicking the face */}if ((hit & K_FLAG) && gs < G_WON) mark(cur);if (back) open_dialog(D_PAUSE, 0);- else if (win_at && (int)(now - win_at) >= 0) {+ else if (win_at && (int32_t)(now - win_at) >= 0) {win_at = 0;if (gs == G_WON) open_dialog(D_WIN, 0);}@@ -1105,7 +1105,7 @@ int main(void) {draw_cell(i), drawn++;}}- game_counters((int)(now - pressed_until) < 0 ? F_SMILE | 4 : face_now);+ game_counters((int32_t)(now - pressed_until) < 0 ? F_SMILE | 4 : face_now);} else {title_counters(face_now);}diff --git a/games/numvisuals/src/main.c b/games/numvisuals/src/main.cindex a2511390..0c76a6b1 100644--- a/games/numvisuals/src/main.c+++ b/games/numvisuals/src/main.c@@ -253,12 +253,12 @@ static void synth(void) {static int plasma_k, plasma_speed;static void plasma_frame(int dt) {- int t = (int)now * plasma_speed / 16, k = plasma_k;+ int t = (int)((int32_t)now * plasma_speed / 16), k = plasma_k;for (int x = 0; x < W; x++) ca[x] = (int16_t)(S(x * k / 8 + t / 7) + S(x * k / 13 - t / 11));for (int y = 0; y < H; y++) cb[y] = (int16_t)(S(y * k / 8 - t / 9) + S(y * k / 17 + t / 13));}static void plasma(void) {- int t = (int)now * plasma_speed / 16, k = plasma_k;+ int t = (int)((int32_t)now * plasma_speed / 16), k = plasma_k;for (int j = 0; j < SH; j++) {int y = top + j, r = cb[y];color *p = buf + j * W;@@ -658,8 +658,8 @@ static const char *hint(void) {}static void ui_draw(void) {- int fade = mode == M_SHOW ? clamp(32 - ((int)(now - hint_t) - 2500) / 16, 0, 32) : 32;- int toast = mode == M_SHOW ? clamp(32 - ((int)(now - toast_t) - 1500) / 16, 0, 32) : 0;+ int fade = mode == M_SHOW ? clamp((int)(32 - ((int32_t)(now - hint_t) - 2500) / 16), 0, 32) : 32;+ int toast = mode == M_SHOW ? clamp((int)(32 - ((int32_t)(now - toast_t) - 1500) / 16), 0, 32) : 0;if (mode == M_BG || mode == M_ADDON) {bool b = mode == M_BG;rect(0, 0, W, 28, 0, 10);diff --git a/games/portal/src/main.c b/games/portal/src/main.cindex 48b8f07b..75f05731 100644--- a/games/portal/src/main.c+++ b/games/portal/src/main.c@@ -1,4 +1,5 @@/* Portal Returns for NumWorks: title screen, menus, help, saving. */+#include <limits.h>#include <string.h>#include "../../common/epsilon_app.h"#include "../../common/epsilon_files.h"@@ -57,7 +58,7 @@ int wait_key(void) {prev_keys = keys;if (fresh) {uint32_t lo = (uint32_t)fresh; /* 32-bit ctz: no libgcc helper in the module */- int k = lo ? __builtin_ctz(lo) : 32 + __builtin_ctz((uint32_t)(fresh >> 32));+ int k = lo ? __builtin_ctzl(lo) : 32 + __builtin_ctzl((uint32_t)(fresh >> 32));rep = k <= eadk_key_right ? k : -1;rep_at = now + 350;return k;@@ -458,7 +459,7 @@ static void sign_draw(void) {/* Where the sign hides the least: over plain wall rather than open air,* doors, droppers or fields, as near the middle as possible. */static int sign_place(int w) {- int best = 0, best_cost = 1 << 30;+ int best = 0, best_cost = INT_MAX;for (int x = 0; x + w <= 320; x += 2) {int cost = 0;for (int c = x / 16; c <= (x + w - 1) / 16; c++) {diff --git a/games/twoplayer/src/main.c b/games/twoplayer/src/main.cindex 04b35320..d39c4857 100644--- a/games/twoplayer/src/main.c+++ b/games/twoplayer/src/main.c@@ -11,6 +11,7 @@* along. Positions are in 256ths of a pixel and time in milliseconds, but for the round things* of Air Hockey and the party games, in pixels and seconds. */#include <eadk.h>+#include <limits.h>#include "../../../launcher/src/gfx.h"#include "../../common/np_text.h"@@ -464,7 +465,7 @@ static void tanks_cpu(int *v, int *turn) {if (me != you && open_way(me, d) && dist[me + STEP[d]] < dist[me]) next = me + STEP[d];int gx = ((TX0 + next % TCOLS * TCS + TCS / 2) << 8) - tx_[1], gy = ((TY0 + next / TCOLS * TCS + TCS / 2) << 8) - ty_[1];if (next == you) gx = tx_[0] - tx_[1], gy = ty_[0] - ty_[1];- for (int a = 0, best = -(1 << 30); a < 64; a++) { /* the way of the 64 nearest to it */+ for (int a = 0, best = INT_MIN / 2; a < 64; a++) { /* the way of the 64 nearest to it */int d = (gx >> 8) * cos64(a) + (gy >> 8) * sin64(a);if (d > best) best = d, want = a;}@@ -536,7 +537,8 @@ static void tanks_paint(void) {for (int i = 0; i < SHELLS; i++)if (sh[i].own >= 0) disc(sh[i].x >> 8, sh[i].y >> 8, 2, HEX(0x1E1F24));for (int p = 0; p < 2; p++) {- int x = tx_[p] >> 8, y = ty_[p] >> 8, t = (int)ago(dead_t[p]);+ int x = tx_[p] >> 8, y = ty_[p] >> 8;+ int32_t t = (int32_t)ago(dead_t[p]);if (!dead[p]) {tank(x, y, ta[p] >> 8, p);continue;@@ -586,12 +588,12 @@ static int room(int x, int y, int cap) {static int cycles_cpu(void) {static const int16_t CAP[4] = {0, 12, 70, 220};if (!bot_due()) return hd[1];- int best = hd[1], bv = -(1 << 30);+ int best = hd[1], bv = INT_MIN / 2;for (int t = 0; t < 3; t++) {int d = (hd[1] + t + (t == 2)) & 3, x = hx[1] + DX[d], y = hy[1] + DY[d], r = room(x, y, CAP[cpu]), a = 0;while (a < 7 && free_at(x + a * DX[d], y + a * DY[d])) a++;int v = r * 8 + a * 48 + (t ? 0 : 6) + rn(cpu == 1 ? 120 : 6);- if (!r) v = -(1 << 29);+ if (!r) v = INT_MIN / 4;if (v > bv) bv = v, best = d;}return best;@@ -630,7 +632,8 @@ static void cycles_paint(void) {gfx_fill(c * 4 + 1 - 2 * l, CY0 + r * 4 + 1 - 2 * u, 2 + 2 * l, 2 + 2 * u, light[v - 1]);}for (int p = 0; p < 2; p++) {- int x = hx[p] * 4 + 2, y = CY0 + hy[p] * 4 + 2, t = (int)ago(phase_t);+ int x = hx[p] * 4 + 2, y = CY0 + hy[p] * 4 + 2;+ int32_t t = (int32_t)ago(phase_t);gfx_circle(x, y, 6, light[p], 90);gfx_fill(x - 2, y - 2, 4, 4, WHITE);if (crashed[p] && phase) { /* a flash where it hit */@@ -878,7 +881,8 @@ static void scene(void *ctx) {}if (game) gfx_text_center(&np_font_small, 160, 15, T("Back pause"), HEX(0xD6DCF5), 256);if (phase == 1 && screen == S_PLAY) {- int t = (int)ago(phase_t), y = 120 - (t < 200 ? (200 - t) / 10 : 0);+ int32_t t = (int32_t)ago(phase_t);+ int y = 120 - (t < 200 ? (200 - t) / 10 : 0);gfx_rrect(70, y - 26, 180, 62, 14, INK, 200);if (winner < 2) say(&np_font_title, 160, y, who(winner), light[winner]);say(&np_font_title, 160, y + 26, winner < 2 ? "+1" : T("Draw!"), WHITE);diff --git a/games/uno/src/main.c b/games/uno/src/main.cindex 50a5e3f9..0b2729d6 100644--- a/games/uno/src/main.c+++ b/games/uno/src/main.c@@ -16,7 +16,7 @@ static uint32_t now, bot_at, catch_at, end_at, saved_at;static uint8_t catcher = UNO_NONE, open_seen = UNO_NONE;static bool dirty;/* frames drawn, the slowest (ms) and those over 33 ms: read by tools/emu.py */-#ifndef HOST+#if !defined(HOST) && !defined(NP_PORT)__attribute__((used, externally_visible))#endifuint32_t perf_frames, perf_max, perf_slow;diff --git a/games/uno/src/save.c b/games/uno/src/save.cindex 99838f2f..a1a9f5be 100644--- a/games/uno/src/save.c+++ b/games/uno/src/save.c@@ -76,7 +76,7 @@ static bool copy_read(uno_file *f) {int v0 = b64v(l[k]), v1 = b64v(l[k + 1]), v2 = l[k + 2] == '=' ? 0 : b64v(l[k + 2]),v3 = l[k + 3] == '=' ? 0 : b64v(l[k + 3]);if (v0 < 0 || v1 < 0 || v2 < 0 || v3 < 0) return false;- uint32_t w = (uint32_t)(v0 << 18 | v1 << 12 | v2 << 6 | v3);+ uint32_t w = (uint32_t)v0 << 18 | (uint32_t)v1 << 12 | (uint32_t)v2 << 6 | (uint32_t)v3;if (o < sizeof *f) bytes[o++] = (uint8_t)(w >> 16);if (o < sizeof *f) bytes[o++] = (uint8_t)(w >> 8);if (o < sizeof *f) bytes[o++] = (uint8_t)w;