shithub: rgbds

Download patch

ref: ed6e4c476955ff1687f43ee17e90f661f0add6e6
parent: d92c284b853f05adc3bf17449483d7333d2c78dd
author: Antonio Niño Díaz <[email protected]>
date: Sun Apr 16 15:54:58 EDT 2017

Clean object file format code and documentation

Remove unused code.

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- 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 @@
 
 	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 {
 	PATCH_BYTE = 0,
 	PATCH_WORD_L,
-	PATCH_LONG_L,
-	PATCH_WORD_B,
-	PATCH_LONG_B
+	PATCH_LONG_L
 };
 #endif
--- a/include/link/mylink.h
+++ b/include/link/mylink.h
@@ -96,9 +96,7 @@
 enum ePatchType {
 	PATCH_BYTE = 0,
 	PATCH_WORD_L,
-	PATCH_LONG_L,
-	PATCH_WORD_B,
-	PATCH_LONG_B
+	PATCH_LONG_L
 };
 
 struct sPatch {
--- a/src/link/patch.c
+++ b/src/link/patch.c
@@ -264,22 +264,12 @@
 				}
 				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",
@@ -295,15 +285,6 @@
 				    (t >> 16) & 0xFF;
 				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;
 			}
 
--- a/src/rgbds.rgbformat.5
+++ b/src/rgbds.rgbformat.5
@@ -115,9 +115,7 @@
 
             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.