public class Monitor
extends java.lang.Object
This executes commands that are given to it. Somme commands are:
Many of the methods of this object are just go-betweens between the Monitor
object and other objects, such as the MC68000Cpu
object.
This means that some methods are called from the emulation thread, wheres others are called from the Swing Event Dispatch thread.
The monitor outo=puts to two windows (instruction and data windows) and has an input wdw, see the MonitorPanel object.
showHelp()
Modifier and Type | Field and Description |
---|---|
protected MC68000Cpu |
cpu |
static int |
TIME_OFFSET |
Constructor and Description |
---|
Monitor(MC68000Cpu cpu,
boolean watchBreakpoints,
boolean logInstructions,
SampledSound sam,
javax.swing.JTextArea regLogger,
javax.swing.JTextArea dataLogger,
boolean fastmode,
Warnings warnings,
int throt,
int tOffset,
MonitorGui gui,
int beepVolume,
SoundDevice snd,
inifile.IniFile inifile)
Creates the object
|
Modifier and Type | Method and Description |
---|---|
void |
changeMemSize(int size,
Screen screen,
boolean allowEmulation)
Change the memory size.
|
boolean |
checkThread()
Checks whether the goThread still exists.
|
void |
executeMonitorCommand(java.lang.String command)
Executes a command.
|
MC68000Cpu |
getCPU()
Gets the CPU this object is monitoring.
|
int |
getMemSize()
Gets the size of memory used by the cpu.
|
Screen |
getScreen()
Gets the screen used by the cpu.
|
TrapDispatcher |
getTrapDispatcher()
Gets the TrapDispatcher.
|
void |
goCommand(java.lang.String[] options,
int provbkp)
Handles the "go" command : execute all instructions until either breakpoint reached or the optional nbr of instructions is reached.
|
void |
goThreadStopped(java.lang.String message)
This is called from the goThread when the goThreead is done.
|
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.
*** This is called from the swing EDT***.
|
void |
inputMouseButton(int btn)
Gets the mouse button pressed into the emulation.
*** This is called from the swing EDT***.
|
boolean |
loadRom(java.io.File f)
Loads a rom image.
|
boolean |
loadRom(java.lang.String filename,
java.net.URL fileURL)
Loads a rom image by calling the appropriate routine of the CPU object.
|
void |
removeKeyrow(int row,
int col)
Removes a keyrow bit for the indicated row and col.
|
void |
reset()
Resets the emulator : restarts it, possibly with a new screen size.
|
void |
resumeExecution()
Resumes execution of the GoThread.
|
void |
setCapsLockStatus(boolean isSet)
NASTY NASTY NASTY way of setting the Caps lock status.
|
void |
setCopyScreen(int mode,
int origins)
A pass through method to the screen object, to copy from the original QL memory area to the screen.
|
void |
setFastMode(boolean fm)
Go into fast or slow mode
|
void |
setFilenameChange(int deviceDriver,
int change)
Sets whether the case of names of files should be changed.
|
void |
setFloppyNames(java.lang.String[] names)
Sets the names of the native files to be used for floppy images.
|
void |
setFocusToEmulScreen()
Sets the focus to the panel containing the screen of the emulated machine
|
void |
setFocusToInputWindow()
Sets the focus to the panel containing the screen of the emulated machine
|
void |
setInputWindow(javax.swing.JTextField p)
Sets the textfield containing my input field.
|
void |
setKeyrow(int row,
int col)
Sets a keyrow bit for the indicated row and col.
|
void |
setLoggers(javax.swing.JTextArea reglogger,
javax.swing.JTextArea datalogger)
Sets the log windows.
|
void |
setNamesForDrives(int deviceDriver,
java.lang.String[] names,
boolean forceRemoval)
Sets the names for the drives of a device, i.e. the directories the drives will point to.
*** This is called from the swing EDT***.
|
void |
setScreenCoordinates(int x,
int y)
Passes on the new absolute screen coordinates of the screen object (normally called at startup and after every window move operation).
|
void |
setScreenUpdateInterval(int tim)
Sets the interval between screen updates.
|
void |
setSoundVolume(int vol)
Sets the sound volume via the TrapDispatcher object.
|
void |
setThrottle(int throt)
Sets the "throttle" value in the TrapDispatcher object.
|
void |
setTimeOffset(int to)
Sets the time offet value.
|
void |
setUsageForDrive(int deviceDriver,
java.lang.String usage)
Sets the usage names for a device.
|
void |
showHardbreak()
Shows that a hard break (instruction $4b00) was encountered in the code.
|
void |
showInfo(boolean clearArea,
javax.swing.JTextArea textArea)
Shows the content of the regs and the next instruction.
|
void |
stopThrottle()
Stops the TrapDispatcher throttle for a short time.
|
void |
suspendExecution()
Suspends execution of the GoThread.
|
protected MC68000Cpu cpu
public static int TIME_OFFSET
public Monitor(MC68000Cpu cpu, boolean watchBreakpoints, boolean logInstructions, SampledSound sam, javax.swing.JTextArea regLogger, javax.swing.JTextArea dataLogger, boolean fastmode, Warnings warnings, int throt, int tOffset, MonitorGui gui, int beepVolume, SoundDevice snd, inifile.IniFile inifile)
cpu
- the cpu we're monitoring.watchBreakpoints
- flag whether we observe breakpoints (true
= yes).logInstructions
- whether we log the instructions traced (will make everything very slow).sam
- the sampled sound system object .regLogger
- where we display registers.dataLogger
- another display, for data.fastmode
- whether we're in fast mode (true
) or not.warnings
- object with warning flags.throt
- throttle value to be passed on to TrapDispatcher.tOffset
- time offset.gui
- the MonitorGui.beepVolume
- how loud is the beep.snd
- device for SSSS (Smsqe Sampled Sound System).inifile
- the ".ini" file with initial and current values.public void executeMonitorCommand(java.lang.String command)
See the help for what commands are recognized by the monitor.
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):
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.
showHelp()
public void goCommand(java.lang.String[] options, int provbkp)
The Go command is handled by a separate thread and can thus be stopped with the "k" commmand.
options
- Options[1] optionally contains the number of instructions to execute.provbkp
- a provisional break for the "GB" command.public void setLoggers(javax.swing.JTextArea reglogger, javax.swing.JTextArea datalogger)
reglogger
- where to show the register contents.datalogger
- where to show data, e.g. memory content.public void showInfo(boolean clearArea, javax.swing.JTextArea textArea)
clearArea
- should the text area be cleared before info is shown?textArea
- where to show the info.public void goThreadStopped(java.lang.String message)
message
- a String to print out.public boolean checkThread()
true
if GoThread no longer exists.public void showHardbreak()
public void suspendExecution()
Thread.suspend
which is discouraged. However, adding a check for a "suspend yourself" flag within the goThread,
which is the recommended method, would further slow the emulation down. Here there is no danger of the goThread and the
event dispatch thread blocking each other.public void resumeExecution()
Thread.resume
which is discouraged. However, adding a check for a "suspend yourself" flag within the goThread,
which is the recommended method, would further slow the emulation down. Here there is no danger of the goThread and the
event dispatch thread blocking each other.public void setScreenUpdateInterval(int tim)
tim
- the interval between screen updates in millisecondspublic void setFocusToEmulScreen()
public void setInputWindow(javax.swing.JTextField p)
p
- the textfield containing my input field.public void setFocusToInputWindow()
public void setCapsLockStatus(boolean isSet)
isSet
- = true
if caps lock status is to be set.public void inputKey(int key)
This should then be picked up by the SMSQE keyboard read routine. *** This is called from the swing EDT***.
key
- the "key" that was typed.public void inputMouse(int msmvtx, int msmvty, int msx, int msy)
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.public void inputMouseButton(int btn)
btn
- the button (1 = left,2=right, 4 = middle buttonpublic void setScreenCoordinates(int x, int y)
x
- the new absolute x screen coordinates of the screen object.y
- the new absolute y screen coordinates of the screen object.public void setNamesForDrives(int deviceDriver, java.lang.String[] names, boolean forceRemoval)
deviceDriver
- the deviceIDnames
- an 8 element String array with the names for 8 drives (from 0 to 7).forceRemoval
- force "unmount" of exiting drives and remount.public void setUsageForDrive(int deviceDriver, java.lang.String usage)
deviceDriver
- the deviceID.usage
- the usage name.public void setFilenameChange(int deviceDriver, int change)
deviceDriver
- the deviceID.change
- 0 = unchanged, 1=all upper case, 2=all lower case.public void setFloppyNames(java.lang.String[] names)
names
- 8 element String array with the names of the native files to be used for floppy images.public void setCopyScreen(int mode, int origins)
origins
- possible origin where to copy to, currently ignoredmode
- which mode the screen is supposed to be in 4 or 8. 0 switches it offpublic void reset()
public MC68000Cpu getCPU()
public Screen getScreen()
public int getMemSize()
public boolean loadRom(java.io.File f)
f
- the file to load it from.true
of loaded OK.public boolean loadRom(java.lang.String filename, java.net.URL fileURL)
filename
- the file to load it from.fileURL
- alternatively, the URL of the file to load it from.true
if loaded OK.public void setKeyrow(int row, int col)
row
- row number.col
- column number.public void removeKeyrow(int row, int col)
row
- row number.col
- column number.public void changeMemSize(int size, Screen screen, boolean allowEmulation)
size
- the memory size in bytes.screen
- the screen to be used or null if current one.allowEmulation
- = true if QL Screen emulation is switched on.public TrapDispatcher getTrapDispatcher()
public void setFastMode(boolean fm)
fm
- if true, goes into fast mode, else slow mode.public void setThrottle(int throt)
throt
- throttle value to set.public void setSoundVolume(int vol)
vol
- volume foom 0 (no sound) to 100 (loudest).public void stopThrottle()
public void setTimeOffset(int to)
to
- the time offset value.