diff --git a/src/main/java/fabrik/simulator/pic16f84/Controller_FileSelect.java b/src/main/java/fabrik/simulator/pic16f84/Controller_FileSelect.java
index 2d9fcda..030e9d8 100644
--- a/src/main/java/fabrik/simulator/pic16f84/Controller_FileSelect.java
+++ b/src/main/java/fabrik/simulator/pic16f84/Controller_FileSelect.java
@@ -13,23 +13,71 @@ import java.io.BufferedReader;
import java.io.FileReader;
+import javafx.scene.control.Label;
+import javafx.scene.control.TableView;
+import javafx.scene.control.TextArea;
+
+import javafx.stage.Stage;
+import java.util.Arrays;
public class Controller_FileSelect {
+ private int [] prog;
+
+
+ @FXML
+ private Button stepintoButton;
+
+
+ @FXML
+ private TableView
tableView;
@FXML
private TextArea lstContentLabel;
+ @FXML
+ private Label pclLabel;
+
+ @FXML
+ private Label statusLabel;
+
+ @FXML
+ private Label fsrLabel;
+
+ @FXML
+ private Label pclathLabel;
+
+ @FXML
+ private Label intconLabel;
+
+
+
+ @FXML
+ private void stepintoButton(ActionEvent event) throws IOException {
+ Commands.decode(prog[DataRegister.getPC()]);
+ DataRegister.increasePC();
+ Table.refresh();
+ Stage stage = (Stage) stepintoButton.getScene().getWindow();
+ CreateWindow.refreshTable(stage);
+
+ }
+
+
@FXML
protected void selectFileLST(ActionEvent event){
File selectedFile = chooseLSTFile();
if(selectedFile != null){
+ prog = ParseFile.parseDatei(selectedFile.getAbsolutePath());
+ System.out.println(Arrays.toString(Arrays.stream(prog).toArray()));
displayLSTFileContent(selectedFile);
}
+
+
+
}
private File chooseLSTFile() {
diff --git a/src/main/java/fabrik/simulator/pic16f84/CreateWindow.java b/src/main/java/fabrik/simulator/pic16f84/CreateWindow.java
index 67ee83f..353690e 100644
--- a/src/main/java/fabrik/simulator/pic16f84/CreateWindow.java
+++ b/src/main/java/fabrik/simulator/pic16f84/CreateWindow.java
@@ -1,14 +1,11 @@
package fabrik.simulator.pic16f84;
import javafx.application.Application;
-import javafx.beans.property.SimpleStringProperty;
-import javafx.fxml.FXMLLoader;
+import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
-import javafx.scene.control.Label;
-import javafx.scene.control.TableColumn;
-import javafx.scene.control.TableView;
+
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
@@ -17,96 +14,46 @@ import java.io.IOException;
public class CreateWindow extends Application {
- private static final int NUM_COLUMNS = 8; // Anzahl der Spalten
+ private static VBox table;
+ public static GridPane grid = new GridPane();
@Override
- public void start(Stage primaryStage) throws IOException {
- // Erstelle eine Instanz der DataRegister-Klasse
+
+ public void start(Stage primaryStage) throws IOException{
DataRegister.initDataRegister();
-
- // Erstelle eine TableView für die Datenanzeige
- TableView tableView = new TableView<>();
-
- // Erstelle Spalten für die TableView
- for (int i = 0; i < NUM_COLUMNS; i++) {
- TableColumn column = new TableColumn<>("0" + (i + 1));
- final int columnIndex = i;
- column.setCellValueFactory(cellData -> {
- if (cellData.getValue() != null && cellData.getValue().length > columnIndex) {
- return new SimpleStringProperty(cellData.getValue()[columnIndex].getValue());
- } else {
- return new SimpleStringProperty("");
- }
- });
- tableView.getColumns().add(column);
- }
-
- // Fülle die TableView mit Daten aus dem Array
- int numRows = (int) Math.ceil((double) DataRegister.getDataRegister().length / NUM_COLUMNS);
- for (int row = 0; row < numRows; row++) {
- DataEntry[] rowData = new DataEntry[NUM_COLUMNS];
- for (int col = 0; col < NUM_COLUMNS; col++) {
- int index = row * NUM_COLUMNS + col;
- if (index < DataRegister.getDataRegister().length) {
- String address = "0x" + Integer.toHexString(index).toUpperCase();
- String value = "0x" + Integer.toHexString(DataRegister.getDataRegister()[index]).toUpperCase();
- rowData[col] = new DataEntry(address, value);
- } else {
- rowData[col] = new DataEntry("", "");
- }
- }
- tableView.getItems().add(rowData);
- }
-
- // Erstelle Labels für die Spezialregister
- Label pclLabel = new Label("PCL: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getPCL())).toUpperCase());
- Label statusLabel = new Label("STATUS: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getSTATUS())).toUpperCase());
- Label fsrLabel = new Label("FSR: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getFSR())).toUpperCase());
- Label pclathLabel = new Label("PCLATH: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase());
- Label intconLabel = new Label("INTCON: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase());
+ table = Table.refresh();
FXMLLoader codewindow = new FXMLLoader(CreateWindow.class.getResource("frontend.fxml"));
Parent code = codewindow.load();
- // Erstelle einen VBox, um die TableView und Labels anzuzeigen
- VBox table = new VBox();
- table.getChildren().addAll(tableView, pclLabel, statusLabel, fsrLabel, pclathLabel, intconLabel);
- GridPane grid = new GridPane();
-
- grid.add(table, 0, 1);
- grid.add(code, 1, 1);
+ grid.add(table, 1, 1);
+ grid.add(code, 0, 1);
grid.relocate(0, 0);
- Scene scene = new Scene(grid, 1600, 800);
+ Scene scene = new Scene(grid, 1800, 800);
primaryStage.setScene(scene);
primaryStage.setTitle("Simulator");
primaryStage.show();
}
- public static void main(String[] args) {
+ static void main(String[] args) {
+
launch(args);
+
}
- // Hilfsklasse für die Datenanzeige in der TableView
- public static class DataEntry {
- private final String address;
- private final String value;
-
- public DataEntry(String address, String value) {
- this.address = address;
- this.value = value;
- }
-
- public String getAddress() {
- return address;
- }
-
- public String getValue() {
- return value;
- }
+ public static void refreshTable(Stage stage) throws IOException {
+ grid.getChildren().remove(table);
+ table= Table.refresh();
+ grid.add(table, 1, 1);
}
-}
\ No newline at end of file
+
+
+}
+
+
+
diff --git a/src/main/java/fabrik/simulator/pic16f84/Table.java b/src/main/java/fabrik/simulator/pic16f84/Table.java
new file mode 100644
index 0000000..2f484ef
--- /dev/null
+++ b/src/main/java/fabrik/simulator/pic16f84/Table.java
@@ -0,0 +1,114 @@
+package fabrik.simulator.pic16f84;
+
+import javafx.beans.property.SimpleStringProperty;
+import javafx.geometry.Insets;
+
+import javafx.scene.control.Label;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableView;
+
+import javafx.scene.layout.VBox;
+
+
+
+import java.io.IOException;
+
+import static javafx.application.Application.launch;
+
+public class Table {
+
+
+ //Hier wird die Tabelle aktualisiert
+ //Tabelle aktualisieren
+
+ private static final int NUM_COLUMNS = 8; // Anzahl der Spalten
+ private static final double TABLE_WIDTH = 310; // Breite der TableView
+
+
+
+ public static VBox refresh(){
+ // Erstelle eine Instanz der DataRegister-Klasse
+
+
+ // Erstelle eine TableView für die Datenanzeige
+ TableView tableView = new TableView<>();
+ tableView.setPrefWidth(TABLE_WIDTH);
+
+
+
+
+ // Erstelle Spalten für die TableView
+ for (int i = 0; i < NUM_COLUMNS; i++) {
+ TableColumn column = new TableColumn<>("0" + (i));
+ final int columnIndex = i;
+ column.setCellValueFactory(cellData -> {
+ if (cellData.getValue() != null && cellData.getValue().length > columnIndex) {
+ return new SimpleStringProperty(cellData.getValue()[columnIndex].getValue());
+ } else {
+ return new SimpleStringProperty("");
+ }
+ });
+ tableView.getColumns().add(column);
+ }
+
+ // Fülle die TableView mit Daten aus dem Array
+ int numRows = (int) Math.ceil((double) DataRegister.getDataRegister().length / NUM_COLUMNS);
+ for (int row = 0; row < numRows; row++) {
+ DataEntry[] rowData = new DataEntry[NUM_COLUMNS];
+ for (int col = 0; col < NUM_COLUMNS; col++) {
+ int index = row * NUM_COLUMNS + col;
+ if (index < DataRegister.getDataRegister().length) {
+ String address = "0x" + Integer.toHexString(index).toUpperCase();
+ String value = "0x" + Integer.toHexString(DataRegister.getDataRegister()[index]).toUpperCase();
+ rowData[col] = new DataEntry(address, value);
+ } else {
+ rowData[col] = new DataEntry("", "");
+ }
+ }
+ tableView.getItems().add(rowData);
+ }
+
+ // Erstelle Labels für die Spezialregister
+ Label pclLabel = new Label("PCL: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getPCL())).toUpperCase());
+ Label statusLabel = new Label("STATUS: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getSTATUS())).toUpperCase());
+ Label fsrLabel = new Label("FSR: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getFSR())).toUpperCase());
+ Label pclathLabel = new Label("PCLATH: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase());
+ Label intconLabel = new Label("INTCON: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase());
+
+
+
+
+ // Erstelle einen VBox, um die TableView und Labels anzuzeigen
+ VBox table = new VBox();
+ table.getChildren().addAll(tableView, pclLabel, statusLabel, fsrLabel, pclathLabel, intconLabel);
+ VBox.setMargin(tableView, new Insets(0, 0, 0, 0));
+
+ return table;
+
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+
+ // Hilfsklasse für die Datenanzeige in der TableView
+ public static class DataEntry {
+ private final String address;
+ private final String value;
+
+ public DataEntry(String address, String value) {
+ this.address = address;
+ this.value = value;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getValue() {
+ return value;
+ }
+ }
+
+
+}
diff --git a/src/main/resources/fabrik/simulator/pic16f84/frontend.fxml b/src/main/resources/fabrik/simulator/pic16f84/frontend.fxml
index 8d03ceb..7042209 100644
--- a/src/main/resources/fabrik/simulator/pic16f84/frontend.fxml
+++ b/src/main/resources/fabrik/simulator/pic16f84/frontend.fxml
@@ -15,7 +15,7 @@
-
+
@@ -48,11 +48,20 @@
+
+
-
+
+
+
+
+
+
+
+