? .DS_Store
? build
? config_old.h
? conflicts
? hatari-080912.patch
? hatari-081004.patch
? hatari-081026.patch
? hatari-081128.patch
? hatari-081129.patch
? q
? Hatari.xcodeproj/giz.mode1
? Hatari.xcodeproj/giz.mode1v3
? Hatari.xcodeproj/giz.pbxuser
? src/.DS_Store
? src/gemdos.c_
? src/gui-osx/PrefsController.m_
? src/gui-osx/SDLMain.nib/classes.nib_
? src/gui-osx/SDLMain.nib/info.nib_
? src/gui-osx/SDLMain.nib/keyedobjects.nib_
? src/includes/configuration.h_
? src/uae-cpu/build68k.dSYM
? src/uae-cpu/newcpu.c_
Index: Hatari.xcodeproj/project.pbxproj
===================================================================
RCS file: /cvsroot/hatari/hatari/Hatari.xcodeproj/project.pbxproj,v
retrieving revision 1.14
diff -u -r1.14 project.pbxproj
--- Hatari.xcodeproj/project.pbxproj	22 Nov 2008 16:01:18 -0000	1.14
+++ Hatari.xcodeproj/project.pbxproj	29 Nov 2008 14:10:28 -0000
@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 42;
+	objectVersion = 44;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -15,7 +15,9 @@
 		4EE4B6070DD8E15C00DF27A2 /* change.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EE4B6040DD8E15C00DF27A2 /* change.h */; };
 		4EE4B6080DD8E15C00DF27A2 /* control.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EE4B6050DD8E15C00DF27A2 /* control.h */; };
 		4EE4B6090DD8E15C00DF27A2 /* str.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EE4B6060DD8E15C00DF27A2 /* str.h */; };
-		961322D80B5BCDB900007C3E /* config-default.h in Headers */ = {isa = PBXBuildFile; fileRef = 961322D30B5BCDB900007C3E /* config-default.h */; };
+		637694150E72DD1700AFC63A /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 637694140E72DD1700AFC63A /* utils.c */; };
+		637BB1B50EDFC53200AFB35A /* dsp_core.c in Sources */ = {isa = PBXBuildFile; fileRef = 637BB1B40EDFC53200AFB35A /* dsp_core.c */; };
+		637BB1B70EDFC55D00AFB35A /* dsp_core.h in Headers */ = {isa = PBXBuildFile; fileRef = 637BB1B60EDFC55D00AFB35A /* dsp_core.h */; };
 		961322E70B5BCFBB00007C3E /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 961322E60B5BCFBB00007C3E /* config.h */; };
 		961322FB0B5BD0B800007C3E /* araglue.h in Headers */ = {isa = PBXBuildFile; fileRef = 961322EF0B5BD0B800007C3E /* araglue.h */; };
 		961322FC0B5BD0B800007C3E /* dsp_cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 961322F00B5BD0B800007C3E /* dsp_cpu.c */; };
@@ -195,7 +197,6 @@
 		E99613BA0E6DC6900047F6A0 /* statusbar.c in Sources */ = {isa = PBXBuildFile; fileRef = E99613B90E6DC6900047F6A0 /* statusbar.c */; };
 		E99613BD0E6DC6C50047F6A0 /* statusbar.h in Headers */ = {isa = PBXBuildFile; fileRef = E99613BB0E6DC6C50047F6A0 /* statusbar.h */; };
 		E99613BE0E6DC6C50047F6A0 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = E99613BC0E6DC6C50047F6A0 /* utils.h */; };
