shithub: rgbds

Download patch

ref: 1d012682497e5060df257a12c2a3e3388d43e4ab
parent: 02cb5a0526553259dfc8229f361619bc3d458371
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun May 2 19:51:41 EDT 2021

Remove LOAD FRAGMENT

It's very troublesome, with flaky semantics and a very restricted use space.

--- a/src/asm/section.c
+++ b/src/asm/section.c
@@ -427,6 +427,11 @@
 		return;
 	}
 
+	if (mod == SECTION_FRAGMENT) {
+		error("`LOAD FRAGMENT` is not allowed\n");
+		return;
+	}
+
 	struct Section *sect = getSection(name, type, org, attribs, mod);
 
 	changeSection();
--- a/test/asm/load-fragment.asm
+++ b/test/asm/load-fragment.asm
@@ -1,29 +1,2 @@
 SECTION "A", ROM0
-AData::
 LOAD FRAGMENT "RAM", WRAM0
-AMem::
-	db 0, 1, 2
-AMemEnd::
-ENDL
-ADataEnd::
-	dw AMem
-
-SECTION "B", ROM0
-BData::
-LOAD FRAGMENT "RAM", WRAM0
-BMem::
-	db 3, 4, 5, 6, 7
-BMemEnd::
-ENDL
-BDataEnd::
-	dw BMem
-
-SECTION "C", ROM0
-CData::
-LOAD FRAGMENT "RAM", WRAM0
-CMem::
-	db 8, 9
-CMemEnd::
-ENDL
-CDataEnd::
-	dw CMem
--- a/test/asm/load-fragment.err
+++ b/test/asm/load-fragment.err
@@ -1,0 +1,3 @@
+ERROR: load-fragment.asm(2):
+    `LOAD FRAGMENT` is not allowed
+error: Assembly aborted (1 error)!
binary files a/test/asm/load-fragment.out.bin /dev/null differ
--- a/test/link/load-fragment-jr.asm
+++ /dev/null
@@ -1,12 +1,0 @@
-SECTION "main", ROM0
-LOAD FRAGMENT "test", SRAM
-ENDL
-
-; The RPN patch for 'jr Label' in section "alt" refers to section "test",
-; but the object file puts section "test" after section "alt".
-; This case needs to be handled when identifying patches' PC sections.
-SECTION "alt", ROM0
-LOAD FRAGMENT "test", SRAM
-	jr Label
-Label:
-ENDL
--- a/test/link/load-fragment-jr.out.bin
+++ /dev/null
@@ -1,1 +1,0 @@
-
\ No newline at end of file
--- a/test/link/load-fragment/a.asm
+++ /dev/null
@@ -1,4 +1,0 @@
-SECTION "main", ROM0
-LOAD FRAGMENT "test", SRAM
-	db 0
-ENDL
--- a/test/link/load-fragment/b.asm
+++ /dev/null
@@ -1,6 +1,0 @@
-SECTION "SECTION2", ROM0
-LOAD FRAGMENT "test", SRAM
-	jr Label
-Label:
-	dw Label
-ENDL
--- a/test/link/load-fragment/out.gb
+++ /dev/null
@@ -1,1 +1,0 @@
-
\ No newline at end of file
--- a/test/link/section-fragment/jr-offset-load/a.asm
+++ /dev/null
@@ -1,4 +1,0 @@
-SECTION FRAGMENT "output", ROM0
-LOAD FRAGMENT "loaded", SRAM
-    ds 128
-ENDL
--- a/test/link/section-fragment/jr-offset-load/b.asm
+++ /dev/null
@@ -1,6 +1,0 @@
-SECTION FRAGMENT "output", ROM0
-LOAD FRAGMENT "loaded", SRAM
-label:
-	jr nz, label2
-label2:
-ENDL
binary files a/test/link/section-fragment/jr-offset-load/ref.out.bin /dev/null differ
--- a/test/link/test.sh
+++ b/test/link/test.sh
@@ -130,17 +130,6 @@
 tryCmp $gbtemp $gbtemp2
 rc=$(($? || $rc))
 
-i="load-fragment.asm"
-startTest
-$RGBASM -o $otemp load-fragment/a.asm
-$RGBASM -o $gbtemp2 load-fragment/b.asm
-rgblinkQuiet -o $gbtemp $otemp $gbtemp2 2>$outtemp
-tryDiff load-fragment/out.err $outtemp
-rc=$(($? || $rc))
-dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < load-fragment/out.gb)) > $otemp 2>/dev/null
-tryCmp load-fragment/out.gb $otemp
-rc=$(($? || $rc))
-
 i="overlay.asm"
 startTest
 $RGBASM -o $otemp overlay/a.asm
@@ -158,15 +147,6 @@
 rgblinkQuiet -o $gbtemp $otemp $gbtemp2
 dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < section-fragment/jr-offset/ref.out.bin)) > $otemp 2>/dev/null
 tryCmp section-fragment/jr-offset/ref.out.bin $otemp
-rc=$(($? || $rc))
-
-i="section-fragment/jr-offset-load.asm"
-startTest
-$RGBASM -o $otemp section-fragment/jr-offset-load/a.asm
-$RGBASM -o $gbtemp2 section-fragment/jr-offset-load/b.asm
-rgblinkQuiet -o $gbtemp $otemp $gbtemp2
-dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < section-fragment/jr-offset-load/ref.out.bin)) > $otemp 2>/dev/null
-tryCmp section-fragment/jr-offset-load/ref.out.bin $otemp
 rc=$(($? || $rc))
 
 i="section-union/good.asm"