Made Am2910 components usable in Editor
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / am2900 / components / am2910 / GUIAm2910InstrPLA.java
index 9dd05b9..ebd69f6 100644 (file)
@@ -13,6 +13,7 @@ import net.mograsim.logic.core.wires.Wire.ReadWriteEnd;
 import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent;
 import net.mograsim.logic.model.model.wires.Pin;
+import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
 import net.mograsim.logic.model.snippets.symbolrenderers.PinNamesSymbolRenderer.PinNamesParams.Position;
 
 public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
@@ -41,7 +42,7 @@ public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
        }
 
        @Override
-       protected void recalculate(Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
+       protected Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
        {
                ReadEnd PASS = readEnds.get("PASS");
                ReadEnd I3 = readEnds.get("I3");
@@ -218,6 +219,7 @@ public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
                                case 9 + 16:
                                case 12 + 16:
                                case 14 + 16:
+                                       // HOLD
                                        STKI1Val = ZERO;
                                        STKI0Val = ZERO;
                                        break;
@@ -226,11 +228,13 @@ public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
                                case 1 + 16:
                                case 4 + 16:
                                case 5 + 16:
+                                       // PUSH
                                        STKI1Val = ZERO;
                                        STKI0Val = ONE;
                                        break;
                                case 0:
                                case 0 + 16:
+                                       // CLEAR
                                        STKI1Val = ONE;
                                        STKI0Val = ZERO;
                                        break;
@@ -238,6 +242,7 @@ public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
                                case 11 + 16:
                                case 13 + 16:
                                case 15 + 16:
+                                       // POP
                                        STKI1Val = ONE;
                                        STKI0Val = ONE;
                                        break;
@@ -254,5 +259,12 @@ public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
                                STKI1.feedSignals(STKI1Val);
                        }
                }
+               return null;
+       }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIAm2910InstrPLA.class.getCanonicalName(),
+                               (m, p, n) -> new GUIAm2910InstrPLA(m, n));
        }
 }
\ No newline at end of file