This page contains notes for the game Mega Man II.
Note: Information here can be referenced from the disassembly unless stated otherwise.
Sound Driver#
This section's primary reason to exist is because of the endless constant misinformation regarding the game's sound driver implementation. It can be considered supplementary info for this page as the sound driver was used in multiple games.
Sound Driver RAM Addresses#
- Writing to these via a debugger at any time triggers a new song or sound effect to play.
:*FF98 - "Port" for a new BGM call. The sound driver defaults this to FF.
:*FF99 - "Port" for a new SFX call. Uses the same default value as the BGM port.
:*FF9A - Currently playing BGM track ID (naturally, in hex).
- Valid BGM values:
:*00 - Silence
:*01 - Title Screen
:*02 - Stage Select
:*03 - Stage Start
:*04 - Password
:*05 - Boss
:*06 - Stage Clear
:*07 - Weapon Get
:*08 - Clashman
:*09 - Airman
:*0A - Metalman
:*0B - Hardman
:*0C - Woodman
:*0D - Topman
:*0E - Magnetman
:*0F - Needleman
:*10 - Wily Castle Intro
:*11 - Wily Castle Stage
:*12 - Ending
:*13 - Unused Ending
:* Values 14 through 20 are duplicates of the blank "Silent" song. Any further values afterwards are invalid and can crash the sound driver or the entire game.
Note that whenever a new BGM plays, the sound driver triggers the "silent" sound effect (SFX ID 00) to play alongside it.
- Valid SFX values:
:*00 - Silence
:*01 - Player Land
:*02 - Player Shoot
:*03 - Enemy Hit
:*04 - Enemy Dead/Explosion
:*05 - Shot Deflect
:*06 - Explode 2 (as in, the player died, or the boss was defeated)
:*07 - HP Meter Fill
:*08 - E-Tank collected (does not play if the player has max E-Tanks)
:*09 - 1UP collected
:*0A - Boss Door Shutter
:*0B - Boss HP Bar Fill (Also plays on the Weapon Get Screen when the text prints, or the Password screen when the cursor moves)
:*0C - Teleport In/Weapon Menu Open
:*0D - Teleport Out/Weapon Menu Close
:*0E - Debug Pause (Unused)
:*0F - Weapon Absorb
:*10 - Appearing Block/Yoku Block sound
:*11 - Ending Cutscene UFO Crash
:*12 - Cursor Move
:*13 - Player Damaged
:*14 - Unused
:* Values 15 through 1F are duplicates of the "silence" sound effect.
Sound Driver Wavetable Data#
This sound driver has a total of four wavetables, but only one is ever used by the game. However the GB version of Spartan X (which also uses this sound driver) uses all of them.
:*0055AAFF0055AAFF0055AAFF0055AAFF - Stairstepped Sawtooth wave, the only used wave. The data being repeated four times means the wavetable audibly plays two octaves higher than actually specified in the sound data.
:*0055AAFFAA550055AAFFAA550055AAFF - Unused "saw"-like wave
:*0022446688AACCEEFFDDBB9977553311 - Unused "Triangle" wave
:*00EDFEC600F5F3D500F5FBD700F503C9 - Unused "Distortion" wave
Sound Driver Sequence Data#
Music Arranging Misconception#
It's well known that this game's music is rough on the ears. However it may astonish people that it's intentionally programmed this way. Take this snippet from the title screen track for example:
octave $04
silence $02
octave $05
note $A2
note $83
note $62
note $53
note $53
wait $02
note $52
note $6A
octave $04
note $BA
octave $05
wait $01
wait $03
note $60
octave $04
note $A3
note $B2
octave $05
note $61
wait $03
As the Game Boy sound hardware plays the pulse channels (not the wave or noise channel) an octave higher than actually specified in the sound driver music data, this song essentially is using octaves 05 and 06 respectively, meaning the sound data is automatically playing well into the upper bounds of the console's frequency range. This is compounded further with aspects like the only used wavetable playing a given note two octaves higher due to the nature of it being repeated data.
In other words, the sound data is deliberately programmed into the ROM this high and therefore is not a bug of the sound driver, or as most commonly believed, a "rendering error".
Silent BGM Track#
While not nearly as interesting, BGM sound ID 00 triggers "silence". While some sound drivers would implement shutting music off as a standalone sound command, this game's usage of it instead has it as a short snippet of "music" data that actually just immediately stops all channels from playing anything.
Sound Driver Frequency Table#
Ironically, despite being infamously pointed to for its flaws, there is only one majorly detuned note in the entire tuning table! The other two are simply off by one, and the remaining are correct (and in fact, match many other GB titles, including the other titles in the series). How this happened is anyone's guess, but it was likely done accidentally by a miscalculation.
However the most unfortunate case is the extremely mistuned C#5 note. Despite being the only instance of this, the game's compositions hit this note very frequently, giving the wrong impression that the music is wildly out of tune even though it's actually only one note causing this. Most hilariously, other games using this sound driver (or variants) either rarely hit the note, or are composed in a way that avoids hitting said note, making this soundtrack a particularly interesting outlier.