diff --git a/src/asm/section.c b/src/asm/section.c index 5b6511c1..ada55352 100644 --- a/src/asm/section.c +++ b/src/asm/section.c @@ -417,11 +417,15 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org, if (!checkcodesection()) return; - if (currentLoadSection) - fatalerror("`LOAD` blocks cannot be nested\n"); + if (currentLoadSection) { + error("`LOAD` blocks cannot be nested\n"); + return; + } - if (sect_HasData(type)) + if (sect_HasData(type)) { error("`LOAD` blocks cannot create a ROM section\n"); + return; + } struct Section *sect = getSection(name, type, org, attribs, mod); @@ -433,8 +437,10 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org, void out_EndLoadSection(void) { - if (!currentLoadSection) + if (!currentLoadSection) { error("Found `ENDL` outside of a `LOAD` block\n"); + return; + } changeSection(); curOffset += loadOffset; diff --git a/test/asm/load-rom.err b/test/asm/load-rom.err index ad93703c..bc2b8093 100644 --- a/test/asm/load-rom.err +++ b/test/asm/load-rom.err @@ -1,3 +1,5 @@ ERROR: load-rom.asm(3): `LOAD` blocks cannot create a ROM section -error: Assembly aborted (1 error)! +ERROR: load-rom.asm(5): + Found `ENDL` outside of a `LOAD` block +error: Assembly aborted (2 errors)!