Syscall 2: Firmware, home

BenchChapter 4: Stars and hubs

B12WICK

The task

P0 drives the lamp through R1. Any value but 0 lights it.

P1 ticks every 16 cycles. The lamp should flare for one tick.

Then leave it dark for three ticks, and repeat.

The board

The chip of WICKChip u1 with 2 ports: P0 digital out, reaching R1, D1, CH1; P1 timer 16 cycles.u1CHIP SC-2P0DIGITAL OUTR1, D1, CH1P1TIMER 16 CYCLES
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes.
Resistors
R1 470 Ω
LEDs
D1 yellow
Probes
CH1

Key idea

The output holds its level while you sleep, so one OUT covers several ticks.

Hints

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

Hint 1Show

Sleep, write 1, sleep once, write 0, then sleep three times before the next flare.

Hint 2Show

A chip asleep on IN P1 spends no energy. The dark stretches are just more sleeps.

Solution

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

One tick lit, three ticks dark.

u1SC-2 standard

IN P1
MOV A, 1
OUT P0
IN P1
MOV A, 0
OUT P0
IN P1
IN P1
IN P1
CYCLES
27
at par
ENERGY
54
at par
NODES
1
at par
INSTRUCTIONS
9
at par