Syscall 2: Firmware, home

SignalChapter 2: Workshop

6FLOOR

The task

Only values greater than 0 may reach P. Drop zero and every negative value.

P will be shorter than X.

The board

The board of FLOOR2 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

Labels, JG, JMP, dropping values.

Hints

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

Hint 1Show

A label names a line, as in S: IN P0. A jump goes there, as in JMP S.

Hint 2Show

JG jumps when A is greater than 0, JL when it is less. JMP always jumps.

Hint 3Show

If the value is not positive, jump back to the read before writing.

Solution

Reveal the Full SolutionThe complete program for FLOOR. 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

S: IN P0
JG H
JMP S
H: OUT P1

c1SC-2 standard

IN P0
OUT P1
CYCLES
146
at par
ENERGY
954
at par
NODES
2
at par
INSTRUCTIONS
6
at par