mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
42 lines
1.4 KiB
Lua
42 lines
1.4 KiB
Lua
-- probe_irq2.lua -- count periodic interrupt handler entries with printf bpsets.
|
|
-- Same investigation as probe_irq.lua, but the breakpoint action is a debugger
|
|
-- command string (the Lua bpset API takes debugger commands, not Lua closures).
|
|
local machine = manager.machine
|
|
local cpu = machine.devices[':maincpu']
|
|
local dbg = machine.debugger
|
|
local prog = cpu.spaces['program']
|
|
if not dbg then print("ERROR: no debugger"); machine:exit(); return end
|
|
|
|
local START = tonumber(os.getenv("IRQ_START") or "3200")
|
|
local STOP = tonumber(os.getenv("IRQ_STOP") or "3400")
|
|
|
|
local function bp(addr, tag)
|
|
dbg:command(string.format(
|
|
'bpset %s,,{ printf "IRQHIT %s pc=%%08X\\n", pc ; g }', addr, tag))
|
|
end
|
|
bp("3f7146d0", "DI")
|
|
bp("3f7144c0", "INT1")
|
|
bp("3f714530", "INT2")
|
|
-- The trampolines themselves, to tell "never entered" from "wrong handler".
|
|
bp("0db0", "TRAMP-DI")
|
|
bp("0f60", "TRAMP-INT1")
|
|
bp("0f30", "TRAMP-INT2")
|
|
|
|
local rd = function(a) return prog:read_u16(a) end
|
|
local f = 0
|
|
emu.register_frame_done(function()
|
|
f = f + 1
|
|
if f == START then print("probe_irq2: armed") end
|
|
if f % 25 == 0 and f >= START then
|
|
print(string.format("f%4d DPYCTL=%04X DPYINT=%04X INTENB=%04X INTPEND=%04X VCOUNT=%04X",
|
|
f, rd(0xc0000080), rd(0xc00000a0), rd(0xc0000110), rd(0xc0000120), rd(0xc00001d0)))
|
|
end
|
|
if f >= STOP then
|
|
print("probe_irq2: stopping")
|
|
machine:exit()
|
|
end
|
|
end, "vt1200-probe-irq2")
|
|
|
|
dbg.visible_cpu = cpu
|
|
dbg.execution_state = 'run'
|