Class Monitor
This executes commands that are given to it. Somme commands are:
- t = trace one instruction (also enter)
- j : jump over next instruction (don't execute it).
- g [number_of_Instructions] : execute the program, optionally for [number_of_Instructions]
- b [address_of_breakpoint] show (no parameter) or set/unset (one parameter) a breakpoint.
- d [address] : display memory, if no parameter is given start at current PC address
- di [address] : disassemble instructions, if no parameter is given start at current PC address.
Many of the methods of this object are just go-between between the Monitor
object and other objects, such as the MC68000Cpu
object.
This means that some methods are called from the emulation thread, whereas others are called from the Swing Event Dispatch thread.
The monitor outputs to two windows (instruction and data windows) and has an input wdw, see the MonitorPanel object.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMonitor
(boolean watchBreakpoints, inifile.IniFile inifile, int nbrLogs, boolean logAtStartup) Creates the object -
Method Summary
Modifier and TypeMethodDescriptionvoid
emulationThreadStopped
(String message) This is called from the EmulationThread when it is done.void
executeMonitorCommand
(String command) Executes a command.Gets the list of breakpoints.getCPU()
Gets the CPU this object is monitoring.Get the name of the logfile.Gets the TrapDispatcher.void
Handles the "go" command : execute all instructions until either breakpoint reached or the optional nbr of instructions is reached.void
inputKey
(int key) Input a key typed into the Java - SMSQE linkage block area.void
inputMouse
(int msmvtx, int msmvty, int msx, int msy) Inputs the mouse position into the SMSQE linkage area.void
inputMouseButton
(int btn) Gets the mouse button pressed into the emulation.void
inputMouseWheel
(int wheel) Gets the mouse wheel movement into the emulation.void
Unsets all keyrows.void
removeKeyrow
(int row, int col) Removes a keyrow bit for the indicated row and col.void
reset()
Resets the emulator : restarts it entirely.void
Resumes execution of the EmulationThread.void
setCapsLockStatus
(boolean isSet) Set the Caps lock directly in the sysvars (!).void
Go into fast or slow modevoid
setGuiAndCpu
(MonitorGui gui, TrapDispatcher trapDispatcher) Sets the gui for this monitor.void
setKeyrow
(int row, int col) Sets a keyrow bit for the indicated row and col.void
setLoggers
(JTextArea reglogger, JTextArea datalogger) Sets the log windows.void
setScreenUpdateInterval
(int tim) Sets the interval between screen updates.void
Shows the content of all regs and the next instruction.void
Starts the emulation.void
Suspends execution of the EmulationThread.
-
Constructor Details
-
Monitor
public Monitor(boolean watchBreakpoints, inifile.IniFile inifile, int nbrLogs, boolean logAtStartup) Creates the object- Parameters:
watchBreakpoints
- flag whether we observe breakpoints (true
= yes).inifile
- the ".ini" file with initial and current values.nbrLogs
- whether we log the instructions traced (will make everything very slow), and how many. =0 = don't log
-
-
Method Details
-
setGuiAndCpu
Sets the gui for this monitor.- Parameters:
gui
-trapDispatcher
-
-
executeMonitorCommand
Executes a command.See the help for what commands are recognized by the monitor.
- Parameters:
command
- a command line : command [options]:Commands are single or double letters, possibly followed by options.
Some commands are (there are more,see the help method):
- h - Help: show help.
- g - Go (start monitoring) <start_address (default current PC)> <number_of_instructions to go (default unlimited)>.
- gb- Go to a provisional breakpoint. One parameter: the breakpoint.
- r - Registers : show content of registers.
- a - check whether the go thread is still running.
- di- Disassemble instructions <start_address (default current PC)> <number_of_instructions (default : 8)>.
- j - Jump over current instruction (do not execute, advance PC).
- b - Breakpoint. No parameters = sh;ow breakpoints , parameter= set breakpoint at that addresss, or unset it if it already is set at that address.
- t - Trace (execute) one instruction at the current PC.
- d - display memory content <start_address (default current PC)> <number_of_bytes (default : 16)>.
- k - kill current Go thread if it exists.
- s - set a register to a value: s <reg> <value> or s <reg> <value>.
- bc - clear all breakpoints.
- qr- quickly execute the following instruction and set a breakpoint to the one after that. Useful for JSR/BSR/Trap.
Options are separated from the command and each other by single spaces.
Numbers can be given in decimal or hex format. The default is hex, decimals must be prefixed by "&".
An address can also be given by register number enclosed in parenthesis, eg (a7) or (d0) and also (pc).
The address will then be that of the content of the register, so, if a7= $100, 'di (a7)' will disassemble instructions as of address $100.
An address can also be calculated with + or - , e.g. *-10 or (a0)+$100.
- See Also:
-
goCommand
Handles the "go" command : execute all instructions until either breakpoint reached or the optional nbr of instructions is reached.The MonitorEmulationThread handles actual instuction execution, and can thus be stopped with the "k" commmand.
- Parameters:
options
- Options[1] optionally contains the number of instructions to execute.provbkp
- a provisional break for the "GB" command.
-
setLoggers
Sets the log windows.- Parameters:
reglogger
- where to show the register contents.datalogger
- where to show data, e.g. memory content.
-
getBreakpoints
Gets the list of breakpoints.- Returns:
- the list of breakpoints may be empty but will not be null.
-
getLogfilename
Get the name of the logfile.- Returns:
- the name of the logfile.
-
showInfo
Shows the content of all regs and the next instruction.- Parameters:
clearArea
- should the text area be cleared before info is shown?textArea
- where to show the info.
-
startEmulation
public void startEmulation()Starts the emulation. -
reset
public void reset()Resets the emulator : restarts it entirely. -
emulationThreadStopped
This is called from the EmulationThread when it is done.- Parameters:
message
- a String to print out.
-
suspendExecution
public void suspendExecution()Suspends execution of the EmulationThread. This is called from the Event Dispatch Thread, via the MonitorGui object when the window is minimized. Note the use ofThread.suspend
which is discouraged. However, adding a check for a "suspend yourself" flag within the emulationThread, which is the recommended method, would slow the emulation down. Here there is no danger of the emulationThread and the event dispatch thread blocking each other. -
resumeExecution
public void resumeExecution()Resumes execution of the EmulationThread. This is called from the Event Dispatch Thread, via the MonitorGui object when the window is minimized. Note the use ofThread.resume
which is discouraged. However, adding a check for a "suspend yourself" flag within the emulationThread, which is the recommended method, would slow the emulation down. Here there is no danger of the emulationThread and the event dispatch thread blocking each other. -
setFastMode
public void setFastMode()Go into fast or slow mode -
setScreenUpdateInterval
public void setScreenUpdateInterval(int tim) Sets the interval between screen updates.- Parameters:
tim
- the interval between screen updates in milliseconds
-
setCapsLockStatus
public void setCapsLockStatus(boolean isSet) Set the Caps lock directly in the sysvars (!).- Parameters:
isSet
- =true
if caps lock status is to be set.
-
inputKey
public void inputKey(int key) Input a key typed into the Java - SMSQE linkage block area.This should then be picked up by the SMSQE keyboard read routine.
- Parameters:
key
- the "key" that was typed.
-
inputMouse
public void inputMouse(int msmvtx, int msmvty, int msx, int msy) Inputs the mouse position into the SMSQE linkage area. *** This is called from the swing EDT via the MonitorGui object ***.- Parameters:
msmvtx
- x movement of the mouse (how much did mouse move).msmvty
- y movement of the mouse.msx
- mouse x pos.msy
- mouse y pos.
-
inputMouseButton
public void inputMouseButton(int btn) Gets the mouse button pressed into the emulation. *** This is called from the swing EDT via the MonitorGui object ***.- Parameters:
btn
- the button (1 = left, 2=right, 4 = middle button
-
inputMouseWheel
public void inputMouseWheel(int wheel) Gets the mouse wheel movement into the emulation. *** This is called from the swing EDT via the MonitorGui object ***.- Parameters:
wheel
- the wheel rotation and char.
-
setKeyrow
public void setKeyrow(int row, int col) Sets a keyrow bit for the indicated row and col. *** This is called from the swing EDT via the MonitorGui/Screen object ***- Parameters:
row
- row number.col
- column number.
-
removeKeyrow
public void removeKeyrow(int row, int col) Removes a keyrow bit for the indicated row and col. *** This is called from the swing EDT via the MonitorGui/Screen object ***- Parameters:
row
- row number.col
- column number.
-
removeAllKeyrows
public void removeAllKeyrows()Unsets all keyrows. This is used when the window is minimized (iconified). -
getCPU
Gets the CPU this object is monitoring.- Returns:
- the CPU this object is monitoring.
-
getTrapDispatcher
Gets the TrapDispatcher.- Returns:
- the TrapDispatcher.
-