Class AbstractCPUContext
java.lang.Object
net.emustudio.emulib.plugin.cpu.AbstractCPUContext
- All Implemented Interfaces:
Context, CPUContext
Abstract CPU context.
Implements passed cycles listeners management
-
Nested Class Summary
Nested classes/interfaces inherited from interface CPUContext
CPUContext.CPUListener, CPUContext.PassedCyclesListener -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs new abstract CPU context. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCPUListener(CPUContext.CPUListener listener) Registers execution notifications.voidaddPassedCyclesListener(CPUContext.PassedCyclesListener passedCyclesListener) Adds passed cycles listenerprotected final voidfireStateChanged(CPU.RunState next, int instructionLocation, float measuredFrequencyKhz) CPU implementations publish their own state; this is not part of the context interface.floatMeasured execution frequency in kHz, or NaN when unavailable.intCurrent instruction address, or -1 when unavailable.Current CPU run state.voidpassedCycles(long cycles) Notifies passed cycle listeners that given CPU cycles has passed since last call (a cycles delta).voidremoveCPUListener(CPUContext.CPUListener listener) Removes a listener when its view or plugin is disposed.voidremovePassedCyclesListener(CPUContext.PassedCyclesListener passedCyclesListener) Removes given passed cycles listenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CPUContext
getCPUFrequency, isInterruptSupported, isPassedCyclesSupported, signalInterrupt
-
Constructor Details
-
AbstractCPUContext
protected AbstractCPUContext()Constructs new abstract CPU context.
-
-
Method Details
-
getRunState
Description copied from interface:CPUContextCurrent CPU run state.- Specified by:
getRunStatein interfaceCPUContext
-
getInstructionLocation
public int getInstructionLocation()Description copied from interface:CPUContextCurrent instruction address, or -1 when unavailable.- Specified by:
getInstructionLocationin interfaceCPUContext
-
getCpuFrequencyKhz
public float getCpuFrequencyKhz()Description copied from interface:CPUContextMeasured execution frequency in kHz, or NaN when unavailable.- Specified by:
getCpuFrequencyKhzin interfaceCPUContext
-
addCPUListener
Description copied from interface:CPUContextRegisters execution notifications. Callbacks may run outside Swing.- Specified by:
addCPUListenerin interfaceCPUContext
-
removeCPUListener
Description copied from interface:CPUContextRemoves a listener when its view or plugin is disposed.- Specified by:
removeCPUListenerin interfaceCPUContext
-
addPassedCyclesListener
Description copied from interface:CPUContextAdds passed cycles listener- Specified by:
addPassedCyclesListenerin interfaceCPUContext- Parameters:
passedCyclesListener- passed cycles listener
-
removePassedCyclesListener
Description copied from interface:CPUContextRemoves given passed cycles listener- Specified by:
removePassedCyclesListenerin interfaceCPUContext- Parameters:
passedCyclesListener- passed cycles listener
-
passedCycles
public void passedCycles(long cycles) Notifies passed cycle listeners that given CPU cycles has passed since last call (a cycles delta).This method should be called by CPU.
- Parameters:
cycles- passed cycles delta
-
fireStateChanged
protected final void fireStateChanged(CPU.RunState next, int instructionLocation, float measuredFrequencyKhz) CPU implementations publish their own state; this is not part of the context interface.
-