ref: 0e0876b17f9c40c5a5e18dd4b536911451d5cfc1
parent: b28eea24fcab53f6d8b4d45392e50d3e05e7b69d
author: ISSOtm <eldredhabert0@gmail.com>
date: Fri Oct 7 12:04:02 EDT 2022
Print addr ranges for empty blocks as well Mirrors what sections do, for clarity & consistency
--- a/src/link/output.c
+++ b/src/link/output.c
@@ -404,6 +404,16 @@
}
+static void writeEmptySpace(uint16_t begin, uint16_t end)
+{
+ if (begin < end) {
+ uint16_t len = end - begin;
+
+ fprintf(mapFile, "\tEMPTY: $%04x-$%04x ($%04" PRIx16 " byte%s)\n",
+ begin, end - 1, len, len == 1 ? "" : "s");
+ }
+}
+
/*
* Write a bank's contents to the map file
* @param bankSections The bank's sections
@@ -432,13 +442,8 @@
used += sect->size;
assert(sect->offset == 0);
- if (prevEndAddr < sect->org) {
- uint16_t empty = sect->org - prevEndAddr;
+ writeEmptySpace(prevEndAddr, sect->org);
- fprintf(mapFile, "\tEMPTY: $%04" PRIx16 " byte%s\n", empty,
- empty == 1 ? "" : "s");
- }
-
prevEndAddr = sect->org + sect->size;
if (sect->size != 0)
@@ -474,19 +479,14 @@
uint16_t bankEndAddr = sectionTypeInfo[type].startAddr + sectionTypeInfo[type].size;
- if (prevEndAddr < bankEndAddr) {
- uint16_t empty = bankEndAddr - prevEndAddr;
+ writeEmptySpace(prevEndAddr, bankEndAddr);
- fprintf(mapFile, "\tEMPTY: $%04" PRIx16 " byte%s\n", empty,
- empty == 1 ? "" : "s");
- }
-
if (used == 0) {
fputs(" EMPTY\n\n", mapFile);
} else {
uint16_t slack = sectionTypeInfo[type].size - used;
- fprintf(mapFile, "\tSLACK: $%04" PRIx16 " byte%s\n\n", slack,
+ fprintf(mapFile, "\tTOTAL EMPTY: $%04" PRIx16 " byte%s\n\n", slack,
slack == 1 ? "" : "s");
}