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_SMART_C_LINK 0x02
|
||||
#define OPT_OVERLAY 0x04
|
||||
#define OPT_DMG_MODE 0x08
|
||||
#define OPT_CONTWRAM 0x08
|
||||
#define OPT_DMG_MODE 0x10
|
||||
|
||||
enum eRpnData {
|
||||
RPN_ADD = 0,
|
||||
|
||||
@@ -402,7 +402,7 @@ AssignSections(void)
|
||||
} else if (i == BANK_WRAM0) {
|
||||
/* WRAM */
|
||||
BankFree[i]->nOrg = 0xC000;
|
||||
if (options & OPT_DMG_MODE) {
|
||||
if (options & OPT_CONTWRAM) {
|
||||
BankFree[i]->nSize = 0x2000;
|
||||
} else {
|
||||
BankFree[i]->nSize = 0x1000;
|
||||
|
||||
@@ -33,7 +33,7 @@ static void
|
||||
usage(void)
|
||||
{
|
||||
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");
|
||||
exit(1);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
|
||||
if (argc == 1)
|
||||
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) {
|
||||
case 'l':
|
||||
SetLinkerscriptName(optarg);
|
||||
@@ -87,15 +87,24 @@ main(int argc, char *argv[])
|
||||
case 't':
|
||||
options |= OPT_TINY;
|
||||
break;
|
||||
case 'w':
|
||||
case 'd':
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This option implies OPT_CONTWRAM.
|
||||
*/
|
||||
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;
|
||||
default:
|
||||
usage();
|
||||
|
||||
@@ -159,10 +159,11 @@ 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.");
|
||||
}
|
||||
/* WRAMX sections are checked for OPT_CONTWRAM */
|
||||
if (pSection->Type == SECT_VRAM && pSection->nBank == 1) {
|
||||
errx(1, "VRAM bank 1 can't be used with option -w.");
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
.Nm rgblink
|
||||
.Op Fl t
|
||||
.Op Fl w
|
||||
.Op Fl d
|
||||
.Op Fl m Ar mapfile
|
||||
.Op Fl n Ar symfile
|
||||
.Op Fl O Ar overlayfile
|
||||
@@ -45,10 +46,16 @@ option to override this.
|
||||
.Pp
|
||||
Similarly, WRAM0 sections are placed in the first 4KiB of WRAM bank 0 and WRAMX
|
||||
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
|
||||
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
|
||||
The arguments are as follows:
|
||||
.Bl -tag -width Ds
|
||||
@@ -68,11 +75,14 @@ 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 d
|
||||
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
|
||||
Expand the ROM0 section size from 16KiB to the full 32KiB assigned to ROM and
|
||||
prohibit the use of ROMX sections.
|
||||
|
||||
@@ -49,7 +49,7 @@ void script_InitSections(void)
|
||||
} else if (i == BANK_WRAM0) {
|
||||
/* WRAM */
|
||||
bank[i].address = 0xC000;
|
||||
if (options & OPT_DMG_MODE) {
|
||||
if (options & OPT_CONTWRAM) {
|
||||
bank[i].top_address = 0xE000;
|
||||
} else {
|
||||
bank[i].top_address = 0xD000;
|
||||
|
||||
@@ -14,21 +14,21 @@ diff bank-numbers.out.bin $otemp
|
||||
|
||||
$RGBASM -o $otemp wramx-dmg-mode.asm
|
||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff wramx-dmg-mode-no-w.out $outtemp
|
||||
$RGBLINK -w -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff wramx-dmg-mode-w.out $outtemp
|
||||
diff wramx-dmg-mode-no-d.out $outtemp
|
||||
$RGBLINK -d -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff wramx-dmg-mode-d.out $outtemp
|
||||
|
||||
$RGBASM -o $otemp vram-fixed-dmg-mode.asm
|
||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff vram-fixed-dmg-mode-no-w.out $outtemp
|
||||
$RGBLINK -w -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff vram-fixed-dmg-mode-w.out $outtemp
|
||||
diff vram-fixed-dmg-mode-no-d.out $outtemp
|
||||
$RGBLINK -d -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff vram-fixed-dmg-mode-d.out $outtemp
|
||||
|
||||
$RGBASM -o $otemp vram-floating-dmg-mode.asm
|
||||
$RGBLINK -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff vram-floating-dmg-mode-no-w.out $outtemp
|
||||
$RGBLINK -w -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff vram-floating-dmg-mode-w.out $outtemp
|
||||
diff vram-floating-dmg-mode-no-d.out $outtemp
|
||||
$RGBLINK -d -o $gbtemp $otemp > $outtemp 2>&1
|
||||
diff vram-floating-dmg-mode-d.out $outtemp
|
||||
|
||||
$RGBASM -o $otemp romx-tiny.asm
|
||||
$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
|
||||
|
||||
$RGBASM -o $otemp wramx-dmg-mode.asm
|
||||
$RGBLINK -o $gbtemp $otemp > wramx-dmg-mode-no-w.out 2>&1
|
||||
$RGBLINK -w -o $gbtemp $otemp > wramx-dmg-mode-w.out 2>&1
|
||||
$RGBLINK -o $gbtemp $otemp > wramx-dmg-mode-no-d.out 2>&1
|
||||
$RGBLINK -d -o $gbtemp $otemp > wramx-dmg-mode-d.out 2>&1
|
||||
|
||||
$RGBASM -o $otemp vram-fixed-dmg-mode.asm
|
||||
$RGBLINK -o $gbtemp $otemp > vram-fixed-dmg-mode-no-w.out 2>&1
|
||||
$RGBLINK -w -o $gbtemp $otemp > vram-fixed-dmg-mode-w.out 2>&1
|
||||
$RGBLINK -o $gbtemp $otemp > vram-fixed-dmg-mode-no-d.out 2>&1
|
||||
$RGBLINK -d -o $gbtemp $otemp > vram-fixed-dmg-mode-d.out 2>&1
|
||||
|
||||
$RGBASM -o $otemp vram-floating-dmg-mode.asm
|
||||
$RGBLINK -o $gbtemp $otemp > vram-floating-dmg-mode-no-w.out 2>&1
|
||||
$RGBLINK -w -o $gbtemp $otemp > vram-floating-dmg-mode-w.out 2>&1
|
||||
$RGBLINK -o $gbtemp $otemp > vram-floating-dmg-mode-no-d.out 2>&1
|
||||
$RGBLINK -d -o $gbtemp $otemp > vram-floating-dmg-mode-d.out 2>&1
|
||||
|
||||
$RGBASM -o $otemp romx-tiny.asm
|
||||
$RGBLINK -o $gbtemp $otemp > romx-tiny-no-t.out 2>&1
|
||||
|
||||
Reference in New Issue
Block a user