mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
ENDL restores the label scope from before LOAD (#1180)
This commit is contained in:
@@ -48,6 +48,7 @@ struct SectionStackEntry *sectionStack;
|
||||
uint32_t curOffset; // Offset into the current section (see sect_GetSymbolOffset)
|
||||
struct Section *currentSection = NULL;
|
||||
static struct Section *currentLoadSection = NULL;
|
||||
char const *currentLoadScope = NULL;
|
||||
int32_t loadOffset; // Offset into the LOAD section's parent (see sect_GetOutputOffset)
|
||||
|
||||
// A quick check to see if we have an initialized section
|
||||
@@ -439,6 +440,7 @@ void sect_SetLoadSection(char const *name, uint32_t type, uint32_t org,
|
||||
|
||||
struct Section *sect = getSection(name, type, org, attribs, mod);
|
||||
|
||||
currentLoadScope = sym_GetCurrentSymbolScope();
|
||||
changeSection();
|
||||
loadOffset = curOffset - (mod == SECTION_UNION ? 0 : sect->size);
|
||||
curOffset -= loadOffset;
|
||||
@@ -456,6 +458,7 @@ void sect_EndLoadSection(void)
|
||||
curOffset += loadOffset;
|
||||
loadOffset = 0;
|
||||
currentLoadSection = NULL;
|
||||
sym_SetCurrentSymbolScope(currentLoadScope);
|
||||
}
|
||||
|
||||
struct Section *sect_GetSymbolSection(void)
|
||||
|
||||
25
test/asm/endl-local-scope.asm
Normal file
25
test/asm/endl-local-scope.asm
Normal file
@@ -0,0 +1,25 @@
|
||||
SECTION "DMA ROM", ROM0[0]
|
||||
SetUpDMA::
|
||||
ld c, LOW(DMARoutine)
|
||||
ld b, DMARoutineCode.end - DMARoutineCode
|
||||
ld hl, DMARoutineCode
|
||||
.loop
|
||||
ld a, [hl+]
|
||||
ldh [c], a
|
||||
inc c
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
DMARoutineCode::
|
||||
LOAD "DMA RAM", HRAM[$FF80]
|
||||
DMARoutine::
|
||||
ld a, $C0
|
||||
ldh [rDMA], a
|
||||
ld a, $28
|
||||
.loop
|
||||
dec a
|
||||
jr nz, .loop
|
||||
ret
|
||||
ENDL
|
||||
.end ; This label should be in the DMARoutineCode scope after ENDL
|
||||
0
test/asm/endl-local-scope.err
Normal file
0
test/asm/endl-local-scope.err
Normal file
0
test/asm/endl-local-scope.out
Normal file
0
test/asm/endl-local-scope.out
Normal file
Reference in New Issue
Block a user