Syscall 2: Firmware, home

SignalChapter 5: Half duplex

32STEP UP

The task

A value of X higher than the one before it goes to P. Any other value goes to Q.

The first value is compared with 0.

The board

The board of STEP UP2 cores: lead and j. Inputs X; outputs P and Q.leadSC-2 15 LINESjSC-2 15 LINESP0P1P2P0P1XPQ
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

The far core keeps the last value and answers which way the near copy goes.

Hints

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

Hint 1Show

The right core can keep the last value in B from one round to the next.

Hint 2Show

XCH puts the new value in B and the old one in A, ready to compare.

Hint 3Show

Answer on the same wire so the left core knows where its own copy goes.

Solution

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

jSC-2 standard

T: IN P0
XCH A, B
SUB B
JL U
MOV A, 0
OUT P0
JMP T
U: MOV A, B
OUT P1
MOV A, 1
OUT P0

leadSC-2 standard

T: IN P0
OUT P1
MOV B, A
IN P1
JNZ T
MOV A, B
OUT P2
CYCLES
508
at par
ENERGY
3144
at par
NODES
2
at par
INSTRUCTIONS
18
at par