mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
47 lines
1.5 KiB
Lua
47 lines
1.5 KiB
Lua
-- Capture the firmware's own console output.
|
|
--
|
|
-- The firmware prints through the routine at bit 0x3FDE00C0. Every call site
|
|
-- follows the same shape:
|
|
-- movi <message pointer>, a9
|
|
-- move a9, *a14+, 1
|
|
-- calla 0x3fde00c0
|
|
-- so at the ENTRY instruction a9 still holds the message pointer. Breaking
|
|
-- there and logging a9 gives us the firmware's console transcript -- which is
|
|
-- how we learn which self-test is failing without being able to see the screen.
|
|
--
|
|
-- CAP_OUT=<file> CAP_MAX=<n> <mame> vt1200 ... -autoboot_script harness/mame/cap.lua
|
|
|
|
local machine = manager.machine
|
|
local cpu = machine.devices[':maincpu']
|
|
local dbg = machine.debugger
|
|
|
|
if not dbg then
|
|
print("ERROR: debugger not enabled; pass -debug")
|
|
machine:exit()
|
|
return
|
|
end
|
|
|
|
local out = os.getenv("CAP_OUT") or "/home/arti/code/k-space/vt1200/harness/mame/console.txt"
|
|
local maxframes = tonumber(os.getenv("CAP_MAX") or "900")
|
|
|
|
-- Pointers are BIT addresses; the image is byte-based at 0x07E40000, so a
|
|
-- pointer P maps to file offset (P >> 3) - 0x07E40000.
|
|
local PROG_BASE_BIT = 0x3F200000
|
|
|
|
dbg:command('bpset 3fde00c0,,{ printf "PRINT pc=%08X a9=%08X a11=%08X a5=%08X\\n", pc, a9, a11, a5 ; g }')
|
|
print("printer breakpoint armed at 3fde00c0")
|
|
|
|
-- Also catch the error-report table entries, which are where a failing test
|
|
-- lands. Log the call target so we see which report fires.
|
|
local n = 0
|
|
emu.register_frame_done(function()
|
|
n = n + 1
|
|
if n >= maxframes then
|
|
print("done (" .. n .. " frames)")
|
|
machine:exit()
|
|
end
|
|
end, "vt1200-cap")
|
|
|
|
dbg.visible_cpu = cpu
|
|
dbg.execution_state = 'run'
|