From 0a2c1e6f5025c20e7c476e305ddda1c1a6bd9eec Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 24 Nov 2015 13:47:28 +0100 Subject: add ASM_CPU and ASM_SPC700 build options. --- Makefile | 2 ++ Makefile.common | 32 +++++++++++++++++++------------- jni/Android.mk | 2 ++ libretro/libretro.c | 2 +- src/apu.h | 4 ++-- src/cpuexec.c | 8 ++++++-- src/cpuexec.h | 2 +- src/port.h | 4 ++-- src/snes9x.h | 2 +- src/soundux.c | 2 +- 10 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index d1e93ec..d74c070 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,8 @@ else ifeq ($(platform), ctr) CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT) AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT) ARM_ASM = 1 + ASM_CPU = 0 + ASM_SPC700 = 0 CFLAGS += -DARM11 -D_3DS CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard CFLAGS += -Wall -mword-relocations diff --git a/Makefile.common b/Makefile.common index 102a0a1..92bc255 100644 --- a/Makefile.common +++ b/Makefile.common @@ -35,8 +35,6 @@ SOURCES += $(LIBRETRO_DIR)/libretro.c SOURCES += $(LIBRETRO_DIR)/memstream.c ifeq ($(ARM_ASM), 1) -SOURCES += $(CORE_DIR)/spc700a.s -SOURCES += $(CORE_DIR)/spc_decode.S SOURCES += $(CORE_DIR)/ppu.c SOURCES += $(CORE_DIR)/rops.c SOURCES += $(CORE_DIR)/mode7new.c @@ -58,15 +56,34 @@ SOURCES += $(CORE_DIR)/tile16fadd1_2.c SOURCES += $(CORE_DIR)/tile16sub.c SOURCES += $(CORE_DIR)/tile16sub1_2.c SOURCES += $(CORE_DIR)/tile16fsub1_2.c + +ifeq ($(ASM_SPC700), 1) +SOURCES += $(CORE_DIR)/spc700a.s +SOURCES += $(CORE_DIR)/spc_decode.S + +DEFINES += -DASM_SPC700 +endif + +ifeq ($(ASM_CPU), 1) SOURCES += $(CORE_DIR)/os9x_65c816_global.s SOURCES += $(CORE_DIR)/os9x_65c816_spcasm.s SOURCES += $(CORE_DIR)/os9x_65c816_spcc.s #SOURCES += $(CORE_DIR)/os9x_65c816.s SOURCES += $(CORE_DIR)/os9x_asm_cpu.c +DEFINES += -DASMCPU +endif + DEFINES += -mstructure-size-boundary=32 DEFINES += -DARM_ASM DEFINES += -DRIGHTSHIFT_IS_SAR +# Do we need all this? Causes issues on non-GCC compilers, etc. +DEFINES += -ffast-math +DEFINES += -finline -finline-functions -fexpensive-optimizations +DEFINES += -falign-functions=32 -falign-loops -falign-labels +DEFINES += -falign-jumps -fstrict-aliasing -fsigned-char -frename-registers -fweb +DEFINES += -fomit-frame-pointer + else SOURCES += $(CORE_DIR)/ppu_.c SOURCES += $(CORE_DIR)/gfx.c @@ -77,21 +94,10 @@ endif #DEFINES += -D__GP2X__ -#DEFINES += -DASMCPU #DEFINES += -DVAR_CYCLES #DEFINES += -D_C_GW_ -#DEFINES += -DUSE_SA1 #DEFINES += -DFAST_LSB_WORD_ACCESS -ifeq ($(ARM_ASM), 1) -# Do we need all this? Causes issues on non-GCC compilers, etc. -DEFINES += -ffast-math -DEFINES += -finline -finline-functions -fexpensive-optimizations -DEFINES += -falign-functions=16 -falign-loops -falign-labels -DEFINES += -falign-jumps -fstrict-aliasing -fsigned-char -frename-registers -fweb -DEFINES += -fomit-frame-pointer -endif - DEFINES += -ffast-math -funroll-loops -fomit-frame-pointer INCLUDES = -I$(LIBRETRO_DIR) -I$(CORE_DIR) -I. diff --git a/jni/Android.mk b/jni/Android.mk index e3b46c6..2e2517d 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -6,6 +6,8 @@ LOCAL_MODULE := retro ifeq ($(TARGET_ARCH),arm) ARM_ASM = 1 +ASM_CPU = 0 +ASM_SPC700 = 0 LOCAL_CFLAGS += -DANDROID_ARM LOCAL_ARM_MODE := arm endif diff --git a/libretro/libretro.c b/libretro/libretro.c index 6f5ba00..ea9ec7a 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -247,7 +247,7 @@ static void snes_init (void) Settings.TurboSkipFrames = 15; Settings.ThreadSound = FALSE; Settings.SoundSync = FALSE; -#ifdef ASMCPU +#ifdef ASM_SPC700 Settings.asmspc700 = TRUE; #endif Settings.SpeedHacks = TRUE; diff --git a/src/apu.h b/src/apu.h index ccf68dc..201c68c 100644 --- a/src/apu.h +++ b/src/apu.h @@ -107,7 +107,7 @@ STATIC inline void S9xAPUUnpackStatus() { IAPU._Zero = ((IAPU.P & Zero) == 0) | (IAPU.P & Negative); -#ifdef ASMCPU +#ifdef ASM_SPC700 if (!Settings.asmspc700) #endif { @@ -118,7 +118,7 @@ STATIC inline void S9xAPUUnpackStatus() STATIC inline void S9xAPUPackStatus() { -#ifdef ASMCPU +#ifdef ASM_SPC700 if (Settings.asmspc700) { IAPU.P &= ~(Zero | Negative); diff --git a/src/cpuexec.c b/src/cpuexec.c index faed0fa..d7d6fa2 100644 --- a/src/cpuexec.c +++ b/src/cpuexec.c @@ -348,8 +348,12 @@ S9xMainLoop(void) S9xMainLoop_NoSA1_NoAPU(); } #else - if (Settings.asmspc700) asmMainLoop_spcAsm(&CPU); - else asmMainLoop_spcC(&CPU); +#ifdef ASM_SPC700 + if (Settings.asmspc700) + asmMainLoop_spcAsm(&CPU); + else +#endif + asmMainLoop_spcC(&CPU); #endif Registers.PC = CPU.PC - CPU.PCBase; diff --git a/src/cpuexec.h b/src/cpuexec.h index 40ea4d6..407c7e5 100644 --- a/src/cpuexec.h +++ b/src/cpuexec.h @@ -190,7 +190,7 @@ extern "C" { void asm_APU_EXECUTE(int Mode); void asm_APU_EXECUTE2(void); }*/ -#ifdef ASMCPU +#ifdef ASM_SPC700 #define asm_APU_EXECUTE(MODE)\ {\ if (CPU.APU_APUExecuting == MODE) {\ diff --git a/src/port.h b/src/port.h index b203d8d..9a18644 100644 --- a/src/port.h +++ b/src/port.h @@ -134,8 +134,8 @@ typedef short int16_32; #define ALIGN_BY_ONE __attribute__ ((aligned (1), packed)) #undef FAST_LSB_WORD_ACCESS #define SUPER_FX -#ifdef ASMCPU -#define ASM_SPC700 +#if defined(ASM_SPC700) && defined(SPC700_SHUTDOWN) +#undef SPC700_SHUTDOWN #endif EXTERN_C void S9xGenerateSound(); diff --git a/src/snes9x.h b/src/snes9x.h index 8e8cac1..5ccfeb0 100644 --- a/src/snes9x.h +++ b/src/snes9x.h @@ -359,7 +359,7 @@ typedef struct bool8 DaffyDuck; uint8 APURAMInitialValue; bool8 SDD1Pack; -#ifdef ASMCPU +#ifdef ASM_SPC700 bool8 asmspc700; #endif bool8 SpeedHacks; diff --git a/src/soundux.c b/src/soundux.c index 67f7127..4649d91 100644 --- a/src/soundux.c +++ b/src/soundux.c @@ -256,7 +256,7 @@ static void DecodeBlock(Channel* ch) int16* raw = ch->block = ch->decoded; -#ifdef ARM +#ifdef ASM_SPC700 DecodeBlockAsm(compressed, raw, &ch->previous [0], &ch->previous [1]); #else int32 out; -- cgit v1.2.3