By default, do not halt on BRK (#14)
This change introduces a new command line flag, '-b', that cause the simulator to halt on the `BRK` instruction. By default, however, the simulator will no longer halt on `BRK`. As before, this behavior can be toggled in the preferences at run-time.
This commit is contained in:
1 parent
5e56627f32
commit
0c026e38dd
5 files changed
+18
-10
No files matched your search
@@ -126,6 +126,8 @@ public class Simulator {
|
||||
|
||||
private MainCommand command = MainCommand.NONE;
|
||||
|
||||
private boolean haltOnBreak;
|
||||
|
||||
public enum MainCommand {
|
||||
NONE,
|
||||
SELECTMACHINE
|
||||
@@ -137,16 +139,17 @@ public class Simulator {
|
||||
private static final String[] STEPS = {"1", "5", "10", "20", "50", "100"};
|
||||
|
||||
public Simulator(Class machineClass) throws Exception {
|
||||
this(machineClass, InstructionTable.CpuBehavior.NMOS_6502, null);
|
||||
this(machineClass, InstructionTable.CpuBehavior.NMOS_6502, null, false);
|
||||
}
|
||||
|
||||
public Simulator(Class machineClass, InstructionTable.CpuBehavior cpuType, String romFile) throws Exception {
|
||||
public Simulator(Class machineClass, InstructionTable.CpuBehavior cpuType,
|
||||
String romFile, boolean haltOnBreak) throws Exception {
|
||||
this.haltOnBreak = haltOnBreak;
|
||||
this.breakpoints = new Breakpoints(this);
|
||||
|
||||
this.machine = (Machine) machineClass.getConstructors()[0].newInstance(romFile);
|
||||
this.machine.getCpu().setBehavior(cpuType);
|
||||
|
||||
|
||||
// Initialize final fields in the constructor.
|
||||
this.traceLog = new TraceLog();
|
||||
this.memoryWindow = new MemoryWindow(machine.getBus());
|
||||
@@ -176,7 +179,7 @@ public class Simulator {
|
||||
|
||||
// File Chooser
|
||||
fileChooser = new JFileChooser(System.getProperty("user.dir"));
|
||||
preferences = new PreferencesDialog(mainWindow, true);
|
||||
preferences = new PreferencesDialog(mainWindow, true, haltOnBreak);
|
||||
|
||||
// Panel for Console and Buttons
|
||||
JPanel consoleContainer = new JPanel();
|
||||
|
||||
Reference in new issue
Block a user