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

This commit is contained in:
bentley
2010-01-15 16:46:26 -07:00
parent 24c1613f06
commit b63924ebf4
5 changed files with 14 additions and 71 deletions

View File

@@ -83,8 +83,6 @@
#define MAXSECTIONSIZE 0x4000
#define ASM_DEFAULT_ENDIAN ASM_LITTLE_ENDIAN
#define APPNAME "RGBAsm"
#define EXENAME "rgbasm"

View File

@@ -2,7 +2,6 @@
#define ASMOTOR_MAIN_H
struct sOptions {
ULONG endian;
char gbgfx[4];
char binary[2];
SLONG fillchar;

View File

@@ -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

View File

@@ -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<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 @@ 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':

View File

@@ -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;