Skip to content

Instantly share code, notes, and snippets.

@air
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save air/0b2ff9fd533844522da3 to your computer and use it in GitHub Desktop.
Save air/0b2ff9fd533844522da3 to your computer and use it in GitHub Desktop.
First SID control program
00 rem based on tone example at http://goo.gl/tIDtAy
05 rem sid is at d400 = 54272
10 sid=54272
12 rem high nibble multiplier
13 high=16
15 rem clear 28 sid bytes
20 for i = 0 to 28 : poke sid + i, 0 : next
25 rem set volume segment of d418 (3 bits) to maximum %111
30 poke sid + 24, 15
35 rem everything here will act on voice 1.
36 rem play a D, frequency value 10001. Low byte 17...
38 poke sid, 17
39 rem ...and high byte 39, since (39*256) + 17 = 10001
40 poke sid + 1, 39
45 rem set both attack and delay nibbles to 0 - i.e. we just sustain
46 rem multiply attack by 16 (high nibble) and add decay (low)
50 poke sid + 5, 0*high + 0
55 rem set sustain volume to maximum 15, set release length to 10 (1500ms)
60 poke sid + 6, 15*high + 10
65 rem set control bits 0 (start cycle) and 4 (triangle wave)
70 poke sid + 4, 1 + 16
75 rem unset control bit 0 (start release) and keep set bit 4 (triangle wave)
80 poke sid + 4, 16
82 rem immediately starts releasing from our sustain volume, so zero A/D/S.
84 rem remove line 80 for a constant tone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment