Best uses of the SNES's 64KB of audio ram

You can talk about almost anything that you want to on this board.

Moderator: Moderators

psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Best uses of the SNES's 64KB of audio ram

Post by psycopathicteen »

I'm surprised more games didn't use that because it simplifies music programming a lot.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Best uses of the SNES's 64KB of audio ram

Post by tepples »

Running the music engine on the S-SMP instead of the S-CPU has several advantages.
  1. 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.
  2. 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.
  3. 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.
  4. 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.
There isn't even the drawback of a drastically different programming model, as there is with the Z80 and 68000 on the Genesis or contemporary arcade system boards. The 65816 is a 65C02 with 16-bit registers, and the SPC700 is approximately a 65C02 with rearranged opcode numbers.

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.
User avatar
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

Post by Drew Sebastino »

@psychopathicteen I've wondered the same thing. However, with how much most early SNES game slow down, the music would fall apart.
tepples wrote:Running the music engine on the S-SMP instead of the S-CPU has several advantages.
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
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Best uses of the SNES's 64KB of audio ram

Post by tepples »

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.
User avatar
Bregalad
Posts: 8055
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Best uses of the SNES's 64KB of audio ram

Post by Bregalad »

Espozo wrote:@psychopathicteen I've wondered the same thing. However, with how much most early SNES game slow down, the music would fall apart.
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.
Running the music engine on the S-SMP instead of the S-CPU has several advantages.
Indeed, the only "advantage" of not doing it is freeing up RAM.
Linear-pitch portamento and vibrato need multiplication, as does volume adjustment.
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. :)
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Best uses of the SNES's 64KB of audio ram

Post by psycopathicteen »

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.
Post Reply