Fixed SDL port compiling. Use the asm core when compiling with USEASM=yes. Optimized the renderer a bit. FF4 intro should be a bit faster, now.

This commit is contained in:
jbo_85 2007-12-31 01:24:58 +00:00
parent 698dd10fec
commit f390575200
4 changed files with 99 additions and 104 deletions

View File

@ -1,9 +1,9 @@
CC=gcc
CPPC=g++
CFLAGS=-W -Wall -Wno-unused -O3 -DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DFINAL_VERSION -DBKPT_SUPPORT -DC_CORE -DSDL -DSYSCONFDIR="home" -DUSE_OPENGL
CFLAGS=-W -Wall -Wno-unused -O3 -DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DFINAL_VERSION -DBKPT_SUPPORT -DSDL -DSYSCONFDIR="home" -DUSE_OPENGL
CXXFLAGS=${CFLAGS}
ASM=nasm
ASMFLAGS=-w-orphan-labels -f elf -DELF -O1 -Isrc/
ASMFLAGS=-w-orphan-labels -f elf -DELF -O1 -Isrc/hq/asm/
LFLAGS=-lz -lpng -lGL `sdl-config --libs`
STRIP=strip -s
DEL=rm -f
@ -11,7 +11,7 @@ OE=.o
OUT=vba
ifeq ($(PLATFORM),win)
ASMFLAGS=-w-orphan-labels -f win32 -O1 -Isrc/
ASMFLAGS=-w-orphan-labels -f win32 -O1 -Isrc/hq/asm/
LFLAGS=-lz -lpng -lSDL -lwsock32 -lopengl32
DELETECOMMAND = del
OE=.obj
@ -21,7 +21,7 @@ endif
ifeq ($(PLATFORM),win-cross)
CC=i586-mingw32-gcc
CPPC=i586-mingw32-g++
ASMFLAGS=-w-orphan-labels -f win32 -O1 -Isrc/
ASMFLAGS=-w-orphan-labels -f win32 -O1 -Isrc/hq/asm/
LFLAGS=-lz -lpng -lSDL -lwsock32 -lopengl32
STRIP=i586-mingw32-strip -s
OE=.obj
@ -33,16 +33,17 @@ SDLDIR=src/sdl
DMGDIR=src/gb
GBAPUDIR=src/gb/gb_apu
FEXDIR=../dependencies/File_Extractor-0.4.3
HQCDIR=src/hq/c
HQASMDIR=src/hq/asm
ASMOBJ=${MAINDIR}/hq3x_16${OE} ${MAINDIR}/hq3x_32${OE} ${MAINDIR}/hq4x_16${OE} ${MAINDIR}/hq4x_32${OE} \
${MAINDIR}/hq3x32${OE}
ASMOBJ=${HQASMDIR}/hq3x_16${OE} ${HQASMDIR}/hq3x_32${OE} ${HQASMDIR}/hq4x_16${OE} \
${HQASMDIR}/hq4x_32${OE} ${HQASMDIR}/hq3x32${OE}
GBAPUOBJ=${GBAPUDIR}/Blip_Buffer${OE} ${GBAPUDIR}/Effects_Buffer${OE} ${GBAPUDIR}/Gb_Apu${OE} \
${GBAPUDIR}/Gb_Apu_State${OE} ${GBAPUDIR}/Gb_Oscs${OE} ${GBAPUDIR}/Multi_Buffer${OE}
CALTERNOBJ=${MAINDIR}/hq3x16c${OE} ${MAINDIR}/hq3x32c${OE} ${MAINDIR}/hq4x16c${OE} ${MAINDIR}/hq4x32c${OE} \
${MAINDIR}/hq_shared32${OE}
CALTERNOBJ=${HQCDIR}/hq_implementation${OE}
MAINOBJ=${MAINDIR}/2xSaI${OE} ${MAINDIR}/admame${OE} ${MAINDIR}/agbprint${OE} ${MAINDIR}/armdis${OE} \
${MAINDIR}/bilinear${OE} ${MAINDIR}/bios${OE} ${MAINDIR}/Cheats${OE} ${MAINDIR}/CheatSearch${OE} \
@ -68,6 +69,7 @@ ifeq ($(USEASM),yes)
OBJECTS+=${ASMOBJ}
else
OBJECTS+=${CALTERNOBJ}
CFLAGS+=-DC_CORE
endif
ifeq ($(USEFEX),yes)

