I will start off by saying I am reformatting my code to accommodate the bank codes the HPMAN provided.
My thought process here is that if my project exceeds the 1MB P1 limit I can fall back on banking to get maximum Mega Shock.
I have already formatted quite a bit of my code but I am willing to reverse my code if there is indeed a better way to initialize the sprites.
There are two methods known to me:
Method 1: Non-Banked Method
This method uses externs.h in the root of your project directory and has a clean call for graphics initialization.
extern spriteInfo Box;
extern paletteInfo Box_Palettes;
aSpriteInit(&BOX,&Box,1,16,0,0,0,0);
palJobPut(16,Box_Palettes.palCount,Box_Palettes.data);
Method 2: Banked Method
This method does have bk0Include.h which can be included in the root of your Bank directory....
I can compile fine but when I call the graphics data outlined in the file I get a compiler error stating the gfx I am calling do not exist.
Based on the Image Catalog method that HPMAN laid out this is what I have been doing....
1. Image Catalog
.include "bankMaps.s"
MAINROM = 0
BANK_0 = 0
BANK_1 = 1
BANK_2 = 2
BANK_3 = 3
ENDMARK = 0xffff
.globl Sprites
Sprites:
.word BANK_0
.long BOX
.long BOX_Palettes
2. *edit - include imagecatalog.s file to makefile (my name is Sprite.s)
OBJS = $(TMPDIR)/crt0_$(OUTPUT).o $(TMPDIR)/main.o \ $(TMPDIR)/Scrollers.o $(TMPDIR)/Sprites.o $(TMPDIR)/Pictures.o
3. *edit - add struct to represent the data structure in the image catalog
typedef struct sprData {
WORD bank;
spriteInfo* sprInfo; //Where you replace this line with picture/scroller depending on the catalog you are aiming to create
paletteInfo* palInfo;
} spriteData;
4. Sprite List *edit because you will have several sprites in your catalog keeping track of the indexes with defined words is necessary
#define Box 0
5. The graphics initialization is more bulky...1 additional line of code per call and a more verbose call style.
volMEMWORD(0x2ffff0)=Sprites[Box].bank;
aSpriteInit(&BOX1,Sprites[Box].sprInfo,1,16,0,0,0,0);
palJobPut(16,((paletteInfo*)Sprites[Box].palInfo)->palCount,&((paletteInfo*)Sprites[Box].palInfo)->data);
I am not complaining here at all. If this is what needs to be done then so be it.
I am just asking in case I am majorly missing something here.
Hoping with banking there is a way to tap into the clean original style of graphics initialization.
Basically I am asking am I on the right track? or is there an easier way...