Implement SIZEOF and STARTOF for section types (#1205)

This commit is contained in:
Rangi
2023-11-03 03:50:04 -04:00
committed by GitHub
parent 8f3369fe29
commit c869edd1d2
9 changed files with 93 additions and 10 deletions

View File

@@ -360,6 +360,30 @@ static int32_t computeRPNExpr(struct Patch const *patch,
}
break;
case RPN_SIZEOF_SECTTYPE:
value = getRPNByte(&expression, &size, patch->src, patch->lineNo);
if (value < 0 || value >= SECTTYPE_INVALID) {
error(patch->src, patch->lineNo,
"Requested SIZEOF() an invalid section type");
isError = true;
value = 0;
} else {
value = sectionTypeInfo[value].size;
}
break;
case RPN_STARTOF_SECTTYPE:
value = getRPNByte(&expression, &size, patch->src, patch->lineNo);
if (value < 0 || value >= SECTTYPE_INVALID) {
error(patch->src, patch->lineNo,
"Requested STARTOF() an invalid section type");
isError = true;
value = 0;
} else {
value = sectionTypeInfo[value].startAddr;
}
break;
case RPN_HRAM:
value = popRPN();
if (!isError && (value < 0