Syscall 2: Firmware, home

SignalChapter 4: Stars and hubs

26DIRECTORY

The task

For each index 0 to 5 on X, P must receive that entry of the directory.

Entries 0 to 2 sit in the left drawer, 3 to 5 in the right. Each counts from 0.

The board

The board of DIRECTORY3 cores: d0, h, and d1. Locked: d0 and d1. Inputs X; outputs P.d0LOCKEDT: IN P0JZ NSUB 1JZ OMOV A, 101OUT P0JMP TN: MOV A, 104OUT P0JMP TO: MOV A, 50OUT P0hSC-2 15 LINESd1LOCKEDT: IN P0JZ NSUB 1JZ OMOV A, 102OUT P0JMP TN: MOV A, 120OUT P0JMP TO: MOV A, 118OUT P0P0P0P1P2P3P0XP
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

Request and reply to two locked lookup tables; the right one counts from 0.

Hints

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

Hint 1Show

A drawer reads an index on its wire and answers on the same wire.

Hint 2Show

Ask first, then read the answer. Both ends writing at once is a HEAD ON.

Hint 3Show

The right drawer's 0 is entry 3.

Solution

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

hSC-2 standard

T: IN P0
SUB 3
JL L
OUT P2
IN P2
OUT P3
JMP T
L: ADD 3
OUT P1
IN P1
OUT P3
CYCLES
527
at par
ENERGY
1634
at par
NODES
1
at par
INSTRUCTIONS
11
at par