diff --git a/Makefile.psp b/Makefile.psp
index f1602a2..bed2d13 100644
--- a/Makefile.psp
+++ b/Makefile.psp
@@ -14,16 +14,20 @@ EXTRA_TARGETS=EBOOT.PBP
 PSP_EBOOT_TITLE=$(PSP_APP_NAME) $(PSP_APP_VER)
 PSP_EBOOT_ICON=$(PSPAPP)/potator-icon.png
 
+POTAROOT=common
+
 BUILD_EMUL=\
- common/controls.o \
- common/gpu.o \
- common/memorymap.o \
- common/sound.o \
- common/timer.o \
- common/watara.o \
- common/m6502/m6502.o
-BUILD_PORT=$(PSPAPP)/emulate.o \
-           $(PSPAPP)/main.o $(PSPAPP)/menu.o
+ $(POTAROOT)/controls.o \
+ $(POTAROOT)/gpu.o \
+ $(POTAROOT)/memorymap.o \
+ $(POTAROOT)/sound.o \
+ $(POTAROOT)/timer.o \
+ $(POTAROOT)/watara.o \
+ $(POTAROOT)/m6502/m6502.o
+BUILD_PORT=\
+ $(PSPAPP)/emulate.o \
+ $(PSPAPP)/menu.o \
+ $(PSPAPP)/main.o
 
 OBJS=$(BUILD_EMUL) $(BUILD_PORT)
 
@@ -33,7 +37,7 @@ BASE_DEFS=-DPSP -DPSP_APP_VER=\"$(PSP_APP_VER)\" -DPSP_APP_NAME="\"$(PSP_APP_NAM
 CFLAGS=-O2 -G0 -Wall $(BASE_DEFS) $(DEFINES)
 CXXFLAGS=$(CFLAGS) -fno-exceptions -fno-rtti
 ASFLAGS=$(CFLAGS)
-INCDIR=$(PSPLIB) $(MZLIB) $(PSPAPP) common/m6502 common
+INCDIR=$(PSPLIB) $(MZLIB) $(PSPAPP) $(POTAROOT)/m6502 $(POTAROOT)
 LIBDIR=$(PSPLIB) $(MZLIB)
 LIBS=-lpsplib -lpng -lpspgu -lpsppower -lminizip \
      -lz -lm -lc -lpspaudio -lpsprtc -lpspwlan -lpspnet_adhoc \