-		E9D75D5A0E8C1BB1000E76DE /* ym2149_fixed_vol.h in Headers */ = {isa = PBXBuildFile; fileRef = E9D75D590E8C1BB1000E76DE /* ym2149_fixed_vol.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXBuildRule section */
@@ -250,7 +251,10 @@
 		4EE4B6040DD8E15C00DF27A2 /* change.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = change.h; sourceTree = "<group>"; };
 		4EE4B6050DD8E15C00DF27A2 /* control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = control.h; sourceTree = "<group>"; };
 		4EE4B6060DD8E15C00DF27A2 /* str.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = str.h; sourceTree = "<group>"; };
-		961322D30B5BCDB900007C3E /* config-default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "config-default.h"; sourceTree = "<group>"; };
+		636E057F0E29C43D008DF96D /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utils.c; path = src/utils.c; sourceTree = "<group>"; };
+		637694140E72DD1700AFC63A /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utils.c; path = src/utils.c; sourceTree = "<group>"; };
+		637BB1B40EDFC53200AFB35A /* dsp_core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dsp_core.c; path = src/falcon/dsp_core.c; sourceTree = "<group>"; };
+		637BB1B60EDFC55D00AFB35A /* dsp_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dsp_core.h; path = src/falcon/dsp_core.h; sourceTree = "<group>"; };
 		961322E60B5BCFBB00007C3E /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
 		961322EF0B5BD0B800007C3E /* araglue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = araglue.h; path = src/falcon/araglue.h; sourceTree = "<group>"; };
 		961322F00B5BD0B800007C3E /* dsp_cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dsp_cpu.c; path = src/falcon/dsp_cpu.c; sourceTree = "<group>"; };
@@ -479,7 +483,6 @@
 			isa = PBXGroup;
 			children = (
 				961322E60B5BCFBB00007C3E /* config.h */,
-				961322D30B5BCDB900007C3E /* config-default.h */,
 				96D6324C0A4E9A4300FBFA27 /* gui-osx */,
 				29B97315FDCFA39411CA2CEA /* Other Sources */,
 				29B97317FDCFA39411CA2CEA /* Resources */,
@@ -527,6 +530,7 @@
 				961323090B5BD14B00007C3E /* ioMemTabSTE.c */,
 				9613230A0B5BD14B00007C3E /* ioMemTabTT.c */,
 				E9283ED507512EA200DA6B24 /* joy.c */,
+				636E057F0E29C43D008DF96D /* utils.c */,
 				E9283ED607512EA200DA6B24 /* keymap.c */,
 				E9933BC20802F0F800E20172 /* log.c */,
 				E9283ED707512EA200DA6B24 /* m68000.c */,
@@ -555,6 +559,7 @@
 				E9283EEC07512EA200DA6B24 /* tos.c */,
 				E9283EED07512EA200DA6B24 /* uae-cpu */,
 				E9283F0107512EA200DA6B24 /* unzip.c */,
+				637694140E72DD1700AFC63A /* utils.c */,
 				E9283F0207512EA200DA6B24 /* vdi.c */,
 				E9283F0307512EA200DA6B24 /* video.c */,
 				E9283F0407512EA200DA6B24 /* wavFormat.c */,
@@ -634,6 +639,8 @@
 				961322EF0B5BD0B800007C3E /* araglue.h */,
 				961322F40B5BD0B800007C3E /* dsp.c */,
 				961322F50B5BD0B800007C3E /* dsp.h */,
+				637BB1B40EDFC53200AFB35A /* dsp_core.c */,
+				637BB1B60EDFC55D00AFB35A /* dsp_core.h */,
 				961322F00B5BD0B800007C3E /* dsp_cpu.c */,
 				961322F10B5BD0B800007C3E /* dsp_cpu.h */,
 				961322F20B5BD0B800007C3E /* dsp_disasm.c */,
@@ -847,7 +854,6 @@
 				9670E1540A5FA132009A73E0 /* gemdos_defines.h in Headers */,
 				9670E1550A5FA132009A73E0 /* options.h in Headers */,
 				9691912A0AA205D60008B3A0 /* scandir.h in Headers */,
-				961322D80B5BCDB900007C3E /* config-default.h in Headers */,
 				961322E70B5BCFBB00007C3E /* config.h in Headers */,
 				961322FB0B5BD0B800007C3E /* araglue.h in Headers */,
 				961322FD0B5BD0B800007C3E /* dsp_cpu.h in Headers */,
@@ -865,7 +871,7 @@
 				4E5138500DE5515200605B70 /* routines.h in Headers */,
 				E99613BD0E6DC6C50047F6A0 /* statusbar.h in Headers */,
 				E99613BE0E6DC6C50047F6A0 /* utils.h in Headers */,
-				E9D75D5A0E8C1BB1000E76DE /* ym2149_fixed_vol.h in Headers */,
+				637BB1B70EDFC55D00AFB35A /* dsp_core.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -916,7 +922,7 @@
 		29B97313FDCFA39411CA2CEA /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 96F027C90998116700577C54 /* Build configuration list for PBXProject "Hatari" */;
-			compatibilityVersion = "Xcode 2.4";
+			compatibilityVersion = "Xcode 3.0";
 			hasScannedForEncodings = 1;
 			mainGroup = 29B97314FDCFA39411CA2CEA /* Hatari */;
 			projectDirPath = "";
@@ -1041,6 +1047,8 @@
 				4EE4B5EE0DD8E0DD00DF27A2 /* control.c in Sources */,
 				4EE4B5EF0DD8E0DD00DF27A2 /* str.c in Sources */,
 				E99613BA0E6DC6900047F6A0 /* statusbar.c in Sources */,
+				637694150E72DD1700AFC63A /* utils.c in Sources */,
+				637BB1B50EDFC53200AFB35A /* dsp_core.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1071,6 +1079,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
+				ENABLE_DSP_EMU = 1;
 				FRAMEWORK_SEARCH_PATHS = "\"$(HOME)/Library/Frameworks\"";
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_FIX_AND_CONTINUE = YES;
@@ -1091,7 +1100,10 @@
 				INFOPLIST_FILE = "Info-Hatari.plist";
 				INSTALL_PATH = "$(HOME)/Applications";
 				LIBRARY_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "-Wno-unused";
+				OTHER_CFLAGS = (
+					"-Wno-unused",
+					"-DENABLE_DSP_EMU",
+				);
 				OTHER_LDFLAGS = "-lz";
 				PRODUCT_NAME = Hatari;
 				SECTORDER_FLAGS = "";
@@ -1109,6 +1121,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
+				ENABLE_DSP_EMU = 1;
 				FRAMEWORK_SEARCH_PATHS = "\"$(HOME)/Library/Frameworks\"";
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
@@ -1127,7 +1140,10 @@
 				INFOPLIST_FILE = "Info-Hatari.plist";
 				INSTALL_PATH = "$(HOME)/Applications";
 				LIBRARY_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "-Wno-unused";
+				OTHER_CFLAGS = (
+					"-Wno-unused",
+					"-DENABLE_DSP_EMU",
+				);
 				OTHER_LDFLAGS = "-lz";
 				PRODUCT_NAME = Hatari;
 				SECTORDER_FLAGS = "";
@@ -1186,10 +1202,15 @@
 		96F027CA0998116700577C54 /* Development */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				MACOSX_DEPLOYMENT_TARGET = 10.3;
+				DEPLOYMENT_POSTPROCESSING = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				HEADER_SEARCH_PATHS = "";
+				MACOSX_DEPLOYMENT_TARGET = 10.5;
 				MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
 				MACOSX_DEPLOYMENT_TARGET_ppc = 10.3.9;
-				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+				SEPARATE_STRIP = YES;
+				USER_HEADER_SEARCH_PATHS = "";
 			};
 			name = Development;
 		};
