mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 03:22:08 +00:00
Redefine consistent names for section types, and document the changes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -12,7 +12,7 @@ section:
|
||||
}
|
||||
| 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 @@ section:
|
||||
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 @@ section:
|
||||
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; }
|
||||
|
||||
@@ -316,11 +316,14 @@ struct sLexInitString staticstrings[] = {
|
||||
{"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},
|
||||
|
||||
@@ -252,8 +252,8 @@ writesection(struct Section * pSect, FILE * f)
|
||||
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 @@ void
|
||||
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 @@ void
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user