Skip to content

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.

make check: every game fits in the 133652 bytes of RAM custom builds of Epsilon 25.2 give apps

Mason Chen469ec558d81d
diff --git a/Makefile b/Makefile
index bac4e2fe..7a40a499 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,10 @@ B = build
# tools/gen_games.py), so it installs with less too, custom builds of the software say, where a game that
# needs more says so. The check: every game fits in RAM_LIMIT.
RAM_LIMIT = 148928
+# custom builds of Epsilon 25.2's source give apps less: 133652 bytes; every game fits there too, in NumPlay and on
+# its own (their big buffers are on the stack, 32 KB apart from that RAM, or in the RAM the software has left)
+CUSTOM_RAM = 133652
+BIG_APPS = Celeste HollowKnight ChampionIsland NumBlocks NumDrive
# 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 has
@@ -137,7 +141,13 @@ $(B)/%.nwa: $(ARM_OBJS) $(MODULES) $(B)/variant/%-name.o $(B)/variant/%-icon.o
arm-none-eabi-strip --strip-unneeded $@
@if [ "$*" = NumPlay ]; then $(PY) tools/sizes.py $@ $(B)/modules; fi
-check: nwa
+check: nwa apps
+ @x=$$(cat $(B)/gen/arena_extra); \
+ $(NWLINK) nwa-bin --ram-length $$(( $(CUSTOM_RAM) - x )) $(B)/NumPlay.nwa $(B)/NumPlay-custom.bin >/dev/null || \
+ { echo "a game of NumPlay needs more RAM than custom builds of 25.2 give apps ($(CUSTOM_RAM) bytes)"; exit 1; }
+ @for a in $(BIG_APPS); do $(NWLINK) nwa-bin --ram-length $(CUSTOM_RAM) $(B)/apps/$$a.nwa $(B)/apps/$$a.bin >/dev/null || \
+ { echo "$$a.nwa needs more RAM than custom builds of 25.2 give apps ($(CUSTOM_RAM) bytes)"; exit 1; }; done; \
+ echo "NumPlay's games and $(BIG_APPS) fit in $(CUSTOM_RAM) bytes of RAM"
@x=$$(cat $(B)/gen-upsilon/arena_extra); \
$(NWLINK) nwa-bin --ram-length $$(( $(UPSILON_RAM) - x )) $(B)/NumPlay-Upsilon.nwa $(B)/NumPlay-Upsilon.bin && \
echo "NumPlay-Upsilon.nwa installs as $$(wc -c < $(B)/NumPlay-Upsilon.bin) bytes; its RAM and any game's fit in $(UPSILON_RAM) bytes"
@@ -175,7 +185,7 @@ $(foreach l,$(LANGS),$(B)/NumPlay-$(LANG_$(l)).nwa): $(B)/NumPlay-%.nwa: FORCE |
$(eval L := $(if $(filter French,$*),fr,zh))
$(PY) tools/lang.py tree $(L) $(B)/lang/$(L)
$(MAKE) -C $(B)/lang/$(L) build/NumPlay.nwa NWLINK="$(NWLINK)"
- $(NWLINK) nwa-bin --ram-length $$(( $(RAM_LIMIT) - $$(cat $(B)/lang/$(L)/build/gen/arena_extra) )) \
+ $(NWLINK) nwa-bin --ram-length $$(( $(CUSTOM_RAM) - $$(cat $(B)/lang/$(L)/build/gen/arena_extra) )) \
$(B)/lang/$(L)/build/NumPlay.nwa $(B)/lang/$(L)/build/NumPlay.bin
@n=$$(wc -c < $(B)/lang/$(L)/build/NumPlay.bin); echo "NumPlay-$*.nwa installs as $$n bytes ($$(( $(APP_SPACE) - n )) to spare)"; \
[ $$n -le $(APP_SPACE) ] || { echo "NumPlay-$*.nwa is bigger than the calculator's app space"; exit 1; }
diff --git a/README.md b/README.md
index 3dcb1317..8111146c 100644
--- a/README.md
+++ b/README.md
@@ -284,9 +284,9 @@ You need your calculator, its USB cable, and a computer with **Google Chrome** o
| N0120 | Epsilon 23.2 or newer (the calculator's own software) | Everything |
| N0110, N0115 | Epsilon 23.2 or newer | Everything. These models are about 2.5 times slower, so the big games (Hollow Knight, Celeste, NumDrive, NumBlocks, Champion Island) show fewer frames per second, but they keep their speed. |
| N0110, N0115 | Upsilon | NumPlay-Upsilon.nwa: 13 games. See [On Upsilon](#on-upsilon). |
-| Any | Custom software built from Epsilon's source | NumPlay installs. These builds can give apps less memory: a game that needs more than there is says how much on its card (NumBlocks and NumDrive need about 147 KB and 143 KB). |
+| Any | Custom software built from Epsilon 25.2's source | Everything, Celeste, Hollow Knight and Champion Island too. These builds can give apps less memory (133 KB): on one that gives even less, a game that needs more than there is says how much on its card. |
-Champion Island needs Epsilon 25.2 or newer. To see your calculator's model and software, open **Settings**, then **About**. To update the software, go to [my.numworks.com](https://my.numworks.com) with the calculator plugged in.
+To see your calculator's model and software, open **Settings**, then **About**. To update the software, go to [my.numworks.com](https://my.numworks.com) with the calculator plugged in.
### In French and Chinese
diff --git a/tests/test_small_ram.py b/tests/test_small_ram.py
index ceda6b1e..40cebeab 100644
--- a/tests/test_small_ram.py
+++ b/tests/test_small_ram.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
-"""Checks NumPlay on calculator software that gives apps less RAM: custom builds of Epsilon 25.2
-give them 133652 bytes (tools/emu.py --ram-length). NumPlay installs there, and its games use the
-RAM after it up to the end of what there is (tools/gen_games.py):
+"""Checks NumPlay on calculator software that gives apps less RAM (tools/emu.py --ram-length). NumPlay installs
+with less, and its games use the RAM after it up to the end of what there is (tools/gen_games.py):
-1. NumBlocks needs more: OK on its card doesn't start it (the card says how much it lacks);
-2. NumDash fits: it starts, and makes no access outside the app's RAM.
+1. custom builds of Epsilon 25.2 give apps 133652 bytes: NumBlocks, the hungriest game, starts there;
+2. with 120000 bytes, NumBlocks doesn't fit: OK on its card doesn't start it (the card says how much it lacks),
+ while NumDash, which fits, starts and makes no access outside the app's RAM.
Usage: test_small_ram.py build/NumPlay.nwa [--out DIR]
"""
@@ -15,9 +15,6 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "tools"))
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import emu # noqa: E402
-
-RAM = 133652
-emu.configure("n0120", "epsilon", RAM)
from test_progress import presses, write_storage # noqa: E402
@@ -28,7 +25,8 @@ def changed(a, b):
return sum(d.histogram()[25:]) / (d.width * d.height)
-def run(nwa, out, name, keys, shots, ms):
+def run(nwa, out, ram, name, keys, shots, ms):
+ emu.configure("n0120", "epsilon", ram)
st = os.path.join(out, f"{name}.bin")
write_storage(st, [("pi.py", b"\x01print(3.14159)\n\x00")])
c = emu.Calculator(nwa, storage_file=st)
@@ -48,15 +46,20 @@ def main():
os.makedirs(a.out, exist_ok=True)
problems = []
# NumBlocks, third on the home screen: Right twice, then OK
- c, (before, after) = run(a.nwa, a.out, "numblocks", ((2500, "right"), (2800, "right"), (4000, "ok")), (3900, 6800), 7000)
+ blocks = ((2500, "right"), (2800, "right"), (4000, "ok"))
+ c, (before, after) = run(a.nwa, a.out, 133652, "numblocks_133652", blocks, (3900, 6800), 7000)
+ problems += sorted(set(c.violations))
+ if changed(before, after) < 0.3:
+ problems.append("NumBlocks didn't start with 133652 bytes of RAM")
+ c, (before, after) = run(a.nwa, a.out, 120000, "numblocks_120000", blocks, (3900, 6800), 7000)
problems += sorted(set(c.violations))
if changed(before, after) > 0.02:
- problems.append("NumBlocks started with too little RAM")
+ problems.append("NumBlocks started with 120000 bytes of RAM, too little")
# NumDash, the first: OK
- c, (home, game) = run(a.nwa, a.out, "numdash", ((2600, "ok"), (6000, "ok")), (2500, 8800), 9000)
+ c, (home, game) = run(a.nwa, a.out, 120000, "numdash_120000", ((2600, "ok"), (6000, "ok")), (2500, 8800), 9000)
problems += sorted(set(c.violations))
if changed(home, game) < 0.3:
- problems.append("NumDash didn't start")
+ problems.append("NumDash didn't start with 120000 bytes of RAM")
for p in problems:
print(" ", p)
print("PASS" if not problems else "FAIL")