B99SIREN
The task
This chip is an SC-4, with registers C and D as well. P1 ticks every 20 cycles.
Two tone siren on P0: add 4 to a phase each tick for 16 ticks, then 8 for 16, and so on.
The phase wraps at 100, and P0 is high while it is 50 or more.
The board
- Resistors
- R1 330 Ω
- LEDs
- D1 red
- Probes
- CH1
Key idea
Count ticks in C from 0 to 31; C DIV 16 tells the two halves apart.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
The step is 4 plus 4 times C DIV 16.
Hint 2Show
The phase works as in VCO: ADD B, MOD 100, MOV B, A, then DIV 50 for the pin.
Solution
Reveal the Full SolutionThe complete program for SIREN. 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 phase accumulator whose step changes every 16 ticks.
u1SC-4 quad
IN P1
MOV A, C
ADD 1
MOD 32
MOV C, A
DIV 16
MUL 4
ADD 4
ADD B
MOD 100
MOV B, A
DIV 50
OUT P0- CYCLES
- 1028
- at par
- ENERGY
- 3084
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 13
- at par