← All lessons

LESSON 12 OF 13

SOUND

Making the SID chip sing with POKE.

SID 54272waveformsgate bitfrequency

The sound chip starts at address 54272. Register 24 is the volume (0-15). Each of the three voices has seven registers; for voice one, +1 is the high byte of the frequency, +5 is attack/decay, +6 is sustain/release, and +4 is the control register.

The control register chooses the waveform — 16 triangle, 32 sawtooth, 64 pulse, 128 noise — and bit 1 is the gate. POKE 54276,33 means sawtooth plus gate on: the note starts. POKE 54276,32 turns the gate off: the note stops.

Hold the note with a delay loop between the two POKEs. The DATA line here is a rising scale.

LESSON 128 lines

Type with the keyboard under the screen, or tap the blue screen to use your phone's own keyboard. While a program runs, keys go to INPUT and GET. When it says READY., type a line and press RETURN to run it straight away.