ref: 975200834ecefd2c05b5f7b292172d222fa751e8
parent: c8fa7998838199d1f1d3ae7ec94fcad58515fa02
author: Antonio Niño Díaz <[email protected]>
date: Mon Jan 15 18:43:47 EST 2018
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 <[email protected]>
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -59,9 +59,6 @@
stype, bank, minbank, maxbank);
}
- if (secttype == SECT_WRAMX)
- bank -= minbank;
-
out_NewAbsSection(name, secttype, org, bank);
}
--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -39,10 +39,10 @@
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}
};