Can SNES Vram be expanded?

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Can SNES Vram be expanded?

Post by Drew Sebastino »

Hello! I am fairly new to SNES programing (and programing in general, for that matter) and I was wondering if it were possible to expand the SNES's Vram size via an expansion chip (kind of like the MMC5 for the NES) or something like that. If so, could you add additional bits for selecting more sprite and background character data? Sorry if this question seems ridiculous. It's just that I have not seen any documentation on the matter.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Can SNES Vram be expanded?

Post by tepples »

NES and Neo Geo are the only consoles I know of that can use extra video memory in the cartridge. Super NES video memory cannot be expanded through the cartridge connector. If you're running out of space for background or sprite tiles, you can always blast in some more with DMA during vblank, replacing tiles that aren't used anymore. This philosophy (although without the DMA) was used to animate the player character as early as Battletoads for NES: some tiles in CHR RAM were reserved for the current animation frame for each player character, and heavily unrolled code would copy it to CHR RAM.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: Can SNES Vram be expanded?

Post by Drew Sebastino »

Oh, well, that's depressing... :( I had known about many games using dma every frame for tile data (mostly main characters as nothing usually shares tile data with them), but I had wanted to make a 64x64 explosion sprite with about 15 frames of animation. Because I will have multiple explosions on screen, changing the tile map would not be feasible. I seriously do not understand as to why the SNES would even have an option for 64x64 sprites, as it does not have nearly enough Vram to back it up. Oh, and out of shear desperation, can it expanded from the expansion port on the bottom of the system? :wink:
lidnariq
Posts: 10677
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Can SNES Vram be expanded?

Post by lidnariq »

No, the expansion port on the bottom of the system just allows for an extra device to be added to the SNES's "B" bus.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Can SNES Vram be expanded?

Post by tepples »

I don't know what your explosions look like, but you might be able to make one 32x32 quadrant of a 64x64 explosion and mirror it as four 32x32 sprites.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: Can SNES Vram be expanded?

Post by Drew Sebastino »

I know what you mean. All the explosions in contra III seem to be mirrored, but I think it looks extremely awkward. I will probably just have to use 32x32 sized sprites.
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Can SNES Vram be expanded?

Post by psycopathicteen »

Do this for every dynamically animated object.

- Check if there is enough DMA time.
- If not, don't update animation frame
- If so, continue
- Clear object's vram slot (area it takes up in VRAM) from the vram slot table
- Find new vram slot, using the vram slot table
- If slots are different, update animation frame
- If slots are the same, compare new and old animation frames
- If animation frames are the same, don't update animation frame
- If animation frames are different, update animation frame
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Can SNES Vram be expanded?

Post by tepples »

That's a lot more complexity than just statically allocating a VRAM slot to each actor the way I do in my white paper about the technique on GBA. Obviously it has to be slightly modified because you can rewrite only about a third of the sprite cels during one NTSC vblank, but averaging 20 fps across all sprites on screen still isn't half bad.
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Can SNES Vram be expanded?

Post by psycopathicteen »

Well, my method is a little more flexible with sprite sizes.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Can SNES Vram be expanded?

Post by tepples »

True, you can and should allocate different amounts of VRAM for different sizes of actor. But you have to allocate the largest amount of memory that each actor can use. Otherwise, you get problems when all actors happen to switch to a larger cel at once.
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Can SNES Vram be expanded?

Post by psycopathicteen »

...and actors wider than 64 pixels, should have tiles rearranged to fill up complete rows of 128 pixels.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Can SNES Vram be expanded?

Post by Sik »

tepples wrote:True, you can and should allocate different amounts of VRAM for different sizes of actor. But you have to allocate the largest amount of memory that each actor can use. Otherwise, you get problems when all actors happen to switch to a larger cel at once.
Random thought, but wouldn't this problem be similar to heaps in everyday memory management? (this also means you have to be careful about fragmentation)
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Can SNES Vram be expanded?

Post by psycopathicteen »

If it happens that you need more than 16kB a frame, you could do mid-screen bank switching, and divide actors between top half, bottom half, and both halves, and move them from one bank to another when they move from one region to the next.
Post Reply