Callbacks

addEventCallback

Syntax

emu.addEventCallback(function, type)

Parameters
function - A Lua function.
type - Enum See eventType.

Return value
Returns an integer value that can be used to remove the callback by calling removeEventCallback.

Description
Registers a callback function to be called whenever the specified event occurs.
The callback function receives no parameters.

removeEventCallback

Syntax

emu.removeEventCallback(reference, type)

Parameters
reference - The value returned by the call to addEventCallback.
type - Enum See eventType.

Return value
None

Description
Removes a previously registered callback function.

addMemoryCallback

Syntax

emu.addMemoryCallback(function, type, startAddress [, endAddress, cpuType])

Parameters
function - A Lua function.
type - Enum See memCallbackType
startAddress - Integer Start of the CPU memory address range to register the callback on.
endAddress - (optional) Integer End of the CPU memory address range to register the callback on.
cpuType - (optional) Enum See cpuType

Return value
Returns an integer value that can be used to remove the callback by calling removeMemoryCallback.

Description
Registers a callback function to be called whenever the specified memory address is read/written/executed (based on type) by the specific CPU (cpuType - When no CPU type is specified, this defaults to emu.cpuType.cpu).
The callback function receives 2 parameters address and value that correspond to the address being written to or read from, and the value that is being read/written.

For reads, the callback is called after the read is performed.
For writes, the callback is called before the write is performed.

removeMemoryCallback

Syntax

emu.removeMemoryCallback(reference, type, startAddress [, endAddress, cpuType])

Parameters
reference - The value returned by the call to addMemoryCallback.
type - Enum See memCallbackType.
startAddress - Integer Start of the CPU memory address range to unregister the callback from.
endAddress - (optional) Integer End of the CPU memory address range to unregister the callback from.
cpuType - (optional) Enum See cpuType

Return value
None

Description
Removes a previously registered callback function.