Syscall 2: Firmware, home

SignalChapter 3: Chains and rings

12TALLY

The task

P must receive the running total of X. A zero clears the total and sends 0.

IN overwrites A, so the total has to live somewhere else.

The board

The board of TALLY2 cores: c0 and c1. Inputs X; outputs P.c0SC-2 15 LINESc1SC-2 15 LINESP0P1P0P1XP
The board as the puzzle screen lays it out. Cyan pins read, lemon pins write, violet pins go both ways. On a narrow screen, scroll the board sideways to see all of it.

Key idea

A counter that resets on zero; a value needed twice is sent twice.

Hints

Each hint goes a step further than the one before. Open them one at a time.

Hint 1Show

B keeps a value while A reads the next one.

Hint 2Show

ADD B then MOV B, A adds the value to the total and keeps the new total.

Hint 3Show

JZ jumps when A is 0, JNZ when it is not. A zero in A is also the new total.

Solution

Reveal the Full SolutionThe complete program for TALLY. Open it only when you want the answer.

The reference program

The game's own solution. It passes every test and scores exactly par on every benchmark.

c0SC-2 standard

IN P0
OUT P1

c1SC-2 standard

IN P0
JZ N
ADD B
N: MOV B, A
OUT P1
CYCLES
230
at par
ENERGY
1590
at par
NODES
2
at par
INSTRUCTIONS
7
at par