From 12d2952e9fd6cc0015c7e607ffecbd4b5395ec36 Mon Sep 17 00:00:00 2001 From: Cyd Date: Fri, 3 Jul 2026 20:31:51 -0500 Subject: [PATCH] VDB: palette-reload delta probe (test palette-animation hypothesis) On each palette reload, diff against the previous captured palette and log how many of the 256 entries changed plus the first few index:old->new. Confirms the static/dynamic split: pal1/pal2 load once (static base structure -- red in odd entries, etc.), pal0 is rewritten ~28x. In this capture pal0 is doing the intro FadeToWhite -- ~216/256 entries ramping in lockstep from 0 to ~60/63 -- i.e. animating the whole display brightness via the palette without redrawing the framebuffer. Selective per-element flashing (targeted small deltas) would need an active mission to observe; this probe is the instrument for it. Co-Authored-By: Claude Opus 4.8 --- emulator/vpx-device/vpxlog.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/emulator/vpx-device/vpxlog.cpp b/emulator/vpx-device/vpxlog.cpp index 983b48f..001968d 100644 --- a/emulator/vpx-device/vpxlog.cpp +++ b/emulator/vpx-device/vpxlog.cpp @@ -1197,9 +1197,36 @@ static int vdb_group_base(int g) { return 2 + 8 * g; } static void vdb_flush_data(void) { if (vdb_data_group >= 0 && vdb_data_count) { if (vpx_fp) { + /* Palette-animation probe: on each reload, diff against the last + * captured palette for this group and report how many of the 256 + * entries changed (+ the first few index:old->new), so the + * "flashed" data can be seen. */ + static unsigned char prev[3][768]; + static bool have_prev[3] = { false, false, false }; + int g = vdb_data_group; flush_run(); - fprintf(vpx_fp, "# VDB pal%d loaded %lu data bytes\n", - vdb_data_group, vdb_data_count); + if (have_prev[g]) { + int changed = 0, first[4], nf = 0; + for (int i = 0; i < 256; i++) { + if (memcmp(&vdb_pal[g].ram[i*3], &prev[g][i*3], 3) != 0) { + if (nf < 4) first[nf++] = i; + changed++; + } + } + fprintf(vpx_fp, "# VDB pal%d reload: %d/256 entries changed", g, changed); + for (int k = 0; k < nf; k++) { + int i = first[k]; + fprintf(vpx_fp, " [%d]%d,%d,%d->%d,%d,%d", i, + prev[g][i*3], prev[g][i*3+1], prev[g][i*3+2], + vdb_pal[g].ram[i*3], vdb_pal[g].ram[i*3+1], vdb_pal[g].ram[i*3+2]); + } + fprintf(vpx_fp, "\n"); + } else { + fprintf(vpx_fp, "# VDB pal%d loaded %lu data bytes (first)\n", + g, vdb_data_count); + } + memcpy(prev[g], vdb_pal[g].ram, 768); + have_prev[g] = true; fflush(vpx_fp); } if (vdb_paldump && vdb_data_count >= 768) {