mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
remove endianness code (this is solely a Game Boy assembler now)
This commit is contained in:
@@ -83,8 +83,6 @@
|
|||||||
|
|
||||||
#define MAXSECTIONSIZE 0x4000
|
#define MAXSECTIONSIZE 0x4000
|
||||||
|
|
||||||
#define ASM_DEFAULT_ENDIAN ASM_LITTLE_ENDIAN
|
|
||||||
|
|
||||||
#define APPNAME "RGBAsm"
|
#define APPNAME "RGBAsm"
|
||||||
#define EXENAME "rgbasm"
|
#define EXENAME "rgbasm"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#define ASMOTOR_MAIN_H
|
#define ASMOTOR_MAIN_H
|
||||||
|
|
||||||
struct sOptions {
|
struct sOptions {
|
||||||
ULONG endian;
|
|
||||||
char gbgfx[4];
|
char gbgfx[4];
|
||||||
char binary[2];
|
char binary[2];
|
||||||
SLONG fillchar;
|
SLONG fillchar;
|
||||||
|
|||||||
@@ -12,7 +12,4 @@ typedef signed short SWORD;
|
|||||||
typedef unsigned long ULONG;
|
typedef unsigned long ULONG;
|
||||||
typedef signed long SLONG;
|
typedef signed long SLONG;
|
||||||
|
|
||||||
#define ASM_LITTLE_ENDIAN 0
|
|
||||||
#define ASM_BIG_ENDIAN 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -127,24 +127,6 @@ opt_Parse(char *s)
|
|||||||
newopt = CurrentOptions;
|
newopt = CurrentOptions;
|
||||||
|
|
||||||
switch (s[0]) {
|
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':
|
case 'g':
|
||||||
if (strlen(&s[1]) == 4) {
|
if (strlen(&s[1]) == 4) {
|
||||||
newopt.gbgfx[0] = s[1];
|
newopt.gbgfx[0] = s[1];
|
||||||
@@ -261,7 +243,6 @@ PrintUsage(void)
|
|||||||
printf("\t-h\t\tThis text\n");
|
printf("\t-h\t\tThis text\n");
|
||||||
printf("\t-i<path>\tExtra include path\n");
|
printf("\t-i<path>\tExtra include path\n");
|
||||||
printf("\t-o<file>\tWrite objectoutput to <file>\n");
|
printf("\t-o<file>\tWrite objectoutput to <file>\n");
|
||||||
printf("\t-e(l|b)\t\tChange endianness (CAUTION!)\n");
|
|
||||||
printf
|
printf
|
||||||
("\t-g<ASCI>\tChange the four characters used for Gameboy graphics\n"
|
("\t-g<ASCI>\tChange the four characters used for Gameboy graphics\n"
|
||||||
"\t\t\tconstants (default is 0123)\n");
|
"\t\t\tconstants (default is 0123)\n");
|
||||||
@@ -293,7 +274,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* yydebug=1; */
|
/* yydebug=1; */
|
||||||
|
|
||||||
DefaultOptions.endian = ASM_DEFAULT_ENDIAN;
|
|
||||||
DefaultOptions.gbgfx[0] = '0';
|
DefaultOptions.gbgfx[0] = '0';
|
||||||
DefaultOptions.gbgfx[1] = '1';
|
DefaultOptions.gbgfx[1] = '1';
|
||||||
DefaultOptions.gbgfx[2] = '2';
|
DefaultOptions.gbgfx[2] = '2';
|
||||||
@@ -314,7 +294,6 @@ main(int argc, char *argv[])
|
|||||||
case 'o':
|
case 'o':
|
||||||
out_SetFileName(&(argv[argn][2]));
|
out_SetFileName(&(argv[argn][2]));
|
||||||
break;
|
break;
|
||||||
case 'e':
|
|
||||||
case 'g':
|
case 'g':
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'z':
|
case 'z':
|
||||||
|
|||||||
@@ -788,14 +788,8 @@ out_AbsWord(int b)
|
|||||||
checkcodesection(2);
|
checkcodesection(2);
|
||||||
b &= 0xFFFF;
|
b &= 0xFFFF;
|
||||||
if (nPass == 2) {
|
if (nPass == 2) {
|
||||||
if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) {
|
pCurrentSection->tData[nPC] = b & 0xFF;
|
||||||
pCurrentSection->tData[nPC] = b & 0xFF;
|
pCurrentSection->tData[nPC + 1] = b >> 8;
|
||||||
pCurrentSection->tData[nPC + 1] = b >> 8;
|
|
||||||
} else {
|
|
||||||
//Assume big endian
|
|
||||||
pCurrentSection->tData[nPC] = b >> 8;
|
|
||||||
pCurrentSection->tData[nPC + 1] = b & 0xFF;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pCurrentSection->nPC += 2;
|
pCurrentSection->nPC += 2;
|
||||||
nPC += 2;
|
nPC += 2;
|
||||||
@@ -818,16 +812,9 @@ out_RelWord(struct Expression * expr)
|
|||||||
b = expr->nVal & 0xFFFF;
|
b = expr->nVal & 0xFFFF;
|
||||||
if (rpn_isReloc(expr)) {
|
if (rpn_isReloc(expr)) {
|
||||||
if (nPass == 2) {
|
if (nPass == 2) {
|
||||||
if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) {
|
pCurrentSection->tData[nPC] = b & 0xFF;
|
||||||
pCurrentSection->tData[nPC] = b & 0xFF;
|
pCurrentSection->tData[nPC + 1] = b >> 8;
|
||||||
pCurrentSection->tData[nPC + 1] = b >> 8;
|
createpatch(PATCH_WORD_L, expr);
|
||||||
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->nPC += 2;
|
pCurrentSection->nPC += 2;
|
||||||
nPC += 2;
|
nPC += 2;
|
||||||
@@ -848,18 +835,10 @@ out_AbsLong(SLONG b)
|
|||||||
{
|
{
|
||||||
checkcodesection(sizeof(SLONG));
|
checkcodesection(sizeof(SLONG));
|
||||||
if (nPass == 2) {
|
if (nPass == 2) {
|
||||||
if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) {
|
pCurrentSection->tData[nPC] = b & 0xFF;
|
||||||
pCurrentSection->tData[nPC] = b & 0xFF;
|
pCurrentSection->tData[nPC + 1] = b >> 8;
|
||||||
pCurrentSection->tData[nPC + 1] = b >> 8;
|
pCurrentSection->tData[nPC + 2] = b >> 16;
|
||||||
pCurrentSection->tData[nPC + 2] = b >> 16;
|
pCurrentSection->tData[nPC + 3] = b >> 24;
|
||||||
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->nPC += 4;
|
pCurrentSection->nPC += 4;
|
||||||
nPC += 4;
|
nPC += 4;
|
||||||
@@ -882,20 +861,11 @@ out_RelLong(struct Expression * expr)
|
|||||||
b = expr->nVal;
|
b = expr->nVal;
|
||||||
if (rpn_isReloc(expr)) {
|
if (rpn_isReloc(expr)) {
|
||||||
if (nPass == 2) {
|
if (nPass == 2) {
|
||||||
if (CurrentOptions.endian == ASM_LITTLE_ENDIAN) {
|
pCurrentSection->tData[nPC] = b & 0xFF;
|
||||||
pCurrentSection->tData[nPC] = b & 0xFF;
|
pCurrentSection->tData[nPC + 1] = b >> 8;
|
||||||
pCurrentSection->tData[nPC + 1] = b >> 8;
|
pCurrentSection->tData[nPC + 2] = b >> 16;
|
||||||
pCurrentSection->tData[nPC + 2] = b >> 16;
|
pCurrentSection->tData[nPC + 3] = b >> 24;
|
||||||
pCurrentSection->tData[nPC + 3] = b >> 24;
|
createpatch(PATCH_LONG_L, expr);
|
||||||
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->nPC += 4;
|
pCurrentSection->nPC += 4;
|
||||||
nPC += 4;
|
nPC += 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user