diff --git a/app/index.html b/app/index.html
index 4872408a..bc0efaef 100755
--- a/app/index.html
+++ b/app/index.html
@@ -248,6 +248,7 @@
Tutorial
TimerStart
TimerEnd
ROM
+ SR Latch
diff --git a/app/js/components.js b/app/js/components.js
index 87fdd8c9..aaa46b96 100644
--- a/app/js/components.js
+++ b/app/js/components.js
@@ -3493,4 +3493,32 @@ class Wire {
}
}
+class SRLatch extends Component {
+ constructor(name,pos, properties) {
+ super(name,pos,2,2,{ type: "value" });
+ this.value = this.properties.value || 0;
+
+ this.SET = 0;
+ this.RESET = 1;
+ this.VAL = 0;
+ this.NOT_VAL = 1;
+ this.addInputPort({ side: 3, pos: 0 }, 'S');
+ this.addInputPort({ side: 3, pos: 1 }, 'R');
+ this.addOutputPort({ side: 1, pos: 0 }, 'Q');
+ this.addOutputPort({ side: 1, pos: 1 }, '~Q');
+ }
+
+ function() {
+ if (this.input[this.SET].value) {
+ this.value = 1;
+ }
+ if (this.input[this.RESET].value) {
+ this.value = 0;
+ }
+ this.properties.value = this.value;
+ this.output[this.VAL].value = +this.value;
+ this.output[this.NOT_VAL].value = 1 - this.value;
+ }
+}
+
let Selected = Input;
diff --git a/app/js/localStorage2.js b/app/js/localStorage2.js
index d3f4550c..73e899cf 100644
--- a/app/js/localStorage2.js
+++ b/app/js/localStorage2.js
@@ -98,7 +98,7 @@ const constructors = {
Button,Constant,Delay,Clock,Debug,
Beep,Counter,LED,Display,
Custom, TimerStart, TimerEnd,
- ROM
+ ROM, SRLatch
};
/*