Increase RGBASM test coverage

This commit is contained in:
Rangi42
2025-08-13 10:56:32 -04:00
parent 92826a726a
commit 2bdf61da70
19 changed files with 94 additions and 18 deletions

View File

@@ -337,7 +337,7 @@ bool fstk_FileError(std::string const &path, char const *functionName) {
if (options.missingIncludeState == GEN_EXIT) {
verbosePrint(
VERB_NOTICE,
"Aborting (-MG) on `%s` file \"%s\": %s\n",
"Aborting due to '-MG' on `%s` file \"%s\": %s\n",
functionName,
path.c_str(),
strerror(errno)

View File

@@ -159,15 +159,10 @@ static void writeRpn(std::vector<uint8_t> &rpnexpr, std::vector<uint8_t> const &
case RPN_SYM:
// The symbol name is always written expanded
sym = sym_FindExactSymbol(getSymName());
if (sym->isConstant()) {
rpnexpr[rpnptr++] = RPN_CONST;
value = sym->getConstantValue();
} else {
rpnexpr[rpnptr++] = RPN_SYM;
registerUnregisteredSymbol(*sym); // Ensure that `sym->ID` is set
value = sym->ID;
}
registerUnregisteredSymbol(*sym); // Ensure that `sym->ID` is set
value = sym->ID;
rpnexpr[rpnptr++] = RPN_SYM;
rpnexpr[rpnptr++] = value & 0xFF;
rpnexpr[rpnptr++] = value >> 8;
rpnexpr[rpnptr++] = value >> 16;

View File

@@ -351,11 +351,8 @@ uint32_t Symbol::getConstantValue() const {
}
if (sym_IsPC(this)) {
if (!getSection()) {
error("PC has no value outside of a section");
} else {
error("PC does not have a constant value; the current section is not fixed");
}
assume(getSection()); // There's no way to reach here from outside of a section
error("PC does not have a constant value; the current section is not fixed");
} else {
error("`%s` does not have a constant value", name.c_str());
}