Super NES Programming/Animated Sprites

This article is for slightly more advanced ASM programmers than the rest of this website.

By default, the SNES is limited to 16kB of sprite patterns, which is the same as: 512 8x8 sprites 128 16x16 sprites 32 32x32 sprites 8 64x64 sprites

As you can see, animated sprites can eat away the available memory pretty quickly. This is where DMA comes in. The only problem is DMA isn't all that fast. You only have time to DMA up to 6kB during v-blank, and even less if you take into account scrolling and OAM updating. For the purpose of this article, let's stick to 4kB.

How do we prevent DMAing over 4kB, regardless of what we throw at the screen? We need to make the system know when to stop, and continue the DMA loading into the next frame. How? My solution is to divide the v-ram into 1kB slots. I chose 1kB, because 1kB happens to be a row of 8 16x16 sprites.

All you have to do is jump to the "update_vram_slot" subroutine during vblank, and use the "change_vram" macro whenever you need to update an animation slot.

For example if you want update slot $0400 in vram from address $98a300 use this macro:

This code isn't limited to just sprite animation, it also can be used for background animation and scrolling.