mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Assign section locations to all UNIONs/FRAGMENTs
Fixes the test case from #800 The `out.gb` output was corrected, since the two "test" fragments have a different order in ROM than in SRAM. It is effectively: ; ROM0[$0000], fragments ordered by size jr Label dw Label db 0 ; SRAM[$a000], fragments ordered by .o order ds 1 ; db 0 ds 2 ; jr Label Label: ; $a003 ds 2 ; dw Label
This commit is contained in:
@@ -112,6 +112,13 @@ static inline void assignSection(struct Section *section,
|
|||||||
section->org = location->address;
|
section->org = location->address;
|
||||||
section->bank = location->bank;
|
section->bank = location->bank;
|
||||||
|
|
||||||
|
// Propagate the assigned location to all UNIONs/FRAGMENTs
|
||||||
|
// so `jr` patches in them will have the correct offset
|
||||||
|
for (struct Section *next = section->nextu; next != NULL; next = next->nextu) {
|
||||||
|
next->org = section->org;
|
||||||
|
next->bank = section->bank;
|
||||||
|
}
|
||||||
|
|
||||||
nbSectionsToAssign--;
|
nbSectionsToAssign--;
|
||||||
|
|
||||||
out_AddSection(section);
|
out_AddSection(section);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
SECTION "SECTION2", ROM0
|
SECTION "SECTION2", ROM0
|
||||||
LOAD FRAGMENT "test", SRAM
|
LOAD FRAGMENT "test", SRAM
|
||||||
jr Label
|
jr Label
|
||||||
Label:
|
Label:
|
||||||
dw Label
|
dw Label
|
||||||
ENDL
|
ENDL
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user