aboutsummaryrefslogtreecommitdiff
path: root/sound.txt
diff options
context:
space:
mode:
Diffstat (limited to 'sound.txt')
-rw-r--r--sound.txt56
1 files changed, 56 insertions, 0 deletions
diff --git a/sound.txt b/sound.txt
new file mode 100644
index 0000000..c9754e9
--- /dev/null
+++ b/sound.txt
@@ -0,0 +1,56 @@
+Most of the sounds in the game are played by a sound engine that
+runs 'in the background' (called every vblank). There are some
+exceptions:
+
+- The descending tones played as the letters materialize, on the
+ title screen (but, the music after that uses the engine).
+- The descending tone you hear as Jumpman materializes, at the
+ start of a level.
+- The sound you hear as the screen crumbles, after you lose your
+ last life.
+
+Everything else uses the engine, and is stored as a series of
+engine opcodes. I've labelled these sfx_* in the source.
+
+The engine has 2 entry points: cue_sfx and cue_sfx_lowprior. The
+difference is that the _lowprior entry point will abort, if another call
+to cue_sfx is in progress. Also the arguments are passed differently.
+Also there are _jv (jump vector) versions of both entry points, which
+are the ones most of the rest of the code uses.
+
+Example sound effect:
+
+sfx_jump:
+ .byte $01,$A5,$00,$79,$04,$60,$04,$51 ; BFBE 01 A5 00 79 04 60 04 51 ...y.`.Q
+ .byte $04,$3C,$04,$51,$04,$60,$04,$79 ; BFC6 04 3C 04 51 04 60 04 79 .<.Q.`.y
+ .byte $04,$00 ; BFCE 04 00 ..
+
+Sound opcodes:
+
+00 snd_end end of sound
+01 xx yy snd_audc set distortion and volume (AUDCx value) to xx,
+ play previous freq for yy frames.
+ yy looks to always be zero in actual use,
+ except the title screen music where it's $02.
+02 xx yy snd_jump jump to address yyxx. this is an unconditional
+ jump, meaning the sfx plays continuously until
+ preempted or silenced.
+03 xx snd_rest play a rest, xx frames (sets AUDCx to 0)
+[04-FF] xx snd_note play [opcode] frequency for xx frames
+
+so sfx_jump might look like this:
+
+sfx_jump:
+ snd_audc $A5,$00
+ snd_note $79,$04
+ snd_note $60,$04
+ snd_note $51,$04
+ snd_note $3C,$04
+ snd_note $51,$04
+ snd_note $60,$04
+ snd_note $79,$04
+ snd_end
+
+or in english: distortion $A (pure tone), volume 5. for 4 frames each,
+play 3 ascending notes, a higher note, then the same 3 notes in reverse
+order. the whole thing takes 28 frames to complete, or about 1/2 sec.