Fix WRAMX BANK offset in the right place

ROMX and WRAMX bank numers are stored in an object file as their number
minus one. This means that this offset has to be applied somewhere.

The old code applied the fix for ROMX and WRAMX in two different places.
It looks like the patch that added support for WRAMX didn't set the
offset correctly in 'src/link/assign.c'. When this was fixed, it was
done in the wrong place, in 'src/asm/asm.y'. This patch moves the fix to
'src/link/assign.c'.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2018-01-15 23:43:47 +00:00
parent c8fa799883
commit 975200834e
2 changed files with 2 additions and 5 deletions

View File

@@ -59,9 +59,6 @@ static void bankrangecheck(char *name, uint32_t secttype, int32_t org,
stype, bank, minbank, maxbank);
}
if (secttype == SECT_WRAMX)
bank -= minbank;
out_NewAbsSection(name, secttype, org, bank);
}

View File

@@ -39,10 +39,10 @@ const enum eSectionType SECT_MAX = SECT_OAM;
const struct sSectionAttributes SECT_ATTRIBUTES[] = {
{"WRAM0", BANK_INDEX_WRAM0, 0, 0, BANK_COUNT_WRAM0},
{"VRAM", BANK_INDEX_VRAM, 0, 0, BANK_COUNT_VRAM},
{"ROMX", BANK_INDEX_ROMX, -1, 1, BANK_COUNT_ROMX},
{"ROMX", BANK_INDEX_ROMX, -BANK_MIN_ROMX, BANK_MIN_ROMX, BANK_COUNT_ROMX},
{"ROM0", BANK_INDEX_ROM0, 0, 0, BANK_COUNT_ROM0},
{"HRAM", BANK_INDEX_HRAM, 0, 0, BANK_COUNT_HRAM},
{"WRAMX", BANK_INDEX_WRAMX, 0, 0, BANK_COUNT_WRAMX},
{"WRAMX", BANK_INDEX_WRAMX, -BANK_MIN_WRAMX, BANK_MIN_WRAMX, BANK_COUNT_WRAMX},
{"SRAM", BANK_INDEX_SRAM, 0, 0, BANK_COUNT_SRAM},
{"OAM", BANK_INDEX_OAM, 0, 0, BANK_COUNT_OAM}
};