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.

NumBlocks CE: benches for a world's rows and the inventory; ce_emu profiles from --frames-from

Mason3635b8c9abace31
diff --git a/games/numblocks/ce/src/main.c b/games/numblocks/ce/src/main.c
index 73b8edd2..ac781f19 100644
--- a/games/numblocks/ce/src/main.c
+++ b/games/numblocks/ce/src/main.c
@@ -118,6 +118,9 @@ static void act(void) {
if (!s) break;
loading("Building terrain");
uint32_t seed = plat_ms() * 2654435761u ^ (uint32_t)rnd(0x7FFFFF);
+#ifdef NB_SEED
+ seed = NB_SEED; /* (tests: a world known in advance) */
+#endif
new_world(s, cur_name, seed, new_mode);
save_world();
start_game();
diff --git a/tools/ce_emu.py b/tools/ce_emu.py
index c8bf8c7b..10b169a5 100644
--- a/tools/ce_emu.py
+++ b/tools/ce_emu.py
@@ -23,7 +23,7 @@ Options:
~/Documents/Assets/toolchains/ce-libs)
--frame SYMBOL|ADDR a frame each time the CPU gets there (default: eadk_display_wait_for_vblank
or eadk_keyboard_scan when the program has them, from its .obj next to it)
- --frames-from MS count frames from then on (past a slow title)
+ --frames-from MS count frames (and profile) from then on (past a slow title)
--profile N the N functions the CPU was found in most
--vars-out DIR the appvars and programs at the end, as files
--rev m|i|pre-a the hardware revision (m, every CE since 2019)
diff --git a/tools/ce_emu/ce_emu.c b/tools/ce_emu/ce_emu.c
index be924f10..4dd05c1f 100644
--- a/tools/ce_emu/ce_emu.c
+++ b/tools/ce_emu/ce_emu.c
@@ -11,7 +11,7 @@
* --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
+ * --frames-from MS frames counted from then on (and the profile)
* --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)
@@ -611,7 +611,7 @@ int main(int argc, char **argv) {
if (opt.profile) { /* the PC every 0.1 ms */
for (int k = 0; k < 10 && !stopping; k++) {
emu_run(1);
- if (started) samples[cpu.registers.PC & 0xFFFFFF]++;
+ if (started && now_ms >= opt.frames_from) samples[cpu.registers.PC & 0xFFFFFF]++;
}
} else {
emu_run(1);