diff --git a/bin/Control/MyControlModel.class b/bin/Control/MyControlModel.class index 8aafdbe..cf8cfa6 100644 Binary files a/bin/Control/MyControlModel.class and b/bin/Control/MyControlModel.class differ diff --git a/bin/Control/MyControlView.class b/bin/Control/MyControlView.class index e547e2d..1423b70 100644 Binary files a/bin/Control/MyControlView.class and b/bin/Control/MyControlView.class differ diff --git a/bin/In.class b/bin/In.class deleted file mode 100644 index 6d4bd51..0000000 Binary files a/bin/In.class and /dev/null differ diff --git a/bin/Model/Backend/InterruptHandling/InterruptServiceHandler.class b/bin/Model/Backend/InterruptHandling/InterruptServiceHandler.class deleted file mode 100644 index 72b7b11..0000000 Binary files a/bin/Model/Backend/InterruptHandling/InterruptServiceHandler.class and /dev/null differ diff --git a/bin/Model/Backend/InterruptHandling/InterruptServiceHandlingTable.class b/bin/Model/Backend/InterruptHandling/InterruptServiceHandlingTable.class deleted file mode 100644 index 3917047..0000000 Binary files a/bin/Model/Backend/InterruptHandling/InterruptServiceHandlingTable.class and /dev/null differ diff --git a/bin/Model/Backend/Microcontroller/Bitmask.class b/bin/Model/Backend/Microcontroller/Bitmask.class deleted file mode 100644 index d231ce4..0000000 Binary files a/bin/Model/Backend/Microcontroller/Bitmask.class and /dev/null differ diff --git a/bin/Model/Backend/Microcontroller/EEPROM.class b/bin/Model/Backend/Microcontroller/EEPROM.class deleted file mode 100644 index 1dcbda2..0000000 Binary files a/bin/Model/Backend/Microcontroller/EEPROM.class and /dev/null differ diff --git a/bin/Model/Backend/Microcontroller/PIC.class b/bin/Model/Backend/Microcontroller/PIC.class deleted file mode 100644 index f12c943..0000000 Binary files a/bin/Model/Backend/Microcontroller/PIC.class and /dev/null differ diff --git a/bin/Model/Backend/Microcontroller/RAM.class b/bin/Model/Backend/Microcontroller/RAM.class deleted file mode 100644 index 6f25dff..0000000 Binary files a/bin/Model/Backend/Microcontroller/RAM.class and /dev/null differ diff --git a/bin/Model/Backend/Microcontroller/STACK.class b/bin/Model/Backend/Microcontroller/STACK.class deleted file mode 100644 index 700ee44..0000000 Binary files a/bin/Model/Backend/Microcontroller/STACK.class and /dev/null differ diff --git a/bin/Model/Backend/MyModel.class b/bin/Model/Backend/MyModel.class deleted file mode 100644 index 639bf7f..0000000 Binary files a/bin/Model/Backend/MyModel.class and /dev/null differ diff --git a/bin/Model/Backend/Runtime/Environment.class b/bin/Model/Backend/Runtime/Environment.class deleted file mode 100644 index b60a699..0000000 Binary files a/bin/Model/Backend/Runtime/Environment.class and /dev/null differ diff --git a/bin/Model/Backend/Runtime/Main.class b/bin/Model/Backend/Runtime/Main.class deleted file mode 100644 index b4e6ce5..0000000 Binary files a/bin/Model/Backend/Runtime/Main.class and /dev/null differ diff --git a/bin/Model/Backend/Runtime/ProgramStepInformation.class b/bin/Model/Backend/Runtime/ProgramStepInformation.class deleted file mode 100644 index f9ca59c..0000000 Binary files a/bin/Model/Backend/Runtime/ProgramStepInformation.class and /dev/null differ diff --git a/bin/Model/Backend/Runtime/TODO.class b/bin/Model/Backend/Runtime/TODO.class deleted file mode 100644 index 0721185..0000000 Binary files a/bin/Model/Backend/Runtime/TODO.class and /dev/null differ diff --git a/bin/Model/Backend/Runtime/Testfile.class b/bin/Model/Backend/Runtime/Testfile.class deleted file mode 100644 index f757b25..0000000 Binary files a/bin/Model/Backend/Runtime/Testfile.class and /dev/null differ diff --git a/bin/Model/Backend/Runtime/WATCHDOG.class b/bin/Model/Backend/Runtime/WATCHDOG.class deleted file mode 100644 index 7bcb98a..0000000 Binary files a/bin/Model/Backend/Runtime/WATCHDOG.class and /dev/null differ diff --git a/bin/Model/Backend/Statistics/ErrorHandling/BackendErrorCounter.class b/bin/Model/Backend/Statistics/ErrorHandling/BackendErrorCounter.class deleted file mode 100644 index 1889d08..0000000 Binary files a/bin/Model/Backend/Statistics/ErrorHandling/BackendErrorCounter.class and /dev/null differ diff --git a/bin/Model/Backend/BackendCommandProcessing/InformationConnecter.class b/bin/Model/BackendCommandProcessing/InformationConnecter.class similarity index 88% rename from bin/Model/Backend/BackendCommandProcessing/InformationConnecter.class rename to bin/Model/BackendCommandProcessing/InformationConnecter.class index eea89a2..933725e 100644 Binary files a/bin/Model/Backend/BackendCommandProcessing/InformationConnecter.class and b/bin/Model/BackendCommandProcessing/InformationConnecter.class differ diff --git a/bin/Model/Backend/EepromLoader/ReadEepromFile.class b/bin/Model/EepromLoader/ReadEepromFile.class similarity index 82% rename from bin/Model/Backend/EepromLoader/ReadEepromFile.class rename to bin/Model/EepromLoader/ReadEepromFile.class index ce6d8e7..8a1fd98 100644 Binary files a/bin/Model/Backend/EepromLoader/ReadEepromFile.class and b/bin/Model/EepromLoader/ReadEepromFile.class differ diff --git a/bin/Model/InterruptHandling/InterruptServiceHandler.class b/bin/Model/InterruptHandling/InterruptServiceHandler.class new file mode 100644 index 0000000..146433d Binary files /dev/null and b/bin/Model/InterruptHandling/InterruptServiceHandler.class differ diff --git a/bin/Model/InterruptHandling/InterruptServiceHandlingTable.class b/bin/Model/InterruptHandling/InterruptServiceHandlingTable.class new file mode 100644 index 0000000..f08b575 Binary files /dev/null and b/bin/Model/InterruptHandling/InterruptServiceHandlingTable.class differ diff --git a/bin/Model/Microcontroller/Bitmask.class b/bin/Model/Microcontroller/Bitmask.class new file mode 100644 index 0000000..7a04e49 Binary files /dev/null and b/bin/Model/Microcontroller/Bitmask.class differ diff --git a/bin/Model/Microcontroller/EEPROM.class b/bin/Model/Microcontroller/EEPROM.class new file mode 100644 index 0000000..7c5fc46 Binary files /dev/null and b/bin/Model/Microcontroller/EEPROM.class differ diff --git a/bin/Model/Microcontroller/PIC.class b/bin/Model/Microcontroller/PIC.class new file mode 100644 index 0000000..f07114d Binary files /dev/null and b/bin/Model/Microcontroller/PIC.class differ diff --git a/bin/Model/Microcontroller/RAM.class b/bin/Model/Microcontroller/RAM.class new file mode 100644 index 0000000..1d8684e Binary files /dev/null and b/bin/Model/Microcontroller/RAM.class differ diff --git a/bin/Model/Microcontroller/STACK.class b/bin/Model/Microcontroller/STACK.class new file mode 100644 index 0000000..9b5875a Binary files /dev/null and b/bin/Model/Microcontroller/STACK.class differ diff --git a/bin/Model/Backend/Microcontroller/WATCHDOG.class b/bin/Model/Microcontroller/WATCHDOG.class similarity index 69% rename from bin/Model/Backend/Microcontroller/WATCHDOG.class rename to bin/Model/Microcontroller/WATCHDOG.class index 1cb2be9..ec31c61 100644 Binary files a/bin/Model/Backend/Microcontroller/WATCHDOG.class and b/bin/Model/Microcontroller/WATCHDOG.class differ diff --git a/bin/Model/MyModel.class b/bin/Model/MyModel.class new file mode 100644 index 0000000..eb4166f Binary files /dev/null and b/bin/Model/MyModel.class differ diff --git a/bin/Model/Runtime/Environment.class b/bin/Model/Runtime/Environment.class new file mode 100644 index 0000000..d549eb6 Binary files /dev/null and b/bin/Model/Runtime/Environment.class differ diff --git a/bin/Model/Runtime/Main.class b/bin/Model/Runtime/Main.class new file mode 100644 index 0000000..5a45b75 Binary files /dev/null and b/bin/Model/Runtime/Main.class differ diff --git a/bin/Model/Runtime/ProgramStepInformation.class b/bin/Model/Runtime/ProgramStepInformation.class new file mode 100644 index 0000000..00b6df0 Binary files /dev/null and b/bin/Model/Runtime/ProgramStepInformation.class differ diff --git a/bin/Model/Runtime/TODO.class b/bin/Model/Runtime/TODO.class new file mode 100644 index 0000000..3ad8e19 Binary files /dev/null and b/bin/Model/Runtime/TODO.class differ diff --git a/bin/Model/Runtime/Testfile.class b/bin/Model/Runtime/Testfile.class new file mode 100644 index 0000000..e6358bb Binary files /dev/null and b/bin/Model/Runtime/Testfile.class differ diff --git a/bin/View/GUIMainFrame.class b/bin/View/GUIMainFrame.class index b9bbc3e..7145eaa 100644 Binary files a/bin/View/GUIMainFrame.class and b/bin/View/GUIMainFrame.class differ diff --git a/bin/View/GUIMenuBar.class b/bin/View/GUIMenuBar.class index 514865d..1987f46 100644 Binary files a/bin/View/GUIMenuBar.class and b/bin/View/GUIMenuBar.class differ diff --git a/bin/View/GUIPorts.class b/bin/View/GUIPorts.class index d9a9b19..2eff123 100644 Binary files a/bin/View/GUIPorts.class and b/bin/View/GUIPorts.class differ diff --git a/bin/View/GUIRegistersDetailed.class b/bin/View/GUIRegistersDetailed.class index f85869f..ac92842 100644 Binary files a/bin/View/GUIRegistersDetailed.class and b/bin/View/GUIRegistersDetailed.class differ diff --git a/bin/View/MyView.class b/bin/View/MyView.class index d4d2793..ee033eb 100644 Binary files a/bin/View/MyView.class and b/bin/View/MyView.class differ diff --git a/bin/simulator_additional_functions.class b/bin/simulator_additional_functions.class deleted file mode 100644 index 9608605..0000000 Binary files a/bin/simulator_additional_functions.class and /dev/null differ diff --git a/src/Control/MyControlModel.java b/src/Control/MyControlModel.java index 49bc542..93841eb 100644 --- a/src/Control/MyControlModel.java +++ b/src/Control/MyControlModel.java @@ -2,7 +2,7 @@ package Control; import java.util.ArrayList; -import Model.Backend.MyModel; +import Model.MyModel; import View.MyView; public class MyControlModel { diff --git a/src/Control/MyControlView.java b/src/Control/MyControlView.java index b65a43d..ce24bc1 100644 --- a/src/Control/MyControlView.java +++ b/src/Control/MyControlView.java @@ -2,7 +2,7 @@ package Control; import java.util.ArrayList; -import Model.Backend.MyModel; +import Model.MyModel; import View.MyView; public class MyControlView { @@ -20,6 +20,8 @@ public class MyControlView { setPortAView(); setPortBView(); setRamView(); + setRegistersDetailed(); + setStack(); } /** @@ -51,11 +53,49 @@ public class MyControlView { * Sets detailed register-table values to values from PIC. */ public void setRegistersDetailed() { + int iStatus = oMyModel.getPIC().getRam().get_STATUS(); + int iOption = oMyModel.getPIC().getRam().get_OPTION(); + int iIntcon = oMyModel.getPIC().getRam().get_INTCON(); + int iS0 = ((iStatus & 1) == 1) ? 1:0; + int iS1 = ((iStatus & 2) == 2) ? 1:0; + int iS2 = ((iStatus & 4) == 4) ? 1:0; + int iS3 = ((iStatus & 8) == 8) ? 1:0; + int iS4 = ((iStatus & 16) == 16) ? 1:0; + int iS5 = ((iStatus & 32) == 32) ? 1:0; + int iS6 = ((iStatus & 64) == 64) ? 1:0; + int iS7 = ((iStatus & 128) == 128) ? 1:0; + + int[] aiStatus = {iS0, iS1, iS2, iS3, iS4, iS5, iS6, iS7}; + oMyView.getGUIRegistersDetailed().setStatus(aiStatus); + + int iO0 = ((iOption & 1) == 1) ? 1:0; + int iO1 = ((iOption & 2) == 2) ? 1:0; + int iO2 = ((iOption & 4) == 4) ? 1:0; + int iO3 = ((iOption & 8) == 8) ? 1:0; + int iO4 = ((iOption & 16) == 16) ? 1:0; + int iO5 = ((iOption & 32) == 32) ? 1:0; + int iO6 = ((iOption & 64) == 64) ? 1:0; + int iO7 = ((iOption & 128) == 128) ? 1:0; + + int[] aiOption = {iO0, iO1, iO2, iO3, iO4, iO5, iO6, iO7}; + oMyView.getGUIRegistersDetailed().setOption(aiOption); + + int iI0 = ((iIntcon & 1) == 1) ? 1:0; + int iI1 = ((iIntcon & 2) == 2) ? 1:0; + int iI2 = ((iIntcon & 4) == 4) ? 1:0; + int iI3 = ((iIntcon & 8) == 8) ? 1:0; + int iI4 = ((iIntcon & 16) == 16) ? 1:0; + int iI5 = ((iIntcon & 32) == 32) ? 1:0; + int iI6 = ((iIntcon & 64) == 64) ? 1:0; + int iI7 = ((iIntcon & 128) == 128) ? 1:0; + + int[] aiIntcon = {iI0, iI1, iI2, iI3, iI4, iI5, iI6, iI7}; + oMyView.getGUIRegistersDetailed().setIntcon(aiIntcon); } /** - * + * Enables and disables checkboxes of PortA. */ public void setPortAView() { @@ -76,9 +116,12 @@ public class MyControlView { oMyView.getGUIPorts().enableCheckboxesA(abEnabled); } + /** + * Enables and disables checkboxes of PortB. + */ public void setPortBView() { - boolean[] abEnabled = new boolean[10]; + boolean[] abEnabled = new boolean[16]; abEnabled[0] = oMyModel.getPIC().getRam().get_TRISB0(); abEnabled[1] = oMyModel.getPIC().getRam().get_TRISB1(); @@ -98,26 +141,29 @@ public class MyControlView { abEnabled[14] = true; abEnabled[15] = true; - oMyView.getGUIPorts().enableCheckboxesA(abEnabled); + oMyView.getGUIPorts().enableCheckboxesB(abEnabled); } public void setRamView() { int[] aiData; int[] aiBank0 = oMyModel.getPIC().getRam().get_Bank0(); int[] aiBank1 = oMyModel.getPIC().getRam().get_Bank1(); - int iLenB0 = aiBank0.length; - int iLenB1 = aiBank1.length; - aiData = new int[iLenB0 + iLenB1]; - for (int i = 0; i < iLenB0; i++) { + + aiData = new int[256]; + for (int i = 0; i < 128; i++) { aiData[i] = aiBank0[i]; } - for (int i = iLenB0; i < (iLenB0 + iLenB1); i++) { - aiData[i] = aiBank1[i]; + int j = 0; + for (int i = 128; i < 256; i++) { + aiData[i] = aiBank1[j]; + j++; } oMyView.getGUIRamTable().setGUIRam(aiData); } - + public void setStack() { + oMyView.getGUIStack().setStack(oMyModel.getPIC().getStack().getSTACK()); + } public void startProgramView() { diff --git a/src/In.java b/src/In.java deleted file mode 100755 index 03f5c06..0000000 --- a/src/In.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - Copyright (C) 1999 (Jens Scheffler) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -import java.io.*; -import java.util.*; -import java.math.*; - -public class In { - -/** Diese Klasse stellt einige einfache Methoden zum Einlesen von der Tastatur - zur Verfügung. Es werden diverse Werte von der Tastatur eingelesen, die - jeweils durch ein Leerzeichen, einen Tabstop oder ein Zeilenendezeichen - getrennt sein müssen. - @author Jens Scheffler - @version 1.01 Spezialfassung für Programmieren 1 in Java - */ - - private In(){} // somit kann die Klasse nicht instanziiert werden! - private static BufferedReader in = - new BufferedReader(new InputStreamReader(System.in)); - private static StringTokenizer eingabe; - private static String zeichenkette; - -/** Löscht alles, was sich in der momentanen Zeile befindet. - Das heißt es wird der Eingabe bis zum Zeilenende keine Beachtung mehr - geschenkt - */ - public static void flush(){ - eingabe=null; - } - -/* Private Methode, die den Tokenizer fuellt. Dies ist uebrigens eine von - zwei Methoden, die die Klasse zum Absturz bringen kann...*/ - private static void init(){ - zeichenkette=null; - if (eingabe!=null && eingabe.hasMoreTokens()) return; - while (eingabe==null || !eingabe.hasMoreTokens()) - eingabe=new StringTokenizer(readLine()); - } - -/* Private Methode, die eine Fehlermeldung ausgibt */ - private static void error(Exception e,String prompt) { - System.out.println("Eingabefehler "+e); - System.out.println("Bitte Eingabe wiederholen..."); - System.out.print(prompt); - } - -/** Liest eine ganze Textzeile von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zeile. - */ -/* Dies ist die zweite Methode, die die Klasse zum Absturz bringen kann.*/ - public static String readLine(String prompt){ - flush(); - String erg=""; - System.out.print(prompt); - try{ - erg=in.readLine(); - } catch(IOException e){ - System.err.println(""+e+"\n Programm abgebrochen...\n"); - //System.exit(1); - } - if (erg==null) { - System.err.println("Dateiende erreicht.\nProgramm abgebrochen...\n"); - //System.exit(1); - } - return erg; - } - -/** Liest eine int-Zahl von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zahl. - */ - public static int readInteger(String prompt){ - int erg; - System.out.print(prompt); - init(); - while(true){ - try{ - erg=Integer.parseInt(eingabe.nextToken()); - } catch (NumberFormatException e) { - error(e,prompt);init();continue; - } - return erg; - } - } - -/** Liest eine long-Zahl von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zahl. - */ - public static long readLong(String prompt){ - long erg; - System.out.print(prompt); - init(); - while(true){ - try{ - erg=Long.parseLong(eingabe.nextToken()); - } catch (NumberFormatException e) {error(e,prompt);init();continue;} - return erg; - } - } - -/** Liest eine double-Zahl von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zahl. - */ - public static double readDouble(String prompt){ - double erg; - System.out.print(prompt); - init(); - while(true){ - try{ - erg=Double.valueOf(eingabe.nextToken()).doubleValue(); - } catch(NumberFormatException e) {error(e,prompt);init();continue;} - return erg; - } - } - -/** Liest eine float-Zahl von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zahl. - */ - public static float readFloat(String prompt){ - float erg; - System.out.print(prompt); - init(); - while(true){ - try{ - erg=Float.valueOf(eingabe.nextToken()).floatValue(); - } catch(NumberFormatException e) {error(e,prompt);init();continue;} - return erg; - } - } - -/** Liest eine short-Zahl von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zahl. - */ - public static short readShort(String prompt){ - short erg; - System.out.print(prompt); - init(); - while(true){ - try{ - erg=Short.valueOf(eingabe.nextToken()).shortValue(); - } catch(NumberFormatException e) {error(e,prompt);init();continue;} - return erg; - } - } - -/** Liest einen boolschen Wert von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return der eingelesene Wert. - */ - public static boolean readBoolean(String prompt){ - String try_this=readString(prompt); - while (!try_this.equals("true") && !try_this.equals("false")) - try_this=readString(); - return try_this.equals("true"); - } - -/** Liest ein Textwort von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return das eingelesene Wort. - */ - public static String readString(String prompt){ - System.out.print(prompt); - init(); - return eingabe.nextToken(); - } - - /** Liest ein Zeichen von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return das eingelesene Zeichen. - */ - public static char readChar(String prompt){ - char erg; - System.out.print(prompt); - if (zeichenkette==null || zeichenkette.length()==0) - zeichenkette=readString(""); - erg=zeichenkette.charAt(0); - zeichenkette=(zeichenkette.length()>1)?zeichenkette.substring(1):null; - return erg; - } - -/** Liest eine ganze Textzeile von der Tastatur ein. -@return die eingelesene Zeile. - */ - public static String readLine(){ - return readLine(""); - } - -/** Liest eine int-Zahl von der Tastatur ein. -@return die eingelesene Zahl. - */ - public static int readInteger(){ - return readInteger(""); - } - -/** Liest eine int-Zahl von der Tastatur ein. -@return die eingelesene Zahl. - */ - public static int readInt(){ - return readInteger(""); - } - -/** Liest eine int-Zahl von der Tastatur ein. Soll vorher eine - Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter. - Dieser kann jedoch auch wegfallen. -@param prompt eine eventuelle Eingabeaufforderung -@return die eingelesene Zahl. - */ - public static int readInt(String prompt){ - return readInteger(prompt); - } - -/** Liest eine long-Zahl von der Tastatur ein. -@return die eingelesene Zahl. - */ - public static long readLong(){ - return readLong(""); - } - -/** Liest eine double-Zahl von der Tastatur ein. -@return die eingelesene Zahl. - */ - public static double readDouble(){ - return readDouble(""); - } - -/** Liest eine short-Zahl von der Tastatur ein. -@return die eingelesene Zahl. - */ - public static short readShort(){ - return readShort(""); - } - -/** Liest eine float-Zahl von der Tastatur ein. -@return die eingelesene Zahl. - */ - public static float readFloat(){ - return readFloat(""); - } - -/** Liest ein Zeichen von der Tastatur ein. -@return das eingelesene Zeichen - */ - public static char readChar(){ - return readChar(""); - } - -/** Liest ein Textwort von der Tastatur ein. -@return das eingelesene Wort. - */ - public static String readString(){ - return readString(""); - } - - /** Liest einen boolschen Wert von der Tastatur ein. -@return das eingelesene Wort. - */ - public static boolean readBoolean(){ - return readBoolean(""); - } - - /** Wandelt eine double-Zahl in einen String um. - Bei der üblichen Umwandlung von double-Werten in einen String - findet eine Rundung statt. So wird etwa die Zahl 0.1, obwohl intern - nicht darstellbar, dennoch auf dem Bildschirm ausgegeben. Diese - Methode umgeht die Rundung */ - public static String toString(double d) { - if (Double.isInfinite(d) || Double.isNaN(d)) - return ""+d; - return (new BigDecimal(d)).toString(); - } - - /** - * Setzt den Standard-Inputreader auf neuen Eingabestrom - * @param in inputstream instance, not null - */ - public static void setInputStream(InputStream in) { - if (in == null) - throw new IllegalArgumentException("in darf nicht null sein."); - In.in = new BufferedReader(new InputStreamReader(in)); - } - - /** - * Setzt den Standard-Inputreader auf neuen Eingabestrom - * @param in reader instance, not null - */ - public static void setInputStreamReader(Reader in) { - if (in == null) - throw new IllegalArgumentException("in darf nicht null sein."); - - In.in = new BufferedReader(in); - } - - /** - * Setzt den Standard-Inputreader auf neuen Eingabestrom - * - * @deprecated - * @param bin BufferedReader - */ - public static void setReader (BufferedReader bin) { - if (bin == null) - throw new IllegalArgumentException("bin darf nicht null sein."); - - In.in = bin; - - } - -} diff --git a/src/Model/Backend/Runtime/ProgramStepInformation.java b/src/Model/Backend/Runtime/ProgramStepInformation.java deleted file mode 100755 index 66c600a..0000000 --- a/src/Model/Backend/Runtime/ProgramStepInformation.java +++ /dev/null @@ -1,7 +0,0 @@ -package Model.Backend.Runtime; - -import Model.Backend.Microcontroller.PIC; - -public class ProgramStepInformation { - private PIC oPIC; -} diff --git a/src/Model/Backend/Runtime/WATCHDOG.java b/src/Model/Backend/Runtime/WATCHDOG.java deleted file mode 100644 index 32a7283..0000000 --- a/src/Model/Backend/Runtime/WATCHDOG.java +++ /dev/null @@ -1,5 +0,0 @@ -package Model.Backend.Runtime; - -public enum WATCHDOG { - -} diff --git a/src/Model/Backend/Statistics/ErrorHandling/BackendErrorCounter.java b/src/Model/Backend/Statistics/ErrorHandling/BackendErrorCounter.java deleted file mode 100755 index 1037999..0000000 --- a/src/Model/Backend/Statistics/ErrorHandling/BackendErrorCounter.java +++ /dev/null @@ -1,16 +0,0 @@ -package Model.Backend.Statistics.ErrorHandling; - -public class BackendErrorCounter { - private int iErrorCounter = 0; - private int [] aiErrors; - - public void incrementErrorCounter() { - iErrorCounter++; - } - - public int getErrorCounter() { - return iErrorCounter; - } - - //TODO detailed error counts -} diff --git a/src/Model/Backend/BackendCommandProcessing/InformationConnecter.java b/src/Model/BackendCommandProcessing/InformationConnecter.java similarity index 97% rename from src/Model/Backend/BackendCommandProcessing/InformationConnecter.java rename to src/Model/BackendCommandProcessing/InformationConnecter.java index f306d14..0c74a2d 100755 --- a/src/Model/Backend/BackendCommandProcessing/InformationConnecter.java +++ b/src/Model/BackendCommandProcessing/InformationConnecter.java @@ -1,6 +1,6 @@ -package Model.Backend.BackendCommandProcessing; +package Model.BackendCommandProcessing; -import Model.Backend.Microcontroller.PIC; +import Model.Microcontroller.PIC; public class InformationConnecter { diff --git a/src/Model/Backend/EepromLoader/ReadEepromFile.java b/src/Model/EepromLoader/ReadEepromFile.java similarity index 96% rename from src/Model/Backend/EepromLoader/ReadEepromFile.java rename to src/Model/EepromLoader/ReadEepromFile.java index 7edbf20..be24f67 100755 --- a/src/Model/Backend/EepromLoader/ReadEepromFile.java +++ b/src/Model/EepromLoader/ReadEepromFile.java @@ -1,4 +1,4 @@ -package Model.Backend.EepromLoader; +package Model.EepromLoader; import java.io.BufferedReader; import java.io.File; @@ -6,7 +6,7 @@ import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; -import Model.Backend.Microcontroller.PIC; +import Model.Microcontroller.PIC; public class ReadEepromFile { diff --git a/src/Model/Backend/InterruptHandling/InterruptServiceHandler.java b/src/Model/InterruptHandling/InterruptServiceHandler.java similarity index 76% rename from src/Model/Backend/InterruptHandling/InterruptServiceHandler.java rename to src/Model/InterruptHandling/InterruptServiceHandler.java index 58caa99..9d54156 100644 --- a/src/Model/Backend/InterruptHandling/InterruptServiceHandler.java +++ b/src/Model/InterruptHandling/InterruptServiceHandler.java @@ -1,4 +1,4 @@ -package Model.Backend.InterruptHandling; +package Model.InterruptHandling; public class InterruptServiceHandler extends Thread { diff --git a/src/Model/Backend/InterruptHandling/InterruptServiceHandlingTable.java b/src/Model/InterruptHandling/InterruptServiceHandlingTable.java similarity index 93% rename from src/Model/Backend/InterruptHandling/InterruptServiceHandlingTable.java rename to src/Model/InterruptHandling/InterruptServiceHandlingTable.java index 0d87d5e..d956fd0 100644 --- a/src/Model/Backend/InterruptHandling/InterruptServiceHandlingTable.java +++ b/src/Model/InterruptHandling/InterruptServiceHandlingTable.java @@ -1,4 +1,4 @@ -package Model.Backend.InterruptHandling; +package Model.InterruptHandling; /** * Class contains methods which calls a method to an overhanded value. diff --git a/src/Model/Backend/Microcontroller/Bitmask.java b/src/Model/Microcontroller/Bitmask.java similarity index 97% rename from src/Model/Backend/Microcontroller/Bitmask.java rename to src/Model/Microcontroller/Bitmask.java index af77901..797e40d 100755 --- a/src/Model/Backend/Microcontroller/Bitmask.java +++ b/src/Model/Microcontroller/Bitmask.java @@ -1,4 +1,4 @@ -package Model.Backend.Microcontroller; +package Model.Microcontroller; public class Bitmask { /** diff --git a/src/Model/Backend/Microcontroller/EEPROM.java b/src/Model/Microcontroller/EEPROM.java similarity index 92% rename from src/Model/Backend/Microcontroller/EEPROM.java rename to src/Model/Microcontroller/EEPROM.java index 7f24725..827c0ef 100755 --- a/src/Model/Backend/Microcontroller/EEPROM.java +++ b/src/Model/Microcontroller/EEPROM.java @@ -1,4 +1,4 @@ -package Model.Backend.Microcontroller; +package Model.Microcontroller; /** * @author Aaron Moser * @date 23.06.2021 diff --git a/src/Model/Backend/Microcontroller/PIC.java b/src/Model/Microcontroller/PIC.java similarity index 97% rename from src/Model/Backend/Microcontroller/PIC.java rename to src/Model/Microcontroller/PIC.java index 1b6ca9a..a889fda 100755 --- a/src/Model/Backend/Microcontroller/PIC.java +++ b/src/Model/Microcontroller/PIC.java @@ -1,4 +1,4 @@ -package Model.Backend.Microcontroller; +package Model.Microcontroller; /** * @author Aaron Moser diff --git a/src/Model/Backend/Microcontroller/RAM.java b/src/Model/Microcontroller/RAM.java similarity index 95% rename from src/Model/Backend/Microcontroller/RAM.java rename to src/Model/Microcontroller/RAM.java index 8f911e0..beeeeb2 100755 --- a/src/Model/Backend/Microcontroller/RAM.java +++ b/src/Model/Microcontroller/RAM.java @@ -1,4 +1,4 @@ -package Model.Backend.Microcontroller; +package Model.Microcontroller; /** * @author Aaron Moser diff --git a/src/Model/Backend/Microcontroller/STACK.java b/src/Model/Microcontroller/STACK.java similarity index 87% rename from src/Model/Backend/Microcontroller/STACK.java rename to src/Model/Microcontroller/STACK.java index d7bb61e..f450cf1 100755 --- a/src/Model/Backend/Microcontroller/STACK.java +++ b/src/Model/Microcontroller/STACK.java @@ -1,4 +1,4 @@ -package Model.Backend.Microcontroller; +package Model.Microcontroller; import java.util.EmptyStackException; @@ -31,15 +31,16 @@ public class STACK */ public void pushReturnAdressOnStack(int return_Adress) { - if (stackpointer < 7) + if (stackpointer < 8) { stack[stackpointer] = return_Adress; stackpointer++; } - if (stackpointer == 7) + if (stackpointer == 8) { - throw new StackOverflowError(); + //throw new StackOverflowError(); + stackpointer = 0; } } diff --git a/src/Model/Backend/Microcontroller/WATCHDOG.java b/src/Model/Microcontroller/WATCHDOG.java similarity index 94% rename from src/Model/Backend/Microcontroller/WATCHDOG.java rename to src/Model/Microcontroller/WATCHDOG.java index f8d54df..965a484 100755 --- a/src/Model/Backend/Microcontroller/WATCHDOG.java +++ b/src/Model/Microcontroller/WATCHDOG.java @@ -1,4 +1,4 @@ -package Model.Backend.Microcontroller; +package Model.Microcontroller; /** * @author Aaron Moser diff --git a/src/Model/Backend/MyModel.java b/src/Model/MyModel.java similarity index 74% rename from src/Model/Backend/MyModel.java rename to src/Model/MyModel.java index 17dc6a3..f3c9151 100644 --- a/src/Model/Backend/MyModel.java +++ b/src/Model/MyModel.java @@ -1,7 +1,7 @@ -package Model.Backend; +package Model; -import Model.Backend.Microcontroller.PIC; -import Model.Backend.Runtime.Environment; +import Model.Microcontroller.PIC; +import Model.Runtime.Environment; public class MyModel { PIC oPIC; diff --git a/src/Model/Backend/Runtime/Environment.java b/src/Model/Runtime/Environment.java similarity index 90% rename from src/Model/Backend/Runtime/Environment.java rename to src/Model/Runtime/Environment.java index 0d9cabb..6693784 100755 --- a/src/Model/Backend/Runtime/Environment.java +++ b/src/Model/Runtime/Environment.java @@ -4,12 +4,12 @@ * @lastchange 21.02.2022 */ -package Model.Backend.Runtime; +package Model.Runtime; import java.util.ArrayList; -import Model.Backend.Microcontroller.PIC; -import Model.Backend.Microcontroller.WATCHDOG; +import Model.Microcontroller.WATCHDOG; +import Model.Microcontroller.PIC; import View.GUIMainFrame; public class Environment { @@ -32,12 +32,12 @@ public class Environment { public Environment() { oPIC = new PIC(); - oPIC.setWRegister(4); + GUIMainFrame oMainFrame = new GUIMainFrame(this); watchdog = new WATCHDOG(); - + diff --git a/src/Model/Backend/Runtime/Main.java b/src/Model/Runtime/Main.java similarity index 76% rename from src/Model/Backend/Runtime/Main.java rename to src/Model/Runtime/Main.java index a678977..fb143fa 100755 --- a/src/Model/Backend/Runtime/Main.java +++ b/src/Model/Runtime/Main.java @@ -1,4 +1,4 @@ -package Model.Backend.Runtime; +package Model.Runtime; public class Main { public static void main(String[] args) { diff --git a/src/Model/Runtime/ProgramStepInformation.java b/src/Model/Runtime/ProgramStepInformation.java new file mode 100755 index 0000000..ec847f1 --- /dev/null +++ b/src/Model/Runtime/ProgramStepInformation.java @@ -0,0 +1,7 @@ +package Model.Runtime; + +import Model.Microcontroller.PIC; + +public class ProgramStepInformation { + private PIC oPIC; +} diff --git a/src/Model/Backend/Runtime/TODO.java b/src/Model/Runtime/TODO.java similarity index 95% rename from src/Model/Backend/Runtime/TODO.java rename to src/Model/Runtime/TODO.java index 3331d1e..edd1a0d 100755 --- a/src/Model/Backend/Runtime/TODO.java +++ b/src/Model/Runtime/TODO.java @@ -1,4 +1,4 @@ -package Model.Backend.Runtime; +package Model.Runtime; public class TODO { diff --git a/src/Model/Backend/Runtime/Testfile.java b/src/Model/Runtime/Testfile.java similarity index 75% rename from src/Model/Backend/Runtime/Testfile.java rename to src/Model/Runtime/Testfile.java index 4966804..cca6d2f 100644 --- a/src/Model/Backend/Runtime/Testfile.java +++ b/src/Model/Runtime/Testfile.java @@ -1,4 +1,4 @@ -package Model.Backend.Runtime; +package Model.Runtime; import java.util.ArrayList; diff --git a/src/View/GUIMainFrame.java b/src/View/GUIMainFrame.java index 907299d..6bc1a5a 100755 --- a/src/View/GUIMainFrame.java +++ b/src/View/GUIMainFrame.java @@ -10,8 +10,10 @@ import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; -import Model.Backend.MyModel; -import Model.Backend.Runtime.Environment; +import Control.MyControlModel; +import Control.MyControlView; +import Model.MyModel; +import Model.Runtime.Environment; public class GUIMainFrame extends JFrame { @@ -59,6 +61,8 @@ public class GUIMainFrame extends JFrame { MyModel oMyModel; + MyControlView mcv; + ArrayList oPanels = new ArrayList(); /** @@ -87,6 +91,9 @@ public class GUIMainFrame extends JFrame { setTheme(0); updateWindow(); this.setVisible(true); //make frame visible + oMyModel = new MyModel(oEnvironment.getPIC(), oEnvironment); + mcv = new MyControlView(oMyView, oMyModel); + mcv.updateView(); } private void buildGUIMainFrame() { diff --git a/src/View/GUIPorts.java b/src/View/GUIPorts.java index 6faa670..879edba 100644 --- a/src/View/GUIPorts.java +++ b/src/View/GUIPorts.java @@ -222,8 +222,10 @@ public class GUIPorts extends JPanel { } public void enableCheckboxesB(boolean[] abEnabled) { + int j = 0; for (int i = 10; i < 26; i++) { - oCheckboxes.get(i).setEnabled(abEnabled[i]); + oCheckboxes.get(i).setEnabled(abEnabled[j]); + j++; } } diff --git a/src/View/GUIRegistersDetailed.java b/src/View/GUIRegistersDetailed.java index b312a43..0d5d5c9 100644 --- a/src/View/GUIRegistersDetailed.java +++ b/src/View/GUIRegistersDetailed.java @@ -140,6 +140,39 @@ public class GUIRegistersDetailed extends JPanel { oTables.add(oStatusTable); } + public void setStatus(int[] aiStatus) { + oStatusTable.setValueAt(aiStatus[7] + "", 1, 0); + oStatusTable.setValueAt(aiStatus[6] + "", 1, 1); + oStatusTable.setValueAt(aiStatus[5] + "", 1, 2); + oStatusTable.setValueAt(aiStatus[4] + "", 1, 3); + oStatusTable.setValueAt(aiStatus[3] + "", 1, 4); + oStatusTable.setValueAt(aiStatus[2] + "", 1, 5); + oStatusTable.setValueAt(aiStatus[1] + "", 1, 6); + oStatusTable.setValueAt(aiStatus[0] + "", 1, 7); + } + + public void setOption(int[] aiOption) { + oOptionTable.setValueAt(aiOption[7] + "", 1, 0); + oOptionTable.setValueAt(aiOption[6] + "", 1, 1); + oOptionTable.setValueAt(aiOption[5] + "", 1, 2); + oOptionTable.setValueAt(aiOption[4] + "", 1, 3); + oOptionTable.setValueAt(aiOption[3] + "", 1, 4); + oOptionTable.setValueAt(aiOption[2] + "", 1, 5); + oOptionTable.setValueAt(aiOption[1] + "", 1, 6); + oOptionTable.setValueAt(aiOption[0] + "", 1, 7); + } + + public void setIntcon(int[] aiIntcon) { + oIntconTable.setValueAt(aiIntcon[0] + "", 1, 0); + oIntconTable.setValueAt(aiIntcon[1] + "", 1, 1); + oIntconTable.setValueAt(aiIntcon[2] + "", 1, 2); + oIntconTable.setValueAt(aiIntcon[3] + "", 1, 3); + oIntconTable.setValueAt(aiIntcon[4] + "", 1, 4); + oIntconTable.setValueAt(aiIntcon[5] + "", 1, 5); + oIntconTable.setValueAt(aiIntcon[6] + "", 1, 6); + oIntconTable.setValueAt(aiIntcon[7] + "", 1, 7); + } + public void setTheme(int iThemeNr) { switch (iThemeNr) { case 0: { diff --git a/src/simulator_additional_functions.java b/src/simulator_additional_functions.java deleted file mode 100755 index 852592e..0000000 --- a/src/simulator_additional_functions.java +++ /dev/null @@ -1,127 +0,0 @@ -import java.io.*; - -//how to use In.java - -public class simulator_additional_functions -{ - public static char menueSelectionChar = 'A'; - public static char secondMenueSelectionChar = 'A'; - public static String secondMenueSelectionString = ""; - public static File frontendToBackendFile = new File("../SIMULATOR_DAT/gui_change.dat"); - - public static void main(String[] args) - { - int []array = new int[9]; - array[0] = 1; - array[1] = 2; - array[2] = 4; - array[3] = 8; - array[4] = 16; - array[5] = 32; - array[6] = 64; - array[7] = 128; - array[8] = 256; - - while ((menueSelectionChar != 'S') && (menueSelectionChar != 's')) - { - menueSelectionChar = In.readChar("What do you want to do?\n(B/b)reakpoint, (P/p)rescaler, (S/s)top:"); - - switch (menueSelectionChar) - { - case 'B': - case 'b': - { - secondMenueSelectionString = In.readString("In which line do you want to set your breakpoint?:"); - - if (!frontendToBackendFile.isFile()) - { - if (Integer.parseInt(secondMenueSelectionString) >= 0) - { - try - { - FileWriter fw = new FileWriter(frontendToBackendFile); - BufferedWriter bw = new BufferedWriter(fw); - bw.write("BREAKPOINT " + secondMenueSelectionString); - bw.close(); - } - catch (IOException ioe) - {} - } - - else - { - System.out.println("Please try again, value must be greater -1"); - } - } - - else - { - System.out.println("Error can't create new File, File already exists!"); - } - }break; - - case 'P': - case 'p': - { - secondMenueSelectionChar = In.readChar("Which Prescaler you want to set? (T/t)imer0, (W/w)atchdogtimer"); - switch (secondMenueSelectionChar) - { - case 'T': - case 't': - { - if (!frontendToBackendFile.isFile()) - { - secondMenueSelectionChar = In.readChar("What value you want to set the prescaler?\n0. 1, 1. 2, 2. 4, 3. 8, 4. 16, 5. 32, 6. 64, 7. 128, 8. 256:"); - - if ((Integer.parseInt("" + secondMenueSelectionChar) >= 0) && (Integer.parseInt("" + secondMenueSelectionChar) < 9)) - { - try - { - FileWriter fw = new FileWriter(frontendToBackendFile); - BufferedWriter bw = new BufferedWriter(fw); - bw.write("PRT " + Integer.parseInt("" + secondMenueSelectionChar)); - bw.close(); - } - catch (IOException ioe) - {} - } - } - - else - { - System.out.println("Error can't create new File, File already exists!"); - } - }break; - - case 'W': - case 'w': - { - if (!frontendToBackendFile.isFile()) - { - secondMenueSelectionChar = In.readChar("What value you want to set the prescaler?\n0. 2, 1. 4, 2. 8, 3. 16, 4. 32, 5. 64, 6. 128, 7. 256:"); - - if ((Integer.parseInt("" + secondMenueSelectionChar) > 0) && (Integer.parseInt("" + secondMenueSelectionChar) < 9)) - { - try - { - FileWriter fw = new FileWriter(frontendToBackendFile); - BufferedWriter bw = new BufferedWriter(fw); - bw.write("PRW " + array[Integer.parseInt("" + secondMenueSelectionChar)]); - bw.close(); - } - catch (IOException ioe) - {} - } - } - - else - { - System.out.println("Error can't create new File, File already exists!"); - } - }break; - } - }break; - } - } - } -} \ No newline at end of file