From: kub Date: Wed, 20 Mar 2019 20:12:10 +0000 (+0100) Subject: sh2 drc host disassembler integration for gp2x X-Git-Tag: v2.00~881 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5939109c409ec906c2c005656e3c0281fa11741;p=picodrive.git sh2 drc host disassembler integration for gp2x --- diff --git a/Makefile b/Makefile index 4d3288d9..ddbd71a1 100644 --- a/Makefile +++ b/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 diff --git a/config.x86 b/config.x86 index 24f9d209..d463157e 100644 --- a/config.x86 +++ b/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 diff --git a/cpu/sh2/compiler.c b/cpu/sh2/compiler.c index aa41a84d..c6522f37 100644 --- a/cpu/sh2/compiler.c +++ b/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; diff --git a/pico/sound/mix.c b/pico/sound/mix.c index 636edb55..202ba355 100644 --- a/pico/sound/mix.c +++ b/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) { diff --git a/platform/common/common.mak b/platform/common/common.mak index 29945d48..197e8677 100644 --- a/platform/common/common.mak +++ b/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 diff --git a/platform/gp2x/host_dasm.c b/platform/common/host_dasm_arm.c similarity index 98% rename from platform/gp2x/host_dasm.c rename to platform/common/host_dasm_arm.c index 5e1fc218..7951b7d9 100644 --- a/platform/gp2x/host_dasm.c +++ b/platform/common/host_dasm_arm.c @@ -2,7 +2,7 @@ #include #include -#include "../common/disarm.c" +#include "disarm.c" /* symbols */