Rename OPT_CONTWRAM to OPT_DMG_MODE

Now, it will also make sure that VRAM bank 1 isn't used.

Man page updated.

Tests added.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2017-04-08 18:08:51 +01:00
parent 928b347dfc
commit e3109af2f8
17 changed files with 73 additions and 18 deletions

View File

@@ -402,7 +402,7 @@ AssignSections(void)
} else if (i == BANK_WRAM0) {
/* WRAM */
BankFree[i]->nOrg = 0xC000;
if (options & OPT_CONTWRAM) {
if (options & OPT_DMG_MODE) {
BankFree[i]->nSize = 0x2000;
} else {
BankFree[i]->nSize = 0x1000;
@@ -418,7 +418,11 @@ AssignSections(void)
} else if (i >= BANK_VRAM && i < BANK_VRAM + BANK_COUNT_VRAM) {
/* Swappable VRAM bank */
BankFree[i]->nOrg = 0x8000;
BankFree[i]->nSize = 0x2000;
if (options & OPT_DMG_MODE && i != BANK_VRAM) {
BankFree[i]->nSize = 0;
} else {
BankFree[i]->nSize = 0x2000;
}
} else if (i == BANK_OAM) {
BankFree[i]->nOrg = 0xFE00;
BankFree[i]->nSize = 0x00A0;

View File

@@ -92,10 +92,14 @@ main(int argc, char *argv[])
options |= OPT_TINY;
break;
case 'w':
/* Set to set WRAM as a single continuous block as on DMG.
All WRAM sections must be WRAM0 as bankable WRAM sections do
not exist in this mode. A WRAMX section will raise an error. */
options |= OPT_CONTWRAM;
/*
* Set to set WRAM as a single continuous block as on
* DMG. All WRAM sections must be WRAM0 as bankable WRAM
* sections do not exist in this mode. A WRAMX section
* will raise an error. VRAM bank 1 can't be used if
* this option is enabled either.
*/
options |= OPT_DMG_MODE;
break;
default:
usage();

View File

@@ -159,8 +159,13 @@ obj_ReadRGBSection(FILE * f)
if ((options & OPT_TINY) && (pSection->Type == SECT_ROMX)) {
errx(1, "ROMX sections can't be used with option -t.");
}
if ((options & OPT_CONTWRAM) && (pSection->Type == SECT_WRAMX)) {
errx(1, "WRAMX sections can't be used with option -w.");
if (options & OPT_DMG_MODE) {
if (pSection->Type == SECT_WRAMX) {
errx(1, "WRAMX sections can't be used with option -w.");
}
if (pSection->Type == SECT_VRAM && pSection->nBank == 1) {
errx(1, "VRAM bank 1 can't be used with option -w.");
}
}
if ((pSection->Type == SECT_ROMX) || (pSection->Type == SECT_ROM0)) {

View File

@@ -12,7 +12,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd March 27, 2017
.Dd April 8, 2017
.Dt RGBLINK 1
.Os RGBDS Manual
.Sh NAME
@@ -48,6 +48,7 @@ sections are placed in any bank except bank 0.
If your ROM is designed for DMG, you can use the
.Fl w
option to override this.
It will also prohibit the use of VRAM bank 1.
.Pp
The arguments are as follows:
.Bl -tag -width Ds
@@ -67,8 +68,10 @@ The default is 0x00.
.It Fl s Ar symbol
???
.It Fl w
Enable DMG mode.
Expand the WRAM0 section size from 4KiB to the full 8KiB assigned to WRAM and
prohibit the use of WRAMX sections.
Prohibit the use of VRAM bank 1.
Useful for ROMs designed for DMG.
.It Fl t
Expand the ROM0 section size from 16KiB to the full 32KiB assigned to ROM and

View File

@@ -49,7 +49,7 @@ void script_InitSections(void)
} else if (i == BANK_WRAM0) {
/* WRAM */
bank[i].address = 0xC000;
if (options & OPT_CONTWRAM) {
if (options & OPT_DMG_MODE) {
bank[i].top_address = 0xE000;
} else {
bank[i].top_address = 0xD000;
@@ -68,8 +68,13 @@ void script_InitSections(void)
} else if (i >= BANK_VRAM && i < BANK_VRAM + BANK_COUNT_VRAM) {
/* Swappable VRAM bank */
bank[i].address = 0x8000;
bank[i].top_address = 0xA000;
bank[i].type = SECT_VRAM;
if (options & OPT_DMG_MODE && i != BANK_VRAM) {
/* In DMG the only available bank is bank 0. */
bank[i].top_address = 0x8000;
} else {
bank[i].top_address = 0xA000;
}
} else if (i == BANK_OAM) {
/* OAM */
bank[i].address = 0xFE00;