-- gate.lua -- does the bit-0x3F2042D0 IP3 gate skip level 1? -- Probes the branch around the level-1 call site and the OS cold-start. local machine = manager.machine local cpu = machine.devices[':maincpu'] local dbg = machine.debugger if not dbg then print("ERROR: no debugger"); machine:exit(); return end local function bp(addr, body) dbg:command('bpset ' .. addr .. ',,{ ' .. body .. ' ; g }') end bp("3f2042d0", 'printf "IP-READ a0(@64000d0)=%08X\\n", a0') bp("3f204300", 'printf "BTST3 a0=%08X bit3=%d\\n", a0, (a0>>3)&1') bp("3f204360", 'printf "AT-360 a3=%08X\\n", a3') bp("3f2043b0", 'printf "SKIP-BRANCH-TAKEN\\n"') bp("3f204400", 'printf "RUN-LEVEL1 arg(a3)=%08X\\n", a3') bp("3f5788c0", 'printf "OS-START-REACHED\\n"') bp("3f2031d0", 'printf "HANDSHAKE-POLL @6200010=%08X\\n", d@6200010') bp("3fdf7da0", 'printf "L1-RUNNER arg0 path\\n"') bp("3fdf7e30", 'printf "L1-RUNNER arg0 fallthrough\\n"') bp("3fdf7fb0", 'printf "L1-RUNNER test-loop\\n"') bp("3fdf9d70", 'printf "HOSTPORT-HANDLER\\n"') local n = 0 local maxf = tonumber(os.getenv("GATE_FRAMES") or "1500") emu.register_frame_done(function() n = n + 1 if n % 300 == 0 then print(string.format("frame %5d PC=%08X", n, cpu.state['PC'].value)) end if n >= maxf then print("done "..n); machine:exit() end end, "vt1200-gate") dbg.visible_cpu = cpu dbg.execution_state = 'run'