From eb824765918b7c54b08a700f5123092cfcae3fc8 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Fri, 10 Jan 2020 14:57:39 +0100 Subject: [PATCH] Make bank of "bank 0" sections known to RGBASM This allows `BANK("Some ROM0 section")` to be used in a constant expression --- src/asm/output.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/asm/output.c b/src/asm/output.c index c319a153..ca82446f 100644 --- a/src/asm/output.c +++ b/src/asm/output.c @@ -639,6 +639,15 @@ struct Section *out_FindSection(char *pzName, uint32_t secttype, int32_t org, if (pSect->pzName == NULL) fatalerror("Not enough memory for sectionname"); + // Force the bank to be 0 if that's the only possibility + switch (secttype) { + case SECTTYPE_ROM0: + case SECTTYPE_WRAM0: + case SECTTYPE_OAM: + case SECTTYPE_HRAM: + bank = 0; + } + pSect->nType = secttype; pSect->nPC = 0; pSect->nOrg = org;