Compare commits
42 Commits
paul-zwisc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c8f23176d2 | |||
| 1d89bf16cc | |||
| 889f9a307b | |||
| 648bb58030 | |||
| 6aab534dad | |||
| ea6cacfa70 | |||
| 0b163589db | |||
| 7440329d91 | |||
| 0ed167f822 | |||
| 8bc6d5cfd0 | |||
| 2294f81766 | |||
| c49a073cfd | |||
| 45f9878047 | |||
| 6d0c47c6c0 | |||
| 08b815c64c | |||
| 99ce3b378b | |||
| 8025de69a9 | |||
| 073ad3dada | |||
| 0b932966c5 | |||
| 2258c5a8be | |||
| 8f35f4f914 | |||
| b842d6eb05 | |||
| c65d9c94de | |||
| af17397a1c | |||
| 3722bff281 | |||
| abc915bf2b | |||
| 6d329c6059 | |||
| fbc3ef0f70 | |||
| e6928339de | |||
| 061021748e | |||
| 0db7c7d840 | |||
| 07c9279ad3 | |||
| f49e1ea09f | |||
| 68ddce74a8 | |||
| 3590779e74 | |||
| d7ea62963f | |||
| f1fe3ecd22 | |||
| 842f26c912 | |||
| b1173a2ceb | |||
| 5a6a70f598 | |||
| 2d9e143b3a | |||
| 0ea1143934 |
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<writeAnnotations>
|
||||
<writeAnnotation name="javafx.fxml.FXML" />
|
||||
</writeAnnotations>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
|
||||
3
eeprom.json
Normal file
3
eeprom.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
BIN
libs/com.gluon/charm-glisten-4.4.1.jar
Normal file
BIN
libs/com.gluon/charm-glisten-4.4.1.jar
Normal file
Binary file not shown.
12
pom.xml
12
pom.xml
@ -45,6 +45,18 @@
|
||||
<artifactId>ikonli-javafx</artifactId>
|
||||
<version>12.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gluonhq</groupId>
|
||||
<artifactId>charm-glisten</artifactId>
|
||||
<version>4.4.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/com.gluon/charm-glisten-4.4.1.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.hansolo</groupId>
|
||||
<artifactId>tilesfx</artifactId>
|
||||
|
||||
@ -3,10 +3,34 @@ package fabrik.simulator.pic16f84;
|
||||
public class Commands {
|
||||
private static int wRegister = 0;
|
||||
|
||||
static long totalExecutionTime = 0;
|
||||
|
||||
|
||||
|
||||
public static int get_wRegister() {
|
||||
return wRegister;
|
||||
}
|
||||
|
||||
public static void addExecutionTime(int i) {
|
||||
totalExecutionTime += i;
|
||||
Timer.cycles(i);
|
||||
EEPROM.registerTime(false);
|
||||
}
|
||||
|
||||
public static long getTotalExecutionTime() {
|
||||
return (long) (totalExecutionTime * Controller_Frontend.getExecutionTimeMultiplier());
|
||||
}
|
||||
|
||||
public static void resetTotalExecutionTime() {
|
||||
totalExecutionTime = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void decode(int instruction){
|
||||
final int jumpaddr = 0x7FF;
|
||||
final int fileregaddr = 0x7F;
|
||||
@ -24,10 +48,12 @@ public class Commands {
|
||||
case 0b10000000000000:
|
||||
System.out.println("CALL: " + j);
|
||||
CALL (j);
|
||||
addExecutionTime(2);
|
||||
return;
|
||||
case 0b10100000000000:
|
||||
System.out.println("GOTO: " + j);
|
||||
GOTO (j);
|
||||
addExecutionTime(2);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
@ -37,26 +63,32 @@ public class Commands {
|
||||
case 0b01000000000000:
|
||||
System.out.println("BCF: " + f + " " + b);
|
||||
DataRegister.clearBit(f, b);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b01010000000000:
|
||||
System.out.println("BSF: " + f + " " + b);
|
||||
DataRegister.setBit(f, b);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b01100000000000:
|
||||
System.out.println("BTFSC: " + f + " " + b);
|
||||
BTFSC(f, b);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b01110000000000:
|
||||
System.out.println("BTFSS: " + f + " " + b);
|
||||
BTFSS(f, b);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b11000000000000:
|
||||
System.out.println("MOVLW: " + k);
|
||||
MOVLW (k);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b11010000000000:
|
||||
System.out.println("RETLW: " + k);
|
||||
RETLW (k);
|
||||
addExecutionTime(2);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
@ -66,10 +98,12 @@ public class Commands {
|
||||
case 0b11111000000000:
|
||||
System.out.println("ADDLW: " + k);
|
||||
ADDLW (k);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b11110000000000:
|
||||
System.out.println("SUBLW: " + k);
|
||||
SUBLW (k);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
@ -79,70 +113,88 @@ public class Commands {
|
||||
case 0b00011100000000:
|
||||
System.out.println("ADDWF: " + f + " " + d);
|
||||
ADDWF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00010100000000:
|
||||
System.out.println("ANDWF: " + f + " " + d);
|
||||
ANDWF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00100100000000:
|
||||
System.out.println("COMF: " + f + " " + d);
|
||||
COMF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00001100000000:
|
||||
System.out.println("DECF: " + f + " " + d);
|
||||
DECF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00101100000000:
|
||||
//1 bzw 2 Laufzeitpunkte
|
||||
System.out.println("DECFSZ: " + f + " " + d);
|
||||
DECFSZ (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00101000000000:
|
||||
System.out.println("INCF: " + f + " " + d);
|
||||
INCF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00111100000000:
|
||||
System.out.println("INCFSZ: " + f + " " + d);
|
||||
INCFSZ (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00010000000000:
|
||||
System.out.println("IORWF: " + f + " " + d);
|
||||
IORWF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00100000000000:
|
||||
System.out.println("MOVF: " + f + " " + d);
|
||||
MOVF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00110100000000:
|
||||
System.out.println("RLF: " + f + " " + d);
|
||||
RLF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00110000000000:
|
||||
System.out.println("RRF: " + f + " " + d);
|
||||
RRF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00001000000000:
|
||||
System.out.println("SUBWF: " + f + " " + d);
|
||||
SUBWF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00111000000000:
|
||||
System.out.println("SWAPF: " + f + " " + d);
|
||||
SWAPF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00011000000000:
|
||||
System.out.println("XORWF: " + f + " " + d);
|
||||
XORWF (f, d);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b11100100000000:
|
||||
System.out.println("ANDLW: " + k);
|
||||
ANDLW (k);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b11101000000000:
|
||||
System.out.println("XORLW: " + k);
|
||||
XORLW (k);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b11100000000000:
|
||||
System.out.println("IORLW: " + k);
|
||||
IORLW (k);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
@ -152,14 +204,17 @@ public class Commands {
|
||||
case 0b00000110000000:
|
||||
System.out.println("CLRF: " + f);
|
||||
CLRF (f);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00000100000000:
|
||||
System.out.println("CLRW");
|
||||
CLRW ();
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
case 0b00000010000000:
|
||||
System.out.println("MOVWF: " + f);
|
||||
MOVWF (f);
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
@ -168,11 +223,12 @@ public class Commands {
|
||||
switch (instruction){
|
||||
case 0b01100100:
|
||||
System.out.println("CLRWDT");
|
||||
//TODO
|
||||
WatchdogTimer.reset();
|
||||
return;
|
||||
case 0b1001:
|
||||
System.out.println("RETFIE");
|
||||
RETFIE();
|
||||
addExecutionTime(2);
|
||||
return;
|
||||
case 0b1000:
|
||||
System.out.println("RETURN");
|
||||
@ -180,14 +236,15 @@ public class Commands {
|
||||
return;
|
||||
case 0b01100011:
|
||||
System.out.println("SLEEP");
|
||||
//TODO
|
||||
SLEEP();
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (instruction == 0 || instruction == 0b0110000 || instruction == 0b01000000 || instruction == 0b00100000){
|
||||
System.out.println("NOP");
|
||||
NOP ();
|
||||
}
|
||||
else{
|
||||
System.out.println("Nicht gefunden!");
|
||||
@ -196,10 +253,20 @@ public class Commands {
|
||||
|
||||
}
|
||||
|
||||
public static void SLEEP() {
|
||||
Controller_Frontend.sleep ();
|
||||
}
|
||||
|
||||
public static void RETFIE() {
|
||||
DataRegister.setBit(DataRegister.getINTCON(), 7); // GIE wieder setzen
|
||||
DataRegister.setPC(ProgramStack.pop());
|
||||
}
|
||||
|
||||
public static void NOP () {
|
||||
System.out.println("NOP");
|
||||
addExecutionTime(1);
|
||||
}
|
||||
|
||||
public static void GOTO(int jump) {
|
||||
DataRegister.setPC(jump-1);
|
||||
}
|
||||
@ -207,6 +274,7 @@ public class Commands {
|
||||
public static void CALL(int jump) {
|
||||
ProgramStack.push(DataRegister.getPC()+1);
|
||||
DataRegister.setPC(jump-1);
|
||||
addExecutionTime(1);
|
||||
}
|
||||
|
||||
public static void MOVWF(int file) {
|
||||
@ -216,11 +284,16 @@ public class Commands {
|
||||
public static void CLRW() {
|
||||
wRegister = 0;
|
||||
DataRegister.determineZeroFlag(wRegister);
|
||||
|
||||
addExecutionTime(1);
|
||||
|
||||
}
|
||||
|
||||
public static void CLRF(int file) {
|
||||
DataRegister.setRegister(file, 0);
|
||||
DataRegister.determineZeroFlag(DataRegister.getRegister(file));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void IORLW(int literal) {
|
||||
@ -247,6 +320,8 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void SWAPF(int file, int destination) {
|
||||
@ -258,6 +333,7 @@ public class Commands {
|
||||
else {
|
||||
DataRegister.setRegister(file, result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void SUBWF(int file, int destination) {
|
||||
@ -277,6 +353,7 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result & 0xFF);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
addExecutionTime(1);
|
||||
}
|
||||
|
||||
public static void RLF(int file, int destination) {
|
||||
@ -290,13 +367,14 @@ public class Commands {
|
||||
else {
|
||||
DataRegister.setRegister(file, result & 0xFF);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RRF(int file, int destination) {
|
||||
int fcontent = DataRegister.getRegister(file);
|
||||
int carry = DataRegister.getCarryFlag() << 7;
|
||||
int contentlow = fcontent & 0b1;
|
||||
int result = fcontent >> 1 | carry;
|
||||
int result = (fcontent >> 1) | carry;
|
||||
DataRegister.setCarryFlag(contentlow);
|
||||
if (destination == 0){
|
||||
wRegister = result & 0xFF;
|
||||
@ -304,6 +382,7 @@ public class Commands {
|
||||
else {
|
||||
DataRegister.setRegister(file, result & 0xFF);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void MOVF(int file, int destination) {
|
||||
@ -326,15 +405,18 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
|
||||
}
|
||||
|
||||
public static void INCFSZ(int file, int destination) {
|
||||
int result = (DataRegister.getRegister(file) + 1) & 0xFF;
|
||||
if (destination == 0){
|
||||
wRegister = result;
|
||||
addExecutionTime(1);
|
||||
}
|
||||
else {
|
||||
DataRegister.setRegister(file, result);
|
||||
|
||||
}
|
||||
if (result == 0) {
|
||||
DataRegister.increasePC();
|
||||
@ -350,15 +432,19 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
|
||||
}
|
||||
|
||||
public static void DECFSZ(int file, int destination) {
|
||||
int result = (DataRegister.getRegister(file) -1) & 0xFF;
|
||||
if (destination == 0){
|
||||
wRegister = result;
|
||||
addExecutionTime(1);
|
||||
|
||||
}
|
||||
else {
|
||||
DataRegister.setRegister(file, result);
|
||||
|
||||
}
|
||||
if (result == 0){
|
||||
DataRegister.increasePC();
|
||||
@ -374,6 +460,8 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void COMF(int file, int destination) {
|
||||
@ -385,6 +473,9 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void ANDWF(int file, int destination) {
|
||||
@ -397,7 +488,8 @@ public class Commands {
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
DataRegister.determineCarryFlag(result);
|
||||
DataRegister.determineDigitCarryFlag(result);
|
||||
DataRegister.determineDigitCarryFlag((wRegister&0b11101111) & (DataRegister.getRegister(file)&0b1111));
|
||||
|
||||
}
|
||||
|
||||
public static void ADDWF(int file, int destination) {
|
||||
@ -408,7 +500,7 @@ public class Commands {
|
||||
}
|
||||
else {
|
||||
DataRegister.determineCarryFlag(result);
|
||||
DataRegister.determineDigitCarryFlag(result);
|
||||
DataRegister.determineDigitCarryFlag((wRegister&0b11101111) + (DataRegister.getRegister(file)&0b1111));
|
||||
}
|
||||
if (destination == 0) {
|
||||
wRegister = result & 0xFF;
|
||||
@ -417,6 +509,8 @@ public class Commands {
|
||||
DataRegister.setRegister(file, result & 0xFF);
|
||||
}
|
||||
DataRegister.determineZeroFlag(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void SUBLW(int literal) {
|
||||
@ -439,7 +533,7 @@ public class Commands {
|
||||
wRegister = result & 0xFF;
|
||||
DataRegister.determineZeroFlag(result);
|
||||
DataRegister.determineCarryFlag(result);
|
||||
DataRegister.determineDigitCarryFlag(result);
|
||||
DataRegister.determineDigitCarryFlag((wRegister&0b11101111) + (literal&0b1111));
|
||||
}
|
||||
|
||||
public static void RETLW(int literal) {
|
||||
@ -454,12 +548,14 @@ public class Commands {
|
||||
public static void BTFSC(int address, int bit) {
|
||||
if (DataRegister.getBit(address, bit) == 0){
|
||||
DataRegister.increasePC();
|
||||
addExecutionTime(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void BTFSS(int address, int bit) {
|
||||
if (DataRegister.getBit(address, bit) == 1){
|
||||
DataRegister.increasePC();
|
||||
addExecutionTime(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Controller_FileSelect {
|
||||
private int [] prog;
|
||||
|
||||
@FXML
|
||||
protected void selectFileLST(ActionEvent event) throws IOException {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("Open LST File");
|
||||
fileChooser.getExtensionFilters().addAll(
|
||||
new FileChooser.ExtensionFilter("LST-Dateien", "*.LST", "*.lst"),
|
||||
new FileChooser.ExtensionFilter("Alle Dateien", "*.*"));
|
||||
File selectedFile = fileChooser.showOpenDialog(new Stage());
|
||||
|
||||
if (selectedFile != null) {
|
||||
prog = ParseFile.parseDatei(selectedFile.getAbsolutePath());
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(CreateWindow.class.getResource("MainBody.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 800);
|
||||
stage.setTitle("PIC16F84-Simulator - Hauptseite");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
System.out.println("\n");
|
||||
DataRegister.initDataRegister();
|
||||
while (true) {
|
||||
Scanner reader = new Scanner(System.in);
|
||||
System.out.println("\nWeiter? ");
|
||||
int n = reader.nextInt();
|
||||
if (n != 0) {
|
||||
Commands.decode(prog[DataRegister.getPC()]);
|
||||
System.out.println("\nPC: " + DataRegister.getPC());
|
||||
System.out.println("FSR: " + DataRegister.getFSR());
|
||||
System.out.println("PCL: " + DataRegister.getRegister(0x2));
|
||||
System.out.println("PCLATH: " + DataRegister.getRegister(0xA));
|
||||
System.out.println("W: " + Commands.get_wRegister());
|
||||
System.out.println("C: " + DataRegister.getCarryFlag());
|
||||
System.out.println("DC: " + DataRegister.getDigitCarryFlag());
|
||||
System.out.println("StackPointer: " + ProgramStack.getStackPointer());
|
||||
System.out.println(ProgramStack.getStack());
|
||||
System.out.printf(Arrays.toString(DataRegister.getDataRegister()));
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public int[] getProg() {
|
||||
return prog;
|
||||
}
|
||||
}
|
||||
588
src/main/java/fabrik/simulator/pic16f84/Controller_Frontend.java
Normal file
588
src/main/java/fabrik/simulator/pic16f84/Controller_Frontend.java
Normal file
@ -0,0 +1,588 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.stage.FileChooser;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
||||
import java.io.FileReader;
|
||||
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableView;
|
||||
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
|
||||
public class Controller_Frontend {
|
||||
|
||||
private int [] prog;
|
||||
private int [][] read;
|
||||
private int [] ind;
|
||||
|
||||
private static double executionTimeMultiplier = 1;
|
||||
|
||||
|
||||
|
||||
public static double getExecutionTimeMultiplier(){
|
||||
return executionTimeMultiplier;
|
||||
}
|
||||
|
||||
private boolean isBreakpointReached = false;
|
||||
|
||||
private boolean continueExecutionAfterBreakpoint = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> executionTimeComboBox;
|
||||
|
||||
|
||||
@FXML
|
||||
private Button stepintoButton;
|
||||
|
||||
@FXML
|
||||
private TableView<Table.DataEntry> tableView;
|
||||
|
||||
@FXML
|
||||
private ListView<String> lstContentListView;
|
||||
|
||||
@FXML
|
||||
private Button autoRunGUI;
|
||||
|
||||
@FXML
|
||||
private Button stopButton;
|
||||
|
||||
@FXML
|
||||
private Label totalExecutionTimeLabel;
|
||||
|
||||
@FXML
|
||||
private CheckBox wdtCheck;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static volatile boolean isAutoRunActive = false;
|
||||
private static volatile boolean isSleeping = false;
|
||||
|
||||
public static boolean isSleeping (){
|
||||
return isSleeping;
|
||||
}
|
||||
|
||||
public static void stopRunFromBackend(String message){
|
||||
isAutoRunActive = false;
|
||||
if (isSleeping)
|
||||
wakeUpFromSleep();
|
||||
else
|
||||
DataRegister.resetPC();
|
||||
Stage stoppedStage = new Stage();
|
||||
stoppedStage.setTitle("Programm unterbrochen!");
|
||||
VBox vbox = new VBox();
|
||||
vbox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
Label grundlabel = new Label("Grund: " + message);
|
||||
grundlabel.setStyle("-fx-font-size: 16px; -fx-font-weight: bold;");
|
||||
Label ueberlabel = new Label("Programm unterbrochen!");
|
||||
vbox.getChildren().add(ueberlabel);
|
||||
vbox.getChildren().add(grundlabel);
|
||||
VBox.setMargin(grundlabel, new javafx.geometry.Insets(10, 10, 10, 10));
|
||||
Scene scene = new Scene(vbox, 300, 90);
|
||||
stoppedStage.setAlwaysOnTop(true);
|
||||
stoppedStage.setScene(scene);
|
||||
stoppedStage.show();
|
||||
}
|
||||
|
||||
public static void sleep() {
|
||||
isSleeping = true;
|
||||
}
|
||||
|
||||
public static void wakeUpFromSleep() {
|
||||
isSleeping = false;
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void stopAutoRun(ActionEvent event) {
|
||||
isAutoRunActive = false;
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void autoRunGUI(ActionEvent event) {
|
||||
if (!isAutoRunActive) {
|
||||
isAutoRunActive = true;
|
||||
}
|
||||
|
||||
Thread autoRunThread = new Thread(() -> {
|
||||
try {
|
||||
while (DataRegister.getPC() < prog.length && isAutoRunActive){
|
||||
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
stepintoButton(null);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
Thread.sleep(80); //Verzögerungszeit in Millisekunden
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
autoRunThread.setDaemon(true);
|
||||
autoRunThread.start();
|
||||
}
|
||||
|
||||
|
||||
private void updateExecutionTimeMultiplier() {
|
||||
String selectedOption = executionTimeComboBox.getValue();
|
||||
switch (selectedOption) {
|
||||
case "8 MHZ":
|
||||
executionTimeMultiplier = 0.5;
|
||||
break;
|
||||
|
||||
case "4 MHZ":
|
||||
executionTimeMultiplier = 1;
|
||||
break;
|
||||
case "1 MHZ":
|
||||
executionTimeMultiplier = 4;
|
||||
break;
|
||||
case "500 HZ":
|
||||
executionTimeMultiplier = 8;
|
||||
break;
|
||||
|
||||
case "100 HZ":
|
||||
executionTimeMultiplier = 40;
|
||||
break;
|
||||
|
||||
case "32 HZ":
|
||||
executionTimeMultiplier = 125;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void stepintoButton(ActionEvent event) throws IOException {
|
||||
if (lstContentListView.getItems().isEmpty()) {
|
||||
// Datei ist nicht geladen oder leer
|
||||
return;
|
||||
}
|
||||
|
||||
int currentIndex;
|
||||
// Aktuelle Zeile abrufen
|
||||
if (!isSleeping)
|
||||
currentIndex = ind[DataRegister.getPC()];
|
||||
else
|
||||
currentIndex = ind[DataRegister.getPC()]-1;
|
||||
|
||||
// Überprüfung ob ein Breakpoint gesetzt ist testte
|
||||
|
||||
if (breakpoints.contains(currentIndex)) {
|
||||
if (!continueExecutionAfterBreakpoint){
|
||||
isBreakpointReached = true;
|
||||
stopAutoRun(null);
|
||||
System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex);
|
||||
continueExecutionAfterBreakpoint = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
isBreakpointReached = false;
|
||||
continueExecutionAfterBreakpoint = false;
|
||||
}
|
||||
|
||||
// Scrollen zur ausgewählten Zeile
|
||||
lstContentListView.scrollTo(currentIndex -2);
|
||||
|
||||
// Zeile auswählen
|
||||
lstContentListView.getSelectionModel().clearSelection();
|
||||
lstContentListView.getSelectionModel().select(currentIndex);
|
||||
|
||||
String selectedRowStyle;
|
||||
if (!isSleeping)
|
||||
selectedRowStyle = "-fx-background-color: red; -fx-text-fill: white;";
|
||||
else
|
||||
selectedRowStyle = "-fx-background-color: teal; -fx-text-fill: white;";
|
||||
|
||||
markSelectedRow(currentIndex, selectedRowStyle);
|
||||
|
||||
if (!isSleeping) {
|
||||
Commands.decode(prog[DataRegister.getPC()]);
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
else {
|
||||
Commands.decode(0);
|
||||
}
|
||||
WatchdogTimer.testAndTrigger();
|
||||
Table.refresh();
|
||||
CreateWindow.refreshTable();
|
||||
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||
updateStack();
|
||||
updateWatchdog();
|
||||
long totalExecutionTime = Commands.getTotalExecutionTime();
|
||||
totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs");
|
||||
}
|
||||
|
||||
private void markSelectedRow(int currentIndex, String selectedRowStyle) {
|
||||
lstContentListView.setCellFactory(column -> new ListCell<String>() {
|
||||
@Override
|
||||
protected void updateItem(String item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
setText(item);
|
||||
if (getIndex() == currentIndex) {
|
||||
setStyle(selectedRowStyle);
|
||||
} else {
|
||||
setStyle("");
|
||||
}
|
||||
CheckBox breakpointCheckBox = new CheckBox();
|
||||
breakpointCheckBox.setOnAction(event -> {
|
||||
int index = getIndex();
|
||||
if (breakpointCheckBox.isSelected()) {
|
||||
breakpoints.add(index);
|
||||
} else {
|
||||
breakpoints.remove(index);
|
||||
}
|
||||
});
|
||||
breakpointCheckBox.setSelected(breakpoints.contains(getIndex()));
|
||||
setGraphic(breakpointCheckBox);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Set<Integer> breakpoints = new HashSet<>();
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
protected void selectFileLST(ActionEvent event) throws IOException {
|
||||
File selectedFile = chooseLSTFile();
|
||||
stopAutoRun(null);
|
||||
if(selectedFile != null){
|
||||
String fileAddress = selectedFile.getAbsolutePath();
|
||||
DataRegister.initDataRegister();
|
||||
DataRegister.resetPC();
|
||||
toggleLEDs(null);
|
||||
IOPorts.reset();
|
||||
|
||||
for (ToggleButtonGroup toggleButtonGroup : allPORTbuttons) {
|
||||
try {
|
||||
toggleButtonGroup.getToggles().get(0).setSelected(true);
|
||||
toggleButtonGroup.getToggles().get(1).setSelected(false);
|
||||
IOPorts.setPORTfromUI(toggleButtonGroup);
|
||||
} catch (NullPointerException ignored) {}
|
||||
}
|
||||
ProgramStack.reset();
|
||||
wakeUpFromSleep();
|
||||
breakpoints.clear();
|
||||
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||
Commands.resetTotalExecutionTime();
|
||||
WatchdogTimer.reset();
|
||||
wdtCheck.setSelected(false);
|
||||
Table.refresh();
|
||||
read = ParseFile.parseDatei(fileAddress);
|
||||
prog = read [0];
|
||||
ind = read[1];
|
||||
updateStack();
|
||||
System.out.println(Arrays.toString(Arrays.stream(prog).toArray()));
|
||||
displayLSTFileContent(selectedFile);
|
||||
markSelectedRow(0, "-fx-background-color: red; -fx-text-fill: white;");
|
||||
initializeBreakpoints();
|
||||
int lastSlash = max (fileAddress.lastIndexOf('/'), fileAddress.lastIndexOf('\\'));
|
||||
int lastDot = fileAddress.lastIndexOf('.');
|
||||
String stageTitle;
|
||||
if (lastDot > lastSlash)
|
||||
stageTitle = "Simulator - " + fileAddress.substring(lastSlash + 1, lastDot);
|
||||
else {
|
||||
stageTitle = "Simulator - " + fileAddress.substring(lastSlash + 1);
|
||||
}
|
||||
Stage stage = (Stage) stepintoButton.getScene().getWindow();
|
||||
stage.setTitle(stageTitle);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeBreakpoints() {
|
||||
lstContentListView.setCellFactory(createBreakpointCell());
|
||||
}
|
||||
|
||||
private boolean checkBreakpoint(int pc) {
|
||||
// Hier wird überprüft, ob ein Breakpoint am angegebenen Programmzähler gesetzt ist
|
||||
return breakpoints.contains(pc);
|
||||
}
|
||||
|
||||
|
||||
private Callback<ListView<String>, ListCell<String>> createBreakpointCell() {
|
||||
return listView -> new ListCell<String>() {
|
||||
private final CheckBox breakpointCheckBox = new CheckBox();
|
||||
{
|
||||
breakpointCheckBox.setOnAction(event -> {
|
||||
int index = getIndex();
|
||||
if (breakpointCheckBox.isSelected()) {
|
||||
breakpoints.add(index);
|
||||
} else {
|
||||
breakpoints.remove(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateItem(String item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty || item == null) {
|
||||
setGraphic(null);
|
||||
} else {
|
||||
setText(item);
|
||||
setGraphic(breakpointCheckBox);
|
||||
breakpointCheckBox.setSelected(breakpoints.contains(getIndex()));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void loadLSTFileContent(String fileContent) {
|
||||
ObservableList<String> items = FXCollections.observableArrayList(fileContent.split("\n"));
|
||||
lstContentListView.setItems(items);
|
||||
}
|
||||
|
||||
|
||||
private File chooseLSTFile() {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.getExtensionFilters().addAll(
|
||||
new FileChooser.ExtensionFilter("LST Files", "*.lst", "*.LST"),
|
||||
new FileChooser.ExtensionFilter("All Files", "*.*"));
|
||||
return fileChooser.showOpenDialog(null);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void displayLSTFileContent(File selectedFile) {
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(selectedFile))) {
|
||||
ObservableList<String> contentList = FXCollections.observableArrayList();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
contentList.add(line);
|
||||
}
|
||||
lstContentListView.setItems(contentList);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void toggleWatchdog(ActionEvent actionEvent) {
|
||||
if (wdtCheck.isSelected()){
|
||||
WatchdogTimer.enable();
|
||||
|
||||
}
|
||||
else{
|
||||
WatchdogTimer.disable();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISA0;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISA1;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISA2;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISA3;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISA4;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB0;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB1;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB2;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB3;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB4;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB5;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB6;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgTRISB7;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTA0;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTA1;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTA2;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTA3;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTA4;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB0;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB1;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB2;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB3;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB4;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB5;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB6;
|
||||
@FXML
|
||||
private ToggleButtonGroup bgPORTB7;
|
||||
|
||||
private static ToggleButtonGroup[] allTRISbuttons;
|
||||
private static ToggleButtonGroup[] allPORTbuttons;
|
||||
private static Circle[] allLEDsA;
|
||||
private static Circle[] allLEDsB;
|
||||
private static ToggleButtonGroup dummy = new ToggleButtonGroup(new ToggleButton(), new ToggleButton());
|
||||
|
||||
public void initialize() {
|
||||
ToggleButtonGroup [] allTRISButtons = {bgTRISA0, bgTRISA1, bgTRISA2, bgTRISA3, bgTRISA4, dummy, dummy, dummy, bgTRISB0, bgTRISB1, bgTRISB2, bgTRISB3, bgTRISB4, bgTRISB5, bgTRISB6, bgTRISB7};
|
||||
ToggleButtonGroup [] allPORTButtons = {bgPORTA0, bgPORTA1, bgPORTA2, bgPORTA3, bgPORTA4, dummy, dummy, dummy, bgPORTB0, bgPORTB1, bgPORTB2, bgPORTB3, bgPORTB4, bgPORTB5, bgPORTB6, bgPORTB7};
|
||||
Circle[] allLEDsA = {ledA0, ledA1, ledA2, ledA3, ledA4};
|
||||
Circle[] allLEDsB = {ledB0, ledB1, ledB2, ledB3, ledB4, ledB5, ledB6, ledB7};
|
||||
for (int i = 0; i<allPORTButtons.length; i++) {
|
||||
allTRISButtons[i].getToggles().get(0).setSelected(true);
|
||||
allPORTButtons[i].getToggles().get(0).setSelected(true);
|
||||
allTRISButtons[i].getToggles().get(1).setSelected(false);
|
||||
allPORTButtons[i].getToggles().get(1).setSelected(false);
|
||||
ToggleButtonGroupExt.get().addAlwaysOneSelectedSupport(allTRISButtons[i]);
|
||||
ToggleButtonGroupExt.get().addAlwaysOneSelectedSupport(allPORTButtons[i]);
|
||||
}
|
||||
|
||||
ledCheckA.setSelected(false);
|
||||
ledCheckB.setSelected(false);
|
||||
setTRISbuttons(allTRISButtons);
|
||||
setPORTbuttons(allPORTButtons);
|
||||
IOPorts.setLEDs(allLEDsA, allLEDsB);
|
||||
|
||||
lstContentListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void setTRISbuttons(ToggleButtonGroup[] allButtons) {
|
||||
allTRISbuttons = allButtons;
|
||||
}
|
||||
|
||||
public static ToggleButtonGroup [] getTRISbuttons() {
|
||||
return allTRISbuttons;
|
||||
}
|
||||
|
||||
private static void setPORTbuttons(ToggleButtonGroup[] allButtons) {
|
||||
allPORTbuttons = allButtons;
|
||||
}
|
||||
|
||||
public static ToggleButtonGroup [] getPORTbuttons() {
|
||||
return allPORTbuttons;
|
||||
}
|
||||
|
||||
public static Circle[] getLEDsA() {
|
||||
return allLEDsA;
|
||||
}
|
||||
|
||||
public static Circle[] getLEDsB() {
|
||||
return allLEDsB;
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private CheckBox ledCheckA;
|
||||
@FXML
|
||||
private CheckBox ledCheckB;
|
||||
@FXML
|
||||
private Circle ledA0;
|
||||
@FXML
|
||||
private Circle ledA1;
|
||||
@FXML
|
||||
private Circle ledA2;
|
||||
@FXML
|
||||
private Circle ledA3;
|
||||
@FXML
|
||||
private Circle ledA4;
|
||||
@FXML
|
||||
private Circle ledB0;
|
||||
@FXML
|
||||
private Circle ledB1;
|
||||
@FXML
|
||||
private Circle ledB2;
|
||||
@FXML
|
||||
private Circle ledB3;
|
||||
@FXML
|
||||
private Circle ledB4;
|
||||
@FXML
|
||||
private Circle ledB5;
|
||||
@FXML
|
||||
private Circle ledB6;
|
||||
@FXML
|
||||
private Circle ledB7;
|
||||
|
||||
@FXML
|
||||
public void toggleLEDs (ActionEvent actionEvent) {
|
||||
IOPorts.setLEDs(new boolean[]{ledCheckA.isSelected(), ledCheckB.isSelected()});
|
||||
}
|
||||
|
||||
@FXML
|
||||
private Label stackIndex;
|
||||
|
||||
@FXML
|
||||
private ListView<String> stackVisual;
|
||||
|
||||
private static String format (String s) {
|
||||
return (s.length() == 1) ? "0" + s : s;
|
||||
}
|
||||
|
||||
private void updateStack (){
|
||||
stackIndex.setText("Stack-Pointer: " + ProgramStack.getStackPointer());
|
||||
ObservableList<String> observedList = FXCollections.observableArrayList();
|
||||
List<Integer> stackList = ProgramStack.getStack();
|
||||
for (Integer integer : stackList) {
|
||||
observedList.add("0x" + format(Integer.toHexString(integer).toUpperCase()));
|
||||
}
|
||||
stackVisual.setItems(observedList);
|
||||
}
|
||||
|
||||
private void updateWatchdog (){
|
||||
wdtCheck.setText("Watchdog-Timer: " + WatchdogTimer.get() + "µs");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
public class Controller_MainBody {
|
||||
|
||||
}
|
||||
@ -1,23 +1,52 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import javafx.application.Application;
|
||||
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CreateWindow extends Application {
|
||||
|
||||
private static VBox table;
|
||||
public static GridPane grid = new GridPane();
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(CreateWindow.class.getResource("FileSelector.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 800);
|
||||
stage.setTitle("PIC16F84-Simulator - Datei auswählen");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
DataRegister.initDataRegister();
|
||||
table = Table.refresh();
|
||||
FXMLLoader codewindow = new FXMLLoader(CreateWindow.class.getResource("frontend.fxml"));
|
||||
Parent code = codewindow.load();
|
||||
|
||||
grid.add(table, 1, 1);
|
||||
grid.add(code, 0, 1);
|
||||
|
||||
grid.relocate(0, 0);
|
||||
|
||||
grid.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styles.css")).toExternalForm());
|
||||
Scene scene = new Scene(grid, 1845, 800);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.setTitle("Simulator");
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch();
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
|
||||
public static void refreshTable() {
|
||||
grid.getChildren().remove(table);
|
||||
table= Table.refresh();
|
||||
grid.add(table, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
22
src/main/java/fabrik/simulator/pic16f84/DataEntry.java
Normal file
22
src/main/java/fabrik/simulator/pic16f84/DataEntry.java
Normal file
@ -0,0 +1,22 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
public 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(int columnIndex) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,11 @@ public class DataRegister {
|
||||
private static final int PCLATH = 0xA;
|
||||
private static final int INTCON = 0xB;
|
||||
|
||||
private static final int EEDATA = 0x08;
|
||||
private static final int EEADR = 0x09;
|
||||
private static final int EECON1 = 0x88;
|
||||
private static final int EECON2 = 0x89;
|
||||
|
||||
private static final int TRISA = 0x85;
|
||||
private static final int TRISB = 0x86;
|
||||
|
||||
@ -23,6 +28,7 @@ public class DataRegister {
|
||||
|
||||
private static final int [] dataRegister = new int[0xFF];
|
||||
private static final int [] syncedRegisters = {INDF, PCL, STATUS, FSR, PCLATH, INTCON};
|
||||
private static final int [] eepromRegisters = {EEDATA, EEADR, EECON1, EECON2};
|
||||
public static final int [] ioRegisters = {PORTA, PORTB, TRISA, TRISB};
|
||||
|
||||
public static void initDataRegister() {
|
||||
@ -34,10 +40,14 @@ public class DataRegister {
|
||||
dataRegister[0x81] = 0b11111111;
|
||||
dataRegister[0x80 + PCL] = dataRegister[PCL];
|
||||
dataRegister[0x80 + STATUS] = dataRegister[STATUS];
|
||||
dataRegister[TRISA] = 0b11111000;
|
||||
dataRegister[TRISA] = 0b11111111;
|
||||
dataRegister[TRISB] = 0b11111111;
|
||||
dataRegister[0x80 + PCLATH] = dataRegister[PCLATH];
|
||||
dataRegister[0x80 + INTCON] = dataRegister[INTCON];
|
||||
carryFlag = 0;
|
||||
zeroFlag = 0;
|
||||
digitCarryFlag = 0;
|
||||
IOPorts.resetTRIS();
|
||||
System.out.println(Arrays.toString(dataRegister));
|
||||
}
|
||||
|
||||
@ -72,6 +82,8 @@ public class DataRegister {
|
||||
|
||||
public static int getRegister(int fileAddress){
|
||||
int address = determineIndirectAndChange (fileAddress);
|
||||
if (bank () + address == EECON2)
|
||||
return 0;
|
||||
return dataRegister[bank() + address];
|
||||
}
|
||||
|
||||
@ -81,6 +93,10 @@ public class DataRegister {
|
||||
IOPorts.setRegister(bank() + address, content);
|
||||
return;
|
||||
}
|
||||
if (Arrays.stream(eepromRegisters).anyMatch(i -> i == address)){
|
||||
EEPROM.parse(bank() + address, content, 0b11);
|
||||
return;
|
||||
}
|
||||
if (fileAddress == PCL || fileAddress == 0x80 + PCL){
|
||||
programCounter = content + (dataRegister[PCLATH] << 8);
|
||||
}
|
||||
@ -89,11 +105,18 @@ public class DataRegister {
|
||||
else {
|
||||
dataRegister[address] = content;
|
||||
dataRegister[0x80 + address] = content;
|
||||
if (address == STATUS){
|
||||
setFlags();
|
||||
}
|
||||
}
|
||||
if (address == 1)
|
||||
PreScaler.resetFromRegister();
|
||||
}
|
||||
|
||||
public static int getBit(int fileAddress, int bit) {
|
||||
int address = determineIndirectAndChange (fileAddress);
|
||||
if (bank() + address == EECON2)
|
||||
return 0;
|
||||
return (dataRegister[bank() + address] >> bit) & 1;
|
||||
}
|
||||
|
||||
@ -107,6 +130,10 @@ public class DataRegister {
|
||||
IOPorts.clearBit(bank() + address, bit);
|
||||
return;
|
||||
}
|
||||
if (Arrays.stream(eepromRegisters).anyMatch(i -> i == address)){
|
||||
EEPROM.parse(bank () + address, bit, 0b00);
|
||||
return;
|
||||
}
|
||||
if (!isSyncedRegister(address)) {
|
||||
if (getBit(address, bit) == 1) {
|
||||
dataRegister[bank() + address] -= (int) Math.pow(2, bit);
|
||||
@ -116,8 +143,13 @@ public class DataRegister {
|
||||
if (getBit(address, bit) == 1) {
|
||||
dataRegister[address] -= (int) Math.pow(2, bit);
|
||||
dataRegister[0x80 + address] = dataRegister[address];
|
||||
if (address == STATUS){
|
||||
setFlags();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (address == 1)
|
||||
PreScaler.resetFromRegister();
|
||||
}
|
||||
|
||||
public static void setBit(int fileAddress, int bit) {
|
||||
@ -126,6 +158,10 @@ public class DataRegister {
|
||||
IOPorts.setBit(bank() + address, bit);
|
||||
return;
|
||||
}
|
||||
if (Arrays.stream(eepromRegisters).anyMatch(i -> i == address)){
|
||||
EEPROM.parse(bank () + address, bit, 0b10);
|
||||
return;
|
||||
}
|
||||
if (!isSyncedRegister(address)) {
|
||||
if (getBit(address, bit) == 0) {
|
||||
dataRegister[bank() + address] += (int) Math.pow(2, bit);
|
||||
@ -135,8 +171,21 @@ public class DataRegister {
|
||||
if (getBit(address, bit) == 0) {
|
||||
dataRegister[address] += (int) Math.pow(2, bit);
|
||||
dataRegister[0x80 + address] = dataRegister[address];
|
||||
if (address == STATUS){
|
||||
setFlags();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (address == 1)
|
||||
PreScaler.resetFromRegister();
|
||||
}
|
||||
|
||||
public static void setDirectBit (int fileAddress, int bit, int value){
|
||||
if (getDirectBit(fileAddress, bit) == 0 && value == 1){
|
||||
dataRegister[fileAddress] += (int) Math.pow(2, bit);
|
||||
} else if (getDirectBit(fileAddress, bit) == 1 && value == 0){
|
||||
dataRegister[fileAddress] -= (int) Math.pow(2, bit);
|
||||
}
|
||||
}
|
||||
|
||||
private static int programCounter = 0;
|
||||
@ -161,10 +210,20 @@ public class DataRegister {
|
||||
writeToPCL();
|
||||
}
|
||||
|
||||
public static void resetPC () {
|
||||
programCounter = 0;
|
||||
}
|
||||
|
||||
public static int getPC(){
|
||||
return programCounter;
|
||||
}
|
||||
|
||||
private static void setFlags() {
|
||||
carryFlag = getDirectBit(STATUS, C);
|
||||
digitCarryFlag = getDirectBit(STATUS, DC);
|
||||
zeroFlag = getDirectBit(STATUS, Z);
|
||||
}
|
||||
|
||||
private static int zeroFlag = 0;
|
||||
|
||||
public static void determineZeroFlag(int result){
|
||||
@ -184,6 +243,10 @@ public class DataRegister {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getZeroFlag(){
|
||||
return zeroFlag;
|
||||
}
|
||||
|
||||
private static int carryFlag = 0;
|
||||
|
||||
public static void setCarryFlag(int value){
|
||||
@ -234,7 +297,7 @@ public class DataRegister {
|
||||
}
|
||||
|
||||
public static void determineDigitCarryFlag(int result){
|
||||
if (result > 0xF){
|
||||
if (result >> 4 == 1){
|
||||
setDigitCarryFlag(1);
|
||||
}
|
||||
else {
|
||||
@ -268,6 +331,7 @@ public class DataRegister {
|
||||
public static int getDirectRegister(int address) {
|
||||
return dataRegister[address];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
167
src/main/java/fabrik/simulator/pic16f84/EEPROM.java
Normal file
167
src/main/java/fabrik/simulator/pic16f84/EEPROM.java
Normal file
@ -0,0 +1,167 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static fabrik.simulator.pic16f84.Commands.getTotalExecutionTime;
|
||||
|
||||
public class EEPROM {
|
||||
private static final int EEDATA = 0x08;
|
||||
private static final int EEADR = 0x09;
|
||||
private static final int EECON1 = 0x88;
|
||||
private static final int EECON2 = 0x89;
|
||||
|
||||
private static final int RD = 0x00;
|
||||
private static final int WR = 0x01;
|
||||
private static final int WRERR = 0x03;
|
||||
private static final int EEIF = 0x04;
|
||||
|
||||
private static boolean readControl = false;
|
||||
private static boolean writeControl = false;
|
||||
private static boolean [] eecon2stages = {false, false};
|
||||
|
||||
private static long startTime;
|
||||
|
||||
public static long read (int address) {
|
||||
FileReader reader;
|
||||
try {
|
||||
reader = new FileReader("eeprom.json");
|
||||
} catch (FileNotFoundException e) {
|
||||
return 0;
|
||||
}
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject data;
|
||||
try {
|
||||
data = (JSONObject) parser.parse(reader);
|
||||
} catch (ParseException | IOException e) {
|
||||
return 0;
|
||||
}
|
||||
Object requestedData = data.get(String.valueOf(address));
|
||||
try {
|
||||
readControl = false;
|
||||
DataRegister.setDirectBit(EECON1, RD, 0);
|
||||
return (long) requestedData;
|
||||
} catch (NullPointerException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void write (int address, long data) {
|
||||
FileReader reader;
|
||||
try {
|
||||
reader = new FileReader("eeprom.json");
|
||||
} catch (FileNotFoundException ignored) {
|
||||
DataRegister.setDirectBit(EECON1, WRERR, 1);
|
||||
return;
|
||||
}
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject eeprom;
|
||||
try {
|
||||
eeprom = (JSONObject) parser.parse(reader);
|
||||
} catch (ParseException | IOException ignored) {
|
||||
DataRegister.setDirectBit(EECON1, WRERR, 1);
|
||||
return;
|
||||
}
|
||||
eeprom.put(String.valueOf(address), data);
|
||||
try {
|
||||
Files.write(Paths.get("eeprom.json"), eeprom.toJSONString().getBytes());
|
||||
} catch (IOException ignored) {
|
||||
DataRegister.setDirectBit(EECON1, WRERR, 1);
|
||||
return;
|
||||
}
|
||||
registerTime(true);
|
||||
}
|
||||
|
||||
public static void registerTime(boolean reset) {
|
||||
if (reset)
|
||||
startTime = getTotalExecutionTime();
|
||||
else if ((getTotalExecutionTime() >= (startTime + 1000)) && writeControl) {
|
||||
eecon2stages = new boolean[]{false, false};
|
||||
DataRegister.setDirectBit(EECON1, EEIF, 1);
|
||||
DataRegister.setDirectBit(EECON1, WR, 0);
|
||||
writeControl = false;
|
||||
startTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void parse(int address, int content, int opcode) {
|
||||
//OPCODE: 0b1x = set
|
||||
//OPCODE: 0b0x = clear
|
||||
//OPCODE: 0bx1 = byte
|
||||
//OPCODE: 0bx0 = bit
|
||||
switch (opcode){
|
||||
case 0b00: // CLEAR BIT
|
||||
if(address == EECON1) {
|
||||
if (DataRegister.getDirectBit(address, content) == 1)
|
||||
setEECON1((int) (DataRegister.getDirectRegister(EECON1) - Math.pow(2, content)));
|
||||
} else {
|
||||
DataRegister.setDirectBit(address, content, 0);
|
||||
}
|
||||
break;
|
||||
case 0b10: // SET BIT
|
||||
if(address == EECON1) {
|
||||
if (DataRegister.getDirectBit(address, content) == 0)
|
||||
setEECON1((int) (DataRegister.getDirectRegister(EECON1) + Math.pow(2, content)));
|
||||
} else {
|
||||
if (address == EEADR && content >= 0b01000000)
|
||||
DataRegister.setDirectBit(address, content, 0);
|
||||
else
|
||||
DataRegister.setDirectBit(address, content, 1);
|
||||
}
|
||||
break;
|
||||
case 0b11: // SET BYTE
|
||||
if(address == EECON1) {
|
||||
setEECON1 (content);
|
||||
} else {
|
||||
if (address == EEADR)
|
||||
content &= 0b00111111;
|
||||
else if (address == EECON2) {
|
||||
if (content == 0x55)
|
||||
eecon2stages [0] = true;
|
||||
else if (content == 0xAA && eecon2stages[0])
|
||||
eecon2stages [1] = true;
|
||||
else
|
||||
eecon2stages = new boolean[]{false, false};
|
||||
}
|
||||
DataRegister.setDirectRegister(address, content);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void setEECON1(int content) {
|
||||
content &= 0b00011111;
|
||||
boolean writeEnabled = ((content & 0b100) >> 2) == 1;
|
||||
if ((content & 0b1) == 1) { // READ
|
||||
readControl = true;
|
||||
DataRegister.setDirectRegister(EECON1, content);
|
||||
int data = (int) read(DataRegister.getDirectRegister(EEADR));
|
||||
DataRegister.setDirectRegister(EEDATA, data);
|
||||
return;
|
||||
}
|
||||
else if ((content & 0b1) == 0 && readControl) // RD kann nicht manuell gecleart werden
|
||||
content |= 0b1;
|
||||
if (((content & 0b10) >> 1) == 1) { // WRITE CONTROL
|
||||
if (writeEnabled && eecon2stages[0] && eecon2stages[1]) {
|
||||
writeControl = true;
|
||||
DataRegister.setDirectRegister(EECON1, content);
|
||||
write(DataRegister.getDirectRegister(EEADR), DataRegister.getDirectRegister(EEDATA));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
content -= 0b10;
|
||||
}
|
||||
}
|
||||
else if ((((content & 0b10) >> 1) == 0) && writeControl) // WR kann nicht manuell gecleart werden
|
||||
content |= 0b10;
|
||||
DataRegister.setDirectRegister(EECON1, content);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,16 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.RadialGradient;
|
||||
import javafx.scene.paint.Stop;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IOPorts {
|
||||
private static final int A = 0;
|
||||
private static final int B = 1;
|
||||
@ -8,8 +19,19 @@ public class IOPorts {
|
||||
private static final int TRISA = 0x85;
|
||||
private static final int TRISB = 0x86;
|
||||
|
||||
private static int [] trisLatch = new int[2];
|
||||
private static int [] trisLatch = {0xFF, 0xFF};
|
||||
private static int [] dataLatch = new int[2];
|
||||
private static boolean isLEDenabledA = false;
|
||||
private static boolean isLEDenabledB = false;
|
||||
private static Circle[] allLEDsA;
|
||||
private static Circle[] allLEDsB;
|
||||
|
||||
|
||||
private static int RB4 = 0x10;
|
||||
private static int RB5 = 0x20;
|
||||
private static int RB6 = 0x40;
|
||||
private static int RB7 = 0x80;
|
||||
|
||||
|
||||
public static void setBit (int address, int bit){
|
||||
if (address < 7) {
|
||||
@ -28,7 +50,7 @@ public class IOPorts {
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (DataRegister.getDirectBit(address, bit) == 1) {
|
||||
if (((trisLatch[address-TRISA] >> bit)&1) == 1){
|
||||
trisLatch[address-TRISA] -= (int) Math.pow(2, bit);
|
||||
}
|
||||
}
|
||||
@ -46,7 +68,158 @@ public class IOPorts {
|
||||
}
|
||||
|
||||
private static void refreshPorts() {
|
||||
System.out.println("PORTA: " + DataRegister.getDirectRegister(PORTA) + "; DATALATCHA: " + dataLatch[A] + "; TRISA: " + trisLatch[A]);
|
||||
System.out.println("PORTB: " + DataRegister.getDirectRegister(PORTB) + "; DATALATCHB: " + dataLatch[B] + "; TRISB: " + trisLatch[B]);
|
||||
DataRegister.setDirectRegister(PORTA, ((~((~dataLatch[A])&0x1F | trisLatch[A])) | (trisLatch[A] & DataRegister.getDirectRegister(PORTA))) & 0xFF);
|
||||
DataRegister.setDirectRegister(PORTB, ((~((~dataLatch[B])&0xFF | trisLatch[B])) | (trisLatch[B] & DataRegister.getDirectRegister(PORTB))) & 0xFF);
|
||||
DataRegister.setDirectRegister(TRISA, trisLatch[A]);
|
||||
DataRegister.setDirectRegister(TRISB, trisLatch[B]);
|
||||
if (((trisLatch[A] >> 4) & 1 )== 1)
|
||||
Timer.incrementFromPin(DataRegister.getDirectRegister(PORTA));
|
||||
ToggleButtonGroup[] buttons = Controller_Frontend.getPORTbuttons();
|
||||
for (int i = 0; i < buttons.length; i++){
|
||||
int port = (i < 8) ? PORTA : PORTB;
|
||||
int bit = i % 8;
|
||||
boolean value = ((DataRegister.getDirectRegister(port) >> bit) & 1) == 1;
|
||||
buttons[i].getToggles().get(0).setSelected(!value);
|
||||
buttons[i].getToggles().get(1).setSelected(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void refreshUI(ToggleButtonGroup[] buttonsTRIS, ToggleButtonGroup[] buttonsPORT) {
|
||||
for (int i = 0; i< buttonsTRIS.length; i++){
|
||||
int tris = (i < 8) ? trisLatch[A] : trisLatch[B];
|
||||
boolean val = isInput(tris, i%8);
|
||||
buttonsPORT[i].setDisable(!val);
|
||||
buttonsTRIS[i].getToggles().get(0).setSelected(val);
|
||||
buttonsTRIS[i].getToggles().get(1).setSelected(!val);
|
||||
updateLEDs(true, i, val);
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateLEDs(boolean updateAll, int index, boolean val) {
|
||||
if (updateAll) {
|
||||
if (index < 8) {
|
||||
if (isLEDenabledA && !val) {
|
||||
if (DataRegister.getDirectBit(PORTA, index) == 1)
|
||||
allLEDsA[index].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
else
|
||||
allLEDsA[index].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
}
|
||||
} else {
|
||||
if (isLEDenabledB && !val) {
|
||||
if (DataRegister.getDirectBit(PORTB, index - 8) == 1)
|
||||
allLEDsB[index - 8].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.RED), new Stop(1, Color.DARKGRAY)));
|
||||
else
|
||||
allLEDsB[index - 8].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (index < 8)
|
||||
if (val || DataRegister.getDirectBit(PORTA, index) == 0)
|
||||
allLEDsA[index].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
else
|
||||
allLEDsA[index].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.RED), new Stop(1, Color.DARKGRAY)));
|
||||
else
|
||||
if (val || DataRegister.getDirectBit(PORTB, index - 8) == 0)
|
||||
allLEDsB[index - 8].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
else
|
||||
allLEDsB[index - 8].setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.RED), new Stop(1, Color.DARKGRAY)));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isInput(int i, int bit) {
|
||||
return (i >> bit & 1) == 1;
|
||||
}
|
||||
|
||||
public static void setTRISfromUI(ToggleButtonGroup parent) throws IOException {
|
||||
int [] params = getToggleParams(parent);
|
||||
int tris = params[0];
|
||||
int bit = params[1];
|
||||
int value = params[2];
|
||||
ToggleButtonGroup [] buttonsPORT = Controller_Frontend.getPORTbuttons();
|
||||
if (value == 1){
|
||||
setBit(tris, bit);
|
||||
buttonsPORT[(tris-TRISA)*8 + bit].setDisable(false);
|
||||
}
|
||||
else{
|
||||
clearBit(tris, bit);
|
||||
buttonsPORT[(tris-TRISA)*8 + bit].setDisable(true);
|
||||
}
|
||||
updateLEDs(false, (tris-TRISA)*8 + bit, value == 1);
|
||||
refreshPorts();
|
||||
refreshTable(parent);
|
||||
}
|
||||
|
||||
public static void setPORTfromUI(ToggleButtonGroup parent) throws IOException {
|
||||
int [] params = getToggleParams(parent);
|
||||
int port = params[0];
|
||||
int bit = params[1];
|
||||
int value = params [2];
|
||||
value = (value == 1) ? 0 : 1;
|
||||
int oldValue = DataRegister.getDirectBit(port, bit);
|
||||
DataRegister.setDirectBit(port, bit, value);
|
||||
refreshPorts();
|
||||
refreshTable(parent);
|
||||
if (port == PORTB && bit >= 4)
|
||||
Interrupts.triggerRBInterrupt(oldValue, value);
|
||||
else if (port == PORTB && bit == 0)
|
||||
Interrupts.triggerRB0Interrupt(oldValue, value);
|
||||
}
|
||||
|
||||
public static void setLEDs (boolean[] leds) {
|
||||
boolean isAnowDisabled = isLEDenabledA && !leds[0];
|
||||
isLEDenabledA = leds[0];
|
||||
boolean isBnowDisabled = isLEDenabledB && !leds[1];
|
||||
isLEDenabledB = leds[1];
|
||||
if (isAnowDisabled){
|
||||
for (Circle circle : allLEDsA) {
|
||||
circle.setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
}
|
||||
}
|
||||
if (isBnowDisabled){
|
||||
for (Circle circle : allLEDsB) {
|
||||
circle.setFill(new RadialGradient(0, 0, 0.5, 0.5, 0.7, true, null, new Stop(0, Color.BLACK), new Stop(1, Color.DARKGRAY)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLEDs (Circle[] a, Circle[] b){
|
||||
allLEDsA = a;
|
||||
allLEDsB = b;
|
||||
}
|
||||
|
||||
public static void refreshTable(ToggleButtonGroup parent) {
|
||||
Table.refresh();
|
||||
CreateWindow.refreshTable();
|
||||
}
|
||||
|
||||
private static int[] getToggleParams(ToggleButtonGroup parent) {
|
||||
String group = parent.getId();
|
||||
ObservableList<ToggleButton> toggles = parent.getToggles();
|
||||
int fileAddress;
|
||||
if (group.contains("TRIS"))
|
||||
if (group.contains("A"))
|
||||
fileAddress = TRISA;
|
||||
else
|
||||
fileAddress = TRISB;
|
||||
else
|
||||
if (group.contains("A"))
|
||||
fileAddress = PORTA;
|
||||
else
|
||||
fileAddress = PORTB;
|
||||
char index =group.charAt(group.length()-1);
|
||||
int bit = Integer.parseInt(String.valueOf(index));
|
||||
int value = (toggles.get(0).isSelected()) ? 1 : 0;
|
||||
return new int[]{fileAddress, bit, value};
|
||||
}
|
||||
|
||||
public static void reset() {
|
||||
trisLatch = new int[]{0xFF, 0xFF};
|
||||
dataLatch = new int[2];
|
||||
refreshPorts();
|
||||
}
|
||||
|
||||
public static void resetTRIS (){
|
||||
trisLatch = new int[] {0xFF, 0xFF};
|
||||
}
|
||||
}
|
||||
|
||||
58
src/main/java/fabrik/simulator/pic16f84/Interrupts.java
Normal file
58
src/main/java/fabrik/simulator/pic16f84/Interrupts.java
Normal file
@ -0,0 +1,58 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
public class Interrupts {
|
||||
private static final int INTCON = 0xB;
|
||||
private static final int T0IF = 0x2;
|
||||
private static final int ISR = 0x4;
|
||||
private static final int GIE = 0x7;
|
||||
private static final int T0IE = 0x5;
|
||||
private static final int RBIE = 0x3;
|
||||
private static final int RBIF = 0x0;
|
||||
private static final int INTEDG = 0x6;
|
||||
private static final int OPTION = 0x81;
|
||||
private static final int INTE = 0x4;
|
||||
private static final int INTF = 0x1;
|
||||
|
||||
public static void triggerTMR0(boolean manual) {
|
||||
triggerInterrupt(T0IF, T0IE);
|
||||
if (manual)
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
|
||||
private static void triggerInterrupt(int flag, int enableFlag) {
|
||||
DataRegister.setBit(INTCON, flag);
|
||||
enableFlag = DataRegister.getDirectBit(INTCON, enableFlag);
|
||||
int globalFlag = DataRegister.getDirectBit(INTCON, GIE);
|
||||
if (enableFlag == 1) {
|
||||
Controller_Frontend.wakeUpFromSleep();
|
||||
if (globalFlag == 1) {
|
||||
DataRegister.clearBit(INTCON, GIE);
|
||||
Commands.CALL(ISR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void triggerRBInterrupt(int oldValue, int newValue) {
|
||||
if (newValue != oldValue){
|
||||
triggerInterrupt(RBIF, RBIE);
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
}
|
||||
|
||||
public static void triggerRB0Interrupt(int oldValue, int newValue){
|
||||
if (newValue != oldValue){
|
||||
int intedg = DataRegister.getDirectBit(OPTION, INTEDG);
|
||||
if (intedg == 1) {
|
||||
if (oldValue == 0 && newValue == 1)
|
||||
triggerInterrupt(INTF, INTE);
|
||||
} else {
|
||||
if (oldValue == 1 && newValue == 0)
|
||||
triggerInterrupt(INTF, INTE);
|
||||
}
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ParseFile {
|
||||
public static int[] parseDatei(String dateiPfad) {
|
||||
public static int[][] parseDatei(String dateiPfad) {
|
||||
List<String> zeilen = new ArrayList<>();
|
||||
|
||||
// Bei diesem Schritt wird jetzt Zeile für Zeile das richtige Programm eingelesen
|
||||
@ -23,10 +23,12 @@ public class ParseFile {
|
||||
|
||||
// Initialisierung des Programmspeichers mit 1024 Speicherplätzen
|
||||
int[] programmspeicher = new int[1024]; // Wie viele Programmspeicherplätze gibt es? → 1024
|
||||
int[] zeilenspeicher = new int[1024];
|
||||
|
||||
// Adresse und Befehle werden ignoriert und nur die Befehle werden in den Programmspeicher gespeichert
|
||||
|
||||
for (String zeile : zeilen) {
|
||||
for (int i = 0; i<zeilen.toArray().length; i++) {
|
||||
String zeile = zeilen.get(i);
|
||||
String[] teile = zeile.split("\\s+"); // Spaltenweise werden die einzelnen Befehle getrennt
|
||||
if (teile.length >= 2) {
|
||||
try {
|
||||
@ -36,6 +38,7 @@ public class ParseFile {
|
||||
// Ausgabe der eingelesenen Zeile
|
||||
System.out.printf("Gelesene Zeile: %s%n", zeile);
|
||||
|
||||
zeilenspeicher[adresse] = i;
|
||||
programmspeicher[adresse] = befehl; // Befehl im Programmspeicher speichern
|
||||
} catch (NumberFormatException e) {
|
||||
// Wenn ein Fehler aufkommt, wird diese Zeile ignoriert funktioniert
|
||||
@ -44,6 +47,6 @@ public class ParseFile {
|
||||
}
|
||||
}
|
||||
|
||||
return programmspeicher;
|
||||
return new int[][]{programmspeicher, zeilenspeicher};
|
||||
}
|
||||
}
|
||||
|
||||
42
src/main/java/fabrik/simulator/pic16f84/PreScaler.java
Normal file
42
src/main/java/fabrik/simulator/pic16f84/PreScaler.java
Normal file
@ -0,0 +1,42 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
public class PreScaler {
|
||||
private static final int PSA = 0x3;
|
||||
private static final int OPTION = 0x81;
|
||||
|
||||
private static int scaler = 0b111;
|
||||
|
||||
public static boolean isPrescalerOnTimer (){
|
||||
return DataRegister.getDirectBit(OPTION, PSA) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static int getScaler() {
|
||||
return scaler;
|
||||
}
|
||||
|
||||
public static int getFactor () {
|
||||
int scale = DataRegister.getDirectRegister(OPTION) & 0b111;
|
||||
int timer = isPrescalerOnTimer() ? 1 : 0;
|
||||
return (int) Math.pow (2, scale+timer);
|
||||
}
|
||||
|
||||
public static void reset (){
|
||||
DataRegister.setDirectBit(OPTION, 0, 0);
|
||||
DataRegister.setDirectBit(OPTION, 1, 0);
|
||||
DataRegister.setDirectBit(OPTION, 2, 0);
|
||||
}
|
||||
|
||||
public static void resetFromRegister() {
|
||||
scaler = getFactor();
|
||||
}
|
||||
|
||||
public static void decrement(boolean manual) {
|
||||
scaler--;
|
||||
if (scaler == 0) {
|
||||
scaler = getFactor();
|
||||
Timer.increment(manual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,11 @@ public class ProgramStack {
|
||||
return returnStack.get(stackIndex)-1;
|
||||
}
|
||||
|
||||
public static void reset (){
|
||||
returnStack.clear();
|
||||
stackIndex = 0;
|
||||
}
|
||||
|
||||
public static int getStackPointer(){
|
||||
return stackIndex;
|
||||
}
|
||||
|
||||
161
src/main/java/fabrik/simulator/pic16f84/Table.java
Normal file
161
src/main/java/fabrik/simulator/pic16f84/Table.java
Normal file
@ -0,0 +1,161 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.geometry.Insets;
|
||||
|
||||
import javafx.scene.chart.PieChart;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
|
||||
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 = 425; // Breite der TableView
|
||||
private static final double TABLE_HEIGHT = 600; // Höhe der TableView
|
||||
|
||||
private static String formatHex(String s) {
|
||||
return (s.length() == 1) ? "0" + s : s;
|
||||
}
|
||||
|
||||
private static String formatBin (String s){
|
||||
int l = s.length();
|
||||
if (l < 8){
|
||||
StringBuilder sBuilder = new StringBuilder(s);
|
||||
for (int i = 0; i < 8 - l; i++){
|
||||
sBuilder.insert(0, "0");
|
||||
}
|
||||
s = sBuilder.toString();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
public static VBox refresh(){
|
||||
// Erstelle eine Instanz der DataRegister-Klasse
|
||||
|
||||
|
||||
// Erstelle eine TableView für die Datenanzeige
|
||||
TableView<DataEntry[]> tableView = new TableView<>();
|
||||
tableView.setPrefWidth(TABLE_WIDTH);
|
||||
tableView.setPrefHeight(TABLE_HEIGHT);
|
||||
|
||||
|
||||
|
||||
|
||||
// Erstelle Spalten für die TableView
|
||||
for (int i = 0; i < NUM_COLUMNS; i++) {
|
||||
TableColumn<DataEntry[], String> 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" + formatHex(Integer.toHexString(index).toUpperCase());
|
||||
String value = "0x" + formatHex(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 spacing = new Label(" ");
|
||||
Label spacing2 = new Label(" ");
|
||||
Label wRegisterLabel = new Label("W-Register: 0x" + formatHex(Integer.toHexString(Commands.get_wRegister()).toUpperCase()));
|
||||
Label cLabel = new Label("Carry-Flag: " + DataRegister.getCarryFlag());
|
||||
Label dcLabel = new Label("DigitCarry-Flag: " + DataRegister.getDigitCarryFlag());
|
||||
Label zLabel = new Label("Zero-Flag: " + DataRegister.getZeroFlag());
|
||||
Label pcLabel = new Label("PC: 0x" + formatHex(Integer.toHexString(DataRegister.getPC()).toUpperCase()));
|
||||
Label pclLabel = new Label("PCL: 0x" + formatHex(Integer.toHexString(DataRegister.getRegister(DataRegister.getPCL())).toUpperCase()));
|
||||
Label pclathLabel = new Label("PCLATH: 0x" + formatHex(Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase()));
|
||||
Label statusLabel = new Label("STATUS: 0b" + formatBin(Integer.toBinaryString(DataRegister.getRegister(DataRegister.getSTATUS())))+ " (0x" + formatHex(Integer.toHexString(DataRegister.getRegister(DataRegister.getSTATUS())).toUpperCase()) + ")");
|
||||
Label fsrLabel = new Label("FSR: 0x" + formatHex(Integer.toHexString(DataRegister.getFSR()).toUpperCase()));
|
||||
Label prescalerLabel = new Label("Prescaler: 0x" + formatHex(Integer.toHexString(PreScaler.getScaler())).toUpperCase());
|
||||
Label intconLabel = new Label("INTCON: 0b" + formatBin(Integer.toBinaryString(DataRegister.getRegister(DataRegister.getINTCON()))) + " (0x" + formatHex(Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase()) + ")");
|
||||
wRegisterLabel.setStyle("-fx-font-weight: bold");
|
||||
pcLabel.setStyle("-fx-font-weight: bold");
|
||||
statusLabel.setStyle("-fx-font-weight: bold");
|
||||
intconLabel.setStyle("-fx-font-weight: bold");
|
||||
|
||||
HBox labelsAndButton = new HBox();
|
||||
VBox labels = new VBox();
|
||||
labels.getChildren().addAll(spacing, pcLabel, pclLabel, pclathLabel, wRegisterLabel, cLabel, dcLabel, zLabel, statusLabel, fsrLabel, prescalerLabel, intconLabel);
|
||||
VBox button = new VBox();
|
||||
Button resetButton = new Button("SFR reset");
|
||||
resetButton.setOnAction(e -> {
|
||||
triggerReset();
|
||||
});
|
||||
|
||||
button.getChildren().addAll(spacing2, resetButton);
|
||||
|
||||
labelsAndButton.getChildren().addAll(labels, button);
|
||||
|
||||
|
||||
// Erstelle einen VBox, um die TableView und Labels anzuzeigen
|
||||
VBox table = new VBox();
|
||||
table.getChildren().addAll(tableView, labelsAndButton);
|
||||
VBox.setMargin(tableView, new Insets(0, 0, 0, 0));
|
||||
|
||||
return table;
|
||||
|
||||
}
|
||||
|
||||
private static void triggerReset() {
|
||||
DataRegister.initDataRegister();
|
||||
IOPorts.refreshUI(Controller_Frontend.getTRISbuttons(), Controller_Frontend.getPORTbuttons());
|
||||
CreateWindow.refreshTable();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
61
src/main/java/fabrik/simulator/pic16f84/Timer.java
Normal file
61
src/main/java/fabrik/simulator/pic16f84/Timer.java
Normal file
@ -0,0 +1,61 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
public class Timer {
|
||||
private static final int TIMERREG = 0x1;
|
||||
private static final int T0SE = 0x4;
|
||||
private static final int T0CS = 0x5;
|
||||
private static final int OPTION = 0x81;
|
||||
|
||||
private static int oldpin = 0;
|
||||
|
||||
|
||||
public static void cycles(int cycles){
|
||||
if (DataRegister.getDirectBit(OPTION, T0CS) == 0){
|
||||
if (PreScaler.isPrescalerOnTimer()){
|
||||
for (int i = 0; i < cycles; i++){
|
||||
PreScaler.decrement(false);
|
||||
}
|
||||
} else {
|
||||
increment(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void incrementFromPin (int register){
|
||||
if ((DataRegister.getDirectBit(OPTION, T0CS) == 1) && !Controller_Frontend.isSleeping()){
|
||||
int newpin = (register >> 4) & 1;
|
||||
if (newpin != oldpin) {
|
||||
if (DataRegister.getDirectBit(OPTION, T0SE) == 0) {
|
||||
// Low to high
|
||||
if (newpin == 1 && oldpin == 0) {
|
||||
if (PreScaler.isPrescalerOnTimer())
|
||||
PreScaler.decrement(true);
|
||||
else
|
||||
increment(true);
|
||||
}
|
||||
} else {
|
||||
// High to low
|
||||
if (newpin == 0 && oldpin == 1) {
|
||||
if (PreScaler.isPrescalerOnTimer())
|
||||
PreScaler.decrement(true);
|
||||
else
|
||||
increment(true);
|
||||
}
|
||||
}
|
||||
oldpin = newpin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void increment(boolean manual) {
|
||||
int timer = DataRegister.getDirectRegister(TIMERREG);
|
||||
timer++;
|
||||
if (timer > 0xFF){
|
||||
Interrupts.triggerTMR0(manual);
|
||||
DataRegister.setDirectRegister(TIMERREG, 0);
|
||||
} else {
|
||||
DataRegister.setDirectRegister(1, timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Toggle;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ToggleButtonGroupExt {
|
||||
private static ToggleButtonGroupExt me;
|
||||
|
||||
private ToggleButtonGroupExt() {
|
||||
}
|
||||
|
||||
public static ToggleButtonGroupExt get() {
|
||||
if (me == null) {
|
||||
me = new ToggleButtonGroupExt();
|
||||
}
|
||||
return me;
|
||||
}
|
||||
|
||||
|
||||
public void addAlwaysOneSelectedSupport(final ToggleButtonGroup toggleGroup) {
|
||||
toggleGroup.getToggles().addListener((ListChangeListener.Change<? extends Toggle> c) -> {
|
||||
while (c.next()) {
|
||||
for (final Toggle addedToggle : c.getAddedSubList()) {
|
||||
addConsumeMouseEventfilter(addedToggle);
|
||||
}
|
||||
}
|
||||
});
|
||||
toggleGroup.getToggles().forEach(this::addConsumeMouseEventfilter);
|
||||
}
|
||||
|
||||
private void addConsumeMouseEventfilter(Toggle toggle) {
|
||||
((ToggleButton) toggle).addEventFilter(MouseEvent.MOUSE_PRESSED, consumeMouseEventfilter);
|
||||
((ToggleButton) toggle).addEventFilter(MouseEvent.MOUSE_RELEASED, consumeMouseEventfilter);
|
||||
((ToggleButton) toggle).addEventFilter(MouseEvent.MOUSE_CLICKED, consumeMouseEventfilter);
|
||||
}
|
||||
|
||||
public EventHandler<MouseEvent> consumeMouseEventfilter = (MouseEvent mouseEvent) -> {
|
||||
if (((Toggle) mouseEvent.getSource()).isSelected()) {
|
||||
ToggleButtonGroup parent = (ToggleButtonGroup) ((ToggleButton) mouseEvent.getSource()).getParent();
|
||||
if (parent.getId().contains("TRIS")) {
|
||||
try {
|
||||
IOPorts.setTRISfromUI(parent);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
IOPorts.setPORTfromUI(parent);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
mouseEvent.consume();
|
||||
}
|
||||
};
|
||||
}
|
||||
49
src/main/java/fabrik/simulator/pic16f84/WatchdogTimer.java
Normal file
49
src/main/java/fabrik/simulator/pic16f84/WatchdogTimer.java
Normal file
@ -0,0 +1,49 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
public class WatchdogTimer {
|
||||
private static long watchdogTime;
|
||||
private static long lastReset = 0;
|
||||
private static boolean enabled = false;
|
||||
private static long rawtimer = 0;
|
||||
private static long realtimer = 0;
|
||||
|
||||
private static long getTimeFromRegister() {
|
||||
return (PreScaler.isPrescalerOnTimer()) ? 18L : PreScaler.getFactor() * 18L;
|
||||
}
|
||||
|
||||
public static void testAndTrigger() {
|
||||
watchdogTime = getTimeFromRegister() * 1000;
|
||||
if (enabled) {
|
||||
if (realtimer >= (watchdogTime + lastReset - 1)) {
|
||||
DataRegister.clearBit(3, 4);
|
||||
lastReset = Commands.getTotalExecutionTime();
|
||||
Controller_Frontend.stopRunFromBackend("Watchdog Timer");
|
||||
}
|
||||
else {
|
||||
rawtimer++;
|
||||
realtimer = (long) (rawtimer * Controller_Frontend.getExecutionTimeMultiplier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void reset (){
|
||||
lastReset = Commands.getTotalExecutionTime();
|
||||
rawtimer = 0;
|
||||
realtimer = 0;
|
||||
PreScaler.reset();
|
||||
DataRegister.setBit(3, 3);
|
||||
DataRegister.setBit(3, 4);
|
||||
}
|
||||
|
||||
public static void enable() {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public static void disable() {
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
public static long get (){
|
||||
return realtimer;
|
||||
}
|
||||
}
|
||||
10
src/main/java/fabrik/simulator/pic16f84/styles.css
Normal file
10
src/main/java/fabrik/simulator/pic16f84/styles.css
Normal file
@ -0,0 +1,10 @@
|
||||
.breakpoint-icon {
|
||||
-fx-background-color: transparent;
|
||||
-fx-shape: "M 0 0 L 10 5 L 0 10 Z"; /* Dreieck-Symbol */
|
||||
-fx-background-insets: 0;
|
||||
-fx-padding: 0;
|
||||
-fx-background-radius: 0;
|
||||
-fx-shape-padding: 0;
|
||||
-fx-scale-shape: false;
|
||||
-fx-cursor: hand;
|
||||
}
|
||||
@ -6,6 +6,9 @@ module fabrik.simulator.pic16f84 {
|
||||
requires org.controlsfx.controls;
|
||||
requires org.kordamp.ikonli.javafx;
|
||||
requires eu.hansolo.tilesfx;
|
||||
requires charm.glisten;
|
||||
requires jdk.jsobject;
|
||||
requires json.simple;
|
||||
|
||||
opens fabrik.simulator.pic16f84 to javafx.fxml;
|
||||
exports fabrik.simulator.pic16f84;
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane prefHeight="500.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fabrik.simulator.pic16f84.Controller_FileSelect">
|
||||
<VBox alignment="CENTER" prefHeight="500.0" prefWidth="500.0" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<Label text="Willkommen beim PIC-Simulator!" textAlignment="CENTER">
|
||||
<padding>
|
||||
<Insets bottom="10.0"/>
|
||||
</padding>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0"/>
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Button mnemonicParsing="false" onAction="#selectFileLST" text="Datei auswählen!"/>
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
|
||||
|
||||
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fabrik.simulator.pic16f84.Controller_MainBody">
|
||||
<VBox alignment="CENTER" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Hauptseite"/>
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
1064
src/main/resources/fabrik/simulator/pic16f84/frontend.fxml
Normal file
1064
src/main/resources/fabrik/simulator/pic16f84/frontend.fxml
Normal file
File diff suppressed because it is too large
Load Diff
3
src/main/resources/fabrik/simulator/pic16f84/styles.css
Normal file
3
src/main/resources/fabrik/simulator/pic16f84/styles.css
Normal file
@ -0,0 +1,3 @@
|
||||
.list-cell:selected {
|
||||
-fx-background-color: red;
|
||||
}
|
||||
Reference in New Issue
Block a user