Skip to content

Instantly share code, notes, and snippets.

@Frank-Buss
Created September 25, 2019 05:09
Show Gist options
  • Save Frank-Buss/1066eaaf8b0e2a718fcf38bf64a6ce2e to your computer and use it in GitHub Desktop.
Save Frank-Buss/1066eaaf8b0e2a718fcf38bf64a6ce2e to your computer and use it in GitHub Desktop.
4 tone gong on the Commander X16
100 REM RESET SOUND CHIP
110 FOR I = 0 TO 255 : POKE $9FE0, I : POKE $9FE1, 0 : NEXT
120 REM GONG
130 O=5:N=0:C=0:GOSUB 1000
140 O=5:N=9:C=1:GOSUB 1000
150 O=6:N=0:C=2:GOSUB 1000
160 O=6:N=9:C=3:GOSUB 1000
170 REM NOTE OFF FOR ALL 4 CHANNELS
180 FOR I = 1 TO 4000:NEXT
190 POKE $9FE0, $08 : POKE $9FE1, $00
200 POKE $9FE0, $08 : POKE $9FE1, $01
210 POKE $9FE0, $08 : POKE $9FE1, $02
220 POKE $9FE0, $08 : POKE $9FE1, $03
900 END
1000 REM N = NOTE, O = OCTAVE, C = CHANNEL, F = FRACTION
1010 REM ENABLE L/R, SET CONNECTION 7, FEEDBACK 2
1020 POKE $9FE0, $20+C : POKE $9FE1, $C7 + 2*8
1030 REM SET FREQUENCY
1040 POKE $9FE0, $28+C : POKE $9FE1, O*16+N
1050 REM VOLUME
1060 POKE $9FE0, $60+C : POKE $9FE1, $07
1070 REM ATTACK
1080 POKE $9FE0, $80+C : POKE $9FE1, $18
1090 REM RELEASE
1100 POKE $9FE0, $E0+C : POKE $9FE1, $05
1110 REM NOTE ON
1120 POKE $9FE0, $08 : POKE $9FE1, $08 + C
1130 FOR I = 1 TO 3000:NEXT
1140 RETURN
@Frank-Buss
Copy link
Author

The multipliers got scrambled in your comment, but looks and sounds good! But I think would be better to use C for a more complex player, it just gets messy as usual with this old Commodore BASIC dialect :-)

@MiklosPathy
Copy link

For now, figuring out the basics, it is enough for me. Also, C would be to easy. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment