remove psion2 compatibility; i doubt anyone uses it

This commit is contained in:
bentley
2010-01-15 12:35:11 -07:00
parent 97b9e822aa
commit 367abd8396
4 changed files with 5 additions and 171 deletions

View File

@@ -7,11 +7,4 @@ extern void usage(void);
extern SLONG fillchar; extern SLONG fillchar;
extern char smartlinkstartsymbol[256]; extern char smartlinkstartsymbol[256];
enum eOutputType {
OUTPUT_GBROM,
OUTPUT_PSION2
};
extern enum eOutputType outputtype;
#endif #endif

View File

@@ -170,7 +170,7 @@ AssignCodeSections(void)
} }
void void
GBROM_AssignSections(void) AssignSections(void)
{ {
SLONG i; SLONG i;
struct sSection *pSection; struct sSection *pSection;
@@ -442,61 +442,6 @@ GBROM_AssignSections(void)
AssignCodeSections(); AssignCodeSections();
} }
void
PSION2_AssignSections(void)
{
struct sSection *pSection;
BankFree[0] = malloc(sizeof *BankFree[0]);
if (!BankFree[0])
errx(5, "Out of memory!");
BankFree[0]->nOrg = 0x0000;
BankFree[0]->nSize = 0x10000;
MaxAvail[0] = 0x10000;
BankFree[0]->pPrev = NULL;
BankFree[0]->pNext = NULL;
pSection = pSections;
while (pSection) {
if (pSection->oAssigned == 0
&& pSection->Type == SECT_CODE) {
pSection->oAssigned = 1;
pSection->nBank = 0;
pSection->nOrg = BankFree[0]->nOrg;
BankFree[0]->nOrg += pSection->nByteSize;
BankFree[0]->nSize -= pSection->nByteSize;
}
pSection = pSection->pNext;
}
pSection = pSections;
while (pSection) {
if (pSection->oAssigned == 0
&& pSection->Type == SECT_BSS) {
pSection->oAssigned = 1;
pSection->nBank = 0;
pSection->nOrg = BankFree[0]->nOrg;
BankFree[0]->nOrg += pSection->nByteSize;
BankFree[0]->nSize -= pSection->nByteSize;
}
pSection = pSection->pNext;
}
}
void
AssignSections(void)
{
switch (outputtype) {
case OUTPUT_GBROM:
GBROM_AssignSections();
break;
case OUTPUT_PSION2:
PSION2_AssignSections();
break;
}
}
void void
CreateSymbolTable(void) CreateSymbolTable(void)
{ {

View File

@@ -30,7 +30,6 @@ enum eBlockType {
SLONG options = 0; SLONG options = 0;
SLONG fillchar = 0; SLONG fillchar = 0;
enum eOutputType outputtype = OUTPUT_GBROM;
char smartlinkstartsymbol[256]; char smartlinkstartsymbol[256];
/* /*
@@ -44,7 +43,7 @@ usage(void)
printf("xLink v" LINK_VERSION " (part of ASMotor " ASMOTOR_VERSION printf("xLink v" LINK_VERSION " (part of ASMotor " ASMOTOR_VERSION
")\n\n"); ")\n\n");
printf("usage: xlink [-l library] [-m mapfile] [-n symfile] [-o outfile] [-s symbol]\n"); printf("usage: xlink [-l library] [-m mapfile] [-n symfile] [-o outfile] [-s symbol]\n");
printf("\t [-t [g | s | p]] [-z pad_value] objectfile [...]\n"); printf("\t [-t [g | s ] [-z pad_value] objectfile [...]\n");
exit(EX_USAGE); exit(EX_USAGE);
} }
@@ -141,15 +140,10 @@ main(int argc, char *argv[])
break; break;
case 't': case 't':
switch (optarg[0]) { switch (optarg[0]) {
case 'g':
outputtype = OUTPUT_GBROM;
break;
case 's': case 's':
outputtype = OUTPUT_GBROM;
options |= OPT_SMALL; options |= OPT_SMALL;
break; /* FALLTHROUGH */
case 'p': case 'g':
outputtype = OUTPUT_PSION2;
break; break;
default: default:
errx(EX_USAGE, "Invalid argument to option t"); errx(EX_USAGE, "Invalid argument to option t");

View File

@@ -80,7 +80,7 @@ out_Setname(char *tzOutputfile)
} }
void void
GBROM_Output(void) Output(void)
{ {
SLONG i; SLONG i;
FILE *f; FILE *f;
@@ -105,101 +105,3 @@ GBROM_Output(void)
MapfileCloseBank(area_Avail(i)); MapfileCloseBank(area_Avail(i));
} }
} }
void
PSION2_Output(void)
{
FILE *f;
if ((f = fopen(tzOutname, "wb"))) {
struct sSection *pSect;
UBYTE *mem;
ULONG size = MaxAvail[0] - area_Avail(0);
ULONG relocpatches;
fputc(size >> 24, f);
fputc(size >> 16, f);
fputc(size >> 8, f);
fputc(size, f);
if ((mem = malloc(MaxAvail[0] - area_Avail(0)))) {
MapfileInitBank(0);
pSect = pSections;
while (pSect) {
if (pSect->Type == SECT_CODE) {
memcpy(mem + pSect->nOrg, pSect->pData,
pSect->nByteSize);
MapfileWriteSection(pSect);
} else {
memset(mem + pSect->nOrg, 0,
pSect->nByteSize);
}
pSect = pSect->pNext;
}
MapfileCloseBank(area_Avail(0));
fwrite(mem, 1, MaxAvail[0] - area_Avail(0), f);
free(mem);
}
relocpatches = 0;
pSect = pSections;
while (pSect) {
struct sPatch *pPatch;
pPatch = pSect->pPatches;
while (pPatch) {
if (pPatch->oRelocPatch) {
relocpatches += 1;
}
pPatch = pPatch->pNext;
}
pSect = pSect->pNext;
}
fputc(relocpatches >> 24, f);
fputc(relocpatches >> 16, f);
fputc(relocpatches >> 8, f);
fputc(relocpatches, f);
pSect = pSections;
while (pSect) {
struct sPatch *pPatch;
pPatch = pSect->pPatches;
while (pPatch) {
if (pPatch->oRelocPatch) {
ULONG address;
address = pPatch->nOffset + pSect->nOrg;
fputc(address >> 24, f);
fputc(address >> 16, f);
fputc(address >> 8, f);
fputc(address, f);
}
pPatch = pPatch->pNext;
}
pSect = pSect->pNext;
}
fclose(f);
}
}
void
Output(void)
{
if (oOutput) {
switch (outputtype) {
case OUTPUT_GBROM:
GBROM_Output();
break;
case OUTPUT_PSION2:
PSION2_Output();
break;
}
}
}