forked from arti/vt1200
checkpoint: VT1200 reverse-engineering workspace before board-model work
This commit is contained in:
commit
acb92d3e44
325 files changed
+951894
No files matched your search
@@ -0,0 +1,52 @@
|
||||
-- When the CPU is parked in the POST delay loop, dump the stack so we can see
|
||||
-- the caller chain -- i.e. who passes the absurd delay count, and where the
|
||||
-- count comes from.
|
||||
--
|
||||
-- <mame> vt1200 -rompath harness/mame/roms -video none -sound none -nothrottle \
|
||||
-- -debug -debugger none -autoboot_script harness/mame/stackwalk.lua -autoboot_delay 0
|
||||
--
|
||||
-- TMS34010 note: SP is a *bit* address, and a 32-bit word occupies 32 bit
|
||||
-- addresses, so consecutive stack words are +/- 32.
|
||||
|
||||
local function hex(v) return string.format("%08X", v) end
|
||||
|
||||
local machine = manager.machine
|
||||
local cpu = machine.devices[':maincpu']
|
||||
local dbg = machine.debugger
|
||||
local prog = cpu.spaces['program']
|
||||
local pc = cpu.state['PC']
|
||||
local sp = cpu.state['SP']
|
||||
|
||||
if not prog or not prog.read_u32 then
|
||||
print("ERROR: program space has no read_u32")
|
||||
end
|
||||
|
||||
local TARGET = tonumber(os.getenv("WALK_PC") or "0x3FDCE400")
|
||||
local SKIP = tonumber(os.getenv("WALK_SKIP") or "40")
|
||||
local frames = 0
|
||||
local done = false
|
||||
|
||||
emu.register_frame_done(function()
|
||||
frames = frames + 1
|
||||
if done then return end
|
||||
if pc.value == TARGET and frames > SKIP then
|
||||
done = true
|
||||
local s = sp.value
|
||||
print(string.format("=== parked at %s SP=%s frame=%d ===", hex(TARGET), hex(s), frames))
|
||||
for i = -4, 28 do
|
||||
local a = (s + i * 32) & 0xFFFFFFFF
|
||||
local v = prog:read_u32(a)
|
||||
local tag = ""
|
||||
if v >= 0x3F200000 and v < 0x40000000 then
|
||||
tag = string.format(" <- ROM bit addr -> file 0x%06X", (v - 0x3F200000) / 8)
|
||||
elseif v < 0x00200000 then
|
||||
tag = " <- low RAM bit addr"
|
||||
end
|
||||
print(string.format(" [%+3d] @%s = %s%s", i, hex(a), hex(v), tag))
|
||||
end
|
||||
machine:exit()
|
||||
end
|
||||
end, "vt1200-stackwalk")
|
||||
|
||||
dbg.visible_cpu = cpu
|
||||
dbg.execution_state = 'run'
|
||||
Reference in new issue
Block a user