Best uses of the SNES's 64KB of audio ram
Moderator: Moderators
-
- Posts: 3140
- Joined: Wed May 19, 2010 6:12 pm
Re: Best uses of the SNES's 64KB of audio ram
I'm surprised more games didn't use that because it simplifies music programming a lot.
Re: Best uses of the SNES's 64KB of audio ram
Running the music engine on the S-SMP instead of the S-CPU has several advantages.
The one drawback is that you lose maybe 8K of audio RAM for the player and the current song's order table and pattern data.
- The S-SMP has access to fine time bases, from 125 Hz on up. The S-CPU would normally be limited to the S-PPU's 60.1 or 50.0 Hz time base unless it uses VTIME, and VTIME is usually in use anyway for graphics. This means more precise tempo.
- Because the time base is independent of the S-PPU, the program running on the S-SMP does not need adjustment for NTSC or PAL-M on the one hand vs. PAL on the other.
- Running audio on the S-SMP frees up the S-CPU for game logic rather than music logic and waiting for the S-SMP to acknowledge every note, program change, pitch bend, and control change.
- Linear-pitch portamento and vibrato need multiplication, as does volume adjustment. The SPC700 has a multiplier, but the 65816 relies on an interrupt-unsafe MMIO for multiplication.
The one drawback is that you lose maybe 8K of audio RAM for the player and the current song's order table and pattern data.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Best uses of the SNES's 64KB of audio ram
@psychopathicteen I've wondered the same thing. However, with how much most early SNES game slow down, the music would fall apart.
Running the code on the S-CPU does free up some more space in audio ram though. However, I don't know how much space is normally taken by this.tepples wrote:Running the music engine on the S-SMP instead of the S-CPU has several advantages.
Re: Best uses of the SNES's 64KB of audio ram
I don't know how much space is normally taken in commercial games because I haven't traced into them. But extrapolating from music code that I wrote for another 6502 family CPU (and am off and on porting to the SPC700), I guess a player might fit in 2K and each song in maybe 3K at most. At that size, a game could load each song's order and pattern data in a matter of a few frames.
Re: Best uses of the SNES's 64KB of audio ram
Not necessarly, NES games have the CPU handling the music and they can slow down without the music falling apart if interputs are handled properly.Espozo wrote:@psychopathicteen I've wondered the same thing. However, with how much most early SNES game slow down, the music would fall apart.
Indeed, the only "advantage" of not doing it is freeing up RAM.Running the music engine on the S-SMP instead of the S-CPU has several advantages.
They don't necessarly need multiplication, and from reverse-engineering them I can assert that at least some engines by Squaresoft only supports non-linear pitch portamento.Linear-pitch portamento and vibrato need multiplication, as does volume adjustment.
-
- Posts: 3140
- Joined: Wed May 19, 2010 6:12 pm
Re: Best uses of the SNES's 64KB of audio ram
You could save a lot of CPU speed with HDMA. Even without HDMA, you can still have the CPU get everything ready while it's waiting for the SPC700. I also find the SPC700 way more frustrating than the 65816 to work with.