Subsequence Extractor - TIS-100


Here is my solution for Subsequence Extractor in TIS-100 (211/4/23):

We take the IN.I and subtract 1 for every "cycle", while it is greater or equal to zero we discard the value from the right by sending -1 to the JRO. When it is less than zero then it is time to grab value from the sequence so we send 1 to the right, jumping to the code that send the ACC down. We enter the second phase of the process, we restore the initial IN.I, subtract the new IN.I and then grab the remaining value until the ACC greater than 0, in which case it is time to stop. We flush the sequence when we hit a zero or we receive the instruction to stop from the node on the left.