├── AUTHORS ├── NEWS ├── po └── ChangeLog ├── debian ├── compat ├── docs ├── dirs ├── files ├── cron.d.ex ├── menu.ex ├── lxdream.substvars ├── lxdream.doc-base.EX ├── changelog ├── watch.ex ├── control ├── preinst.ex ├── prerm.ex ├── postrm.ex ├── postinst.ex ├── copyright └── manpage.1.ex ├── stamp-h.in ├── test ├── include │ ├── errno.h │ ├── fcntl.h │ ├── sys │ │ ├── file.h │ │ ├── resource.h │ │ ├── utime.h │ │ ├── param.h │ │ ├── _types.h │ │ ├── dirent.h │ │ ├── times.h │ │ ├── timeb.h │ │ ├── wait.h │ │ ├── time.h │ │ └── stat-dj.h │ ├── unistd.h │ ├── dirent.h │ ├── termios.h │ ├── utmp.h │ ├── paths.h │ ├── machine │ │ ├── time.h │ │ ├── types.h │ │ └── setjmp-dj.h │ ├── utime.h │ ├── regdef.h │ ├── fastmath.h │ ├── setjmp.h │ ├── assert.h │ ├── _syslist.h │ ├── signal.h │ ├── locale.h │ ├── _ansi.h │ ├── time.h │ ├── ctype.h │ ├── unctrl.h │ └── process.h ├── lib │ ├── libc.a │ ├── libm.a │ └── crt0.s ├── random.dat ├── lib-arm │ ├── libc.a │ ├── libm.a │ └── crt0.s ├── timer.h ├── lxdream.rc ├── sh4 │ ├── README │ ├── trapa.s │ ├── ldc.s │ ├── xtrct.s │ ├── cmpstr.s │ ├── div0.s │ ├── subc.s │ ├── vmexit.s │ ├── fsrra.s │ ├── and.s │ ├── utlb.h │ ├── andi.s │ ├── bsr.s │ ├── addv.s │ ├── subv.s │ ├── undef.s │ ├── tas.s │ ├── sub.s │ ├── mmummio.c │ └── shld.s ├── README ├── ide.h ├── testdata.h ├── bin2c.c ├── asic.h ├── timer.c ├── lib.c ├── randmath.c ├── math.s └── dma.h ├── dmg.layout ├── android ├── deps │ ├── glib-2.26.0.cache │ ├── libiconv-1.13.1.diff │ ├── glib-2.26.0.diff │ └── libisofs-0.6.38.diff ├── res │ ├── drawable │ │ ├── lxdream.png │ │ ├── tb_cdrom.png │ │ ├── tb_pause.png │ │ ├── tb_reset.png │ │ ├── tb_run.png │ │ └── tb_preferences.png │ ├── values │ │ └── strings.xml │ └── menu │ │ └── main.xml ├── project.properties ├── AndroidManifest.xml ├── gen │ └── org │ │ └── lxdream │ │ └── R.java └── src │ └── org │ └── lxdream │ ├── Dreamcast.java │ └── LxdreamView.java ├── pixmaps ├── lxdst.icns ├── tb-run.png ├── lxdream.icns ├── lxdream.png ├── tb-cdrom.png ├── tb-ctrls.png ├── tb-load.png ├── tb-paths.png ├── tb-pause.png ├── tb-reset.png ├── tb-save.png ├── tb-run-to.png ├── tb-breakpoint.png ├── tb-preferences.png └── tb-single-step.png ├── src ├── xlat │ ├── disasm │ │ ├── README │ │ ├── sysdep.h │ │ ├── dis-init.c │ │ └── symcat.h │ └── xlatdasm.h ├── tools │ ├── Makefile.am │ └── gendec.h ├── drivers │ ├── cdrom │ │ ├── cd_none.c │ │ └── isofs.h │ ├── dummy.c │ ├── joy_linux.h │ ├── video_egl.h │ ├── audio_null.c │ ├── video_nsgl.h │ ├── mac_keymap.txt │ ├── video_glx.h │ ├── genkeymap.pl │ ├── audio_esd.c │ ├── video_nsgl.m │ ├── audio_pulse.c │ └── video_null.c ├── hotkeys.h ├── sh4 │ ├── sh4dasm.h │ ├── dmac.h │ └── sh4mem.c ├── aica │ └── armdasm.h ├── clock.h ├── checkver.pl ├── gui_none.c ├── paths_unix.c ├── ioutil.c ├── tqueue.h ├── cpu.c ├── syscall.c ├── bootstrap.h ├── loader.h ├── syscall.h ├── cocoaui │ └── paths_osx.m ├── plugin.h ├── sdram.c ├── ioutil.h ├── gdrom │ └── packet.h ├── serial.h └── gdlist.h ├── ChangeLog ├── acconfig.h ├── README.md ├── lxdream.desktop ├── lxdreamrc ├── .gitignore ├── CREDITS ├── .hgignore ├── bundlelibs.pl ├── STATUS ├── Info.plist.in └── mkinstalldirs /AUTHORS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /stamp-h.in: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | NEWS 2 | README 3 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/sbin 3 | -------------------------------------------------------------------------------- /test/include/errno.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /test/include/fcntl.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /debian/files: -------------------------------------------------------------------------------- 1 | lxdream_0.8.1_i386.deb otherosfs extra 2 | -------------------------------------------------------------------------------- /test/include/sys/file.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | -------------------------------------------------------------------------------- /dmg.layout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/dmg.layout -------------------------------------------------------------------------------- /android/deps/glib-2.26.0.cache: -------------------------------------------------------------------------------- 1 | glib_cv_stack_grows=no 2 | glib_cv_uscore=no 3 | -------------------------------------------------------------------------------- /test/lib/libc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/test/lib/libc.a -------------------------------------------------------------------------------- /test/lib/libm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/test/lib/libm.a -------------------------------------------------------------------------------- /test/random.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/test/random.dat -------------------------------------------------------------------------------- /pixmaps/lxdst.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/lxdst.icns -------------------------------------------------------------------------------- /pixmaps/tb-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-run.png -------------------------------------------------------------------------------- /pixmaps/lxdream.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/lxdream.icns -------------------------------------------------------------------------------- /pixmaps/lxdream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/lxdream.png -------------------------------------------------------------------------------- /pixmaps/tb-cdrom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-cdrom.png -------------------------------------------------------------------------------- /pixmaps/tb-ctrls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-ctrls.png -------------------------------------------------------------------------------- /pixmaps/tb-load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-load.png -------------------------------------------------------------------------------- /pixmaps/tb-paths.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-paths.png -------------------------------------------------------------------------------- /pixmaps/tb-pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-pause.png -------------------------------------------------------------------------------- /pixmaps/tb-reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-reset.png -------------------------------------------------------------------------------- /pixmaps/tb-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-save.png -------------------------------------------------------------------------------- /test/lib-arm/libc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/test/lib-arm/libc.a -------------------------------------------------------------------------------- /test/lib-arm/libm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/test/lib-arm/libm.a -------------------------------------------------------------------------------- /pixmaps/tb-run-to.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-run-to.png -------------------------------------------------------------------------------- /pixmaps/tb-breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-breakpoint.png -------------------------------------------------------------------------------- /src/xlat/disasm/README: -------------------------------------------------------------------------------- 1 | i386-dis extracted from binutils 2.16.1 and modified to play with lxdream. 2 | -------------------------------------------------------------------------------- /pixmaps/tb-preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-preferences.png -------------------------------------------------------------------------------- /pixmaps/tb-single-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/pixmaps/tb-single-step.png -------------------------------------------------------------------------------- /android/res/drawable/lxdream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/android/res/drawable/lxdream.png -------------------------------------------------------------------------------- /android/res/drawable/tb_cdrom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/android/res/drawable/tb_cdrom.png -------------------------------------------------------------------------------- /android/res/drawable/tb_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/android/res/drawable/tb_pause.png -------------------------------------------------------------------------------- /android/res/drawable/tb_reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/android/res/drawable/tb_reset.png -------------------------------------------------------------------------------- /android/res/drawable/tb_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/android/res/drawable/tb_run.png -------------------------------------------------------------------------------- /debian/cron.d.ex: -------------------------------------------------------------------------------- 1 | # 2 | # Regular cron jobs for the lxdream package 3 | # 4 | 0 4 * * * root lxdream_maintenance 5 | -------------------------------------------------------------------------------- /android/res/drawable/tb_preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hean01/lxdream/master/android/res/drawable/tb_preferences.png -------------------------------------------------------------------------------- /test/include/unistd.h: -------------------------------------------------------------------------------- 1 | #ifndef _UNISTD_H_ 2 | #define _UNISTD_H_ 3 | 4 | # include 5 | 6 | #endif /* _UNISTD_H_ */ 7 | -------------------------------------------------------------------------------- /test/include/dirent.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | #include 5 | #ifdef __cplusplus 6 | } 7 | #endif 8 | -------------------------------------------------------------------------------- /test/include/termios.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | #include 5 | #ifdef __cplusplus 6 | } 7 | #endif 8 | -------------------------------------------------------------------------------- /test/include/utmp.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | #include 5 | #ifdef __cplusplus 6 | } 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /debian/menu.ex: -------------------------------------------------------------------------------- 1 | ?package(lxdream):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\ 2 | title="lxdream" command="/usr/bin/lxdream" 3 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 07 Mar 2004 - Restarting the project. Ported the gui layer to Gtk 2.0 2 | (although still need to replace the GtkCLists at some point) 3 | -------------------------------------------------------------------------------- /test/include/paths.h: -------------------------------------------------------------------------------- 1 | #ifndef _PATHS_H_ 2 | #define _PATHS_H_ 3 | 4 | #define _PATH_DEV "/dev/" 5 | #define _PATH_BSHELL "/bin/sh" 6 | 7 | #endif /* _PATHS_H_ */ 8 | -------------------------------------------------------------------------------- /acconfig.h: -------------------------------------------------------------------------------- 1 | #undef ENABLE_NLS 2 | #undef HAVE_CATGETS 3 | #undef HAVE_GETTEXT 4 | #undef GETTEXT_PACKAGE 5 | #undef HAVE_LC_MESSAGES 6 | #undef HAVE_STPCPY 7 | #undef HAVE_LIBSM 8 | -------------------------------------------------------------------------------- /test/timer.h: -------------------------------------------------------------------------------- 1 | 2 | void timer_start(); 3 | unsigned int timer_gettime(); 4 | unsigned int timer_gettime_us(); 5 | unsigned int timer_stop(); 6 | unsigned int timer_to_microsecs( long value ); 7 | -------------------------------------------------------------------------------- /test/include/machine/time.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACHTIME_H_ 2 | #define _MACHTIME_H_ 3 | 4 | #if defined(__arm__) || defined(__thumb__) 5 | #define _CLOCKS_PER_SEC_ 100 6 | #endif 7 | 8 | #endif /* _MACHTIME_H_ */ 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/include/machine/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACHTYPES_H_ 2 | #define _MACHTYPES_H_ 3 | 4 | #define _CLOCK_T_ unsigned long /* clock() */ 5 | #define _TIME_T_ long /* time() */ 6 | 7 | #endif /* _MACHTYPES_H_ */ 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | /* The utime function is defined in libc/sys//sys if it exists. */ 6 | #include 7 | 8 | #ifdef __cplusplus 9 | } 10 | #endif 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lxdream 2 | 3 | [Lxdream](http://www.lxdream.org/) is an emulator for the Sega Dreamcast system, running on Linux and OS X. 4 | 5 | This is a fork of the orginal project Lxdream by Nathan Keynes with the aim to pick up development of the stalled project. 6 | -------------------------------------------------------------------------------- /test/include/regdef.h: -------------------------------------------------------------------------------- 1 | /* regdef.h -- define register names. */ 2 | 3 | /* This is a standard include file for MIPS targets. Other target 4 | probably don't define it, and attempts to include this file will 5 | fail. */ 6 | 7 | #include 8 | -------------------------------------------------------------------------------- /test/include/fastmath.h: -------------------------------------------------------------------------------- 1 | #ifndef _FASTMATH_H_ 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | #define _FASTMATH_H_ 6 | 7 | #include 8 | #include 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif /* _FASTMATH_H_ */ 14 | -------------------------------------------------------------------------------- /android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Lxdream 4 | Run 5 | Reset 6 | Preferences 7 | 8 | -------------------------------------------------------------------------------- /lxdream.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=lxdream 5 | GenericName=Dreamcast Emulator 6 | Type=Application 7 | Categories=Game;Emulator 8 | MimeType=application/x-lxdream-save-state; 9 | FilePattern=gdi;GDI;dst;DST; 10 | Exec=lxdream %f 11 | TryExec=lxdream 12 | Icon=lxdream 13 | -------------------------------------------------------------------------------- /test/include/sys/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_RESOURCE_H_ 2 | #define _SYS_RESOURCE_H_ 3 | 4 | #include 5 | 6 | #define RUSAGE_SELF 0 /* calling process */ 7 | #define RUSAGE_CHILDREN -1 /* terminated child processes */ 8 | 9 | struct rusage { 10 | struct timeval ru_utime; /* user time used */ 11 | struct timeval ru_stime; /* system time used */ 12 | }; 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-11 12 | -------------------------------------------------------------------------------- /test/include/setjmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | setjmp.h 3 | stubs for future use. 4 | */ 5 | 6 | #ifndef _SETJMP_H_ 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #define _SETJMP_H_ 11 | 12 | #include "_ansi.h" 13 | #include 14 | 15 | void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); 16 | int _EXFUN(setjmp,(jmp_buf __jmpb)); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif /* _SETJMP_H_ */ 22 | 23 | -------------------------------------------------------------------------------- /lxdreamrc: -------------------------------------------------------------------------------- 1 | [Global] 2 | 3 | [Controllers] 4 | Device 0 = Sega Controller 5 | dpad left = Left 6 | dpad right = Right 7 | dpad up = Up 8 | dpad down = Down 9 | Start = KP_Enter, Return 10 | analog left = KP_Left 11 | analog right = KP_Right 12 | analog up = KP_Up 13 | analog down = KP_Down 14 | button X = a 15 | button Y = s 16 | button A = z 17 | button B = x 18 | trigger left = d 19 | trigger right = c 20 | -------------------------------------------------------------------------------- /test/include/sys/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTIME_H 2 | #define _SYS_UTIME_H 3 | 4 | /* This is a dummy file, not customized for any 5 | particular system. If there is a utime.h in libc/sys/SYSDIR/sys, 6 | it will override this one. */ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | struct utimbuf 13 | { 14 | time_t actime; 15 | time_t modtime; 16 | }; 17 | 18 | #ifdef __cplusplus 19 | }; 20 | #endif 21 | 22 | #endif /* _SYS_UTIME_H */ 23 | -------------------------------------------------------------------------------- /test/include/sys/param.h: -------------------------------------------------------------------------------- 1 | /* This is a dummy file, not customized for any 2 | particular system. If there is a param.h in libc/sys/SYSDIR/sys, 3 | it will override this one. */ 4 | 5 | #ifndef _SYS_PARAM_H 6 | # define _SYS_PARAM_H 7 | 8 | # define HZ (60) 9 | # define NOFILE (60) 10 | # define PATHSIZE (1024) 11 | 12 | #ifdef __i386__ 13 | #define BIG_ENDIAN 4321 14 | #define LITTLE_ENDIAN 1234 15 | #define BYTE_ORDER LITTLE_ENDIAN 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /debian/lxdream.substvars: -------------------------------------------------------------------------------- 1 | shlibs:Depends=libatk1.0-0 (>= 1.20.0), libaudiofile0 (>= 0.2.3-4), libc6 (>= 2.6.1-1), libcairo2 (>=1.4.0), libesd0 (>= 0.2.35) | libesd-alsa0 (>= 0.2.35), libfontconfig1 (>= 2.4.0), libgl1-mesa-glx | libgl1, libglib2.0-0 (>= 2.14.0), libgtk2.0-0 (>= 2.12.0), libpango1.0-0 (>= 1.18.2), libpng12-0 (>= 1.2.13-4), libx11-6, libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3 (>= 1:4.0.1), libxi6, libxinerama1, libxrandr2 (>= 2:1.2.0), libxrender1, zlib1g (>= 1:1.2.3.3.dfsg-1) 2 | -------------------------------------------------------------------------------- /test/lxdream.rc: -------------------------------------------------------------------------------- 1 | [Global] 2 | bios = 3 | flash = 4 | default path = ../disc 5 | save path = ../save 6 | bootstrap = 7 | 8 | [Controllers] 9 | Device 0 = Sega Controller 10 | dpad left = Left 11 | dpad right = Right 12 | dpad up = Up 13 | dpad down = Down 14 | Start = KP_Enter 15 | analog left = KP_Left 16 | analog right = KP_Right 17 | analog up = KP_Up 18 | analog down = KP_Down 19 | button X = A 20 | button Y = S 21 | button A = Z 22 | button B = X 23 | trigger left = D 24 | trigger right = C 25 | 26 | -------------------------------------------------------------------------------- /test/include/sys/_types.h: -------------------------------------------------------------------------------- 1 | /* ANSI C namespace clean utility typedefs */ 2 | 3 | /* This file defines various typedefs needed by the system calls that support 4 | the C library. Basically, they're just the POSIX versions with an '_' 5 | prepended. This file lives in the `sys' directory so targets can provide 6 | their own if desired (or they can put target dependant conditionals here). 7 | */ 8 | 9 | #ifndef _SYS__TYPES_H 10 | #define _SYS__TYPES_H 11 | 12 | typedef long _off_t; 13 | typedef long _ssize_t; 14 | 15 | #endif /* _SYS__TYPES_H */ 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | autom4te.cache/ 3 | *~ 4 | *.a 5 | *.o 6 | *.gmo 7 | *.so 8 | *.lo 9 | POTFILES 10 | .deps/ 11 | Makefile 12 | config.h 13 | config.log 14 | config.status 15 | Info.plist 16 | lxdream.1 17 | po/Makefile.in 18 | src/.deps/ 19 | src/drivers/mac_keymap.h 20 | src/lxdream 21 | src/pvr2/shaders.def 22 | src/pvr2/shaders.h 23 | src/sh4/sh4core.c 24 | src/sh4/sh4dasm.c 25 | src/sh4/sh4stat.c 26 | src/sh4/sh4x86.c 27 | src/str1Ilf2 28 | src/tools/.deps/ 29 | src/tools/gendec 30 | src/tools/genglsl 31 | src/tools/genmach 32 | src/version.c 33 | stamp-h1 34 | -------------------------------------------------------------------------------- /test/include/sys/dirent.h: -------------------------------------------------------------------------------- 1 | /* includes , which is this file. On a 2 | system which supports , this file is overridden by 3 | dirent.h in the libc/sys/.../sys directory. On a system which does 4 | not support , we will get this file which tries to find 5 | any other which may be lurking around. If there isn't 6 | one, the user will get an error indicating that there is no 7 | . */ 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | #include_next 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /test/sh4/README: -------------------------------------------------------------------------------- 1 | SH4 instruction set tests. 2 | Each core instruction has its own set of tests that are assembled into the 3 | main test executable. 4 | 5 | Note: Since each instruction's tests obviously depends on other 6 | instructions, its possible for multiple bugs to cancel each other out. 7 | However the tests are structured as much as possible to prevent this. 8 | 9 | Each test loops repeatedly for a constant number of times (currently 1000) 10 | to a) ensure that dynamic recompilation kicks in and recompiles the block, 11 | and b) allow the code to be timed (to a first approximation anyway). 12 | -------------------------------------------------------------------------------- /test/include/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | assert.h 3 | */ 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "_ansi.h" 10 | 11 | #undef assert 12 | 13 | #ifdef NDEBUG /* required by ANSI standard */ 14 | #define assert(p) ((void)0) 15 | #else 16 | 17 | #ifdef __STDC__ 18 | #define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e)) 19 | #else /* PCC */ 20 | #define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, "e")) 21 | #endif 22 | 23 | #endif /* NDEBUG */ 24 | 25 | void _EXFUN(__assert,(const char *, int, const char *)); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /debian/lxdream.doc-base.EX: -------------------------------------------------------------------------------- 1 | Document: lxdream 2 | Title: Debian lxdream Manual 3 | Author: 4 | Abstract: This manual describes what lxdream is 5 | and how it can be used to 6 | manage online manuals on Debian systems. 7 | Section: unknown 8 | 9 | Format: debiandoc-sgml 10 | Files: /usr/share/doc/lxdream/lxdream.sgml.gz 11 | 12 | Format: postscript 13 | Files: /usr/share/doc/lxdream/lxdream.ps.gz 14 | 15 | Format: text 16 | Files: /usr/share/doc/lxdream/lxdream.text.gz 17 | 18 | Format: HTML 19 | Index: /usr/share/doc/lxdream/html/index.html 20 | Files: /usr/share/doc/lxdream/html/*.html 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TIMES_H 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | #define _SYS_TIMES_H 6 | 7 | #include <_ansi.h> 8 | #include 9 | 10 | #ifndef __clock_t_defined 11 | typedef _CLOCK_T_ clock_t; 12 | #define __clock_t_defined 13 | #endif 14 | 15 | struct tms { 16 | clock_t tms_utime; /* user time */ 17 | clock_t tms_stime; /* system time */ 18 | clock_t tms_cutime; /* user time, children */ 19 | clock_t tms_cstime; /* system time, children */ 20 | }; 21 | 22 | clock_t _EXFUN(times,(struct tms *)); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* !_SYS_TIMES_H */ 28 | -------------------------------------------------------------------------------- /src/tools/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CPPFLAGS = -I$(top_srcdir)/src $(GLIB_FOR_BUILD_CFLAGS) 3 | AM_LDFLAGS = $(GLIB_FOR_BUILD_LDFLAGS) 4 | CC = $(CC_FOR_BUILD) 5 | CPPFLAGS = $(CPPFLAGS_FOR_BUILD) 6 | CFLAGS = $(CFLAGS_FOR_BUILD) 7 | LDFLAGS = $(LDFLAGS_FOR_BUILD) 8 | 9 | noinst_PROGRAMS = gendec genglsl genmach 10 | 11 | gendec_SOURCES = gendec.c gendec.h insparse.c actparse.c 12 | gendec_LDADD = @GLIB_FOR_BUILD_LIBS@ @GTK_LIBS@ $(INTLLIBS) 13 | 14 | genmach_SOURCES = genmach.c genmach.h mdparse.c 15 | genmach_LDADD = @GLIB_FOR_BUILD_LIBS@ @GTK_LIBS@ $(INTLLIBS) 16 | 17 | genglsl_SOURCES = genglsl.c 18 | genglsl_LDADD = @GLIB_FOR_BUILD_LIBS@ @GTK_LIBS@ $(INTLLIBS) 19 | 20 | -------------------------------------------------------------------------------- /test/sh4/trapa.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_trapa 5 | _test_trapa: 6 | start_test 7 | 8 | test_trapa_1: 9 | add #1, r12 10 | expect_exc 0x00000160 11 | trapa #42 12 | 13 | test_trapa_1_pc: 14 | assert_exc_caught test_trapa_str_k test_trapa_1_pc 15 | 16 | mov.l test_trapa_tra, r1 17 | mov.l @r1, r2 18 | mov #42, r0 19 | shll r0 20 | shll r0 21 | cmp/eq r0, r2 22 | bt test_trapa_end 23 | fail test_trapa_str_k 24 | bra test_trapa_end 25 | nop 26 | 27 | test_trapa_tra: 28 | .long 0xFF000020 29 | 30 | test_trapa_end: 31 | end_test test_trapa_str_k 32 | 33 | test_trapa_str_k: 34 | .long test_trapa_str 35 | test_trapa_str: 36 | .string "TRAPA" 37 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | lxdream (0.9.1) unstable; urgency=low 2 | 3 | * Core performance improvements, especially wrt the MMU 4 | * VMU support (memory card only) 5 | * GDB remote debugging support 6 | * Quick-save states 7 | * LIRC driver 8 | 9 | -- Nathan Keynes Sun, 28 Jun 2009 18:25:00 +1000 10 | 11 | lxdream (0.9) unstable; urgency=low 12 | 13 | * Major upgrade to emulation accuracy and rendering functionality. 14 | * Shadow volumes, render-to-texture, fog 15 | * Light-gun support 16 | 17 | -- Nathan Keynes Wed, 25 Oct 2008 18:25:00 +1000 18 | 19 | lxdream (0.8.4) unstable; urgency=low 20 | 21 | * Initial Release. 22 | 23 | -- Nathan Keynes Wed, 30 Jul 2008 18:25:00 +1000 24 | -------------------------------------------------------------------------------- /debian/watch.ex: -------------------------------------------------------------------------------- 1 | # Example watch control file for uscan 2 | # Rename this file to "watch" and then you can run the "uscan" command 3 | # to check for upstream updates and more. 4 | # See uscan(1) for format 5 | 6 | # Compulsory line, this is a version 3 file 7 | version=3 8 | 9 | # Uncomment to examine a Webpage 10 | # 11 | #http://www.example.com/downloads.php lxdream-(.*)\.tar\.gz 12 | 13 | # Uncomment to examine a Webserver directory 14 | #http://www.example.com/pub/lxdream-(.*)\.tar\.gz 15 | 16 | # Uncommment to examine a FTP server 17 | #ftp://ftp.example.com/pub/lxdream-(.*)\.tar\.gz debian uupdate 18 | 19 | # Uncomment to find new files on sourceforge, for debscripts >= 2.9 20 | # http://sf.net/lxdream/lxdream-(.*)\.tar\.gz 21 | 22 | 23 | -------------------------------------------------------------------------------- /android/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | 2 | The test cases in this directory require an sh4 tool chain, as well as an 3 | arm tool chain if you want to build the AICA tests. The default Makefile 4 | assumes these are sh-elf and arm-elf targets respectively. A modified copy of 5 | newlib 1.8.2 prebuilt for SH4 with dc-load support is included as well, 6 | to save having to set up that part of the environment. The necessary patch 7 | is in the lib directory if you wish to build from source (newlib is included 8 | under the terms of the GPL) 9 | 10 | crt0.s is included from the dcload distribution, and is assumed to be 11 | redistributable under the terms of the GPL. 12 | 13 | There is currently no configure/automake for this directory - you'll need to 14 | modify the Makefile directly if needed. This should probably be changed 15 | eventually 16 | -------------------------------------------------------------------------------- /src/drivers/cdrom/cd_none.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * The "null" cdrom device driver. Just provides a couple of empty stubs. 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include "drivers/cdrom/cdimpl.h" 20 | 21 | void cdrom_drive_scan(void ) 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /src/drivers/dummy.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Dummy plugin that exists to mark the plugin directory (and also for testing 5 | * purposes) 6 | * 7 | * Copyright (c) 2009 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #include "plugin.h" 21 | 22 | DEFINE_PLUGIN( PLUGIN_NONE, "dummy", NULL ); 23 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | Credits 2 | ======= 3 | 4 | None of this would have been possible without the work of many people in the 5 | dreamcast homebrew community, for whom I have the utmost respect. In 6 | particular, I'd like to thank: 7 | 8 | * Marcus Comstedt (http://mc.pp.se/dc/) for much educational documentation 9 | 10 | * Andrew Kieschnick (http://adk.napalm-x.com/dc/index.html) for the invaluable 11 | dcload-ip utility. 12 | 13 | * Maiwe (http://www.ludd.ltu.se/~jlo/dc/) for the excellent PVR2 and AICA 14 | documentation 15 | 16 | * bITmASTER (http://www.fuzzymuzzle.com/Bitmaster/bITmASTERs_dCdeV.htm) for 17 | (among other things) the SPU dma examples. 18 | 19 | And of course, last but by no means least 20 | * Dan Potter (http://cadcdev.sourceforge.net/) for almost single handedly 21 | jump starting the DC homebrew scene with libdream and KOS 22 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: lxdream 2 | Section: otherosfs 3 | Priority: extra 4 | Maintainer: Nathan Keynes 5 | Build-Depends: debhelper (>= 5), autotools-dev 6 | Standards-Version: 3.7.2 7 | 8 | Package: lxdream 9 | Architecture: any 10 | Depends: libatk1.0-0 (>= 1.20.0), libc6 (>= 2.3), libcairo2 (>= 1.2.4), libfontconfig1 (>= 2.4.0), libfreetype6 (>= 2.3.5), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libglib2.0-0 (>= 2.16.0), libgtk2.0-0 (>= 2.8.0), libpango1.0-0 (>= 1.14.0), libpng12-0 (>= 1.2.13-4), libx11-6, zlib1g (>= 1:1.1.4) 11 | Recommends: libasound2 (>> 1.0.18), libaudiofile0 (>= 0.2.3-4), libesd0 (>= 0.2.35) | libesd-alsa0 (>= 0.2.35), libpulse0 (>= 0.9.15~test5) 12 | Suggests: liblircclient0 13 | Description: Emulator for the Sega Dreamcast (TM) system 14 | 15 | -------------------------------------------------------------------------------- /test/include/_syslist.h: -------------------------------------------------------------------------------- 1 | /* internal use only -- mapping of "system calls" for libraries that lose 2 | and only provide C names, so that we end up in violation of ANSI */ 3 | #ifndef __SYSLIST_H 4 | #define __SYSLIST_H 5 | #ifdef MISSING_SYSCALL_NAMES 6 | #define _close close 7 | #define _execve execve 8 | #define _fcntl fcntl 9 | #define _fork fork 10 | #define _fstat fstat 11 | #define _getpid getpid 12 | #define _gettimeofday gettimeofday 13 | #define _kill kill 14 | #define _link link 15 | #define _lseek lseek 16 | #define _open open 17 | #define _read read 18 | #define _sbrk sbrk 19 | #define _stat stat 20 | #define _times times 21 | #define _unlink unlink 22 | #define _wait wait 23 | #define _write write 24 | /* functions not yet sysfaked */ 25 | #define _opendir opendir 26 | #define _readdir readdir 27 | #define _closedir closedir 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /debian/preinst.ex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # preinst script for lxdream 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `install' 10 | # * `install' 11 | # * `upgrade' 12 | # * `abort-upgrade' 13 | # for details, see http://www.debian.org/doc/debian-policy/ or 14 | # the debian-policy package 15 | 16 | 17 | case "$1" in 18 | install|upgrade) 19 | ;; 20 | 21 | abort-upgrade) 22 | ;; 23 | 24 | *) 25 | echo "preinst called with unknown argument \`$1'" >&2 26 | exit 1 27 | ;; 28 | esac 29 | 30 | # dh_installdeb will replace this with shell code automatically 31 | # generated by other debhelper scripts. 32 | 33 | #DEBHELPER# 34 | 35 | exit 0 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/sh4/ldc.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_ldc 5 | _test_ldc: 6 | start_test 7 | mov.l r8, @-r15 8 | mov.l r9, @-r15 9 | 10 | test_ldcsr_1: 11 | add #1, r12 12 | 13 | stc sr, r8 14 | mov #-1, r1 15 | ldc r1, sr 16 | stc sr, r9 17 | ldc r8, sr 18 | mov.l sr_mask, r3 19 | cmp/eq r9, r3 20 | bt test_ldsfpscr_1 21 | fail test_ldc_str_k 22 | 23 | test_ldsfpscr_1: 24 | add #1,r12 25 | sts fpscr, r0 26 | mov #-1, r1 27 | lds r1, fpscr 28 | sts fpscr, r2 29 | lds r0, fpscr 30 | mov.l fpscr_mask, r3 31 | cmp/eq r2, r3 32 | bt test_ldc_end 33 | fail test_ldc_str_k 34 | 35 | test_ldc_end: 36 | mov.l @r15+, r9 37 | mov.l @r15+, r8 38 | end_test test_ldc_str_k 39 | 40 | test_ldc_str: 41 | .string "LDC/S" 42 | .align 4 43 | sr_mask: 44 | .long 0x700083F3 45 | fpscr_mask: 46 | .long 0x003FFFFF 47 | test_ldc_str_k: 48 | .long test_ldc_str 49 | -------------------------------------------------------------------------------- /test/include/sys/timeb.h: -------------------------------------------------------------------------------- 1 | /* timeb.h -- An implementation of the standard Unix file. 2 | Written by Ian Lance Taylor 3 | Public domain; no rights reserved. 4 | 5 | declares the structure used by the ftime function, as 6 | well as the ftime function itself. Newlib does not provide an 7 | implementation of ftime. */ 8 | 9 | #ifndef _SYS_TIMEB_H 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #define _SYS_TIMEB_H 16 | 17 | #include <_ansi.h> 18 | #include 19 | 20 | #ifndef __time_t_defined 21 | typedef _TIME_T_ time_t; 22 | #define __time_t_defined 23 | #endif 24 | 25 | struct timeb 26 | { 27 | time_t time; 28 | unsigned short millitm; 29 | short timezone; 30 | short dstflag; 31 | }; 32 | 33 | extern int ftime _PARAMS ((struct timeb *)); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* ! defined (_SYS_TIMEB_H) */ 40 | -------------------------------------------------------------------------------- /test/ide.h: -------------------------------------------------------------------------------- 1 | 2 | struct gdrom_session { 3 | int track; 4 | unsigned int lba; 5 | }; 6 | 7 | struct gdrom_track { 8 | int mode; 9 | unsigned int lba; 10 | }; 11 | 12 | struct gdrom_toc { 13 | struct gdrom_track track[99]; 14 | unsigned int first_lba; 15 | unsigned int last_lba; 16 | unsigned int leadout_lba; 17 | }; 18 | 19 | int ide_init(); 20 | 21 | int ide_test_ready(); 22 | 23 | int ide_sense_error( char *buf ); 24 | 25 | int ide_get_sense_code(); 26 | 27 | /** 28 | * Retrieve session information. If session == 0, returns the 29 | * end-of-disc information instead. 30 | */ 31 | int ide_get_session( int session, struct gdrom_session *session_data ); 32 | 33 | /** 34 | * Read 1 or more sectors in PIO mode 35 | */ 36 | int ide_read_sector_pio( unsigned int sector, unsigned int count, int mode, 37 | char *buf, int length ); 38 | int ide_read_sector_dma( unsigned int sector, unsigned int count, int mode, 39 | char *buf, int length ); 40 | -------------------------------------------------------------------------------- /debian/prerm.ex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # prerm script for lxdream 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `upgrade' 11 | # * `failed-upgrade' 12 | # * `remove' `in-favour' 13 | # * `deconfigure' `in-favour' 14 | # `removing' 15 | # 16 | # for details, see http://www.debian.org/doc/debian-policy/ or 17 | # the debian-policy package 18 | 19 | 20 | case "$1" in 21 | remove|upgrade|deconfigure) 22 | ;; 23 | 24 | failed-upgrade) 25 | ;; 26 | 27 | *) 28 | echo "prerm called with unknown argument \`$1'" >&2 29 | exit 1 30 | ;; 31 | esac 32 | 33 | # dh_installdeb will replace this with shell code automatically 34 | # generated by other debhelper scripts. 35 | 36 | #DEBHELPER# 37 | 38 | exit 0 39 | 40 | 41 | -------------------------------------------------------------------------------- /android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/include/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIGNAL_H_ 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | #define _SIGNAL_H_ 6 | 7 | #include "_ansi.h" 8 | #include 9 | 10 | typedef int sig_atomic_t; /* Atomic entity type (ANSI) */ 11 | 12 | #if defined(__STDC__) || defined(__cplusplus) 13 | #define SIG_DFL ((void (*)(int))0) /* Default action */ 14 | #define SIG_IGN ((void (*)(int))1) /* Ignore action */ 15 | #define SIG_ERR ((void (*)(int))-1) /* Error return */ 16 | #else 17 | #define SIG_DFL ((void (*)())0) /* Default action */ 18 | #define SIG_IGN ((void (*)())1) /* Ignore action */ 19 | #define SIG_ERR ((void (*)())-1) /* Error return */ 20 | #endif 21 | 22 | typedef void (*_sig_func_ptr) (int); 23 | 24 | struct _reent; 25 | 26 | _sig_func_ptr _EXFUN(_signal_r, (struct _reent *, int, _sig_func_ptr)); 27 | int _EXFUN(_raise_r, (struct _reent *, int)); 28 | 29 | #ifndef _REENT_ONLY 30 | _sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr)); 31 | int _EXFUN(raise, (int)); 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif /* _SIGNAL_H_ */ 38 | -------------------------------------------------------------------------------- /src/hotkeys.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Handles hotkeys for pause/continue, save states, quit, etc 5 | * 6 | * Copyright (c) 2009 wahrhaft. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_hotkeys_H 20 | #define lxdream_hotkeys_H 21 | 22 | #include "config.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | void hotkeys_init(); 29 | lxdream_config_group_t hotkeys_get_config(); 30 | void hotkeys_register_keys(); 31 | void hotkeys_unregister_keys(); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /debian/postrm.ex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postrm script for lxdream 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # 18 | # for details, see http://www.debian.org/doc/debian-policy/ or 19 | # the debian-policy package 20 | 21 | 22 | case "$1" in 23 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 24 | ;; 25 | 26 | *) 27 | echo "postrm called with unknown argument \`$1'" >&2 28 | exit 1 29 | ;; 30 | esac 31 | 32 | # dh_installdeb will replace this with shell code automatically 33 | # generated by other debhelper scripts. 34 | 35 | #DEBHELPER# 36 | 37 | exit 0 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/sh4/sh4dasm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * SH4 CPU definition and disassembly function declarations 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_sh4dasm_H 20 | #define lxdream_sh4dasm_H 1 21 | 22 | #include "cpu.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | uint32_t sh4_disasm_instruction( uint32_t pc, char *buf, int len, char * ); 31 | void sh4_disasm_region( FILE *f, int from, int to ); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /* !lxdream_sh4dasm_H */ 38 | -------------------------------------------------------------------------------- /android/deps/libiconv-1.13.1.diff: -------------------------------------------------------------------------------- 1 | diff -ur libiconv-1.13.1/srclib/stdint.in.h /Users/nkeynes/src/libiconv-1.13.1/srclib/stdint.in.h 2 | --- libiconv-1.13.1-orig/srclib/stdint.in.h 2009-06-21 21:31:08.000000000 +1000 3 | +++ libiconv-1.13.1/srclib/stdint.in.h 2012-02-16 09:57:24.000000000 +1000 4 | @@ -29,6 +29,13 @@ 5 | . */ 6 | #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H 7 | 8 | +/* On Android (Bionic libc), includes this file before 9 | + having defined 'time_t'. Therefore in this case avoid including 10 | + other system header files; just include the system's . */ 11 | +#if defined __ANDROID__ 12 | +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ 13 | +#else 14 | + 15 | /* Get those types that are already defined in other system include 16 | files, so that we can "#define int8_t signed char" below without 17 | worrying about a later system include file containing a "typedef 18 | @@ -565,3 +572,4 @@ 19 | 20 | #endif /* _GL_STDINT_H */ 21 | #endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ 22 | +#endif /* !__ANDROID__ */ 23 | \ No newline at end of file 24 | -------------------------------------------------------------------------------- /test/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | #define WNOHANG 1 11 | #define WUNTRACED 2 12 | 13 | /* A status looks like: 14 | <2 bytes info> <2 bytes code> 15 | 16 | == 0, child has exited, info is the exit value 17 | == 1..7e, child has exited, info is the signal number. 18 | == 7f, child has stopped, info was the signal number. 19 | == 80, there was a core dump. 20 | */ 21 | 22 | #define WIFEXITED(w) (((w) & 0xff) == 0) 23 | #define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) 24 | #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) 25 | #define WEXITSTATUS(w) (((w) >> 8) & 0xff) 26 | #define WTERMSIG(w) ((w) & 0x7f) 27 | #define WSTOPSIG WEXITSTATUS 28 | 29 | pid_t wait (int *); 30 | pid_t waitpid (pid_t, int *, int); 31 | 32 | /* Provide prototypes for most of the _ names that are 33 | provided in newlib for some compilers. */ 34 | pid_t _wait (int *); 35 | 36 | #ifdef __cplusplus 37 | }; 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/drivers/joy_linux.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Linux joystick input device support 5 | * 6 | * Copyright (c) 2008 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_joy_linux_H 20 | #define lxdream_joy_linux_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** 27 | * Initialize the linux joystick code, and scan for devices 28 | */ 29 | gboolean linux_joystick_init(); 30 | 31 | /** 32 | * Shutdown the linux joystick system 33 | */ 34 | void linux_joystick_shutdown(); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* !lxdream_joy_linux_H */ 41 | -------------------------------------------------------------------------------- /debian/postinst.ex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postinst script for lxdream 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `configure' 10 | # * `abort-upgrade' 11 | # * `abort-remove' `in-favour' 12 | # 13 | # * `abort-remove' 14 | # * `abort-deconfigure' `in-favour' 15 | # `removing' 16 | # 17 | # for details, see http://www.debian.org/doc/debian-policy/ or 18 | # the debian-policy package 19 | 20 | 21 | case "$1" in 22 | configure) 23 | ;; 24 | 25 | abort-upgrade|abort-remove|abort-deconfigure) 26 | ;; 27 | 28 | *) 29 | echo "postinst called with unknown argument \`$1'" >&2 30 | exit 1 31 | ;; 32 | esac 33 | 34 | # dh_installdeb will replace this with shell code automatically 35 | # generated by other debhelper scripts. 36 | 37 | #DEBHELPER# 38 | 39 | exit 0 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/aica/armdasm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * ARM CPU definition and disassembly function declarations 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_armdasm_H 20 | #define lxdream_armdasm_H 1 21 | 22 | #include "cpu.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | uint32_t arm_disasm_instruction( uint32_t pc, char *buf, int len, char * ); 31 | uint32_t armt_disasm_instruction( uint32_t pc, char *buf, int len, char * ); 32 | extern const struct cpu_desc_struct arm_cpu_desc; 33 | extern const struct cpu_desc_struct armt_cpu_desc; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* !lxdream_armdasm_H */ 40 | -------------------------------------------------------------------------------- /test/sh4/xtrct.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_xtrct 5 | _test_xtrct: 6 | start_test 7 | 8 | test_xtrct_1: 9 | add #1, r12 10 | 11 | mov.l test_xtrct_1_input_1, r3 12 | mov.l test_xtrct_1_input_2, r4 13 | mov r4, r5 14 | xtrct r3, r4 15 | xtrct r5, r3 16 | mov.l test_xtrct_1_result_1, r0 17 | mov.l test_xtrct_1_result_2, r1 18 | cmp/eq r0, r4 19 | bf test_xtrct_1_fail 20 | cmp/eq r1, r3 21 | bt test_xtrct_2 22 | test_xtrct_1_fail: 23 | fail test_xtrct_str_k 24 | bra test_xtrct_2 25 | nop 26 | test_xtrct_1_input_1: 27 | .long 0x12345678 28 | test_xtrct_1_input_2: 29 | .long 0x9ABCDEF0 30 | test_xtrct_1_result_1: 31 | .long 0x56789ABC 32 | test_xtrct_1_result_2: 33 | .long 0xDEF01234 34 | 35 | test_xtrct_2: 36 | add #1, r12 37 | 38 | mov.l test_xtrct_2_input, r3 39 | xtrct r3, r3 40 | mov.l test_xtrct_2_result, r4 41 | cmp/eq r3, r3 42 | bt test_xtrct_end 43 | fail test_xtrct_str_k 44 | bra test_xtrct_end 45 | nop 46 | test_xtrct_2_input: 47 | .long 0x2143546A 48 | test_xtrct_2_result: 49 | .long 0x546A2143 50 | 51 | test_xtrct_end: 52 | end_test test_xtrct_str_k 53 | 54 | test_xtrct_str: 55 | .string "XTRCT" 56 | 57 | .align 4 58 | test_xtrct_str_k: 59 | .long test_xtrct_str 60 | -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | .*\.o 2 | .*\.lo 3 | .*\.so 4 | .*\.Po 5 | .*\.dylib 6 | .*\~ 7 | .*\.gmo 8 | .*\.mo 9 | .*\.class 10 | .*\.apk 11 | .*\.ap_ 12 | classes.dex 13 | autom4te.cache 14 | Makefile 15 | config.h 16 | config.status 17 | lxdream.1 18 | lxdream.app 19 | gdbserver 20 | Info.plist 21 | stamp-h1 22 | lxdream-.*.tar.gz 23 | lxdream-.*.zip 24 | src/drivers/mac_keymap.h 25 | src/tools/gendec 26 | src/tools/genglsl 27 | src/tools/genmach 28 | src/pvr2/shaders.h 29 | src/pvr2/shaders.def 30 | src/sh4/sh4dasm.c 31 | src/sh4/sh4stat.c 32 | src/sh4/sh4core.c 33 | src/sh4/sh4x86.c 34 | src/version.c 35 | src/lxdream 36 | src/liblxdream-core.a 37 | src/liblxdream.so 38 | src/testsh4x86 39 | src/test/.dirstamp 40 | src/test/testsh4x86 41 | src/test/testxlt 42 | src/test/testlxpaths 43 | po/POTFILES 44 | test/testdisp 45 | test/testdisp.bin 46 | test/testide 47 | test/testide.bin 48 | test/testmath 49 | test/testmmu 50 | test/testmmu.bin 51 | test/testregs 52 | test/testregs.bin 53 | test/testrend 54 | test/testrend.bin 55 | test/testsh4 56 | test/testsh4.bin 57 | test/testspu 58 | test/testspu.bin 59 | test/testta 60 | test/testta.bin 61 | test/testaica 62 | test/testaica.bin 63 | test/randmath 64 | test/randmath.bin 65 | test/randmath.native 66 | android/build.prop 67 | android/gen/R.java.d 68 | -------------------------------------------------------------------------------- /src/drivers/video_egl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Window management using EGL. 5 | * 6 | * Copyright (c) 2012 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | 20 | #ifndef lxdream_video_egl_H 21 | #define lxdream_video_egl_H 1 22 | 23 | #include "glib/gtypes.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #include 30 | 31 | gboolean video_egl_init(); 32 | gboolean video_egl_init_context(EGLNativeWindowType window, int format); 33 | gboolean video_egl_init_driver(display_driver_t driver); 34 | void video_egl_shutdown(); 35 | gboolean video_egl_set_window(EGLNativeWindowType window, int width, int height, int format); 36 | void video_egl_clear_window(); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* !lxdream_video_egl_H */ 43 | -------------------------------------------------------------------------------- /test/include/machine/setjmp-dj.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 3 | ** 4 | ** This file is distributed under the terms listed in the document 5 | ** "copying.dj", available from DJ Delorie at the address above. 6 | ** A copy of "copying.dj" should accompany this file; if not, a copy 7 | ** should be available from where this file was obtained. This file 8 | ** may not be distributed without a verbatim copy of "copying.dj". 9 | ** 10 | ** This file is distributed WITHOUT ANY WARRANTY; without even the implied 11 | ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | */ 13 | 14 | /* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid 15 | conflicting with setjmp.h. Ian Taylor, Cygnus support, April, 16 | 1993. */ 17 | 18 | #ifndef _SETJMP_DJ_H_ 19 | #define _SETJMP_DJ_H_ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct { 26 | unsigned long eax; 27 | unsigned long ebx; 28 | unsigned long ecx; 29 | unsigned long edx; 30 | unsigned long esi; 31 | unsigned long edi; 32 | unsigned long ebp; 33 | unsigned long esp; 34 | unsigned long eip; 35 | } jmp_buf[1]; 36 | 37 | extern int setjmp(jmp_buf); 38 | extern void longjmp(jmp_buf, int); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/clock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * External interface to the dreamcast serial port, implemented by 5 | * sh4/scif.c 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #ifndef lxdream_clock_H 21 | #define lxdream_clock_H 1 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #define MHZ 30 | #define KHZ 31 | #define SH4_BASE_RATE 200 MHZ 32 | #define ARM_BASE_RATE 2 MHZ 33 | #define PVR2_DOT_CLOCK 27068 KHZ 34 | 35 | extern uint32_t sh4_freq; 36 | extern uint32_t sh4_peripheral_freq; 37 | extern uint32_t sh4_bus_freq; 38 | extern uint32_t sh4_cpu_period; 39 | extern uint32_t sh4_peripheral_period; 40 | extern uint32_t sh4_bus_period; 41 | extern uint32_t arm_freq; 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /test/include/sys/time.h: -------------------------------------------------------------------------------- 1 | /* time.h -- An implementation of the standard Unix file. 2 | Written by Geoffrey Noer 3 | Public domain; no rights reserved. */ 4 | 5 | #ifndef _SYS_TIME_H_ 6 | #define _SYS_TIME_H_ 7 | 8 | #include <_ansi.h> 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _WINSOCK_H 16 | struct timeval { 17 | long tv_sec; 18 | long tv_usec; 19 | }; 20 | 21 | struct timezone { 22 | int tz_minuteswest; 23 | int tz_dsttime; 24 | }; 25 | 26 | #ifdef __CYGWIN32__ 27 | #include 28 | #endif /* __CYGWIN32__ */ 29 | 30 | #endif /* _WINSOCK_H */ 31 | 32 | #define ITIMER_REAL 0 33 | #define ITIMER_VIRTUAL 1 34 | #define ITIMER_PROF 2 35 | 36 | struct itimerval { 37 | struct timeval it_interval; 38 | struct timeval it_value; 39 | }; 40 | 41 | int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); 42 | int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); 43 | int _EXFUN(utimes, (const char *__path, struct timeval *__tvp)); 44 | int _EXFUN(getitimer, (int __which, struct itimerval *__value)); 45 | int _EXFUN(setitimer, (int __which, const struct itimerval *__value, 46 | struct itimerval *__ovalue)); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif /* _SYS_TIME_H_ */ 52 | -------------------------------------------------------------------------------- /src/checkver.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Usage: updatever.pl 3 | 4 | my $hgversion = "hg identify -i -n"; 5 | my $basever = $ARGV[0]; 6 | my $top_srcdir = $ARGV[1]; 7 | my $outfile = $ARGV[2]; 8 | 9 | my $rev = "", $hash; 10 | my $full_ver = "$basever"; 11 | 12 | if( $hgversion ) { 13 | my $ident = `$hgversion "$top_srcdir" 2>/dev/null`; 14 | if ( $? == 0 ) { 15 | chomp $ident; 16 | ($hash,$rev) = split /\s+/,$ident,2; 17 | $rev =~ s/\+//g; 18 | $full_ver = "${basever}.${rev}:${hash}"; 19 | } 20 | } 21 | my $header = "/* Autogenerated by checkver.pl */"; 22 | my $output = "${header}\n". 23 | "const char lxdream_package_name[] = \"lxdream $basever\";\n" . 24 | "const char lxdream_short_version[] = \"$basever\";\n" . 25 | "const char lxdream_full_version[] = \"$full_ver\";\n" . 26 | "const char lxdream_copyright[] = \"Copyright (C) 2005-2008 Nathan Keynes\";\n"; 27 | 28 | my $oldfile = ""; 29 | if( -e $outfile ) { 30 | open(VERSIONFILE, "<$outfile") || die "Unable to read from $outfile\n"; 31 | $oldfile = join "", ; 32 | close(VERSIONFILE); 33 | } 34 | 35 | if( $oldfile ne $output ) { 36 | open(VERSIONFILE, ">$outfile") || die "Unable to write to $outfile\n"; 37 | print VERSIONFILE $output; 38 | close(VERSIONFILE); 39 | } -------------------------------------------------------------------------------- /android/gen/org/lxdream/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package org.lxdream; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int lxdream=0x7f020000; 15 | public static final int tb_cdrom=0x7f020001; 16 | public static final int tb_pause=0x7f020002; 17 | public static final int tb_preferences=0x7f020003; 18 | public static final int tb_reset=0x7f020004; 19 | public static final int tb_run=0x7f020005; 20 | } 21 | public static final class id { 22 | public static final int menu_reset=0x7f050001; 23 | public static final int menu_run=0x7f050000; 24 | public static final int menu_settings=0x7f050002; 25 | } 26 | public static final class menu { 27 | public static final int main=0x7f040000; 28 | } 29 | public static final class string { 30 | public static final int lxdream_activity=0x7f030000; 31 | public static final int menu_preferences=0x7f030003; 32 | public static final int menu_reset=0x7f030002; 33 | public static final int menu_run=0x7f030001; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/sh4/cmpstr.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test cmp/xx 5 | 6 | .global _test_cmpstr 7 | _test_cmpstr: 8 | start_test 9 | mov.l r11, @-r15 10 | mov.l r10, @-r15 11 | 12 | test_cmpstr_1: ! CMP/STR r2,r2 13 | add #1, r12 14 | mova test_cmpstr_str, r0 15 | cmp/str r0, r0 16 | bt test_cmpstr_2 17 | fail test_cmpstr_str_k 18 | 19 | test_cmpstr_2: 20 | mova test_cmpstr_data, r0 21 | mov r0, r11 22 | mov #6, r10 23 | 24 | test_cmpstr_2_loop: 25 | add #1, r12 26 | mov.l @r11+, r2 27 | mov.l @r11+, r3 28 | mov.l @r11+, r4 29 | cmp/str r2, r3 30 | movt r0 31 | cmp/eq r0, r4 32 | bt test_cmpstr_2_ok 33 | fail test_cmpstr_str_k 34 | test_cmpstr_2_ok: 35 | dt r10 36 | bf test_cmpstr_2_loop 37 | 38 | test_cmpstr_end: 39 | mov.l @r15+, r10 40 | mov.l @r15+, r11 41 | end_test test_cmpstr_str_k 42 | 43 | test_cmpstr_data: 44 | .long 0x81828384 45 | .long 0x82838485 46 | .long 0x00000000 47 | 48 | .long 0x01040302 49 | .long 0x02010304 50 | .long 0x00000001 51 | 52 | .long 0xAA55AA55 53 | .long 0x55AA55AA 54 | .long 0x00000000 55 | 56 | .long 0x12345678 57 | .long 0x12345678 58 | .long 0x00000001 59 | 60 | .long 0xABCD01DC 61 | .long 0xABCD01DD 62 | .long 0x00000001 63 | 64 | .long 0x12003423 65 | .long 0x12342300 66 | .long 0x00000001 67 | 68 | test_cmpstr_str_k: 69 | .long test_cmpstr_str 70 | test_cmpstr_str: 71 | .string "CMP/STR" 72 | -------------------------------------------------------------------------------- /test/include/locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | locale.h 3 | Values appropriate for the formatting of monetary and other 4 | numberic quantities. 5 | */ 6 | 7 | #ifndef _LOCALE_H_ 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | #define _LOCALE_H_ 12 | 13 | #include "_ansi.h" 14 | 15 | #ifndef NULL 16 | #define NULL 0L 17 | #endif 18 | 19 | #define LC_ALL 0 20 | #define LC_COLLATE 1 21 | #define LC_CTYPE 2 22 | #define LC_MONETARY 3 23 | #define LC_NUMERIC 4 24 | #define LC_TIME 5 25 | 26 | struct lconv 27 | { 28 | char *decimal_point; 29 | char *thousands_sep; 30 | char *grouping; 31 | char *int_curr_symbol; 32 | char *currency_symbol; 33 | char *mon_decimal_point; 34 | char *mon_thousands_sep; 35 | char *mon_grouping; 36 | char *positive_sign; 37 | char *negative_sign; 38 | char int_frac_digits; 39 | char frac_digits; 40 | char p_cs_precedes; 41 | char p_sep_by_space; 42 | char n_cs_precedes; 43 | char n_sep_by_space; 44 | char p_sign_posn; 45 | char n_sign_posn; 46 | }; 47 | 48 | #ifndef _REENT_ONLY 49 | char *_EXFUN(setlocale,(int category, const char *locale)); 50 | struct lconv *_EXFUN(localeconv,(void)); 51 | #endif 52 | 53 | struct _reent; 54 | char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale)); 55 | struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | #endif /* _LOCALE_H_ */ 61 | -------------------------------------------------------------------------------- /src/gui_none.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Dummy GUI implementation for headless systems. 5 | * 6 | * Copyright (c) 2012 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include "gui.h" 20 | 21 | gboolean gui_parse_cmdline( int *argc, char **argv[] ) 22 | { 23 | return TRUE; 24 | } 25 | 26 | gboolean gui_init( gboolean debug, gboolean fullscreen ) 27 | { 28 | return TRUE; 29 | } 30 | 31 | void gui_main_loop( gboolean run ) { 32 | if( run ) { 33 | dreamcast_run(); 34 | } 35 | } 36 | 37 | gboolean gui_error_dialog( const char *fmt, ... ) 38 | { 39 | return TRUE; 40 | } 41 | 42 | void gui_update_state() 43 | { 44 | } 45 | 46 | void gui_set_use_grab( gboolean grab ) 47 | { 48 | } 49 | 50 | void gui_update_io_activity( io_activity_type activity, gboolean active ) 51 | { 52 | } 53 | 54 | void gui_do_later( do_later_callback_t func ) 55 | { 56 | func(); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/drivers/audio_null.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * The "null" audio driver, which just discards all input without even 5 | * looking at it. 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | #include "aica/audio.h" 20 | 21 | static gboolean audio_null_init() 22 | { 23 | return TRUE; 24 | } 25 | 26 | static gboolean audio_null_process_buffer( audio_buffer_t buffer ) 27 | { 28 | return TRUE; 29 | } 30 | 31 | static gboolean audio_null_shutdown() 32 | { 33 | return TRUE; 34 | } 35 | 36 | struct audio_driver audio_null_driver = { 37 | "null", 38 | N_("Null (no audio) driver"), 39 | 65536, // Always last 40 | DEFAULT_SAMPLE_RATE, 41 | DEFAULT_SAMPLE_FORMAT, 42 | audio_null_init, 43 | NULL, 44 | audio_null_process_buffer, 45 | NULL, 46 | audio_null_shutdown}; 47 | 48 | AUDIO_DRIVER( "null", audio_null_driver ); 49 | -------------------------------------------------------------------------------- /test/testdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Test data loader 5 | * 6 | * Copyright (c) 2006 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include 20 | 21 | #define MAX_DATA_BLOCKS 16 22 | 23 | typedef struct test_data_block { 24 | const char *name; 25 | unsigned int length; 26 | char *data; 27 | } *test_data_block_t; 28 | 29 | typedef struct test_data { 30 | const char *test_name; 31 | struct test_data *next; 32 | struct test_data_block item[MAX_DATA_BLOCKS]; 33 | } *test_data_t; 34 | 35 | typedef int (*test_func_t)(); 36 | int run_tests( test_func_t *tests ); 37 | 38 | test_data_t load_test_dataset( FILE *f ); 39 | void free_test_dataset( test_data_t dataset ); 40 | void dump_test_dataset( FILE *f, test_data_t dataset ); 41 | int test_block_compare( test_data_block_t expect, char *actual, int actual_length ); 42 | test_data_block_t get_test_data( test_data_t dataset, char *item_name ); 43 | 44 | -------------------------------------------------------------------------------- /src/drivers/video_nsgl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Cocoa (NSOpenGL) video driver 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_video_nsgl_H 20 | #define lxdream_video_nsgl_H 1 21 | 22 | #include 23 | #include "display.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * Initialize the display driver by setting the appropriate methods 31 | * for NSGL support 32 | */ 33 | gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver ); 34 | 35 | /** 36 | * Shutdown GLX support and release all resources. 37 | */ 38 | void video_nsgl_shutdown(); 39 | 40 | /** 41 | * Standard front/back buffer swap 42 | */ 43 | void video_nsgl_swap_buffers(); 44 | 45 | /** 46 | * Update the NSGL context after a window change 47 | */ 48 | void video_nsgl_update(); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* !video_nsgl_H */ -------------------------------------------------------------------------------- /test/bin2c.c: -------------------------------------------------------------------------------- 1 | /* Converts a binary file into a C integer array (for inclusion in 2 | a source file) 3 | 4 | (c)2000 Dan Potter 5 | 6 | $Id$ 7 | Note: Licensed under the new BSD license, see README.KOS -NK 8 | */ 9 | 10 | #include 11 | 12 | void convert(char *ifn, char *ofn, char *prefix) { 13 | FILE *i, *o; 14 | unsigned char buffer[2048]; 15 | int red, left, lc, q; 16 | char buf[BUFSIZ]; 17 | 18 | i = fopen(ifn, "rb"); 19 | o = fopen(ofn, "w"); 20 | if (!i || !o) { 21 | printf("error: can't open input or output file\n"); 22 | return; 23 | } 24 | 25 | fseek(i, 0, SEEK_END); left = ftell(i); fseek(i, 0, SEEK_SET); 26 | setbuf(o, buf); 27 | 28 | fprintf(o, "const int %s_size = %d;\n", prefix, left); 29 | fprintf(o, "const unsigned char %s_data[%d] =", prefix, left); 30 | fprintf(o, "{\n\t"); 31 | 32 | lc = 0; 33 | while(left > 0) { 34 | red = fread(buffer, 1, 2048, i); 35 | left -= red; 36 | for (q=0; q= 8) { 39 | lc = 0; 40 | fprintf(o, "\n\t"); 41 | } 42 | } 43 | } 44 | 45 | fprintf(o, "\n};\n"); 46 | fclose(i); fclose(o); 47 | } 48 | 49 | int main(int argc, char **argv) { 50 | 51 | char *prefix; 52 | 53 | argc--; 54 | if (argc != 2 && argc != 3) { 55 | printf("usage: bin2c [prefix]\n"); 56 | return 0; 57 | } 58 | 59 | prefix = (argc == 3) ? argv[3] : "file"; 60 | convert(argv[1], argv[2], prefix); 61 | return 0; 62 | } 63 | 64 | -------------------------------------------------------------------------------- /test/sh4/div0.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test DIV0 operation 5 | ! 6 | .global _test_div0 7 | _test_div0: 8 | start_test 9 | mov.l r11, @-r15 10 | mov.l r10, @-r15 11 | 12 | test_div0u: 13 | add #1, r12 14 | stc sr, r2 15 | mov.l test_div0_sr_mask, r0 16 | or r0, r2 17 | ldc r2, sr 18 | 19 | div0u 20 | stc sr, r3 21 | mov r3, r4 22 | and r0, r4 23 | tst r4, r4 24 | bf test_div0u_fail 25 | not r0, r0 26 | and r0, r3 27 | and r0, r2 28 | cmp/eq r2, r3 29 | bt test_div0s 30 | test_div0u_fail: 31 | fail test_div0_str_k 32 | 33 | test_div0s: 34 | mova test_div0s_data, r0 35 | mov r0, r11 36 | mov #4, r10 37 | 38 | test_div0s_loop: 39 | add #1, r12 40 | mov.l @r11+, r1 41 | mov.l @r11+, r2 42 | mov.l @r11+, r3 43 | div0s r1,r2 44 | stc sr, r4 45 | mov.l test_div0_sr_mask, r0 46 | and r0,r4 47 | cmp/eq r3,r4 48 | bt test_div0s_ok 49 | fail test_div0_str_k 50 | test_div0s_ok: 51 | dt r10 52 | bf test_div0s_loop 53 | 54 | test_div0_end: 55 | mov.l @r15+, r10 56 | mov.l @r15+, r11 57 | end_test test_div0_str_k 58 | 59 | test_div0s_data: 60 | .long 0x01234567 61 | .long 0x12345678 62 | .long 0x00000000 63 | .long 0xFFFF8912 64 | .long 0x7ABC1526 65 | .long 0x00000201 66 | .long 0x55443322 67 | .long 0x80000234 68 | .long 0x00000101 69 | .long 0xFFFFFFFF 70 | .long 0x9CD39495 71 | .long 0x00000300 72 | 73 | test_div0_sr_mask: 74 | .long 0x00000301 75 | 76 | test_div0_str_k: 77 | .long test_div0_str 78 | test_div0_str: 79 | .string "DIV0" 80 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Nathan Keynes on 2 | Thu, 15 Nov 2007 12:05:19 +1000. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author(s): 7 | 8 | Nathan Keynes 9 | 10 | Copyright: 11 | 12 | 13 | 14 | License: 15 | 16 | This package is free software; you can redistribute it and/or modify 17 | it under the terms of the GNU General Public License as published by 18 | the Free Software Foundation; either version 2 of the License, or 19 | (at your option) any later version. 20 | 21 | This package is distributed in the hope that it will be useful, 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | GNU General Public License for more details. 25 | 26 | You should have received a copy of the GNU General Public License 27 | along with this package; if not, write to the Free Software 28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 29 | 30 | On Debian systems, the complete text of the GNU General 31 | Public License can be found in `/usr/share/common-licenses/GPL'. 32 | 33 | The Debian packaging is (C) 2007, Nathan Keynes and 34 | is licensed under the GPL, see above. 35 | 36 | 37 | # Please also look if there are files or directories which have a 38 | # different copyright/license attached and list them here. 39 | -------------------------------------------------------------------------------- /test/sh4/subc.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_subc 5 | _test_subc: 6 | start_test 7 | 8 | test_subc_1: ! test subing 0+0 = 0 9 | add #1, r12 10 | 11 | xor r3, r3 12 | clrt 13 | subc r3, r3 14 | bt test_subc_1_fail 15 | tst r3, r3 16 | bt test_subc_2 17 | test_subc_1_fail: 18 | fail test_subc_str_k 19 | 20 | test_subc_2: ! test subing 0+0+T = -1 21 | add #1, r12 22 | 23 | xor r3, r3 24 | sett 25 | subc r3, r3 26 | bf test_subc_2_fail 27 | mov.l test_subc_2_result, r2 28 | cmp/eq r2, r3 29 | bt test_subc_3 30 | test_subc_2_fail: 31 | fail test_subc_str_k 32 | bra test_subc_3 33 | nop 34 | test_subc_2_result: 35 | .long 0xFFFFFFFF 36 | test_subc_3: 37 | add #1, r12 38 | 39 | xor r3, r3 40 | mov.l test_subc_3_input, r2 41 | clrt 42 | subc r2, r3 43 | bf test_subc_3_fail 44 | mov.l test_subc_3_result, r1 45 | cmp/eq r1, r3 46 | bt test_subc_4 47 | test_subc_3_fail: 48 | fail test_subc_str_k 49 | bra test_subc_4 50 | nop 51 | test_subc_3_input: 52 | .long 0x00000001 53 | test_subc_3_result: 54 | .long 0xFFFFFFFF 55 | 56 | test_subc_4: 57 | add #1, r12 58 | 59 | xor r3, r3 60 | mov.l test_subc_4_input, r2 61 | sett 62 | subc r3, r2 63 | bt test_subc_4_fail 64 | tst r2, r2 65 | bt test_subc_5 66 | test_subc_4_fail: 67 | fail test_subc_str_k 68 | bra test_subc_5 69 | nop 70 | test_subc_4_input: 71 | .long 0x00000001 72 | 73 | test_subc_5: 74 | test_subc_end: 75 | end_test test_subc_str_k 76 | 77 | test_subc_str: 78 | .string "SUBC" 79 | 80 | .align 4 81 | test_subc_str_k: 82 | .long test_subc_str 83 | -------------------------------------------------------------------------------- /test/sh4/vmexit.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test for correct performance of the continuation-type core exit - that is, 5 | ! the memory write instruction finishes completely, and the following 6 | ! instruction is only executed once. Note that we assume the exit actually 7 | ! takes place, but the mmu tests are unlikely to pass if it doesn't. 8 | ! 9 | ! Reserved: 10 | ! r11 Original value of MMUCR 11 | ! r10 Address of MMUCR 12 | ! r9 Current value of MMUCR 13 | 14 | .global _test_vmexit 15 | _test_vmexit: 16 | start_test 17 | 18 | mov.l r11, @-r15 19 | mov.l r10, @-r15 20 | mov.l r9, @-r15 21 | 22 | mov.l test_vmexit_mmucr, r10 23 | mov.l @r10, r11 24 | mov r11, r9 25 | 26 | test_vmexit_1: 27 | add #1, r12 28 | mov r10, r0 29 | mov r10, r2 30 | mov #1, r1 31 | add #4, r0 32 | xor r1, r9 33 | mov.l r9, @-r0 34 | add #1, r1 35 | cmp/eq r0, r2 36 | bt test_vmexit_1a 37 | fail test_vmexit_str_k 38 | bra test_vmexit_2 39 | nop 40 | test_vmexit_1a: 41 | mov #2, r0 42 | cmp/eq r1, r0 43 | bt test_vmexit_2 44 | fail test_vmexit_str_k 45 | 46 | test_vmexit_2: 47 | add #1, r12 48 | mov #1, r1 49 | xor r1, r9 50 | bra test_vmexit_2_ok 51 | mov.l r9, @r10 52 | fail test_vmexit_str_k 53 | bra test_vmexit_end 54 | nop 55 | 56 | test_vmexit_2_ok: 57 | 58 | test_vmexit_end: 59 | mov.l r11, @r10 60 | mov.l @r15+, r9 61 | mov.l @r15+, r10 62 | mov.l @r15+, r11 63 | end_test test_vmexit_str_k 64 | 65 | test_vmexit_mmucr: 66 | .long 0xFF000010 67 | test_vmexit_str_k: 68 | .long test_vmexit_str 69 | test_vmexit_str: 70 | .string "VM-EXIT" 71 | -------------------------------------------------------------------------------- /src/xlat/disasm/sysdep.h: -------------------------------------------------------------------------------- 1 | /* Random host-dependent support code. 2 | Copyright 1995, 1997, 2000 Free Software Foundation, Inc. 3 | Written by Ken Raeburn. 4 | 5 | This file is part of libopcodes, the opcodes library. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 20 | 21 | /* Do system-dependent stuff, mainly driven by autoconf-detected info. 22 | 23 | Well, some generic common stuff is done here too, like including 24 | ansidecl.h. That's because the .h files in bfd/hosts files I'm 25 | trying to replace often did that. If it can be dropped from this 26 | file (check in a non-ANSI environment!), it should be. */ 27 | 28 | #include "lxdream.h" 29 | 30 | #include "xlat/disasm/ansidecl.h" 31 | 32 | #ifdef HAVE_STDLIB_H 33 | #include 34 | #endif 35 | 36 | #ifdef HAVE_STRING_H 37 | #include 38 | #else 39 | #ifdef HAVE_STRINGS_H 40 | #include 41 | #endif 42 | #endif 43 | -------------------------------------------------------------------------------- /src/paths_unix.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Wrappers for system-dependent functions (mainly path differences) 5 | * 6 | * Copyright (c) 2008 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "lxdream.h" 24 | #include "config.h" 25 | 26 | const char *get_sysconf_path() 27 | { 28 | return PACKAGE_CONF_DIR; 29 | } 30 | 31 | const char *get_locale_path() 32 | { 33 | return PACKAGE_LOCALE_DIR; 34 | } 35 | 36 | const char *get_plugin_path() 37 | { 38 | return PACKAGE_PLUGIN_DIR; 39 | } 40 | 41 | static char *user_data_path = NULL; 42 | 43 | const char *get_user_data_path() 44 | { 45 | if( user_data_path == NULL ) { 46 | char *home = getenv("HOME"); 47 | user_data_path = g_strdup_printf( "%s/.lxdream", home ); 48 | } 49 | return user_data_path; 50 | } 51 | 52 | void set_user_data_path( const char *p ) 53 | { 54 | g_free(user_data_path); 55 | user_data_path = g_strdup(p); 56 | } 57 | 58 | const char *get_user_home_path() 59 | { 60 | return getenv("HOME"); 61 | } 62 | -------------------------------------------------------------------------------- /test/sh4/fsrra.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_fsrra 5 | _test_fsrra: 6 | start_test 7 | mov.l r11, @-r15 8 | mov.l test_fsrra_data_k, r11 9 | 10 | test_fsrra_loop: 11 | mov.l test_fsrra_data_end_k, r4 12 | cmp/eq r11, r4 13 | bt test_fsrra_end 14 | add #1, r12 15 | 16 | fmov @r11+, fr5 17 | fsrra fr5 18 | flds fr5, fpul 19 | sts fpul, r5 20 | mov.l @r11+, r4 21 | cmp/eq r4, r5 22 | bt test_fsrra_loop 23 | 24 | mov.l test_fsrra_error_k, r3 25 | jsr @r3 26 | fail test_fsrra_str_k 27 | bra test_fsrra_loop 28 | nop 29 | 30 | test_fsrra_end: 31 | mov.l @r15+, r11 32 | end_test test_fsrra_str_k 33 | 34 | .align 4 35 | test_fsrra_data_k: 36 | .long test_fsrra_data 37 | test_fsrra_data: 38 | test_fsrra_data_1: 39 | .long 0x3F800000 40 | .long 0x3F800000 41 | 42 | .long 0x43214321 43 | .long 0x3da14613 44 | 45 | .long 0x3B0D693E 46 | .long 0x41ac38ca 47 | 48 | .long 0x3B5D87B7 49 | .long 0x41899934 50 | 51 | .long 0x41899934 52 | .long 0x3e76e8e3 53 | 54 | # .long 0xFFFFFFF0 55 | # .long 0x7fbfffff 56 | 57 | .long 0x00000040 58 | .long 0x633504f3 59 | 60 | .long 0xFFFFFF80 61 | .long 0xffffff80 62 | 63 | .long 0x00000001 64 | .long 0x64b504f3 65 | 66 | .long 0x98765432 67 | .long 0xffc00000 68 | 69 | .long 0x64b504f3 70 | .long 0x2cd744fd 71 | 72 | .long 0x2cd744fd 73 | .long 0x48c5672a 74 | 75 | test_fsrra_data_end: 76 | .align 4 77 | test_fsrra_data_end_k: 78 | .long test_fsrra_data_end 79 | test_fsrra_str_k: 80 | .long test_fsrra_str 81 | test_fsrra_error_k: 82 | .long _test_print_float_error 83 | test_fsrra_str: 84 | .string "FSRRA" 85 | -------------------------------------------------------------------------------- /test/sh4/and.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test AND Rm,Rn operation 5 | ! 6 | .global _test_and 7 | _test_and: 8 | start_test 9 | mov.l r11, @-r15 10 | mov.l test_and_data_k, r11 11 | 12 | test_and_loop: 13 | mov.l test_and_data_end_k, r4 14 | cmp/eq r11, r4 15 | bt test_and_end 16 | add #1, r12 17 | 18 | clc 19 | mov.l @r11+, r0 20 | mov.l @r11+, r1 21 | and r0, r1 22 | stc sr, r4 23 | mov.l @r11+, r2 24 | mov.l @r11+, r3 25 | cmp/eq r1, r2 26 | bt test_and_b 27 | fail test_and_str_k 28 | bra test_and_loop 29 | nop 30 | test_and_b: 31 | ldc r4, sr 32 | xor r0, r0 33 | add #1, r0 34 | and r0, r4 35 | cmp/eq r3, r4 36 | bt test_and_loop 37 | fail test_and_str_k 38 | bra test_and_loop 39 | nop 40 | 41 | test_and_end: 42 | mov.l @r15+, r11 43 | end_test test_and_str_k 44 | 45 | .align 4 46 | test_and_data_k: 47 | .long test_and_data 48 | test_and_data: 49 | test_and_data_1: 50 | .long 0xFFFFFFFF 51 | .long 0x00000000 52 | .long 0x00000000 53 | .long 0x00000000 54 | 55 | .long 0x55555555 56 | .long 0xAAAAAAAA 57 | .long 0x00000000 58 | .long 0x00000000 59 | 60 | .long 0xFFFFFFFF 61 | .long 0xA5A5A5A5 62 | .long 0xA5A5A5A5 63 | .long 0x00000000 64 | 65 | .long 0xFFFFFFFF 66 | .long 0xFFFFFFFF 67 | .long 0xFFFFFFFF 68 | .long 0x00000000 69 | 70 | .long 0x12345678 71 | .long 0x98765432 72 | .long 0x10345430 73 | .long 0x00000000 74 | 75 | .long 0x00FFFFFF 76 | .long 0x98765432 77 | .long 0x00765432 78 | .long 0x00000000 79 | 80 | test_and_data_end: 81 | .align 4 82 | test_and_data_end_k: 83 | .long test_and_data_end 84 | test_and_str_k: 85 | .long test_and_str 86 | test_and_str: 87 | .string "AND" 88 | -------------------------------------------------------------------------------- /android/deps/glib-2.26.0.diff: -------------------------------------------------------------------------------- 1 | diff -ur glib-2.26.0/glib/gstrfuncs.c glib-2.26.0/glib/gstrfuncs.c 2 | --- glib-2.26.0/glib/gstrfuncs.c 2010-09-14 01:57:51.000000000 +1000 3 | +++ glib-2.26.0/glib/gstrfuncs.c 2012-02-16 17:36:27.000000000 +1000 4 | @@ -442,8 +442,12 @@ 5 | 6 | fail_pos = NULL; 7 | 8 | +#ifdef __ANDROID__ 9 | + decimal_point = "."; 10 | +#else 11 | locale_data = localeconv (); 12 | decimal_point = locale_data->decimal_point; 13 | +#endif 14 | decimal_point_len = strlen (decimal_point); 15 | 16 | g_assert (decimal_point_len != 0); 17 | @@ -656,8 +660,12 @@ 18 | 19 | _g_snprintf (buffer, buf_len, format, d); 20 | 21 | +#ifdef __ANDROID__ 22 | + decimal_point = "."; 23 | +#else 24 | locale_data = localeconv (); 25 | decimal_point = locale_data->decimal_point; 26 | +#endif 27 | decimal_point_len = strlen (decimal_point); 28 | 29 | g_assert (decimal_point_len != 0); 30 | diff -ur glib-2.26.0/glib/gutils.c glib-2.26.0/glib/gutils.c 31 | --- glib-2.26.0/glib/gutils.c 2010-09-14 01:57:51.000000000 +1000 32 | +++ glib-2.26.0/glib/gutils.c 2012-02-16 17:35:33.000000000 +1000 33 | @@ -1694,14 +1694,12 @@ 34 | 35 | if (!pw) 36 | { 37 | - setpwent (); 38 | pw = getpwuid (getuid ()); 39 | - endpwent (); 40 | } 41 | if (pw) 42 | { 43 | g_user_name = g_strdup (pw->pw_name); 44 | - 45 | +#ifndef __ANDROID__ 46 | if (pw->pw_gecos && *pw->pw_gecos != '\0') 47 | { 48 | gchar **gecos_fields; 49 | @@ -1715,7 +1713,7 @@ 50 | g_strfreev (gecos_fields); 51 | g_strfreev (name_parts); 52 | } 53 | - 54 | +#endif 55 | if (!g_home_dir) 56 | g_home_dir = g_strdup (pw->pw_dir); 57 | } 58 | -------------------------------------------------------------------------------- /bundlelibs.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Script for OS X to copy all non-core library dependencies into the bundle, and fixup the lib naming 3 | # Run after the executable is already in the bundle. 4 | 5 | if( $#ARGV <= 0 ) { 6 | die( "Usage: bundlelibs.pl \n" ); 7 | } 8 | 9 | my $BINARY=shift(); 10 | my $TARGETDIR=shift(); 11 | my $OTOOL="otool"; 12 | my $NTOOL="install_name_tool"; 13 | 14 | mkdir $TARGETDIR; 15 | 16 | my %done=(); 17 | my @worklist = ($BINARY); 18 | 19 | while( $#worklist >= 0 ) { 20 | my $target = shift @worklist; 21 | $done{$target} = 2; 22 | 23 | open FH, "$OTOOL -L $target|" || die "Unable to run otool"; 24 | $skip = ; 25 | 26 | while(){ 27 | $lib = $_; 28 | $lib =~ s/^\s+([^\s]+)\s.*$/$1/s; 29 | if( $lib !~ /^\/System\/Library/ && $lib !~ /^\/usr\/lib/ && $lib !~ /^\@executable_path\// ) { 30 | $libname = $lib; 31 | $libname =~ s#^.*/##; 32 | $targetpath = "$TARGETDIR/$libname"; 33 | $libid = "\@executable_path/../Frameworks/$libname"; 34 | if( !$done{$libname} ) { 35 | $done{$libname} = 1; 36 | push @worklist, $targetpath; 37 | system( ("cp", $lib, $targetpath) ) == 0 || die "Failed to copy $lib to $targetpath"; 38 | system( ($NTOOL, "-id", $libid, $targetpath) ) == 0 || die "Failed to set $lib ID to $libid"; 39 | print "Copied $lib => $targetpath\n"; 40 | } 41 | system( ($NTOOL, "-change", $lib, $libid, $target ) ) == 0 || die "Failed to change $lib ID to $libid"; 42 | } 43 | } 44 | close FH; 45 | } 46 | -------------------------------------------------------------------------------- /src/ioutil.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Network support functions 5 | * 6 | * Copyright (c) 2009 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "ioutil.h" 26 | 27 | int io_create_server_socket(const char *interface, int port ) 28 | { 29 | struct sockaddr_in sin; 30 | int fd = socket(AF_INET, SOCK_STREAM, 0); 31 | if( fd == -1 ) { 32 | ERROR( "Failed to create TCP socket!" ); 33 | return -1; 34 | } 35 | 36 | sin.sin_family = AF_INET; 37 | sin.sin_addr.s_addr = 0; 38 | sin.sin_port = htons(port); 39 | 40 | if( interface != NULL ) { 41 | if( !inet_aton(interface, &sin.sin_addr) ) { 42 | /* TODO: hostname lookup */ 43 | } 44 | } 45 | 46 | if( bind( fd, (struct sockaddr *)&sin, sizeof(sin) ) != 0 || 47 | listen(fd, 5) != 0 ) { 48 | close(fd); 49 | ERROR( "Failed to bind port %d (%s)", port, strerror(errno) ); 50 | return -1; 51 | } 52 | return fd; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/drivers/mac_keymap.txt: -------------------------------------------------------------------------------- 1 | 0x00 a 2 | 0x01 s 3 | 0x02 d 4 | 0x03 f 5 | 0x04 h 6 | 0x05 g 7 | 0x06 z 8 | 0x07 x 9 | 0x08 c 10 | 0x09 v 11 | 0x0B b 12 | 0x0C q 13 | 0x0D w 14 | 0x0E e 15 | 0x0F r 16 | 0x10 y 17 | 0x11 t 18 | 0x12 1 19 | 0x13 2 20 | 0x14 3 21 | 0x15 4 22 | 0x16 6 23 | 0x17 5 24 | 0x18 equal 25 | 0x19 9 26 | 0x1A 7 27 | 0x1B minus 28 | 0x1C 8 29 | 0x1D 0 30 | 0x1E bracketright 31 | 0x1F o 32 | 0x20 u 33 | 0x21 bracketleft 34 | 0x22 i 35 | 0x23 p 36 | 0x24 Return 37 | 0x25 l 38 | 0x26 j 39 | 0x27 apostrophe 40 | 0x28 k 41 | 0x29 semicolon 42 | 0x2A backslash 43 | 0x2B comma 44 | 0x2C slash 45 | 0x2D n 46 | 0x2E m 47 | 0x2F period 48 | 0x30 Tab 49 | 0x31 space 50 | 0x32 grave 51 | 0x33 BackSpace 52 | 0x35 Escape 53 | 0x36 Meta_R 54 | 0x37 Meta_L 55 | 0x38 Shift_L 56 | 0x39 Caps_Lock 57 | 0x3A Alt_L 58 | 0x3B Control_L 59 | 0x3C Shift_R 60 | 0x3D Alt_R 61 | 0x3E Control_R 62 | 0x3F Function 63 | 0x41 KP_Delete 64 | 0x43 KP_Multiply 65 | 0x45 KP_Add 66 | 0x47 Num_Lock 67 | 0x4B KP_Divide 68 | 0x4C KP_Enter 69 | 0x4E KP_Subtract 70 | 0x51 KP_Equal 71 | 0x52 KP_Insert 72 | 0x53 KP_End 73 | 0x54 KP_Down 74 | 0x55 KP_Page_Down 75 | 0x56 KP_Left 76 | 0x57 KP_Begin 77 | 0x58 KP_Right 78 | 0x59 KP_Home 79 | 0x5B KP_Up 80 | 0x5C KP_Page_Up 81 | 0x60 F5 82 | 0x61 F6 83 | 0x62 F7 84 | 0x63 F3 85 | 0x64 F8 86 | 0x65 F9 87 | 0x67 F11 88 | 0x69 F13 89 | 0x6B F14 90 | 0x6D F10 91 | 0x6F F12 92 | 0x71 F15 93 | 0x72 Insert 94 | 0x73 Home 95 | 0x74 Page_Up 96 | 0x75 Delete 97 | 0x76 F4 98 | 0x77 End 99 | 0x78 F2 100 | 0x79 Page_Down 101 | 0x7A F1 102 | 0x7B Left 103 | 0x7C Right 104 | 0x7D Down 105 | 0x7E Up 106 | 0x7F Power 107 | -------------------------------------------------------------------------------- /android/src/org/lxdream/Dreamcast.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Main Lxdream activity 5 | * 6 | * Copyright (c) 2011 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | package org.lxdream; 20 | 21 | public class Dreamcast { 22 | 23 | static { 24 | System.loadLibrary("lxdream"); 25 | } 26 | 27 | /* Core emulation */ 28 | public static native void init( String appHome ); 29 | public static native void run(); 30 | public static native void stop(); 31 | public static native void reset(); 32 | public static native void toggleRun(); 33 | public static native boolean isRunnable(); 34 | public static native boolean isRunning(); 35 | 36 | /* GD-Rom */ 37 | public static native boolean mount( String filename ); 38 | public static native void unmount(); 39 | 40 | 41 | /* Save state management */ 42 | /* public static native boolean saveState( String filename ); 43 | public static native boolean loadState( String filename ); 44 | public static native boolean quickSave(); 45 | public static native boolean quickLoad(); 46 | public static native void setQuickState(int state); 47 | */ 48 | } 49 | -------------------------------------------------------------------------------- /src/xlat/disasm/dis-init.c: -------------------------------------------------------------------------------- 1 | /* Initialize "struct disassemble_info". 2 | 3 | Copyright 2003 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License as 7 | published by the Free Software Foundation; either version 2 of the 8 | License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but 11 | WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | 02111-1307, USA. */ 19 | 20 | #include "xlat/disasm/sysdep.h" 21 | #include "xlat/disasm/dis-asm.h" 22 | #include "xlat/disasm/bfd.h" 23 | 24 | void 25 | init_disassemble_info (struct disassemble_info *info, void *stream, 26 | fprintf_ftype fprintf_func) 27 | { 28 | memset (info, 0, sizeof (*info)); 29 | 30 | info->flavour = bfd_target_unknown_flavour; 31 | info->arch = bfd_arch_unknown; 32 | info->endian = BFD_ENDIAN_UNKNOWN; 33 | info->octets_per_byte = 1; 34 | info->fprintf_func = fprintf_func; 35 | info->stream = stream; 36 | info->read_memory_func = buffer_read_memory; 37 | info->memory_error_func = perror_memory; 38 | info->print_address_func = generic_print_address; 39 | info->symbol_at_address_func = generic_symbol_at_address; 40 | info->symbol_is_valid = generic_symbol_is_valid; 41 | info->display_endian = BFD_ENDIAN_UNKNOWN; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /test/sh4/utlb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * UTLB unit test support 5 | * 6 | * Copyright (c) 2006 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include <../lib.h> 20 | 21 | #ifndef TEST_UTLB 22 | #define TEST_UTLB 1 23 | 24 | #define TLB_VALID 0x00000100 25 | #define TLB_USERMODE 0x00000040 26 | #define TLB_WRITABLE 0x00000020 27 | #define TLB_USERWRITABLE (TLB_WRITABLE|TLB_USERMODE) 28 | #define TLB_SIZE_MASK 0x00000090 29 | #define TLB_SIZE_1K 0x00000000 30 | #define TLB_SIZE_4K 0x00000010 31 | #define TLB_SIZE_64K 0x00000080 32 | #define TLB_SIZE_1M 0x00000090 33 | #define TLB_CACHEABLE 0x00000008 34 | #define TLB_DIRTY 0x00000004 35 | #define TLB_SHARE 0x00000002 36 | #define TLB_WRITETHRU 0x00000001 37 | 38 | void set_tlb_enabled( int flag ); 39 | void invalidate_tlb(); 40 | void set_sv_enabled( int flag ); 41 | void set_storequeue_protected( int flag ); 42 | void set_asid( int asid ); 43 | void load_utlb_entry( int entryNo, uint32_t vpn, uint32_t ppn, int asid, uint32_t mode ); 44 | 45 | #define ACCESS_OK 0 46 | #define ACCESS_READONLY 1 47 | #define ACCESS_PRIVONLY 2 48 | #define ACCESS_USERMISS 4 49 | void check_utlb_access( uint32_t addr, uint32_t direct_addr, int mode ); 50 | 51 | #endif /* !TEST_UTLB */ 52 | -------------------------------------------------------------------------------- /test/asic.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #define EVENT_PVR_RENDER_DONE 2 5 | #define EVENT_SCANLINE1 3 6 | #define EVENT_SCANLINE2 4 7 | #define EVENT_RETRACE 5 8 | #define EVENT_PVR_UNK 6 9 | #define EVENT_PVR_OPAQUE_DONE 7 10 | #define EVENT_PVR_OPAQUEMOD_DONE 8 11 | #define EVENT_PVR_TRANS_DONE 9 12 | #define EVENT_PVR_TRANSMOD_DONE 10 13 | #define EVENT_MAPLE_DMA 12 14 | #define EVENT_MAPLE_ERR 13 /* ??? */ 15 | #define EVENT_IDE_DMA 14 16 | #define EVENT_G2_DMA0 15 17 | #define EVENT_G2_DMA1 16 18 | #define EVENT_G2_DMA2 17 19 | #define EVENT_G2_DMA3 18 20 | #define EVENT_PVR_DMA 19 21 | #define EVENT_SORT_DMA 20 22 | #define EVENT_PVR_PUNCHOUT_DONE 21 23 | 24 | #define EVENT_TA_ERROR 31 25 | #define EVENT_IDE 32 26 | #define EVENT_AICA 33 27 | 28 | #define EVENT_PVR_PRIM_ALLOC_FAIL 66 29 | #define EVENT_PVR_MATRIX_ALLOC_FAIL 67 30 | #define EVENT_PVR_BAD_INPUT 68 31 | 32 | #define EVENT_SORT_DMA_ERR 92 33 | 34 | /** 35 | * Wait for an ASIC event. 36 | * @return 0 if the event occurred, otherwise -1 if the wait timed out. 37 | */ 38 | int asic_wait( int event ); 39 | 40 | /** 41 | * Wait for either of a pair of events. 42 | * @return the event ID of the event that occured, or -1 if the wait timed out 43 | */ 44 | int asic_wait2( int event1, int event2 ); 45 | 46 | /** 47 | * Check if an ASIC event is active (does not wait) 48 | * @return 0 if inactive, nonzero if active. 49 | */ 50 | int asic_check( int event ); 51 | 52 | /** 53 | * Clear all asic events 54 | */ 55 | void asic_clear(); 56 | 57 | /** 58 | * Print the contents of the ASIC event registers to the supplied FILE 59 | */ 60 | void asic_dump( FILE *f ); 61 | 62 | void asic_mask_all(); 63 | 64 | /** 65 | * Wait until the G2 FIFO buffer is clear to write 66 | */ 67 | int g2_fifo_wait(); 68 | -------------------------------------------------------------------------------- /test/timer.c: -------------------------------------------------------------------------------- 1 | #include "lib.h" 2 | #define TMU_CHANNEL 2 3 | #define BASE_TICKS_PER_US 200 4 | #define CLOCK_DIVIDER 16 5 | #define TOCR 0xFFD80000 /* Output control register */ 6 | #define TSTR 0xFFD80004 /* Start register */ 7 | #define TCOR(c) (0xFFD80008 + (c*12)) /* Constant register */ 8 | #define TCNT(c) (0xFFD8000C + (c*12)) /* Count register */ 9 | #define TCR(c) (0xFFD80010 + (c*12)) /* Control register */ 10 | 11 | /** 12 | * Initialize the on-chip timer controller. We snag TMU channel 2 in its 13 | * highest resolution mode, and start it counting down from max_int. 14 | */ 15 | void timer_init() { 16 | unsigned int val = byte_read(TSTR); 17 | byte_write( TSTR, val & (~(1<name ); 27 | for( i=0; cpu->regs_info[i].name != NULL; i++ ) { 28 | void *value = cpu->get_register(i); 29 | if( value != NULL ) { 30 | column++; 31 | switch( cpu->regs_info[i].type ) { 32 | case REG_TYPE_INT: 33 | fprintf( f, "%5s: %08x ", cpu->regs_info[i].name, *(uint32_t *)value ); 34 | break; 35 | case REG_TYPE_FLOAT: 36 | fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, (double)*(float *)value ); 37 | break; 38 | case REG_TYPE_DOUBLE: 39 | fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, *(double *)value ); 40 | break; 41 | case REG_TYPE_NONE: 42 | column = 4; 43 | } 44 | } 45 | if( column == 4 ) { 46 | fprintf( f, "\n" ); 47 | column = 0; 48 | } 49 | } 50 | if( column != 0 ) { 51 | fprintf( f, "\n" ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /test/sh4/andi.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test AND #imm, R0 operation 5 | ! Test AND #imm, @(r0,GBR) 6 | 7 | .global _test_andi 8 | _test_andi: 9 | start_test 10 | 11 | test_andi_1: ! test and ff, 0 12 | add #1, r12 13 | xor r0, r0 14 | xor r1, r1 15 | and #255, r0 16 | cmp/eq r0, r1 17 | bt test_andi_2 18 | fail test_andi_str_k 19 | 20 | test_andi_2: ! test 0-extend 21 | add #1, r12 22 | mov.l test_andi_2_op1, r0 23 | and #255, r0 24 | mov.l test_andi_2_result, r4 25 | cmp/eq r0, r4 26 | bt test_andi_3 27 | fail test_andi_str_k 28 | bra test_andi_3 29 | nop 30 | 31 | test_andi_2_op1: 32 | .long 0x98765432 33 | test_andi_2_result: 34 | .long 0x00000032 35 | 36 | test_andi_3: ! Test single-bit AND 37 | add #1, r12 38 | mov.l test_andi_3_op1, r0 39 | and #128, r0 40 | mov.l test_andi_3_result, r3 41 | cmp/eq r0, r3 42 | bt test_andi_4 43 | fail test_andi_str_k 44 | bra test_andi_4 45 | nop 46 | test_andi_3_op1: 47 | .long 0x123456AB 48 | test_andi_3_result: 49 | .long 0x00000080 50 | 51 | test_andi_4: ! Test GBR version 52 | add #1, r12 53 | stc gbr, r4 54 | mov.l test_andi_4_gbr, r0 55 | ldc r0, gbr 56 | mov.l test_andi_4_op1, r0 57 | and.b #254, @(r0,gbr) 58 | add #1, r0 59 | and.b #67, @(r0,gbr) 60 | add #2, r0 61 | and.b #227, @(r0,gbr) 62 | ldc r4, gbr 63 | mov.l test_andi_4_output, r1 64 | mov.l test_andi_4_result, r2 65 | cmp/eq r1, r2 66 | bt test_andi_5 67 | fail test_andi_str_k 68 | bra test_andi_5 69 | nop 70 | test_andi_4_gbr: 71 | .long test_andi_4_gbr 72 | test_andi_4_op1: 73 | .long 0x00000008 74 | test_andi_4_output: 75 | .long 0x123456AB 76 | test_andi_4_result: 77 | .long 0x023442AA 78 | 79 | test_andi_5: 80 | test_andi_end: 81 | end_test test_andi_str_k 82 | 83 | test_andi_str: 84 | .string "ANDi" 85 | 86 | .align 4 87 | test_andi_str_k: 88 | .long test_andi_str 89 | -------------------------------------------------------------------------------- /src/drivers/video_glx.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Parent for all glx-based display drivers. 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_video_glx_H 20 | #define lxdream_video_glx_H 1 21 | 22 | #include "X11/Xlib.h" 23 | #include "display.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * Initialize GLX support. Detect capabilities, visuals, etc. 31 | * Must be called before any other GLX functions 32 | */ 33 | gboolean video_glx_init( Display *display, int screen ); 34 | 35 | /** 36 | * Return the prefered visual to be used for the GL window. 37 | * (Not using this for the render window may cause init context 38 | * to fail). 39 | */ 40 | XVisualInfo *video_glx_get_visual(); 41 | 42 | /** 43 | * Initialize the GLX context and bind to the specified window. 44 | * (which should have been created with the visual returned above). 45 | */ 46 | gboolean video_glx_init_context( Display *display, Window window ); 47 | 48 | /** 49 | * Initialize the display driver by setting the appropriate methods 50 | * for GLX support 51 | */ 52 | gboolean video_glx_init_driver( display_driver_t driver ); 53 | 54 | /** 55 | * Shutdown GLX support and release all resources. 56 | */ 57 | void video_glx_shutdown(); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /test/include/sys/stat-dj.h: -------------------------------------------------------------------------------- 1 | /* This is file STAT.H */ 2 | /* 3 | ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 4 | ** 5 | ** This file is distributed under the terms listed in the document 6 | ** "copying.dj", available from DJ Delorie at the address above. 7 | ** A copy of "copying.dj" should accompany this file; if not, a copy 8 | ** should be available from where this file was obtained. This file 9 | ** may not be distributed without a verbatim copy of "copying.dj". 10 | ** 11 | ** This file is distributed WITHOUT ANY WARRANTY; without even the implied 12 | ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | */ 14 | 15 | #ifndef _STAT_H_ 16 | #define _STAT_H_ 17 | 18 | struct stat { 19 | short st_dev; 20 | short st_ino; 21 | unsigned short st_mode; 22 | short st_nlink; 23 | short st_uid; 24 | short st_gid; 25 | short st_rdev; 26 | short st_align_for_word32; 27 | long st_size; 28 | long st_atime; 29 | long st_mtime; 30 | long st_ctime; 31 | long st_blksize; 32 | }; 33 | 34 | #define S_IFMT 0xF000 /* file type mask */ 35 | #define S_IFDIR 0x4000 /* directory */ 36 | #define S_IFIFO 0x1000 /* FIFO special */ 37 | #define S_IFCHR 0x2000 /* character special */ 38 | #define S_IFBLK 0x3000 /* block special */ 39 | #define S_IFREG 0x8000 /* or just 0x0000, regular */ 40 | #define S_IREAD 0x0100 /* owner may read */ 41 | #define S_IWRITE 0x0080 /* owner may write */ 42 | #define S_IEXEC 0x0040 /* owner may execute */ 43 | 44 | #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 45 | #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 46 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 47 | #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 48 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | int stat(const char *, struct stat *); 54 | int fstat(int, struct stat *); 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /debian/manpage.1.ex: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .\" First parameter, NAME, should be all caps 3 | .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection 4 | .\" other parameters are allowed: see man(7), man(1) 5 | .TH LXDREAM SECTION "November 15, 2007" 6 | .\" Please adjust this date whenever revising the manpage. 7 | .\" 8 | .\" Some roff macros, for reference: 9 | .\" .nh disable hyphenation 10 | .\" .hy enable hyphenation 11 | .\" .ad l left justify 12 | .\" .ad b justify to both left and right margins 13 | .\" .nf disable filling 14 | .\" .fi enable filling 15 | .\" .br insert line break 16 | .\" .sp insert n+1 empty lines 17 | .\" for manpage-specific macros, see man(7) 18 | .SH NAME 19 | lxdream \- program to do something 20 | .SH SYNOPSIS 21 | .B lxdream 22 | .RI [ options ] " files" ... 23 | .br 24 | .B bar 25 | .RI [ options ] " files" ... 26 | .SH DESCRIPTION 27 | This manual page documents briefly the 28 | .B lxdream 29 | and 30 | .B bar 31 | commands. 32 | .PP 33 | .\" TeX users may be more comfortable with the \fB\fP and 34 | .\" \fI\fP escape sequences to invode bold face and italics, 35 | .\" respectively. 36 | \fBlxdream\fP is a program that... 37 | .SH OPTIONS 38 | These programs follow the usual GNU command line syntax, with long 39 | options starting with two dashes (`-'). 40 | A summary of options is included below. 41 | For a complete description, see the Info files. 42 | .TP 43 | .B \-h, \-\-help 44 | Show summary of options. 45 | .TP 46 | .B \-v, \-\-version 47 | Show version of program. 48 | .SH SEE ALSO 49 | .BR bar (1), 50 | .BR baz (1). 51 | .br 52 | The programs are documented fully by 53 | .IR "The Rise and Fall of a Fooish Bar" , 54 | available via the Info system. 55 | .SH AUTHOR 56 | lxdream was written by . 57 | .PP 58 | This manual page was written by Nathan Keynes , 59 | for the Debian project (but may be used by others). 60 | -------------------------------------------------------------------------------- /test/lib.c: -------------------------------------------------------------------------------- 1 | #include "lib.h" 2 | 3 | void fwrite_dump( FILE *f, char *buf, int length) 4 | { 5 | int i,j; 6 | for( i=0; i>8)&0xFF, (val>>16)&0xFF, (val>>24)&0xFF ); 11 | } 12 | for( ;j<16; j+= 4 ) { 13 | fprintf( f, " " ); 14 | } 15 | for( j=0; j<16 && i+j < length; j++ ) { 16 | fprintf( f, "%c", isprint(buf[i+j]) ? buf[i+j] : '.' ); 17 | } 18 | fprintf( f, "\n"); 19 | } 20 | } 21 | 22 | void fwrite_diff( FILE *f, char *a, int a_length, char *b, int b_length ) 23 | { 24 | int i; 25 | fprintf( f, "Expected %d bytes:\n", a_length ); 26 | fwrite_dump( f, a, a_length ); 27 | fprintf( f, "but was %d bytes =>\n", b_length ); 28 | fwrite_dump( f, b, b_length ); 29 | } 30 | 31 | void fwrite_diff32( FILE *f, char *a, int a_length, char *b, int b_length ) 32 | { 33 | int i,j, k; 34 | int length = a_length > b_length ? a_length : b_length; 35 | fprintf( f, "Expected %d bytes, was %d bytes =>\n", a_length, b_length ); 36 | 37 | for( i=0; i= a_length || i+k >= b_length || 40 | *((volatile unsigned int *)(a+i+k)) != *((volatile unsigned int *)(b+i+k)) ) { 41 | break; 42 | } 43 | } 44 | if( k != 32 && i+k != length ) { 45 | fprintf( f, "%08X: ", i ); 46 | for( j=0; j<16 && i+j < a_length; j+=4 ) { 47 | fprintf( f, "%08X ", *((volatile unsigned int *)(a+i+j)) ); 48 | } 49 | 50 | for(; j<16; j+=4 ) { 51 | fprintf( f, " " ); 52 | } 53 | 54 | fprintf( f, "| " ); 55 | for( j=0; j<16 && i+j < b_length; j+=4 ) { 56 | fprintf( f, "%08X ", *((volatile unsigned int *)(b+i+j)) ); 57 | } 58 | 59 | fprintf( f, "\n"); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/xlat/xlatdasm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Wrapper around i386-dis to supply the same behaviour as the other 5 | * disassembly functions. 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #include 21 | #include "cpu.h" 22 | #include "mem.h" 23 | extern const struct cpu_desc_struct xlat_cpu_desc; 24 | 25 | typedef struct xlat_symbol { 26 | const char *name; 27 | void *ptr; 28 | } xlat_symbol; 29 | 30 | 31 | 32 | /** 33 | * Dump the disassembly of the specified code block to a stream 34 | * (primarily for debugging purposes) 35 | * @param out The stream to write the output to 36 | * @param code a translated block 37 | */ 38 | void xlat_disasm_block( FILE *out, void *code ); 39 | 40 | /** 41 | * Disassemble one host instruction 42 | * @param pc Instruction to disassemble 43 | * @param buf buffer to hold the disassembled instruction 44 | * @param len sizeof buf 45 | * @param opcode buffer to hold the raw opcodes for the instruction (must be at least 46 | * 3 * maximum number of instruction bytes) 47 | * @return next pc after the current instruction 48 | */ 49 | uintptr_t xlat_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode ); 50 | 51 | void xlat_disasm_region( FILE *out, void *block, uint32_t len ); 52 | void xlat_disasm_init( xlat_symbol *symtab, int num_symbols ); 53 | uintptr_t xlat_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode ); 54 | 55 | void xlat_print_symbolic_operand( char *buf, int hex, uintptr_t disp ); 56 | -------------------------------------------------------------------------------- /test/sh4/bsr.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | 5 | .global _test_bsr 6 | _test_bsr: 7 | start_test 8 | mov.l r11, @-r15 9 | 10 | test_bsr_1: ! Ordinary case 11 | add #1, r12 12 | sts pr, r11 13 | mova test_bsr_1_fail, r0 14 | mov r0, r5 15 | xor r1, r1 16 | bsr test_bsr_1_target 17 | add #1, r1 18 | test_bsr_1_fail: 19 | fail test_bsr_str_k 20 | bra test_bsr_2 21 | nop 22 | test_bsr_1_target: 23 | sts pr, r3 24 | cmp/eq r5,r3 25 | bf test_bsr_1_fail 26 | mov #1, r2 27 | cmp/eq r1, r2 28 | bf test_bsr_1_fail 29 | 30 | test_bsr_2: ! Write PR in delay slot 31 | add #1, r12 32 | 33 | bsr test_bsr_2_target 34 | lds r11, pr 35 | test_bsr_2_fail: 36 | fail test_bsr_str_k 37 | bra test_bsr_3 38 | nop 39 | test_bsr_2_target: 40 | sts pr, r4 41 | cmp/eq r4,r11 42 | bf test_bsr_2_fail 43 | 44 | test_bsr_3: ! Read PR in delay slot 45 | add #1, r12 46 | 47 | mova test_bsr_3_fail, r0 48 | mov r0, r5 49 | bsr test_bsr_3_target 50 | sts pr, r2 51 | test_bsr_3_fail: 52 | fail test_bsr_str_k 53 | bra test_bsr_4 54 | test_bsr_3_target: 55 | cmp/eq r2, r5 56 | bf test_bsr_3_fail 57 | sts pr, r3 58 | cmp/eq r3, r5 59 | bf test_bsr_3_fail 60 | 61 | test_bsr_4: ! Exception in delay slot 62 | add #1, r12 63 | 64 | mova test_bsr_4_fail, r0 65 | add #1, r0 66 | expect_exc 0x000001A0 67 | mova test_bsr_4_rte, r0 68 | mov r0, r11 69 | test_bsr_4_fault_pc: 70 | bsr test_bsr_4_fail 71 | bt test_bsr_4_rte 72 | test_bsr_4_rte: 73 | sts pr, r1 74 | cmp/eq r1, r11 75 | bf test_bsr_4_fail 76 | assert_exc_caught test_bsr_str_k test_bsr_4_fault_pc 77 | bra test_bsr_5 78 | nop 79 | test_bsr_4_fail: 80 | fail test_bsr_str_k 81 | 82 | test_bsr_5: 83 | 84 | test_bsr_end: 85 | mov.l @r15+, r11 86 | end_test test_bsr_str_k 87 | 88 | ! Branch point used for tests that should never be reached (under correct 89 | ! operation. Returns immediately, which should hit the "no exception" test 90 | test_bsr_fail: 91 | rts 92 | nop 93 | 94 | test_bsr_str_k: 95 | .long test_bsr_str 96 | test_bsr_str: 97 | .string "BSR" 98 | 99 | -------------------------------------------------------------------------------- /STATUS: -------------------------------------------------------------------------------- 1 | Current status 2 | ============== 3 | 4 | General issues 5 | - Slow 6 | - No I/O timing whatsoever except for video events. 7 | (ie DMA, rendering, GD-Rom operations need to take > 0 ms to complete) 8 | 9 | SH4 Core 10 | + Base instruction set 11 | - no FPU exceptions 12 | - Not remotely cycle-correct timing 13 | 14 | SH4 On-chip peripherals 15 | BSC 16 | * Not implemented except for PCTRA/PDTRA, and that part is quite dodgy. 17 | CPG 18 | * Complete? 19 | DMAC 20 | * Implemented to extent needed by ASIC DMA, not fully complete 21 | INTC 22 | * Complete? 23 | RTC 24 | * Not implemented 25 | SCI 26 | * Not implemented (not even hooked up in the hardware?) 27 | SCIF 28 | * Complete? (not heavily tested) 29 | TMU 30 | * Complete? 31 | UBC 32 | * Not implemented 33 | 34 | AICA SPU 35 | ARM core 36 | + Base instruction set (Complete?) 37 | - No thumb support 38 | - No system coprocessor support 39 | - No cycle-correct timing 40 | DSP 41 | + Basic sound generation 42 | - Really bad sound 43 | - No waveform support 44 | - No LFO support 45 | 46 | PVR2 GPU 47 | TA 48 | - Functionally complete 49 | - Some bugs/error behaviour not implemented 50 | - No timing support 51 | Render 52 | + Basic opaque and translucent polygon support 53 | + Depth buffer, alpha blend, most poly modes 54 | + Opaque shadow volumes 55 | - Basic translucent poly sorting 56 | - Y-scaler 57 | - No modifier volumes 58 | Texture 59 | + All texture formats supported except bump maps 60 | 61 | GD-Rom 62 | IDE interface 63 | + Supports Ident, Set feature, and Packet (and no other IDE commands) 64 | + Supports PIO and DMA modes 65 | GD-Rom interface 66 | + Supports Test ready, Ident, Read TOC, Read Session info, Sense request, and Read CD 67 | commands 68 | - other 20-odd commands not supported 69 | 70 | Maple 71 | + Maple bus complete? 72 | + Standard DC controllers 73 | - No dynamic timing 74 | 75 | Network 76 | - Not implemented 77 | -------------------------------------------------------------------------------- /src/xlat/disasm/symcat.h: -------------------------------------------------------------------------------- 1 | /* Symbol concatenation utilities. 2 | 3 | Copyright (C) 1998, 2000 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 18 | 19 | #ifndef SYM_CAT_H 20 | #define SYM_CAT_H 21 | 22 | #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 23 | #define CONCAT2(a,b) a##b 24 | #define CONCAT3(a,b,c) a##b##c 25 | #define CONCAT4(a,b,c,d) a##b##c##d 26 | #define STRINGX(s) #s 27 | #else 28 | /* Note one should never pass extra whitespace to the CONCATn macros, 29 | e.g. CONCAT2(foo, bar) because traditonal C will keep the space between 30 | the two labels instead of concatenating them. Instead, make sure to 31 | write CONCAT2(foo,bar). */ 32 | #define CONCAT2(a,b) a/**/b 33 | #define CONCAT3(a,b,c) a/**/b/**/c 34 | #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d 35 | #define STRINGX(s) "s" 36 | #endif 37 | 38 | #define XCONCAT2(a,b) CONCAT2(a,b) 39 | #define XCONCAT3(a,b,c) CONCAT3(a,b,c) 40 | #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) 41 | 42 | /* Note the layer of indirection here is typically used to allow 43 | stringification of the expansion of macros. I.e. "#define foo 44 | bar", "XSTRING(foo)", to yield "bar". Be aware that this only 45 | works for __STDC__, not for traditional C which will still resolve 46 | to "foo". */ 47 | #define XSTRING(s) STRINGX(s) 48 | 49 | #endif /* SYM_CAT_H */ 50 | -------------------------------------------------------------------------------- /test/include/_ansi.h: -------------------------------------------------------------------------------- 1 | /* Provide support for both ANSI and non-ANSI environments. */ 2 | 3 | /* Some ANSI environments are "broken" in the sense that __STDC__ cannot be 4 | relied upon to have it's intended meaning. Therefore we must use our own 5 | concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib 6 | sources! 7 | 8 | To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will 9 | "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header 10 | files aren't affected). */ 11 | 12 | #ifndef _ANSIDECL_H_ 13 | #define _ANSIDECL_H_ 14 | 15 | #include 16 | 17 | /* First try to figure out whether we really are in an ANSI C environment. */ 18 | /* FIXME: This probably needs some work. Perhaps sys/config.h can be 19 | prevailed upon to give us a clue. */ 20 | 21 | #ifdef __STDC__ 22 | #define _HAVE_STDC 23 | #endif 24 | 25 | #ifdef _HAVE_STDC 26 | #define _PTR void * 27 | #define _AND , 28 | #define _NOARGS void 29 | #define _CONST const 30 | #define _VOLATILE volatile 31 | #define _SIGNED signed 32 | #define _DOTS , ... 33 | #define _VOID void 34 | #define _EXFUN(name, proto) name proto 35 | #define _DEFUN(name, arglist, args) name(args) 36 | #define _DEFUN_VOID(name) name(_NOARGS) 37 | #define _CAST_VOID (void) 38 | #ifndef _LONG_DOUBLE 39 | #define _LONG_DOUBLE long double 40 | #endif 41 | #ifndef _PARAMS 42 | #define _PARAMS(paramlist) paramlist 43 | #endif 44 | #else 45 | #define _PTR char * 46 | #define _AND ; 47 | #define _NOARGS 48 | #define _CONST 49 | #define _VOLATILE 50 | #define _SIGNED 51 | #define _DOTS 52 | #define _VOID void 53 | #define _EXFUN(name, proto) name() 54 | #define _DEFUN(name, arglist, args) name arglist args; 55 | #define _DEFUN_VOID(name) name() 56 | #define _CAST_VOID 57 | #define _LONG_DOUBLE double 58 | #ifndef _PARAMS 59 | #define _PARAMS(paramlist) () 60 | #endif 61 | #endif 62 | 63 | /* Support gcc's __attribute__ facility. */ 64 | 65 | #ifdef __GNUC__ 66 | #define _ATTRIBUTE(attrs) __attribute__ (attrs) 67 | #else 68 | #define _ATTRIBUTE(attrs) 69 | #endif 70 | 71 | #endif /* _ANSIDECL_H_ */ 72 | -------------------------------------------------------------------------------- /test/randmath.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef unsigned char u8; 5 | typedef signed char i8; 6 | typedef unsigned short u16; 7 | typedef signed short i16; 8 | typedef unsigned int u32; 9 | typedef signed int i32; 10 | typedef unsigned long long u64; 11 | typedef signed long long i64; 12 | 13 | #define TEST_REPS 64 14 | 15 | void printu8(u8 a) { printf( "%08X ", (unsigned int)a ); } 16 | void printi8(i8 a) { printf( "%08X ", (unsigned int)(u8)a ); } 17 | void printu16(u16 a) { printf( "%08X ", (unsigned int)a ); } 18 | void printi16(i16 a) { printf( "%08X ", (unsigned int)(u16)a ); } 19 | void printu32(u32 a) { printf( "%08X ", (unsigned int)a ); } 20 | void printi32(i32 a) { printf( "%08X ", (unsigned int)a ); } 21 | void printu64(u64 a) { printf( "%08X%08X ", (unsigned int)(a>>32),(unsigned int)a ); } 22 | void printi64(i64 a) { printf( "%08X%08X ", (unsigned int)(a>>32),(unsigned int)a ); } 23 | 24 | #define TEST_TYPE(T) \ 25 | void test##T() { \ 26 | T a, b, c, d, e, f; \ 27 | read(0,&a,sizeof(a)); read(0,&b,sizeof(b)); read(0,&c,sizeof(c)); read(0,&d,sizeof(d)); \ 28 | e = a * b - c * d;\ 29 | if( b != 0 && c != 0 ) { f = a / b + 1/c; }\ 30 | T g = e - f / 2 + (u32)b;\ 31 | T h = b * c / d; T i = a / -d; \ 32 | printf( "%d| ", (int)sizeof(a) ); \ 33 | print##T(a); print##T(b); print##T(c); print##T(d); \ 34 | printf( ": " ); print##T(e); print##T(f); print##T(g); \ 35 | print##T(h); print##T(i); \ 36 | printf( "\n" ); \ 37 | } 38 | 39 | TEST_TYPE(u8); 40 | TEST_TYPE(i8); 41 | TEST_TYPE(u16); 42 | TEST_TYPE(i16); 43 | TEST_TYPE(u32); 44 | TEST_TYPE(i32); 45 | TEST_TYPE(u64); 46 | TEST_TYPE(i64); 47 | 48 | int main(int argc, char *argv[]) { 49 | unsigned i; 50 | 51 | for(i=0;i \n"; 6 | } 7 | 8 | my $name = shift(); 9 | my $dckeysymsfile = shift(); 10 | my $keymapfile = shift(); 11 | my $outputfile = shift(); 12 | my %dcsyms = (); 13 | 14 | my %hash = (); 15 | my %rhash = (); 16 | 17 | open(DCKB, "<$dckeysymsfile") || die "Unable to open dckeysym file $dckeysymsfile"; 18 | while() { 19 | if( /^#define\s+DCKB_([^ ]*)/ ) { 20 | $dcsyms{$1} = "DCKB_$1"; 21 | } 22 | } 23 | close DCKB; 24 | 25 | open(KM, "<$keymapfile") || die "Unable to open keymap file $keymapfile"; 26 | while() { 27 | my ($val, $sym) = split /\s+/; 28 | $ival = POSIX::strtol($val,0); 29 | $hash{$ival} = $sym; 30 | $rhash{$sym} = $ival; 31 | } 32 | close KM; 33 | 34 | open(OUT, ">$outputfile") || die "Unable to open output file $outputfile"; 35 | print OUT "/**\n * $name keyboard map autogenerated by genkeymap.pl\n */\n\n"; 36 | print OUT "const gchar *${name}_keysyms_by_keycode[128] = { "; 37 | 38 | for( $i=0; $i < 128; $i++ ) { 39 | if( $i != 0 ) { 40 | print OUT ", "; 41 | } 42 | if( defined($hash{$i}) ) { 43 | print OUT "\"$hash{$i}\""; 44 | } else { 45 | print OUT "NULL"; 46 | } 47 | } 48 | print OUT "};\n\n"; 49 | 50 | print OUT "const uint16_t ${name}_keycode_to_dckeysym[128] = { "; 51 | for( $i=0; $i<128; $i++ ) { 52 | if( $i != 0 ) { 53 | print OUT ", "; 54 | } 55 | if( defined($hash{$i}) && $dcsyms{$hash{$i}} ) { 56 | print OUT $dcsyms{$hash{$i}}; 57 | } else { 58 | print OUT "DCKB_NONE"; 59 | } 60 | } 61 | print OUT "};\n\n"; 62 | 63 | my @keys = sort {uc($a) cmp uc($b)} keys %rhash; 64 | print OUT "#define ${name}_keysym_count " . ($#keys+1) . "\n"; 65 | print OUT "struct ${name}_keymap_struct {\n const gchar *name;\n uint16_t keycode;\n};\n\n"; 66 | print OUT "struct ${name}_keymap_struct ${name}_keysyms[] = { "; 67 | foreach my $keysym (@keys) { 68 | print OUT "{\"$keysym\", $rhash{$keysym} }, "; 69 | } 70 | print OUT "{NULL,-1} };\n\n"; 71 | close OUT; 72 | -------------------------------------------------------------------------------- /src/syscall.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Routines to add hook functions that are callable from the SH4 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include "lxdream.h" 20 | #include "mem.h" 21 | #include "syscall.h" 22 | #include "sh4/sh4.h" 23 | 24 | 25 | struct syscall_hook { 26 | syscall_hook_func_t hook; 27 | sh4addr_t vector; 28 | } syscall_hooks[256]; 29 | 30 | void syscall_add_hook( uint32_t hook_id, syscall_hook_func_t hook ) 31 | { 32 | hook_id &= 0xFF; 33 | if( syscall_hooks[hook_id].hook != NULL ) 34 | WARN( "Overwriting existing hook %02X", hook_id ); 35 | syscall_hooks[hook_id].hook = hook; 36 | syscall_hooks[hook_id].vector = 0; 37 | } 38 | 39 | void syscall_add_hook_vector( uint32_t hook_id, uint32_t vector_addr, 40 | syscall_hook_func_t hook ) 41 | { 42 | hook_id &= 0xFF; 43 | syscall_add_hook( hook_id, hook ); 44 | syscall_hooks[hook_id].vector = vector_addr; 45 | mem_write_long( vector_addr, 0xFFFFFF00 + hook_id ); 46 | } 47 | 48 | void syscall_invoke( uint32_t hook_id ) 49 | { 50 | hook_id &= 0xFF; 51 | syscall_hook_func_t hook = syscall_hooks[hook_id].hook; 52 | if( hook == NULL ) { 53 | WARN( "Invoked non-existent hook %02X", hook_id ); 54 | } else { 55 | hook(hook_id); 56 | } 57 | } 58 | 59 | void syscall_repatch_vectors( ) 60 | { 61 | int i; 62 | for( i=0; i<256; i++ ) { 63 | if( syscall_hooks[i].hook != NULL && 64 | syscall_hooks[i].vector != 0 ) { 65 | mem_write_long( syscall_hooks[i].vector, 0xFFFFFF00 + i ); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /test/sh4/undef.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test for undefined/unknown instructions. The only "official" 5 | ! undefined instruction is 0xFFFD, but this tests everything 6 | ! that doesn't match a known instruction pattern. Undefined 7 | ! instructions are expected to raise general-illegal when not 8 | ! in a delay slot, and slot-illegal when in a delay slot. 9 | 10 | .global _test_undefined 11 | _test_undefined: 12 | start_test 13 | 14 | test_undef_1: ! First the official one 15 | add #1, r12 16 | expect_exc 0x00000180 17 | test_undef_1_pc: 18 | .word 0xFFFD 19 | assert_exc_caught test_undef_str_k test_undef_1_pc 20 | 21 | test_undef_1a: ! 0xFFFD with FPU disabled - should still be an 0x180 22 | add #1, r12 23 | stc sr, r0 24 | xor r1, r1 25 | add #32, r1 26 | shll2 r1 27 | shll8 r1 28 | or r0, r1 29 | ldc r1, sr 30 | expect_exc 0x00000180 31 | test_undef_1a_pc: 32 | .word 0xFFFD 33 | assert_exc_caught test_undef_str_k test_undef_1a_pc 34 | stc sr, r0 35 | xor r1, r1 36 | add #32, r1 37 | shll2 r1 38 | shll8 r1 39 | not r1, r1 40 | and r0, r1 41 | ldc r1, sr 42 | bra test_undef_end 43 | nop 44 | ! The following don't actually raise an exception, so skip over for the 45 | ! moment. 46 | 47 | ! Gaps in the STC range (0x0nn2) 48 | test_undef_2: ! 0x52 49 | add #1, r12 50 | expect_exc 0x00000180 51 | test_undef_2_pc: 52 | .word 0x0052 53 | assert_exc_caught test_undef_str_k test_undef_2_pc 54 | 55 | test_undef_3: ! 0x62 56 | add #1, r12 57 | expect_exc 0x00000180 58 | test_undef_3_pc: 59 | .word 0x0062 60 | assert_exc_caught test_undef_str_k test_undef_3_pc 61 | 62 | test_undef_4: ! 0x72 63 | add #1, r12 64 | expect_exc 0x00000180 65 | test_undef_4_pc: 66 | .word 0x0072 67 | assert_exc_caught test_undef_str_k test_undef_4_pc 68 | 69 | ! Test undefined FP instructions w/ and w/o FP disable 70 | test_undef_fpu_1: 71 | add #1, r12 72 | expect_exc 0x00000180 73 | test_undef_fpu_1_pc: 74 | .word 0xF0CD 75 | assert_exc_caught test_undef_str_k test_undef_fpu_1_pc 76 | 77 | test_undef_end: 78 | end_test test_undef_str_k 79 | 80 | test_undef_str_k: 81 | .long test_undef_str 82 | test_undef_str: 83 | .string "UNDEFINED-INSTRUCTION" 84 | -------------------------------------------------------------------------------- /src/bootstrap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * CD Bootstrap header parsing. Mostly for informational purposes. 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | /* 20 | * IP.BIN related code. Ref: http://mc.pp.se/dc/ip0000.bin.html 21 | */ 22 | #ifndef lxdream_bootstrap_H 23 | #define lxdream_bootstrap_H 1 24 | 25 | #include "lxdream.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #define BOOTSTRAP_LOAD_ADDR 0x8C008000 32 | #define BOOTSTRAP_ENTRY_ADDR 0x8c008300 33 | #define BOOTSTRAP_SIZE 32768 34 | #define BOOTSTRAP_MAGIC "SEGA SEGAKATANA SEGA ENTERPRISES" 35 | #define BOOTSTRAP_MAGIC_SIZE 32 36 | 37 | #define BINARY_LOAD_ADDR 0x8C010000 38 | #define BINARY_MAX_SIZE (0x8D000000 - BINARY_LOAD_ADDR) 39 | 40 | /** 41 | * Bootstrap header structure 42 | */ 43 | typedef struct dc_bootstrap_head { 44 | char magic[32]; 45 | char crc[4]; 46 | char padding; /* normally ascii space */ 47 | char gdrom_id[6]; 48 | char disc_no[5]; 49 | char regions[8]; 50 | char peripherals[8]; 51 | char product_id[10]; 52 | char product_ver[6]; 53 | char product_date[16]; 54 | char boot_file[16]; 55 | char vendor_id[16]; 56 | char product_name[128]; 57 | } *dc_bootstrap_head_t; 58 | 59 | /** 60 | * Dump the bootstrap info to the output log for infomational/debugging 61 | * purposes. 62 | */ 63 | void bootstrap_dump(void *data, gboolean detail); 64 | 65 | void bootprogram_scramble( unsigned char *dest, unsigned char *src, size_t length ); 66 | void bootprogram_unscramble( unsigned char *dest, unsigned char *src, size_t length ); 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* !lxdream_bootstrap_H */ 72 | -------------------------------------------------------------------------------- /src/sh4/dmac.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * SH4 onboard DMA controller (DMAC) definitions. 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_dmac_H 20 | #define lxdream_dmac_H 1 21 | 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* External DREQ. Note only used for DMA memory-to-memory - for single 29 | * address transfers the device uses DMAC_get_buffer/DMAC_put_buffer. 30 | */ 31 | #define DMAC_EXTERNAL 0 32 | #define DMAC_SCI_TDE 1 /* SCI Transmit data empty */ 33 | #define DMAC_SCI_RDF 2 /* SCI Receive data full */ 34 | #define DMAC_SCIF_TDE 3 /* SCIF Transmit data empty */ 35 | #define DMAC_SCIF_RDF 4 /* SCIF Receive data full */ 36 | #define DMAC_TMU_ICI 5 /* TMU Input capture interrupt (not used?) */ 37 | 38 | /** 39 | * Trigger a DMAC transfer by asserting one of the above DMA request lines 40 | * (from the onboard peripherals). Actual transfer is dependent on the 41 | * relevant channel configuration. 42 | */ 43 | void DMAC_trigger( int dmac_trigger ); 44 | 45 | /** 46 | * Execute a memory-to-external-device transfer. Copies data into the supplied 47 | * buffer up to a maximum of bytecount bytes. 48 | * @return Actual number of bytes copied. 49 | */ 50 | uint32_t DMAC_get_buffer( int channel, unsigned char *buf, uint32_t bytecount ); 51 | 52 | /** 53 | * execute an external-device-to-memory transfer. Copies data from the 54 | * supplied buffer into memory up to a maximum of bytecount bytes. 55 | * @return Actual number of bytes copied. 56 | */ 57 | uint32_t DMAC_put_buffer( int channel, unsigned char *buf, uint32_t bytecount ); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* !lxdream_dmac_H */ 64 | -------------------------------------------------------------------------------- /src/loader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Interface declarations for the binary loader routines (loader.c, elf.c) 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_loader_H 20 | #define lxdream_loader_H 1 21 | 22 | #include 23 | #include 24 | 25 | #include "drivers/cdrom/cdrom.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * NULL-terminated list of file extension/name pairs, 33 | * supported by the loader 34 | */ 35 | extern char *file_loader_extensions[][2]; 36 | 37 | typedef enum { 38 | FILE_ERROR, 39 | FILE_BINARY, 40 | FILE_ELF, 41 | FILE_ISO, 42 | FILE_DISC, 43 | FILE_ZIP, 44 | FILE_SAVE_STATE, 45 | FILE_UNKNOWN, 46 | } lxdream_file_type_t; 47 | 48 | /** 49 | * Attempt to identify the given file as one of the above file types 50 | */ 51 | lxdream_file_type_t file_identify( const gchar *filename, int fd, ERROR *err ); 52 | 53 | /** 54 | * Load any supported file, and return the type of file loaded. 55 | * If the file is a disc, the disc is mounted. 56 | * 57 | * @param filename The file to load 58 | * @param wrap_exec If true, load executables as disc images. Otherwise load 59 | * directly into RAM 60 | * @param err Updated with error message on failure. 61 | */ 62 | lxdream_file_type_t file_load_magic( const gchar *filename, gboolean wrap_exec, ERROR *err ); 63 | 64 | /** 65 | * Load an ELF or .bin executable file based on magic. 66 | */ 67 | gboolean file_load_exec( const gchar *filename, ERROR *err ); 68 | 69 | cdrom_disc_t cdrom_wrap_magic( cdrom_disc_type_t type, const gchar *filename, ERROR *err ); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif /* !lxdream_loader_H */ 76 | 77 | -------------------------------------------------------------------------------- /test/include/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * time.h 3 | * 4 | * Struct and function declarations for dealing with time. 5 | */ 6 | 7 | #ifndef _TIME_H_ 8 | #define _TIME_H_ 9 | 10 | #include "_ansi.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifndef NULL 17 | #define NULL 0 18 | #endif 19 | 20 | /* Get _CLOCKS_PER_SEC_ */ 21 | #include 22 | 23 | #ifndef _CLOCKS_PER_SEC_ 24 | #define _CLOCKS_PER_SEC_ 1000 25 | #endif 26 | 27 | #define CLOCKS_PER_SEC _CLOCKS_PER_SEC_ 28 | #define CLK_TCK CLOCKS_PER_SEC 29 | #define __need_size_t 30 | #include 31 | 32 | /* Get _CLOCK_T_ and _TIME_T_. */ 33 | #include 34 | 35 | #ifndef __clock_t_defined 36 | typedef _CLOCK_T_ clock_t; 37 | #define __clock_t_defined 38 | #endif 39 | 40 | #ifndef __time_t_defined 41 | typedef _TIME_T_ time_t; 42 | #define __time_t_defined 43 | #endif 44 | 45 | struct tm 46 | { 47 | int tm_sec; 48 | int tm_min; 49 | int tm_hour; 50 | int tm_mday; 51 | int tm_mon; 52 | int tm_year; 53 | int tm_wday; 54 | int tm_yday; 55 | int tm_isdst; 56 | }; 57 | 58 | clock_t _EXFUN(clock, (void)); 59 | double _EXFUN(difftime, (time_t _time2, time_t _time1)); 60 | time_t _EXFUN(mktime, (struct tm *_timeptr)); 61 | time_t _EXFUN(time, (time_t *_timer)); 62 | #ifndef _REENT_ONLY 63 | char *_EXFUN(asctime, (const struct tm *_tblock)); 64 | char *_EXFUN(ctime, (const time_t *_time)); 65 | struct tm *_EXFUN(gmtime, (const time_t *_timer)); 66 | struct tm *_EXFUN(localtime,(const time_t *_timer)); 67 | #endif 68 | size_t _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)); 69 | 70 | char *_EXFUN(asctime_r, (const struct tm *, char *)); 71 | char *_EXFUN(ctime_r, (const time_t *, char *)); 72 | struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); 73 | struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); 74 | 75 | #ifdef __CYGWIN32__ 76 | #ifndef __STRICT_ANSI__ 77 | extern time_t _timezone __declspec(dllimport); 78 | extern int _daylight __declspec(dllimport); 79 | extern char *_tzname[2] __declspec(dllimport); 80 | 81 | char *_EXFUN(timezone, (void)); 82 | void _EXFUN(tzset, (void)); 83 | #endif 84 | #endif /* __CYGWIN32__ */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #endif /* _TIME_H_ */ 90 | 91 | -------------------------------------------------------------------------------- /test/include/ctype.h: -------------------------------------------------------------------------------- 1 | #ifndef _CTYPE_H_ 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | #define _CTYPE_H_ 6 | 7 | #include "_ansi.h" 8 | 9 | int _EXFUN(isalnum, (int __c)); 10 | int _EXFUN(isalpha, (int __c)); 11 | int _EXFUN(iscntrl, (int __c)); 12 | int _EXFUN(isdigit, (int __c)); 13 | int _EXFUN(isgraph, (int __c)); 14 | int _EXFUN(islower, (int __c)); 15 | int _EXFUN(isprint, (int __c)); 16 | int _EXFUN(ispunct, (int __c)); 17 | int _EXFUN(isspace, (int __c)); 18 | int _EXFUN(isupper, (int __c)); 19 | int _EXFUN(isxdigit,(int __c)); 20 | int _EXFUN(tolower, (int __c)); 21 | int _EXFUN(toupper, (int __c)); 22 | 23 | #ifndef __STRICT_ANSI__ 24 | int _EXFUN(isascii, (int __c)); 25 | int _EXFUN(toascii, (int __c)); 26 | int _EXFUN(_tolower, (int __c)); 27 | int _EXFUN(_toupper, (int __c)); 28 | #endif 29 | 30 | #define _U 01 31 | #define _L 02 32 | #define _N 04 33 | #define _S 010 34 | #define _P 020 35 | #define _C 040 36 | #define _X 0100 37 | #define _B 0200 38 | 39 | #if !defined(__CYGWIN32__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB) 40 | extern _CONST char _ctype_[]; 41 | #else 42 | extern _CONST char _ctype_[] __declspec(dllimport); 43 | #endif 44 | 45 | #define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L)) 46 | #define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U) 47 | #define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L) 48 | #define isdigit(c) ((_ctype_+1)[(unsigned)(c)]&_N) 49 | #define isxdigit(c) ((_ctype_+1)[(unsigned)(c)]&(_X|_N)) 50 | #define isspace(c) ((_ctype_+1)[(unsigned)(c)]&_S) 51 | #define ispunct(c) ((_ctype_+1)[(unsigned)(c)]&_P) 52 | #define isalnum(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L|_N)) 53 | #define isprint(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B)) 54 | #define isgraph(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N)) 55 | #define iscntrl(c) ((_ctype_+1)[(unsigned)(c)]&_C) 56 | /* Non-gcc versions will get the library versions, and will be 57 | slightly slower */ 58 | #ifdef __GNUC__ 59 | # define toupper(c) \ 60 | ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) 61 | # define tolower(c) \ 62 | ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) 63 | #endif 64 | 65 | #ifndef __STRICT_ANSI__ 66 | #define isascii(c) ((unsigned)(c)<=0177) 67 | #define toascii(c) ((c)&0177) 68 | #endif 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | #endif /* _CTYPE_H_ */ 74 | -------------------------------------------------------------------------------- /test/sh4/tas.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_tas 5 | _test_tas: 6 | start_test 7 | 8 | test_tas_1: 9 | add #1, r12 10 | 11 | mova test_tas_1_data, r0 ! test with byte == 0 12 | mov r0, r4 13 | mov r4, r5 14 | tas.b @r4 15 | bf test_tas_1_fail 16 | cmp/eq r4, r5 17 | bf test_tas_1_fail 18 | mov #0x40, r1 19 | shll r1 20 | mov.l test_tas_1_data, r3 21 | cmp/eq r1, r3 22 | bt test_tas_2 23 | 24 | test_tas_1_fail: 25 | fail test_tas_str_k 26 | bra test_tas_2 27 | nop 28 | test_tas_1_data: 29 | .long 0x00000000 30 | 31 | test_tas_2: 32 | add #1, r12 33 | 34 | mova test_tas_2_data, r0 ! test with byte == 0x80 35 | mov r0, r4 36 | mov r4, r5 37 | tas.b @r4 ! follow up test with byte == 0x00000080 38 | bt test_tas_2_fail 39 | cmp/eq r4, r5 40 | bf test_tas_2_fail 41 | mov.l @r4, r3 42 | mov #0x40, r1 43 | shll r1 44 | cmp/eq r1, r3 45 | bt test_tas_3 46 | test_tas_2_fail: 47 | fail test_tas_str_k 48 | bra test_tas_3 49 | nop 50 | test_tas_2_data: 51 | .long 0x00000080 52 | 53 | test_tas_3: ! Test with byte = 0x45 (ensure existing bits aren't changed) 54 | add #1, r12 55 | mova test_tas_3_data, r0 56 | mov r0, r4 57 | mov.l test_tas_3_result, r1 58 | mov r4, r5 59 | tas.b @r4 60 | bt test_tas_3_fail 61 | cmp/eq r4,r5 62 | bf test_tas_3_fail 63 | mov.l test_tas_3_data, r3 64 | cmp/eq r1, r3 65 | bt test_tas_4 66 | 67 | test_tas_3_fail: 68 | fail test_tas_str_k 69 | bra test_tas_4 70 | nop 71 | test_tas_3_data: 72 | .long 0x00000045 73 | test_tas_3_result: 74 | .long 0x000000C5 75 | 76 | test_tas_4: ! Test that it's really a byte op 77 | add #1, r12 78 | mova test_tas_4_data, r0 79 | mov r0, r4 80 | mov.l test_tas_4_result, r1 81 | add #1, r4 82 | mov r4, r5 83 | tas.b @r4 84 | bf test_tas_4_fail 85 | cmp/eq r4, r5 86 | mov.l test_tas_4_data, r3 87 | cmp/eq r1, r3 88 | bt test_tas_end 89 | test_tas_4_fail: 90 | fail test_tas_str_k 91 | bra test_tas_end 92 | nop 93 | test_tas_4_data: 94 | .long 0xAB9C00ED 95 | test_tas_4_result: 96 | .long 0xAB9C80ED 97 | 98 | test_tas_end: 99 | end_test test_tas_str_k 100 | 101 | test_tas_str: 102 | .string "TAS" 103 | 104 | .align 4 105 | test_tas_str_k: 106 | .long test_tas_str 107 | -------------------------------------------------------------------------------- /test/include/unctrl.h: -------------------------------------------------------------------------------- 1 | /* From curses.h. */ 2 | /* 3 | * Copyright (c) 1981, 1993 4 | * The Regents of the University of California. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. All advertising materials mentioning features or use of this software 15 | * must display the following acknowledgement: 16 | * This product includes software developed by the University of 17 | * California, Berkeley and its contributors. 18 | * 4. Neither the name of the University nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 | * SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef _UNCTRL_H_ 36 | #define _UNCTRL_H_ 37 | 38 | #include <_ansi.h> 39 | 40 | #define unctrl(c) __unctrl[(c) & 0xff] 41 | #define unctrllen(ch) __unctrllen[(ch) & 0xff] 42 | 43 | extern _CONST char * _CONST __unctrl[256]; /* Control strings. */ 44 | extern _CONST char __unctrllen[256]; /* Control strings length. */ 45 | 46 | #endif /* _UNCTRL_H_ */ 47 | -------------------------------------------------------------------------------- /src/syscall.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Generic syscall support - ability to add hooks into SH4 code to call out 5 | * to the emu. 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | #ifndef lxdream_syscall_H 20 | #define lxdream_syscall_H 1 21 | 22 | #include 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | 30 | typedef void (*syscall_hook_func_t)( uint32_t hook_id ); 31 | 32 | 33 | /** 34 | * Define a new hook without an indirect vector 35 | */ 36 | void syscall_add_hook( uint32_t hook_id, syscall_hook_func_t hook ); 37 | 38 | /** 39 | * Define a new hook which indirects through the specified vector address 40 | * (which must be somewhere in main SH4 ram). 41 | */ 42 | void syscall_add_hook_vector( uint32_t hook_id, uint32_t vector_addr, 43 | syscall_hook_func_t hook ); 44 | 45 | /** 46 | * Invoke a syscall from the SH4 47 | */ 48 | void syscall_invoke( uint32_t hook_id ); 49 | 50 | /** 51 | * Repatch all syscall vectors (eg in case of system reset) 52 | */ 53 | void syscall_repatch_vectors( ); 54 | 55 | /************************ Standard syscall hacks ************************/ 56 | 57 | /** 58 | * Install the BIOS emu hack into ram (sets the vectors at 8C0000B0 through 59 | * 8C0000C0) 60 | */ 61 | void bios_install( void ); 62 | 63 | void bios_boot( uint32_t syscallid ); 64 | 65 | /** 66 | * Install the DCLoad syscall hack 67 | */ 68 | void dcload_install( void ); 69 | 70 | /** 71 | * Set the flag that indicates whether the dcload exit() syscall will be 72 | * honoured by exiting the VM. 73 | */ 74 | void dcload_set_allow_unsafe( gboolean allow ); 75 | 76 | #define IS_SYSCALL(pc) (((uint32_t)pc)>=0xFFFFFF00) 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* !lxdream_syscall_H */ 83 | -------------------------------------------------------------------------------- /Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | dst 13 | 14 | CFBundleTypeIconFile 15 | lxdst.icns 16 | CFBundleTypeName 17 | Lxdream Save State 18 | CFBundleTypeRole 19 | Editor 20 | LSItemContentTypes 21 | 22 | org.lxdream.savestate 23 | 24 | 25 | 26 | CFBundleExecutable 27 | lxdream 28 | CFBundleGetInfoString 29 | @VERSION@, Copyright (C) 2005-2008 Nathan Keynes 30 | CFBundleIconFile 31 | lxdream 32 | CFBundleIdentifier 33 | org.lxdream.lxdream 34 | CFBundleInfoDictionaryVersion 35 | 6.0 36 | CFBundleName 37 | lxdream 38 | CFBundlePackageType 39 | APPL 40 | CFBundleShortVersionString 41 | @VERSION@ 42 | CFBundleSignature 43 | ???? 44 | CFBundleVersion 45 | 1.0 46 | NSMainNibFile 47 | MainMenu 48 | NSPrincipalClass 49 | NSApplication 50 | UTExportedTypeDeclarations 51 | 52 | 53 | UTTypeConformsTo 54 | 55 | public.data 56 | 57 | UTTypeDescription 58 | Lxdream Save State 59 | UTTypeIconFile 60 | lxdst.icns 61 | UTTypeIdentifier 62 | org.lxdream.savestate 63 | UTTypeReferenceURL 64 | http://www.lxdream.org/wiki/ 65 | UTTypeTagSpecification 66 | 67 | public.filename-extension 68 | 69 | dst 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/cocoaui/paths_osx.m: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Cocoa builds need to use different paths from ordinary builds, since 5 | * the message catalogs, default config, etc are all bundle-relative. 6 | * Otherwise paths use the standard unix install paths 7 | * 8 | * Copyright (c) 2008 Nathan Keynes. 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "lxdream.h" 25 | #include "lxpaths.h" 26 | 27 | #include 28 | 29 | static char *bundle_resource_path = NULL; 30 | static char *bundle_plugin_path = NULL; 31 | static char *user_data_path = NULL; 32 | 33 | static char *get_bundle_resource_path() 34 | { 35 | if( bundle_resource_path == NULL ) { 36 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 37 | NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; 38 | bundle_resource_path = strdup([resourcePath UTF8String]); 39 | [pool release]; 40 | } 41 | return bundle_resource_path; 42 | } 43 | 44 | const char *get_sysconf_path() 45 | { 46 | return get_bundle_resource_path(); 47 | } 48 | 49 | const char *get_locale_path() 50 | { 51 | return get_bundle_resource_path(); 52 | } 53 | 54 | const char *get_plugin_path() 55 | { 56 | if( bundle_plugin_path == NULL ) { 57 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 58 | NSString *pluginPath = [[NSBundle mainBundle] builtInPlugInsPath]; 59 | bundle_plugin_path = strdup([pluginPath UTF8String]); 60 | [pool release]; 61 | } 62 | return bundle_plugin_path; 63 | } 64 | 65 | 66 | const char *get_user_data_path() 67 | { 68 | if( user_data_path == NULL ) { 69 | char *home = getenv("HOME"); 70 | user_data_path = g_strdup_printf( "%s/Library/Application Support/Lxdream", home ); 71 | } 72 | return user_data_path; 73 | } -------------------------------------------------------------------------------- /src/drivers/cdrom/isofs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * libisofs adapter 5 | * 6 | * Copyright (c) 2010 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef cdrom_isofs_H 20 | #define cdrom_isofs_H 1 21 | 22 | #include 23 | #include 24 | #include "drivers/cdrom/sector.h" 25 | 26 | /** 27 | * Construct an IsoFilesystem from an existing sector source 28 | */ 29 | IsoImageFilesystem *iso_filesystem_new_from_source( sector_source_t track, cdrom_lba_t start, ERROR *err ); 30 | IsoImageFilesystem *iso_filesystem_new_from_disc( cdrom_disc_t disc, cdrom_lba_t start, ERROR *err ); 31 | IsoImageFilesystem *iso_filesystem_new_from_track( cdrom_disc_t disc, cdrom_track_t track, ERROR *err ); 32 | 33 | 34 | /** 35 | * Convenience function to read an entire IsoFileSource 36 | */ 37 | int iso_source_file_read_all( IsoFileSource *file, unsigned char *buf, size_t max_size ); 38 | 39 | /** 40 | * Construct an IsoImage image from an existing sector source, for use in 41 | * creating a modified image 42 | */ 43 | IsoImage *iso_image_new_from_source( sector_source_t track, cdrom_lba_t start, ERROR *err ); 44 | 45 | /** 46 | * Construct an IsoImage from a cdrom disc and sector position. 47 | * @return a new isofs_reader, or NULL on an error. 48 | */ 49 | IsoImage *iso_image_new_from_disc( cdrom_disc_t disc, cdrom_lba_t start_sector, ERROR *err ); 50 | 51 | IsoImage *iso_image_new_from_track( cdrom_disc_t disc, cdrom_track_t track, ERROR *err ); 52 | 53 | /** 54 | * Construct a sector source from a given IsoImage. 55 | */ 56 | sector_source_t iso_sector_source_new( IsoImage *image, sector_mode_t mode, cdrom_lba_t start_sector, 57 | const char *bootstrap, ERROR *err ); 58 | 59 | 60 | /** Prototypes for "Internal" Libisofs functions */ 61 | int iso_mem_stream_new(unsigned char *buf, size_t size, IsoStream **stream); 62 | 63 | #endif /* !cdrom_isofs_H */ 64 | -------------------------------------------------------------------------------- /src/plugin.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Plugin declarations and support. 5 | * 6 | * Note plugins mainly exist to make binary packagers' lives easier, 7 | * 8 | * Copyright (c) 2009 Nathan Keynes. 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | */ 20 | 21 | #ifndef lxdream_plugin_H 22 | #define lxdream_plugin_H 23 | 24 | #include "lxdream.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | enum plugin_type { 31 | PLUGIN_NONE = 0, 32 | PLUGIN_AUDIO_DRIVER = 1, 33 | PLUGIN_INPUT_DRIVER = 2, 34 | }; 35 | 36 | #define PLUGIN_MIN_TYPE 1 37 | #define PLUGIN_MAX_TYPE PLUGIN_INPUT_DRIVER 38 | 39 | struct plugin_struct { 40 | enum plugin_type type; 41 | const char *name; 42 | const char *version; 43 | 44 | /** 45 | * Plugin registration function, called at load time (dynamic modules) or 46 | * startup (static modules). This should register with the appropriate 47 | * driver list. 48 | * @return TRUE on success, FALSE on failure (although exactly how this 49 | * can fail is unclear). 50 | */ 51 | gboolean (*register_plugin)(void); 52 | }; 53 | 54 | #define CONSTRUCTOR __attribute__((constructor)) 55 | 56 | #ifdef PLUGIN 57 | #define DEFINE_PLUGIN(type,name,fn) struct plugin_struct lxdream_plugin_entry = { type, name, VERSION, fn } 58 | #define AUDIO_DRIVER(name, driver) static gboolean __lxdream_plugin_init(void) { return audio_register_driver(&(driver)); } \ 59 | DEFINE_PLUGIN(PLUGIN_AUDIO_DRIVER, name, __lxdream_plugin_init) 60 | 61 | #else /* !ENABLE_SHARED */ 62 | #define AUDIO_DRIVER(name,driver) static void CONSTRUCTOR __lxdream_static_constructor(void) { audio_register_driver(&(driver)); } 63 | #define DEFINE_PLUGIN(type,name,fn) static void CONSTRUCTOR __lxdream_static_constructor(void) { fn(); } 64 | 65 | #endif /* ENABLE_SHARED */ 66 | 67 | gboolean plugin_init(); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* !lxdream_plugin_H */ 74 | -------------------------------------------------------------------------------- /test/lib-arm/crt0.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .code 32 3 | .align 0 4 | .global start 5 | .global ___exit 6 | .global _atexit 7 | start: 8 | b real_entry 9 | b exception_entry 10 | b exception_entry /* SWI - not used so jump to general exception */ 11 | b exception_entry 12 | b exception_entry 13 | b exception_entry /* Not a vector, but if we ever get here... */ 14 | b irq_entry 15 | b fiq_entry 16 | 17 | /* Start by setting up a stack */ 18 | real_entry: 19 | /* Set up the stack pointer to a fixed value */ 20 | ldr r3, .LC0 21 | mov sp, r3 22 | /* Setup a default stack-limit in-case the code has been 23 | compiled with "-mapcs-stack-check". Hard-wiring this value 24 | is not ideal, since there is currently no support for 25 | checking that the heap and stack have not collided, or that 26 | this default 64k is enough for the program being executed. 27 | However, it ensures that this simple crt0 world will not 28 | immediately cause an overflow event: */ 29 | sub sl, sp, #64 << 10 /* Still assumes 256bytes below sl */ 30 | b .LB0 31 | 32 | .syscall: 33 | .word -1 /* Syscall # */ 34 | .word 0 /* Arguments */ 35 | .word 0 36 | .word 0 37 | 38 | irq_counter: 39 | .word 0 40 | fiq_counter: 41 | .word 0 42 | 43 | .LB0: 44 | /* Zero-out the BSS segment */ 45 | mov a2, #0 /* Second arg: fill value */ 46 | mov fp, a2 /* Null frame pointer */ 47 | mov r7, a2 /* Null frame pointer for Thumb */ 48 | 49 | ldr a1, .LC1 /* First arg: start of memory block */ 50 | ldr a3, .LC2 51 | sub a3, a3, a1 /* Third arg: length of block */ 52 | bl memset 53 | 54 | /* Enter main with no arguments for now */ 55 | mov r0, #0 /* no arguments */ 56 | mov r1, #0 /* no argv either */ 57 | bl main 58 | 59 | bl exit /* Should not return */ 60 | 61 | /* For Thumb, constants must be after the code since only 62 | positive offsets are supported for PC relative addresses. */ 63 | 64 | exception_entry: 65 | mov r13, #-2 66 | str r13, .syscall 67 | .die: 68 | b .die 69 | 70 | irq_entry: 71 | /* Increment IRQ counter and return */ 72 | ldr r13, irq_counter 73 | add r13, r13, #1 74 | str r13, irq_counter 75 | subs r15, r14, #4 76 | fiq_entry: 77 | /* Increment FIQ counter and return */ 78 | ldr r13, fiq_counter 79 | add r13, r13, #1 80 | str r13, fiq_counter 81 | subs r15, r14, #4 82 | 83 | .align 0 84 | .LC0: 85 | .word _stack 86 | .LC1: 87 | .word __bss_start 88 | .LC2: 89 | .word __bss_end 90 | 91 | 92 | -------------------------------------------------------------------------------- /test/sh4/sub.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | 4 | .global _test_sub 5 | _test_sub: 6 | start_test 7 | 8 | test_sub_1: ! test subing 0+0 = 0 9 | add #1, r12 10 | xor r0,r0 11 | xor r1,r1 12 | xor r2,r2 13 | sett 14 | sub r0,r1 15 | bf test_sub_1_fail 16 | cmp/eq r1, r2 17 | bt test_sub_2 18 | test_sub_1_fail: 19 | fail test_sub_str_k 20 | 21 | test_sub_2: ! test 0+ constant 1 = 1 22 | add #1, r12 23 | xor r0, r0 24 | xor r1, r1 25 | mov.l test_sub_2_input, r0 26 | mov.l test_sub_2_result, r2 27 | clrt 28 | sub r0, r1 29 | bt test_sub_2_fail 30 | cmp/eq r1, r2 31 | bt test_sub_3 32 | test_sub_2_fail: 33 | fail test_sub_str_k 34 | bra test_sub_3 35 | nop 36 | 37 | .align 4 38 | test_sub_2_input: 39 | .long 0x00000001 40 | test_sub_2_result: 41 | .long 0xFFFFFFFF 42 | 43 | test_sub_3: ! test 0 + constant -1 = -1 44 | add #1, r12 45 | mov.l test_sub_3_input_1, r0 46 | mov r0, r1 47 | mov.l test_sub_3_input_2, r1 48 | sett 49 | sub r0, r1 50 | bf test_sub_3_fail 51 | mov.l test_sub_3_result, r2 52 | cmp/eq r1, r2 53 | bt test_sub_4 54 | test_sub_3_fail: 55 | fail test_sub_str_k 56 | bra test_sub_4 57 | nop 58 | 59 | .align 4 60 | test_sub_3_input_1: 61 | .long 0xFFFFFF84 62 | test_sub_3_input_2: 63 | .long 0x43217000 64 | test_sub_3_result: 65 | .long 0x4321707C 66 | 67 | test_sub_4: ! Test 0 result 68 | add #1, r12 69 | mov.l test_sub_4_op1, r2 70 | mov.l test_sub_4_op2, r1 71 | mov r2, r3 72 | sub r1, r3 73 | mov.l test_sub_4_result_1, r0 74 | cmp/eq r0, r3 75 | bf test_sub_4_fail 76 | mov r2, r3 77 | sub r3, r1 78 | mov.l test_sub_4_result_2, r2 79 | cmp/eq r1, r2 80 | bt test_sub_5 81 | test_sub_4_fail: 82 | fail test_sub_str_k 83 | bra test_sub_5 84 | nop 85 | test_sub_4_op1: 86 | .long 0x00000001 87 | test_sub_4_op2: 88 | .long 0xFFFFFFFF 89 | test_sub_4_result_1: 90 | .long 0x00000002 91 | test_sub_4_result_2: 92 | .long 0xFFFFFFFE 93 | 94 | test_sub_5: 95 | add #1, r12 96 | mov.l test_sub_5_op, r2 97 | sett 98 | sub r2, r2 99 | bf test_sub_5_fail 100 | tst r2, r2 101 | bt test_sub_end 102 | test_sub_5_fail: 103 | fail test_sub_str_k 104 | bra test_sub_end 105 | nop 106 | 107 | test_sub_5_op: 108 | .long 0xABCD1234 109 | 110 | test_sub_end: 111 | end_test test_sub_str_k 112 | 113 | test_sub_str: 114 | .string "SUB" 115 | 116 | .align 4 117 | test_sub_str_k: 118 | .long test_sub_str 119 | -------------------------------------------------------------------------------- /test/lib/crt0.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .global start 3 | .global ___exit 4 | .global _atexit 5 | start: 6 | mov.l setup_cache_k,r0 7 | mov.l p2_mask,r1 8 | or r1,r0 9 | jmp @r0 10 | nop 11 | setup_cache: 12 | mov.l ccr_addr,r0 13 | mov.w ccr_data,r1 14 | mov.l r1,@r0 15 | mov.l start_2_k,r0 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | nop 23 | jmp @r0 24 | nop 25 | start_2: 26 | mov.l old_stack_k,r14 27 | mov.l r15,@r14 28 | mov.l old_pr_k,r14 29 | sts pr,r15 30 | mov.l r15,@r14 31 | mov.l stack_k,r15 32 | 33 | ! zero out bss 34 | mov.l edata_k,r0 35 | mov.l end_k,r1 36 | mov #0,r2 37 | start_l: 38 | mov.l r2,@r0 39 | add #4,r0 40 | cmp/ge r0,r1 41 | bt start_l 42 | 43 | #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY) 44 | mov.l set_fpscr_k, r1 45 | jsr @r1 46 | mov #0,r4 47 | lds r3,fpscr 48 | #endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */ 49 | 50 | mov.l sr_data, r1 51 | ldc r1, sr 52 | 53 | ! call the mainline 54 | mov.l main_k,r0 55 | jsr @r0 56 | or r0,r0 57 | 58 | ! call exit 59 | mov r0,r4 60 | mov.l exit_k,r0 61 | jsr @r0 62 | or r0,r0 63 | 64 | ___exit: 65 | mov.l old_pr_k,r14 66 | mov.l @r14,r15 67 | lds r15,pr 68 | mov.l old_stack_k,r14 69 | mov.l @r14,r15 70 | rts 71 | nop 72 | 73 | _atexit: 74 | rts 75 | nop 76 | 77 | .align 4 78 | #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) 79 | set_fpscr_k: 80 | .long ___set_fpscr 81 | #endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */ 82 | stack_k: 83 | .long _stack 84 | edata_k: 85 | .long _edata 86 | end_k: 87 | .long _end 88 | main_k: 89 | .long _main 90 | exit_k: 91 | .long _exit 92 | 93 | old_stack_k: 94 | .long _old_stack 95 | old_pr_k: 96 | .long _old_pr 97 | 98 | _old_stack: 99 | .long 0 100 | _old_pr: 101 | .long 0 102 | 103 | setup_cache_k: 104 | .long setup_cache 105 | start_2_k: 106 | .long start_2 107 | p2_mask: 108 | .long 0xa0000000 109 | sr_data: 110 | .long 0x400000f0 111 | ccr_addr: 112 | .long 0xff00001c 113 | ccr_data: 114 | .word 0x090b 115 | 116 | .align 4 117 | 118 | #ifdef __ELF__ 119 | .section .stack,"aw" 120 | #else 121 | .section .stack 122 | #endif 123 | ! _stack: .long 0xdeaddead 124 | 125 | -------------------------------------------------------------------------------- /src/drivers/audio_esd.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * The esd (esound) audio driver 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | #include 19 | #include 20 | #include 21 | #include "aica/audio.h" 22 | #include "dream.h" 23 | 24 | static int esd_handle = -1; 25 | static int esd_sample_size = 1; 26 | 27 | 28 | static gboolean audio_esd_init() 29 | { 30 | int format = DEFAULT_SAMPLE_FORMAT; 31 | int rate = DEFAULT_SAMPLE_RATE; 32 | 33 | if( esd_handle != -1 ) { 34 | esd_close(esd_handle); 35 | } 36 | esd_format_t esd_format = 0; 37 | esd_sample_size = 1; 38 | if( format & AUDIO_FMT_16BIT ) { 39 | esd_format |= ESD_BITS16; 40 | } else esd_format |= ESD_BITS8; 41 | if( format & AUDIO_FMT_STEREO ) { 42 | esd_format |= ESD_STEREO; 43 | } 44 | else esd_format |= ESD_MONO; 45 | 46 | esd_handle = esd_play_stream( esd_format, rate, "localhost", "lxdream" ); 47 | if( esd_handle == -1 ) { 48 | ERROR( "Unable to open audio output (ESD)" ); 49 | return FALSE; 50 | } 51 | return TRUE; 52 | } 53 | 54 | static gboolean audio_esd_process_buffer( audio_buffer_t buffer ) 55 | { 56 | if( esd_handle != -1 ) { 57 | write( esd_handle, buffer->data, buffer->length ); 58 | return TRUE; 59 | } else { 60 | ERROR( "ESD not initialized" ); 61 | return FALSE; 62 | } 63 | } 64 | 65 | static gboolean audio_esd_shutdown() 66 | { 67 | close(esd_handle); 68 | esd_handle = -1; 69 | return TRUE; 70 | } 71 | 72 | static struct audio_driver audio_esd_driver = { 73 | "esd", 74 | N_("Enlightened Sound Daemon driver"), 75 | 30, 76 | DEFAULT_SAMPLE_RATE, 77 | DEFAULT_SAMPLE_FORMAT, 78 | audio_esd_init, 79 | NULL, 80 | audio_esd_process_buffer, 81 | NULL, 82 | audio_esd_shutdown}; 83 | 84 | AUDIO_DRIVER( "esd", audio_esd_driver ); 85 | -------------------------------------------------------------------------------- /src/sdram.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Dreamcast main SDRAM - access methods and timing controls. This is fairly 5 | * directly coupled to the SH4 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #include "lxdream.h" 21 | #include "mem.h" 22 | #include "dreamcast.h" 23 | #include "xlat/xltcache.h" 24 | #include 25 | 26 | 27 | static int32_t FASTCALL ext_sdram_read_long( sh4addr_t addr ) 28 | { 29 | return *((int32_t *)(dc_main_ram + (addr&0x00FFFFFF))); 30 | } 31 | static int32_t FASTCALL ext_sdram_read_word( sh4addr_t addr ) 32 | { 33 | return SIGNEXT16(*((int16_t *)(dc_main_ram + (addr&0x00FFFFFF)))); 34 | } 35 | static int32_t FASTCALL ext_sdram_read_byte( sh4addr_t addr ) 36 | { 37 | return SIGNEXT8(*((int16_t *)(dc_main_ram + (addr&0x00FFFFFF)))); 38 | } 39 | static void FASTCALL ext_sdram_write_long( sh4addr_t addr, uint32_t val ) 40 | { 41 | *(uint32_t *)(dc_main_ram + (addr&0x00FFFFFF)) = val; 42 | xlat_invalidate_long(addr); 43 | } 44 | static void FASTCALL ext_sdram_write_word( sh4addr_t addr, uint32_t val ) 45 | { 46 | *(uint16_t *)(dc_main_ram + (addr&0x00FFFFFF)) = (uint16_t)val; 47 | xlat_invalidate_word(addr); 48 | } 49 | static void FASTCALL ext_sdram_write_byte( sh4addr_t addr, uint32_t val ) 50 | { 51 | *(uint8_t *)(dc_main_ram + (addr&0x00FFFFFF)) = (uint8_t)val; 52 | xlat_invalidate_word(addr); 53 | } 54 | static void FASTCALL ext_sdram_read_burst( unsigned char *dest, sh4addr_t addr ) 55 | { 56 | memcpy( dest, dc_main_ram+(addr&0x00FFFFFF), 32 ); 57 | } 58 | static void FASTCALL ext_sdram_write_burst( sh4addr_t addr, unsigned char *src ) 59 | { 60 | memcpy( dc_main_ram+(addr&0x00FFFFFF), src, 32 ); 61 | } 62 | 63 | struct mem_region_fn mem_region_sdram = { ext_sdram_read_long, ext_sdram_write_long, 64 | ext_sdram_read_word, ext_sdram_write_word, 65 | ext_sdram_read_byte, ext_sdram_write_byte, 66 | ext_sdram_read_burst, ext_sdram_write_burst }; 67 | -------------------------------------------------------------------------------- /src/sh4/sh4mem.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * This is a deprecated module that is not yet completely extricated from the 5 | * surrounding code. 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #define MODULE sh4_module 21 | 22 | #include 23 | #include 24 | #include "dream.h" 25 | #include "mem.h" 26 | #include "mmio.h" 27 | #include "dreamcast.h" 28 | #include "sh4/sh4core.h" 29 | #include "sh4/sh4mmio.h" 30 | #include "sh4/mmu.h" 31 | #include "pvr2/pvr2.h" 32 | #include "xlat/xltcache.h" 33 | 34 | /************** Obsolete methods ***************/ 35 | 36 | /* FIXME: Handle all the many special cases when the range doesn't fall cleanly 37 | * into the same memory block 38 | */ 39 | void mem_copy_from_sh4( sh4ptr_t dest, sh4addr_t srcaddr, size_t count ) { 40 | if( srcaddr >= 0x04000000 && srcaddr < 0x05000000 ) { 41 | pvr2_vram64_read( dest, srcaddr, count ); 42 | } else { 43 | sh4ptr_t src = mem_get_region(srcaddr); 44 | if( src == NULL ) { 45 | WARN( "Attempted block read from unknown address %08X", srcaddr ); 46 | } else { 47 | memcpy( dest, src, count ); 48 | } 49 | } 50 | } 51 | 52 | void mem_copy_to_sh4( sh4addr_t destaddr, sh4ptr_t src, size_t count ) { 53 | if( destaddr >= 0x10000000 && destaddr < 0x14000000 ) { 54 | pvr2_dma_write( destaddr, src, count ); 55 | return; 56 | } else if( (destaddr & 0x1F800000) == 0x05000000 ) { 57 | pvr2_render_buffer_invalidate( destaddr, TRUE ); 58 | } else if( (destaddr & 0x1F800000) == 0x04000000 ) { 59 | pvr2_vram64_write( destaddr, src, count ); 60 | return; 61 | } 62 | sh4ptr_t dest = mem_get_region(destaddr); 63 | if( dest == NULL ) 64 | WARN( "Attempted block write to unknown address %08X", destaddr ); 65 | else { 66 | xlat_invalidate_block( destaddr, count ); 67 | memcpy( dest, src, count ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/drivers/video_nsgl.m: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Cocoa (NSOpenGL) video driver 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include 20 | #include 21 | #include "drivers/video_nsgl.h" 22 | #include "drivers/video_gl.h" 23 | #include "pvr2/glutil.h" 24 | 25 | static NSOpenGLContext *nsgl_context = nil; 26 | 27 | gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver ) 28 | { 29 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; 30 | NSOpenGLPixelFormatAttribute attributes[] = { 31 | NSOpenGLPFAWindow, 32 | // NSOpenGLPFADoubleBuffer, 33 | NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24, 34 | (NSOpenGLPixelFormatAttribute)nil }; 35 | 36 | NSOpenGLPixelFormat *pixelFormat = 37 | [[[NSOpenGLPixelFormat alloc] initWithAttributes: attributes] autorelease]; 38 | nsgl_context = 39 | [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil]; 40 | [nsgl_context setView: view]; 41 | [nsgl_context makeCurrentContext]; 42 | [pool release]; 43 | driver->swap_buffers = video_nsgl_swap_buffers; 44 | driver->capabilities.has_gl = TRUE; 45 | driver->capabilities.depth_bits = 24; 46 | gl_init_driver(driver, TRUE); 47 | return TRUE; 48 | } 49 | 50 | void video_nsgl_update() 51 | { 52 | if( nsgl_context != nil ) { 53 | [nsgl_context update]; 54 | } 55 | } 56 | 57 | void video_nsgl_make_current() 58 | { 59 | if( nsgl_context != nil ) { 60 | [nsgl_context makeCurrentContext]; 61 | } 62 | } 63 | 64 | void video_nsgl_swap_buffers() 65 | { 66 | if( nsgl_context != nil ) { 67 | [nsgl_context flushBuffer]; 68 | } 69 | } 70 | 71 | void video_nsgl_shutdown() 72 | { 73 | if( nsgl_context != nil ) { 74 | [NSOpenGLContext clearCurrentContext]; 75 | [nsgl_context release]; 76 | nsgl_context = nil; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /test/sh4/mmummio.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../lib.h" 4 | 5 | #define PTEH 0xFF000000 6 | #define PTEL 0xFF000004 7 | #define TTB 0xFF000008 8 | #define TEA 0xFF00000C 9 | #define MMUCR 0xFF000010 10 | #define PTEA 0xFF000034 11 | 12 | #define ITLB_ADDR(entry) (0xF2000000 + (entry<<8)) 13 | #define ITLB_DATA(entry) (0xF3000000 + (entry<<8)) 14 | #define UTLB_ADDR(entry) (0xF6000000 + (entry<<8)) 15 | #define UTLB_DATA1(entry) (0xF7000000 + (entry<<8)) 16 | #define UTLB_DATA2(entry) (0xF7800000 + (entry<<8)) 17 | 18 | /* Bang on the mmio side of the TLBs to make sure the bits 19 | * respond appropriately (with AT disabled so we don't risk 20 | * doing a hard crash) */ 21 | void test_tlb_mmio() 22 | { 23 | int entry; 24 | for( entry=0; entry<64; entry++ ) { 25 | long_write( UTLB_DATA1(entry), 0 ); 26 | long_write( UTLB_ADDR(entry), 0xFFFFFFFF ); 27 | assert( long_read( UTLB_ADDR(entry) ) == 0xFFFFFFFF ); 28 | assert( long_read( UTLB_DATA1(entry) ) == 0x00000104 ); 29 | long_write( UTLB_ADDR(entry), 0x00000000 ); 30 | assert( long_read( UTLB_ADDR(entry) ) == 0x00000000 ); 31 | assert( long_read( UTLB_DATA1(entry) ) == 0x00000000 ); 32 | long_write( UTLB_DATA1(entry), 0xFFFFFFFF ); 33 | assert( long_read( UTLB_DATA1(entry) ) == 0x1FFFFDFF ); 34 | assert( long_read( UTLB_ADDR(entry) ) == 0x00000300 ); 35 | long_write( UTLB_DATA1(entry), 0x00000000 ); 36 | assert( long_read( UTLB_DATA1(entry) ) == 0x00000000 ); 37 | assert( long_read( UTLB_ADDR(entry) ) == 0x00000000 ); 38 | long_write( UTLB_DATA2(entry), 0xFFFFFFFF ); 39 | assert( long_read( UTLB_DATA2(entry) ) == 0x0000000F ); 40 | long_write( UTLB_DATA2(entry), 0x00000000 ); 41 | assert( long_read( UTLB_DATA2(entry) ) == 0x00000000 ); 42 | } 43 | 44 | for( entry=0; entry<4; entry++ ) { 45 | long_write( ITLB_DATA(entry), 0 ); 46 | long_write( ITLB_ADDR(entry), 0xFFFFFFFF ); 47 | assert( long_read( ITLB_ADDR(entry) ) == 0xFFFFFDFF ); 48 | assert( long_read( ITLB_DATA(entry) ) == 0x00000100 ); 49 | long_write( ITLB_ADDR(entry), 0x00000000 ); 50 | assert( long_read( ITLB_ADDR(entry) ) == 0x00000000 ); 51 | assert( long_read( ITLB_DATA(entry) ) == 0x00000000 ); 52 | long_write( ITLB_DATA(entry), 0xFFFFFFFF ); 53 | assert( long_read( ITLB_DATA(entry) ) == 0x1FFFFDDA ); 54 | assert( long_read( ITLB_ADDR(entry) ) == 0x00000100 ); 55 | long_write( ITLB_DATA(entry), 0x00000000 ); 56 | assert( long_read( ITLB_DATA(entry) ) == 0x00000000 ); 57 | assert( long_read( ITLB_ADDR(entry) ) == 0x00000000 ); 58 | 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /test/sh4/shld.s: -------------------------------------------------------------------------------- 1 | .section .text 2 | .include "sh4/inc.s" 3 | ! 4 | ! Test SHAD/SHLD operation 5 | ! 6 | .global _test_shld 7 | _test_shld: 8 | start_test 9 | mov.l r11, @-r15 10 | mov.l r10, @-r15 11 | 12 | test_shld_1: 13 | mov #8, r11 14 | mova test_shld_data, r0 15 | mov r0, r10 16 | 17 | test_shld_1_loop1: 18 | add #1, r12 19 | mov.l @r10+, r2 20 | mov.l @r10+, r3 21 | mov.l @r10+, r4 22 | shld r3, r2 23 | cmp/eq r2, r4 24 | bt test_shld_1_ok 25 | fail test_shld_str_k 26 | test_shld_1_ok: 27 | dt r11 28 | bf test_shld_1_loop1 29 | 30 | test_shad_1: ! Same again, but using shad 31 | mov #8, r11 32 | mova test_shad_data, r0 33 | mov r0, r10 34 | 35 | test_shad_1_loop1: 36 | add #1, r12 37 | mov.l @r10+, r2 38 | mov.l @r10+, r3 39 | mov.l @r10+, r4 40 | shad r3, r2 41 | cmp/eq r2, r4 42 | bt test_shad_1_ok 43 | fail test_shld_str_k 44 | test_shad_1_ok: 45 | dt r11 46 | bf test_shad_1_loop1 47 | 48 | test_shld_end: 49 | mov.l @r15+, r10 50 | mov.l @r15+, r11 51 | end_test test_shld_str_k 52 | 53 | test_shld_data: 54 | .long 0x12345678 55 | .long 0 56 | .long 0x12345678 57 | 58 | .long 0xA8B9CADB 59 | .long 0x00000010 60 | .long 0xCADB0000 61 | 62 | .long 0x8A9BACBD 63 | .long 0xFFFFFFF0 64 | .long 0x00008A9B 65 | 66 | .long 0x7A9BACBD 67 | .long 0xFFFFFFF0 68 | .long 0x00007A9B 69 | 70 | .long 0x7891ACDC 71 | .long 0x80000000 72 | .long 0x00000000 73 | 74 | .long 0x8719C010 75 | .long 0x80000000 76 | .long 0x00000000 77 | 78 | .long 0x7891ACDF 79 | .long 0x7FFFFFFF 80 | .long 0x80000000 81 | 82 | .long 0x8719C01E 83 | .long 0x000000FF 84 | .long 0x00000000 85 | 86 | test_shad_data: 87 | .long 0x12345678 88 | .long 0 89 | .long 0x12345678 90 | 91 | .long 0xA8B9CADB 92 | .long 0x00000010 93 | .long 0xCADB0000 94 | 95 | .long 0x8A9BACBD 96 | .long 0xFFFFFFF0 97 | .long 0xFFFF8A9B 98 | 99 | .long 0x7A9BACBD 100 | .long 0xFFFFFFF0 101 | .long 0x00007A9B 102 | 103 | .long 0x7891ACDC 104 | .long 0x80000000 105 | .long 0x00000000 106 | 107 | .long 0x8719C010 108 | .long 0x80000000 109 | .long 0xFFFFFFFF 110 | 111 | .long 0x7891ACDF 112 | .long 0x7FFFFFFF 113 | .long 0x80000000 114 | 115 | .long 0x8719C01E 116 | .long 0x000000FF 117 | .long 0x00000000 118 | 119 | test_shld_data_end: 120 | .align 4 121 | test_shld_data_end_k: 122 | .long test_shld_data_end 123 | test_shld_str_k: 124 | .long test_shld_str 125 | test_shld_str: 126 | .string "SHLD" 127 | -------------------------------------------------------------------------------- /test/include/process.h: -------------------------------------------------------------------------------- 1 | /* process.h. This file comes with MSDOS and WIN32 systems. */ 2 | 3 | #ifndef __PROCESS_H_ 4 | #define __PROCESS_H_ 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int execl(const char *path, const char *argv0, ...); 11 | int execle(const char *path, const char *argv0, ... /*, char * const *envp */); 12 | int execlp(const char *path, const char *argv0, ...); 13 | int execlpe(const char *path, const char *argv0, ... /*, char * const *envp */); 14 | 15 | int execv(const char *path, char * const *argv); 16 | int execve(const char *path, char * const *argv, char * const *envp); 17 | int execvp(const char *path, char * const *argv); 18 | int execvpe(const char *path, char * const *argv, char * const *envp); 19 | 20 | int spawnl(int mode, const char *path, const char *argv0, ...); 21 | int spawnle(int mode, const char *path, const char *argv0, ... /*, char * const *envp */); 22 | int spawnlp(int mode, const char *path, const char *argv0, ...); 23 | int spawnlpe(int mode, const char *path, const char *argv0, ... /*, char * const *envp */); 24 | 25 | int spawnv(int mode, const char *path, const char * const *argv); 26 | int spawnve(int mode, const char *path, char * const *argv, const char * const *envp); 27 | int spawnvp(int mode, const char *path, const char * const *argv); 28 | int spawnvpe(int mode, const char *path, const char * const *argv, const char * const *envp); 29 | 30 | #ifdef __CYGWIN32__ 31 | /* Secure exec() functions family */ 32 | /* The first arg should really be a HANDLE which is a void *. But we 33 | can't include windows.h here so... */ 34 | #include 35 | pid_t sexecl(void *, const char *path, const char *argv0, ...); 36 | pid_t sexecle(void *, const char *path, const char *argv0, ... /*, char * const *envp */); 37 | pid_t sexeclp(void *, const char *path, const char *argv0, ...); 38 | pid_t sexeclpe(void *, const char *path, const char *argv0, ... /*, char * const *envp */); 39 | 40 | pid_t sexecv(void *, const char *path, const char * const *argv); 41 | pid_t sexecve(void *, const char *path, const char * const *argv, const char * const *envp); 42 | pid_t sexecvp(void *, const char *path, const char * const *argv); 43 | pid_t sexecvpe(void *, const char *path, const char * const *argv, const char * const *envp); 44 | #endif 45 | 46 | int cwait(int *, int, int); 47 | 48 | #define _P_WAIT 1 49 | #define _P_NOWAIT 2 /* always generates error */ 50 | #define _P_OVERLAY 3 51 | #define _P_NOWAITO 4 52 | #define _P_DETACH 5 53 | 54 | #define WAIT_CHILD 1 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | errstatus=0 8 | dirmode="" 9 | 10 | usage="\ 11 | Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." 12 | 13 | # process command line arguments 14 | while test $# -gt 0 ; do 15 | case $1 in 16 | -h | --help | --h*) # -h for help 17 | echo "$usage" 1>&2 18 | exit 0 19 | ;; 20 | -m) # -m PERM arg 21 | shift 22 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 23 | dirmode=$1 24 | shift 25 | ;; 26 | --) # stop option processing 27 | shift 28 | break 29 | ;; 30 | -*) # unknown option 31 | echo "$usage" 1>&2 32 | exit 1 33 | ;; 34 | *) # first non-opt arg 35 | break 36 | ;; 37 | esac 38 | done 39 | 40 | for file 41 | do 42 | if test -d "$file"; then 43 | shift 44 | else 45 | break 46 | fi 47 | done 48 | 49 | case $# in 50 | 0) exit 0 ;; 51 | esac 52 | 53 | case $dirmode in 54 | '') 55 | if mkdir -p -- . 2>/dev/null; then 56 | echo "mkdir -p -- $*" 57 | exec mkdir -p -- "$@" 58 | fi 59 | ;; 60 | *) 61 | if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 62 | echo "mkdir -m $dirmode -p -- $*" 63 | exec mkdir -m "$dirmode" -p -- "$@" 64 | fi 65 | ;; 66 | esac 67 | 68 | for file 69 | do 70 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 71 | shift 72 | 73 | pathcomp= 74 | for d 75 | do 76 | pathcomp="$pathcomp$d" 77 | case $pathcomp in 78 | -*) pathcomp=./$pathcomp ;; 79 | esac 80 | 81 | if test ! -d "$pathcomp"; then 82 | echo "mkdir $pathcomp" 83 | 84 | mkdir "$pathcomp" || lasterr=$? 85 | 86 | if test ! -d "$pathcomp"; then 87 | errstatus=$lasterr 88 | else 89 | if test ! -z "$dirmode"; then 90 | echo "chmod $dirmode $pathcomp" 91 | lasterr="" 92 | chmod "$dirmode" "$pathcomp" || lasterr=$? 93 | 94 | if test ! -z "$lasterr"; then 95 | errstatus=$lasterr 96 | fi 97 | fi 98 | fi 99 | fi 100 | 101 | pathcomp="$pathcomp/" 102 | done 103 | done 104 | 105 | exit $errstatus 106 | 107 | # Local Variables: 108 | # mode: shell-script 109 | # sh-indentation: 2 110 | # End: 111 | # mkinstalldirs ends here 112 | -------------------------------------------------------------------------------- /android/deps/libisofs-0.6.38.diff: -------------------------------------------------------------------------------- 1 | diff -ur libisofs-0.6.38/demo/demo.c libisofs-0.6.38/demo/demo.c 2 | --- libisofs-0.6.38/demo/demo.c 2010-08-31 19:24:04.000000000 +1000 3 | +++ libisofs-0.6.38/demo/demo.c 2012-02-16 18:07:47.000000000 +1000 4 | @@ -311,7 +311,7 @@ 5 | 6 | fp = fopen(argv[optind+1], "w"); 7 | if (fp == NULL) { 8 | - err(1, "error opening output file"); 9 | + fprintf(stderr, "error opening output file"); 10 | goto ex; 11 | } 12 | 13 | @@ -639,7 +639,7 @@ 14 | 15 | fp = fopen(argv[3], "w"); 16 | if (fp == NULL) { 17 | - err(1, "error opening output file"); 18 | + fprintf(stderr, "error opening output file"); 19 | goto ex; 20 | } 21 | 22 | @@ -749,7 +749,7 @@ 23 | 24 | fp = fopen(argv[5], "w"); 25 | if (!fp) { 26 | - err(1, "error opening output file"); 27 | + fprintf(stderr, "error opening output file"); 28 | goto ex; 29 | } 30 | 31 | diff -ur libisofs-0.6.38/libisofs/ecma119.c libisofs-0.6.38/libisofs/ecma119.c 32 | --- libisofs-0.6.38/libisofs/ecma119.c 2010-10-19 20:41:15.000000000 +1000 33 | +++ libisofs-0.6.38/libisofs/ecma119.c 2012-02-16 17:57:46.000000000 +1000 34 | @@ -38,7 +38,7 @@ 35 | #include 36 | #include 37 | #include 38 | -#include 39 | +//#include 40 | #include 41 | 42 | #ifdef Xorriso_standalonE 43 | diff -ur libisofs-0.6.38/libisofs/fs_image.c libisofs-0.6.38/libisofs/fs_image.c 44 | --- libisofs-0.6.38/libisofs/fs_image.c 2010-08-31 20:05:09.000000000 +1000 45 | +++ libisofs-0.6.38/libisofs/fs_image.c 2012-02-16 17:53:29.000000000 +1000 46 | @@ -30,7 +30,7 @@ 47 | #include 48 | #include 49 | #include 50 | -#include 51 | +//#include 52 | #include 53 | #include 54 | 55 | diff -ur libisofs-0.6.38/libisofs/util.c libisofs-0.6.38/libisofs/util.c 56 | --- libisofs-0.6.38/libisofs/util.c 2010-05-29 06:33:28.000000000 +1000 57 | +++ libisofs-0.6.38/libisofs/util.c 2012-02-16 17:57:28.000000000 +1000 58 | @@ -27,7 +27,7 @@ 59 | #include 60 | #include 61 | #include 62 | -#include 63 | +//#include 64 | 65 | #include 66 | 67 | @@ -185,7 +185,11 @@ 68 | { 69 | if(libisofs_local_charset[0]) 70 | return libisofs_local_charset; 71 | +#ifdef __ANDROID__ 72 | + return "UTF-8"; 73 | +#else 74 | return nl_langinfo(CODESET); 75 | +#endif 76 | } 77 | 78 | int strconv(const char *str, const char *icharset, const char *ocharset, 79 | -------------------------------------------------------------------------------- /src/ioutil.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * GDB RDP server stub - SH4 + ARM 5 | * 6 | * Copyright (c) 2009 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #ifndef lxdream_netutil_H 20 | #define lxdream_netutil_H 1 21 | 22 | #include 23 | #include 24 | #include "lxdream.h" 25 | 26 | typedef void *io_listener_t; 27 | 28 | /** 29 | * Construct a server socket listening on the given interface and port. If port 30 | * is 0, a dynamic port will be bound instead. 31 | * This method does not register a listener. 32 | * @return newly created socket fd, or -1 on failure. 33 | */ 34 | int io_create_server_socket(const char *interface, int port ); 35 | 36 | /** 37 | * Callback invoked when data is available from the remote peer, or when the peer 38 | * connects/disconnects. 39 | * 40 | * @param fd file descriptor of the connected socket 41 | * @param data data supplied when the callback was registered 42 | * @return TRUE to maintain the connection, FALSE to immediately disconnected + close. 43 | */ 44 | typedef gboolean (*io_callback_t)( int fd, void *data ); 45 | 46 | /** 47 | * Register a TCP server socket listener on an already open (and listening) 48 | * socket. The socket must not have been previously registered. 49 | * @return NULL on failure, otherwise an io listener handle. 50 | * 51 | * Note: Implementation is platform specific 52 | */ 53 | io_listener_t io_register_tcp_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void*) ); 54 | 55 | /** 56 | * Register an I/O listener on an open file descriptor. The fd must not have 57 | * been previously registered. 58 | * @return TRUE on success, FALSE on failure. 59 | */ 60 | io_listener_t io_register_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void *) ); 61 | 62 | /** 63 | * Unregister a socket that was previously registered with the system. This 64 | * does not close the socket, but will remove any callbacks associated with the socket. 65 | */ 66 | void io_unregister_listener( io_listener_t handle ); 67 | 68 | #endif /* !lxdream_netutil_H */ 69 | -------------------------------------------------------------------------------- /src/tools/gendec.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * mem is responsible for creating and maintaining the overall system memory 5 | * map, as visible from the SH4 processor. (Note the ARM has a different map) 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #ifndef lxdream_gendec_H 21 | #define lxdream_gendec_H 1 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #define MAX_OPERAND_NAME 8 30 | #define MAX_OPERANDS 4 31 | #define MAX_OPERATION_FORMAT 64 32 | #define MAX_RULES 512 33 | 34 | #define USE_NONE 0 35 | #define USE_READ 1 36 | #define USE_WRITE 2 37 | #define USE_READWRITE 3 38 | 39 | struct operand { 40 | int bit_count; 41 | int bit_shift; 42 | int left_shift; 43 | int is_signed; 44 | int use_mode; 45 | char name[MAX_OPERAND_NAME+1]; 46 | }; 47 | 48 | struct rule { 49 | uint32_t bits; 50 | uint32_t mask; 51 | int bit_count; 52 | int operand_count; 53 | int flags_use_mode; 54 | struct operand operands[MAX_OPERANDS]; 55 | char format[MAX_OPERATION_FORMAT+1]; 56 | }; 57 | 58 | struct ruleset { 59 | uint32_t rule_count; 60 | struct rule *rules[MAX_RULES]; 61 | }; 62 | 63 | struct ruleset *parse_ruleset_file( FILE *f ); 64 | void dump_ruleset( struct ruleset *rules, FILE *f ); 65 | void dump_rulesubset( struct ruleset *rules, int ruleidx[], int rule_count, FILE *f ); 66 | 67 | struct action { 68 | const char *filename; 69 | int lineno; 70 | const char *text; 71 | }; 72 | 73 | typedef struct actionfile *actionfile_t; 74 | 75 | typedef struct actiontoken { 76 | enum { NONE, TEXT, ACTIONS, END, ERROR } symbol; 77 | const char *filename; 78 | int lineno; 79 | char *text; 80 | struct action actions[MAX_RULES]; 81 | } *actiontoken_t; 82 | 83 | actionfile_t action_file_open( const char *filename, struct ruleset *rules ); 84 | 85 | actiontoken_t action_file_next( actionfile_t af ); 86 | 87 | void action_file_close( actionfile_t af ); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif /* !lxdream_gendec_H */ 94 | -------------------------------------------------------------------------------- /test/math.s: -------------------------------------------------------------------------------- 1 | # 2 | # Assembler functions to invoke the non-standard FP operations 3 | # 4 | .global _clear_fpscr 5 | _clear_fpscr: 6 | xor r0, r0 7 | lds r0, fpscr 8 | rts 9 | nop 10 | 11 | .global _get_fpscr 12 | _get_fpscr: 13 | rts 14 | sts fpscr, r0 15 | 16 | .global _set_fpscr 17 | _set_fpscr: 18 | rts 19 | lds r4, fpscr 20 | 21 | .global _do_fsca 22 | _do_fsca: 23 | sts fpscr, r0 24 | mov #0x08, r1 25 | shll16 r1 26 | not r1, r1 27 | and r0, r1 28 | lds r1, fpscr 29 | lds r4, fpul 30 | .word 0xF0FD 31 | fmov fr0, @r5 32 | fmov fr1, @r6 33 | xor r0,r0 34 | rts 35 | lds r1, fpscr 36 | 37 | .global _do_fsrra 38 | _do_fsrra: 39 | sts fpscr, r0 40 | mov #0x08, r1 41 | shll16 r1 42 | not r1, r1 43 | and r0, r1 44 | lds r1, fpscr 45 | fmov fr4, fr0 46 | .word 0xF07D 47 | rts 48 | lds r0, fpscr 49 | 50 | .global _do_fipr 51 | _do_fipr: 52 | sts fpscr, r0 53 | mov #0x08, r1 54 | shll16 r1 55 | not r1, r1 56 | and r0, r1 57 | lds r1, fpscr 58 | fmov.s @r4+, fr0 59 | fmov.s @r4+, fr1 60 | fmov.s @r4+, fr2 61 | fmov.s @r4+, fr3 62 | fmov.s @r5+, fr4 63 | fmov.s @r5+, fr5 64 | fmov.s @r5+, fr6 65 | fmov.s @r5+, fr7 66 | fipr fv0, fv4 67 | lds r0, fpscr 68 | rts 69 | fmov fr7, fr0 70 | 71 | .global _do_fipr2 72 | _do_fipr2: 73 | sts fpscr, r0 74 | mov #0x08, r1 75 | shll16 r1 76 | not r1, r1 77 | and r0, r1 78 | lds r1, fpscr 79 | fschg 80 | fmov @r4+, dr0 81 | fmov @r4+, dr2 82 | fmov @r5+, dr4 83 | fmov @r5+, dr6 84 | fschg 85 | fipr fv0, fv4 86 | lds r0, fpscr 87 | rts 88 | fmov fr7, fr0 89 | 90 | .global _do_ftrv 91 | _do_ftrv: 92 | sts fpscr, r0 93 | mov #0x08, r1 94 | shll16 r1 95 | not r1, r1 96 | and r0, r1 97 | lds r1, fpscr 98 | fschg 99 | fmov @r4+, xd0 100 | fmov @r4+, xd2 101 | fmov @r4+, xd4 102 | fmov @r4+, xd6 103 | fmov @r4+, xd8 104 | fmov @r4+, xd10 105 | fmov @r4+, xd12 106 | fmov @r4, xd14 107 | fmov @r5+, dr0 108 | fmov @r5, dr2 109 | ftrv xmtrx, fv0 110 | fmov dr2, @r5 111 | fmov dr0, @-r5 112 | fschg 113 | rts 114 | lds r0, fpscr 115 | 116 | .global _do_ftrv2 117 | _do_ftrv2: 118 | sts fpscr, r0 119 | mov #0x08, r1 120 | shll16 r1 121 | not r1, r1 122 | and r0, r1 123 | lds r1, fpscr 124 | fschg 125 | frchg 126 | fmov @r4+, dr0 127 | fmov @r4+, dr2 128 | fmov @r4+, dr4 129 | fmov @r4+, dr6 130 | fmov @r4+, dr8 131 | fmov @r4+, dr10 132 | fmov @r4+, dr12 133 | fmov @r4+, dr14 134 | frchg 135 | fmov @r5+, dr0 136 | fmov @r5, dr2 137 | ftrv xmtrx, fv0 138 | fmov dr2, @-r5 139 | fmov dr0, @-r5 140 | fschg 141 | rts 142 | lds r0, fpscr 143 | -------------------------------------------------------------------------------- /test/dma.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * DMA support code 5 | * 6 | * Copyright (c) 2006 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include "lib.h" 20 | 21 | /** 22 | * Setup the DMAC for a transfer. Assumes 32-byte block transfer. 23 | * Caller is responsible for making sure no-one else is using the 24 | * channel already. 25 | * 26 | * @param channel DMA channel to use, 0 to 3 27 | * @param source source address (if a memory source) 28 | * @param dest destination address (if a memory destination) 29 | * @param length number of bytes to transfer (must be a multiple of 30 | * 32. 31 | * @param direction 0 = host to device, 1 = device to host 32 | */ 33 | void dmac_prepare_channel( int channel, uint32_t source, uint32_t dest, 34 | uint32_t length, int direction ); 35 | 36 | /** 37 | * Transfer data to the PVR via DMA. Target address should be 38 | * 0x10000000 for the TA, and 0x11000000 + VRAM address for VRAM. 39 | * 40 | * @param target Target address 41 | * @param buf Data to write (must be 32-byte aligned) 42 | * @param length Size of data to write, in bytes. 43 | * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region. 44 | * 45 | * @return 0 on success, non-zero on failure. 46 | */ 47 | int pvr_dma_write( unsigned int target, char *buf, int length, int region ); 48 | 49 | /** 50 | * Transfer TA data to the PVR via SORT-DMA. 51 | * 52 | * @param sorttable Start address of the sort table 53 | * @param tablelen Size of the sort table (in bytes) 54 | * @param data Start address of the TA data (polygons) 55 | * @param datalen Size of the polygon data block (in bytes) 56 | * @param bitwidth 57 | * @param datasize 58 | * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region. 59 | * 60 | * @return 0 on success, non-zero on failure. 61 | */ 62 | int sort_dma_write( char *sorttable, int tablelen, char *data, int datalen, int bitwidth, int datasize ); 63 | 64 | int aica_dma_write( uint32_t aica_addr, char *data, uint32_t size ); 65 | int aica_dma_read( char *data, uint32_t aica_addr, uint32_t size ); 66 | -------------------------------------------------------------------------------- /src/drivers/audio_pulse.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * The pulseaudio sound driver 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | #include 19 | #include 20 | #include 21 | #include "aica/audio.h" 22 | #include "lxdream.h" 23 | 24 | static pa_simple *pulse_server = NULL; 25 | 26 | static gboolean audio_pulse_init( ) 27 | { 28 | int rate = DEFAULT_SAMPLE_RATE; 29 | int format = DEFAULT_SAMPLE_FORMAT; 30 | pa_sample_spec ss; 31 | 32 | if( pulse_server != NULL ) { 33 | pa_simple_free(pulse_server); 34 | } 35 | ss.rate = rate; 36 | 37 | if( format & AUDIO_FMT_16BIT ) { 38 | ss.format = PA_SAMPLE_S16NE; 39 | } else { 40 | ss.format = PA_SAMPLE_U8; 41 | } 42 | 43 | if( format & AUDIO_FMT_STEREO ) { 44 | ss.channels = 2; 45 | } else { 46 | ss.channels = 1; 47 | } 48 | 49 | pulse_server = pa_simple_new(NULL, APP_NAME, PA_STREAM_PLAYBACK, 50 | NULL, "Audio", &ss, NULL, NULL, NULL); 51 | if( pulse_server == NULL ) { 52 | ERROR( "Unable to open audio output (pulseaudio)" ); 53 | return FALSE; 54 | } 55 | return TRUE; 56 | } 57 | 58 | static gboolean audio_pulse_process_buffer( audio_buffer_t buffer ) 59 | { 60 | if( pulse_server != NULL ) { 61 | int error; 62 | pa_simple_write( pulse_server, buffer->data, buffer->length, &error ); 63 | return TRUE; 64 | } else { 65 | ERROR( "Pulseaudio not initialized" ); 66 | return FALSE; 67 | } 68 | } 69 | 70 | static gboolean audio_pulse_shutdown() 71 | { 72 | pa_simple_free(pulse_server); 73 | pulse_server = NULL; 74 | return TRUE; 75 | } 76 | 77 | static struct audio_driver audio_pulse_driver = { 78 | "pulse", 79 | N_("PulseAudio sound server driver"), 80 | 10, 81 | DEFAULT_SAMPLE_RATE, 82 | DEFAULT_SAMPLE_FORMAT, 83 | audio_pulse_init, 84 | NULL, 85 | audio_pulse_process_buffer, 86 | NULL, 87 | audio_pulse_shutdown}; 88 | 89 | AUDIO_DRIVER( "pulse", audio_pulse_driver ); 90 | -------------------------------------------------------------------------------- /src/gdrom/packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * This file defines the command codes and any other flags used by the 5 | * GD-Rom ATAPI packet commands. 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #ifndef lxdream_packet_H 21 | #define lxdream_packet_H 1 22 | 23 | /** 24 | * Valid command codes (hex): 25 | * 00 Test 26 | * 10 Drive Status 27 | * 11 Mode Sense 28 | * 12 Mode Select 29 | * 13 Request Sense 30 | * 14 Read TOC 31 | * 15 Read session info 32 | * 16 33 | * 20 34 | * 21 35 | * 22 36 | * 30 Read CD 37 | * 31 38 | * 40 Read Status ? 39 | * 50 40 | * 51 41 | * 52 42 | * 53 43 | * 54 44 | * 55 45 | * 70 46 | * 71 47 | * 72 48 | * 73 49 | * FE 50 | */ 51 | 52 | #define PKT_CMD_TEST_READY 0x00 53 | #define PKT_CMD_DRIVE_STATUS 0x10 54 | #define PKT_CMD_MODE_SENSE 0x11 55 | #define PKT_CMD_MODE_SELECT 0x12 56 | #define PKT_CMD_SENSE 0x13 57 | #define PKT_CMD_READ_TOC 0x14 58 | #define PKT_CMD_SESSION_INFO 0x15 59 | #define PKT_CMD_READ_SECTOR 0x30 60 | #define PKT_CMD_PLAY_AUDIO 0x20 /* ? */ 61 | #define PKT_CMD_STATUS 0x40 62 | #define PKT_CMD_SPIN_UP 0x70 /* ??? */ 63 | #define PKT_CMD_71 0x71 /* ??? seems to return garbage */ 64 | 65 | #define PKT_ERR_OK 0x0000 66 | #define PKT_ERR_NODISC 0x3A02 67 | #define PKT_ERR_BADCMD 0x2005 68 | #define PKT_ERR_BADFIELD 0x2405 69 | #define PKT_ERR_BADREAD 0x3002 70 | #define PKT_ERR_BADREADMODE 0x6405 /* Illegal mode for this track */ 71 | #define PKT_ERR_READERROR 0x1103 /* Read failed due to uncorrectable error */ 72 | #define PKT_ERR_RESET 0x2906 73 | 74 | /* Parse CD read */ 75 | #define READ_CD_MODE(x) ((x)&0x0E) 76 | #define READ_CD_MODE_ANY 0x00 77 | #define READ_CD_MODE_CDDA 0x02 78 | #define READ_CD_MODE_1 0x04 79 | #define READ_CD_MODE_2 0x06 80 | #define READ_CD_MODE_2_FORM_1 0x08 81 | #define READ_CD_MODE_2_FORM_2 0x0A 82 | 83 | #define READ_CD_CHANNELS(x) ((x)&0xF0) 84 | #define READ_CD_HEADER(x) ((x)&0x80) 85 | #define READ_CD_SUBHEAD(x) ((x)&0x40) 86 | #define READ_CD_DATA(x) ((x)&0x20) 87 | #define READ_CD_RAW(x) ((x)&0x10) 88 | 89 | #endif /* !lxdream_packet_H */ 90 | -------------------------------------------------------------------------------- /src/serial.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * External interface to the dreamcast serial port, implemented by 4 | * sh4/scif.c 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | #ifndef lxdream_serial_H 19 | #define lxdream_serial_H 1 20 | 21 | #include 22 | 23 | #include "lxdream.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #define SERIAL_8BIT 0x00 30 | #define SERIAL_7BIT 0x40 31 | #define SERIAL_PARITY_OFF 0x00 32 | #define SERIAL_PARITY_EVEN 0x20 33 | #define SERIAL_PARITY_ODD 0x30 34 | #define SERIAL_1STOPBIT 0x00 35 | #define SERIAL_2STOPBITS 0x08 36 | 37 | typedef struct serial_device { 38 | void (*attach)(struct serial_device *dev); 39 | void (*detach)(struct serial_device *dev); 40 | void (*destroy)(struct serial_device *dev); 41 | void (*set_line_speed)(struct serial_device *dev, uint32_t bps); 42 | void (*set_line_params)(struct serial_device *dev, int flags); 43 | void (*receive_data)(struct serial_device *dev, uint8_t value); 44 | } *serial_device_t; 45 | 46 | serial_device_t serial_attach_device( serial_device_t dev ); 47 | serial_device_t serial_detach_device( ); 48 | serial_device_t serial_get_device( ); 49 | 50 | void serial_init(); 51 | 52 | /** 53 | * Destroy a serial device. 54 | */ 55 | void serial_destroy_device( serial_device_t dev ); 56 | 57 | 58 | void serial_transmit_data( char *data, int length ); 59 | void serial_transmit_break( void ); 60 | 61 | /** 62 | * Create a serial device on a host device identified by the given 63 | * file (ie /dev/tty). If filename identifies a regular file, it is opened 64 | * for output only. 65 | */ 66 | serial_device_t serial_fd_device_new_filename( const gchar *filename ); 67 | 68 | /** 69 | * Create a serial device on the host console (stdin/stdout). 70 | */ 71 | serial_device_t serial_fd_device_new_console(); 72 | 73 | /** 74 | * Create a serial device on a pair of file streams (in and out) 75 | */ 76 | serial_device_t serial_fd_device_new_file( FILE *in, FILE *out, gboolean closeOnDestroy ); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* !lxdream_serial_H */ 83 | -------------------------------------------------------------------------------- /src/gdlist.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * GD-Rom list manager - maintains the list of recently accessed images and 5 | * available devices for the UI + config. 6 | * 7 | * Copyright (c) 2005 Nathan Keynes. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | */ 19 | 20 | #ifndef lxdream_gdlist_H 21 | #define lxdream_gdlist_H 1 22 | 23 | #include 24 | #include "hook.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | typedef gboolean (*gdrom_list_change_hook_t)(gboolean list_changed, int selection, void *user_data); 31 | DECLARE_HOOK(gdrom_list_change_hook, gdrom_list_change_hook_t); 32 | 33 | 34 | /** 35 | * Initialize the gdrom list (registers with the gdrom driver, creates the 36 | * initial lists, etc). Must be called exactly once before using the lists. 37 | */ 38 | void gdrom_list_init(void); 39 | 40 | /** 41 | * Return the index of the currently selected GD-Rom item. If there is no disc 42 | * currently mounted, returns 0. 43 | */ 44 | int gdrom_list_get_selection(void); 45 | 46 | /** 47 | * Return the number of items in the list, including separators. 48 | */ 49 | int gdrom_list_size(void); 50 | 51 | /** 52 | * Return the display name of the item at the specified index. If the 53 | * item is a separator, returns the empty string. If the index is out 54 | * of bounds, returns NULL. 55 | * The list will currently follow the following structure: 56 | * "Empty" (localised) 57 | * Any CD/DVD drives attached to the system 58 | * "" (empty string) - separator item 59 | * An LRU list of disc image files (note without directory components). 60 | */ 61 | const gchar *gdrom_list_get_display_name(int index); 62 | 63 | const gchar *gdrom_list_get_filename(int index); 64 | 65 | /** 66 | * Change the current gdrom selection to the selected index. This will mount the 67 | * appropriate drive/image where necessary. 68 | * @param err Updated if there was an error loading the selected gdrom 69 | * @return TRUE if the selection was updated, FALSE if the position was invalid. 70 | */ 71 | gboolean gdrom_list_set_selection(int posn, ERROR *err); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* lxdream_gdlist_H */ 78 | -------------------------------------------------------------------------------- /src/drivers/video_null.c: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Null video output driver (ie no video output whatsoever) 5 | * 6 | * Copyright (c) 2005 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | #include "display.h" 20 | #include "drivers/video_gl.h" 21 | 22 | static gboolean video_null_init( void ); 23 | 24 | static render_buffer_t video_null_create_render_buffer( uint32_t hres, uint32_t vres, GLuint tex_id ) 25 | { 26 | return NULL; 27 | } 28 | 29 | static void video_null_destroy_render_buffer( render_buffer_t buffer ) 30 | { 31 | } 32 | 33 | static gboolean video_null_set_render_target( render_buffer_t buffer ) 34 | { 35 | return TRUE; 36 | } 37 | 38 | static void video_null_finish_render( render_buffer_t buffer ) 39 | { 40 | } 41 | 42 | static void video_null_display_render_buffer( render_buffer_t buffer ) 43 | { 44 | } 45 | 46 | static gboolean video_null_read_render_buffer( unsigned char *target, 47 | render_buffer_t buffer, 48 | int rowstride, int format ) 49 | { 50 | return TRUE; 51 | } 52 | 53 | static void video_null_load_frame_buffer( frame_buffer_t frame, 54 | render_buffer_t buffer ) 55 | { 56 | } 57 | 58 | static void video_null_display_blank( uint32_t colour ) 59 | { 60 | } 61 | 62 | static void video_null_swap_buffers(void) 63 | { 64 | } 65 | 66 | struct display_driver display_null_driver = { 67 | "null", 68 | N_("Null (no video) driver"), 69 | video_null_init, 70 | NULL, 71 | NULL, 72 | NULL, 73 | NULL, 74 | video_null_create_render_buffer, 75 | video_null_destroy_render_buffer, 76 | video_null_set_render_target, 77 | video_null_finish_render, 78 | video_null_load_frame_buffer, 79 | video_null_display_render_buffer, 80 | video_null_display_blank, 81 | video_null_swap_buffers, 82 | video_null_read_render_buffer, 83 | NULL }; 84 | 85 | static gboolean video_null_init( void ) 86 | { 87 | gl_vbo_fallback_init(&display_null_driver); 88 | return TRUE; 89 | } 90 | -------------------------------------------------------------------------------- /android/src/org/lxdream/LxdreamView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id$ 3 | * 4 | * Lxdream GL view. Derived from android 5 | * 6 | * Copyright (c) 2011 Nathan Keynes. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | package org.lxdream; 20 | /* 21 | * Copyright (C) 2008,2009 The Android Open Source Project 22 | * 23 | * Licensed under the Apache License, Version 2.0 (the "License"); 24 | * you may not use this file except in compliance with the License. 25 | * You may obtain a copy of the License at 26 | * 27 | * http://www.apache.org/licenses/LICENSE-2.0 28 | * 29 | * Unless required by applicable law or agreed to in writing, software 30 | * distributed under the License is distributed on an "AS IS" BASIS, 31 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 32 | * See the License for the specific language governing permissions and 33 | * limitations under the License. 34 | */ 35 | 36 | 37 | import android.content.Context; 38 | import android.graphics.PixelFormat; 39 | import android.util.AttributeSet; 40 | import android.util.Log; 41 | import android.view.KeyEvent; 42 | import android.view.MotionEvent; 43 | import android.view.Surface; 44 | import android.view.SurfaceHolder; 45 | import android.view.SurfaceView; 46 | 47 | class LxdreamView extends SurfaceView implements SurfaceHolder.Callback { 48 | private static String TAG = "LxdreamView"; 49 | private static final boolean DEBUG = false; 50 | 51 | public LxdreamView(Context context) { 52 | super(context); 53 | getHolder().addCallback(this); 54 | } 55 | 56 | @Override 57 | public void surfaceCreated( SurfaceHolder holder ) { 58 | /* Ignore */ 59 | } 60 | 61 | @Override 62 | public void surfaceChanged( SurfaceHolder holder, int format, int width, int height ) { 63 | setSurface( holder.getSurface(), width, height ); 64 | } 65 | 66 | @Override 67 | public void surfaceDestroyed( SurfaceHolder holder ) { 68 | clearSurface( holder.getSurface() ); 69 | } 70 | 71 | private native void setSurface( Surface surface, int width, int height ); 72 | private native void clearSurface( Surface surface ); 73 | 74 | } 75 | --------------------------------------------------------------------------------