View File

@ -321,10 +321,10 @@ static void count(u32 opcode, int cond_res)
#define EMIT1(op,arg) #op" "arg"; "
#define EMIT2(op,src,dest) #op" "src", "dest"; "
#define CONST(val) "$"#val
#define VAR(var) #var
#define VARL(var) #var
#define REGREF1(index) "reg("index")"
#define REGREF2(index,scale) "reg(,"index","#scale")"
#define VAR(var) "_"#var
#define VARL(var) "_"#var
#define REGREF1(index) "_reg("index")"
#define REGREF2(index,scale) "_reg(,"index","#scale")"
#define LABEL(n) #n": "
#define LABELREF(n,dir) #n#dir
#define al "%%al"
@ -697,7 +697,7 @@ static void count(u32 opcode, int cond_res)
: "0" (offset), "c" (shift));
#define RRX_OFFSET \
asm("btl $0, C_FLAG;" \
asm("btl $0, _C_FLAG;" \
"rcr $1, %0" \
: "=r" (offset) \
: "0" (offset));

View File

@ -324,95 +324,95 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode)
#define ADD_RN_O8(d) \
asm ("andl $0xFF, %%eax;"\
"addl %%eax, %0;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setcb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setcb _C_FLAG;"\
"setob _V_FLAG;"\
: "=m" (reg[(d)].I));
#define CMN_RD_RS \
asm ("add %0, %1;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setcb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setcb _C_FLAG;"\
"setob _V_FLAG;"\
: \
: "r" (value), "r" (reg[dest].I):"1");
#define ADC_RD_RS \
asm ("bt $0, C_FLAG;"\
asm ("bt $0, _C_FLAG;"\
"adc %1, %%ebx;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setcb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setcb _C_FLAG;"\
"setob _V_FLAG;"\
: "=b" (reg[dest].I)\
: "r" (value), "b" (reg[dest].I));
#define SUB_RN_O8(d) \
asm ("andl $0xFF, %%eax;"\
"subl %%eax, %0;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setncb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setncb _C_FLAG;"\
"setob _V_FLAG;"\
: "=m" (reg[(d)].I));
#define MOV_RN_O8(d) \
asm ("andl $0xFF, %%eax;"\
"movb $0, N_FLAG;"\
"movb $0, _N_FLAG;"\
"movl %%eax, %0;"\
"setzb Z_FLAG;"\
"setzb _Z_FLAG;"\
: "=m" (reg[(d)].I));
#define CMP_RN_O8(d) \
asm ("andl $0xFF, %%eax;"\
"cmpl %%eax, %0;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setncb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setncb _C_FLAG;"\
"setob _V_FLAG;"\
: \
: "m" (reg[(d)].I));
#define SBC_RD_RS \
asm volatile ("bt $0, C_FLAG;"\
asm volatile ("bt $0, _C_FLAG;"\
"cmc;"\
"sbb %1, %%ebx;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setncb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setncb _C_FLAG;"\
"setob _V_FLAG;"\
: "=b" (reg[dest].I)\
: "r" (value), "b" (reg[dest].I) : "cc", "memory");
#define LSL_RD_RS \
asm ("shl %%cl, %%eax;"\
"setcb C_FLAG;"\
"setcb _C_FLAG;"\
: "=a" (value)\
: "a" (reg[dest].I), "c" (value));
#define LSR_RD_RS \
asm ("shr %%cl, %%eax;"\
"setcb C_FLAG;"\
"setcb _C_FLAG;"\
: "=a" (value)\
: "a" (reg[dest].I), "c" (value));
#define ASR_RD_RS \
asm ("sar %%cl, %%eax;"\
"setcb C_FLAG;"\
"setcb _C_FLAG;"\
: "=a" (value)\
: "a" (reg[dest].I), "c" (value));
#define ROR_RD_RS \
asm ("ror %%cl, %%eax;"\
"setcb C_FLAG;"\
"setcb _C_FLAG;"\
: "=a" (value)\
: "a" (reg[dest].I), "c" (value));
#define NEG_RD_RS \
asm ("neg %%ebx;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setncb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setncb _C_FLAG;"\
"setob _V_FLAG;"\
: "=b" (reg[dest].I)\
: "b" (reg[source].I));
#define CMP_RD_RS \
asm ("sub %0, %1;"\
"setsb N_FLAG;"\
"setzb Z_FLAG;"\
"setncb C_FLAG;"\
"setob V_FLAG;"\
"setsb _N_FLAG;"\
"setzb _Z_FLAG;"\
"setncb _C_FLAG;"\
"setob _V_FLAG;"\
: \
: "r" (value), "r" (reg[dest].I):"1");
#define IMM5_INSN(OP,N) \
@ -420,75 +420,75 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode)
"shrl $1,%%eax;" \
"andl $7,%%ecx;" \
"andl $0x1C,%%eax;" \
"movl reg(%%eax),%%edx;" \
"movl _reg(%%eax),%%edx;" \
OP \
"setsb N_FLAG;" \
"setzb Z_FLAG;" \
"movl %%edx,reg(,%%ecx,4);" \
"setsb _N_FLAG;" \
"setzb _Z_FLAG;" \
"movl %%edx,_reg(,%%ecx,4);" \
: : "i" (N))
#define IMM5_INSN_0(OP) \
asm("movl %%eax,%%ecx;" \
"shrl $1,%%eax;" \
"andl $7,%%ecx;" \
"andl $0x1C,%%eax;" \
"movl reg(%%eax),%%edx;" \
"movl _reg(%%eax),%%edx;" \
OP \
"setsb N_FLAG;" \
"setzb Z_FLAG;" \
"movl %%edx,reg(,%%ecx,4);" \
"setsb _N_FLAG;" \
"setzb _Z_FLAG;" \
"movl %%edx,_reg(,%%ecx,4);" \
: : )
#define IMM5_LSL \
"shll %0,%%edx;"\
"setcb C_FLAG;"
"setcb _C_FLAG;"
#define IMM5_LSL_0 \
"testl %%edx,%%edx;"
#define IMM5_LSR \
"shrl %0,%%edx;"\
"setcb C_FLAG;"
"setcb _C_FLAG;"
#define IMM5_LSR_0 \
"testl %%edx,%%edx;"\
"setsb C_FLAG;"\
"setsb _C_FLAG;"\
"xorl %%edx,%%edx;"
#define IMM5_ASR \
"sarl %0,%%edx;"\
"setcb C_FLAG;"
"setcb _C_FLAG;"
#define IMM5_ASR_0 \
"sarl $31,%%edx;"\
"setsb C_FLAG;"
"setsb _C_FLAG;"
#define THREEARG_INSN(OP,N) \
asm("movl %%eax,%%edx;" \
"shrl $1,%%edx;" \
"andl $0x1C,%%edx;" \
"andl $7,%%eax;" \
"movl reg(%%edx),%%ecx;" \
"movl _reg(%%edx),%%ecx;" \
OP(N) \
"setsb N_FLAG;" \
"setzb Z_FLAG;" \
"movl %%ecx,reg(,%%eax,4)"::)
"setsb _N_FLAG;" \
"setzb _Z_FLAG;" \
"movl %%ecx,_reg(,%%eax,4)"::)
#define ADD_RD_RS_RN(N) \
"add (reg+"#N"*4),%%ecx;" \
"setcb C_FLAG;" \
"setob V_FLAG;"
"add (_reg+"#N"*4),%%ecx;" \
"setcb _C_FLAG;" \
"setob _V_FLAG;"
#define ADD_RD_RS_O3(N) \
"add $"#N",%%ecx;" \
"setcb C_FLAG;" \
"setob V_FLAG;"
"setcb _C_FLAG;" \
"setob _V_FLAG;"
#define ADD_RD_RS_O3_0(N) \
"movb $0,C_FLAG;" \
"movb $0,_C_FLAG;" \
"add $0,%%ecx;" \
"movb $0,V_FLAG;"
"movb $0,_V_FLAG;"
#define SUB_RD_RS_RN(N) \
"sub (reg+"#N"*4),%%ecx;" \
"setncb C_FLAG;" \
"setob V_FLAG;"
"sub (_reg+"#N"*4),%%ecx;" \
"setncb _C_FLAG;" \
"setob _V_FLAG;"
#define SUB_RD_RS_O3(N) \
"sub $"#N",%%ecx;" \
"setncb C_FLAG;" \
"setob V_FLAG;"
"setncb _C_FLAG;" \
"setob _V_FLAG;"
#define SUB_RD_RS_O3_0(N) \
"movb $1,C_FLAG;" \
"movb $1,_C_FLAG;" \
"sub $0,%%ecx;" \
"movb $0,V_FLAG;"
"movb $0,_V_FLAG;"
#endif
#else // !__GNUC__
#define ADD_RD_RS_RN(N) \

