Add overlay file option to rgblink (-O)

This option takes a file and places fixed sections on top of it.
Should prove useful for patches and partial disassemblies.
This commit is contained in:
Sanqui
2016-03-28 01:02:05 +02:00
parent 2ea2e47231
commit 2e9c68f8c3
5 changed files with 74 additions and 12 deletions

View File

@@ -713,6 +713,10 @@ AssignSections(void)
&& pSection->Type == SECT_ROMX
&& pSection->nOrg == -1 && pSection->nBank != -1) {
/* User wants to have a say... and he's pissed */
if (options & OPT_OVERLAY) {
errx(1, "All ROM sections must be fixed when using overlay");
}
if (pSection->nBank >= 1 && pSection->nBank <= 511) {
if ((pSection->nOrg =
area_Alloc(&BankFree[pSection->nBank],
@@ -789,6 +793,9 @@ AssignSections(void)
&& pSection->nOrg != -1 && pSection->nBank == -1) {
/* User wants to have a say... and he's back with a
* vengeance */
if (options & OPT_OVERLAY) {
errx(1, "All ROM sections must be fixed when using overlay");
}
if ((pSection->nBank =
area_AllocAbsROMXAnyBank(pSection->nOrg,
pSection->nByteSize)) ==
@@ -875,6 +882,9 @@ AssignSections(void)
case SECT_WRAMX:
break;
case SECT_ROM0:
if (options & OPT_OVERLAY) {
errx(1, "All ROM sections must be fixed when using overlay");
}
if ((pSection->nOrg =
area_Alloc(&BankFree[BANK_ROM0],
pSection->nByteSize)) == -1) {
@@ -884,6 +894,9 @@ AssignSections(void)
pSection->oAssigned = 1;
break;
case SECT_ROMX:
if (options & OPT_OVERLAY) {
errx(1, "All ROM sections must be fixed when using overlay");
}
break;
default:
errx(1, "(INTERNAL) Unknown section type!");