diff --git a/contrib/gbdiff.bash b/contrib/gbdiff.bash index 2772a0bb..f568e5d9 100755 --- a/contrib/gbdiff.bash +++ b/contrib/gbdiff.bash @@ -57,7 +57,7 @@ diff <(xxd "$1") <(xxd "$2") | while read -r LINE; do while read -r SYMADDR SYM; do SYMADDR=$((0x${SYMADDR#*:})) if [[ $SYMADDR -le $ADDR ]]; then - printf " (%s+%#x)\n" "$SYM" $((ADDR - SYMADDR)) + printf " (%s+0x%x)\n" "$SYM" $((ADDR - SYMADDR)) fi # TODO: assumes sorted sym files done | tail -n 1 diff --git a/src/asm/section.c b/src/asm/section.c index a8acca79..dcdb4d2e 100644 --- a/src/asm/section.c +++ b/src/asm/section.c @@ -335,8 +335,8 @@ static struct Section *getSection(char const *name, enum SectionType type, uint3 if (org != (uint32_t)-1) { if (org < sectionTypeInfo[type].startAddr || org > endaddr(type)) - error("Section \"%s\"'s fixed address %#" PRIx32 - " is outside of range [%#" PRIx16 "; %#" PRIx16 "]\n", + error("Section \"%s\"'s fixed address $%04" PRIx32 + " is outside of range [$%04" PRIx16 "; $%04" PRIx16 "]\n", name, org, sectionTypeInfo[type].startAddr, endaddr(type)); } diff --git a/src/fix/main.c b/src/fix/main.c index dc5a3f3c..d0a0fc25 100644 --- a/src/fix/main.c +++ b/src/fix/main.c @@ -969,7 +969,7 @@ static void processFile(int input, int output, char const *name, off_t fileSize) overwriteByte(rom0, 0x14B, oldLicensee, "old licensee code"); else if (sgb && rom0[0x14B] != 0x33) fprintf(stderr, - "warning: SGB compatibility enabled, but old licensee was %#x, not 0x33\n", + "warning: SGB compatibility enabled, but old licensee was 0x%02x, not 0x33\n", rom0[0x14B]); if (romVersion != UNSPECIFIED) @@ -1440,7 +1440,7 @@ do { \ if (sgb && oldLicensee != UNSPECIFIED && oldLicensee != 0x33) fprintf(stderr, - "warning: SGB compatibility enabled, but old licensee is %#x, not 0x33\n", + "warning: SGB compatibility enabled, but old licensee is 0x%02x, not 0x33\n", oldLicensee); argv += musl_optind; diff --git a/src/link/patch.c b/src/link/patch.c index 9eb90134..f71fc27e 100644 --- a/src/link/patch.c +++ b/src/link/patch.c @@ -525,7 +525,7 @@ static void applyFilePatches(struct Section *section, struct Section *dataSectio if (!isError && (value < types[patch->type].min || value > types[patch->type].max)) error(patch->src, patch->lineNo, - "Value %#" PRIx32 "%s is not %u-bit", + "Value %" PRId32 "%s is not %u-bit", value, value < 0 ? " (maybe negative?)" : "", types[patch->type].size * 8U); for (uint8_t i = 0; i < types[patch->type].size; i++) { diff --git a/src/link/section.c b/src/link/section.c index 74aabc05..7ea5a30f 100644 --- a/src/link/section.c +++ b/src/link/section.c @@ -274,8 +274,9 @@ static void doSanityChecks(struct Section *section, void *ptr) // Check if section has a chance to be placed if (section->size > sectionTypeInfo[section->type].size) - error(NULL, 0, "Section \"%s\" is bigger than the max size for that type: %#" PRIx16 " > %#" PRIx16, - section->name, section->size, sectionTypeInfo[section->type].size); + error(NULL, 0, "Section \"%s\" is bigger than the max size for that type: $%" + PRIx16 " > $%" PRIx16, + section->name, section->size, sectionTypeInfo[section->type].size); // Translate loose constraints to strong ones when they're equivalent @@ -296,14 +297,14 @@ static void doSanityChecks(struct Section *section, void *ptr) // Ensure the target address is valid if (section->org < sectionTypeInfo[section->type].startAddr || section->org > endaddr(section->type)) - error(NULL, 0, "Section \"%s\"'s fixed address %#" PRIx16 " is outside of range [%#" - PRIx16 "; %#" PRIx16 "]", section->name, section->org, + error(NULL, 0, "Section \"%s\"'s fixed address $%04" PRIx16 " is outside of range [$%04" + PRIx16 "; $%04" PRIx16 "]", section->name, section->org, sectionTypeInfo[section->type].startAddr, endaddr(section->type)); if (section->org + section->size > endaddr(section->type) + 1) - error(NULL, 0, "Section \"%s\"'s end address %#x is greater than last address %#x", - section->name, section->org + section->size, - endaddr(section->type) + 1); + error(NULL, 0, "Section \"%s\"'s end address $%04x is greater than last address $%04x", + section->name, section->org + section->size, + endaddr(section->type) + 1); } #undef fail diff --git a/test/asm/fixed-oob.err b/test/asm/fixed-oob.err index 873c63a3..f28e15c1 100644 --- a/test/asm/fixed-oob.err +++ b/test/asm/fixed-oob.err @@ -1,15 +1,15 @@ error: fixed-oob.asm(1): - Section "ROM0"'s fixed address 0xbabe is outside of range [0; 0x7fff] + Section "ROM0"'s fixed address $babe is outside of range [$0000; $7fff] error: fixed-oob.asm(3): - Section "ROMX"'s fixed address 0xbeef is outside of range [0x4000; 0x7fff] + Section "ROMX"'s fixed address $beef is outside of range [$4000; $7fff] error: fixed-oob.asm(5): - Section "VRAM"'s fixed address 0xc0de is outside of range [0x8000; 0x9fff] + Section "VRAM"'s fixed address $c0de is outside of range [$8000; $9fff] error: fixed-oob.asm(7): - Section "SRAM"'s fixed address 0xcafe is outside of range [0xa000; 0xbfff] + Section "SRAM"'s fixed address $cafe is outside of range [$a000; $bfff] error: fixed-oob.asm(11): - Section "WRAMX"'s fixed address 0xdad is outside of range [0xd000; 0xdfff] + Section "WRAMX"'s fixed address $0dad is outside of range [$d000; $dfff] error: fixed-oob.asm(13): - Section "OAM"'s fixed address 0xcab is outside of range [0xfe00; 0xfe9f] + Section "OAM"'s fixed address $0cab is outside of range [$fe00; $fe9f] error: fixed-oob.asm(15): - Section "HRAM"'s fixed address 0xbad is outside of range [0xff80; 0xfffe] + Section "HRAM"'s fixed address $0bad is outside of range [$ff80; $fffe] error: Assembly aborted (7 errors)! diff --git a/test/link/rom0-tiny-no-t.out b/test/link/rom0-tiny-no-t.out index 9143b45f..866957c7 100644 --- a/test/link/rom0-tiny-no-t.out +++ b/test/link/rom0-tiny-no-t.out @@ -1,2 +1,2 @@ -error: Section "rom" is bigger than the max size for that type: 0x8000 > 0x4000 +error: Section "rom" is bigger than the max size for that type: $8000 > $4000 Linking failed with 1 error