WORM Solution
DELTA ENCODER
WORM row 5

Prerequisites
Unlocks
w55 solved
Active cores0, 1, 3, 4
Program lines18
DetailWORM row 5
Walkthrough
DELTA ENCODER: OUT = IN[k]: IN[k-1]; the first output passes IN[0]
through (the prior sample is taken as 0).
Two-row rack: input tap rides core 1 (UP), output tap rides core 4 (DOWN).
A delayed copy of the stream meets the live copy at core 4, which subtracts.
core 1 read IN; send a live copy DOWN to core 4, a copy LEFT to core 0.
core 0 delay-by-1: emit the OLD value (0 first) DOWN to core 3, then keep the
new value as the next prev. ACC starts 0, so the first emit is 0.
core 3 relay the delayed value RIGHT into core 4 (split so the link->link
relay never drops a value when the write stalls a cycle).
core 4 ACC = live IN (UP); SUB the delayed IN (LEFT); emit DOWN.
Rack Solution
# DELTA ENCODER: OUT = IN[k]: IN[k-1]; the first output passes IN[0]
# through (the prior sample is taken as 0).
# Two-row rack: input tap rides core 1 (UP), output tap rides core 4 (DOWN).
# A delayed copy of the stream meets the live copy at core 4, which subtracts.
# core 1 read IN; send a live copy DOWN to core 4, a copy LEFT to core 0.
# core 0 delay-by-1: emit the OLD value (0 first) DOWN to core 3, then keep the
# new value as the next prev. ACC starts 0, so the first emit is 0.
# core 3 relay the delayed value RIGHT into core 4 (split so the link->link
# relay never drops a value when the write stalls a cycle).
# core 4 ACC = live IN (UP); SUB the delayed IN (LEFT); emit DOWN.
@1
MOV ACC, UP
MOV DOWN, ACC
MOV LEFT, ACC
@0
L: SAV
MOV ACC, RIGHT
XCH
MOV DOWN, ACC
XCH
JMP L
@3
MOV ACC, UP
MOV RIGHT, ACC
@4
MOV ACC, UP
SUB LEFT
MOV DOWN, ACC