# very small caches, avoid optimization options making the binary much bigger
CFLAGS += -finline-limit=42 -fno-unroll-loops -fno-ipa-cp -ffast-math
# this gets you about 20% better execution speed on 32bit arm/mips
-CFLAGS += -fno-common -fno-stack-protector -fno-guess-branch-probability -fno-caller-saves -fno-tree-loop-if-convert -fno-regmove
+CFLAGS += -fno-common -fno-stack-protector -fno-guess-branch-probability -fno-caller-saves -fno-regmove
+# Ouf, very old gcc toolchains (pre 4.6) don't have this option:
+CFLAGS += $(shell echo | $(CC) -ftree-loop-if-convert -x c -c -o /dev/null - 2>/dev/null && echo xfno-tree-loop-if-convert | tr x -)
endif
# default settings
OBJS += platform/gp2x/warm.o
USE_FRONTEND = 1
PLATFORM_MP3 = 1
-PLATFORM_ZLIB = 1
endif
ifeq "$(PLATFORM)" "psp"
CFLAGS += -DUSE_BGR565 -G8 # -DLPRINTF_STDIO -DFW15
ifeq "$(USE_LIBRETRO_VFS)" "1"
OBJS += platform/libretro/libretro-common/memmap/memmap.o
endif
-
-PLATFORM_ZLIB ?= 1
endif
ifeq "$(USE_FRONTEND)" "1"
# preprocessed asm files most probably include the offsets file
$(filter %.S,$(SRCS_COMMON)): pico/pico_int_offs.h
-# random deps
+# random deps - TODO remove this and compute dependcies automatically
pico/carthw/svp/compiler.o : cpu/drc/emit_arm.c
cpu/sh2/compiler.o : cpu/drc/emit_arm.c cpu/drc/emit_arm64.c cpu/drc/emit_ppc.c
cpu/sh2/compiler.o : cpu/drc/emit_x86.c cpu/drc/emit_mips.c cpu/drc/emit_riscv.c
cpu/sh2/mame/sh2pico.o : cpu/sh2/mame/sh2.c
-pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c pico/pico_int.h
-pico/memory.o pico/cd/memory.o pico/32x/memory.o : pico/pico_int.h pico/memory.h
+pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c
+pico/memory.o pico/cd/memory.o pico/32x/memory.o : pico/memory.h
+$(shell grep -rl pico_int.h pico) : pico/pico_int.h
# pico/cart.o : pico/carthw_cfg.c
cpu/fame/famec.o: cpu/fame/famec.c cpu/fame/famec_opcodes.h
CFLAGS="$CFLAGS -D__PSP__"
MFLAGS="-march=allegrex"
ARCH=mipsel
+ need_zlib="yes"
;;
*)
fail "unsupported platform: $platform"
;;
--with-sdl-gles=*) have_gles="$optarg"
;;
+ --with-zlib=*) need_zlib="$optarg"
+ ;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
echo " available: $sound_driver_list"
echo " --with-libavcodec=yes|no use libavcodec for mp3 decoding"
echo " --with-sdl-gles=yes|no enable GLES usage for SDL"
+ echo " --with-zlib=yes|no use internal zlib"
echo "influential environment variables:"
echo " CROSS_COMPILE CC CXX AS STRIP CFLAGS ASFLAGS LDFLAGS LDLIBS"
exit 1
mov r7, r7, ror #5
orr r7, r7, r7, ror #10+11
orr r7, r7, r12,lsl #1+16
- lsr r7, #16
+ mov r7, r7, lsr #16
tst r7, #0x20 @ check for prio transfer
bne 9f @ bg_loop
beq 0f\r
cmp r4, #0xe\r
orr r4, r3, r4\r
- biceq r4, #0x80\r
+ biceq r4, r4, #0x80\r
strb r4, [r1,#\offs]\r
0:\r
.endm\r
beq 0f\r
cmp r3, #2\r
mov r3, r2, lsl #2 @ htab+=DrawScanline<<1; // Offset by line\r
- biceq r3, #0x1f @ htab&=~0xf; // Offset by tile\r
- andlt r3, #0x1f\r
+ biceq r3, r3, #0x1f @ htab&=~0xf; // Offset by tile\r
+ andlt r3, r3, #0x1f\r
add r4, r4, r3\r
0: add r4, r4, r0, lsl #1 @ htab+=plane\r
bic r4, r4, #0x00ff0000 @ just in case\r
@ r4 & r7 are scratch in this loop\r
\r
@ need to calc new ty?\r
- lsls r7, r10, #7 @ (cell&1)?\r
+ movs r7, r10, lsl #7 @ (cell&1)?\r
bmi .dsloop_vs_subr1\r
\r
@ calc offset and read tileline code to r7, also calc ty\r
ble .dsloop_vs_exit\r
\r
@ need to calc new ty?\r
- lsls r7, r10, #7 @ (cell&1)?\r
+ movs r7, r10, lsl #7 @ (cell&1)?\r
bmi 0f\r
\r
@ calc offset and read tileline code to r7, also calc ty\r
and r8, lr, r8, lsl #1\r
ldrh r8, [r3, r8]\r
and r8, r8, r9\r
- lsl r8, r8, #16\r
+ mov r8, r8, lsl #16\r
\r
.fl_20loop_bl2:\r
ldr r12, [r1], #4\r
m16_32_rss_loop:
ldmia r0, {r5-r8}
- lsr r9, r4, #16
+ mov r9, r4, lsr #16
ldr r12,[r1, r9, lsl #2]
add r4, r4, r3
- lsr r9, r4, #16
+ mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
add r4, r4, r3
subs r2, r2, #2
m16_32_rss_end:
tst r2, #1
ldmeqfd sp!, {r4-r9,pc}
- lsr r9, r4, #16
+ mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
ldmia r0, {r5,r6}
mov r12,lr, lsl #16
m16_32_rsm_loop:
ldmia r0, {r5-r6}
- lsr r9, r4, #16
+ mov r9, r4, lsr #16
ldr r12,[r1, r9, lsl #2]
add r4, r4, r3
- lsr r9, r4, #16
+ mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
add r4, r4, r3
subs r2, r2, #2
m16_32_rsm_end:
tst r2, #1
ldmeqfd sp!, {r4-r6,r9,pc}
- lsr r9, r4, #16
+ mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
ldr r5, [r0]
mov r12,lr, lsl #16
@ lowpass filter
@ in=int_sample (max 20 bit), y=filter memory, r12=alpha(Q8), r8=tmp
.macro LPfilt in y
-@ asr r8, \y, #8
+@ mov r8, \y, asr #8
@ rsb r8, r8, \in, lsl #4 @ fixpoint 20.12
sub r8, \in, \y, asr #12 @ fixpoint 20.12
mla \y, r8, r12, \y
- asr \in, \y, #12
+ mov \in, \y, asr #12
.endm
mix_reset:
ldr r2, =filter
rsb r0, r0, #0x10000
-@ asr r0, r0, #8
- asr r0, r0, #4
+@ mov r0, r0, asr #8
+ mov r0, r0, asr #4
str r0, [r2], #4
mov r1, #0
str r1, [r2], #4
*/\r
\r
#include <string.h>\r
+#include "../pico_int.h"\r
#include "ym2612.h"\r
#include "sn76496.h"\r
-#include "../pico_int.h"\r
-#include "mix.h"\r
#include "emu2413/emu2413.h"\r
#include "resampler.h"\r
+#include "mix.h"\r
\r
void (*PsndMix_32_to_16l)(s16 *dest, s32 *src, int count) = mix_32_to_16l_stereo;\r
\r
ymchans = YM2612UpdateOne(buffer, length, stereo, 1);\r
}\r
\r
-int YM2612UpdateFIR(s32 *buffer, int length, int stereo, int is_buf_empty)\r
+static int YM2612UpdateFIR(s32 *buffer, int length, int stereo, int is_buf_empty)\r
{\r
resampler_update(fmresampler, buffer, length, YM2612Update);\r
return ymchans;\r
#include <string.h>\r
#include <math.h>\r
\r
+#include "../pico_int.h"\r
#include "ym2612.h"\r
\r
#ifndef EXTERNAL_YM2612\r
#else\r
/* GP2X specific */\r
#include <platform/gp2x/940ctl.h>\r
-#define YM2612Init(baseclock,rate,flags) do { \\r
- if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, flags); \\r
- else YM2612Init_(baseclock, rate, flags); \\r
-} while (0)\r
-#define YM2612ResetChip() do { \\r
- if (PicoIn.opt&POPT_EXT_FM) YM2612ResetChip_940(); \\r
- else YM2612ResetChip_(); \\r
-} while (0)\r
-#define YM2612UpdateOne(buffer,length,stereo,is_buf_empty) do { \\r
- (PicoIn.opt&POPT_EXT_FM) ? YM2612UpdateOne_940(buffer, length, stereo, is_buf_empty) : \\r
- YM2612UpdateOne_(buffer, length, stereo, is_buf_empty); \\r
-} while (0)\r
-#define YM2612PicoStateLoad() do { \\r
- if (PicoIn.opt&POPT_EXT_FM) YM2612PicoStateLoad_940(); \\r
- else YM2612PicoStateLoad_(); \\r
-} while (0)\r
+static inline void YM2612Init(int baseclock, int rate, int flags) {\r
+ if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, flags);\r
+ else YM2612Init_(baseclock, rate, flags);\r
+}\r
+\r
+static inline void YM2612ResetChip(void) {\r
+ if (PicoIn.opt&POPT_EXT_FM) YM2612ResetChip_940();\r
+ else YM2612ResetChip_();\r
+}\r
+static inline int YM2612UpdateOne(s32 *buffer, int length, int stereo, int is_buf_empty) {\r
+ return (PicoIn.opt&POPT_EXT_FM) ? YM2612UpdateOne_940(buffer, length, stereo, is_buf_empty) :\r
+ YM2612UpdateOne_(buffer, length, stereo, is_buf_empty);\r
+}\r
+static inline void YM2612PicoStateLoad(void) {\r
+ if (PicoIn.opt&POPT_EXT_FM) YM2612PicoStateLoad_940();\r
+ else YM2612PicoStateLoad_();\r
+}\r
#endif /* __GP2X__ */\r
\r
\r
1: @ EG_REL
cmp r0, #0x200 @ if ( volume >= 0x200 )
movge r0, #1024
- subge r0, #1
+ subge r0, r0, #1
movge r3, #EG_OFF
strgeb r3, [r5,#0x17] @ state
cmpge r3, #EG_REL+1
ldrh r3, [r5,#0x18] @ tl
rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT
- lslge r0, r0, #22
- lsrge r0, r0, #22
+ movge r0, r0, lsl #22
+ movge r0, r0, lsr #22
11:
#endif
beq 1f
tst r0, #0x02
- eorne r0, r0, lsr #8 @ ssg ^= ssgn ^ 4
+ eorne r0, r0, r0, lsr #8 @ ssg ^= ssgn ^ 4
eorne r0, r0, #0x4
orrne r0, r0, #0x400 @ ssgn = 4
strneh r0, [r5,#0x30]
cmpge r3, #EG_REL+1
ldrh r3, [r5,#0x18] @ tl
rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT
- lslge r0, r0, #22
- lsrge r0, r0, #22
+ movge r0, r0, lsl #22
+ movge r0, r0, lsr #22
add r0, r0, r3 @ volume += tl
strh r0, [r5,#0x34] @ vol_out
tst r0, r0
beq ctl_sample_skip
orr r4, r4, #8 @ have_output
- lsr r1, r0, #31 @ clip (saturate) sample to 14 bit
+ mov r1, r0, lsr #31 @ clip (saturate) sample to 14 bit
cmn r1, r0, asr #13
subne r0, r1, #0x80000001
- asrne r0, r0, #18
+ movne r0, r0, asr #18
tst r4, r1, lsl #7 @ (sample < 0) && dac?
bicne r0, r0, #0x1f
subne r0, r0, #7<<5
mov r12, r3, lsl #16 @ h\r
\r
vidCpy8bit_loop_out:\r
- lsrs r6, lr, #5\r
+ movs r6, lr, lsr #5\r
@ beq vidCpy8bit_loop_end\r
vidCpy8bit_loop:\r
subs r6, r6, #1\r
mov r8, #328\r
vidCpy8bitrot_loop_out:\r
mov r10, r0\r
- lsrs r9, lr, #2\r
+ movs r9, lr, lsr #2\r
@ beq vidCpy8bitrot_loop_end\r
vidCpy8bitrot_loop:\r
mov r6, r1\r