Skip to content

Commit

Permalink
LOAD blocks cannot be placed within a ROM section
Browse files Browse the repository at this point in the history
Fixes gbdev#576
  • Loading branch information
Rangi42 committed Dec 16, 2020
1 parent 1d9cc01 commit fd268da
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/asm/section.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org,
if (currentLoadSection)
fatalerror("`LOAD` blocks cannot be nested\n");

if (sect_HasData(type))
fatalerror("`LOAD` blocks cannot be placed within a ROM section\n");

struct Section *sect = getSection(name, type, org, attribs, false);

loadOffset = curOffset;
Expand Down
5 changes: 5 additions & 0 deletions test/asm/load-rom.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SECTION "Hello", ROM0
ld a, 1
LOAD "Wello", ROM0
ld a, 2
ENDL
2 changes: 2 additions & 0 deletions test/asm/load-rom.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FATAL: load-rom.asm(3):
`LOAD` blocks cannot be placed within a ROM section
Empty file added test/asm/load-rom.out
Empty file.

0 comments on commit fd268da

Please sign in to comment.