@@ -1200,15 +1221,18 @@
 					ppc,
 					i386,
 				);
+				DEPLOYMENT_POSTPROCESSING = NO;
+				ENABLE_DSP_EMU = 1;
 				GCC_AUTO_VECTORIZATION = YES;
 				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_OPTIMIZATION_LEVEL = 3;
-				MACOSX_DEPLOYMENT_TARGET = 10.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.5;
 				MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
 				MACOSX_DEPLOYMENT_TARGET_ppc = 10.3.9;
 				OTHER_CFLAGS = "-ftree-vectorizer-verbose=3";
-				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+				SEPARATE_STRIP = YES;
 			};
 			name = Deployment;
 		};
Index: src/configuration.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/configuration.c,v
retrieving revision 1.103
diff -u -r1.103 configuration.c
--- src/configuration.c	25 Nov 2008 20:51:34 -0000	1.103
+++ src/configuration.c	29 Nov 2008 14:10:28 -0000
@@ -518,21 +518,12 @@
 		Audio_SetOutputAudioFreq(ConfigureParams.Sound.nPlaybackQuality);
 	}
 	/* CPU settings */
-	if (ConfigureParams.System.nCpuFreq < 12)
-	{
-		ConfigureParams.System.nCpuFreq = 8;
-		nCpuFreqShift = 0;
-	}
-	else if (ConfigureParams.System.nCpuFreq > 26)
-	{
-		ConfigureParams.System.nCpuFreq = 32;
-		nCpuFreqShift = 2;
-	}
-	else
-	{
-		ConfigureParams.System.nCpuFreq = 16;
-		nCpuFreqShift = 1;
-	}
+  nCpuFreqShift = log2(ConfigureParams.System.nCpuFreq) - 3;
+  if(nCpuFreqShift<0 || nCpuFreqShift>6)
+    nCpuFreqShift = 0;
+  ConfigureParams.System.nCpuFreq = 8<<nCpuFreqShift;
+  /* printf("cpu freq: %d , cpu shift: %d \n", ConfigureParams.System.nCpuFreq ,  nCpuFreqShift); */
+  
 	/* Change UAE cpu_level and cpu_compatible accordingly */
 	M68000_CheckCpuLevel();
 
Index: src/cycles.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/cycles.c,v
retrieving revision 1.6
diff -u -r1.6 cycles.c
--- src/cycles.c	18 Apr 2008 20:31:59 -0000	1.6
+++ src/cycles.c	29 Nov 2008 14:10:28 -0000
@@ -11,30 +11,22 @@
   before returning the current counter value.
 */
 
-
 /* 2007/03/xx	[NP]	Use 'CurrentInstrCycles' to get a good approximation for	*/
 /*			Cycles_GetCounterOnReadAccess and Cycles_GetCounterOnWriteAccess*/
 /*			(this should work correctly with 'move' instruction).		*/
 /* 2008/04/14	[NP]	Take nWaitStateCycles into account when computing the value of	*/
 /*			Cycles_GetCounterOnReadAccess and Cycles_GetCounterOnWriteAccess*/
 
-
-
-
 const char Cycles_rcsid[] = "Hatari $Id: cycles.c,v 1.6 2008/04/18 20:31:59 npomarede Exp $";
 
 #include "main.h"
 #include "m68000.h"
 #include "cycles.h"
 
-
 int nCyclesMainCounter;                         /* Main cycles counter */
-
 static int nCyclesCounter[CYCLES_COUNTER_MAX];  /* Array with all counters */
-
 int CurrentInstrCycles;
 
-
 /*-----------------------------------------------------------------------*/
 /**
  * Update all cycles counters with the current value of nCyclesMainCounter.
Index: src/debugui.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/debugui.c,v
retrieving revision 1.26
diff -u -r1.26 debugui.c
--- src/debugui.c	25 Oct 2008 22:32:15 -0000	1.26
+++ src/debugui.c	29 Nov 2008 14:10:28 -0000
@@ -39,14 +39,14 @@
 #define NON_PRINT_CHAR '.'     /* character to display for non-printables */
 #define DISASM_INSTS   5       /* disasm - number of instructions */
 
+bool bDebugStep=FALSE;		/* Are we single stepping the CPU? */
+
 static bool bMemDump;          /* has memdump been called? */
 static unsigned long memdump_addr; /* memdump address */
 static unsigned long disasm_addr;  /* disasm address */
 
 static FILE *debugOutput;
 
