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.

TI-84 CE: testing without a calculator, in the README

Mason3637a60a748056f
diff --git a/platform/ti84ce/README.md b/platform/ti84ce/README.md
index 2f350b68..79224efc 100644
--- a/platform/ti84ce/README.md
+++ b/platform/ti84ce/README.md
@@ -39,3 +39,23 @@ python3 ../../platform/ti84ce/check.py --ints build/ti84ce/<game>
lists what loses bits only with a 24-bit `int`: conversions, shifts, and the casts to `int` to look at.
The CE is slow (48 MHz, and `float` is done in software): the classics and the light 2D games run on it.
+
+## Testing without a calculator
+
+`tools/ce_emu.py` runs a CE program on [CEmu](https://github.com/CE-Programming/CEmu)'s core (the eZ80, the LCD controller and panel, the keypad, the timers, the flash and the memory protection, as on the calculator) with a small OS of its own in place of TI's ROM, so no ROM dump is needed. Its first run builds it (`tools/ce_emu`, needs CEdev and a C compiler; CEmu is fetched into `~/Documents/Assets/toolchains/ce-src`) and gets the CE C libraries into `~/Documents/Assets/toolchains/ce-libs`.
+
+```
+python3 tools/ce_emu.py prog.8xp [vars.8xv ...] --keys "1500-1600:2nd,3000:clear" --shots 1000,4000 --ms 6000 --out DIR
+python3 tools/ce_emu.py game snake --keys ... --shots ... a game's CE build
+python3 tools/ce_emu.py sheet [game ...] every CE build for 40 s, build/ce_emu/sheet.png
+python3 tools/ce_emu.py autotest test/.../autotest.json a CE toolchain test, its screens' CRCs checked
+```
+
+Keys are the CE's (`2nd mode del alpha enter clear up down left right 0`-`9` ...) or the NumWorks's on NumPlay's layout (`ok exe back home`), held from one time to another in milliseconds. It says how the run ended, `ok` (the time ran out), `exited`, `crash` (a write to flash or past the stack, an invalid instruction or a jump to 0, unmapped memory), `hang`, `os-error` or `unimplemented` (an OS routine `ce_emu` doesn't have yet, named), then the frame rate a real CE gets, the work a frame takes, the stack used and the RAM left.
+
+- `--frames-from MS` counts frames from then on, past a slow title. A frame is a call to `eadk_display_wait_for_vblank`, or a key scan once the screen changed (when the build inlined it), or a graphx buffer swap.
+- `--profile 15` names the functions the time goes to.
+- `--vars-out DIR` keeps the appvars at the end; give them back to the next run to test saves.
+- `--ram NAME` puts a variable in RAM instead of the archive.
+
+TI's float routines (`float`, `sqrtf`...) are done by the host at an estimated cost, and the report says how much of the time they took (`--float-scale` changes it). TI-OS's own screens and fonts aren't drawn (the home screen's text is written with NumPlay's font and listed in the report), and TI-OS's menus, the parser and USB aren't there.
diff --git a/tools/ce_emu.py b/tools/ce_emu.py
index 0f96085f..c8bf8c7b 100644
--- a/tools/ce_emu.py
+++ b/tools/ce_emu.py
@@ -4,7 +4,11 @@
python3 tools/ce_emu.py PROG.8xp [VARS.8xv ...] [--keys ...] [--shots ...] [--ms N] [--out DIR]
python3 tools/ce_emu.py game ID [same options] a NumPlay game's CE build (games/ID/build/ti84ce)
python3 tools/ce_emu.py sheet [ID ...] [--ms N] [-j N] [--out DIR]
- every CE build (games.json "ports"), a sheet of screens
+ every CE build (games.json "ports") for 40 s: OK twice,
+ the arrows, a sheet of screens (build/ce_emu/sheet.png)
+ python3 tools/ce_emu.py autotest DIR/autotest.json ...
+ CE toolchain tests (CEmu's autotester JSON): their keys
+ and delays, their screens' CRCs checked
Options:
--keys "1500-1600:2nd,3000:clear" keys held from one time to another (ms; one time alone: 100 ms). CE names:
diff --git a/tools/ce_emu/ce_emu.c b/tools/ce_emu/ce_emu.c
index 30851878..ccb19d9f 100644
--- a/tools/ce_emu/ce_emu.c
+++ b/tools/ce_emu/ce_emu.c
@@ -10,10 +10,17 @@
* --out DIR where pictures go (.)
* --ram NAME,... these variables in RAM; the others where their file puts them (the archive, mostly)
* --frame ADDR a frame each time the CPU reaches ADDR (eadk_display_wait_for_vblank's, say)
+ * --frame-drawn only when what the LCD shows changed since the last one (a key scan as the marker)
+ * --frames-from MS frames counted from then on
+ * --idle ADDR a function the program waits in (ticksleep): the time inside isn't work
* --vars-out DIR the programs and appvars at the end, as files
* --report FILE a JSON report (else a summary on stdout)
* --rev pre-a|i|m the ASIC revision (m: every CE since 2019, the Python ones)
* --names INC ti84pceg.inc, for the routines' names
+ * --script FILE CEmu autotester steps (delay MS, key GROUP BIT, hash ID START SIZE TIMEOUT CRCS)
+ * --float-scale X TI's float routines cost X times os.c's estimates
+ * --profile FILE the PC every 0.1 ms, counted, into FILE
+ * --screen-memory pictures from the LCD controller's memory rather than the panel
* --trace every OS call on stderr
*
* It stops at a crash (a protection fault: a write to flash, to the stack limit, out in unprivileged code; the