Scramble banks from the end of the ROM (#1273)

This is more likely to test edge cases, such as having content in banks with their highest bit set.
This commit is contained in:
Rangi
2023-12-17 20:14:03 -05:00
committed by GitHub
parent 5a3a215b0e
commit 39018174c5
5 changed files with 61 additions and 23 deletions

View File

@@ -122,7 +122,7 @@ for i in *.asm; do
desired_binname=${i%.asm}.out.bin
if [ -f "$desired_binname" ]; then
"$RGBLINK" -o "$gb" "$o"
rom_size=$(wc -c < "$desired_binname")
rom_size=$(printf %s $(wc -c <"$desired_binname"))
dd if="$gb" count=1 bs="$rom_size" >"$output" 2>/dev/null
tryCmp "$desired_binname" "$output" gb
(( our_rc = our_rc || $? ))

View File

@@ -0,0 +1,5 @@
SECTION "fixed", ROMX, BANK[3]
ds $4000, 1
SECTION "floating", ROMX
db 2

View File

View File

@@ -41,7 +41,7 @@ tryCmp () {
fi
}
tryCmpRom () {
# `printf` lets us keep only the first returned word.
# `printf` lets us keep only the first returned word from `wc`.
rom_size=$(printf %s $(wc -c <"$1"))
dd if="$gbtemp" count=1 bs="$rom_size" >"$otemp" 2>/dev/null
tryCmp "$1" "$otemp"
@@ -146,6 +146,17 @@ tryDiff overlay/out.err "$outtemp"
tryCmp overlay/out.gb "$gbtemp"
(( rc = rc || $? ))
i="scramble-romx.asm"
startTest
"$RGBASM" -o "$otemp" scramble-romx/a.asm
rgblinkQuiet -o "$gbtemp" -S romx=3 "$otemp" >"$outtemp" 2>&1
tryDiff scramble-romx/out.err "$outtemp"
(( rc = rc || $? ))
# This test does not compare its exact output with 'tryCmpRom' because no scrambling order is guaranteed
rom_size=$(printf %s $(wc -c <"$gbtemp"))
test "$rom_size" = 65536 # Check for exactly 3 ROMX banks
(( rc = rc || $? ))
i="section-fragment/jr-offset.asm"
startTest
"$RGBASM" -o "$otemp" section-fragment/jr-offset/a.asm