Files
rgbds/src/linkdefs.cpp
T
ISSOtm f234796428 Avoid allocating for our linkdef names (#2111)
This reverts a change introduced in fd78a9ae8, though it wasn't that commit's main point
so I'm feeling okay with undoing that.

This feels like an overkill change, using a static string is good enough for this
since we never modify this. I have considered using `string_view` instead, to have
the best of both worlds, but that's not NUL-terminated so our print functions
get a little grumpy.
2026-09-17 13:58:30 -04:00

73 lines
1.7 KiB
C++

// SPDX-License-Identifier: MIT
#include "linkdefs.hpp"
// The default values are the most lax, as they are used as-is by RGBASM; only RGBLINK has the full
// info, so RGBASM's job is only to catch unconditional errors earlier.
// clang-format off: nested initializers
SectionTypeInfo sectionTypeInfo[SECTTYPE_INVALID] = {
{
.name = "WRAM0",
.startAddr = 0xC000,
.size = 0x2000, // Patched to 0x1000 if !isWRAM0Mode
.firstBank = 0,
.lastBank = 0,
},
{
.name = "VRAM",
.startAddr = 0x8000,
.size = 0x2000,
.firstBank = 0,
.lastBank = 1, // Patched to 0 if isDmgMode
},
{
.name = "ROMX",
.startAddr = 0x4000,
.size = 0x4000,
.firstBank = 1,
.lastBank = 65535,
},
{
.name = "ROM0",
.startAddr = 0x0000,
.size = 0x8000, // Patched to 0x4000 if !is32kMode
.firstBank = 0,
.lastBank = 0,
},
{
.name = "HRAM",
.startAddr = 0xFF80,
.size = 0x007F,
.firstBank = 0,
.lastBank = 0,
},
{
.name = "WRAMX",
.startAddr = 0xD000,
.size = 0x1000,
.firstBank = 1,
.lastBank = 7,
},
{
.name = "SRAM",
.startAddr = 0xA000,
.size = 0x2000,
.firstBank = 0,
.lastBank = 255,
},
{
.name = "OAM",
.startAddr = 0xFE00,
.size = 0x00A0,
.firstBank = 0,
.lastBank = 0,
},
};
// clang-format on
char const * const sectionModNames[] = {
"(no modifier)", // SECTION_NORMAL
"UNION", // SECTION_UNION
"FRAGMENT", // SECTION_FRAGMENT
};