mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Restore behaviour of option -w and add option -d
rgblink option -w has been restored to its previous behaviour: make WRAM a continous section instead of spliting it into WRAM0 and WRAMX. To enable DMG mode, option -d has to be used instead. This option automatically enables -w. Update tests. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -11,7 +11,8 @@ extern SLONG options;
|
|||||||
#define OPT_TINY 0x01
|
#define OPT_TINY 0x01
|
||||||
#define OPT_SMART_C_LINK 0x02
|
#define OPT_SMART_C_LINK 0x02
|
||||||
#define OPT_OVERLAY 0x04
|
#define OPT_OVERLAY 0x04
|
||||||
#define OPT_DMG_MODE 0x08
|
#define OPT_CONTWRAM 0x08
|
||||||
|
#define OPT_DMG_MODE 0x10
|
||||||
|
|
||||||
enum eRpnData {
|
enum eRpnData {
|
||||||
RPN_ADD = 0,
|
RPN_ADD = 0,
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ AssignSections(void)
|
|||||||
} else if (i == BANK_WRAM0) {
|
} else if (i == BANK_WRAM0) {
|
||||||
/* WRAM */
|
/* WRAM */
|
||||||
BankFree[i]->nOrg = 0xC000;
|
BankFree[i]->nOrg = 0xC000;
|
||||||
if (options & OPT_DMG_MODE) {
|
if (options & OPT_CONTWRAM) {
|
||||||
BankFree[i]->nSize = 0x2000;
|
BankFree[i]->nSize = 0x2000;
|
||||||
} else {
|
} else {
|
||||||
BankFree[i]->nSize = 0x1000;
|
BankFree[i]->nSize = 0x1000;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"usage: rgblink [-tw] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
|
"usage: rgblink [-twd] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
|
||||||
" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
|
" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
|
|||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "l:m:n:o:O:p:s:tw")) != -1) {
|
while ((ch = getopt(argc, argv, "l:m:n:o:O:p:s:twd")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'l':
|
case 'l':
|
||||||
SetLinkerscriptName(optarg);
|
SetLinkerscriptName(optarg);
|
||||||
@@ -87,15 +87,24 @@ main(int argc, char *argv[])
|
|||||||
case 't':
|
case 't':
|
||||||
options |= OPT_TINY;
|
options |= OPT_TINY;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'd':
|
||||||
/*
|
/*
|
||||||
* Set to set WRAM as a single continuous block as on
|
* Set to set WRAM as a single continuous block as on
|
||||||
* DMG. All WRAM sections must be WRAM0 as bankable WRAM
|
* DMG. All WRAM sections must be WRAM0 as bankable WRAM
|
||||||
* sections do not exist in this mode. A WRAMX section
|
* sections do not exist in this mode. A WRAMX section
|
||||||
* will raise an error. VRAM bank 1 can't be used if
|
* will raise an error. VRAM bank 1 can't be used if
|
||||||
* this option is enabled either.
|
* this option is enabled either.
|
||||||
|
*
|
||||||
|
* This option implies OPT_CONTWRAM.
|
||||||
*/
|
*/
|
||||||
options |= OPT_DMG_MODE;
|
options |= OPT_DMG_MODE;
|
||||||
|
/* fallthrough */
|
||||||
|
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;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
|||||||
@@ -159,10 +159,11 @@ obj_ReadRGBSection(FILE * f)
|
|||||||
if ((options & OPT_TINY) && (pSection->Type == SECT_ROMX)) {
|
if ((options & OPT_TINY) && (pSection->Type == SECT_ROMX)) {
|
||||||
errx(1, "ROMX sections can't be used with option -t.");
|
errx(1, "ROMX sections can't be used with option -t.");
|
||||||
}
|
}
|
||||||
if (options & OPT_DMG_MODE) {
|
if ((options & OPT_CONTWRAM) && (pSection->Type == SECT_WRAMX)) {
|
||||||
if (pSection->Type == SECT_WRAMX) {
|
|
||||||
errx(1, "WRAMX sections can't be used with option -w.");
|
errx(1, "WRAMX sections can't be used with option -w.");
|
||||||
}
|
}
|
||||||
|
if (options & OPT_DMG_MODE) {
|
||||||
|
/* WRAMX sections are checked for OPT_CONTWRAM */
|
||||||
if (pSection->Type == SECT_VRAM && pSection->nBank == 1) {
|
if (pSection->Type == SECT_VRAM && pSection->nBank == 1) {
|
||||||
errx(1, "VRAM bank 1 can't be used with option -w.");
|
errx(1, "VRAM bank 1 can't be used with option -w.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
.Nm rgblink
|
.Nm rgblink
|
||||||
.Op Fl t
|
.Op Fl t
|
||||||
.Op Fl w
|
.Op Fl w
|
||||||
|
.Op Fl d
|
||||||
.Op Fl m Ar mapfile
|
.Op Fl m Ar mapfile
|
||||||
.Op Fl n Ar symfile
|
.Op Fl n Ar symfile
|
||||||
.Op Fl O Ar overlayfile
|
.Op Fl O Ar overlayfile
|
||||||
@@ -45,10 +46,16 @@ option to override this.
|
|||||||
.Pp
|
.Pp
|
||||||
Similarly, WRAM0 sections are placed in the first 4KiB of WRAM bank 0 and WRAMX
|
Similarly, WRAM0 sections are placed in the first 4KiB of WRAM bank 0 and WRAMX
|
||||||
sections are placed in any bank except bank 0.
|
sections are placed in any bank except bank 0.
|
||||||
If your ROM is designed for DMG, you can use the
|
If your ROM doesn't use banked WRAM you can use option
|
||||||
.Fl w
|
.Fl w
|
||||||
option to override this.
|
option to override this.
|
||||||
It will also prohibit the use of VRAM bank 1.
|
.Pp
|
||||||
|
Also, if your ROM is designed for DMG, you can make sure that you don't use any
|
||||||
|
prohibited section by using the option
|
||||||
|
.Fl d ,
|
||||||
|
which implies
|
||||||
|
.Fl w
|
||||||
|
but also prohibits the use of VRAM bank 1.
|
||||||
.Pp
|
.Pp
|
||||||
The arguments are as follows:
|
The arguments are as follows:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
@@ -68,11 +75,14 @@ The default is 0x00.
|
|||||||
.It Fl s Ar symbol
|
.It Fl s Ar symbol
|
||||||
???
|
???
|
||||||
.It Fl w
|
.It Fl w
|
||||||
Enable DMG mode.
|
|
||||||
Expand the WRAM0 section size from 4KiB to the full 8KiB assigned to WRAM and
|
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 WRAMX sections.
|
||||||
Prohibit the use of VRAM bank 1.
|
.It Fl d
|
||||||
Useful for ROMs designed for DMG.
|
Enable DMG mode.
|
||||||
|
Prohibit the use of sections that doesn't exist on a DMG, such as WRAMX and VRAM
|
||||||
|
bank 1.
|
||||||
|
This option automatically enables
|
||||||
|
.Fl w .
|
||||||
.It Fl t
|
.It Fl t
|
||||||
Expand the ROM0 section size from 16KiB to the full 32KiB assigned to ROM and
|
Expand the ROM0 section size from 16KiB to the full 32KiB assigned to ROM and
|
||||||
prohibit the use of ROMX sections.
|
prohibit the use of ROMX sections.
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void script_InitSections(void)
|
|||||||
} else if (i == BANK_WRAM0) {
|
} else if (i == BANK_WRAM0) {
|
||||||
/* WRAM */
|
/* WRAM */
|
||||||
bank[i].address = 0xC000;
|
bank[i].address = 0xC000;
|
||||||
if (options & OPT_DMG_MODE) {
|
if (options & OPT_CONTWRAM) {
|
||||||
bank[i].top_address = 0xE000;
|
bank[i].top_address = 0xE000;
|
||||||
} else {
|
} else {
|
||||||
bank[i].top_address = 0xD000;
|
bank[i].top_address = 0xD000;
|
||||||
|
|||||||
@@ -14,21 +14,21 @@ diff bank-numbers.out.bin $otemp
|
|||||||
|
|
||||||
$RGBASM -o $otemp wramx-dmg-mode.asm
|
$RGBASM -o $otemp wramx-dmg-mode.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
diff wramx-dmg-mode-no-w.out $outtemp
|
diff wramx-dmg-mode-no-d.out $outtemp
|
||||||
$RGBLINK -w -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -d -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
diff wramx-dmg-mode-w.out $outtemp
|
diff wramx-dmg-mode-d.out $outtemp
|
||||||
|
|
||||||
$RGBASM -o $otemp vram-fixed-dmg-mode.asm
|
$RGBASM -o $otemp vram-fixed-dmg-mode.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
diff vram-fixed-dmg-mode-no-w.out $outtemp
|
diff vram-fixed-dmg-mode-no-d.out $outtemp
|
||||||
$RGBLINK -w -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -d -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
diff vram-fixed-dmg-mode-w.out $outtemp
|
diff vram-fixed-dmg-mode-d.out $outtemp
|
||||||
|
|
||||||
$RGBASM -o $otemp vram-floating-dmg-mode.asm
|
$RGBASM -o $otemp vram-floating-dmg-mode.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
diff vram-floating-dmg-mode-no-w.out $outtemp
|
diff vram-floating-dmg-mode-no-d.out $outtemp
|
||||||
$RGBLINK -w -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -d -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
diff vram-floating-dmg-mode-w.out $outtemp
|
diff vram-floating-dmg-mode-d.out $outtemp
|
||||||
|
|
||||||
$RGBASM -o $otemp romx-tiny.asm
|
$RGBASM -o $otemp romx-tiny.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ $RGBLINK -o $gbtemp $otemp > bank-numbers.out 2>&1
|
|||||||
head -c 20 $gbtemp > bank-numbers.out.bin 2>&1
|
head -c 20 $gbtemp > bank-numbers.out.bin 2>&1
|
||||||
|
|
||||||
$RGBASM -o $otemp wramx-dmg-mode.asm
|
$RGBASM -o $otemp wramx-dmg-mode.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > wramx-dmg-mode-no-w.out 2>&1
|
$RGBLINK -o $gbtemp $otemp > wramx-dmg-mode-no-d.out 2>&1
|
||||||
$RGBLINK -w -o $gbtemp $otemp > wramx-dmg-mode-w.out 2>&1
|
$RGBLINK -d -o $gbtemp $otemp > wramx-dmg-mode-d.out 2>&1
|
||||||
|
|
||||||
$RGBASM -o $otemp vram-fixed-dmg-mode.asm
|
$RGBASM -o $otemp vram-fixed-dmg-mode.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > vram-fixed-dmg-mode-no-w.out 2>&1
|
$RGBLINK -o $gbtemp $otemp > vram-fixed-dmg-mode-no-d.out 2>&1
|
||||||
$RGBLINK -w -o $gbtemp $otemp > vram-fixed-dmg-mode-w.out 2>&1
|
$RGBLINK -d -o $gbtemp $otemp > vram-fixed-dmg-mode-d.out 2>&1
|
||||||
|
|
||||||
$RGBASM -o $otemp vram-floating-dmg-mode.asm
|
$RGBASM -o $otemp vram-floating-dmg-mode.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > vram-floating-dmg-mode-no-w.out 2>&1
|
$RGBLINK -o $gbtemp $otemp > vram-floating-dmg-mode-no-d.out 2>&1
|
||||||
$RGBLINK -w -o $gbtemp $otemp > vram-floating-dmg-mode-w.out 2>&1
|
$RGBLINK -d -o $gbtemp $otemp > vram-floating-dmg-mode-d.out 2>&1
|
||||||
|
|
||||||
$RGBASM -o $otemp romx-tiny.asm
|
$RGBASM -o $otemp romx-tiny.asm
|
||||||
$RGBLINK -o $gbtemp $otemp > romx-tiny-no-t.out 2>&1
|
$RGBLINK -o $gbtemp $otemp > romx-tiny-no-t.out 2>&1
|
||||||
|
|||||||
Reference in New Issue
Block a user