Light and Bleep
Bleeper's whole vocabulary is a panel that lights and sounds at once. Draw a colour block in screen memory, flash it white for a beat, and fire a SID note at the same moment. Colour and sound, locked together — the atom the whole game is built from.
Every Simon-style game is built from one event: a panel that lights and sounds at the same time. Get that right and the rest is repetition. So start with a single panel — draw it, flash it, and give it a voice, all in one beat.
10 POKE 53281,0
20 PRINT CHR$(147)
30 DIM PR(4),PC(4),PK(4),PF(4)
40 PR(1)=4:PC(1)=7:PK(1)=2:PF(1)=30
50 POKE 54296,15:POKE 54277,0:POKE 54278,240
60 P=1:GOSUB 1000
70 P=1:GOSUB 1100
80 END
1000 RP=PR(P):CP=PC(P)
1010 FOR Y=0 TO 7:FOR X=0 TO 11
1020 POKE 1024+(RP+Y)*40+CP+X,160
1030 POKE 55296+(RP+Y)*40+CP+X,PK(P)
1040 NEXT X:NEXT Y
1050 RETURN
1100 RP=PR(P):CP=PC(P)
1110 FOR Y=0 TO 7:FOR X=0 TO 11:POKE 55296+(RP+Y)*40+CP+X,1:NEXT X:NEXT Y
1120 POKE 54273,PF(P):POKE 54272,0:POKE 54276,17
1130 FOR T=1 TO 200:NEXT T
1140 POKE 54276,16
1150 FOR Y=0 TO 7:FOR X=0 TO 11:POKE 55296+(RP+Y)*40+CP+X,PK(P):NEXT X:NEXT Y
1160 RETURN
There are three new ideas here, and the program keeps them in tidy boxes. The panel data —
lines 40 — stores each panel's row, column, colour and pitch in arrays, so panel 1 is just
PR(1), PC(1), PK(1), PF(1). The draw routine at line 1000 fills a block of screen
RAM (from 1024) with solid blocks and sets the matching colour RAM (from 55296) — the
screen-as-canvas you met in Skyline, now a rectangle.
The flash-and-tone routine at line 1100 is the heart of it. It rewrites the panel's colour
RAM to white for a beat, fires a SID note — POKE 54273 sets the pitch and POKE 54276,17 opens
the gate that starts the sound — holds, then closes the gate (POKE 54276,16) and restores the
panel's colour. Line 50 set the SID up first: volume full (54296) and an envelope (54277,
54278) so the note has a shape. The flash and the note fire together, so the panel speaks.
Try this
- Re-pitch it. Change
PF(1)=30toPF(1)=50for a higher note, or15for a lower one. The number is the panel's voice. - Hold it longer. The
FOR T=1 TO 200in line 1130 is how long the panel stays lit and loud. Make it400and the beat draws out;80and it snaps.
What's next
One panel speaks. In Unit 2 you draw all four, give each its own colour and pitch, and wrap
the flash-and-tone in a routine you can call for any panel with GOSUB.