Syscall 2: Firmware, home

BenchChapter 4: Stars and hubs

B20CLIPPER

The task

Z1 is a zener diode. It holds CH1 at 3.3 volts at most and lets lower levels pass.

P1 ticks every 40 cycles. On each tick, step the duty on P0 up a quarter:

25, 50, 75, then 100 percent, and back to 25. The top steps come out flat.

The board

The chip of CLIPPERChip u1 with 2 ports: P0 pwm out, reaching R1, C1, Z1, CH1; P1 timer 40 cycles.u1CHIP SC-2P0PWM OUTR1, C1, Z1, CH1P1TIMER 40 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 1 kΩ
Capacitors
C1 1 µF
Zener diodes
Z1, a zener diode
Probes
CH1

Key idea

Without Z1, 75 and 100 percent would give 3.75 and 5 volts.

Hints

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

Hint 1Show

Above 3.3 volts Z1 conducts and takes the extra current from R1.

Hint 2Show

Four blocks of three lines: IN P1, MOV A with the duty, OUT P0.

Solution

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

A staircase whose top steps the zener flattens.

u1SC-2 standard

IN P1
MOV A, 25
OUT P0
IN P1
MOV A, 50
OUT P0
IN P1
MOV A, 75
OUT P0
IN P1
MOV A, 100
OUT P0
CYCLES
34
at par
ENERGY
68
at par
NODES
1
at par
INSTRUCTIONS
12
at par