mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Clean object file format code and documentation
Remove unused code. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user