ref: 367abd839636c2eda606073b0798172db5d517ea
parent: 97b9e822aaa97289a4797e04f92be44e4558d08f
author: bentley <[email protected]>
date: Fri Jan 15 07:35:11 EST 2010
remove psion2 compatibility; i doubt anyone uses it
--- a/include/link/main.h
+++ b/include/link/main.h
@@ -7,11 +7,4 @@
extern SLONG fillchar;
extern char smartlinkstartsymbol[256];
-enum eOutputType {
- OUTPUT_GBROM,
- OUTPUT_PSION2
-};
-
-extern enum eOutputType outputtype;
-
#endif
--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -170,7 +170,7 @@
}
void
-GBROM_AssignSections(void)
+AssignSections(void)
{
SLONG i;
struct sSection *pSection;
@@ -440,61 +440,6 @@
}
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
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -30,7 +30,6 @@
SLONG options = 0;
SLONG fillchar = 0;
-enum eOutputType outputtype = OUTPUT_GBROM;
char smartlinkstartsymbol[256];
/*
@@ -44,7 +43,7 @@
printf("xLink v" LINK_VERSION " (part of ASMotor " ASMOTOR_VERSION
")\n\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);
}
@@ -141,15 +140,10 @@
break;
case 't':
switch (optarg[0]) {
- case 'g':
- outputtype = OUTPUT_GBROM;
- break;
case 's':
- outputtype = OUTPUT_GBROM;
options |= OPT_SMALL;
- break;
- case 'p':
- outputtype = OUTPUT_PSION2;
+ /* FALLTHROUGH */
+ case 'g':
break;
default:
errx(EX_USAGE, "Invalid argument to option t");
--- a/src/link/output.c
+++ b/src/link/output.c
@@ -80,7 +80,7 @@
}
void
-GBROM_Output(void)
+Output(void)
{
SLONG i;
FILE *f;
@@ -103,103 +103,5 @@
pSect = pSect->pNext;
}
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;
- }
}
}