WORM Solution
THRESHOLD COUNTER
WORM row 7

Prerequisites
Unlocks
w57 solved
Active cores1, 4
Program lines13
DetailWORM row 7
Walkthrough
THRESHOLD COUNTER: emit a running count of inputs strictly above 50.
Two-row rack: input tap rides core 1 (UP), output tap rides core 4 (DOWN).
Core 1 just forwards each input down to the counter.
Core 4 keeps the count in BAK across the test: read v into ACC, SUB 50, and
branch on the sign. Both branches converge at E, which saves the new count
back into BAK and emits it. The loop wraps via JMP L.
Rack Solution
# THRESHOLD COUNTER: emit a running count of inputs strictly above 50.
# Two-row rack: input tap rides core 1 (UP), output tap rides core 4 (DOWN).
# Core 1 just forwards each input down to the counter.
# Core 4 keeps the count in BAK across the test: read v into ACC, SUB 50, and
# branch on the sign. Both branches converge at E, which saves the new count
# back into BAK and emits it. The loop wraps via JMP L.
@1
MOV DOWN, UP
@4
L: MOV ACC, UP
SUB 50
JG K
XCH
JMP E
K: XCH
ADD 1
E: SAV
MOV DOWN, ACC
JMP L