shithub: rgbds

Download patch

ref: 7770827cce8029310c05d93fa9232a3620689ef5
parent: 7ab9742299276b89a116e51d707541723a433149
author: Anthony J. Bentley <[email protected]>
date: Wed Jul 31 18:14:31 EDT 2013

Redefine consistent names for section types, and document the changes.

--- a/doc/asm.htm
+++ b/doc/asm.htm
@@ -42,7 +42,7 @@
 <h3>Other ways than mnemonics to define data</h3>
 <ul>
 	<li><a href="asm/db.htm">Defining constant data</a>
-	<li><a href="asm/ds.htm">Declaring variables in a BSS section</a>
+	<li><a href="asm/ds.htm">Declaring variables in a RAM section</a>
 	<li><a href="asm/incbin.htm">Including binary files</a>
 </ul>
 
@@ -65,10 +65,7 @@
 	<li><a href="asm/expr_fix.htm">ATAN</a>
 	<li><a href="asm/expr_fix.htm">ATAN2</a>
 	<li><a href="asm/miscfunc.htm">BANK</a>
-	<li><a href="asm/section.htm">BSS</a>
-	<li><a href="asm/section.htm">CODE</a>
 	<li><a href="asm/expr_fix.htm">COS</a>
-	<li><a href="asm/section.htm">DATA</a>
 	<li><a href="asm/db.htm">DB</a>
 	<li><a href="asm/miscfunc.htm">DEF</a>
 	<li><a href="asm/expr_fix.htm">DIV</a>
@@ -101,6 +98,8 @@
 	<li><a href="asm/pops.htm">PUSHS</a>
 	<li><a href="asm/rept.htm">REPT</a>
 	<li><a href="asm/rs.htm">RB</a>
+	<li><a href="asm/section.htm">ROM0</a>
+	<li><a href="asm/section.htm">ROMX</a>
 	<li><a href="asm/rs.htm">RSRESET</a>
 	<li><a href="asm/rs.htm">RSSET</a>
 	<li><a href="asm/rs.htm">RW</a>
@@ -108,6 +107,7 @@
 	<li><a href="asm/set.htm">SET</a>
 	<li><a href="asm/shift.htm">SHIFT</a>
 	<li><a href="asm/expr_fix.htm">SIN</a>
+	<li><a href="asm/section.htm">SRAM</a>
 	<li><a href="asm/expr_str.htm">STRCAT</a>
 	<li><a href="asm/expr_str.htm">STRCMP</a>
 	<li><a href="asm/expr_str.htm">STRIN</a>
@@ -117,6 +117,8 @@
 	<li><a href="asm/expr_str.htm">STRUPR</a>
 	<li><a href="asm/expr_fix.htm">TAN</a>
 	<li><a href="asm/section.htm">VRAM</a>
+	<li><a href="asm/section.htm">WRAM0</a>
+	<li><a href="asm/section.htm">WRAMX</a>
 	<li><a href="asm/fail.htm">WARN</a>
 	<li><a href="asm/export.htm">XDEF</a>
 	<li><a href="asm/export.htm">XREF</a>
--- a/doc/asm/db.htm
+++ b/doc/asm/db.htm
@@ -10,13 +10,13 @@
 <p><dfn>DB</dfn> defines a list of bytes that will be stored in the final image. Ideal for tables and text.</p>
 <pre>DB   1,2,3,4,"This is a string"</pre>
 <p>Alternatively you can use <dfn>DW</dfn> to store a list of words. Strings are not allowed as arguments to DW.</p>
-<p>You can also use DB and DW without arguments. This works exactly like “DS 1” and “DS 2” respectively. Consequently DB and DW can be used in a BSS/HRAM/VRAM section.</p>
+<p>You can also use DB and DW without arguments. This works exactly like “DS 1” and “DS 2” respectively. Consequently DB and DW can be used in a WRAM0/WRAMX/HRAM/VRAM/SRAM section.</p>
 <h1>See also:</h1>
 <ul>
 	<li><a href="expr_int.htm">Integer and Boolean expressions</a>
 	<li><a href="expr_fix.htm">Fixed-point expressions and functions</a>
 	<li><a href="expr_str.htm">String expressions, functions and formatting</a>
-	<li><a href="ds.htm">Declaring variables in a BSS section</a>
+	<li><a href="ds.htm">Declaring variables in a RAM section</a>
 	<li><a href="miscfunc.htm">Other functions</a>
 </ul>
 
--- a/doc/asm/ds.htm
+++ b/doc/asm/ds.htm
@@ -7,7 +7,7 @@
 </head>
 <body>
 <h1>DS</h1>
