mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-31 12:05:05 +02:00
57 lines
2.2 KiB
Lua
57 lines
2.2 KiB
Lua
-- Interrupt diagnostic. The stuck loop sits inside the LEVEL0 display-interrupt
|
|
-- test, which waits for the TMS34010's display interrupt. MAME generates it when
|
|
-- VCOUNT == DPYINT and the display is enabled, provided INTENB has the DI bit.
|
|
--
|
|
-- Register map (MAME tms34010 enum, index*0x10 from 0xC0000000):
|
|
-- 0x00 HESYNC 0x10 HEBLNK 0x20 HSBLNK 0x30 HTOTAL
|
|
-- 0x40 VESYNC 0x50 VEBLNK 0x60 VSBLNK 0x70 VTOTAL
|
|
-- 0x80 DPYCTL 0x90 DPYSTRT 0xA0 DPYINT 0xB0 CONTROL
|
|
-- 0x110 INTENB 0x120 INTPEND 0x1B0 DPYTAP 0x1C0 HCOUNT 0x1D0 VCOUNT 0x1E0 DPYADR
|
|
--
|
|
-- INT_FRAMES=400 <mame> vt1200 ... -autoboot_script harness/mame/intr.lua
|
|
|
|
local machine = manager.machine
|
|
local cpu = machine.devices[':maincpu']
|
|
local dbg = machine.debugger
|
|
local prog = cpu.spaces['program']
|
|
|
|
local maxframes = tonumber(os.getenv("INT_FRAMES") or "400")
|
|
local every = tonumber(os.getenv("INT_EVERY") or "50")
|
|
local n = 0
|
|
local rd = function(a) return prog:read_u16(a) end
|
|
|
|
local seen = {}
|
|
local last_intenb, last_intpend = -1, -1
|
|
emu.register_frame_done(function()
|
|
n = n + 1
|
|
local intenb = rd(0xc0000110)
|
|
local intpend = rd(0xc0000120)
|
|
local dpyctl = rd(0xc0000080)
|
|
seen[intenb] = (seen[intenb] or 0) + 1
|
|
-- Report changes immediately; sampling every N frames can miss a transient.
|
|
if intenb ~= last_intenb then
|
|
print(string.format("f%4d INTENB CHANGED -> %04X (DI=%d)", n, intenb, (intenb & 0x0400) ~= 0 and 1 or 0))
|
|
last_intenb = intenb
|
|
end
|
|
if intpend ~= last_intpend then
|
|
print(string.format("f%4d INTPEND CHANGED -> %04X", n, intpend))
|
|
last_intpend = intpend
|
|
end
|
|
if n % every == 0 then
|
|
print(string.format(
|
|
"f%4d DPYCTL=%04X INTENB=%04X(DI=%d) INTPEND=%04X DI=%d DPYINT=%04X VCOUNT=%04X VTOTAL=%04X HTOTAL=%04X HSBLNK=%04X",
|
|
n, dpyctl, intenb, (intenb & 0x0400) ~= 0 and 1 or 0, intpend,
|
|
(intpend & 0x0400) ~= 0 and 1 or 0, rd(0xc00000a0), rd(0xc00001d0),
|
|
rd(0xc0000070), rd(0xc0000030), rd(0xc0000020)))
|
|
end
|
|
if n >= maxframes then
|
|
print("distinct INTENB values seen:")
|
|
for v, c in pairs(seen) do
|
|
print(string.format(" INTENB=%04X DI=%d (%d frames)", v, (v & 0x0400) ~= 0 and 1 or 0, c))
|
|
end
|
|
machine:exit()
|
|
end
|
|
end, "vt1200-intr")
|
|
|
|
dbg.execution_state = 'run'
|