-
-
 /*-----------------------------------------------------------------------*/
 /**
  * Get a hex adress range, eg. "fa0000-fa0100" 
@@ -570,6 +570,7 @@
 	        " l filename address - load a file into memory starting at address. \n"
 	        " s filename address length - dump length bytes from memory to a file. \n"
 	        " o [command line] - set Hatari command line options\n\n"
+		" i - step one instruction\n"
 	        " q - quit emulator\n"
 	        " c - continue emulation\n\n"
 	        " Adresses may be given as a range e.g. fc0000-fc0100\nAll values in hexadecimal.\n"
@@ -684,6 +685,11 @@
 			DebugUI_SaveBin(input);
 		break;
 
+	case 'i':
+		//DebugUI_Step();
+		retval = DEBUG_STEP;
+		break;
+			
 	 default:
 		if (command[0])
 			fprintf(stderr,"  Unknown command: '%s'\n", command);
@@ -722,20 +728,38 @@
 	return retval;
 }
 
-
 /*-----------------------------------------------------------------------*/
 /**
  * Debug UI
  */
 void DebugUI(void)
 {
+	int cmd;
 	bMemDump = FALSE;
 	disasm_addr = 0;
 
-	fprintf(stderr, "\nYou have entered debug mode. Type c to continue emulation, h for help."
+	if(bDebugStep)
+	{
+		uaecptr disasm_addr = M68000_GetPC();
+		uaecptr nextpc;
+		m68k_disasm(debugOutput, (uaecptr)disasm_addr, &nextpc, 1);		
+	}
+	else
+	{
+		fprintf(stderr, "\nYou have entered debug mode. Type c to continue emulation, h for help."
 	                "\n----------------------------------------------------------------------\n");
-	while (DebugUI_GetCommand() != DEBUG_QUIT)
-		;
+	}
+	
+	while ( (cmd=DebugUI_GetCommand()) != DEBUG_QUIT)
+	{
+		if(cmd == DEBUG_STEP)
+		{
+			fprintf(stderr,"Stepping...\n");
+			bDebugStep=TRUE;
+			return;
+		}
+	}
+	bDebugStep=FALSE;
 	fprintf(stderr,"Returning to emulation...\n------------------------------\n\n");
 	DebugUI_SetLogDefault();
 }
Index: src/main.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/main.c,v
retrieving revision 1.153
diff -u -r1.153 main.c
--- src/main.c	23 Nov 2008 10:27:13 -0000	1.153
+++ src/main.c	29 Nov 2008 14:10:29 -0000
@@ -51,7 +51,6 @@
 #include "falcon/dsp.h"
 #endif
 
-
 bool bQuitProgram = FALSE;                /* Flag to quit program cleanly */
 bool bEnableDebug = FALSE;                /* Enable debug UI? */
 
Index: src/options.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/options.c,v
retrieving revision 1.72
diff -u -r1.72 options.c
--- src/options.c	20 Sep 2008 12:01:08 -0000	1.72
+++ src/options.c	29 Nov 2008 14:10:29 -0000
@@ -43,11 +43,9 @@
 
 #include "hatari-glue.h"
 
-
 bool bLoadAutoSave;        /* Load autosave memory snapshot at startup */
 bool bLoadMemorySave;      /* Load memory snapshot provided via option at startup */
-bool bBiosIntercept;       /* whether UAE should intercept Bios & XBios calls */
-
+bool bBiosIntercept=TRUE;  /* whether UAE should intercept Bios & XBios calls */
 
 /*  List of supported options. */
 enum {
Index: src/rs232.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/rs232.c,v
retrieving revision 1.33
diff -u -r1.33 rs232.c
--- src/rs232.c	16 Jun 2008 19:22:37 -0000	1.33
+++ src/rs232.c	29 Nov 2008 14:10:29 -0000
@@ -54,7 +54,7 @@
 #if HAVE_TERMIOS_H
 
 #if !HAVE_CFMAKERAW
-static inline void cfmakeraw(struct termios *termios_p)
+void cfmakeraw(struct termios *termios_p)
 {
 	termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
 	termios_p->c_oflag &= ~OPOST;
Index: src/xbios.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/xbios.c,v
retrieving revision 1.18
diff -u -r1.18 xbios.c
--- src/xbios.c	3 Nov 2008 20:24:25 -0000	1.18
+++ src/xbios.c	29 Nov 2008 14:10:29 -0000
@@ -20,11 +20,10 @@
 #include "screenSnapShot.h"
 #include "stMemory.h"
 #include "xbios.h"
-
+#include "debugui.h"
 
 #define XBIOS_DEBUG 0	/* for floppy read/write */
 
-
 /* List of Atari ST RS-232 baud rates */
 static const int BaudRates[] =
 {
@@ -161,6 +160,186 @@
 }
 
 
+/*----------------------------------------------------------------------- */
+/**
+ * XBIOS Prtblk
+ * Call 36
+ */
+static bool XBios_Prtblk(Uint32 Params)
+{
+	/* Correct return code? */
+	Regs[REG_D0] = 0;
+
+	return TRUE;
+}
+
+/*----------------------------------------------------------------------- */
+/**
+ * XBIOS Change Emulator Options
+ * Call 255
+ */
+static bool XBios_HatariOption(Uint32 Params)
+{
+  int option = STMemory_ReadWord(Params+2);
+  fprintf(stderr, "Intercepted XBIOS HatariOption(), option=%d (%08x), ", option, Params);
+
+  switch(option)
+  {
+  case 1: /* Min speed? */
+    ConfigureParams.System.bFastForward = false;
+    //ConfigureParams.System.nMinMaxSpeed = MINMAXSPEED_MIN;
+    /* Reset the sound emulation variables: */
+    Sound_ResetBufferIndex();
+    fprintf(stderr, "Normal speed\n");
+    Regs[REG_D0] = 0;
+    break;
+  case 2: /* Max speed? */
+    ConfigureParams.System.bFastForward = true;
+    //ConfigureParams.System.nMinMaxSpeed = MINMAXSPEED_MAX;
+    fprintf(stderr, "Maximum speed!\n");
+    Regs[REG_D0] = 0;
+    break;
+  case 3:  /* Enable debugger? */
+	  bEnableDebug = TRUE;  
+	  fprintf(stderr, "Debugger enabled\n");
+	  Regs[REG_D0] = 0;
+    break;
+  case 4:  /* Disable debugger? */
+	  bEnableDebug = FALSE;  
+	  fprintf(stderr, "Debugger disabled\n");
+	  Regs[REG_D0] = 0;
+    break;
+  default:
+    fprintf(stderr, "Unknown argument (%d)\n",Params);
+    Regs[REG_D0] = -1;
+  }
+
+  return(TRUE);
+}
+
+/*----------------------------------------------------------------------- */
+/**
+ * XBIOS Debug output to console
+ * Call 254
+ * Parameters: memptr at -2(sp) and numbytes at -6(sp)
+ */
+static bool XBios_Debug(Uint32 Params)
+{
+  int i;
+  Uint32 memptr = STMemory_ReadLong(Params+2);
+  Uint32 length = STMemory_ReadLong(Params+6);
+  
+  fprintf(stderr, "Memory dump at 0x%08x (%d bytes): ", memptr, length);
+  if(length>256)
+  {
+    length = 256;
+    fprintf(stderr,"length truncated to 256 bytes! ");
+  }
+  for(i=0;i<length;i++)
+  {
+    if( (i%16) == 0) fprintf(stderr,"\n");
+    fprintf(stderr,"%02x ",STMemory_ReadByte(memptr+i));
+  }
+  fprintf(stderr,"\n");
+  
+  return(TRUE);
+}
+
+/**
+ * XBIOS Dump all registers to console
+ * Call 251
+ * Parameters: none
+ */
+static bool XBios_Registers(Uint32 Params)
+{
+//	Uint32 memptr = STMemory_ReadLong(Params+2);
+//	Uint32 length = STMemory_ReadLong(Params+6);
+	
+	fprintf(stderr, "Registers: \n");
+	fprintf(stderr,"d/a0     d/a1     d/a2     d/a3      d/a4     d/a5     d/a6     d/a7 \n");
+	fprintf(stderr,"%08x %08x %08x %08x %08x %08x %08x %08x \n",
+		Regs[REG_D0], Regs[REG_D1], Regs[REG_D2], Regs[REG_D3],
+		Regs[REG_D4], Regs[REG_D5], Regs[REG_D6], Regs[REG_D7] );
+	fprintf(stderr,"%08x %08x %08x %08x %08x %08x %08x %08x \n",
+		Regs[REG_A0], Regs[REG_A1], Regs[REG_A2], Regs[REG_A3],
+		Regs[REG_A4], Regs[REG_A5], Regs[REG_A6], Regs[REG_A7] );
+	
+	return(TRUE);
+}
+
+static Uint32 sCycleCounter[256];
+extern int nScanlinesPerFrame;                   /* Number of scan lines per frame */
+extern int nCyclesPerLine;                       /* Cycles per horizontal line scan */
+
+/**
+ * XBIOS Start or restart a cycle counter
+ * Call 253
+ * Parameters: counter no at -2(sp)
+ */
+static bool XBios_CounterStart(Uint32 Params)
+{
+  Params = STMemory_ReadWord(Params+2);
+  Params &= 0xFF;  /* we only use 255 cycle counters */
+  sCycleCounter[Params] = Cycles_GetCounter(CYCLES_COUNTER_VIDEO);
+/*  fprintf(stderr,"XBios cycle counter #%d started at %d\n",Params,sCycleCounter[Params]); */
+  return(TRUE);
+}
+
+/**
+ * XBIOS Stop a cycle counter
+ * Call 252
+ * Parameters: counter no at -2(sp)
+ */
+static bool XBios_CounterRead(Uint32 Params)
+{
+  Uint32 cycles,curr_cycles;
+  Params = STMemory_ReadWord(Params+2);
+  Params &= 0xFF;  /* we only use 255 cycle counters */
+/*  sCycleCounter[Params] = nCycleMainCounter - sCycleCounter[Params]; */
+
+  cycles = Cycles_GetCounter(CYCLES_COUNTER_VIDEO);
+
+  /* has the frame refreshed? */
+  if(cycles < sCycleCounter[Params])
+  {  /* extend the frame... */
+    cycles += nScanlinesPerFrame*nCyclesPerLine;;
+  }
+
+  curr_cycles = cycles-sCycleCounter[Params];
+  fprintf(stderr,"Cnt #%d at %d : %d cycles (%d frames + %d cycles)\n",
+    Params,cycles,curr_cycles,curr_cycles/nCyclesPerLine,curr_cycles%nCyclesPerLine);
+  return(TRUE);
+}
+
+/**
+ * XBIOS Set Hatari CPU frequency
+ * Call 249
+ * Parameters: CPU frequency (word)
+ */
+static bool XBios_CPUFreq(Uint32 Params)
+{
+  int cpuFreq = STMemory_ReadWord(Params+2);
+  cpuFreq &= 0x1FF; /* max freq is 511 MHz */
+  nCpuFreqShift = log2(cpuFreq) - 3;
+  if(nCpuFreqShift<0 || nCpuFreqShift>6)
+    nCpuFreqShift = 0;
+  ConfigureParams.System.nCpuFreq = 8<<nCpuFreqShift;
+  printf("cpu freq: %d , cpu shift: %d \n", cpuFreq ,  nCpuFreqShift);  
+	return(TRUE);
+}
+
+/**
+ * XBIOS Enter Hatari debug UI
+ * Call 251
+ * Parameters: none
+ */
+static bool XBios_DebugUI(Uint32 Params)
+{
+	DebugUI();
+	return(TRUE);
+}
+
+
 /*-----------------------------------------------------------------------*/
 /**
  * Check if we need to re-direct XBios call to our own routines
@@ -169,11 +348,10 @@
 {
 	Uint32 Params;
 	Uint16 XBiosCall;
-
 	/* Find call */
 	Params = Regs[REG_A7];
 	XBiosCall = STMemory_ReadWord(Params);
-
+	Log_Printf(LOG_DEBUG, "XBIOS %d\n",XBiosCall);
 	switch (XBiosCall)
 	{
 	 case 8:
@@ -189,6 +367,29 @@
 		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS Scrdmp()\n" );
 		return XBios_Scrdmp(Params);
 
+	/* DHS specific debug patches */
+  case 249:
+    HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS CPUFreq()\n" );
+    return(XBios_CPUFreq(Params));
+  case 250:
+		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS Registers()\n" );
+		return(XBios_Registers(Params));
+	case 251:
+		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS DebugUI()\n" );
+		return(XBios_DebugUI(Params));
+	case 252:
+		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS CounterRead()\n" );
+		return(XBios_CounterRead(Params));
+	case 253:
+		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS CounterStart()\n" );
+		return(XBios_CounterStart(Params));
+	case 254:
+		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS Debug()\n" );
+		return(XBios_Debug(Params));
+	case 255:
+		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS DHS HatariOption()\n" );
+		return(XBios_HatariOption(Params));
+			
 	 default:  /* Call as normal! */
 		HATARI_TRACE ( HATARI_TRACE_OS_XBIOS, "XBIOS %d\n", XBiosCall );
 		return FALSE;
Index: src/gui-osx/Shared.m
===================================================================
RCS file: /cvsroot/hatari/hatari/src/gui-osx/Shared.m,v
retrieving revision 1.2
diff -u -r1.2 Shared.m
--- src/gui-osx/Shared.m	22 Nov 2008 14:31:31 -0000	1.2
+++ src/gui-osx/Shared.m	29 Nov 2008 14:10:29 -0000
@@ -1,97 +1,97 @@
-/*
-  Hatari - CreateFloppyController.m
-
-  This file is distributed under the GNU Public License, version 2 or at
-  your option any later version. Read the file gpl.txt for details.
-
-  Helper code used by the other Cocoa code files
-
-  June 2006, Sébastien Molines - Created
-*/
-
-#import <Cocoa/Cocoa.h>
-#import "Shared.h"
-#import "AlertHooks.h"
-#include "main.h"
-
-@implementation ModalWrapper
-
-// Runs an NSWindow modally
-- (void)runModal:(NSWindow*)window
-{
-	// Grab the window
-	modalWindow = window;
-
-	// Set the window's delegate
-	[window setDelegate:self];
-
-	// Change emulation and UI state
-	GuiOsx_PauseAndSwitchToCocoaUI();
-	
-	// Run it as modal
-	[NSApp runModalForWindow:window];
-
-	// Restore emulation and UI state
-	GuiOsx_ResumeFromCocoaUI();
-}
-
-// On closure of the NSWindow, end the modal session
-- (void) windowWillClose:(NSNotification *)notification
-{
-	NSWindow *windowAboutToClose = [notification object];
-	
-	// Is this our modal window?
-	if (windowAboutToClose == modalWindow)
-	{
-		// Stop the modal loop
-		[NSApp stopModal];
-	}
-}
-
-@end
-
-/*-----------------------------------------------------------------------*/
-/*
-  Helper function to write the contents of a path as an NSString to a string
-*/
-void GuiOsx_ExportPathString(NSString* path, char* szTarget, size_t cchTarget)
-{
-	NSCAssert((szTarget), @"Target buffer must not be null.");
-	NSCAssert((cchTarget > 0), @"Target buffer size must be greater than zero.");
-
-	// Copy the string
-	strncpy(szTarget, [[path stringByExpandingTildeInPath] cString], cchTarget);
-	
-	// Make sure it is null terminated (as strncpy does not null-terminate if the buffer is too small)
-	szTarget[cchTarget - 1] = 0;
-}
-
-/*-----------------------------------------------------------------------*/
-/*
-  Pauses emulation and gets ready to use Cocoa UI
-*/
-void GuiOsx_PauseAndSwitchToCocoaUI()
-{
-	// Pause emulation
-	Main_PauseEmulation(FALSE);
-	
-	// Enable the alert hooks, so that any messages are shown in Cocoa alerts instead of SDL alerts
-#ifdef ALERT_HOOKS
-	useAlertHooks = TRUE;
-#endif
-}
-
-/*-----------------------------------------------------------------------*/
-/*
-  Switches back to emulation mode and resume emulation
-*/
-void GuiOsx_ResumeFromCocoaUI()
-{
-	// Disable the alert hooks, so that SDL handle messages
-#ifdef ALERT_HOOKS
-	useAlertHooks = FALSE;
-#endif
-
-	// Resume emulation
-	Main_UnPauseEmulation();
-}
+/*
+  Hatari - CreateFloppyController.m
+
+  This file is distributed under the GNU Public License, version 2 or at
+  your option any later version. Read the file gpl.txt for details.
+
+  Helper code used by the other Cocoa code files
+
+  June 2006, Sébastien Molines - Created
+*/
+
+#import <Cocoa/Cocoa.h>
+#import "Shared.h"
+#import "AlertHooks.h"
+#include "main.h"
+
+@implementation ModalWrapper
+
+// Runs an NSWindow modally
+- (void)runModal:(NSWindow*)window
+{
+	// Grab the window
+	modalWindow = window;
+
+	// Set the window's delegate
+	[window setDelegate:self];
+
+	// Change emulation and UI state
+	GuiOsx_PauseAndSwitchToCocoaUI();
+	
+	// Run it as modal
+	[NSApp runModalForWindow:window];
+
+	// Restore emulation and UI state
+	GuiOsx_ResumeFromCocoaUI();
+}
+
+// On closure of the NSWindow, end the modal session
+- (void) windowWillClose:(NSNotification *)notification
+{
+	NSWindow *windowAboutToClose = [notification object];
+	
+	// Is this our modal window?
+	if (windowAboutToClose == modalWindow)
+	{
+		// Stop the modal loop
+		[NSApp stopModal];
+	}
+}
+
+@end
+
+/*-----------------------------------------------------------------------*/
+/*
+  Helper function to write the contents of a path as an NSString to a string
+*/
+void GuiOsx_ExportPathString(NSString* path, char* szTarget, size_t cchTarget)
+{
+	NSCAssert((szTarget), @"Target buffer must not be null.");
+	NSCAssert((cchTarget > 0), @"Target buffer size must be greater than zero.");
+
+	// Copy the string
+	strncpy(szTarget, [[path stringByExpandingTildeInPath] cString], cchTarget);
+	
+	// Make sure it is null terminated (as strncpy does not null-terminate if the buffer is too small)
+	szTarget[cchTarget - 1] = 0;
+}
+
+/*-----------------------------------------------------------------------*/
+/*
+  Pauses emulation and gets ready to use Cocoa UI
+*/
+void GuiOsx_PauseAndSwitchToCocoaUI()
+{
+	// Pause emulation
+	Main_PauseEmulation(FALSE); //TRUE in 1.1... >>>>>>> 1.2
+	
+	// Enable the alert hooks, so that any messages are shown in Cocoa alerts instead of SDL alerts
+#ifdef ALERT_HOOKS
+	useAlertHooks = TRUE;
+#endif
+}
+
+/*-----------------------------------------------------------------------*/
+/*
+  Switches back to emulation mode and resume emulation
+*/
+void GuiOsx_ResumeFromCocoaUI()
+{
+	// Disable the alert hooks, so that SDL handle messages
+#ifdef ALERT_HOOKS
+	useAlertHooks = FALSE;
+#endif
+
+	// Resume emulation
+	Main_UnPauseEmulation();
+}
Index: src/gui-sdl/dlgSystem.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/gui-sdl/dlgSystem.c,v
retrieving revision 1.11
diff -u -r1.11 dlgSystem.c
--- src/gui-sdl/dlgSystem.c	8 Jun 2008 16:07:42 -0000	1.11
+++ src/gui-sdl/dlgSystem.c	29 Nov 2008 14:10:29 -0000
@@ -24,12 +24,13 @@
 #define DLGSYS_8MHZ     17
 #define DLGSYS_16MHZ    18
 #define DLGSYS_32MHZ    19
-#define DLGSYS_PREFETCH 20
-#define DLGSYS_BLITTER  21
-#define DLGSYS_RTC      22
-#define DLGSYS_TIMERD   23
-#define DLGSYS_SLOWFDC  24
-
+#define DLGSYS_64MHZ    20
+#define DLGSYS_128MHZ   21
+#define DLGSYS_PREFETCH 22
+#define DLGSYS_BLITTER  23
+#define DLGSYS_RTC      24
+#define DLGSYS_TIMERD   25
+#define DLGSYS_SLOWFDC  26
 
 /* The "System" dialog: */
 static SGOBJ systemdlg[] =
@@ -57,6 +58,8 @@
 	{ SGRADIOBUT, 0, 0, 19,13, 3,1, "8" },
 	{ SGRADIOBUT, 0, 0, 24,13, 4,1, "16" },
 	{ SGRADIOBUT, 0, 0, 30,13, 4,1, "32" },
+	{ SGRADIOBUT, 0, 0, 19,14, 4,1, "64" },
+	{ SGRADIOBUT, 0, 0, 30,14, 4,1, "128" },
 
 	{ SGCHECKBOX, 0, 0, 2,15, 32,1, "Slower but more compatible CPU" },
 	{ SGCHECKBOX, 0, 0, 2,16, 20,1, "Blitter emulation" },
@@ -93,11 +96,15 @@
 	}
 	systemdlg[DLGSYS_ST + ConfigureParams.System.nMachineType].state |= SG_SELECTED;
 
-	for (i = DLGSYS_8MHZ; i <= DLGSYS_16MHZ; i++)
+	for (i = DLGSYS_8MHZ; i <= DLGSYS_128MHZ; i++)
 	{
 		systemdlg[i].state &= ~SG_SELECTED;
 	}
-	if (ConfigureParams.System.nCpuFreq == 32)
+	if (ConfigureParams.System.nCpuFreq == 128)
+	  systemdlg[DLGSYS_128MHZ].state |= SG_SELECTED;
+	else if (ConfigureParams.System.nCpuFreq == 64)
+	  systemdlg[DLGSYS_64MHZ].state |= SG_SELECTED;
+	else if (ConfigureParams.System.nCpuFreq == 32)
 	  systemdlg[DLGSYS_32MHZ].state |= SG_SELECTED;
 	else if (ConfigureParams.System.nCpuFreq == 16)
 	  systemdlg[DLGSYS_16MHZ].state |= SG_SELECTED;
@@ -152,7 +159,11 @@
 		}
 	}
 
-	if (systemdlg[DLGSYS_32MHZ].state & SG_SELECTED)
+	if (systemdlg[DLGSYS_128MHZ].state & SG_SELECTED)
+		ConfigureParams.System.nCpuFreq = 128;
+	else if (systemdlg[DLGSYS_64MHZ].state & SG_SELECTED)
+		ConfigureParams.System.nCpuFreq = 64;
+	else if (systemdlg[DLGSYS_32MHZ].state & SG_SELECTED)
 		ConfigureParams.System.nCpuFreq = 32;
 	else if (systemdlg[DLGSYS_16MHZ].state & SG_SELECTED)
 		ConfigureParams.System.nCpuFreq = 16;
Index: src/includes/debugui.h
===================================================================
RCS file: /cvsroot/hatari/hatari/src/includes/debugui.h,v
retrieving revision 1.3
diff -u -r1.3 debugui.h
--- src/includes/debugui.h	8 May 2008 20:41:29 -0000	1.3
+++ src/includes/debugui.h	29 Nov 2008 14:10:29 -0000
@@ -11,10 +11,13 @@
 /* DebugUI_ParseCommand() return values */
 enum {
 	DEBUG_QUIT,
-	DEBUG_CMD
+	DEBUG_CMD,
+	DEBUG_STEP
 };
 
 extern void DebugUI(void);
 extern int DebugUI_ParseCommand(char *input);
 
+extern bool bDebugStep;
+
 #endif /* HATARI_DEBUGUI_H */
Index: src/includes/m68000.h
===================================================================
RCS file: /cvsroot/hatari/hatari/src/includes/m68000.h,v
retrieving revision 1.33
diff -u -r1.33 m68000.h
--- src/includes/m68000.h	5 Oct 2008 17:55:31 -0000	1.33
+++ src/includes/m68000.h	29 Nov 2008 14:10:30 -0000
@@ -170,7 +170,9 @@
 {
 	cycles = (cycles + 3) & ~3;
 	cycles = cycles >> nCpuFreqShift;
-
+  /* we have to advance the cycle counter by at least one cycle! */
+  if(cycles<1) cycles=1;
+  
 	PendingInterruptCount -= INT_CONVERT_TO_INTERNAL(cycles, INT_CPU_CYCLE);
 	nCyclesMainCounter += cycles;
 }
@@ -226,6 +228,9 @@
 
 	cycles = cycles >> nCpuFreqShift;
 
+  /* we have to advance the cycle counter by at least one cycle! */
+  if(cycles<1) cycles=1;
+
 	PendingInterruptCount -= INT_CONVERT_TO_INTERNAL ( cycles , INT_CPU_CYCLE );
 
 	nCyclesMainCounter += cycles;
Index: src/uae-cpu/newcpu.c
===================================================================
RCS file: /cvsroot/hatari/hatari/src/uae-cpu/newcpu.c,v
retrieving revision 1.61
diff -u -r1.61 newcpu.c
--- src/uae-cpu/newcpu.c	17 Nov 2008 23:13:01 -0000	1.61
+++ src/uae-cpu/newcpu.c	29 Nov 2008 14:10:30 -0000
@@ -915,7 +915,16 @@
 	    }
 	    if (bEnableDebug && BusErrorAddress!=0xff8a00) {
 	      fprintf(stderr,"Bus Error at address $%x, PC=$%lx\n", BusErrorAddress, (long)currpc);
-	      DebugUI();
+	      if(currpc == 0xe00406 ||
+		 currpc == 0xe0041e ||
+		 currpc == 0xe004c4 ||
+		 currpc == 0xe0058a ||
+		 currpc == 0xe029bc ||
+		 currpc == 0xe0290c ||
+		 currpc == 0x02f354)
+	         fprintf(stderr,"Ignoring: probably in TOS boot sequence!\n");
+	      else
+	        DebugUI();
 	    }
 	}
     }
@@ -1426,7 +1435,6 @@
     }
 }
 
-
 /*
  * Handle special flags
  */
@@ -1528,6 +1536,8 @@
 	int cycles;
 	uae_u32 opcode = get_iword_prefetch (0);
 
+	if(bDebugStep) DebugUI();
+
 #ifdef DEBUG_PREFETCH
 	if (get_ilong (0) != do_get_mem_long (&regs.prefetch)) {
 	    fprintf (stderr, "Prefetch differs from memory.\n");
@@ -1596,6 +1606,8 @@
 	int cycles;
 	uae_u32 opcode = get_iword (0);
 
+	if(bDebugStep) DebugUI();
+
 	/*m68k_dumpstate(stderr, NULL);*/
 	if ( HATARI_TRACE_LEVEL ( HATARI_TRACE_CPU_DISASM ) )
 	  {
