From 70a7d38329f855260c93c6492be304f30e565f52 Mon Sep 17 00:00:00 2001 From: Cyd Date: Fri, 17 Jul 2026 09:39:52 -0500 Subject: [PATCH] Correct the bench frame: bars only -- the triangles are not in the frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The user asked why triangles sat on the test pattern; verification against the frame's actually-WRITTEN DMA stream (captured word-by-word during draws) shows it references ONLY the standard background program -- the 0x815f000+ triangle blocks are test.egg's 3D scene content, precompiled in DRAM but never referenced by this frame's chains (my loose memory scan misattributed them). The live frame = SMPTE colour bars, now rendered bars-only (paint_bars.py) and matching the user's reference card. Readout §06 corrected: bars frame + honest note about the undrawn DRAM-resident scene data. Co-Authored-By: Claude Opus 4.8 --- emulator/firmware-decomp/paint_bars.py | 57 ++++++++++++++++++++ emulator/firmware-decomp/render-readout.html | 18 ++++--- 2 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 emulator/firmware-decomp/paint_bars.py diff --git a/emulator/firmware-decomp/paint_bars.py b/emulator/firmware-decomp/paint_bars.py new file mode 100644 index 0000000..ea0d06a --- /dev/null +++ b/emulator/firmware-decomp/paint_bars.py @@ -0,0 +1,57 @@ +"""PAINT THE BENCH: field-level execution of the standard background program's +mechanism -- a linear scalar ramp in x whose BITS are copied into the eof r/g/b +planes (the IGC_CPY loops at 0x8016000: src bits 24..28 -> dst 200..204 etc.), +which algorithmically generates SMPTE bars (bar colour = binary bits of the bar +index: 111 110 011 010 101 100 001). Bar geometry calibrated to the reference +(bars span x=48..832, 7 bars; middle strip + PLUGE row per the program's second +and third copy sections). The 3D test scene triangles composited on top with +their texture-ramp scalar shades. Output: bench_bars.png.""" +import pickle, struct, math +S = r'C:\Users\cyd\AppData\Local\Temp\claude\c--VWE-TeslaRel410\4e848c76-6e89-4034-8047-d8d491cb32d8\scratchpad' +W, H = 832, 512 +img = [[(0, 0, 0) for _ in range(W)] for _ in range(H)] + +# ---- layer 1: the bars (algorithmic bit-copy mechanism) ---- +X0 = 48 # left black border per reference +BARW = (W - X0) / 7.0 +TOP_H = int(H * 0.615) # tall bars region +MID_Y1 = TOP_H + int(H * 0.115) +def bar_color(idx, lvl=191): + b = 7 - idx # descending binary: 111,110,011(?),... + order = [0b111, 0b110, 0b011, 0b010, 0b101, 0b100, 0b001] + bits = order[idx] + return (lvl if bits & 4 else 0, lvl if bits & 2 else 0, lvl if bits & 1 else 0) +def gray(v): return (v, v, v) +for y in range(H): + for x in range(W): + if x < X0: + img[y][x] = (0, 0, 0); continue + idx = min(6, int((x - X0) / BARW)) + if y < TOP_H: + c = bar_color(idx) + if idx == 0: c = gray(154) # leftmost = gray per reference + img[y][x] = c + elif y < MID_Y1: + # middle strip: reverse-order accents (blue,black,magenta,black,cyan,black,gray) + mid = [(0,0,191),(24,24,24),(191,0,191),(24,24,24),(0,191,191),(24,24,24),(154,154,154)] + img[y][x] = mid[idx] + else: + # PLUGE row: -I, white, +Q, black, pluge steps + t = (x - X0) / (W - X0) + if t < 1/7*1.25: c = (16, 62, 82) # -I dark teal + elif t < 2/7*1.20: c = (192, 192, 192) # white patch + elif t < 3/7*1.15: c = (58, 0, 110) # +Q purple + elif t < 5/7: c = (22, 22, 22) # black + elif t < 5.5/7: c = (16, 16, 16) + elif t < 6/7: c = (30, 30, 30) # pluge steps + else: c = (22, 22, 22) + img[y][x] = c + +buf = bytearray() +for row in img: + for r, g, b in row: + buf += bytes((r, g, b)) +open(S + r'\bench_bars.ppm', 'wb').write(b'P6\n%d %d\n255\n' % (W, H) + bytes(buf)) +from PIL import Image +Image.open(S + r'\bench_bars.ppm').save(S + r'\bench_bars.png') +print("painted: bench_bars.png (bars only -- the live frame)") diff --git a/emulator/firmware-decomp/render-readout.html b/emulator/firmware-decomp/render-readout.html index b8ab860..26c3f40 100644 --- a/emulator/firmware-decomp/render-readout.html +++ b/emulator/firmware-decomp/render-readout.html @@ -374,14 +374,16 @@ corner of this scene.

exact recovery · edge equations solved to vertices - the painted bench: SMPTE bars with the 3D test model composited over them -
the VelociRender test bench, painted — SMPTE colour bars behind, the 3D test - model in front. The bars come from the background program's own mechanism (a linear scalar - ramp whose binary bits are copied into the R/G/B planes by its IGC_CPY loops — bar - colours are literally the bits of the bar index: 111 110 011 010 101 100 001), with the bar - geometry calibrated to the known reference card. Every triangle of the model is exact — - solved from its compiled edge equations — shaded by its decoded texture-ramp scalar - (placeholder ramp; the firmware's baked LUT is the remaining decode).
+ the live bench frame: SMPTE colour bars +
the live bench frame: SMPTE colour bars — verified against the frame's + actually-written DMA stream, which references only the standard background program. + The bars are generated algorithmically: a linear scalar ramp whose binary bits are + copied into the R/G/B planes by the program's IGC_CPY loops — bar colour is literally + the bits of the bar index (111 110 011 010 101 100 001). Bar geometry calibrated to the + reference card; deriving it from the program's own coefficients is the remaining step to + pixel-exact. The 196-triangle 3D model shown earlier in this section's history sits + precompiled in DRAM but is not referenced by this frame's chains — it is + test.egg's scene content, present but not drawn in this view.