gbdev / rgbds

Rednex Game Boy Development System - An assembly toolchain for the Nintendo Game Boy and Game Boy Color
https://rgbds.gbdev.io
MIT License
1.33k stars 175 forks source link

RGBLINK doesn't convert WRAMX sections to WRAM0 under -w #1116

Closed StanHash closed 1 year ago

StanHash commented 1 year ago
; this.asm
SECTION "wram0", WRAM0
    ds $1800
SECTION "wramx", WRAMX
    ds $800
rgbasm this.asm -o this.o
rgblink -w -m this.map this.o

What I expect:

WRAM0 bank #0:
    SECTION: $c000-$d7ff ($1800 bytes) ["wram0"]
    SECTION: $d800-$dfff ($0800 bytes) ["wramx"]
    TOTAL EMPTY: $0000 bytes

What I get:

WRAM0 bank #0:
    SECTION: $c000-$d7ff ($1800 bytes) ["wram0"]
    EMPTY: $d800-$dfff ($0800 bytes)
    TOTAL EMPTY: $0800 bytes

WRAMX bank #1:
    SECTION: $d000-$d7ff ($0800 bytes) ["wramx"]
    EMPTY: $d800-$dfff ($0800 bytes)
    TOTAL EMPTY: $0800 bytes

This is not consistent with the doc for the -w/--wramx option that says "WRAMX sections [that aren't fixed to a bank other than 1] are treated as WRAM0"; and also breaks the ROM (as WRAM0 sections placed past $d000 and WRAMX sections in bank 1 overlap).


https://github.com/gbdev/rgbds/blob/fa13611bbf6a1db1a439d9ba4ec9e6e8bb4f9f7c/src/link/section.c#L251

I changed SECTTYPE_WRAMX to SECTTYPE_WRAM0 on that line to fix it locally.

ISSOtm commented 1 year ago

Yep, that's a silly mistake lol.