diff --git a/PSP/controls.cpp b/PSP/controls.cpp
deleted file mode 100644
index a1447d8..0000000
--- a/PSP/controls.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "controls.h"
-
-uint8 controls_state;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void controls_init()
-{
-	fprintf(log_get(), "controls: init\n");
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void controls_done()
-{
-	fprintf(log_get(), "controls: done\n");
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void controls_reset()
-{
-	fprintf(log_get(), "controls: reset\n");
-	controls_state = 0x00;
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void controls_write(uint32 addr, uint8 data)
-{
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-uint8 controls_read(uint32 addr)
-{
-	return(controls_state^0xff); 
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-bool controls_update(void)
-{
-	return(true);
-}
diff --git a/PSP/controls.h b/PSP/controls.h
deleted file mode 100644
index 9a543ce..0000000
--- a/PSP/controls.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __CONTROLS_H__
-#define __CONTROLS_H__
-
-#include "supervision.h"
-
-void controls_init();
-void controls_done();
-void controls_reset();
-void controls_write(uint32 addr, uint8 data);
-uint8 controls_read(uint32 addr);
-bool controls_update(void);
-
-#endif
diff --git a/PSP/minizip/unzip.c b/PSP/minizip/unzip.c
index 9ad4766..ace7a08 100644
--- a/PSP/minizip/unzip.c
+++ b/PSP/minizip/unzip.c
@@ -607,11 +607,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
 
 
     /* we check the magic */
-    if (err==UNZ_OK)
+    if (err==UNZ_OK) {
         if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
             err=UNZ_ERRNO;
         else if (uMagic!=0x02014b50)
             err=UNZ_BADZIPFILE;
+    }
 
     if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
         err=UNZ_ERRNO;
@@ -687,11 +688,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
         else
             uSizeRead = extraFieldBufferSize;
 
-        if (lSeek!=0)
+        if (lSeek!=0) {
             if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
                 lSeek=0;
             else
                 err=UNZ_ERRNO;
+        }
         if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
             if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
                 err=UNZ_ERRNO;
@@ -712,11 +714,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
         else
             uSizeRead = commentBufferSize;
 
-        if (lSeek!=0)
+        if (lSeek!=0) {
             if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
                 lSeek=0;
             else
                 err=UNZ_ERRNO;
+        }
         if ((file_info.size_file_comment>0) && (commentBufferSize>0))
             if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
                 err=UNZ_ERRNO;
@@ -976,11 +979,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
         return UNZ_ERRNO;
 
 
-    if (err==UNZ_OK)
+    if (err==UNZ_OK) {
         if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
             err=UNZ_ERRNO;
         else if (uMagic!=0x04034b50)
             err=UNZ_BADZIPFILE;
+    }
 
     if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
         err=UNZ_ERRNO;
@@ -1534,7 +1538,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
     char *szComment;
     uLong uSizeBuf;
 {
-    int err=UNZ_OK;
     unz_s* s;
     uLong uReadThis ;
     if (file==NULL)
diff --git a/PSP/psplib/pl_file.c b/PSP/psplib/pl_file.c
index be94278..6ebe844 100644
--- a/PSP/psplib/pl_file.c
+++ b/PSP/psplib/pl_file.c
@@ -260,7 +260,7 @@ static void sort_file_list(pl_file_list *list,
 
   /* Copy the file entries to an array */
   files = (pl_file**)malloc(sizeof(pl_file*) * count);
-  for (file = list->files, fp = files; file; file = file->next, i++, fp++)
+  for (file = list->files, fp = files; file; file = file->next, fp++)
     *fp = file;
 
   /* Sort the array */
diff --git a/PSP/psplib/pl_gfx.c b/PSP/psplib/pl_gfx.c
index cd59066..6d32c5d 100644
--- a/PSP/psplib/pl_gfx.c
+++ b/PSP/psplib/pl_gfx.c
@@ -189,12 +189,12 @@ void pl_video_put_image(const pl_image *image,
   sceGuTexFilter(GU_LINEAR, GU_LINEAR);
 
   pl_gfx_vertex *vertices;
-  int start, end, sc_end, slsz_scaled;
+  int start, end, /*sc_end,*/ slsz_scaled;
   slsz_scaled = ceil((float)dw * (float)SLICE_SIZE) / (float)image->view.w;
 
   start = image->view.x;
   end = image->view.x + image->view.w;
-  sc_end = dx + dw;
+  /*sc_end = dx + dw;*/
 
   for (; start < end; start += SLICE_SIZE, dx += slsz_scaled)
   {
diff --git a/PSP/psplib/pl_image.c b/PSP/psplib/pl_image.c
index bbf8c86..adb5ae9 100644
--- a/PSP/psplib/pl_image.c
+++ b/PSP/psplib/pl_image.c
@@ -375,7 +375,7 @@ int pl_image_save_png_stream(const pl_image *image,
   int height = image->view.h;
   int bytes_per_pixel = pl_image_get_bytes_per_pixel(image->format);
   void *line_ptr, *pel_ptr;
-  uint32_t color;
+  uint32_t color = 0;
 
   if (!(bitmap = (u8*)malloc(sizeof(u8) * width * height * 3)))
     return 0;
@@ -558,7 +558,7 @@ int pl_image_create_thumbnail(const pl_image *original,
   }
 
   int x, y;
-  uint32_t color;
+  uint32_t color = 0;
   uint bytes_per_pixel =
     pl_image_get_bytes_per_pixel(original->format);
   void *slp = original->bitmap + original->view.y * original->pitch;
diff --git a/PSP/psplib/pl_ini.c b/PSP/psplib/pl_ini.c
index c8d58e2..ea96b22 100644
--- a/PSP/psplib/pl_ini.c
+++ b/PSP/psplib/pl_ini.c
@@ -71,7 +71,7 @@ int pl_ini_load(pl_ini_file *file,
     return 0;
 
   pl_ini_section *current_section = NULL;
-  pl_ini_pair *tail;
+  pl_ini_pair *tail = NULL;
 
   char string[PL_MAX_LINE_LENGTH],
        name[PL_MAX_LINE_LENGTH];
@@ -79,9 +79,6 @@ int pl_ini_load(pl_ini_file *file,
   int len;
 
   /* Create unnamed section */
-  current_section = NULL;
-  tail = NULL;
-
   while(!feof(stream) && fgets(string, sizeof(string), stream))
   {
     /* TODO: Skip whitespace */
diff --git a/PSP/psplib/pl_snd.c b/PSP/psplib/pl_snd.c
index 3704efa..42b45df 100644
--- a/PSP/psplib/pl_snd.c
+++ b/PSP/psplib/pl_snd.c
@@ -313,7 +313,7 @@ static unsigned int get_bytes_per_sample(int channel)
 
 int pl_snd_pause(int channel)
 {
-  if (channel < 0 || channel > AUDIO_CHANNELS)
+  if (channel < 0 || channel >= AUDIO_CHANNELS)
     return 0;
   sound_stream[channel].paused = 1;
   return 1;
@@ -321,7 +321,7 @@ int pl_snd_pause(int channel)
 
 int pl_snd_resume(int channel)
 {
-  if (channel < 0 || channel > AUDIO_CHANNELS)
+  if (channel < 0 || channel >= AUDIO_CHANNELS)
     return 0;
   sound_stream[channel].paused = 0;
   return 1;
diff --git a/PSP/psplib/pl_vk.c b/PSP/psplib/pl_vk.c
index dc37836..0ec2ffc 100644
--- a/PSP/psplib/pl_vk.c
+++ b/PSP/psplib/pl_vk.c
@@ -108,11 +108,11 @@ int pl_vk_load(pl_vk_layout *layout,
     return 0;
   }
 
-  int code;
+  uint32_t code;
   uint16_t x, y, w, h;
 
   /* Determine button count */
-  while ((fscanf(file, "0x%x\t%hi\t%hi\t%hi\t%hi\n",
+  while ((fscanf(file, "0x%x\t%hu\t%hu\t%hu\t%hu\n",
                 &code, &x, &y, &w, &h) == 5) && code)
     layout->key_count++;
 
@@ -132,7 +132,7 @@ int pl_vk_load(pl_vk_layout *layout,
   pl_vk_button *button;
   for (i = 0, button = layout->keys; i < layout->key_count; i++, button++)
   {
-    if (fscanf(file, "0x%x\t%hi\t%hi\t%hi\t%hi\n",
+    if (fscanf(file, "0x%x\t%hu\t%hu\t%hu\t%hu\n",
                &code, &x, &y, &w, &h) < 5)
     {
       fclose(file);
@@ -149,7 +149,7 @@ int pl_vk_load(pl_vk_layout *layout,
   }
 
   /* "Swallow" last record */
-  fscanf(file, "0x%x\t%hi\t%hi\t%hi\t%hi\n",
+  fscanf(file, "0x%x\t%hu\t%hu\t%hu\t%hu\n",
          &code, &x, &y, &w, &h);
 
   /* Determine sticky count */
@@ -224,7 +224,7 @@ int pl_vk_load(pl_vk_layout *layout,
   fscanf(file, "0x%x\t", &code);
 
   /* Read the offsets */
-  if (fscanf(file, "%hi\t%hi\n", 
+  if (fscanf(file, "%hu\t%hu\n", 
              &layout->offset_x, &layout->offset_y) < 2)
   {
     fclose(file);
diff --git a/PSP/psplib/ui.c b/PSP/psplib/ui.c
index c2a7768..eaa9f96 100644
--- a/PSP/psplib/ui.c
+++ b/PSP/psplib/ui.c
@@ -93,7 +93,7 @@ struct AdhocMatchEvent
   int NewEvent;
   int EventID;
   PspMAC EventMAC;
-  PspMAC CurrentMAC;
+  PspMAC CurrentMAC; /* is never used */
   char OptData[512];
 };
 
diff --git a/PSP/psplib/video.c b/PSP/psplib/video.c
index 8fd1e79..381ae2f 100644
--- a/PSP/psplib/video.c
+++ b/PSP/psplib/video.c
@@ -253,12 +253,12 @@ void pspVideoPutImage(const PspImage *image, int dx, int dy, int dw, int dh)
     sceGuTexFilter(GU_LINEAR, GU_LINEAR);
  
     struct TexVertex* vertices;
-    int start, end, sc_end, slsz_scaled;
+    int start, end, /*sc_end,*/ slsz_scaled;
     slsz_scaled = ceil((float)dw * (float)SLICE_SIZE) / (float)image->Viewport.Width;
 
     start = image->Viewport.X;
     end = image->Viewport.X + image->Viewport.Width;
-    sc_end = dx + dw;
+    /*sc_end = dx + dw;*/
 
     /* TODO: Convert to floating-point coords */
     for (; start < end; start += SLICE_SIZE, dx += slsz_scaled)
@@ -340,12 +340,12 @@ void pspVideoPutImageAlpha(const PspImage *image, int dx, int dy, int dw, int dh
     sceGuTexFilter(GU_LINEAR, GU_LINEAR);
  
     struct TexVertex* vertices;
-    int start, end, sc_end, slsz_scaled;
+    int start, end, /*sc_end,*/ slsz_scaled;
     slsz_scaled = ceil((float)dw * (float)SLICE_SIZE) / (float)image->Viewport.Width;
 
     start = image->Viewport.X;
     end = image->Viewport.X + image->Viewport.Width;
-    sc_end = dx + dw;
+    /*sc_end = dx + dw;*/
 
     /* TODO: Convert to floating-point coords */
     for (; start < end; start += SLICE_SIZE, dx += slsz_scaled)
diff --git a/PSP/sfifo.c b/PSP/sfifo.c
deleted file mode 100644
index 220228e..0000000
--- a/PSP/sfifo.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-------------------------------------------------------------
-	SFIFO 1.3
-------------------------------------------------------------
- * Simple portable lock-free FIFO
- * (c) 2000-2002, David Olofson
- * Released under the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
-
- * Modifications by Philip Kendall (c) 2007
- * This modified version is released under the GNU GENERAL PUBLIC LICENSE
- * version 2, or any later version
------------------------------------------------------------
-TODO:
-	* Is there a way to avoid losing one byte of buffer
-	  space to avoid extra variables or locking?
-
-	* Test more compilers and environments.
------------------------------------------------------------
- */
-
-#ifdef __KERNEL__
-#	include	<linux/string.h>
-#	include	<asm/uaccess.h>
-#	include	<linux/malloc.h>
-#	define	malloc(x)	kmalloc(x, GFP_KERNEL)
-#	define	free(x, y)	kfree_s(x, y)
-#else
-#	include	<string.h>
-#	include	<stdlib.h>
-#	define	free(x, y)	free(x)
-#endif
-
-#include "sfifo.h"
-
-#ifdef _SFIFO_TEST_
-#include <stdio.h>
-#include <unistd.h>
-#include <pthread.h>
-#define DBG(x)	/*(x)*/
-#define TEST_BUFSIZE	10
-#else
-#define DBG(x)
-#endif
-
-
-/*
- * Alloc buffer, init FIFO etc...
- */
-int sfifo_init(sfifo_t *f, int size)
-{
-	memset(f, 0, sizeof(sfifo_t));
-
-	if(size > SFIFO_MAX_BUFFER_SIZE)
-		return -EINVAL;
-
-	/*
-	 * Set sufficient power-of-2 size.
-	 *
-	 * No, there's no bug. If you need
-	 * room for N bytes, the buffer must
-	 * be at least N+1 bytes. (The fifo
-	 * can't tell 'empty' from 'full'
-	 * without unsafe index manipulations
-	 * otherwise.)
-	 */
-	f->size = 1;
-	for(; f->size <= size; f->size <<= 1)
-		;
-
-	/* Get buffer */
-	if( 0 == (f->buffer = malloc(f->size)) )
-		return -ENOMEM;
-
-	return 0;
-}
-
-/*
- * Dealloc buffer etc...
- */
-void sfifo_close(sfifo_t *f)
-{
-	if(f->buffer)
-		free(f->buffer, f->size);
-}
-
-/*
- * Empty FIFO buffer
- */
-void sfifo_flush(sfifo_t *f)
-{
-	/* Reset positions */
-	f->readpos = 0;
-	f->writepos = 0;
-}
-
-/*
- * Write bytes to a FIFO
- * Return number of bytes written, or an error code
- */
-int sfifo_write(sfifo_t *f, const void *_buf, int len)
-{
-	int total;
-	int i;
-	const char *buf = (const char *)_buf;
-
-	if(!f->buffer)
-		return -ENODEV;	/* No buffer! */
-
-	/* total = len = min(space, len) */
-	total = sfifo_space(f);
-	DBG(printf("sfifo_space() = %d\n",total));
-	if(len > total)
-		len = total;
-	else
-		total = len;
-
-	i = f->writepos;
-	if(i + len > f->size)
-	{
-		memcpy(f->buffer + i, buf, f->size - i);
-		buf += f->size - i;
-		len -= f->size - i;
-		i = 0;
-	}
-	memcpy(f->buffer + i, buf, len);
-	f->writepos = i + len;
-
-	return total;
-}
-
-#ifdef __KERNEL__
-/*
- * Write bytes to a FIFO from a user space buffer
- * Return number of bytes written, or an error code
- */
-int sfifo_write_user(sfifo_t *f, const void *buf, int len)
-{
-	int total;
-	int i;
-
-	if(!f->buffer)
-		return -ENODEV;	/* No buffer! */
-
-	/* total = len = min(space, len) */
-	total = sfifo_space(f);
-	if(len > total)
-		len = total;
-	else
-		total = len;
-
-	i = f->writepos;
-	if(i + len > f->size)
-	{
-		if(f->size - i)
-		{
-			if(copy_from_user(f->buffer + i, buf, f->size - i))
-				return -EFAULT;
-			buf += f->size - i;
-			len -= f->size - i;
-		}
-		i = 0;
-	}
-	if(copy_from_user(f->buffer + i, buf, len))
-		return -EFAULT;
-	f->writepos = i + len;
-
-	return total;
-}
-#endif
-
-/*
- * Read bytes from a FIFO
- * Return number of bytes read, or an error code
- */
-int sfifo_read(sfifo_t *f, void *_buf, int len)
-{
-	int total;
-	int i;
-	char *buf = (char *)_buf;
-
-	if(!f->buffer)
-		return -ENODEV;	/* No buffer! */
-
-	/* total = len = min(used, len) */
-	total = sfifo_used(f);
-	DBG(printf("sfifo_used() = %d\n",total));
-	if(len > total)
-		len = total;
-	else
-		total = len;
-
-	i = f->readpos;
-	if(i + len > f->size)
-	{
-		memcpy(buf, f->buffer + i, f->size - i);
-		buf += f->size - i;
-		len -= f->size - i;
-		i = 0;
-	}
-	memcpy(buf, f->buffer + i, len);
-	f->readpos = i + len;
-
-	return total;
-}
-
-#ifdef __KERNEL__
-/*
- * Read bytes from a FIFO into a user space buffer
- * Return number of bytes read, or an error code
- */
-int sfifo_read_user(sfifo_t *f, void *buf, int len)
-{
-	int total;
-	int i;
-
-	if(!f->buffer)
-		return -ENODEV;	/* No buffer! */
-
-	/* total = len = min(used, len) */
-	total = sfifo_used(f);
-	if(len > total)
-		len = total;
-	else
-		total = len;
-
-	i = f->readpos;
-	if(i + len > f->size)
-	{
-		if(f->size - i)
-		{
-			if(copy_to_user(buf, f->buffer + i, f->size - i))
-				return -EFAULT;
-			buf += f->size - i;
-			len -= f->size - i;
-		}
-		i = 0;
-	}
-	if(copy_to_user(buf, f->buffer + i, len))
-		return -EFAULT;
-	f->readpos = i + len;
-
-	return total;
-}
-#endif
-
-#ifdef _SFIFO_TEST_
-void *sender(void *arg)
-{
-	char buf[TEST_BUFSIZE*2];
-	int i,j;
-	int cnt = 0;
-	int res;
-	sfifo_t *sf = (sfifo_t *)arg;
-	while(1)
-	{
-		j = sfifo_space(sf);
-		for(i = 0; i < j; ++i)
-		{
-			++cnt;
-			buf[i] = cnt;
-		}
-		res = sfifo_write(sf, &buf, j);
-		if(res != j)
-		{
-			printf("Write failed!\n");
-			sleep(1);
-		} else if(res)
-			printf("Wrote %d\n", res);
-	}
-}
-int main()
-{
-	sfifo_t sf;
-	char last = 0;
-	pthread_t thread;
-	char buf[100] = "---------------------------------------";
-
-	printf("sfifo_init(&sf, %d) = %d\n",
-			TEST_BUFSIZE, sfifo_init(&sf, TEST_BUFSIZE)
-		);
-
-#if 0
-	printf("sfifo_write(&sf,\"0123456789\",7) = %d\n",
-		sfifo_write(&sf,"0123456789",7) );
-
-	printf("sfifo_write(&sf,\"abcdefghij\",7) = %d\n",
-		sfifo_write(&sf,"abcdefghij",7) );
-
-	printf("sfifo_read(&sf,buf,8) = %d\n",
-		sfifo_read(&sf,buf,8) );
-
-	buf[20] = 0;
-	printf("buf =\"%s\"\n",buf);
-
-	printf("sfifo_write(&sf,\"0123456789\",7) = %d\n",
-		sfifo_write(&sf,"0123456789",7) );
-
-	printf("sfifo_read(&sf,buf,10) = %d\n",
-		sfifo_read(&sf,buf,10) );
-
-	buf[20] = 0;
-	printf("buf =\"%s\"\n",buf);
-#else
-	pthread_create(&thread, NULL, sender, &sf);
-
-	while(1)
-	{
-		static int c = 0;
-		++last;
-		while( sfifo_read(&sf,buf,1) != 1 )
-			/*sleep(1)*/;
-		if(last != buf[0])
-		{
-			printf("Error %d!\n", buf[0]-last);
-			last = buf[0];
-		}
-		else
-			printf("Ok. (%d)\n",++c);
-	}
-#endif
-
-	sfifo_close(&sf);
-	printf("sfifo_close(&sf)\n");
-
-	return 0;
-}
-
-#endif
diff --git a/PSP/sfifo.h b/PSP/sfifo.h
deleted file mode 100644
index fb12741..0000000
--- a/PSP/sfifo.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-------------------------------------------------------------
-	SFIFO 1.3
-------------------------------------------------------------
- * Simple portable lock-free FIFO
- * (c) 2000-2002, David Olofson
- * Released under the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
- *
- * Platform support:
- *	gcc / Linux / x86:		Works
- *	gcc / Linux / x86 kernel:	Works
- *	gcc / FreeBSD / x86:		Works
- *	gcc / NetBSD / x86:		Works
- *	gcc / Mac OS X / PPC:		Works
- *	gcc / Win32 / x86:		Works
- *	Borland C++ / DOS / x86RM:	Works
- *	Borland C++ / Win32 / x86PM16:	Untested
- *	? / Various Un*ces / ?:		Untested
- *	? / Mac OS / PPC:		Untested
- *	gcc / BeOS / x86:		Untested
- *	gcc / BeOS / PPC:		Untested
- *	? / ? / Alpha:			Untested
- *
- * 1.2: Max buffer size halved, to avoid problems with
- *	the sign bit...
- *
- * 1.3:	Critical buffer allocation bug fixed! For certain
- *	requested buffer sizes, older version would
- *	allocate a buffer of insufficient size, which
- *	would result in memory thrashing. (Amazing that
- *	I've manage to use this to the extent I have
- *	without running into this... *heh*)
- */
-
-#ifndef	_SFIFO_H_
-#define	_SFIFO_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <errno.h>
-
-/*------------------------------------------------
-	"Private" stuff
-------------------------------------------------*/
-/*
- * Porting note:
- *	Reads and writes of a variable of this type in memory
- *	must be *atomic*! 'int' is *not* atomic on all platforms.
- *	A safe type should be used, and  sfifo should limit the
- *	maximum buffer size accordingly.
- */
-typedef int sfifo_atomic_t;
-#ifdef __TURBOC__
-#	define	SFIFO_MAX_BUFFER_SIZE	0x7fff
-#else /* Kludge: Assume 32 bit platform */
-#	define	SFIFO_MAX_BUFFER_SIZE	0x7fffffff
-#endif
-
-typedef struct sfifo_t
-{
-	char *buffer;
-	int size;			/* Number of bytes */
-	sfifo_atomic_t readpos;		/* Read position */
-	sfifo_atomic_t writepos;	/* Write position */
-} sfifo_t;
-
-#define SFIFO_SIZEMASK(x)	((x)->size - 1)
-
-
-/*------------------------------------------------
-	API
-------------------------------------------------*/
-int sfifo_init(sfifo_t *f, int size);
-void sfifo_close(sfifo_t *f);
-void sfifo_flush(sfifo_t *f);
-int sfifo_write(sfifo_t *f, const void *buf, int len);
-int sfifo_read(sfifo_t *f, void *buf, int len);
-#define sfifo_used(x)	(((x)->writepos - (x)->readpos) & SFIFO_SIZEMASK(x))
-#define sfifo_space(x)	((x)->size - 1 - sfifo_used(x))
-
-
-/*------------------------------------------------
-	Linux kernel space interface
-------------------------------------------------*/
-#ifdef __KERNEL__
-int sfifo_write_user(sfifo_t *f, const void *buf, int len);
-int sfifo_read_user(sfifo_t *f, void *buf, int len);
-#else
-#	define	sfifo_write_user	sfifo_write
-#	define	sfifo_read_user		sfifo_read
-#endif
-
-#ifdef __cplusplus
-};
-#endif
-#endif
diff --git a/PSP/sound.cpp b/PSP/sound.cpp
deleted file mode 100644
index 31e0658..0000000
--- a/PSP/sound.cpp
+++ /dev/null
@@ -1,655 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-#include "sound.h"
-#include <math.h>
-#include <string.h>
-
-
-static uint8    sound_regs[2][4];
-static uint32   sound_channel_size[2];
-static uint32	sound_channel_pos[2];
-
-static int16    *sound_buffers[2];
-static uint8    audioDma_regs[8];
-
-#define BPS			22050
-#define BPSMAX		AUDIO_MAX_FREQUENCY
-#define BPSMIN		AUDIO_MIN_FREQUENCY
-#define BUFSIZE		BPS
-#define POFF		128
-#define PDIV		3
-#define PH			POFF+PDIV*8
-#define PL			POFF-PDIV*7
-
-/*
-AUDIOINFO	audio_info;
-AUDIOCAPS	audio_caps;
-HAC			audio_FmVoice[2];
-AUDIOWAVE	audio_FmWave[2];
-HAC			audio_NoiseVoice;
-AUDIOWAVE   audio_NoiseWave;
-HAC			audio_AudioDmaVoice;
-AUDIOWAVE   audio_AudioDmaWave;
-*/
-bool		audio_FmVoicePlaying[2];
-bool        audio_NoiseVoicePlaying;
-bool        audio_AudioDmaVoicePlaying;
-
-bool		audio_FmVoicePlayingOld[2];
-bool        audio_NoiseVoicePlayingOld;
-bool        audio_AudioDmaVoicePlayingOld;
-
-uint8       RandData[BUFSIZE];
-unsigned int audio_mrand(unsigned int Degree);
-
-const long TblChVol[16]={				// n/15 n=0~15
-	-10000,-2352,-1750,-1398,-1148,-954,-796,-662,
-    -546,-444,-352,-269,-194,-124,-60,0
-};
-
-void audio_NoiseVoiceFreq(int freq, int volume)
-{
-    for(int j=0;j<(BUFSIZE);j++)
-		RandData[j] = ((audio_mrand(15)*volume)/127);
-
-	memcpy(audio_NoiseWave.lpData,		RandData, audio_NoiseWave.dwLength);
-//	AWriteAudioData(&audio_NoiseWave,	0, audio_NoiseWave.dwLength);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_FmVoicePlay(int channel, bool bPlay)
-{
-	if (audio_FmVoicePlaying[channel] == bPlay)
-		return;
-
-	audio_FmVoicePlaying[channel] = bPlay;
-
-	if (bPlay)
-//		APlayVoice(audio_FmVoice[channel], &audio_FmWave[channel]);
-	else
-//		AStopVoice(audio_FmVoice[channel]);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_FmVoiceFreq(int channel, int freq, int volume)
-{
-	int size;
-
-	volume = (127*volume)/15;
-
-	//fprintf(log_get()," volume: %i\n", volume);
-	if (freq==0)
-	{
-		audio_FmVoicePlay(channel, false);
-		return;
-	}
-	size = (BUFSIZE/freq);
-	
-	if (size == 0)
-	{
-		audio_FmVoicePlay(channel, false);
-		return;
-	}
-
-    for(int j=0;j<(BUFSIZE);j++)
-	{
-		RandData[j] = (((uint32)(((j%size)<(size>>1))?127:-128))*volume)/127;
-//		RandData[j] = (char)(127.0f*sin((((float)j)*((float)freq)*2*3.14159)/((float)BUFSIZE)));
-	}
-	memcpy(audio_FmWave[channel].lpData,		RandData, audio_FmWave[channel].dwLength);
-//	AWriteAudioData(&audio_FmWave[channel],	0, audio_FmWave[channel].dwLength);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_AudioDmaSetSample(uint32 offset, uint32 length, uint32 freq, uint32 cartSpace)
-{
-	float scale = ((float)freq)/((float)audio_AudioDmaWave.dwLength);
-
-	for (int i = 0; i < audio_AudioDmaWave.dwLength; i++)
-	{
-		int16 data;
-
-		int offs = ((i>>1)*scale);
-		if (offs>= (length>>1))
-			data =0;
-		else
-			data = (cartSpace)?(memorymap_getRomPointer()[offset + offs]):Rd6502(offset + offs);
-		
-		if (i&0x01)
-			data = ((data>>4)-8)*8;
-		else
-			data = ((data&0x0f)-8)*8;
-
-		RandData[i] = (char)(data);
-	}
-	memcpy(audio_AudioDmaWave.lpData, RandData, audio_AudioDmaWave.dwLength);
-//	AWriteAudioData(&audio_AudioDmaWave,	0, audio_AudioDmaWave.dwLength);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_NoiseVoiceVolume(int volume)
-{
-//	ASetVoiceVolume(audio_NoiseVoice, TblChVol[volume]);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_AudioDmaVoiceVolume(int volume)
-{
-//	ASetVoiceVolume(audio_AudioDmaVoice, TblChVol[volume]);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_NoiseVoicePlay(bool bPlay)
-{
-	if (audio_NoiseVoicePlaying == bPlay)
-		return;
-
-	audio_NoiseVoicePlaying = bPlay;
-
-	if (bPlay)
-;//		APlayVoice(audio_NoiseVoice, &audio_NoiseWave);
-	else
-;//		AStopVoice(audio_NoiseVoice);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_AudioDmaVoicePlay(bool bPlay)
-{
-	if (audio_AudioDmaVoicePlaying == bPlay)
-		return;
-
-	audio_AudioDmaVoicePlaying = bPlay;
-
-	if (bPlay)
-;//		APlayVoice(audio_AudioDmaVoice, &audio_AudioDmaWave);
-	else
-;//		AStopVoice(audio_AudioDmaVoice);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_FmVoiceVolume(int channel, int volume)
-{
-//	ASetVoiceVolume(audio_FmVoice[channel], TblChVol[volume]);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_turnSound(bool bOn)
-{
-	if (bOn)
-	{
-		audio_FmVoicePlay(0, audio_FmVoicePlayingOld[0]);
-		audio_FmVoicePlay(1, audio_FmVoicePlayingOld[1]);
-		audio_NoiseVoicePlay(audio_NoiseVoicePlayingOld);
-		audio_AudioDmaVoicePlay(audio_AudioDmaVoicePlayingOld);
-	} 
-	else
-	{
-		audio_FmVoicePlayingOld[0] = audio_FmVoicePlaying[0];
-		audio_FmVoicePlayingOld[1] = audio_FmVoicePlaying[1];
-		audio_NoiseVoicePlayingOld = audio_NoiseVoicePlaying;
-		audio_AudioDmaVoicePlayingOld = audio_AudioDmaVoicePlaying;
-		audio_FmVoicePlay(0, false);
-		audio_FmVoicePlay(1, false);
-		audio_NoiseVoicePlay(false);
-		audio_AudioDmaVoicePlay(false);
-	}
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-unsigned int audio_mrand(unsigned int Degree)
-{
-#define BIT(n) (1<<n)
-	typedef struct {
-		unsigned int N;
-    	int InputBit;
-    	int Mask;
-	} POLYNOMIAL;
-
-	static POLYNOMIAL TblMask[]=
-	{
-		{ 2,BIT(2) ,BIT(0)|BIT(1)},
-		{ 3,BIT(3) ,BIT(0)|BIT(1)},
-		{ 4,BIT(4) ,BIT(0)|BIT(1)},
-		{ 5,BIT(5) ,BIT(0)|BIT(2)},
-		{ 6,BIT(6) ,BIT(0)|BIT(1)},
-		{ 7,BIT(7) ,BIT(0)|BIT(1)},
-		{ 8,BIT(8) ,BIT(0)|BIT(2)|BIT(3)|BIT(4)},
-		{ 9,BIT(9) ,BIT(0)|BIT(4)},
-		{10,BIT(10),BIT(0)|BIT(3)},
-		{11,BIT(11),BIT(0)|BIT(2)},
-		{12,BIT(12),BIT(0)|BIT(1)|BIT(4)|BIT(6)},
-		{13,BIT(13),BIT(0)|BIT(1)|BIT(3)|BIT(4)},
-		{14,BIT(14),BIT(0)|BIT(1)|BIT(4)|BIT(5)},
-		{15,BIT(15),BIT(0)|BIT(1)},
-		{NULL,NULL,NULL},
-	};
-
-	static POLYNOMIAL *pTbl=TblMask;
-	static int ShiftReg=pTbl->InputBit-1;
-	int XorReg=0;
-	int Masked;
-
-    if(pTbl->N!=Degree)
-    {
-    	pTbl=TblMask;
-		while(pTbl->N)
-		{
-			if(pTbl->N==Degree)
-			{
-				break;
-			}
-        	pTbl++;
-		}
-		if(!pTbl->N)
-		{
-			pTbl--;
-		}
-
-    	ShiftReg&=pTbl->InputBit-1;
-		if(!ShiftReg)
-		{
-			ShiftReg=pTbl->InputBit-1;
-		}
-    }
-
-	Masked=ShiftReg&pTbl->Mask;
-	while(Masked)
-	{
-		XorReg^=Masked&0x01;
-		Masked>>=1;
-	}
-
-	if(XorReg)
-	{
-		ShiftReg|=pTbl->InputBit;
-	}
-	else
-	{
-		ShiftReg&=~pTbl->InputBit;
-	}
-	ShiftReg>>=1;
-
-	return ShiftReg;
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_createFmVoices()
-{
-	for (int i = 0;i<2;i++)
-	{
-//		ACreateAudioVoice(&audio_FmVoice[i]);
-//		ASetVoiceVolume  ( audio_FmVoice[i], AUDIO_MAX_VOLUME);
-//		ASetVoicePanning ( audio_FmVoice[i], AUDIO_MAX_PANNING>>1);
-//		ASetVoiceFrequency(audio_FmVoice[i],audio_info.nSampleRate);
-
-		audio_FmWave[i].nSampleRate		= audio_info.nSampleRate;
-		audio_FmWave[i].dwLength		= BUFSIZE;
-		audio_FmWave[i].dwLoopStart		= 0;
-		audio_FmWave[i].dwLoopEnd		= audio_FmWave[i].dwLength;
-		audio_FmWave[i].wFormat			= AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
-//		ACreateAudioData(&audio_FmWave[i]);
-	}
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_createNoiseVoice()
-{
-//	ACreateAudioVoice(&audio_NoiseVoice);
-//	ASetVoiceVolume  ( audio_NoiseVoice, AUDIO_MAX_VOLUME);
-//	ASetVoicePanning ( audio_NoiseVoice, AUDIO_MAX_PANNING>>1);
-//	ASetVoiceFrequency(audio_NoiseVoice,audio_info.nSampleRate);
-
-	audio_NoiseWave.nSampleRate		= audio_info.nSampleRate;
-	audio_NoiseWave.dwLength		= BUFSIZE;
-	audio_NoiseWave.dwLoopStart		= 0;
-	audio_NoiseWave.dwLoopEnd		= audio_NoiseWave.dwLength;
-	audio_NoiseWave.wFormat			= AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
-//	ACreateAudioData(&audio_NoiseWave);
-	audio_NoiseVoiceFreq(50, 127);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_createAudioDmaVoice()
-{
-//	ACreateAudioVoice(&audio_AudioDmaVoice);
-//	ASetVoiceVolume  ( audio_AudioDmaVoice, AUDIO_MAX_VOLUME);
-//	ASetVoicePanning ( audio_AudioDmaVoice, AUDIO_MAX_PANNING>>1);
-//	ASetVoiceFrequency(audio_AudioDmaVoice, audio_info.nSampleRate);
-
-	audio_AudioDmaWave.nSampleRate		= audio_info.nSampleRate;
-	audio_AudioDmaWave.dwLength		= BUFSIZE;
-	audio_AudioDmaWave.dwLoopStart		= 0;
-	audio_AudioDmaWave.dwLoopEnd		= audio_AudioDmaWave.dwLength;
-	audio_AudioDmaWave.wFormat			= AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;// | AUDIO_FORMAT_LOOP;
-//	ACreateAudioData(&audio_AudioDmaWave);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_done()
-{/*
-	fprintf(log_get(), "sound: fm voice %i was %s\n", 0, (audio_FmVoicePlaying[0]?"playing":"not playing"));
-	fprintf(log_get(), "sound: fm voice %i was %s\n", 1, (audio_FmVoicePlaying[1]?"playing":"not playing"));
-	fprintf(log_get(), "sound: noise voice was %s\n", (audio_NoiseVoicePlaying?"playing":"not playing"));
-	fprintf(log_get(), "sound: audio dma voice was %s\n", (audio_AudioDmaVoicePlaying?"playing":"not playing"));
-*/
-	for (int i = 0;i<2;i++)
-	{
-//		ADestroyAudioData(&audio_FmWave[i]);
-//		ADestroyAudioVoice(audio_FmVoice[i]);
-	}
-//	ADestroyAudioData(&audio_NoiseWave);
-//	ADestroyAudioVoice(audio_NoiseVoice);
-//	ADestroyAudioData(&audio_AudioDmaWave);
-//	ADestroyAudioVoice(audio_AudioDmaVoice);
-//	ACloseVoices();
-//    ACloseAudio();
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void audio_init()
-{
-    UINT		rc;
-	UINT		nDevId;
-
-	fprintf(log_get(),"audio: using seal audio library\n");
-    /* initialize audio library */
-//	AInitialize();
-
-    /* show registered device drivers */
-    fprintf(log_get(),"audio: registered sound devices:\n");
-    for (nDevId = 0; nDevId < AGetAudioNumDevs(); nDevId++) {
-        AGetAudioDevCaps(nDevId, &audio_caps);
-        fprintf(log_get(),"audio:   %2d. %s\n", nDevId, audio_caps.szProductName);
-    }
-    /* open audio device */
-    audio_info.nDeviceId = AUDIO_DEVICE_MAPPER;
-    audio_info.wFormat   = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;//|AUDIO_MIXER_BASS;
-    audio_info.nSampleRate = 22050;
-//    if ((rc = AOpenAudio(&audio_info)) != AUDIO_ERROR_NONE) 
-	{
-        CHAR szText[80];
-  //      AGetErrorText(rc, szText, sizeof(szText) - 1);
-        fprintf(log_get(),"audio: error: %s\n", szText);
-        return;
-    }
-	
-//	AOpenVoices(4);
-	audio_createFmVoices();
-	audio_createNoiseVoice();
-	audio_createAudioDmaVoice();
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_init()
-{
-	fprintf(log_get(), "sound: init\n");
-	memory_malloc_secure((void**)&sound_buffers[0],  22050*sizeof(int16), "Right sound buffer");
-	memory_malloc_secure((void**)&sound_buffers[1],  22050*sizeof(int16), "Left sound buffer");
-	
-	memset(sound_buffers[0], 0x00, 22050*sizeof(int16));
-	memset(sound_buffers[1], 0x00, 22050*sizeof(int16));
-
-	audio_init();
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_reset()
-{
-	fprintf(log_get(), "sound: reset\n");
-	memset(sound_regs, 0, 8);
-	memset(sound_channel_size, 0, 2*sizeof(uint32));
-	memset(sound_channel_pos,  0, 2*sizeof(uint32));
-	memset(audioDma_regs, 0, 8);
-	audio_FmVoicePlaying[0] = true;
-	audio_FmVoicePlaying[1] = true;
-	audio_FmVoicePlay(0, false);
-	audio_FmVoicePlay(1, false);
-	audio_NoiseVoicePlaying = true;
-	audio_NoiseVoicePlay(false);
-	audio_AudioDmaVoicePlaying = true;
-	audio_AudioDmaVoicePlay(false);
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_done()
-{
-	fprintf(log_get(), "sound: done\n");
-	audio_done();
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_audio_dma(uint32 Addr, uint8 data)
-{
-	// fprintf(log_get(), "sound: writing 0x%2x at 0x%.4x (audio dma voice)\n", data, Addr);
-	
-	audioDma_regs[Addr&0x07] = data;
-
-	switch (Addr&0x07)
-	{
-
-	case 0x04: {
-					if (data&0x80)
-					{
-						uint32 offset = ((uint16)audioDma_regs[0])|(((uint16)audioDma_regs[1])<<8);
-						uint32 length = ((uint16)audioDma_regs[2])*32;
-						audio_AudioDmaSetSample(offset, length, 12000/(1+(audioDma_regs[3]&0x03)), audioDma_regs[3]&(1<<5));
-						if (Rd6502(0x2026)&0x04)
-						{
-							Wr6502(0x2027, Rd6502(0x2027)|0x02);
-							interrupts_irq();
-						}
-						audio_AudioDmaVoicePlay(false);
-						audio_AudioDmaVoicePlay(true);
-					}
-					else
-						audio_AudioDmaVoicePlay(false);
-					break;	
-			   }
-	}
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_noise_write(uint32 Addr, uint8 data)
-{
-	// fprintf(log_get(), "sound: writing 0x%2x at 0x%.4x (noise voice)\n", data, Addr);
-
-	switch (Addr)
-	{
-	case 0:
-			if ((data&0x07)==0)
-				audio_NoiseVoicePlay(false);
-			else
-			{
-				audio_NoiseVoiceFreq((22050/16)*(15-((data>>4)&0x0f)), (127*(data&0x0f))/15);
-				audio_NoiseVoicePlay(true);
-			}
-			break;
-	case 2: if ((data&0x10)||((data&0x0c)!=0))
-				audio_NoiseVoicePlay(true);
-			else
-				audio_NoiseVoicePlay(false);
-	}
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_write(uint32 Addr, uint8 data)
-{
-	uint32 channel = ((Addr&0x4)>>2);
-	Addr&=0x03;
-	sound_regs[channel][Addr] = data;
-
-	 // fprintf(log_get(), "sound: writing 0x%.2x at 0x%.4x (channel %i)\n", data, Addr, channel);
-	switch (Addr) 
-	{
-    case 0:
-			// fprintf(log_get(),"sound: channel %i, freq 0x%.2x\n", channel, data);
-    case 1:
-	case 2: 
-			if (sound_regs[channel][0]) 
-			{
-				uint32 v1 = sound_regs[channel][0];
-				uint32 v2 = sound_regs[channel][1]&0x07;
-				
-				uint32 counter = (v1|(v2<<8));
-				
-				audio_FmVoiceFreq(channel, 4000000/(counter*32), sound_regs[channel][2]&0x0f);
-				audio_FmVoicePlay(channel, true);
-			}
-			else 
-				audio_FmVoicePlay(channel, false);
-				
-			sound_channel_pos[channel] = 0;
-			break;
-    }
-}
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-////////////////////////////////////////////////////////////////////////////////
-void sound_exec(uint32 cycles)
-{
-}
diff --git a/PSP/sound.h b/PSP/sound.h
deleted file mode 100644
index fa241f7..0000000
--- a/PSP/sound.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __SOUND_H__
-#define __SOUND_H__
-
-#include "supervision.h"
-
-void sound_init();
-void sound_reset();
-void sound_done();
-void sound_write(uint32 Addr, uint8 data);
-void sound_noise_write(uint32 Addr, uint8 data);
-void sound_audio_dma(uint32 Addr, uint8 data);
-void sound_exec(uint32 cycles);
-void audio_turnSound(bool bOn);
-
-#endif