View File

@ -297,6 +297,11 @@ static inline void gfxDrawRotScreen(u16 control,
break;
}
int maskX = sizeX-1;
int maskY = sizeY-1;
int yshift = ((control >> 14) & 3)+4;
int dx = pa & 0x7FFF;
if(pa & 0x8000)
dx |= 0xFFFF8000;
@ -343,12 +348,8 @@ static inline void gfxDrawRotScreen(u16 control,
int yyy = (realY >> 8);
if(control & 0x2000) {
xxx %= sizeX;
yyy %= sizeY;
if(xxx < 0)
xxx += sizeX;
if(yyy < 0)
yyy += sizeY;
xxx &= maskX;
yyy &= maskY;
}
if(control & 0x80) {
@ -359,7 +360,7 @@ static inline void gfxDrawRotScreen(u16 control,
yyy >= sizeY) {
line[x] = 0x80000000;
} else {
int tile = screenBase[(xxx>>3) + (yyy>>3)*(sizeX>>3)];
int tile = screenBase[(xxx>>3) + ((yyy>>3)<<yshift)];
int tileX = (xxx & 7);
int tileY = yyy & 7;
@ -375,12 +376,8 @@ static inline void gfxDrawRotScreen(u16 control,
yyy = (realY >> 8);
if(control & 0x2000) {
xxx %= sizeX;
yyy %= sizeY;
if(xxx < 0)
xxx += sizeX;
if(yyy < 0)
yyy += sizeY;
xxx &= maskX;
yyy &= maskY;
}
}
} else {
@ -391,7 +388,7 @@ static inline void gfxDrawRotScreen(u16 control,
yyy >= sizeY) {
line[x] = 0x80000000;
} else {
int tile = screenBase[(xxx>>3) + (yyy>>3)*(sizeX>>3)];
int tile = screenBase[(xxx>>3) + ((yyy>>3)<<yshift)];
int tileX = (xxx & 7);
int tileY = yyy & 7;
@ -407,12 +404,8 @@ static inline void gfxDrawRotScreen(u16 control,
yyy = (realY >> 8);
if(control & 0x2000) {
xxx %= sizeX;
yyy %= sizeY;
if(xxx < 0)
xxx += sizeX;
if(yyy < 0)
yyy += sizeY;
xxx &= maskX;
yyy &= maskY;
}
}
}