Lupoviridae wrote:I came up with my own register, capable of storing any value for any given items. For example, it could store 512 iron plates, 210 copper, and 123 coal, all in one register. It essentially takes a snapshot of everything currently on the red circuit.
A couple things to keep in mind:
iE means output Everything (input count)
In implementation, the wires labled red and green would all be connected to a main bus. I ommitted this in the diagram to make it easier to read.
Input for each box is on the left, output is on the right.
Here's the wiring diagram: Combinator 6 in the diagram is what does the heavy lifting, and it works by using "pulsed" (single tick length) signals. For this reason I call it a "Pulsed-Value Register" or "PVR".
In this setup, the green wire carries the read ("0") and write ("1") signals as well as the address ("A"), while the red wire carries data.
The first pulse of a green signal to that combinator causes it to remember all current input values. The next clears the memory. This does mean that before it can be used, the register must fist be initialized with a single green pulse, which can be done by disconnecting one of the combinators labeled 4 and performing a dummy write.
Here's the breakdown of what each component does:
1) If the address signal ("A" == 5) and write ("1" == 1) are both enabled, outputs "Blue" == 2
2) If "Blue" == 2, outputs "Red" == 1. This gets added to the constant combinator for a total signal of "Red" == 0 and "Green" == 1.
3) While "Red" == 0, initiates a counter that counts up until "Red" =/= 0, at which point it resets. This is what allows the pulsed signals in the next step
4) When "green" from the counter hits 1 and 2, pulses green signals into the next cell.
5) Passes the input signal from the red wire to the memory component when the green pulses occur.
6) This is the memory component. First green pulse causes it to store all input values into memory. The next green pulse erases memory. Once initialized, this happens in reverse, so when a write occurs, it first erases the old memory, then writes the new values.
8) When the address ("A" == 5) and read ("0" == 1) are both enabled, passes "Blue" == 2 to combinator 7.
9) Filters out the "Blue" == 2 and "Green" == 1 signals from the read output.
7) When "Blue" == 0 (a read occurs), passes the value of combinator 6 onto the red wire.
PS. I will post an in-game picture later.
Perhaps, the same system can be done in more compact and simple way:
This build remembers all values from first constant combinator if ("0" signal = 1).
And these values can be taken from output in any time.