mirror of
https://github.com/gbdev/rgbds.git
synced 2026-10-06 04:05:38 +00:00
Allow STARTOF(SECTTYPE) and SIZEOF(SECTTYPE) to be constant when possible (#2131)
This commit is contained in:
1 parent
548a11c3ef
commit
e0ee6c9013
6 files changed
+45
-6
No files matched your search
+10
-4
@@ -142,14 +142,20 @@ void Expression::makeStartOfSection(std::string const §Name) {
|
||||
|
||||
void Expression::makeSizeOfSectionType(SectionType type) {
|
||||
assume(rpn.empty());
|
||||
data = "Section type's size is not known";
|
||||
rpn.emplace_back(RPN_SIZEOF_SECTTYPE, static_cast<uint8_t>(type));
|
||||
if (type == SECTTYPE_WRAM0) {
|
||||
data = "Section type WRAM0's size is not known (can be affected by RGBLINK '-w/--wramx')";
|
||||
rpn.emplace_back(RPN_SIZEOF_SECTTYPE, static_cast<uint8_t>(type));
|
||||
} else if (type == SECTTYPE_ROM0) {
|
||||
data = "Section type ROM0's size is not known (can be affected by RGBLINK '-t/--tiny')";
|
||||
rpn.emplace_back(RPN_SIZEOF_SECTTYPE, static_cast<uint8_t>(type));
|
||||
} else {
|
||||
data = static_cast<int32_t>(sectionTypeInfo[type].size);
|
||||
}
|
||||
}
|
||||
|
||||
void Expression::makeStartOfSectionType(SectionType type) {
|
||||
assume(rpn.empty());
|
||||
data = "Section type's start is not known";
|
||||
rpn.emplace_back(RPN_STARTOF_SECTTYPE, static_cast<uint8_t>(type));
|
||||
data = static_cast<int32_t>(sectionTypeInfo[type].startAddr);
|
||||
}
|
||||
|
||||
static bool tryConstZero(Expression const &lhs, Expression const &rhs) {
|
||||
|
||||
Reference in new issue
Block a user