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
Add Donkey Kong builds, credits and validation
Bobydeluxe76808e7e58ef
diff --git a/games/donkeykong/.gitignore b/games/donkeykong/.gitignorenew file mode 100644index 00000000..fd6aad7f--- /dev/null+++ b/games/donkeykong/.gitignore@@ -0,0 +1,2 @@+output/+__pycache__/diff --git a/games/donkeykong/Makefile b/games/donkeykong/Makefilenew file mode 100644index 00000000..7cb1582f--- /dev/null+++ b/games/donkeykong/Makefile@@ -0,0 +1,43 @@+# Donkey Kong: native standalone arcade adaptation by Bobydeluxe.+CC = arm-none-eabi-gcc+NWLINK ?= npx --yes -- [email protected]+PYTHON ?= python3+HOST_CC ?= cc+ARM_LD ?= arm-none-eabi-ld+OBJCOPY ?= arm-none-eabi-objcopy+SRC = src/main.c src/game.c src/save.c src/render.c+OBJECTS = $(patsubst src/%.c,output/%.o,$(SRC))+HEADERS = $(wildcard src/*.h) ../common/epsilon_app.h ../common/epsilon_files.h+PACKER = tools/compact_nwa.py tools/standalone.ld+CFLAGS = -std=c11 $(shell $(NWLINK) eadk-cflags-device) -Os -Wall -Wextra -Werror+CFLAGS += -ffunction-sections -fdata-sections -fstack-usage -fno-tree-loop-distribute-patterns+CFLAGS += -flto -fno-fat-lto-objects -fvisibility=internal+LINK = -nostartfiles --specs=nano.specs -Wl,--relocatable,--gc-sections,-e,main -flinker-output=nolto-rel+.PHONY: build check test test-arm assets clean+build: output/donkeykong.nwa+output:+ mkdir -p $@+output/%.o: src/%.c $(HEADERS) | output+ $(CC) $(CFLAGS) -c $< -o $@+output/icon.o: src/icon.png | output+ $(NWLINK) png-icon-o $< $@+output/icon-compact.o: output/icon.o $(PACKER)+ $(PYTHON) tools/compact_nwa.py icon $< $@ --objcopy $(OBJCOPY)+output/donkeykong-debug.nwa: $(OBJECTS) output/icon-compact.o $(PACKER)+ $(CC) $(CFLAGS) $(LINK) -Wl,-u,eadk_app_name,-u,eadk_app_icon,-u,eadk_api_level $(OBJECTS) output/icon-compact.o -o output/standalone.o+ $(PYTHON) tools/compact_nwa.py app output/standalone.o $@ --ld $(ARM_LD)+output/donkeykong.nwa: output/donkeykong-debug.nwa $(PACKER)+ $(PYTHON) tools/compact_nwa.py release $< $@ --objcopy $(OBJCOPY)+check: build+ $(NWLINK) nwa-bin output/donkeykong.nwa output/donkeykong.bin --ram-length 107674+ $(NWLINK) nwa-bin output/donkeykong-debug.nwa output/donkeykong-debug.bin --ram-length 107674+ $(PYTHON) -c "from pathlib import Path; assert Path('output/donkeykong.bin').read_bytes() == Path('output/donkeykong-debug.bin').read_bytes()"+test: | output+ $(HOST_CC) -std=c11 -O2 -Wall -Wextra -Werror -Isrc tests/test.c src/game.c src/save.c src/render.c -o output/test+ cd output && ./test+test-arm:+ $(PYTHON) tests/test_arm.py --nwlink "$(NWLINK)"+assets:+ $(PYTHON) tools/assets.py+clean:+ rm -rf outputdiff --git a/games/donkeykong/README.md b/games/donkeykong/README.mdnew file mode 100644index 00000000..98902057--- /dev/null+++ b/games/donkeykong/README.md@@ -0,0 +1,85 @@+# Donkey Kong++**By Bobydeluxe.** A native arcade adaptation for NumWorks, with English menus,+original redrawn pixel art and the four arcade boards. No ROM or emulator is+required. It builds and installs as its own app, separately from the combined+NumPlay launcher. Not affiliated with Nintendo.++++## Play++Download **DonkeyKong.nwa** from the [NumPlay releases](https://github.com/Mason363/NumPlay/releases/latest)+once a release includes this game, or build `build/apps/DonkeyKong.nwa` locally.+Install it with [my.numworks.com/apps](https://my.numworks.com/apps), then open+Donkey Kong from the calculator's Home menu.++| Key | Action |+| --- | --- |+| Left / Right, or 4 / 6 | Move |+| Up / Down, or 8 / 2 | Climb a ladder |+| OK / EXE / Shift | Jump |+| Back | Pause / go back |+| Home / On-Off | Save records and exit |++Reach Pauline on **25m** (barrels), **50m** (conveyors) and **75m** (elevators).+On **100m**, remove all eight blue rivets. Jump over the holes left behind.+The four boards repeat in order, with gradually faster obstacles; difficulty+is capped to keep later rounds playable.++Three lives, a single extra life at 7,000 points, temporary hammers, collectible+lost items and a countdown bonus are included. Long falls and running out of+bonus cost a life. Hammers prevent jumping and climbing until they expire;+the yellow bar under the lives shows the remaining time.++Pause offers **Resume**, **Restart** (with confirmation) and **Title**. An+unfinished run can be resumed from the title while the app remains open.+`donkeykong.sav` stores records only, not a suspended run: best score, runs,+rescues and highest round, in 32 bytes plus filesystem metadata. A full+filesystem offers retry, continued play, or exit without saving.++## Build++Requirements: Python 3.9+, Node.js, `nwlink` 1.0.0, and the ARM GNU toolchain+with newlib nano. Art and the PNG icon are generated with Python's standard+library; there is no asset download or external asset pack.++```sh+python build.py --arm-bin /path/to/arm/bin --nwlink /path/to/nwlink/bin/nwlink+```++With the tools on `PATH`, `python build.py` or `make build check` is enough.+`ARM_BIN` and `NWLINK` environment variables are also accepted. The build+checks that the compact release and debug app install to identical bytes+and that both fit the 107,674-byte RAM profile. From the repository root,+`make apps` builds and copies `DonkeyKong.nwa` alongside the other apps;+`make check` checks its RAM and release generation lists its download.++Host tests and screenshots:++```sh+make test HOST_CC=cc PYTHON=python+```++Actual ARM app tests, after building and running host tests:++```sh+python tests/test_arm.py --nwlink /path/to/nwlink/bin/nwlink+```++These use the repository's Unicorn emulator and require Unicorn, pyelftools+and Pillow. See [validation](VALIDATION.md) for measured sizes and test scope.++## Credits and scope++- Adaptation: **Bobydeluxe**.+- Original arcade game, characters and design: **Nintendo, 1981**.+- Reference: [Donkey Kong — Super Mario Wiki](https://www.mariowiki.com/Donkey_Kong_(game)).+- Packed pixel art is newly drawn in `tools/assets.py`. No extracted Nintendo+ sprites or ROM data are bundled.+- Uses the repository's shared Epsilon file/exit helpers and 5×7 lettering.+ Source code follows the repository's GPL-3.0-only license.++This is a calculator adaptation with layouts and timing adjusted for its+224×224 playfield, rather than a cycle-accurate arcade reproduction. It uses+all four boards per round and avoids the original late-game timer overflow.diff --git a/games/donkeykong/VALIDATION.md b/games/donkeykong/VALIDATION.mdnew file mode 100644index 00000000..4c99c291--- /dev/null+++ b/games/donkeykong/VALIDATION.md@@ -0,0 +1,63 @@+# Donkey Kong validation++Verified locally on 2026-10-21, including an isolated publication snapshot+based on upstream `09943ea31e9198816ead6e33c75788cda6810048`.++## Footprint++| Item | Measured size |+| --- | ---: |+| Release `.nwa` transport file | 21,912 bytes |+| Installed flash image | 15,824 bytes |+| Static RAM (`.bss`) | 6,209 bytes |+| Maximum stack observed in ARM checks | 316 bytes |+| Game state, including all entity pools | 864 bytes |+| LCD drawing strip | 5,120 bytes |+| Record save payload | 32 bytes |+| Packed launcher icon | 346 bytes |++The renderer draws directly from packed 4-bit sprites into one eight-row strip.+Strip hashes avoid sending unchanged rows. There is no heap, full framebuffer,+floating-point physics, external asset pack, or ROM. Fixed 60 Hz simulation+uses a bounded catch-up loop and does not advance while paused.++## Tests++- C11 host build with `-O2 -Wall -Wextra -Werror`.+- Actual walking, jumping and climbing routes through all four boards;+ obstacles and items are disabled for those geometry checks. The elevator+ route boards a moving lift and transfers to the right-hand girders.+- Separate live obstacle checks for barrel jumping, one-time jump awards,+ hammer hits, body collisions and capped scores/extra lives.+- Broken/retracting ladders, hammer restrictions, held jump input, fatal+ falls, timeouts, life loss, game over, rivet holes and round progression.+- 48 seeded random-input simulations (up to 18,000 steps each), checking+ entity bounds and invariants at every step.+- Save round-trip, every-byte corruption, truncated/null input, preserving+ the prior decoded record on failure.+- Host and actual ARM screenshots of the boards, title, pause, instructions+ and storage-full dialog; inspected visually.+- Actual ARM app on Epsilon N0120 (153,676-byte app RAM), Epsilon N0110+ (148,928-byte app RAM) and Upsilon (107,674-byte app RAM): launch, pause,+ resume, save, reload records, Home/On-Off exit.+- Full filesystem: keep playing, retry exit, and leave without saving;+ unrelated files remain byte-identical.+- Exit checks: no invalid accesses, firmware RAM changes, unbalanced Home+ locks, or uncleared app RAM.+- Release and debug artifacts install to identical bytes on the smallest+ RAM profile.+- Publication builds with the current upstream Home/exit and file helpers;+ the exit helper waits for held keys to be released before returning Home.+- `make build check test` passes from the isolated snapshot. Release+ generation lists `DonkeyKong.nwa` once, with Bobydeluxe's credit. The+ combined launcher manifest is unchanged, and no other game is modified.++The four-board ARM render sample recorded 193 frames, a slowest draw of+11 ms, and no draws over 17 ms at the emulator's 216 MHz instruction budget.+This is an emulator measurement, not a physical-device benchmark. There has+been no physical-calculator playtest or exhaustive human playthrough of every+difficulty level. N0115 shares the N0110 architecture but was not separately+benchmarked here.++Reproducible local reports: `output/build-report.json` and+`output/arm/report.json`. Outputs and toolchain binaries are ignored by Git.diff --git a/games/donkeykong/build.py b/games/donkeykong/build.pynew file mode 100644index 00000000..037b9e51--- /dev/null+++ b/games/donkeykong/build.py@@ -0,0 +1,70 @@+#!/usr/bin/env python3+"""Build a standalone Donkey Kong .nwa, without changing the NumPlay launcher.++python build.py --arm-bin /path/to/arm/bin --nwlink /path/to/nwlink+NWLINK may also name the nwlink JavaScript entry point (run with Node).+"""+import argparse+import json+import os+from pathlib import Path+import re+import shlex+import shutil+import subprocess+import sys++ROOT = Path(__file__).resolve().parent+REPO = ROOT.parents[1]+OUT = ROOT/'output'++def run(args):+ args = [str(x) for x in args]+ subprocess.run(args, cwd=ROOT, check=True)++def main():+ ap = argparse.ArgumentParser(description=__doc__)+ ap.add_argument('--arm-bin', default=os.environ.get('ARM_BIN',''))+ ap.add_argument('--nwlink', default=os.environ.get('NWLINK','nwlink'))+ a = ap.parse_args()+ OUT.mkdir(exist_ok=True)+ arm = lambda name: str(Path(a.arm_bin)/('arm-none-eabi-'+name)) if a.arm_bin else 'arm-none-eabi-'+name+ if Path(a.nwlink).is_file():+ nw = [a.nwlink] if a.nwlink.endswith(('.exe','.cmd')) else ['node',a.nwlink]+ else:+ nw = ([v.replace('"','') for v in re.findall(r'(?:[^\s"]|"[^"]*")+',a.nwlink)]+ if os.name=='nt' else shlex.split(a.nwlink))+ flags = subprocess.check_output(nw+['eadk-cflags-device'],cwd=ROOT,text=True).strip()+ # nwlink quotes the include directory. Preserve backslashes inside Windows paths.+ target = ([v.replace('"','') for v in re.findall(r'(?:[^\s"]|"[^"]*")+',flags)]+ if os.name=='nt' else shlex.split(flags))+ opts = ['-std=c11',*target,'-Os','-Wall','-Wextra','-Werror','-ffunction-sections',+ '-fdata-sections','-fstack-usage','-fno-tree-loop-distribute-patterns',+ '-flto','-fno-fat-lto-objects','-fvisibility=internal']+ run([sys.executable,'tools/assets.py'])+ objects = []+ for name in ('main','game','save','render'):+ obj = OUT/(name+'.o')+ run([arm('gcc'),*opts,'-c','src/'+name+'.c','-o',obj]);objects.append(obj)+ packer = ROOT/'tools/compact_nwa.py'+ run([*nw,'png-icon-o','src/icon.png',OUT/'icon.o'])+ run([sys.executable,packer,'icon',OUT/'icon.o',OUT/'icon-compact.o','--objcopy',arm('objcopy')])+ run([arm('gcc'),*opts,'-nostartfiles','--specs=nano.specs',+ '-Wl,--relocatable,--gc-sections,-e,main','-flinker-output=nolto-rel',+ '-Wl,-u,eadk_app_name,-u,eadk_app_icon,-u,eadk_api_level',+ *objects,OUT/'icon-compact.o','-o',OUT/'standalone.o'])+ run([sys.executable,packer,'app',OUT/'standalone.o',OUT/'donkeykong-debug.nwa','--ld',arm('ld')])+ run([sys.executable,packer,'release',OUT/'donkeykong-debug.nwa',OUT/'donkeykong.nwa','--objcopy',arm('objcopy')])+ for name in ('donkeykong','donkeykong-debug'):+ run([*nw,'nwa-bin',OUT/(name+'.nwa'),OUT/(name+'.bin'),'--ram-length','107674'])+ installed = (OUT/'donkeykong.bin').read_bytes()+ assert installed == (OUT/'donkeykong-debug.bin').read_bytes(), 'Release changes installed bytes'+ apps = REPO/'build/apps';apps.mkdir(parents=True,exist_ok=True)+ shutil.copyfile(OUT/'donkeykong.nwa',apps/'DonkeyKong.nwa')+ report = dict(nwa_bytes=(OUT/'donkeykong.nwa').stat().st_size, installed_bytes=len(installed),+ release_installed_matches_debug=True, artifact=str(apps/'DonkeyKong.nwa'))+ (OUT/'build-report.json').write_text(json.dumps(report,indent=2)+'\n')+ print(json.dumps(report,indent=2))++if __name__=='__main__':+ main()