Use memory callback during startup.

This commit is contained in:
Empathic Qubit 2021-11-24 21:12:45 +01:00
parent b378d8f519
commit 9f1cade7e4

View file

@ -269,12 +269,18 @@ function me.registerFrameCallback()
frameCallback = emu.addEventCallback(frameHandle, emu.eventType.inputPolled)
end
function me.deregisterFrameCallback()
function me.deregisterFrameCallback()
emu.removeEventCallback(frameCallback, emu.eventType.inputPolled)
end
local startupCallback = nil
local lastTime = -1
local function breakHandle()
if startupCallback ~= nil then
emu.removeMemoryCallback(startupCallback, emu.memCallbackType.cpuExec, 0x0000, 0xffff)
startupCallback = nil
end
local pc = emu.getState().cpu.pc
print(string.format("PC: %04x", pc))
@ -325,7 +331,7 @@ function me.start(host, port, waitForConnection)
emu.addEventCallback(breakHandle, emu.eventType.codeBreak)
breakHandle()
startupCallback = emu.addMemoryCallback(breakHandle, emu.memCallbackType.cpuExec, 0x0000, 0xffff)
end
return me