Make options -t and -w consistent

Instead of converting from ROMX to ROM0 with -t and preventing the use
of WRAMX at all with -w, make each option prohibit the type of section
they affect.

This is a good idea because it can prevent a developer from making
mistakes when switching from using the options to not using them.
Generally, a change from using one single bank to multiple banks is
something that will take a lot of effort, and forgetting sections in
ROM0 or WRAM0 will only make the free space of those areas to be
reduced (and maybe prevent compilation), but it won't cause any problems
because of a forgotten bank swap in the code.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
This commit is contained in:
AntonioND
2017-04-02 21:55:16 +01:00
parent e9ed81074b
commit 7e3720b627
4 changed files with 25 additions and 36 deletions

View File

@@ -156,11 +156,13 @@ obj_ReadRGB0Section(FILE * f)
pSection->nBank = -1;
pSection->nAlign = 1;
/* does the user want the -s mode? */
if ((options & OPT_TINY) && (pSection->Type == SECT_ROMX)) {
pSection->Type = SECT_ROM0;
errx(1, "ROMX sections can't be used with option -t.");
}
if ((options & OPT_CONTWRAM) && (pSection->Type == SECT_WRAMX)) {
errx(1, "WRAMX sections can't be used with option -w.");
}
if ((pSection->Type == SECT_ROMX) || (pSection->Type == SECT_ROM0)) {
/*
* These sectiontypes contain data...
@@ -306,18 +308,20 @@ obj_ReadRGBSection(FILE * f, enum ObjectFileContents contents)
pSection->Type = (enum eSectionType) fgetc(f);
pSection->nOrg = readlong(f);
pSection->nBank = readlong(f);
if (contents & CONTAINS_SECTION_ALIGNMENT) {
pSection->nAlign = readlong(f);
} else {
pSection->nAlign = 1;
}
/* does the user want the -s mode? */
if ((options & OPT_TINY) && (pSection->Type == SECT_ROMX)) {
pSection->Type = SECT_ROM0;
errx(1, "ROMX sections can't be used with option -t.");
}
if ((options & OPT_CONTWRAM) && (pSection->Type == SECT_WRAMX)) {
errx(1, "WRAMX sections can't be used with option -w.");
}
if ((pSection->Type == SECT_ROMX) || (pSection->Type == SECT_ROM0)) {
/*
* These sectiontypes contain data...