Your Spec file, before adding the assets to it, would look something like this:
beginseg
name "code"
flags BOOT OBJECT
entry nuBoot
address NU_SPEC_BOOT_ADDR
stack NU_SPEC_BOOT_STACK
include "codesegment.o"
// Microcode includes go here (omitted for simplicity reasons)
endseg
// Wave's aren't used for anything in the PC SDK, they're just for visual reference
beginwave
name "original"
include "code"
endwave
Adding in new raw assets is as simple as creating a new segment and specifying the RAW
flag. For instance, having the data from spr_bear.c
converted into binary form (with the name spr_bear.bin
) and linking it to our ROM is as simple as:
beginseg
name "spr_bear" // This name is important, and should be unique
flags RAW // Specify that this segment is raw data (and not code)
after "code" // Specify to put this data in ROM, right after our code segment (Although you can omit this line if you want)
include "spr_bear.bin" // The file to link
endseg
Do this for all the assets, and you're almost done. The next step is to open a C header file (or better yet, create a new one) and to create some extern
calls for your new segments:
extern u32 _spr_bearSegmentRomStart[];
extern u32 _spr_bearSegmentRomEnd[];
Remember that segment name I told you that was important and had to be unique? Whatever you set your segment name to, it needs to match the extern
's. Meaning, if you called your segment NAME
, then you would need to define the extern
's as _NAMESegmentRomStart
and _NAMESegmentRomEnd
respectively.