Files
Dragon-s-Lair-X68k/tools/bench/sweep.lua
T
reala-misaki 65112b9305 Session 1: hardware research, content measurement, codec decision, MAME harness
Verified GVRAM is one word-access per pixel in ALL color modes; chose 256-color
256x192 with movem.l bursts (page 1 sacrificed as double-buffer).

Measured 8 scenes from the Blu-ray source: blit costs under 8% of the 12fps
cycle budget, so I/O is the bottleneck, not CPU. Naive delta+RLE reaches only
3.2:1 (365 KB/s, 470MB) -> decision to use 4x4 vector quantization (~30 KB/s).

"Shot on twos" assumption failed: the transfer has zero duplicate frames, so
12fps requires explicit decimation.

Documents three false measurement results and their root causes (per-frame
Floyd-Steinberg dithering, temporal denoise, exact-match dedupe on noisy source).

MAME Lua injection harness works and is reusable for cycle-cost measurement;
the IOCS _B_READ disk benchmark is blocked returning -1.

Claude-Session: https://claude.ai/code/session_01194oWYW8DQXK1SZ2DnChW6
2026-08-23 11:23:49 -07:00

33 lines
1.2 KiB
Lua

M=manager.machine; CPU=M.devices[":maincpu"]; SP=CPU.spaces["program"]
local f=io.open("sweep.bin","rb"); local d=f:read("a"); f:close()
CODE={}; for i=1,#d do CODE[i]=string.byte(d,i) end
STATE="wait"
local function T() local t=M.time return t.seconds+t.attoseconds/1e18 end
local function tick()
local t=T()
if STATE=="wait" then
if t<5.0 then return end
for i=1,#CODE do SP:write_u8(0x10000+i-1,CODE[i]) end
SP:write_u32(0x18000,0)
for i=0,31 do SP:write_u32(0x18100+i*4,0x5A5A5A5A) end
CPU.state["SR"].value=0x2000; CPU.state["SP"].value=0x8000; CPU.state["PC"].value=0x10000
STATE="run"; print("[SW] injected")
return
end
if STATE=="run" then
local fl=SP:read_u32(0x18000)
if fl==0xFF or t>25 then
STATE="done"
print("[SW] flag="..string.format("%X",fl))
for i=0,15 do
local a=SP:read_u32(0x18100+i*8)
local b=SP:read_u32(0x18100+i*8+4)
print(string.format("[SW] PDA=%02X encA(<<24)=%08X encB(<<8)=%08X",0x80+i,a,b))
end
M:exit()
end
end
end
SUB=emu.add_machine_frame_notifier(function()
local ok,err=pcall(tick); if not ok then print("[SW] ERR "..tostring(err)); M:exit() end end)