Signal Divider

Solution

Solution

@0
_: JRO RIGHT
ADD 8
JMP _
ADD 4
MOV ACC DOWN
MOV NIL ACC

@1
MOV UP ACC
_: SAV
MOV 1 RIGHT
SUB RIGHT
JLZ DIV8
MOV 1 LEFT
JMP _
DIV8: MOV 3 RIGHT
ADD RIGHT
JLZ ENDSQ
MOV 3 LEFT
JMP E
ENDSQ:SWP
MOV 4 LEFT
E:MOV ACC DOWN

@2
MOV UP ACC
MOV ACC RIGHT
ADD ACC
ADD ACC
SAV
ADD ACC
_: JRO LEFT
MOV ACC LEFT
JMP _
SWP
MOV ACC LEFT

@3
MOV LEFT ACC
MOV DOWN NIL
MOV ACC DOWN

@4

@5
MOV UP ACC
_: SAV
MOV 1 RIGHT
SUB RIGHT
JLZ DIV8
MOV 1 DOWN
JMP _
DIV8: MOV 3 RIGHT
ADD RIGHT
JLZ ENDSQ
MOV 3 DOWN
JMP E
ENDSQ:SWP
MOV 4 DOWN
E:MOV ACC DOWN

@6
MOV -1 RIGHT
NOP
NOP
MOV RIGHT ACC
SAV
ADD ACC
_: JRO LEFT
MOV ACC LEFT
JMP _
SWP
MOV ACC LEFT

@7

@8
MOV UP RIGHT

@9
MOV LEFT ACC
_: JRO UP
ADD 2
JMP _
ADD 1
MOV ACC DOWN
MOV UP RIGHT

@10
MOV LEFT DOWN

@11