1This is my foray into dynamic recompilation using PicoDrive, a
2Megadrive / Genesis / Sega CD / Mega CD / 32X / SMS emulator.
3
4I added support for MIPS (mips32r1), ARM64 (aarch64) and RISC-V (RV64IM) to the
5SH2 recompiler, as well as spent much effort to optimize the DRC-generated code.
6I also optimized SH2 memory access inside the emulator, and did some work on
7M68K/SH2 CPU synchronization to fix some problems and speed up the emulator.
8
9It got a bit out of hand. I ended up doing fixes and optimizations all over the
10place, mainly for 32X and CD, 32X graphics handling, and probably some more,
11see the commit history. As a result, 32X emulation speed has improved a lot.
12
13### compiling
14
15I mainly worked with standalone PicoDrive versions as created by configure/make.
16A list of platforms for which this is possible can be obtained with
17
18> configure --help
19
20If you want to build an executable for a unixoid platform not listed in the
21platform list, just use
22
23> configure --platform=generic
24
25If DRC is available for the platform, it should be enabled automatically.
26
27For other platforms using a cross-compiling toolchain I used this,
28assuming $TC points to the appropriate cross compile toolchain directory:
29
30platform|toolchain|configure command
31--------|---------|-----------------
32gp2x,wiz,caanoo|open2x|CROSS_COMPILE=arm-open2x-linux- CFLAGS="-I$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include" LDFLAGS="--sysroot $TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux -L$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib" ./configure --platform=gp2x
33gp2x,wiz,caanoo|open2x with ubuntu arm gcc 4.7|CROSS_COMPILE=arm-linux-gnueabi- CFLAGS="-I$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include" LDFLAGS="-B$TC/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1 -B$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -L$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib" ./configure --platform=gp2x
34opendingux|opendingux|CROSS_COMPILE=mipsel-linux- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="--sysroot $TC -L$TC/lib" ./configure --platform=opendingux
35opendingux|opendingux with ubuntu mips gcc 5.4|CROSS_COMPILE=mipsel-linux-gnu- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="-B$TC/usr/lib -B$TC/lib -Wl,-rpath-link=$TC/usr/lib -Wl,-rpath-link=$TC/lib" ./configure --platform=opendingux
36gcw0|gcw0|CROSS_COMPILE=mipsel-gcw0-linux-uclibc- CFLAGS="-I$TC/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include -I$TC/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL" LDFLAGS="--sysroot $TC/usr/mipsel-gcw0-linux-uclibc/sysroot" ./configure --platform=gcw0
37rg350|rg350|CROSS_COMPILE=mipsel-linux- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="--sysroot $TC -L$TC/lib" ./configure --platform=rg350
38
39For gp2x, wiz, and caanoo you may need to compile libpng first.
40
41After configure, compile with
42
43> make
44
45### helix MP3 decoder
46
47For 32 bit ARM platforms, there is the possibility to compile the helix MP3
48decoder into a shared library to be able to use MP3 audio files with CD games.
49The helix source files aren't supplied because of licensing issues. However, if
50you have obtained the sources, put them into the platform/common/helix
51directory, set CROSS to your cross compiler prefix (e.g. arm-linux-gnueabi-)
52and LIBGCC to your cross compiler's libgcc.a
53(e.g. /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/libgcc.a), and compile with
54
55> make -C platform/common/helix CROSS=$CROSS LIBGCC=$LIBGCC
56
57Copy the resulting ${CROSS}helix_mp3.so as libhelix.so to the directory where
58the PicoDrive binary is.
59
60### installing
61
62You need to install the resulting binary onto your device manually.
63For opendingux and gcw0, copy the opk to your SD card.
64For gp2x, wiz and caanoo, the easiest way is to unpack
65[PicoDrive_191.zip](http://notaz.gp2x.de/releases/PicoDrive/PicoDrive_191.zip)
66on your SD card and replace the PicoDrive binary.
67
68Send bug reports, fixes etc to <derkub@gmail.com>
69Kai-Uwe Bloem
70