Browse Source

sh2 drc host disassembler integration for gp2x

kub 5 years ago
parent
commit
f5939109c4
6 changed files with 26 additions and 11 deletions
  1. 0 2
      Makefile
  2. 1 2
      config.x86
  3. 1 1
      cpu/sh2/compiler.c
  4. 13 3
      pico/sound/mix.c
  5. 10 2
      platform/common/common.mak
  6. 1 1
      platform/common/host_dasm_arm.c

+ 0 - 2
Makefile

@@ -122,8 +122,6 @@ OBJS += platform/gp2x/emu.o
 OBJS += platform/gp2x/vid_mmsp2.o 
 OBJS += platform/gp2x/vid_pollux.o 
 OBJS += platform/gp2x/warm.o 
-OBJS += platform/gp2x/host_dasm.o
-OBJS += cpu/sh2/mame/sh2dasm.o
 USE_FRONTEND = 1
 PLATFORM_MP3 = 1
 PLATFORM_ZLIB = 1

+ 1 - 2
config.x86

@@ -4,10 +4,9 @@ CC = gcc
 CXX = g++
 AS = as
 STRIP = strip
-CFLAGS +=  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -m32 #-DGPERF -pg
+CFLAGS +=  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -m32 # -pg
 ASFLAGS += 
 LDFLAGS += -m32 #-pg
-LDLIBS += -L$(HOME)/opt/binutils-i386/usr/lib/ -lbfd-2.24-multiarch -lopcodes-2.24-multiarch
 LDLIBS += -L/usr/lib/i386-linux-gnu/debug -L/home/build/opt/lib32 -lSDL-1.2 -lasound -lpng -lz -lm -ldl
 
 ARCH = x86

+ 1 - 1
cpu/sh2/compiler.c

@@ -2744,7 +2744,7 @@ end_op:
     if (drcf.pending_branch_direct)
     {
       struct op_data *opd_b =
-        (op_flags[i] & OF_DELAY_OP) ? &ops[i-1] : opd;
+        (op_flags[i] & OF_DELAY_OP) ? opd-1 : opd;
       u32 target_pc = opd_b->imm;
       int cond = -1, ncond = -1;
       void *target = NULL;

+ 13 - 3
pico/sound/mix.c

@@ -15,16 +15,17 @@
 	else if ( val < min ) val = min; \
 }
 
+int mix_32_to_16l_level;
 
-void mix_32_to_16l_stereo(short *dest, int *src, int count)
+void mix_32_to_16l_stereo_core(short *dest, int *src, int count, int level)
 {
 	int l, r;
 
 	for (; count > 0; count--)
 	{
 		l = r = *dest;
-		l += *src++;
-		r += *src++;
+		l += *src++ >> level;
+		r += *src++ >> level;
 		Limit( l, MAXOUT, MINOUT );
 		Limit( r, MAXOUT, MINOUT );
 		*dest++ = l;
@@ -32,6 +33,15 @@ void mix_32_to_16l_stereo(short *dest, int *src, int count)
 	}
 }
 
+void mix_32_to_16l_stereo_lvl(short *dest, int *src, int count)
+{
+	mix_32_to_16l_stereo_core(dest, src, count, mix_32_to_16l_level);
+}
+
+void mix_32_to_16l_stereo(short *dest, int *src, int count)
+{
+	mix_32_to_16l_stereo_core(dest, src, count, 0);
+}
 
 void mix_32_to_16_mono(short *dest, int *src, int count)
 {

+ 10 - 2
platform/common/common.mak

@@ -161,8 +161,16 @@ SRCS_COMMON += $(R)cpu/sh2/compiler.c
 ifdef drc_debug
 DEFINES += DRC_DEBUG=$(drc_debug)
 SRCS_COMMON += $(R)cpu/sh2/mame/sh2dasm.c
-SRCS_COMMON += $(R)platform/libpicofe/linux/host_dasm.c
-LDFLAGS += -lbfd -lopcodes -liberty
+DASM = $(R)platform/libpicofe/linux/host_dasm.c
+DASMLIBS = -lbfd -lopcodes -liberty
+ifeq "$(ARCH)" "arm"
+ifeq ($(filter_out $(shell $(CC) --print-file-name=libbfd.so),"/"),)
+DASM = $(R)platform/common/host_dasm_arm.c
+DASMLIBS =
+endif
+endif
+SRCS_COMMON += $(DASM)
+LDFLAGS += $(DASMLIBS)
 endif
 endif # use_sh2drc
 SRCS_COMMON += $(R)cpu/sh2/mame/sh2pico.c

+ 1 - 1
platform/gp2x/host_dasm.c → platform/common/host_dasm_arm.c

@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "../common/disarm.c"
+#include "disarm.c"
 
 
 /* symbols */