shithub: rgbds

Download patch

ref: 2ab10a95e4c5e269563fa424e2e5cceae8041b36
parent: bc60b85785e7557a0d49f0fc121648fcc3ec2765
author: Anthony J. Bentley <[email protected]>
date: Sat Feb 21 22:48:00 EST 2015

Fix a bug in handling WRAMX sections with/without hardcoded addresses.

From Antonio Niño Díaz.

--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -324,6 +324,7 @@
 		if ((org = area_AllocSRAMAnyBank(pSection->nByteSize)) != -1) {
 			pSection->nOrg = org & 0xFFFF;
 			pSection->nBank = org >> 16;
+			pSection->nBank += BANK_SRAM;
 			pSection->oAssigned = 1;
 			DOMAXSBANK(pSection->nBank);
 		} else {
@@ -343,6 +344,7 @@
 		if ((org = area_AllocWRAMAnyBank(pSection->nByteSize)) != -1) {
 			pSection->nOrg = org & 0xFFFF;
 			pSection->nBank = org >> 16;
+			pSection->nBank += BANK_WRAMX - 1;
 			pSection->oAssigned = 1;
 			DOMAXWBANK(pSection->nBank);
 		} else {
@@ -557,8 +559,8 @@
 						 * bank are hardcoded.
 						 */
 
-						if (pSection->nBank >= 1
-						    && pSection->nBank <= 7) {
+						if (pSection->nBank >= 0
+						    && pSection->nBank <= 6) {
 							pSection->nBank +=
 							    BANK_WRAMX;
 							if (area_AllocAbs