mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-23 23:34:32 +00:00
Fix RGBLINK scrambling algorithm to work for SRAM
Since SRAM sections start from 0, we had been using a signed `int8_t curScrambleSRAM` counter to allow 0 as a scrambled bank, but this actually just placed all floating SRAM sections in bank 0.
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
SECTION "fixed", ROMX, BANK[3]
|
||||
db BANK(xLabel1), BANK(xLabel2), BANK(xLabel3), BANK(wLabel), BANK(sLabel)
|
||||
ds $1000 - 5, 4
|
||||
|
||||
SECTION "floating1", ROMX
|
||||
xLabel1:: ds $3000, 1
|
||||
|
||||
SECTION "floating2", ROMX
|
||||
xLabel2:: ds $3000, 2
|
||||
|
||||
SECTION "floating3", ROMX
|
||||
xLabel3:: ds $3000, 3
|
||||
|
||||
SECTION "wram", WRAMX
|
||||
wLabel:: ds 2
|
||||
|
||||
SECTION "sram", SRAM
|
||||
sLabel:: ds 2
|
||||
@@ -0,0 +1,25 @@
|
||||
DEF N = 6
|
||||
|
||||
SECTION "fixed", ROMX, BANK[3]
|
||||
; XXX: We rely on these landing at certain banks, which isn't *guaranteed*...
|
||||
FOR i, 1, N + 1
|
||||
db BANK(xLabel{d:i})
|
||||
ENDR
|
||||
FOR i, 1, N + 1
|
||||
db BANK(wLabel{d:i})
|
||||
ENDR
|
||||
FOR i, 1, N + 1
|
||||
db BANK(sLabel{d:i})
|
||||
ENDR
|
||||
ds $1000 - N * 3, $ff
|
||||
|
||||
FOR i, 1, N + 1
|
||||
SECTION "floating{d:i}", ROMX
|
||||
xLabel{d:i}:: ds $2000, i
|
||||
|
||||
SECTION "wram{d:i}", WRAMX
|
||||
wLabel{d:i}:: dw
|
||||
|
||||
SECTION "sram{d:i}", SRAM
|
||||
sLabel{d:i}:: dw
|
||||
ENDR
|
||||
Binary file not shown.
+3
-12
@@ -62,15 +62,6 @@ tryCmpRom () {
|
||||
tryCmp "$1" "$otemp"
|
||||
}
|
||||
|
||||
tryCmpRomSize () {
|
||||
rom_size=$(printf %s $(wc -c <"$1"))
|
||||
if [ "$rom_size" -ne "$2" ]; then
|
||||
echo "$bold${red}${test} binary size mismatch! ${rescolors}${resbold}"
|
||||
false
|
||||
fi
|
||||
(( our_rc = our_rc || $? ))
|
||||
}
|
||||
|
||||
rgblinkQuiet () {
|
||||
out="$(env "$RGBLINK" -Weverything -Bcollapse "$@")" || return $?
|
||||
if [[ -n "$out" ]]; then
|
||||
@@ -321,14 +312,14 @@ rgblinkQuiet -o "$gbtemp" -S "romx := 4" "$otemp" 2>"$outtemp"
|
||||
tryDiff "$test"/out.err "$outtemp"
|
||||
evaluateTest
|
||||
|
||||
test="scramble-romx"
|
||||
test="scramble-specs"
|
||||
startTest
|
||||
"$RGBASM" -o "$otemp" "$test"/a.asm
|
||||
continueTest
|
||||
rgblinkQuiet -o "$gbtemp" -S "romx=3,wramx=4,sram=4" "$otemp" 2>"$outtemp"
|
||||
tryDiff "$test"/out.err "$outtemp"
|
||||
# This test does not compare its exact output with 'tryCmpRom' because no scrambling order is guaranteed
|
||||
tryCmpRomSize "$gbtemp" 65536
|
||||
# This test does not trim its output with 'dd' because it needs to verify the correct output size
|
||||
tryCmp "$test"/out.gb "$gbtemp"
|
||||
evaluateTest
|
||||
|
||||
test="script-include"
|
||||
|
||||
Reference in New Issue
Block a user