diff --git a/eeprom.json b/eeprom.json index 0e0dcd2..4969254 100644 --- a/eeprom.json +++ b/eeprom.json @@ -1,3 +1 @@ -{ - -} \ No newline at end of file +{"0":255} \ No newline at end of file diff --git a/src/main/java/fabrik/simulator/pic16f84/Controller_Frontend.java b/src/main/java/fabrik/simulator/pic16f84/Controller_Frontend.java index 296a9ce..978be1d 100644 --- a/src/main/java/fabrik/simulator/pic16f84/Controller_Frontend.java +++ b/src/main/java/fabrik/simulator/pic16f84/Controller_Frontend.java @@ -46,6 +46,12 @@ public class Controller_Frontend { return executionTimeMultiplier; } + private boolean isBreakpointReached = false; + + private boolean continueExecutionAfterBreakpoint = false; + + + @@ -139,10 +145,12 @@ public class Controller_Frontend { @FXML - private void autoRunGUI(ActionEvent event) { + public void autoRunGUI(ActionEvent event) { if (!isAutoRunActive) { - isAutoRunActive = true; + isAutoRunActive = true; + initializeBreakpoints(); } + Thread autoRunThread = new Thread(() -> { try { while (DataRegister.getPC() < prog.length && isAutoRunActive){ @@ -206,13 +214,21 @@ public class Controller_Frontend { else currentIndex = ind[DataRegister.getPC()]-1; - // Überprüfen, ob ein Breakpoint gesetzt ist testte + // Überprüfung ob ein Breakpoint gesetzt ist testte + if (breakpoints.contains(currentIndex)) { - stopAutoRun(null); - System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex); - return; + if (breakpoints.contains(currentIndex) && !continueExecutionAfterBreakpoint){ + isBreakpointReached = true; + stopAutoRun(null); + System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex); + continueExecutionAfterBreakpoint = true; + return; + } + + } + initializeBreakpoints(); // Scrollen zur ausgewählten Zeile lstContentListView.scrollTo(currentIndex -2); @@ -245,6 +261,7 @@ public class Controller_Frontend { CreateWindow.refreshTable(stage); IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons()); + long totalExecutionTime = Commands.getTotalExecutionTime(); totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs"); } @@ -264,6 +281,7 @@ public class Controller_Frontend { }); } + //////////////testeteet private Set breakpoints = new HashSet<>(); @@ -279,6 +297,7 @@ public class Controller_Frontend { initialize(); toggleLEDs(null); IOPorts.reset(); + for (ToggleButtonGroup toggleButtonGroup : allPORTbuttons) { try { toggleButtonGroup.getToggles().get(0).setSelected(true); @@ -286,6 +305,8 @@ public class Controller_Frontend { IOPorts.setPORTfromUI(toggleButtonGroup); } catch (NullPointerException ignored) {} } + initializeBreakpoints(); + breakpoints.clear(); IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons()); Commands.resetTotalExecutionTime(); WatchdogTimer.reset(); @@ -308,9 +329,11 @@ public class Controller_Frontend { } Stage stage = (Stage) stepintoButton.getScene().getWindow(); stage.setTitle(stageTitle); + } + } private void initializeBreakpoints() { @@ -473,7 +496,7 @@ public class Controller_Frontend { autoRunGUI.setOnAction(this::autoRunGUI); stopButton.setOnAction(this::stopAutoRun); - + initializeBreakpoints(); executionTimeComboBox.setItems(FXCollections.observableArrayList("8 MHZ", "4 MHZ", "1 MHZ", "500 HZ", "100 HZ", "32 HZ")); executionTimeComboBox.setValue("4 MHZ"); executionTimeComboBox.setOnAction(event -> updateExecutionTimeMultiplier());