-<p><dfn>DS</dfn> allocates a number of bytes. The content is undefined. This is the preferred method of allocationg space in a <a href="section.htm">BSS section</a>. You can however also use DB and DW without any arguments.</p>
+<p><dfn>DS</dfn> allocates a number of bytes. The content is undefined. This is the preferred method of allocationg space in a <a href="section.htm">RAM section</a>. You can however also use DB and DW without any arguments.</p>
 <pre>DS   str_SIZEOF     ;allocate str_SIZEOF bytes</pre>
 <h1>See also:</h1>
 <ul>
--- a/doc/asm/section.htm
+++ b/doc/asm/section.htm
@@ -8,47 +8,54 @@
 <body>
 <h1>SECTION</h1>
 <p>Before you can start writing code you must define a section. This tells the assembler what kind of data follows and if it is code where to put it.</p>
-<pre>SECTION   "CoolStuff",CODE</pre>
+<pre>SECTION   "CoolStuff",ROMX</pre>
 <p>This switches to the section called <b>"CoolStuff"</b> (or creates it if it doesn't already exits) and it defines it as a code section. All sections within a sourcefile must be identified by a <em>unique</em> name.</p>
-<table>
-	<caption>Section types</caption>
-<thead>
-<tr>
-	<th scope="col">Name</th>
-	<th scope="col">Function</th>
-</tr>
-</thead>
-<tr>
-	<td>CODE</td>
-	<td>A code section. The linker decides where to put this. For the Gameboy it also decides which bank to put it in except #0 (the HOME bank).</td>
-</tr>
-<tr>
-	<td>DATA</td>
-	<td>Really just a synonym for CODE.</td>
-</tr>
-<tr>
-	<td>BSS</td>
-	<td>This section is for variables. For the Gameboy it will be placed where the Gameboy RAM is.</td>
-</tr>
-<tr>
-	<td>HOME</td>
-	<td>Gameboy ONLY: A code section that will be placed in Gameboy bank #0.</td>
-</tr>
-<tr>
-	<td>VRAM</td>
-	<td>Gameboy ONLY: This section is for allocating VRAM and will be placed where the Gameboy VRAM is.</td>
-</tr>
-<tr>
-	<td>HRAM</td>
-	<td>Gameboy ONLY: This section is for allocating variables in the high RAM area ($FF80-$FFFE) and will be placed there. Suggested by Jens Ch. Restemeier. NOTE WELL: if you use this method of allocating HRAM the assembler will NOT choose the short addressingmode in the LD instruction because the actual address calculation is done by the linker! If you find this undesirable you can use <a href="rs.htm">RSSET/RB/RW</a> instead or use the LDIO mnemonic. The address calculation is then done by the assembler.</td>
-</tr>
-</table>
+
+<p>Possible section types are as follows:
+
+<dl>
+	<dt>ROM0</dt>
+	<dd>A ROM section. Mapped to memory at $0000–$3fff.</dd>
+
+	<dt>ROMX</dt>
+	<dd>A banked ROM section. Mapped to memory at $4000–$7fff. Valid banks range from 1 to 511.</dd>
+
+	<dt>VRAM</dt>
+	<dd>A banked video RAM section. Mapped to memory at $8000–$9fff. Can only allocate memory, not fill it. Valid banks range from 0 to 1.</dd>
+
+	<dt>SRAM</dt>
+	<dd>A banked external (save) RAM section. Mapped to memory at $a000–$bfff. Can only allocate memory, not fill it. Valid banks range from 0 to 3.</dd>
+
+	<dt>WRAM0</dt>
+	<dd>A general-purpose RAM section. Mapped to memory at $c000–$cfff. Can only allocate memory, not fill it.</dd>
+
+	<dt>WRAMX</dt>
+	<dd>A banked general-purpose RAM section. Mapped to memory at $d000–$dfff. Can only allocate memory, not fill it. Valid banks range from 1 to 7.</dd>
+
+	<dt>HRAM</dt>
+	<dd>A high RAM section. Mapped to memory at $ff80–$fffe. Can only allocate memory, not fill it. NOTE WELL: if you use this method of allocating HRAM the assembler will NOT choose the short addressingmode in the LD instruction because the actual address calculation is done by the linker! If you find this undesirable you can use <a href="rs.htm">RSSET/RB/RW</a> instead or use the LDIO mnemonic. The address calculation is then done by the assembler.</dd>
+</dl>
+
+<p>The following deprecated section names are aliases for some of the above sections:
+
+<dl>
+	<dt>HOME</dt>
+	<dd>Alias for ROM0.</dd>
+
+	<dt>CODE</dt>
+	<dt>DATA</dt>
+	<dd>Alias for ROMX.</dd>
+
+	<dt>BSS</dt>
+	<dd>Alias for WRAM0.</dd>
+</dl>
+
 <p>Due to quite a lot of emails requesting an ORG directive you can now add an address to the sectiontype for the Gameboy:</p>
-<pre>SECTION   "CoolStuff",HOME[$1234]</pre>
-<p>This will force the section to address $1234. This also works with the other sectiontypes. For CODE/DATA sections the linker  will then place the section in any bank at the address you specify. If you also want to specify the bank you can do:</p>
-<pre>SECTION   "CoolStuff",DATA[$4567],BANK[3]</pre>
+<pre>SECTION   "CoolStuff",ROM0[$1234]</pre>
+<p>This will force the section to address $1234. This also works with the other sectiontypes. For ROMX sections the linker  will then place the section in any bank at the address you specify. If you also want to specify the bank you can do:</p>
+<pre>SECTION   "CoolStuff",ROMX[$4567],BANK[3]</pre>
 <p>And if you only want to force the section into a certain bank, and not it's position within the bank, that's also possible:</p>
-<pre>SECTION   "CoolStuff",CODE,BANK[7]</pre>
+<pre>SECTION   "CoolStuff",ROMX,BANK[7]</pre>
 <p><strong>HINT:</strong> If you think this is a lot of typing for doing a simple ORG type thing you can quite easily write an intelligent macro (called ORG for example) that uses <a href="expr_str.htm">\@</a> for the sectionname and determines correct sectiontype etc as arguments for SECTION</p>
 <h1>See also:</h1>
 <ul>
@@ -58,6 +65,6 @@
 <li><a href="pops.htm">POPS and PUSHS:</a> The section stack.
 </ul>
 <hr>
-<p>Last updated �18 July 1997 by <a href="mailto:[email protected]">Carsten Sorensen</a></p>
+<p>Last updated 18 July 1997 by <a href="mailto:[email protected]">Carsten Sorensen</a></p>
 </body>
 </html>
--- a/doc/link.htm
+++ b/doc/link.htm
@@ -104,27 +104,14 @@
 <p>A line starting with # is ignored.
 <p>If you use libraries they will only be included if one of the objects actually reference them. This works on a SECTION level and not on a module level. This means that when you write libraries you can put each subroutine in its own SECTION so only the relevant bits are included.
 <h2 id="operationtg">Operation for Gameboy (-tg)</h2>
-<p><a href="asm.htm#sections">Sections</a> created with <b>HOME</b> in the assembler are placed in the GB bank #0 (the fixed bank $0000-$3FFF) in the order they are loaded from the objectfiles specified in the linkfile. So you want the first file in the linkfile to contain your header. <b>CODE/DATA</b> sections are placed in <em>any bank other than #0</em>. This means you have absolutely <em>no</em> control over which sections goes where. This insures minimal slack (unused bytes) at the end of each bank in the image.
+<p><a href="asm.htm#sections">Sections</a> created with <b>ROM0</b> in the assembler are placed in the GB bank #0 (the fixed bank $0000-$3FFF) in the order they are loaded from the objectfiles specified in the linkfile. So you want the first file in the linkfile to contain your header. <b>ROMX</b> sections are placed in <em>any bank other than #0</em>. This means you have absolutely <em>no</em> control over which sections goes where. This insures minimal slack (unused bytes) at the end of each bank in the image.
 <p>Currently  the linker doesn't calculate the GB checksums.
 You must use <a href="fix.htm">RGBFix</a> to do this.
 
 <h3 id="smallmode">Operation for Gameboy small mode (-ts)</h3>
-<p>Small mode forces all <b>DATA/CODE</b> sections to be of type <b>HOME</b> and increases the <b>HOME</b> section size from 16kB to 32kB. This also means that <b>CODE/DATA/HOME</b> sections are written to the final image in the order you have specified in the linkfile.
+<p>Small mode forces all <b>ROMX</b> sections to be of type <b>ROM0</b> and increases the <b>ROM0</b> section size from 16kB to 32kB. This also means that <b>ROM0/ROMX</b> sections are written to the final image in the order you have specified on the command line.
 <p>Currently  the linker doesn't calculate the GB checksums. You must use <a href="fix.htm">RGBFix</a> to do this.
 
-<h2 id="psion2">Operation for Psion2 relocatable modules (-tp)</h2>
-<p>This is a fileformat for the Psion2 that allows you to load your code into where ever there's any free space. The only sections types allowed are <b>HOME, DATA and BSS</b>. All CODE and DATA sections are written to the output file in the order specified in the linkfile. The BSS are actually then expanded to DATA sections filled with zeroes and appended. This might change later.
-<p>The file looks like this (all values are big endian):
-<pre>
-LONG    NumberOfDataBytes
-REPT    NumberOfDataBytes
-    DB  x
-ENDR
-LONG    NumberOfPatches
-REPT    NumberOfPatches
-    LONG    x    ; A value to add to the word at address x in the code
-ENDR
-</pre>
 <hr>
 <p>Last updated 08 October 1997 by <a href="mailto:[email protected]">Carsten Sorensen</a></p>
 </body>
--- a/doc/rgb0.htm
+++ b/doc/rgb0.htm
@@ -50,10 +50,10 @@
       
     REPT NumberOfSections
         LONG    Size                   ;Size in bytes of this section
-        BYTE    Type                   ;0 = BSS
+        BYTE    Type                   ;0 = WRAM0
                                        ;1 = VRAM
-                                       ;2 = CODE
-                                       ;3 = HOME
+                                       ;2 = ROMX
+                                       ;3 = ROM0
                                        ;4 = HRAM
         LONG    Org                    ;Only present in RGB1. Address to fix this
                                        ;section at. -1 if the linker should
@@ -61,8 +61,8 @@
         LONG    Bank                   ;Only present in RGB1. Bank to load this
                                        ;section into. -1 if the linker should
                                        ;decide (normal operation). This field is
-                                       ;only valid for CODE sections.
-        IF      Type==CODE || Type==HOME
+                                       ;only valid for ROMX sections.
+        IF      Type==ROMX || Type==ROM0
             BYTE Data[Size]
             LONG NumberOfPatches
                
--- a/include/asm/mylink.h
+++ b/include/asm/mylink.h
@@ -30,7 +30,7 @@
  * Section:
  * LONG SizeInBytes
  * char Type
- * if( Type!=BSS )
+ * if( Type!=WRAM0 )
  * {
  *		char Data[SizeInBytes]
  *		Patches
@@ -95,10 +95,10 @@
 };
 
 enum {
-	SECT_BSS = 0,
+	SECT_WRAM0 = 0,
 	SECT_VRAM,
-	SECT_CODE,
-	SECT_HOME,
+	SECT_ROMX,
+	SECT_ROM0,
 	SECT_HRAM,
 	SECT_WRAMX,
 	SECT_SRAM
--- a/include/link/assign.h
+++ b/include/link/assign.h
@@ -4,8 +4,8 @@
 #include "link/types.h"
 
 enum eBankDefine {
-	BANK_HOME = 0,
-	BANK_BSS = 512,
+	BANK_ROM0 = 0,
+	BANK_WRAM0 = 512,
 	BANK_WRAMX,
 	BANK_VRAM = 520,
 	BANK_HRAM = 522,
--- a/include/link/mylink.h
+++ b/include/link/mylink.h
@@ -49,10 +49,10 @@
 };
 
 enum eSectionType {
-	SECT_BSS,
+	SECT_WRAM0,
 	SECT_VRAM,
-	SECT_CODE,
-	SECT_HOME,
+	SECT_ROMX,
+	SECT_ROM0,
 	SECT_HRAM,
 	SECT_WRAMX,
 	SECT_SRAM
--- a/src/asm/gameboy/yaccprt2.y
+++ b/src/asm/gameboy/yaccprt2.y
@@ -1,4 +1,4 @@
-%token	T_SECT_BSS T_SECT_VRAM T_SECT_CODE T_SECT_HOME T_SECT_HRAM T_SECT_WRAMX T_SECT_SRAM
+%token	T_SECT_WRAM0 T_SECT_VRAM T_SECT_ROMX T_SECT_ROM0 T_SECT_HRAM T_SECT_WRAMX T_SECT_SRAM
 
 %token	T_Z80_ADC T_Z80_ADD T_Z80_AND
 %token	T_Z80_BIT
--- a/src/asm/gameboy/yaccprt4.y
+++ b/src/asm/gameboy/yaccprt4.y
@@ -12,7 +12,7 @@
 		}
 	|	T_POP_SECTION string ',' sectiontype ',' T_OP_BANK '[' const ']'
 		{
-			if( $4==SECT_CODE ) {
+			if( $4==SECT_ROMX ) {
 				if( $8>=1 && $8<=0x1ff )
 					out_NewAbsSection($2,$4,-1,$8);
 				else
@@ -36,12 +36,12 @@
 					yyerror("VRAM bank value $%x out of range (0 to 1)", $8);
 				}
 			} else {
-				yyerror("BANK only allowed for CODE/DATA, WRAMX, SRAM, or VRAM sections");
+				yyerror("BANK only allowed for ROMX, WRAMX, SRAM, or VRAM sections");
 			}
 		}
 	|	T_POP_SECTION string ',' sectiontype '[' const ']' ',' T_OP_BANK '[' const ']'
 		{
-			if( $4==SECT_CODE ) {
+			if( $4==SECT_ROMX ) {
 				if( $6>=0 && $6<0x10000 ) {
 					if( $11>=1 && $11<=0x1ff )
 						out_NewAbsSection($2,$4,$6,$11);
@@ -80,16 +80,16 @@
 					yyerror("Address $%x not 16-bit", $6);
 				}
 			} else {
-				yyerror("BANK only allowed for CODE/DATA, WRAMX, SRAM, or VRAM sections");
+				yyerror("BANK only allowed for ROMX, WRAMX, SRAM, or VRAM sections");
 			}
 		}
 ;
 
 sectiontype:
-		T_SECT_BSS	{ $$=SECT_BSS; }
+		T_SECT_WRAM0	{ $$=SECT_WRAM0; }
 	|	T_SECT_VRAM	{ $$=SECT_VRAM; }
-	|	T_SECT_CODE	{ $$=SECT_CODE; }
-	|	T_SECT_HOME	{ $$=SECT_HOME; }
+	|	T_SECT_ROMX	{ $$=SECT_ROMX; }
+	|	T_SECT_ROM0	{ $$=SECT_ROM0; }
 	|	T_SECT_HRAM	{ $$=SECT_HRAM; }
 	|	T_SECT_WRAMX	{ $$=SECT_WRAMX; }
 	|	T_SECT_SRAM	{ $$=SECT_SRAM; }
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -316,11 +316,14 @@
 	{"else", T_POP_ELSE},
 	{"endc", T_POP_ENDC},
 
-	{"bss", T_SECT_BSS},
+	{"wram0", T_SECT_WRAM0},
+	{"bss", T_SECT_WRAM0}, /* deprecated */
 	{"vram", T_SECT_VRAM},
-	{"code", T_SECT_CODE},
-	{"data", T_SECT_CODE},
-	{"home", T_SECT_HOME},
+	{"code", T_SECT_ROMX}, /* deprecated */
+	{"data", T_SECT_ROMX}, /* deprecated */
+	{"romx", T_SECT_ROMX},
+	{"home", T_SECT_ROM0}, /* deprecated */
+	{"rom0", T_SECT_ROM0},
 	{"hram", T_SECT_HRAM},
 	{"wramx", T_SECT_WRAMX},
 	{"sram", T_SECT_SRAM},
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -252,8 +252,8 @@
 	    fputlong(pSect->nBank, f);
 	//RGB1 addition
 
-	    if ((pSect->nType == SECT_HOME)
-	    || (pSect->nType == SECT_CODE)) {
+	    if ((pSect->nType == SECT_ROM0)
+	    || (pSect->nType == SECT_ROMX)) {
 		struct Patch *pPatch;
 
 		fwrite(pSect->tData, 1, pSect->nPC, f);
@@ -504,13 +504,13 @@
 checkcodesection(SLONG size)
 {
 	checksection();
-	if ((pCurrentSection->nType == SECT_HOME
-		|| pCurrentSection->nType == SECT_CODE)
+	if ((pCurrentSection->nType == SECT_ROM0
+		|| pCurrentSection->nType == SECT_ROMX)
 	    && (pCurrentSection->nPC + size <= MAXSECTIONSIZE)) {
 		if (((pCurrentSection->nPC % SECTIONCHUNK) >
 			((pCurrentSection->nPC + size) % SECTIONCHUNK))
-		    && (pCurrentSection->nType == SECT_HOME
-			|| pCurrentSection->nType == SECT_CODE)) {
+		    && (pCurrentSection->nType == SECT_ROM0
+			|| pCurrentSection->nType == SECT_ROMX)) {
 			if ((pCurrentSection->tData =
 				(UBYTE *) realloc(pCurrentSection->tData,
 				    ((pCurrentSection->nPC +
@@ -725,8 +725,8 @@
 out_Skip(int skip)
 {
 	checksection();
-	if (!((pCurrentSection->nType == SECT_HOME)
-		|| (pCurrentSection->nType == SECT_CODE))) {
+	if (!((pCurrentSection->nType == SECT_ROM0)
+		|| (pCurrentSection->nType == SECT_ROMX))) {
 		pCurrentSection->nPC += skip;
 		nPC += skip;
 		pPCSymbol->nValue += skip;
--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -132,7 +132,7 @@
 }
 
 SLONG 
-area_AllocAbsCODEAnyBank(SLONG org, SLONG size)
+area_AllocAbsROMXAnyBank(SLONG org, SLONG size)
 {
 	SLONG i;
 
@@ -208,7 +208,7 @@
 }
 
 SLONG 
-area_AllocCODEAnyBank(SLONG size)
+area_AllocROMXAnyBank(SLONG size)
 {
 	SLONG i, org;
 
@@ -285,7 +285,7 @@
 
 	pSection = pSections;
 	while (pSection) {
-		if (pSection->oAssigned == 0 && pSection->Type == SECT_CODE) {
+		if (pSection->oAssigned == 0 && pSection->Type == SECT_ROMX) {
 			if (pSection->nByteSize > nLargest) {
 				nLargest = pSection->nByteSize;
 				r = pSection;
@@ -367,7 +367,7 @@
 	while ((pSection = FindLargestCode())) {
 		SLONG org;
 
-		if ((org = area_AllocCODEAnyBank(pSection->nByteSize)) != -1) {
+		if ((org = area_AllocROMXAnyBank(pSection->nByteSize)) != -1) {
 			pSection->nOrg = org & 0xFFFF;
 			pSection->nBank = org >> 16;
 			pSection->oAssigned = 1;
@@ -374,7 +374,7 @@
 			DOMAXBANK(pSection->nBank);
 		} else {
 			fprintf(stderr,
-			    "Unable to place CODE section anywhere\n");
+			    "Unable to place ROMX section anywhere\n");
 			exit(1);
 		}
 	}
@@ -425,7 +425,7 @@
 				BankFree[i]->nSize = 0x4000;
 				MaxAvail[i] = 0x4000;
 			}
-		} else if (i == BANK_BSS) {
+		} else if (i == BANK_WRAM0) {
 			/* WRAM */
 			BankFree[i]->nOrg = 0xC000;
 			BankFree[i]->nSize = 0x1000;
@@ -468,17 +468,17 @@
 			/* User wants to have a say... */
 
 			switch (pSection->Type) {
-			case SECT_BSS:
+			case SECT_WRAM0:
 				if (area_AllocAbs
-				    (&BankFree[BANK_BSS], pSection->nOrg,
+				    (&BankFree[BANK_WRAM0], pSection->nOrg,
 					pSection->nByteSize) != pSection->nOrg) {
 					fprintf(stderr,
-					    "Unable to load fixed BSS section "
+					    "Unable to load fixed WRAM0 section "
 					    "at $%lX\n", pSection->nOrg);
 					exit(1);
 				}
 				pSection->oAssigned = 1;
-				pSection->nBank = BANK_BSS;
+				pSection->nBank = BANK_WRAM0;
 				break;
 			case SECT_HRAM:
 				if (area_AllocAbs
@@ -651,19 +651,19 @@
 					}
 				}
 				break;
-			case SECT_HOME:
+			case SECT_ROM0:
 				if (area_AllocAbs
-				    (&BankFree[BANK_HOME], pSection->nOrg,
+				    (&BankFree[BANK_ROM0], pSection->nOrg,
 					pSection->nByteSize) != pSection->nOrg) {
 					fprintf(stderr, "Unable to load fixed "
-					    "HOME section at $%lX\n",
+					    "ROM0 section at $%lX\n",
 					    pSection->nOrg);
 					exit(1);
 				}
 				pSection->oAssigned = 1;
-				pSection->nBank = BANK_HOME;
+				pSection->nBank = BANK_ROM0;
 				break;
-			case SECT_CODE:
+			case SECT_ROMX:
 				if (pSection->nBank == -1) {
 					/*
 					 * User doesn't care which bank, so he must want to
@@ -703,7 +703,7 @@
 								pSection->
 								nByteSize) !=
 							    pSection->nOrg) {
-								fprintf(stderr, "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX\n", pSection->nOrg, pSection->nBank);
+								fprintf(stderr, "Unable to load fixed ROMX section at $%lX in bank $%02lX\n", pSection->nOrg, pSection->nBank);
 								exit(1);
 							}
 							DOMAXBANK(pSection->
@@ -710,7 +710,7 @@
 							    nBank);
 							pSection->oAssigned = 1;
 						} else {
-							fprintf(stderr, "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX\n", pSection->nOrg, pSection->nBank);
+							fprintf(stderr, "Unable to load fixed ROMX section at $%lX in bank $%02lX\n", pSection->nOrg, pSection->nBank);
 							exit(1);
 						}
 					}
@@ -723,7 +723,7 @@
 	}
 
 	/*
-	 * Next, let's assign all the bankfixed ONLY CODE sections...
+	 * Next, let's assign all the bankfixed ONLY ROMX sections...
 	 *
 	 */
 
@@ -730,7 +730,7 @@
 	pSection = pSections;
 	while (pSection) {
 		if (pSection->oAssigned == 0
-		    && pSection->Type == SECT_CODE
+		    && pSection->Type == SECT_ROMX
 		    && pSection->nOrg == -1 && pSection->nBank != -1) {
 			/* User wants to have a say... and he's pissed */
 			if (pSection->nBank >= 1 && pSection->nBank <= 511) {
@@ -737,13 +737,13 @@
 				if ((pSection->nOrg =
 					area_Alloc(&BankFree[pSection->nBank],
 					    pSection->nByteSize)) == -1) {
-					fprintf(stderr, "Unable to load fixed CODE/DATA section into bank $%02lX\n", pSection->nBank);
+					fprintf(stderr, "Unable to load fixed ROMX section into bank $%02lX\n", pSection->nBank);
 					exit(1);
 				}
 				pSection->oAssigned = 1;
 				DOMAXBANK(pSection->nBank);
 			} else {
-				fprintf(stderr, "Unable to load fixed CODE/DATA section into bank $%02lX\n", pSection->nBank);
+				fprintf(stderr, "Unable to load fixed ROMX section into bank $%02lX\n", pSection->nBank);
 				exit(1);
 			}
 		} else if (pSection->oAssigned == 0
@@ -805,7 +805,7 @@
 	}
 
 	/*
-	 * Now, let's assign all the floating bank but fixed CODE sections...
+	 * Now, let's assign all the floating bank but fixed ROMX sections...
 	 *
 	 */
 
@@ -812,15 +812,15 @@
 	pSection = pSections;
 	while (pSection) {
 		if (pSection->oAssigned == 0
-		    && pSection->Type == SECT_CODE
+		    && pSection->Type == SECT_ROMX
 		    && pSection->nOrg != -1 && pSection->nBank == -1) {
 			/* User wants to have a say... and he's back with a
 			 * vengeance */
 			if ((pSection->nBank =
-				area_AllocAbsCODEAnyBank(pSection->nOrg,
+				area_AllocAbsROMXAnyBank(pSection->nOrg,
 				    pSection->nByteSize)) ==
 			    -1) {
-				fprintf(stderr, "Unable to load fixed CODE/DATA section at $%lX into any bank\n", pSection->nOrg);
+				fprintf(stderr, "Unable to load fixed ROMX section at $%lX into any bank\n", pSection->nOrg);
 				exit(1);
 			}
 			pSection->oAssigned = 1;
@@ -881,14 +881,14 @@
 	while (pSection) {
 		if (pSection->oAssigned == 0) {
 			switch (pSection->Type) {
-			case SECT_BSS:
+			case SECT_WRAM0:
 				if ((pSection->nOrg =
-					area_Alloc(&BankFree[BANK_BSS],
+					area_Alloc(&BankFree[BANK_WRAM0],
 					    pSection->nByteSize)) == -1) {
-					fprintf(stderr, "BSS section too large\n");
+					fprintf(stderr, "WRAM0 section too large\n");
 					exit(1);
 				}
-				pSection->nBank = BANK_BSS;
+				pSection->nBank = BANK_WRAM0;
 				pSection->oAssigned = 1;
 				break;
 			case SECT_HRAM:
@@ -907,17 +907,17 @@
 				break;
 			case SECT_WRAMX:
 				break;
-			case SECT_HOME:
+			case SECT_ROM0:
 				if ((pSection->nOrg =
-					area_Alloc(&BankFree[BANK_HOME],
+					area_Alloc(&BankFree[BANK_ROM0],
 					    pSection->nByteSize)) == -1) {
-					fprintf(stderr, "HOME section too large\n");
+					fprintf(stderr, "ROM0 section too large\n");
 					exit(1);
 				}
-				pSection->nBank = BANK_HOME;
+				pSection->nBank = BANK_ROM0;
 				pSection->oAssigned = 1;
 				break;
-			case SECT_CODE:
+			case SECT_ROMX:
 				break;
 			default:
 				fprintf(stderr, "(INTERNAL) Unknown section type!\n");
--- a/src/link/mapfile.c
+++ b/src/link/mapfile.c
@@ -59,10 +59,10 @@
 		currentbank = bank;
 		if (bank == 0)
 			fprintf(mf, "Bank #0 (HOME):\n");
-		else if (bank < BANK_BSS)
+		else if (bank < BANK_WRAM0)
 			fprintf(mf, "Bank #%ld:\n", bank);
-		else if (bank == BANK_BSS)
-			fprintf(mf, "BSS:\n");
+		else if (bank == BANK_WRAM0)
+			fprintf(mf, "WRAM0:\n");
 		else if (bank == BANK_HRAM)
 			fprintf(mf, "HRAM:\n");
 		else if (bank == BANK_VRAM || bank == BANK_VRAM + 1)
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -139,10 +139,10 @@
 
 	/* does the user want the -s mode? */
 
-	if ((options & OPT_SMALL) && (pSection->Type == SECT_CODE)) {
-		pSection->Type = SECT_HOME;
+	if ((options & OPT_SMALL) && (pSection->Type == SECT_ROMX)) {
+		pSection->Type = SECT_ROM0;
 	}
-	if ((pSection->Type == SECT_CODE) || (pSection->Type == SECT_HOME)) {
+	if ((pSection->Type == SECT_ROMX) || (pSection->Type == SECT_ROM0)) {
 		/*
 		 * These sectiontypes contain data...
 		 *
@@ -294,10 +294,10 @@
 
 	/* does the user want the -s mode? */
 
-	if ((options & OPT_SMALL) && (pSection->Type == SECT_CODE)) {
-		pSection->Type = SECT_HOME;
+	if ((options & OPT_SMALL) && (pSection->Type == SECT_ROMX)) {
+		pSection->Type = SECT_ROM0;
 	}
-	if ((pSection->Type == SECT_CODE) || (pSection->Type == SECT_HOME)) {
+	if ((pSection->Type == SECT_ROMX) || (pSection->Type == SECT_ROM0)) {
 		/*
 		 * These sectiontypes contain data...
 		 *
--- a/src/link/output.c
+++ b/src/link/output.c
@@ -16,16 +16,16 @@
 	struct sSection *pSect;
 	UBYTE *mem;
 
-	mem = malloc(MaxAvail[BANK_HOME]);
+	mem = malloc(MaxAvail[BANK_ROM0]);
 	if (!mem)
 		return;
 
-	memset(mem, fillchar, MaxAvail[BANK_HOME]);
+	memset(mem, fillchar, MaxAvail[BANK_ROM0]);
 	MapfileInitBank(0);
 
 	pSect = pSections;
 	while (pSect) {
-		if (pSect->Type == SECT_HOME) {
+		if (pSect->Type == SECT_ROM0) {
 			memcpy(mem + pSect->nOrg, pSect->pData,
 			    pSect->nByteSize);
 			MapfileWriteSection(pSect);
@@ -35,7 +35,7 @@
 
 	MapfileCloseBank(area_Avail(0));
 
-	fwrite(mem, 1, MaxAvail[BANK_HOME], f);
+	fwrite(mem, 1, MaxAvail[BANK_ROM0], f);
 	free(mem);
 }
 
@@ -54,7 +54,7 @@
 
 	pSect = pSections;
 	while (pSect) {
-		if (pSect->Type == SECT_CODE && pSect->nBank == bank) {
+		if (pSect->Type == SECT_ROMX && pSect->nBank == bank) {
 			memcpy(mem + pSect->nOrg - 0x4000, pSect->pData,
 			    pSect->nByteSize);
 			MapfileWriteSection(pSect);
--- a/src/link/rgblink.1
+++ b/src/link/rgblink.1
@@ -21,8 +21,8 @@
 .Xr rgbasm 1
 into a single Game Boy ROM file.
 .Pp
-By default, HOME sections created by the assembler are placed in the 16KiB
-bank 0, and CODE/DATA sections are placed in any bank except bank 0.
+By default, ROM0 sections created by the assembler are placed in the 16KiB
+bank 0, and ROMX sections are placed in any bank except bank 0.
 If your ROM will only be 32KiB, you can use the
 .Fl t
 option to override this.
@@ -50,7 +50,7 @@
 Write a tiny
 .Pq 32KiB
 ROM file.
-This forces all DATA/CODE sections to be of type HOME, and increases the HOME
+This forces all ROMX sections to be of type ROM0, and increases the ROM0
 section size from 16KiB to 32KiB.
 .El
 .Sh EXAMPLES