shithub: rgbds

Download patch

ref: b63924ebf4a2c6d09a04ae4aa2c6701df84354ad
parent: 24c1613f06ae1352eb6ec50480227730c6f94729
author: bentley <[email protected]>
date: Fri Jan 15 11:46:26 EST 2010

remove endianness code (this is solely a Game Boy assembler now)

--- 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"
 
--- 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;
--- a/include/asm/types.h
+++ b/include/asm/types.h
@@ -12,7 +12,4 @@
 typedef unsigned long ULONG;
 typedef signed long SLONG;
 
-#define	ASM_LITTLE_ENDIAN	0
-#define	ASM_BIG_ENDIAN		1
-
 #endif
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -127,24 +127,6 @@
 	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 @@
 	printf("\t-h\t\tThis text\n");
 	printf("\t-i<path>\tExtra include path\n");
 	printf("\t-o<file>\tWrite objectoutput to <file>\n");
-	printf("\t-e(l|b)\t\tChange endianness (CAUTION!)\n");
 	printf
 	    ("\t-g<ASCI>\tChange the four characters used for Gameboy graphics\n"
 	    "\t\t\tconstants (default is 0123)\n");
@@ -293,7 +274,6 @@
 
 	/* yydebug=1; */
 
-	DefaultOptions.endian = ASM_DEFAULT_ENDIAN;
 	DefaultOptions.gbgfx[0] = '0';
 	DefaultOptions.gbgfx[1] = '1';
 	DefaultOptions.gbgfx[2] = '2';
@@ -314,7 +294,6 @@
 		case 'o':
 			out_SetFileName(&(argv[argn][2]));
 			break;
-		case 'e':
 		case 'g':
 		case 'b':
 		case 'z':
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -788,14 +788,8 @@
 	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 @@
 	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 @@
 {
 	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 @@
 	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;