Class AbstractCPU
java.lang.Object
net.emustudio.emulib.plugin.AbstractPlugin
net.emustudio.emulib.plugin.cpu.AbstractCPU
Publishes CPU context state for synchronous operations scheduled by the host.
-
Nested Class Summary
Nested classes/interfaces inherited from interface CPU
CPU.RunState -
Field Summary
Fields inherited from class AbstractPlugin
applicationApi, pluginID, settings -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCPU(long pluginID, ApplicationApi applicationApi, PluginSettings settings) Creates new instance of CPU. -
Method Summary
Modifier and TypeMethodDescriptionstatic CPU.RunStateclassifyExecutionFailure(Throwable failure) Classifies a thrown execution failure, including an address error wrapped by a CPU engine.protected abstract AbstractCPUContextReturns the same context instance the plugin registers for the host.final voiddestroy()Host calls only after actual execution exit.protected abstract voidfinal CPU.RunStateexecute()Runs the instruction loop synchronously until natural completion or cooperative interruption.protected abstract CPU.RunStatefinal voidreset()Reset plugin to its "initial state", as it was after callingPlugin.initialize().final voidreset(int location) Resets the CPU synchronously after the host has acknowledged actual execution exit.protected abstract voidresetInternal(int location) final booleansetInstructionLocation(int location) Set memory location of an instruction which will be emulated as next.protected abstract booleansetInstructionLocationInternal(int location) final CPU.RunStatestep()Executes one instruction synchronously on the host's CPU worker and returns its result.protected abstract CPU.RunStateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CPU
getAddressSpaceSize, getDebuggerColumns, getDecoder, getStatusPanel, isAutomationSupportedMethods inherited from interface Plugin
getCopyright, getDescription, getDocumentationUrl, getTitle, getVersion, initialize, isShowSettingsSupported, showSettings, startAutomation, stopAutomation
-
Constructor Details
-
AbstractCPU
Creates new instance of CPU.- Parameters:
pluginID- plugin IDapplicationApi- emuStudio APIsettings- plugin custom settings
-
-
Method Details
-
reset
public final void reset()Description copied from interface:PluginReset plugin to its "initial state", as it was after callingPlugin.initialize(). -
reset
-
setInstructionLocation
public final boolean setInstructionLocation(int location) Description copied from interface:CPUSet memory location of an instruction which will be emulated as next.Instruction position is more "abstract" name for "program counter", which is mostly used in 8-bit architectures.
This method is called by emuStudio application when a user perform "jump to address" operation.
- Specified by:
setInstructionLocationin interfaceCPU- Parameters:
location- new address of actual instruction- Returns:
- true if operation was successful, false otherwise
-
execute
Description copied from interface:CPURuns the instruction loop synchronously until natural completion or cooperative interruption. The host supplies the worker thread, serializes CPU mutations, and publishes lifecycle events. Return STATE_RUNNING when interrupted without another terminal reason; the host applies the requested pause/stop state. Natural halt, breakpoint, and failures must retain their actual result. -
step
-
classifyExecutionFailure
Classifies a thrown execution failure, including an address error wrapped by a CPU engine. -
cpuContext
Returns the same context instance the plugin registers for the host. -
executeInternal
- Throws:
Exception
-
stepInternal
- Throws:
Exception
-
resetInternal
protected abstract void resetInternal(int location) -
setInstructionLocationInternal
protected abstract boolean setInstructionLocationInternal(int location) -
destroy
-
destroyInternal
protected abstract void destroyInternal()
-