Decode plane constants: fixed-point screen coordinates
edge_decode.py: the edge payloads' non-float words carry the plane constant/ vertex terms as .8 fixed-point screen coordinates (0x0000ec00 = 60416 = 236.0, a screen-x in the object's range), not IEEE floats -- which is why they weren't in the float list. Locates the last missing piece for edge reconstruction: A/B slope (float, verified 0.2%) + C (fixed-point coord). Readout §02 notes it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,25 @@ reconstruct the coefficient (or just take the recognisable float planes), apply
|
||||
value at the tile origin (still to be located in the stream). Then it is a plain
|
||||
`igc_array.py` z-plane.
|
||||
|
||||
## Plane constants are fixed-point screen coordinates
|
||||
|
||||
The edge payloads' non-float words carry the plane's constant/vertex terms as
|
||||
**fixed-point screen coordinates** (`scratchpad/edge_decode.py`):
|
||||
|
||||
```
|
||||
SEND(4) edge @0x08015000: 00000100 3e013991(A=0.1262) 0000ec00 00000000
|
||||
^ 0xec00 = 60416 = 236.0 * 256
|
||||
SEND(0x21) @0x08015260: … 0000ec00 (=236.0) 0000b53a (=181.2) …
|
||||
```
|
||||
|
||||
`0x0000ec00 / 256 = 236.0` = a screen-x right in the object's x[126,255] range
|
||||
(first captured vertex was x≈237.5). So the constant term C is stored as a `.8`
|
||||
fixed-point coordinate (word/256), not an IEEE float — which is why it wasn't in
|
||||
the float list. SEND(0x29) is a long single-coefficient sweep (`-0.0626` repeated
|
||||
~30x across bit-planes = the coarse interpolant). This locates the last missing
|
||||
piece for edge reconstruction: A/B slope (float, verified 0.2%) + C (fixed-point
|
||||
coord). Remaining is pairing them per triangle + all-regions assembly.
|
||||
|
||||
## What this changes
|
||||
|
||||
The micro-code decode is now **extraction + bit-serial execution**, not blind
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
"""The edge payloads carry the plane's constant as FIXED-POINT screen coordinates,
|
||||
not floats (0x0000ec00 = 60416 = 236.0*256, a screen-x). Dump the edge SEND payloads
|
||||
reading each word as float AND as fixed-point (/256, /65536), and flag values that fall
|
||||
in the object's screen range x[126,255] y[0,93] — those are the C / vertex terms."""
|
||||
import sys, time, struct, pickle
|
||||
sys.path.insert(0, r'C:\VWE\TeslaRel410\emulator\firmware-decomp')
|
||||
import emu860, dis860, emu_main
|
||||
emu860.Mem.log = lambda self, *a, **k: None
|
||||
S = r'C:\Users\cyd\AppData\Local\Temp\claude\c--VWE-TeslaRel410\4e848c76-6e89-4034-8047-d8d491cb32d8\scratchpad'
|
||||
snap = pickle.load(open(S + r'\snapv2.pkl', 'rb'))
|
||||
r = emu_main.MainRunner(r'C:\VWE\TeslaRel410\dpl3-revive\patha\cap7.raw.bin', fw='capfw7', max_cmds=6000)
|
||||
cpu = r.cpu
|
||||
cpu.mem.pages = {k: bytearray(v) for k, v in snap['pages'].items()}
|
||||
cpu.ctrl.clear(); cpu.ctrl.update(snap['ctrl'])
|
||||
cpu.r = list(snap['r']); cpu.f = list(snap['f']); cpu.cr = dict(snap['cr']); cpu.pc = snap['pc']
|
||||
cpu._apipe = list(snap['apipe']); cpu._mpipe = list(snap['mpipe']); cpu._fp_pipes()
|
||||
cpu._lpipe = list(snap['lpipe']); cpu._gpipe = list(snap['gpipe'])
|
||||
cpu._kr, cpu._ki, cpu._t = snap['kr'], snap['ki'], snap['t']
|
||||
cpu.lcc = snap['lcc']; r.qi = snap['qi']; r.heap = list(snap['heap'])
|
||||
t0 = time.time(); startq = r.qi
|
||||
while time.time() - t0 < 60:
|
||||
if r.qi >= startq + 2: break
|
||||
h = r.hooks.get(cpu.pc)
|
||||
if h:
|
||||
if h(cpu) == 'done': break
|
||||
continue
|
||||
if not cpu.step(): break
|
||||
def rw(a): return cpu.mem.r32(a & 0xffffffff)
|
||||
def asf(w): return struct.unpack('<f', struct.pack('<I', w))[0]
|
||||
|
||||
def flags(w):
|
||||
out = []
|
||||
f = asf(w); e = (w >> 23) & 0xff
|
||||
if 1e-4 < abs(f) < 1e6 and 1 < e < 254:
|
||||
out.append("f=%.5g" % f)
|
||||
for div, tag in [(256.0, '/256'), (65536.0, '/65536')]:
|
||||
v = w / div
|
||||
if 0 < v < 900: # plausible screen coord
|
||||
out.append("%s=%.2f" % (tag, v))
|
||||
lo = w & 0xffff; hi = (w >> 16) & 0xffff
|
||||
for name, val in [('lo', lo), ('hi', hi)]:
|
||||
if 100 < val < 60000:
|
||||
vv = val / 256.0
|
||||
if 0 < vv < 600: out.append("%s/256=%.1f" % (name, vv))
|
||||
return " ".join(out)
|
||||
|
||||
for base, n, tag in [(0x08015000, 4, 'SEND(4) edge'), (0x08015260, 0x21, 'SEND(0x21)'),
|
||||
(0x08015380, 0x29, 'SEND(0x29)')]:
|
||||
print("\n===== %s @ %#010x =====" % (tag, base))
|
||||
for i in range(n):
|
||||
w = rw(base + i * 4)
|
||||
print(" +%03x %08x %s" % (i * 4, w, flags(w)))
|
||||
@@ -269,8 +269,9 @@
|
||||
bit-plane, exactly how a bit-serial adder holds a number. And the recovered values are the
|
||||
object's own geometry: a payload edge coefficient (<span class="mono">0.12527</span>) lands on
|
||||
the edge normal computed from the captured vertices (<span class="mono">0.12555</span>) to
|
||||
<b>0.2%</b>. The coefficients feeding the array simulator (§05) are
|
||||
<b>the ones the hardware actually shipped</b>.</p>
|
||||
<b>0.2%</b>. The plane <b>constants</b> sit alongside as fixed-point screen coordinates
|
||||
(<span class="mono">0x0000ec00 = 236.0</span>, a vertex x). The coefficients feeding the array
|
||||
simulator (§05) are <b>the ones the hardware actually shipped</b>.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
Reference in New Issue
Block a user