shithub: rgbds

Download patch

ref: e16af28676d553f84939b63589c8dc5d29fe4e21
parent: 25be5c65611d99bfc9809010c4e4b2a9b9ee2507
author: AntonioND <[email protected]>
date: Sun Apr 2 18:27:32 EDT 2017

Automate and improve rgblink test

Check all sections when testing BANK().

Add scripts to verify the tests and update the reference if needed.

Signed-off-by: AntonioND <[email protected]>

--- /dev/null
+++ b/test/link/bank-numbers.asm
@@ -1,0 +1,53 @@
+section "x",rom0[$0000]
+	db bank(r0),bank(r1),bank(r2),bank(r3) ; Should be enough
+	db bank(v0),bank(v1)
+	db bank(w0),bank(w1),bank(w2),bank(w3),bank(w4),bank(w5),bank(w6),bank(w7)
+	db bank(s0),bank(s1),bank(s2),bank(s3) ; Should be enough
+	db bank(o0)
+	db bank(h0)
+
+section "r0",rom0
+r0:
+section "r1",romx,bank[1]
+r1:
+section "r2",romx,bank[2]
+r2:
+section "r3",romx,bank[3]
+r3:
+
+section "v0",vram,bank[0]
+v0:
+section "v1",vram,bank[1]
+v1:
+
+section "s0",sram,bank[0]
+s0:
+section "s1",sram,bank[1]
+s1:
+section "s2",sram,bank[2]
+s2:
+section "s3",sram,bank[3]
+s3:
+
+section "w0",wram0
+w0:
+section "w1",wramx,bank[1]
+w1:
+section "w2",wramx,bank[2]
+w2:
+section "w3",wramx,bank[3]
+w3:
+section "w4",wramx,bank[4]
+w4:
+section "w5",wramx,bank[5]
+w5:
+section "w6",wramx,bank[6]
+w6:
+section "w7",wramx,bank[7]
+w7:
+
+section "o0",oam
+o0:
+
+section "h0",hram
+h0:
--- /dev/null
+++ b/test/link/bank-numbers.out
@@ -1,0 +1,2 @@
+rgblink:warning:Trying to calculate BANK() of label in HRAM.
+rgblink:warning:Trying to calculate BANK() of label in OAM.
binary files /dev/null b/test/link/bank-numbers.out.bin differ
--- a/test/link/ram-bank-numbers.asm
+++ /dev/null
@@ -1,36 +1,0 @@
-; this should generate a rom consisting of the following bytes:
-; 01 02 03 04 05 06 07 00 01 02 03 00 01
-
-section "x",rom0
-	db bank(w1),bank(w2),bank(w3),bank(w4),bank(w5),bank(w6),bank(w7)
-	db bank(s0),bank(s1),bank(s2),bank(s3)
-	db bank(v0),bank(v1)
-
-section "wa",wramx,bank[1]
-w1:
-section "wb",wramx,bank[2]
-w2:
-section "wc",wramx,bank[3]
-w3:
-section "wd",wramx,bank[4]
-w4:
-section "we",wramx,bank[5]
-w5:
-section "wf",wramx,bank[6]
-w6:
-section "wg",wramx,bank[7]
-w7:
-
-section "sa",sram,bank[0]
-s0:
-section "sb",sram,bank[1]
-s1:
-section "sc",sram,bank[2]
-s2:
-section "sd",sram,bank[3]
-s3:
-
-section "v00",vram,bank[0]
-v0:
-section "v01",vram,bank[1]
-v1:
--- /dev/null
+++ b/test/link/test.sh
@@ -1,0 +1,12 @@
+otemp=$(mktemp)
+gbtemp=$(mktemp)
+outtemp=$(mktemp)
+
+RGBASM=../../rgbasm
+RGBLINK=../../rgblink
+
+$RGBASM -o $otemp bank-numbers.asm
+$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
+diff bank-numbers.out $outtemp
+head -c 20 $gbtemp > $otemp 2>&1
+diff bank-numbers.out.bin $otemp
--- /dev/null
+++ b/test/link/update-refs.sh
@@ -1,0 +1,9 @@
+otemp=$(mktemp)
+gbtemp=$(mktemp)
+
+RGBASM=../../rgbasm
+RGBLINK=../../rgblink
+
+$RGBASM -o $otemp bank-numbers.asm
+$RGBLINK -o $gbtemp $otemp > bank-numbers.out 2>&1
+head -c 20 $gbtemp > bank-numbers.out.bin 2>&1