From ed6e4c476955ff1687f43ee17e90f661f0add6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ni=C3=B1o=20D=C3=ADaz?= Date: Sun, 16 Apr 2017 19:54:58 +0100 Subject: [PATCH] Clean object file format code and documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unused code. Signed-off-by: Antonio Niño Díaz --- include/asm/mylink.h | 67 +------------------------------------------ include/link/mylink.h | 4 +-- src/link/patch.c | 27 +++-------------- src/rgbds.rgbformat.5 | 4 +-- 4 files changed, 7 insertions(+), 95 deletions(-) diff --git a/include/asm/mylink.h b/include/asm/mylink.h index 0eecce02..951b089b 100644 --- a/include/asm/mylink.h +++ b/include/asm/mylink.h @@ -1,64 +1,6 @@ #ifndef RGBDS_ASM_LINK_H #define RGBDS_ASM_LINK_H -/* RGB4 .o format: - * - * Header - * Symbols - * Sections - * - * Header: - * "RGB4" - * LONG NumberOfSymbols - * LONG NumberOfSections - * - * Symbols: - * Symbol[NumberOfSymbols] - * - * Symbol: - * char Name (NULL terminated) - * char nType - * if (nType != SYM_IMPORT) - * { - * LONG SectionID - * LONG Offset - * } - * - * Sections: - * Section[NumberOfSections] - * - * Section: - * char SectionName (NULL-terminated) - * LONG SizeInBytes - * char Type - * LONG OrgPosition - * LONG Bank - * LONG Alignment - * if (Type == ROM0 || Type == ROMX) - * { - * char Data[SizeInBytes] - * Patches - * } - * - * Patches: - * LONG NumberOfPatches - * Patch[NumberOfPatches] - * - * Patch: - * char Filename NULL-terminated - * LONG LineNo - * LONG Offset - * char Type - * LONG RpnByteSize - * Rpn[RpnByteSize] - * - * Rpn: - * Operators: 0x00-0x7F - * Constants: 0x80 0x00000000 - * Symbols : 0x81 0x00000000 - * - */ - enum { RPN_ADD = 0, RPN_SUB, @@ -90,11 +32,6 @@ enum { RPN_HRAM, - /* TODO: This hasn't been removed in order not to break compatibility - * with the existing object files, but it will be removed in a future - * version. */ - RPN_unused, - RPN_RANGECHECK, RPN_CONST = 0x80, @@ -121,8 +58,6 @@ enum { enum { PATCH_BYTE = 0, PATCH_WORD_L, - PATCH_LONG_L, - PATCH_WORD_B, - PATCH_LONG_B + PATCH_LONG_L }; #endif diff --git a/include/link/mylink.h b/include/link/mylink.h index 23c95e2c..56f159a8 100644 --- a/include/link/mylink.h +++ b/include/link/mylink.h @@ -96,9 +96,7 @@ struct sSymbol { enum ePatchType { PATCH_BYTE = 0, PATCH_WORD_L, - PATCH_LONG_L, - PATCH_WORD_B, - PATCH_LONG_B + PATCH_LONG_L }; struct sPatch { diff --git a/src/link/patch.c b/src/link/patch.c index 6beb29d5..c88ed231 100644 --- a/src/link/patch.c +++ b/src/link/patch.c @@ -264,22 +264,12 @@ Patch(void) } break; case PATCH_WORD_L: - case PATCH_WORD_B: if (t >= -32768 && t <= 65535) { t &= 0xFFFF; - if (pPatch->Type == PATCH_WORD_L) { - pSect->pData[pPatch->nOffset] = - t & 0xFF; - pSect->pData[pPatch->nOffset + - 1] = - (t >> 8) & 0xFF; - } else { - //Assume big endian - pSect->pData[pPatch->nOffset] = - (t >> 8) & 0xFF; - pSect->pData[pPatch->nOffset + - 1] = t & 0xFF; - } + pSect->pData[pPatch->nOffset] = + t & 0xFF; + pSect->pData[pPatch->nOffset + 1] = + (t >> 8) & 0xFF; } else { errx(1, "%s(%ld) : Value must be 16-bit", @@ -296,15 +286,6 @@ Patch(void) pSect->pData[pPatch->nOffset + 3] = (t >> 24) & 0xFF; break; - case PATCH_LONG_B: - pSect->pData[pPatch->nOffset + 0] = - (t >> 24) & 0xFF; - pSect->pData[pPatch->nOffset + 1] = - (t >> 16) & 0xFF; - pSect->pData[pPatch->nOffset + 2] = - (t >> 8) & 0xFF; - pSect->pData[pPatch->nOffset + 3] = t & 0xFF; - break; } pPatch = pPatch->pNext; diff --git a/src/rgbds.rgbformat.5 b/src/rgbds.rgbformat.5 index e7154b2c..e29dff91 100644 --- a/src/rgbds.rgbformat.5 +++ b/src/rgbds.rgbformat.5 @@ -115,9 +115,7 @@ REPT NumberOfSections BYTE Type ; 0 = BYTE patch. ; 1 = little endian WORD patch. - ; 2 = little endianLONG patch. - ; 3 = big endian WORD patch (unused) - ; 4 = big endian LONG patch (unused) + ; 2 = little endian LONG patch. LONG RPNSize ; Size of the buffer with the RPN. ; expression.