Syscall 2: Firmware, home

BenchChapter 4: Stars and hubs

B18SPIKE

The task

C1 passes only changes: CH1 spikes up when P0 rises, then settles back through R1.

When P0 falls, D1 catches the downward spike just under 0 volts.

P1 ticks every 20 cycles. Hold P0 high for two ticks and low for one, and repeat.

The board

The chip of SPIKEChip u1 with 2 ports: P0 digital out, reaching C1, R1, D1, CH1; P1 timer 20 cycles.u1CHIP SC-2P0DIGITAL OUTC1, R1, D1, 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 10 kΩ
Capacitors
C1 100 nF
Diodes
D1, a diode
Probes
CH1

Key idea

A level that holds shows nothing on CH1. Only the edges spike.

Hints

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

Hint 1Show

The small dip below 0 volts marks where P0 fell.

Hint 2Show

Sleep, write 1, sleep twice, write 0.

Solution

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

Two ticks high, one low, seen through C1.

u1SC-2 standard

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