Syscall 2: Firmware, home

BenchChapter 10: Meshes

B77GAMMA

The task

P0 reads a brightness knob on CH1. Eyes see brightness on a curve, not a straight line.

Set P1 to the square of the reading's tens: a reading of 70 gives 7 times 7, which is 49.

R1 and C1 smooth the duty onto CH2.

The board

The chip of GAMMAChip u1 with 2 ports: P0 analog in, reaching V1, CH1; P1 pwm out, reaching R1, C1, CH2.u1CHIP SC-2P0ANALOG INV1, CH1P1PWM OUTR1, C1, CH2
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.
Sources
V1 2.4 V triangle at 4 Hz and V2 2.5 V
Resistors
R1 10 kΩ
Capacitors
C1 1 µF
Probes
CH1 and CH2

Key idea

DIV 10 first, so the square is at most 100 and stays inside a word.

Hints

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

Hint 1Show

MUL takes a register as well as a number.

Hint 2Show

IN P0, DIV 10, MOV B, A, MUL B, OUT P1.

Solution

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

The tens, squared.

u1SC-2 standard

IN P0
DIV 10
MOV B, A
MUL B
OUT P1
CYCLES
2400
at par
ENERGY
4800
at par
NODES
1
at par
INSTRUCTIONS
5
at par