mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 03:22:08 +00:00
Add a new WRAMX section type, for banked (CGB) WRAM sections.
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
|
||||
%token T_SECT_BSS T_SECT_VRAM T_SECT_CODE T_SECT_HOME T_SECT_HRAM T_SECT_WRAMX
|
||||
|
||||
%token T_Z80_ADC T_Z80_ADD T_Z80_AND
|
||||
%token T_Z80_BIT
|
||||
|
||||
@@ -17,14 +17,20 @@ section:
|
||||
out_NewAbsSection($2,$4,-1,$8);
|
||||
else
|
||||
yyerror("ROM bank value $%x out of range (1 to $1ff)", $8);
|
||||
} else if ($4 == SECT_WRAMX) {
|
||||
if ($8 >= 1 && $8 <= 7) {
|
||||
out_NewAbsSection($2, $4, -1, $8);
|
||||
} else {
|
||||
yyerror("WRAMX bank value $%x out of range (1 to 7)", $8);
|
||||
}
|
||||
} else if ($4 == SECT_VRAM) {
|
||||
if ($8 >= 0 && $8 <= 1) {
|
||||
if ($8 >= 0 && $8 <= 1) {
|
||||
out_NewAbsSection($2, $4, -1, $8);
|
||||
} else {
|
||||
yyerror("VRAM bank value $%x out of range (0 to 1)", $8);
|
||||
}
|
||||
} else {
|
||||
yyerror("BANK only allowed for CODE/DATA or VRAM sections");
|
||||
yyerror("BANK only allowed for CODE/DATA, WRAMX, or VRAM sections");
|
||||
}
|
||||
}
|
||||
| T_POP_SECTION string ',' sectiontype '[' const ']' ',' T_OP_BANK '[' const ']'
|
||||
@@ -37,6 +43,16 @@ section:
|
||||
yyerror("ROM bank value $%x out of range (1 to $1ff)", $11);
|
||||
} else
|
||||
yyerror("Address $%x not 16-bit", $6);
|
||||
} else if ($4 == SECT_WRAMX) {
|
||||
if ($6 >= 0 && $6 < 0x10000) {
|
||||
if ($11 >= 1 && $11 <= 7) {
|
||||
out_NewAbsSection($2, $4, $6, $11);
|
||||
} else {
|
||||
yyerror("WRAMX bank value $%x out of range (1 to 7)", $11);
|
||||
}
|
||||
} else {
|
||||
yyerror("Address $%x not 16-bit", $6);
|
||||
}
|
||||
} else if ($4 == SECT_VRAM) {
|
||||
if ($6 >= 0 && $6 < 0x10000) {
|
||||
if ($11 >= 0 && $11 <= 1) {
|
||||
@@ -48,7 +64,7 @@ section:
|
||||
yyerror("Address $%x not 16-bit", $6);
|
||||
}
|
||||
} else {
|
||||
yyerror("BANK only allowed for CODE/DATA or VRAM sections");
|
||||
yyerror("BANK only allowed for CODE/DATA, WRAMX, or VRAM sections");
|
||||
}
|
||||
}
|
||||
;
|
||||
@@ -59,6 +75,7 @@ sectiontype:
|
||||
| T_SECT_CODE { $$=SECT_CODE; }
|
||||
| T_SECT_HOME { $$=SECT_HOME; }
|
||||
| T_SECT_HRAM { $$=SECT_HRAM; }
|
||||
| T_SECT_WRAMX { $$=SECT_WRAMX; }
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -322,6 +322,7 @@ struct sLexInitString staticstrings[] = {
|
||||
{"data", T_SECT_CODE},
|
||||
{"home", T_SECT_HOME},
|
||||
{"hram", T_SECT_HRAM},
|
||||
{"wramx", T_SECT_WRAMX},
|
||||
|
||||
{NAME_RB, T_POP_RB},
|
||||
{NAME_RW, T_POP_RW},
|
||||
|
||||
Reference in New Issue
Block a user