shithub: rgbds

Download patch

ref: eb4bbb3e0bee84752f4f5c0bce9e76d76bc36ef9
parent: 2ab10a95e4c5e269563fa424e2e5cceae8041b36
author: Anthony J. Bentley <[email protected]>
date: Sat Feb 21 22:52:28 EST 2015

Update mapfile code to support new section types.

From Antonio Niño Díaz.

--- a/src/link/mapfile.c
+++ b/src/link/mapfile.c
@@ -53,19 +53,36 @@
 {
 	if (mf) {
 		currentbank = bank;
-		if (bank == 0)
-			fprintf(mf, "Bank #0 (HOME):\n");
+		if (bank == BANK_ROM0)
+			fprintf(mf, "ROM Bank #0 (HOME):\n");
 		else if (bank < BANK_WRAM0)
-			fprintf(mf, "Bank #%ld:\n", bank);
+			fprintf(mf, "ROM Bank #%ld:\n", bank);
 		else if (bank == BANK_WRAM0)
-			fprintf(mf, "WRAM0:\n");
+			fprintf(mf, "WRAM Bank #0:\n");
+		else if (bank < BANK_VRAM)
+			fprintf(mf, "WRAM Bank #%ld:\n", bank - BANK_WRAMX + 1);
 		else if (bank == BANK_HRAM)
 			fprintf(mf, "HRAM:\n");
 		else if (bank == BANK_VRAM || bank == BANK_VRAM + 1)
 			fprintf(mf, "VRAM Bank #%ld:\n", bank - BANK_VRAM);
+		else if (bank < MAXBANKS)
+			fprintf(mf, "SRAM Bank #%ld:\n", bank - BANK_SRAM);
 	}
 	if (sf) {
-		sfbank = (bank >= 1 && bank <= 511) ? bank : 0;
+		if (bank < BANK_WRAM0)
+			sfbank = bank;
+		else if (bank == BANK_WRAM0)
+			sfbank = 0;
+		else if (bank < BANK_VRAM)
+			sfbank = bank - BANK_WRAMX + 1;
+		else if (bank == BANK_HRAM)
+			sfbank = 0;
+		else if (bank == BANK_VRAM || bank == BANK_VRAM + 1)
+			sfbank = bank - BANK_VRAM;
+		else if (bank < MAXBANKS)
+			sfbank = bank - BANK_SRAM;
+		else
+			sfbank = 0;
 	}
 }