shithub: rgbds

Download patch

ref: eb824765918b7c54b08a700f5123092cfcae3fc8
parent: f1f70d250ac9d065e53aa224509c81fd7f2dcbf0
author: ISSOtm <[email protected]>
date: Fri Jan 10 09:57:39 EST 2020

Make bank of "bank 0" sections known to RGBASM
This allows `BANK("Some ROM0 section")` to be used in a constant expression

--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -639,6 +639,15 @@
 	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;