sh2 drc host disassembler integration for gp2x
authorkub <derkub@gmail.com>
Wed, 20 Mar 2019 20:12:10 +0000 (21:12 +0100)
committerkub <derkub@gmail.com>
Tue, 30 Jul 2019 14:34:40 +0000 (16:34 +0200)
Makefile
config.x86
cpu/sh2/compiler.c
pico/sound/mix.c
platform/common/common.mak
platform/common/host_dasm_arm.c [moved from platform/gp2x/host_dasm.c with 98% similarity]

index 4d3288d..ddbd71a 100644 (file)
--- 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
index 24f9d20..d463157 100644 (file)
@@ -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
index aa41a84..c6522f3 100644 (file)
@@ -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;
index 636edb5..202ba35 100644 (file)
        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)
 {
index 29945d4..197e867 100644 (file)
@@ -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
similarity index 98%
rename from platform/gp2x/host_dasm.c
rename to platform/common/host_dasm_arm.c
index 5e1fc21..7951b7d 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "../common/disarm.c"
+#include "disarm.c"
 
 
 /* symbols */