Before you can start writing code you must define a section. This tells the assembler what kind of data follows and if it is code where to put it.
SECTION "CoolStuff",ROMX
This switches to the section called "CoolStuff" (or creates it if it doesn't already exits) and it defines it as a code section. All sections within a sourcefile must be identified by a unique name.
Possible section types are as follows:
The following deprecated section names are aliases for some of the above sections:
Due to quite a lot of emails requesting an ORG directive you can now add an address to the sectiontype for the Gameboy:
SECTION "CoolStuff",ROM0[$1234]
This will force the section to address $1234. This also works with the other sectiontypes. For ROMX sections the linker will then place the section in any bank at the address you specify. If you also want to specify the bank you can do:
SECTION "CoolStuff",ROMX[$4567],BANK[3]
And if you only want to force the section into a certain bank, and not it's position within the bank, that's also possible:
SECTION "CoolStuff",ROMX,BANK[7]
HINT: If you think this is a lot of typing for doing a simple ORG type thing you can quite easily write an intelligent macro (called ORG for example) that uses \@ for the sectionname and determines correct sectiontype etc as arguments for SECTION
Last updated 18 July 1997 by Carsten Sorensen