shithub: rgbds

Download patch

ref: dda3a066be61d1fdacaa2f05ce43907b04b3b9a0
parent: a6a47ff66d4c90c3b00893707b38d6409c2ac5f1
author: Antonio Niño Díaz <[email protected]>
date: Thu Apr 6 18:40:38 EDT 2017

Add test for HIGH() and LOW()

It compares the results of the operators with the expected result if
doing the same thing manually.

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- /dev/null
+++ b/test/link/high-low-a.asm
@@ -1,0 +1,22 @@
+ldhilo : MACRO
+    ld  HIGH(\1),LOW(\2)
+ENDM
+
+SECTION "r0", ROM0[$0]
+ld HIGH(af),a
+ld HIGH(bc),LOW(bc)
+ld LOW(bc),HIGH(bc)
+ld HIGH(de),LOW(de)
+ld LOW(de),HIGH(de)
+    ldhilo hl, hl
+ld LOW(hl),HIGH(hl)
+
+db HIGH(label+$AB)
+db LOW(label+$AB)
+
+db HIGH($1234)
+db LOW($1234)
+
+SECTION "o",OAM
+DS $10
+label:
--- /dev/null
+++ b/test/link/high-low-b.asm
@@ -1,0 +1,18 @@
+SECTION "r0", ROM0[$0]
+ld a,a
+ld b,c
+ld c,b
+ld d,e
+ld e,d
+ld h,l
+ld l,h
+
+db ((label+$AB) >> 8) & $FF
+db (label+$AB) & $FF
+
+db ($1234 >> 8) & $FF
+db $1234 & $FF
+
+SECTION "o",OAM
+DS $10
+label:
--- a/test/link/test.sh
+++ b/test/link/test.sh
@@ -1,5 +1,6 @@
 otemp=$(mktemp)
 gbtemp=$(mktemp)
+gbtemp2=$(mktemp)
 outtemp=$(mktemp)
 
 RGBASM=../../rgbasm
@@ -22,5 +23,11 @@
 diff romx-tiny-no-t.out $outtemp
 $RGBLINK -t -o $gbtemp $otemp > $outtemp 2>&1
 diff romx-tiny-t.out $outtemp
+
+$RGBASM -o $otemp high-low-a.asm
+$RGBLINK -o $gbtemp $otemp
+$RGBASM -o $otemp high-low-b.asm
+$RGBLINK -o $gbtemp2 $otemp
+diff $gbtemp $gbtemp2
 
 exit 0