Syscall 2: Firmware, home

SignalChapter 7: Frames and loops

51TIMES TABLE

The task

P must receive X times Y. There is no instruction that multiplies.

X is never 0 and Y is from 0 to 9.

The board

The board of TIMES TABLE3 cores: m, k, and s. Inputs X and Y; outputs P.mSC-2 15 LINESkSC-2 15 LINESsSC-2 15 LINESP0P1P2P3P4P0P1P0P1XYP
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

Multiply by adding: one core sends X round Y times and a 0, another adds them up.

Hints

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

Hint 1Show

Multiplying is adding X to itself Y times.

Hint 2Show

k can send X round once for each step of Y and then a 0 to end the frame.

Hint 3Show

s adds up a frame the way h did in ROUND TRIP.

Solution

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

mSC-2 standard

IN P0
OUT P3
IN P1
OUT P3
IN P4
OUT P2

kSC-2 standard

IN P0
MOV B, A
IN P0
L: JZ DN
SUB 1
XCH A, B
OUT P1
XCH A, B
JMP L
DN: OUT P1

sSC-2 standard

S: IN P0
JZ E
ADD B
MOV B, A
JMP S
E: XCH A, B
OUT P1
CYCLES
587
at par
ENERGY
4600
at par
NODES
3
at par
INSTRUCTIONS
23
at par