Package smsqmulator
Class MonitoredEmulationThread
java.lang.Object
java.lang.Thread
smsqmulator.MonitoredEmulationThread
- All Implemented Interfaces:
Runnable
,EmulationThread
The independent thread that actually handles the emulation on a "g","gb" or "x" command.
The MonitorGoThread may observe breakpoints. When a breakpoint is hit, execution of the 68K program stops.
The MonitorGoThread may log instructions. Logging is done to an internal data structure called a DebugList. Instructions executed are logged there but are only written to the log file when execution of the program stops. The DebugList is a fifo queue and only keeps a certain number of instructions (set up when this object is created).
This thread may also watch a memory location and stop excution when the content of that memory location changes (long word only).
This thread may also stop at a certain condition (eg register==value).
In "gofast
" mode, no memory is watched, no breakpoints are checked etc - the program just executes as fast as it can.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionMonitoredEmulationThread
(int nbrOfInstructions, Monitor monitor, boolean watchBreakpoints, int upperLogLimit, boolean checkmem, int memWatched, int provbreak, boolean excludeSuper, Screen screen, boolean loginstrs, int nbrLogs) Creates the monitor go thread. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This is called when the emulation stops.void
void
run()
Does the actual work : execute cpu instructions in a loop.void
setckmem
(boolean b) Sets whether memory check should be switched on or off.void
setCondition
(int dataReg, int addrReg, int condValue, boolean isContent, int address) Sets the condition for a "g" commandvoid
setmemWatched
(int a) Sets the memory to be watched.void
setScreenUpdateInterval
(int tim) Sets the interval between screen updates.void
setUpperLimit
(int address) Sets the upper limit of memory when logging.void
signalDeath
(boolean b) Sets whether the death of the thread should be logged in the MonitorGui log wdw.void
switchLogging
(boolean newLogState) Switches logging state on/off.void
switchSuper
(boolean superState) Do we log calls to the OS or only user state code?Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smsqmulator.EmulationThread
resume, start, stop, suspend
-
Constructor Details
-
MonitoredEmulationThread
public MonitoredEmulationThread(int nbrOfInstructions, Monitor monitor, boolean watchBreakpoints, int upperLogLimit, boolean checkmem, int memWatched, int provbreak, boolean excludeSuper, Screen screen, boolean loginstrs, int nbrLogs) Creates the monitor go thread.- Parameters:
nbrOfInstructions
- how many instructions are to be executed, or 0 if continuous execution.monitor
- the motor launching this goThread.watchBreakpoints
-true
if breakpoints should be observed.upperLogLimit
- when logging instructions, instructions beyond this limit will NOT be logged (useful to exclude OS code in high mem).checkmem
- set totrue
if memory is to be watched.memWatched
- what memory address is to be watched.provbreak
- provisional breakpoint used with traceover.excludeSuper
- iftrue
: when logging, exclude all instructions executed in supervisor mode.screen
- the screen currently used to display the emulation.loginstrs
- is true if instructions need to be logged.nbrLogs
- how many instructions should be logged
-
-
Method Details
-
run
public void run()Does the actual work : execute cpu instructions in a loop. -
done
This is called when the emulation stops.- Parameters:
message
- the message to display.
-
endEmulation
public void endEmulation()- Specified by:
endEmulation
in interfaceEmulationThread
-
switchLogging
public void switchLogging(boolean newLogState) Switches logging state on/off.- Specified by:
switchLogging
in interfaceEmulationThread
- Parameters:
newLogState
- if true, logging is switched on again
-
switchSuper
public void switchSuper(boolean superState) Do we log calls to the OS or only user state code?- Parameters:
superState
- if true, only log calls in user mode.
-
setCondition
public void setCondition(int dataReg, int addrReg, int condValue, boolean isContent, int address) Sets the condition for a "g" command- Specified by:
setCondition
in interfaceEmulationThread
- Parameters:
dataReg
- the datareg this condition applies to, or -1 if condition is for address reg.addrReg
- the addrreg this condition applies to, or -1 if condition is for data reg.condValue
- the value to be met.isContent
- possible content at...address
- ...this address
-
signalDeath
public void signalDeath(boolean b) Sets whether the death of the thread should be logged in the MonitorGui log wdw.- Parameters:
b
-true
if death should be logged.
-
setckmem
public void setckmem(boolean b) Sets whether memory check should be switched on or off.- Specified by:
setckmem
in interfaceEmulationThread
- Parameters:
b
- true if memory check is the switched on.
-
setmemWatched
public void setmemWatched(int a) Sets the memory to be watched.- Specified by:
setmemWatched
in interfaceEmulationThread
- Parameters:
a
- the mmemory to be watched : if content of memory location is changed the emulation breaks (in monitor mode).
-
setUpperLimit
public void setUpperLimit(int address) Sets the upper limit of memory when logging.- Specified by:
setUpperLimit
in interfaceEmulationThread
- Parameters:
address
- the upper limit of memory when logging any instruction executed above this will not be logged.
-
setScreenUpdateInterval
public void setScreenUpdateInterval(int tim) Sets the interval between screen updates.- Specified by:
setScreenUpdateInterval
in interfaceEmulationThread
- Parameters:
tim
- the interval between screen updates in milliseconds.
-