Skip to content

“TIS-100” – INTERRUPT HANDLER (SEGMENT 33762)

TIS-100 index

full solution

It’s apparently not super efficient in either space or time, but I wrote this one as a state machine for each input line:

main code segment

There are two states, ZERO and ONE (standing for the last value read). Transitioning from ZERO to ONE outputs the number of that input line, while any other transition outputs 0. Then, to produce the desired output, all we need to do is add the outputs of all four state machines.