WORM Solution
DIGIT TAP
WORM row 6

Prerequisites
Unlocks
w26 solved
Active cores1, 2, 4, 5, 7
Program lines27
DetailWORM row 6
Walkthrough
DIGIT TAP: OUT = IN mod 10. 5-stage serpentine pipeline 0->1->5->4->8 balances
the reduction so no stage runs more than ~4 subtractions. The strip constants
(300/100/40) are multiples of 10, so they leave the value unchanged mod 10; each
stage adds back to keep ACC >= 0 at the handoff, and core 4 does the true final
mod-10 (JZ keeps an exact multiple at 0 instead of restoring it to 10).
Rack Solution
# DIGIT TAP: OUT = IN mod 10. 5-stage serpentine pipeline 0->1->5->4->8 balances
# the reduction so no stage runs more than ~4 subtractions. The strip constants
# (300/100/40) are multiples of 10, so they leave the value unchanged mod 10; each
# stage adds back to keep ACC >= 0 at the handoff, and core 4 does the true final
# mod-10 (JZ keeps an exact multiple at 0 instead of restoring it to 10).
@1
L: MOV ACC, UP
H: SUB 300
JG H
ADD 300
MOV RIGHT, ACC
@2
M: MOV ACC, LEFT
P: SUB 100
JG P
ADD 100
MOV DOWN, ACC
@5
N: MOV ACC, UP
Q: SUB 40
JG Q
ADD 40
MOV LEFT, ACC
@4
R: MOV ACC, RIGHT
S: SUB 10
JG S
JZ E
ADD 10
E: MOV DOWN, ACC
@7
MOV DOWN, UP