diff --git a/src/main/dig/processor/Processor.dig b/src/main/dig/processor/Processor.dig index 71c415635..7c063496b 100644 --- a/src/main/dig/processor/Processor.dig +++ b/src/main/dig/processor/Processor.dig @@ -1,6 +1,7 @@ 1 + Control.dig @@ -168,20 +169,22 @@ Data - 13 + 15 5137 5120 6145 15888 29521 + 31744 15375 - 26107 + 26106 8193 16400 29521 + 31744 15360 - 26107 - 28661 + 26106 + 28659 16 @@ -235,7 +238,7 @@ Frequency - 200 + 1000 @@ -253,7 +256,7 @@ 16 - + 0 @@ -268,7 +271,7 @@ 16 - + 0 @@ -441,6 +444,14 @@ + + + + + + + + @@ -898,7 +909,7 @@ - + @@ -994,7 +1005,7 @@ - + diff --git a/src/main/java/de/neemann/digital/gui/Main.java b/src/main/java/de/neemann/digital/gui/Main.java index 748ce5f2d..993051ccf 100644 --- a/src/main/java/de/neemann/digital/gui/Main.java +++ b/src/main/java/de/neemann/digital/gui/Main.java @@ -49,8 +49,9 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave { private static final Icon iconFast = IconCreator.create("FastForward24.gif"); private final CircuitComponent circuitComponent; private final ToolTipAction save; - private final ElementLibrary library; private final ToolTipAction doStep; + private final ToolTipAction runToBreak; + private final ElementLibrary library; private final JCheckBoxMenuItem runClock; private final LibrarySelector librarySelector; private final ShapeFactory shapeFactory; @@ -68,7 +69,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave { private State selectState; private State runModelState; private State runModelMicroState; - private boolean clocksAreRunning; private Main() { this(null, null, null); @@ -250,31 +250,19 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave { .setToolTip(Lang.get("menu_run_tt")); ToolTipAction runModelMicroAction = runModelMicroState.createToolTipAction(Lang.get("menu_micro"), iconMicro) .setToolTip(Lang.get("menu_micro_tt")); - ToolTipAction runFast = new ToolTipAction(Lang.get("menu_fast"), iconFast) { + runToBreak = new ToolTipAction(Lang.get("menu_fast"), iconFast) { @Override public void actionPerformed(ActionEvent e) { - if (model == null || !model.isFastRunModel() || clocksAreRunning) { - // start without running clocks - createAndStartModel(false, ModelEvent.Event.BREAK); - circuitComponent.setManualChangeObserver(new FullStepObserver(model)); - // inform StateManager that we manually entered the run state - stateManager.stateEnteredManually(runModelState); - if (!model.isFastRunModel()) { - elementState.activate(); - new ErrorMessage(Lang.get("msg_needOneClockAndOneTimer")).show(Main.this); - } + try { + int i = model.runToBreak(); + circuitComponent.repaint(); + statusLabel.setText(Lang.get("stat_clocks", i)); + } catch (NodeException e1) { + elementState.activate(); + new ErrorMessage(Lang.get("msg_fastRunError")).addCause(e1).show(Main.this); } - if (model != null && model.isFastRunModel() && !clocksAreRunning) - try { - int i = model.runToBreak(); - circuitComponent.repaint(); - statusLabel.setText(Lang.get("stat_clocks", i)); - } catch (NodeException e1) { - elementState.activate(); - new ErrorMessage(Lang.get("msg_fastRunError")).addCause(e1).show(Main.this); - } } - }.setToolTip(Lang.get("menu_fast_tt")); + }.setToolTip(Lang.get("menu_fast_tt")).setActive(false); ToolTipAction speedTest = new ToolTipAction(Lang.get("menu_speedTest")) { @Override @@ -299,7 +287,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave { run.add(runModelAction.createJMenuItem()); run.add(runModelMicroAction.createJMenuItem()); run.add(doStep.createJMenuItem()); - run.add(runFast.createJMenuItem()); + run.add(runToBreak.createJMenuItem()); run.add(speedTest.createJMenuItem()); run.add(traceEnable); run.add(runClock); @@ -316,7 +304,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave { toolBar.add(circuitComponent.getDeleteAction().createJButtonNoText()); toolBar.addSeparator(); toolBar.add(runModelState.setIndicator(runModelAction.createJButtonNoText())); - toolBar.add(runFast.createJButtonNoText()); + toolBar.add(runToBreak.createJButtonNoText()); toolBar.add(runModelMicroState.setIndicator(runModelMicroAction.createJButtonNoText())); toolBar.add(doStep.createJButtonNoText()); @@ -399,7 +387,8 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave { for (Clock c : model.getClocks()) model.addObserver(new RealTimeClock(model, c, timerExecuter)); } - clocksAreRunning = runClock; + + runToBreak.setEnabled(!runClock && model.isFastRunModel()); model.init();