-- Feed the x68000's OWN okim6258 a known nibble stream and let MAME record what -- comes out, so that "which delta formula does the chip use" is a MEASUREMENT -- and not a reading of source code that is not on this machine (64.4). -- -- The feed is deliberately SLOW -- a byte every host frame, where real time -- wants ~138 -- because the question is not the rate. A starved chip holds its -- last sample, so the wave is a STAIRCASE of the reconstructed values, which is -- exactly the sequence the two candidate formulas disagree about. M = manager.machine local sp = M.devices[":maincpu"].spaces["program"] local CTRL, DATA = 0xE92001, 0xE92003 local CMD = tonumber(os.getenv("AD_CMD") or "1") -- 12 loud nibbles to climb the step index, then every nibble in turn: the pairs -- where the two formulas differ are all at step indices above the floor. local nibs = {} for i = 1, 12 do nibs[#nibs+1] = 7 end for i = 0, 15 do nibs[#nibs+1] = i end for i = 0, 15 do nibs[#nibs+1] = i end local bytes = {} for i = 1, #nibs, 2 do bytes[#bytes+1] = nibs[i] * 16 + nibs[i+1] end local n, started = 0, false SUB = emu.add_machine_frame_notifier(function() n = n + 1 if n == 30 then sp:write_u8(CTRL, CMD) started = true print(string.format("[AD] ctrl $%02X written to $%06X", CMD, CTRL)) elseif started and n > 30 and (n - 30) <= #bytes then sp:write_u8(DATA, bytes[n - 30]) elseif started and (n - 30) == #bytes + 20 then print("[AD] fed " .. #bytes .. " bytes = " .. #nibs .. " nibbles") print("[AD] done") M:exit() end end)