--- /dev/null
+diff -Nur Frodo.orig/Src/Display_x.i Frodo/Src/Display_x.i
+--- Frodo.orig/Src/Display_x.i Wed Aug 6 20:56:26 1997
++++ Frodo/Src/Display_x.i Fri Jun 15 13:48:00 2001
+@@ -4,6 +4,8 @@
+ *
+ * Frodo (C) 1994-1997 Christian Bauer
+ * X11 stuff by Bernd Schmidt/Lutz Vieweg
++ * Support for visuals >8 bits by Michael Krause
++ * Support for visuals >16 bits by qboosh@pld.org.pl
+ */
+
+ #include "CmdPipe.h"
+@@ -35,7 +37,8 @@
+ static Visual *vis;
+ static XVisualInfo visualInfo;
+ static int bitdepth;
+-static char *bufmem;
++static char *bufmem, *bufmem8;
++static uint32 trans[1<<12];
+ static int hsize;
+
+ // For LED error blinking
+@@ -382,13 +385,10 @@
+
+ screen = XDefaultScreen(display);
+ rootwin = XRootWindow(display, screen);
+-#if 0
+ if (XMatchVisualInfo(display, screen, 16, TrueColor, &visualInfo)) {
++ } else if (XMatchVisualInfo(display, screen, 32, TrueColor, &visualInfo)) {
+ } else if (XMatchVisualInfo(display, screen, 24, TrueColor, &visualInfo)) {
+- } else
+-#endif
+- if (XMatchVisualInfo(display, screen, 8, PseudoColor, &visualInfo)) {
+- /* for our HP boxes */
++ } else if (XMatchVisualInfo(display, screen, 8, PseudoColor, &visualInfo)) {
+ } else if (XMatchVisualInfo(display, screen, 8, GrayScale, &visualInfo)) {
+ } else {
+ fprintf(stderr, "Can't obtain appropriate X visual\n");
+@@ -397,8 +397,8 @@
+
+ vis = visualInfo.visual;
+ bitdepth = visualInfo.depth;
+ pixbytes = (bitdepth == 24 || bitdepth == 32 ? 4 : bitdepth == 12 || bitdepth == 16 ? 2 : 1);
+- fprintf(stderr, "Using %d bit visual\n", bitdepth);
++ fprintf(stderr, "Using %d bit visual%s", bitdepth, bitdepth>8 ? " - please use 8 bits for highest performance!\n" : "\n");
+
+ hsize = (DISPLAY_X + 3) & ~3;
+
+@@ -419,6 +419,10 @@
+ img = XCreateImage(display, vis, bitdepth, ZPixmap, 0, bufmem, hsize, DISPLAY_Y, 32, 0);
+ #endif
+
++ if(bitdepth > 8) {
++ bufmem8 = (char*)malloc(hsize * DISPLAY_Y);
++ }
++
+ cmap = XCreateColormap(display, rootwin, vis, AllocNone);
+
+ XParseColor(display, cmap, "#000000", &black);
+@@ -484,6 +488,32 @@
+ {
+ // Update C64 display
+ XSync(display, 0);
++
++ if(bitdepth == 16) {
++ // Best thing would be to change
++ // VIC.cpp so it could render directly into 16-bit or 32-bit
++ // memory instead of into an 8-bit chunky buffer.
++ uint16 *p = (uint16*)bufmem8, *x = p + hsize*DISPLAY_Y/2;
++ uint32 *d = (uint32*)bufmem;
++ while(p < x) {
++ *d++ = trans[*p++ & 0x0fff];
++ }
++#if 0
++ // Just a plain version. Might be necessary on non-i386
++ // machines?
++ uint8 *p = (uint8*)bufmem8, *x = p + hsize*DISPLAY_Y;
++ uint16 *d = (uint16*)bufmem;
++ while(p < x) {
++ *d++ = eight2sixteen[*p++];
++ }
++#endif
++ } else if(bitdepth >= 24) {
++ uint8 *p = (uint8*)bufmem8, *x = p + hsize*DISPLAY_Y;
++ uint32 *d = (uint32*)bufmem;
++ while(p < x)
++ *d++ = trans[*p++];
++ }
++
+ #if defined(X_USE_SHM)
+ XShmPutImage(display, mywin, black_gc, img, 0, 0, 0, 0, DISPLAY_X, DISPLAY_Y, 0);
+ #else
+@@ -566,7 +605,7 @@
+
+ uint8 *C64Display::BitmapBase(void)
+ {
+- return (uint8 *)bufmem;
++ return (uint8*)(bitdepth>8 ? bufmem8 : bufmem);
+ }
+
+
+@@ -776,14 +815,36 @@
+ int i;
+ XColor col;
+ char str[20];
++ uint32 eight2sixteen[16];
+
+ for (i=0; i< 256; i++) {
++ if(bitdepth == 16) {
++ colors[i] = i & 0x0f;
++ if(i < 16) {
++ eight2sixteen[i] = ((uint16(palette_red[i]) << 8) & 0xf800) | ((uint16(palette_green[i]) << 3) & 0x07e0) | (palette_blue[i] >> 3);
++ }
++ } else if(bitdepth >= 24) {
++ colors[i] = i & 0x0f;
++ if(i < 16)
++ eight2sixteen[i] = (uint32(palette_red[i]) << 16) | (uint32(palette_green[i]) << 8) | palette_blue[i];
++ } else {
+ sprintf(str, "rgb:%x/%x/%x", palette_red[i & 0x0f], palette_green[i & 0x0f], palette_blue[i & 0x0f]);
+ XParseColor(display, cmap, str, &col);
+ if (XAllocColor(display, cmap, &col))
+ colors[i] = col.pixel;
+ else
+ fprintf(stderr, "Couldn't get all colors\n");
++ }
++ }
++
++ if(bitdepth == 16) {
++ // Table to translate two 8-bit src -> two 16-bit dest
++ for(i=0; i<1<<12;i++) {
++ trans[i] = eight2sixteen[i & 0x0f] | (eight2sixteen[i >> 8] << 16);
++ }
++ } else if(bitdepth >= 24) {
++ for(i=0;i<16;i++)
++ trans[i] = eight2sixteen[i];
+ }
+ }
+
--- /dev/null
+--- Frodo.orig/TkGui.tcl Sun Jul 5 14:43:05 1998
++++ Frodo/TkGui.tcl Sun Jul 5 17:17:01 1998
+@@ -1,9 +1,9 @@
+-#!/usr/local/bin/X11/wish
++#!/usr/bin/wish
+
+ # Frodo Tk GUI by Lutz Vieweg <lkv@mania.robin.de>
+ # requires Tk >= 4.1
+
+-package require Tk 4.1
++#package require Tk 4.1
+
+ set prefname "$env(HOME)/.frodorc"
+
--- /dev/null
+--- Frodo/Src/configure.in.orig Tue Feb 27 01:00:16 2001
++++ Frodo/Src/configure.in Tue Feb 27 01:05:46 2001
+@@ -34,14 +34,8 @@
+
+ if [[ "$ac_cv_header_linux_joystick_h" = "yes" ]]; then
+ AC_MSG_CHECKING(whether linux/joystick.h is broken)
+- if grep "#include" /usr/include/linux/joystick.h >/dev/null; then
+- AC_MSG_RESULT(yes)
+- BROKEN_JOYSTICK_H=1
+- grep -v "#include" /usr/include/linux/joystick.h >joystick.h
+- else
+- AC_MSG_RESULT(no)
+- BROKEN_JOYSTICK_H=0
+- fi
++ AC_MSG_RESULT(no)
++ BROKEN_JOYSTICK_H=0
+ fi
+
+ AC_CHECK_SIZEOF(char)
--- /dev/null
+--- Frodo.orig/Src/configure.in Wed Aug 6 20:56:31 1997
++++ Frodo/Src/configure.in Tue Feb 27 00:16:23 2001
+@@ -8,11 +8,6 @@
+ AC_PROG_CPP
+ AC_PROG_MAKE_SET
+
+-dnl Don't want the default "-O -g" that autoconf uses for gcc.
+-if [[ x"$GXX" = "xyes" ]]; then
+- CFLAGS="-O3 -g -fomit-frame-pointer -Wall -Wno-unused -Wno-format -W -Wmissing-prototypes -Wstrict-prototypes"
+-fi
+-
+ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+
+@@ -193,7 +188,7 @@
+
+ if [[ "$HAVEGCC27" = "y" -a "$HAVEI386" = "y" ]]; then
+ # Don't want strength-reduce on the i386, makes the code slower usually.
+- CFLAGS="$CFLAGS -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\""
++ CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regparm(3)))\""
+ else if [[ "$TARGET" = "amigaos" ]]; then
+ CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regargs(4)))\" "
+ else
--- /dev/null
+diff -Nur Frodo.orig/Src/C64_x.i Frodo/Src/C64_x.i
+--- Frodo.orig/Src/C64_x.i Wed Aug 6 20:56:25 1997
++++ Frodo/Src/C64_x.i Tue Feb 27 00:40:21 2001
+@@ -100,7 +100,7 @@
+ gui = 0;
+ #else
+ // try to start up Tk gui.
+- gui = new CmdPipe("wish", "TkGui.tcl");
++ gui = new CmdPipe("/usr/bin/wish", FRODO_HOME "TkGui.tcl");
+ if (gui) {
+ if (gui->fail) {
+ delete gui; gui = 0;
+diff -Nur Frodo.orig/Src/Makefile.in Frodo/Src/Makefile.in
+--- Frodo.orig/Src/Makefile.in Wed Aug 6 20:56:29 1997
++++ Frodo/Src/Makefile.in Tue Feb 27 00:42:07 2001
+@@ -9,7 +9,7 @@
+ CXX = @CXX@
+ CPP = @CPP@
+ LIBRARIES = @LIBRARIES@ @LIBS@
+-CFLAGS = @CFLAGS@ @X_CFLAGS@ -I./ -DBROKEN_JOYSTICK_H=@BROKEN_JOYSTICK_H@ -DFRODO_HPUX_REV=@HPUX_REV@ -DKBD_LANG=@KBD_LANG@
++CFLAGS = @CFLAGS@ @X_CFLAGS@ -I./ -DBROKEN_JOYSTICK_H=@BROKEN_JOYSTICK_H@ -DFRODO_HPUX_REV=@HPUX_REV@ -DKBD_LANG=@KBD_LANG@ -DFRODO_HOME=$(FRODOHOME)
+
+ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+diff -Nur Frodo.orig/Src/Prefs.cpp Frodo/Src/Prefs.cpp
+--- Frodo.orig/Src/Prefs.cpp Wed Aug 6 20:56:29 1997
++++ Frodo/Src/Prefs.cpp Tue Feb 27 00:40:21 2001
+@@ -39,7 +39,7 @@
+ for (int i=0; i<4; i++)
+ DriveType[i] = DRVTYPE_DIR;
+
+- strcpy(DrivePath[0], "64prgs");
++ strcpy(DrivePath[0], FRODO_HOME "64prgs");
+ strcpy(DrivePath[1], "");
+ strcpy(DrivePath[2], "");
+ strcpy(DrivePath[3], "");
+diff -Nur Frodo.orig/Src/main.cpp Frodo/Src/main.cpp
+--- Frodo.orig/Src/main.cpp Wed Aug 6 20:56:31 1997
++++ Frodo/Src/main.cpp Tue Feb 27 00:40:21 2001
+@@ -24,10 +24,10 @@
+ #define CHAR_ROM_FILE "FrodoRsrc:Char_ROM"
+ #define FLOPPY_ROM_FILE "FrodoRsrc:1541_ROM"
+ #else
+-#define BASIC_ROM_FILE "Basic ROM"
+-#define KERNAL_ROM_FILE "Kernal ROM"
+-#define CHAR_ROM_FILE "Char ROM"
+-#define FLOPPY_ROM_FILE "1541 ROM"
++#define BASIC_ROM_FILE FRODO_HOME "Basic ROM"
++#define KERNAL_ROM_FILE FRODO_HOME "Kernal ROM"
++#define CHAR_ROM_FILE FRODO_HOME "Char ROM"
++#define FLOPPY_ROM_FILE FRODO_HOME "1541 ROM"
+ #endif
+
+
--- /dev/null
+Summary: Commodore 64 emulator
+Summary(pl): Emulator Commodore 64
+Name: Frodo
+Version: 4.1a
+Release: 2
+License: Noncommercial
+Group: Applications/Emulators
+Group(de): Applikationen/Emulators
+Group(pl): Aplikacje/Emulatory
+Source0: http://iphcip1.physik.uni-mainz.de/~cbauer/%{name}V4_1a.Src.tar.gz
+Patch0: %{name}-16+bpp.patch
+Patch1: %{name}-TkGui.patch
+Patch2: %{name}-paths.patch
+Patch3: %{name}-opt.patch
+Patch4: %{name}-joy.patch
+URL: http://www.uni-mainz.de/~bauec002/FRMain.html
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+BuildRequires: XFree86-devel
+BuildRequires: libstdc++-devel
+BuildRequires: autoconf
+Requires: tk
+
+%define _prefix /usr/X11R6
+%define _mandir %{_prefix}/man
+
+%description
+Frodo V4.1 is a free, portable C64 emulator for BeOS, Unix, MacOS,
+AmigaOS, RiscOS and WinNT/95 systems.
+
+Some of the emulation's features:
+
+This emulator focuses on the exact reproduction of special graphical
+effects possible on the C64, and has therefore relatively high system
+requirements. It should only be run on systems with at least a
+PowerPC/Pentium/68060. Frodo is capable of running most games and
+demos correctly, even those with FLI, FLD, DYCP, open borders,
+multiplexed sprites, timing dependent decoders, fast loaders etc. 6510
+emulation: All undocumented opcodes, 100 percent correct decimal mode,
+instruction/cycle exact emulation. VIC emulation: Line-/cycle-based
+emulation, all display modes, sprites with collisions/priorities, DMA
+cycles, open borders, all $d011/$d016 effects. SID emulation:
+Real-time digital emulation (16 bit, 44.1kHz), including filters (only
+under BeOS, Linux, HP-UX, MacOS and AmigaOS). 1541 emulation: Drive
+simulation in directories, .d64/x64 or .t64/LYNX files, or
+processor-level 1541 emulation that works with about 95 percent of all
+fast loaders and even some copy protection schemes. Other peripherals:
+Keyboard and joystick (real joysticks (only under BeOS, Linux and
+AmigaOS) or keyboard emulation). The full source code in C++ is
+available. Frodo is freeware. Why pay >$40 for a C64 emulator?
+
+%description -l pl
+Frodo jest darmowym, przeno¶nym emulatorem C64 dla BeOS, uniksów, MacOS,
+AmigaOS, RiscOS i WinNT/Win9x.
+
+%prep
+%setup -q -n Frodo
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+
+%build
+cd Src
+autoconf
+CFLAGS="%{rpmcflags} %{!?debug:-fomit-frame-pointer}"
+CFLAGS="$CFLAGS -DX_USE_SHM -fno-exceptions -fno-rtti -fno-implicit-templates"
+%configure
+%{__make} all FRODOHOME="\\\"%{_libdir}/Frodo/\\\""
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_libdir}/Frodo/{64prgs,64imgs},%{_bindir}}
+install Src/Frodo Src/FrodoPC Src/FrodoSC $RPM_BUILD_ROOT%{_bindir}
+install TkGui.tcl "Frodo Logo" $RPM_BUILD_ROOT%{_libdir}/Frodo
+install "1541 ROM" "Basic ROM" "Char ROM" "Kernal ROM" $RPM_BUILD_ROOT%{_libdir}/Frodo
+install 64prgs/* $RPM_BUILD_ROOT%{_libdir}/Frodo/64prgs
+
+gzip -9nf CHANGES
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc *.gz Docs/*
+%{_libdir}/Frodo
+%attr(755,root,root) %{_bindir}/*