From b63924ebf4a2c6d09a04ae4aa2c6701df84354ad Mon Sep 17 00:00:00 2001 From: bentley Date: Fri, 15 Jan 2010 16:46:26 -0700 Subject: [PATCH] remove endianness code (this is solely a Game Boy assembler now) --- include/asm/gameboy/localasm.h | 2 -- include/asm/main.h | 1 - include/asm/types.h | 3 -- src/asm/main.c | 21 ------------ src/asm/output.c | 58 ++++++++-------------------------- 5 files changed, 14 insertions(+), 71 deletions(-) diff --git a/include/asm/gameboy/localasm.h b/include/asm/gameboy/localasm.h index b2931639..dc79c5e4 100644 --- a/include/asm/gameboy/localasm.h +++ b/include/asm/gameboy/localasm.h @@ -83,8 +83,6 @@ #define MAXSECTIONSIZE 0x4000 -#define ASM_DEFAULT_ENDIAN ASM_LITTLE_ENDIAN - #define APPNAME "RGBAsm" #define EXENAME "rgbasm" diff --git a/include/asm/main.h b/include/asm/main.h index 0867bbe3..86cb5313 100644 --- a/include/asm/main.h +++ b/include/asm/main.h @@ -2,7 +2,6 @@ #define ASMOTOR_MAIN_H struct sOptions { - ULONG endian; char gbgfx[4]; char binary[2]; SLONG fillchar; diff --git a/include/asm/types.h b/include/asm/types.h index c0c88c0e..08390b52 100644 --- a/include/asm/types.h +++ b/include/asm/types.h @@ -12,7 +12,4 @@ typedef signed short SWORD; typedef unsigned long ULONG; typedef signed long SLONG; -#define ASM_LITTLE_ENDIAN 0 -#define ASM_BIG_ENDIAN 1 - #endif diff --git a/src/asm/main.c b/src/asm/main.c index d2d30116..556f13d0 100644 --- a/src/asm/main.c +++ b/src/asm/main.c @@ -127,24 +127,6 @@ opt_Parse(char *s) newopt = CurrentOptions; switch (s[0]) { - case 'e': - switch (s[1]) { - case 'b': - newopt.endian = ASM_BIG_ENDIAN; - printf - ("*WARNING*\t :\n\tEndianness forced to BIG for destination CPU\n"); - break; - case 'l': - newopt.endian = ASM_LITTLE_ENDIAN; - printf - ("*WARNING*\t :\n\tEndianness forced to LITTLE for destination CPU\n"); - break; - default: - printf - ("*ERROR*\t :\n\tArgument to option -e must be 'b' or 'l'\n"); - exit(5); - } - break; case 'g': if (strlen(&s[1]) == 4) { newopt.gbgfx[0] = s[1]; @@ -261,7 +243,6 @@ PrintUsage(void) printf("\t-h\t\tThis text\n"); printf("\t-i\tExtra include path\n"); printf("\t-o\tWrite objectoutput to \n"); - printf("\t-e(l|b)\t\tChange endianness (CAUTION!)\n"); printf ("\t-g\tChange the four characters used for Gameboy graphics\n" "\t\t\tconstants (default is 0123)\n"); @@ -293,7 +274,6 @@ main(int argc, char *argv[]) /* yydebug=1; */ - DefaultOptions.endian = ASM_DEFAULT_ENDIAN; DefaultOptions.gbgfx[0] = '0'; DefaultOptions.gbgfx[1] = '1'; DefaultOptions.gbgfx[2] = '2'; @@ -314,7 +294,6 @@ main(int argc, char *argv[]) case 'o': out_SetFileName(&(argv[argn][2])); break; - case 'e': case 'g': case 'b': case 'z': diff --git a/src/asm/output.c b/src/asm/output.c index ce9d3d7b..0579cb02 100644 --- a/src/asm/output.c +++ b/src/asm/output.c @@ -788,14 +788,8 @@ out_AbsWord(int b) checkcodesection(2); b &= 0xFFFF; if (nPass == 2) { - if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) { - pCurrentSection->tData[nPC] = b & 0xFF; - pCurrentSection->tData[nPC + 1] = b >> 8; - } else { - //Assume big endian - pCurrentSection->tData[nPC] = b >> 8; - pCurrentSection->tData[nPC + 1] = b & 0xFF; - } + pCurrentSection->tData[nPC] = b & 0xFF; + pCurrentSection->tData[nPC + 1] = b >> 8; } pCurrentSection->nPC += 2; nPC += 2; @@ -818,16 +812,9 @@ out_RelWord(struct Expression * expr) b = expr->nVal & 0xFFFF; if (rpn_isReloc(expr)) { if (nPass == 2) { - if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) { - pCurrentSection->tData[nPC] = b & 0xFF; - pCurrentSection->tData[nPC + 1] = b >> 8; - createpatch(PATCH_WORD_L, expr); - } else { - //Assume big endian - pCurrentSection->tData[nPC] = b >> 8; - pCurrentSection->tData[nPC + 1] = b & 0xFF; - createpatch(PATCH_WORD_B, expr); - } + pCurrentSection->tData[nPC] = b & 0xFF; + pCurrentSection->tData[nPC + 1] = b >> 8; + createpatch(PATCH_WORD_L, expr); } pCurrentSection->nPC += 2; nPC += 2; @@ -848,18 +835,10 @@ out_AbsLong(SLONG b) { checkcodesection(sizeof(SLONG)); if (nPass == 2) { - if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) { - pCurrentSection->tData[nPC] = b & 0xFF; - pCurrentSection->tData[nPC + 1] = b >> 8; - pCurrentSection->tData[nPC + 2] = b >> 16; - pCurrentSection->tData[nPC + 3] = b >> 24; - } else { - //Assume big endian - pCurrentSection->tData[nPC] = b >> 24; - pCurrentSection->tData[nPC + 1] = b >> 16; - pCurrentSection->tData[nPC + 2] = b >> 8; - pCurrentSection->tData[nPC + 3] = b & 0xFF; - } + pCurrentSection->tData[nPC] = b & 0xFF; + pCurrentSection->tData[nPC + 1] = b >> 8; + pCurrentSection->tData[nPC + 2] = b >> 16; + pCurrentSection->tData[nPC + 3] = b >> 24; } pCurrentSection->nPC += 4; nPC += 4; @@ -882,20 +861,11 @@ out_RelLong(struct Expression * expr) b = expr->nVal; if (rpn_isReloc(expr)) { if (nPass == 2) { - if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) { - pCurrentSection->tData[nPC] = b & 0xFF; - pCurrentSection->tData[nPC + 1] = b >> 8; - pCurrentSection->tData[nPC + 2] = b >> 16; - pCurrentSection->tData[nPC + 3] = b >> 24; - createpatch(PATCH_LONG_L, expr); - } else { - //Assume big endian - pCurrentSection->tData[nPC] = b >> 24; - pCurrentSection->tData[nPC + 1] = b >> 16; - pCurrentSection->tData[nPC + 2] = b >> 8; - pCurrentSection->tData[nPC + 3] = b & 0xFF; - createpatch(PATCH_LONG_B, expr); - } + pCurrentSection->tData[nPC] = b & 0xFF; + pCurrentSection->tData[nPC + 1] = b >> 8; + pCurrentSection->tData[nPC + 2] = b >> 16; + pCurrentSection->tData[nPC + 3] = b >> 24; + createpatch(PATCH_LONG_L, expr); } pCurrentSection->nPC += 4; nPC += 4;