diff --git a/Compiled/Logisim-ITA.exe b/Compiled/Logisim-ITA.exe index 14dc44ea..08863e4f 100644 Binary files a/Compiled/Logisim-ITA.exe and b/Compiled/Logisim-ITA.exe differ diff --git a/Compiled/Logisim-ITA.jar b/Compiled/Logisim-ITA.jar index f5d93e6c..e54726c0 100644 Binary files a/Compiled/Logisim-ITA.jar and b/Compiled/Logisim-ITA.jar differ diff --git a/Logisim-Fork/com/cburch/logisim/Main.java b/Logisim-Fork/com/cburch/logisim/Main.java index 25327e79..ea5ef29d 100644 --- a/Logisim-Fork/com/cburch/logisim/Main.java +++ b/Logisim-Fork/com/cburch/logisim/Main.java @@ -33,7 +33,7 @@ public class Main { // current version - public static final LogisimVersion VERSION = LogisimVersion.get(2, 16, 1, 0, LogisimVersion.getVariantFromFile()); + public static final LogisimVersion VERSION = LogisimVersion.get(2, 16, 1, 1, LogisimVersion.getVariantFromFile()); // the version of the file you're using, equals to current version if new file public static LogisimVersion FILE_VERSION; diff --git a/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGenerator.java b/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGenerator.java index 19e44aaa..4974a4fe 100644 --- a/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGenerator.java +++ b/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGenerator.java @@ -302,9 +302,12 @@ private static ProgrammableGeneratorState getState(InstanceState state) { public static boolean tick(CircuitState circState, int ticks, Component comp) { ProgrammableGeneratorState state = getState(comp, circState); state.incrementTicks(); - int durationHigh = state.getdurationHighValue(); int statetick = state.getStateTick(); - Value desired = (statetick - 1 < durationHigh ? Value.TRUE : Value.FALSE); + Value desired = Value.UNKNOWN; + if (statetick > 0) { + int durationHigh = state.getdurationHighValue(); + desired = (statetick - 1 < durationHigh ? Value.TRUE : Value.FALSE); + } if (!state.sending.equals(desired)) { state.sending = desired; Instance.getInstanceFor(comp).fireInvalidated(); diff --git a/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGeneratorState.java b/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGeneratorState.java index 553808cf..f97f7f42 100644 --- a/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGeneratorState.java +++ b/Logisim-Fork/com/cburch/logisim/std/wiring/ProgrammableGeneratorState.java @@ -23,6 +23,7 @@ public class ProgrammableGeneratorState implements InstanceData, Cloneable { Value sending = Value.FALSE; private int[] durationHigh; private int[] durationLow; + private boolean allZeros = false; private String SavedData = ""; // number of clock ticks performed in the current state private int ticks, currentstate; @@ -166,17 +167,24 @@ public String getSavedData() { } public int getStateTick() { + if (this.allZeros) + return -1; return this.ticks; } public void incrementCurrentState() { - this.ticks = 1; + if (this.allZeros) + return; + this.ticks = 0; this.currentstate++; if (this.currentstate >= this.durationHigh.length) this.currentstate = 0; + incrementTicks(); } public void incrementTicks() { + if (this.allZeros) + return; this.ticks++; if (this.ticks > getdurationHighValue() + getdurationLowValue()) incrementCurrentState(); @@ -222,9 +230,11 @@ else if (last.equals("x")) { private void SaveValues(JTextField[] inputs) { String onlynumber; int value; - for (byte i = 0; i < inputs.length; i++) { + boolean allZeros = true; + byte i; + for (i = 0; i < inputs.length; i++) { onlynumber = ""; - value = 0; + value = -1; // create a string composed by the digits of the text field for (byte j = 0; j < inputs[i].getText().length(); j++) { if (Character.isDigit(inputs[i].getText().charAt(j))) @@ -234,12 +244,15 @@ private void SaveValues(JTextField[] inputs) { if (onlynumber != "") value = Integer.parseInt(onlynumber); if (value >= 0) { + if (value != 0) + allZeros = false; if (i % 2 == 0) setdurationHigh(i / 2, value); else setdurationLow(i / 2, value); } } + this.allZeros = allZeros; } public void setdurationHigh(int i, int value) { diff --git a/version.xml b/version.xml index 3e2f08d9..244ec87e 100644 --- a/version.xml +++ b/version.xml @@ -2,11 +2,10 @@ https://github.com/LogisimIt/Logisim/raw/master/Compiled/Logisim-ITA.jar - 2.16.1.0 + 2.16.1.1 https://github.com/LogisimIt/Logisim/raw/master/Compiled/Logisim-ITA.exe - 2.16.1.0 + 2.16.1.1 -* Added Simplified Chinese translation -* Compiled with Jdk 14 +* Fixed a problem with zeros in programmable generator