Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Do "data.asm" is a bank of sorts that holds the assets, and "template.c " pulls/references those assets?

Yes. To do the link, you'll simply import the definitions from data.asm as "extern variables" in your C file.

For example, in my data.asm I have the lines:

spritesGFX:
.incbin "sprites16.pic"
spritesGFX_end:

(the "sprites16.pic" file being a BMP file converted to the SNES format by PVSNESLib)

Then, in my C file, in the variable declarations I use the line:

extern char spritesGFX, spritesGFX_end;

Now I can use those variables in my code: "spritesGFX" is the beginning of the graphical data, while "spritesGFX_end" is their end.

That way, I can load the graphical data from the ROM to the VRAM using the following line:

oamInitGfxSet(&spritesGFX, (&spritesGFX_end-&spritesGFX), &spritesPAL, (&spritesPAL_end-&spritesPAL), 0, 0x4000, OBJ_SIZE16);

The "&" in front of the variable name is meant to indicate that I don't need the variable value, but their address in memory (well, in that case in ROM), as we'll use the start/end address to load the data in VRAM (at least, that's how PVSNESLib works!)

All this code comes directly for the source code of Keeping SNES Alive btw.

(+1)

Thanks for the directions! I'll start working on a pong-clone over the next few days to get the hang of C.