-- fontprobe.lua -- live values for the TFTP font-read capacity check. -- -- Breaks inside the firmware's tftp_read (0x3f5ed230) at the point where the -- per-datagram payload (a9) is compared with the buffer capacity (a11), and at -- the error path. Prints the frame, PC, a9 (payload), a11 (capacity) and the -- accumulated total (dword at a13+8) so the "disk full" verdict can be read -- directly rather than inferred. -- -- FP_FRAMES= budget (default 20000) -- vt1200 ... -debug -debugger none -debuglog \ -- -autoboot_script harness/mame/fontprobe.lua -autoboot_delay 0 local machine = manager.machine local dbg = machine.debugger local cpu = machine.devices[':maincpu'] if not dbg then print("ERROR: debugger not enabled; pass -debug") machine:exit() return end FRAME = 0 -- tftp_read entry: dump the three arguments from the callee frame (a13-12/-8/-4) dbg:command('bpset 3f5ed290,,{ printf "TFTP-ARGS fr=%d arg1(len)=%08X arg2(buf)=%08X arg3(sock)=%08X\\n", FRAME, d@(a13-12), d@(a13-8), d@(a13-4) ; g }') -- capacity check, just after `cmp a11,a9` (a9 = payload, a11 = capacity) dbg:command('bpset 3f5eed50,,{ printf "CHK fr=%d pc=%08X payload(a9)=%08X capacity(a11)=%08X a13=%08X [%08X %08X %08X | %08X %08X %08X]\\n", FRAME, PC, a9, a11, a13, d@(a13-12), d@(a13-8), d@(a13-4), d@(a13), d@(a13+4), d@(a13+8) ; g }') -- error path just before the message is formatted (a9 = payload first arg, a11 = capacity second) dbg:command('bpset 3f5eeda0,,{ printf "BUFSIZE-ERR fr=%d a9=%08X a11=%08X\\n", FRAME, a9, a11 ; g }') -- ERROR code 3 being sent dbg:command('bpset 3f5eee50,,{ printf "SEND-ERROR-3 fr=%d\\n", FRAME ; g }') -- tftp_read entry, count calls dbg:command('bpset 3f5ed230,,{ printf "TFTP-READ-ENTRY fr=%d a14=%08X\\n", FRAME, a14 ; g }') -- received an ERROR packet from the peer dbg:command('bpset 3f5edb30,,{ printf "GOT-ERROR-PKT fr=%d\\n", FRAME ; g }') local maxframes = tonumber(os.getenv("FP_FRAMES") or "20000") emu.register_frame_done(function() FRAME = FRAME + 1 if FRAME % 2000 == 0 then print(string.format("frame %d PC=%08X", FRAME, cpu.state['PC'].value)) end if FRAME >= maxframes then print("done (" .. FRAME .. " frames)") machine:exit() end end, "vt1200-fp") dbg.visible_cpu = cpu dbg.execution_state = 'run'