mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Report empty space between sections in map file
This commit is contained in:
@@ -375,6 +375,7 @@ static uint16_t writeMapBank(struct SortedSections const *sectList,
|
|||||||
bank + sectionTypeInfo[type].firstBank);
|
bank + sectionTypeInfo[type].firstBank);
|
||||||
|
|
||||||
uint16_t used = 0;
|
uint16_t used = 0;
|
||||||
|
uint16_t prevEndAddr = sectionTypeInfo[type].startAddr;
|
||||||
|
|
||||||
while (section || zeroLenSection) {
|
while (section || zeroLenSection) {
|
||||||
struct SortedSection const **pickedSection =
|
struct SortedSection const **pickedSection =
|
||||||
@@ -382,12 +383,21 @@ static uint16_t writeMapBank(struct SortedSections const *sectList,
|
|||||||
struct Section const *sect = (*pickedSection)->section;
|
struct Section const *sect = (*pickedSection)->section;
|
||||||
|
|
||||||
used += sect->size;
|
used += sect->size;
|
||||||
|
|
||||||
assert(sect->offset == 0);
|
assert(sect->offset == 0);
|
||||||
|
|
||||||
|
if (prevEndAddr < sect->org) {
|
||||||
|
uint16_t empty = sect->org - prevEndAddr;
|
||||||
|
|
||||||
|
fprintf(mapFile, " EMPTY: $%04" PRIx16 " byte%s\n", empty,
|
||||||
|
empty == 1 ? "" : "s");
|
||||||
|
}
|
||||||
|
|
||||||
|
prevEndAddr = sect->org + sect->size;
|
||||||
|
|
||||||
if (sect->size != 0)
|
if (sect->size != 0)
|
||||||
fprintf(mapFile, " SECTION: $%04" PRIx16 "-$%04x ($%04" PRIx16
|
fprintf(mapFile, " SECTION: $%04" PRIx16 "-$%04x ($%04" PRIx16
|
||||||
" byte%s) [\"%s\"]\n",
|
" byte%s) [\"%s\"]\n",
|
||||||
sect->org, sect->org + sect->size - 1,
|
sect->org, prevEndAddr - 1,
|
||||||
sect->size, sect->size == 1 ? "" : "s",
|
sect->size, sect->size == 1 ? "" : "s",
|
||||||
sect->name);
|
sect->name);
|
||||||
else
|
else
|
||||||
@@ -414,6 +424,14 @@ static uint16_t writeMapBank(struct SortedSections const *sectList,
|
|||||||
*pickedSection = (*pickedSection)->next;
|
*pickedSection = (*pickedSection)->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t bankEndAddr = sectionTypeInfo[type].startAddr + sectionTypeInfo[type].size;
|
||||||
|
|
||||||
|
if (prevEndAddr < bankEndAddr) {
|
||||||
|
uint16_t empty = bankEndAddr - prevEndAddr;
|
||||||
|
|
||||||
|
fprintf(mapFile, " EMPTY: $%04" PRIx16 " byte%s\n", empty,
|
||||||
|
empty == 1 ? "" : "s");
|
||||||
|
}
|
||||||
|
|
||||||
if (used == 0) {
|
if (used == 0) {
|
||||||
fputs(" EMPTY\n\n", mapFile);
|
fputs(" EMPTY\n\n", mapFile);
|
||||||
|
|||||||
Reference in New Issue
Block a user