ENDL restores the label scope from before LOAD (#1180)

This commit is contained in:
Rangi
2023-10-26 16:58:36 -04:00
committed by GitHub
parent 22def89760
commit 84f3cb4075
4 changed files with 28 additions and 0 deletions

View File

@@ -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)

View 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

View File

View File