Syscall 2: Firmware, home

BenchChapter 4: Stars and hubs

B16RESERVOIR

The task

P0 charges C1 through the diode D1. A diode lets current through one way only.

When P0 drops, D1 blocks, so C1 drains slowly through R1 instead of back into P0.

P1 ticks every 20 cycles. Raise P0 for one tick, then drop it for two, and repeat.

The board

The chip of RESERVOIRChip u1 with 2 ports: P0 digital out, reaching D1, C1, R1, CH1; P1 timer 20 cycles.u1CHIP SC-2P0DIGITAL OUTD1, C1, R1, CH1P1TIMER 20 CYCLES
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes. On a narrow screen, scroll the board sideways to see all of it.
Resistors
R1 4.7 kΩ
Capacitors
C1 1 µF
Diodes
D1, a diode
Probes
CH1

Key idea

CH1 jumps up while P0 is high and sags while it is low.

Hints

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

Hint 1Show

The level holds while you sleep, so one OUT covers every tick until the next.

Hint 2Show

Sleep, write 1, sleep, write 0, then sleep again.

Solution

Reveal the Full SolutionThe complete program for RESERVOIR. 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 of charge, then two of slow drain.

u1SC-2 standard

IN P1
MOV A, 1
OUT P0
IN P1
MOV A, 0
OUT P0
IN P1
CYCLES
28
at par
ENERGY
56
at par
NODES
1
at par
INSTRUCTIONS
7
at par