diff --git a/src/asm/section.c b/src/asm/section.c index 2776efe1..912e96a5 100644 --- a/src/asm/section.c +++ b/src/asm/section.c @@ -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)) + error("`LOAD` blocks cannot create a ROM section\n"); + struct Section *sect = getSection(name, type, org, attribs, false); loadOffset = curOffset; diff --git a/test/asm/load-rom.asm b/test/asm/load-rom.asm new file mode 100644 index 00000000..90445881 --- /dev/null +++ b/test/asm/load-rom.asm @@ -0,0 +1,5 @@ +SECTION "Hello", ROM0 + ld a, 1 +LOAD "Wello", ROM0 + ld a, 2 +ENDL diff --git a/test/asm/load-rom.err b/test/asm/load-rom.err new file mode 100644 index 00000000..32654082 --- /dev/null +++ b/test/asm/load-rom.err @@ -0,0 +1,3 @@ +ERROR: load-rom.asm(3): + `LOAD` blocks cannot create a ROM section +error: Assembly aborted (1 errors)! diff --git a/test/asm/load-rom.out b/test/asm/load-rom.out new file mode 100644 index 00000000..e69de29b