Re: [hatari-devel] WinUAE core freeze with ST emulation, solved but another question about gemdos drive.

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On tiistai 29 toukokuu 2012, Thomas Huth wrote:
> Am Tue, 29 May 2012 00:00:07 +0300
> schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
> > On maanantai 28 toukokuu 2012, Eero Tamminen wrote:
> > > Btw. Does your this patch:
> > > http://hg.tuxfamily.org/mercurialroot/hatari/hatari/rev/a941332bd17b
> > > 
> > > make it unnecessary to turn cycle exact / compatible (prefetch)
> > > options off for ST?
> > 
> > Tested it... No effect on that, one still needs to disable both
> > options with ST.
> 
> After applying that patch, starting Hatari with "--cpu-exact 1" worked
> for me. Which TOS version were you using? In case it also does not work
> with different TOS versions, could you please mail me your hatari.cfg?

I'm not anymore able to reproduce it, so I don't know how I actually
got it...

So, what do you suggest to do with the patch?

(The attached new version adds missing call to CheckCpuSettings()
after changing WinUAE settings in tos.c.)


This is everything that the current one does for WinAUE build:
* defaults to Falcon as that's the main reason for WinAUE core.
* adds CPU prefetch option so that this WinAUE
  setting doesn't mangle old UAE compatible CPU setting
  (as both cores use same .hatari/hatari.cfg file).
* Resets emulations also if prefetch or FPU type is
  changed, as requested by Laurent.
* enables prefetch & cycle-exact whenever Falcon
  or TT is selected and disables them when some
  other TOS is selected.

Do you think some of these things are redundant now?


	- Eero

PS. One potential remaining thing is to change the SDL GUI System dialog
so that when user selects machine type, the fields related to machine
type are updated (DSP and CPU level & frequency + WinUAE options).
Like they already do in Python UI...
diff -r f8b7da6c61de src/change.c
--- a/src/change.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/change.c	Thu May 31 23:14:19 2012 +0300
@@ -119,13 +119,17 @@
 		return true;
 
 	/* Did change CPU prefetch mode? */
-	if (changed->System.bCompatibleCpu != current->System.bCompatibleCpu)
+	if (changed->System.bPrefetchCpu != current->System.bPrefetchCpu)
 		return true;
 
 	/* Did change CPU cycle exact? */
 	if (changed->System.bCycleExactCpu != current->System.bCycleExactCpu)
 		return true;
 
+	/* Did change FPU? */
+	if (changed->System.n_FPUType != current->System.n_FPUType)
+		return true;
+
 	/* Did change MMU? */
 	if (changed->System.bMMU != current->System.bMMU)
 		return true;
diff -r f8b7da6c61de src/configuration.c
--- a/src/configuration.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/configuration.c	Thu May 31 23:14:19 2012 +0300
@@ -331,6 +331,7 @@
 
 #if ENABLE_WINUAE_CPU
 	{ "bAddressSpace24", Bool_Tag, &ConfigureParams.System.bAddressSpace24 },
+	{ "bPrefetchCpu", Bool_Tag, &ConfigureParams.System.bPrefetchCpu },
 	{ "bCycleExactCpu", Bool_Tag, &ConfigureParams.System.bCycleExactCpu },
 	{ "n_FPUType", Int_Tag, &ConfigureParams.System.n_FPUType },
 	{ "bCompatibleFPU", Bool_Tag, &ConfigureParams.System.bCompatibleFPU },
@@ -512,23 +513,32 @@
 	strcpy(ConfigureParams.Rom.szCartridgeImageFileName, "");
 
 	/* Set defaults for System */
+#if ENABLE_WINUAE_CPU
+	/* Default to Falcon with WinUAE CPU core... */
+	ConfigureParams.System.nMachineType = MACHINE_FALCON;
+	ConfigureParams.System.nCpuLevel = 3;
+	ConfigureParams.System.nCpuFreq = 16;
+	ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
+
+	ConfigureParams.System.bAddressSpace24 = true;
+	ConfigureParams.System.bPrefetchCpu = true;
+	ConfigureParams.System.bCycleExactCpu = true;
+	ConfigureParams.System.n_FPUType = FPU_68882;
+	ConfigureParams.System.bCompatibleFPU = true;
+	ConfigureParams.System.bMMU = false;
+#else
+	/* ...and to ST with old UAE CPU core */
+	ConfigureParams.System.nMachineType = MACHINE_ST;
 	ConfigureParams.System.nCpuLevel = 0;
 	ConfigureParams.System.nCpuFreq = 8;
+	ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
+#endif
 	ConfigureParams.System.bCompatibleCpu = true;
-	ConfigureParams.System.nMachineType = MACHINE_ST;
 	ConfigureParams.System.bBlitter = false;
-	ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
 	ConfigureParams.System.bPatchTimerD = true;
 	ConfigureParams.System.bFastBoot = true;
 	ConfigureParams.System.bRealTimeClock = true;
 	ConfigureParams.System.bFastForward = false;
-#if ENABLE_WINUAE_CPU
-	ConfigureParams.System.bAddressSpace24 = true;
-	ConfigureParams.System.bCycleExactCpu = false;
-	ConfigureParams.System.n_FPUType = FPU_NONE;
-	ConfigureParams.System.bCompatibleFPU = false;
-	ConfigureParams.System.bMMU = false;
-#endif
 
 	/* Set defaults for Video */
 #if HAVE_LIBPNG
@@ -786,6 +796,7 @@
 
 #if ENABLE_WINUAE_CPU
 	MemorySnapShot_Store(&ConfigureParams.System.bAddressSpace24, sizeof(ConfigureParams.System.bAddressSpace24));
+	MemorySnapShot_Store(&ConfigureParams.System.bPrefetchCpu, sizeof(ConfigureParams.System.bPrefetchCpu));
 	MemorySnapShot_Store(&ConfigureParams.System.bCycleExactCpu, sizeof(ConfigureParams.System.bCycleExactCpu));
 	MemorySnapShot_Store(&ConfigureParams.System.n_FPUType, sizeof(ConfigureParams.System.n_FPUType));
 	MemorySnapShot_Store(&ConfigureParams.System.bCompatibleFPU, sizeof(ConfigureParams.System.bCompatibleFPU));
diff -r f8b7da6c61de src/cpu/hatari-glue.c
--- a/src/cpu/hatari-glue.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/cpu/hatari-glue.c	Thu May 31 23:14:19 2012 +0300
@@ -99,7 +99,7 @@
 		default: fprintf (stderr, "Init680x0() : Error, cpu_level unknown\n");
 	}
 	
-	currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
+	currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bPrefetchCpu;
 	currprefs.address_space_24 = changed_prefs.address_space_24 = ConfigureParams.System.bAddressSpace24;
 	currprefs.cpu_cycle_exact = changed_prefs.cpu_cycle_exact = ConfigureParams.System.bCycleExactCpu;
 	currprefs.fpu_model = changed_prefs.fpu_model = ConfigureParams.System.n_FPUType;
diff -r f8b7da6c61de src/gui-sdl/dlgSystem.c
--- a/src/gui-sdl/dlgSystem.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/gui-sdl/dlgSystem.c	Thu May 31 23:14:19 2012 +0300
@@ -343,7 +343,7 @@
 		systemdlg[DLGSYS_DSPON].state |= SG_SELECTED;
 
 	/* More compatible CPU, Prefetch mode */
-	if (ConfigureParams.System.bCompatibleCpu)
+	if (ConfigureParams.System.bPrefetchCpu)
 		systemdlg[DLGSYS_PREFETCH].state |= SG_SELECTED;
 	else
 		systemdlg[DLGSYS_PREFETCH].state &= ~SG_SELECTED;
@@ -442,7 +442,7 @@
 	else
 		ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
 
-	ConfigureParams.System.bCompatibleCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);
+	ConfigureParams.System.bPrefetchCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);
 	ConfigureParams.System.bBlitter = (systemdlg[DLGSYS_BLITTER].state & SG_SELECTED);
 	ConfigureParams.System.bRealTimeClock = (systemdlg[DLGSYS_RTC].state & SG_SELECTED);
 	ConfigureParams.System.bPatchTimerD = (systemdlg[DLGSYS_TIMERD].state & SG_SELECTED);
diff -r f8b7da6c61de src/includes/configuration.h
--- a/src/includes/configuration.h	Thu May 31 23:00:07 2012 +0300
+++ b/src/includes/configuration.h	Thu May 31 23:14:19 2012 +0300
@@ -283,6 +283,7 @@
 
 #if ENABLE_WINUAE_CPU
   bool bAddressSpace24;
+  bool bPrefetchCpu;
   bool bCycleExactCpu;
   FPUTYPE n_FPUType;
   bool bCompatibleFPU;            /* More compatible FPU */
diff -r f8b7da6c61de src/m68000.c
--- a/src/m68000.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/m68000.c	Thu May 31 23:14:19 2012 +0300
@@ -276,7 +276,6 @@
 		nCpuFreqShift = 1;
 	}
 	changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel;
-	changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
 
 #if ENABLE_WINUAE_CPU
 	/* WinUAE core uses cpu_model instead of cpu_level, so we've got to
@@ -297,6 +296,10 @@
 	changed_prefs.fpu_model = ConfigureParams.System.n_FPUType;
 	changed_prefs.fpu_strict = ConfigureParams.System.bCompatibleFPU;
 	changed_prefs.mmu_model = ConfigureParams.System.bMMU;
+
+	changed_prefs.cpu_compatible = ConfigureParams.System.bPrefetchCpu;
+#else
+	changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
 #endif
 	if (table68k)
 		check_prefs_changed_cpu();
diff -r f8b7da6c61de src/options.c
--- a/src/options.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/options.c	Thu May 31 23:14:19 2012 +0300
@@ -114,7 +114,8 @@
 	OPT_CPUCLOCK,
 	OPT_COMPATIBLE,
 #if ENABLE_WINUAE_CPU
-	OPT_CPU_CYCLE_EXACT,	/* WinUAE CPU/FPU/bus options */
+	OPT_CPU_PREFETCH,	/* WinUAE CPU/FPU/bus options */
+	OPT_CPU_CYCLE_EXACT,
 	OPT_CPU_ADDR24,
 	OPT_FPU_TYPE,
 	OPT_FPU_COMPATIBLE,
@@ -312,8 +313,10 @@
 
 #if ENABLE_WINUAE_CPU
 	{ OPT_HEADER, NULL, NULL, NULL, "WinUAE CPU/FPU/bus" },
+	{ OPT_CPU_PREFETCH, NULL, "--cpu-prefetch",
+	  "<bool>", "Better/more accurate (030) CPU prefetch" },
 	{ OPT_CPU_CYCLE_EXACT, NULL, "--cpu-exact",
-	  "<bool>", "Use cycle exact CPU emulation" },
+	  "<bool>", "Use (030) cycle exact CPU emulation" },
 	{ OPT_CPU_ADDR24, NULL, "--addr24",
 	  "<bool>", "Use 24-bit instead of 32-bit addressing mode" },
 	{ OPT_FPU_TYPE, NULL, "--fpu-type",
@@ -1368,6 +1371,11 @@
 			bLoadAutoSave = false;
 			break;
 
+		case OPT_CPU_PREFETCH:
+			ok = Opt_Bool(argv[++i], OPT_CPU_PREFETCH, &ConfigureParams.System.bPrefetchCpu);
+			bLoadAutoSave = false;
+			break;
+
 		case OPT_CPU_CYCLE_EXACT:
 			ok = Opt_Bool(argv[++i], OPT_CPU_CYCLE_EXACT, &ConfigureParams.System.bCycleExactCpu);
 			bLoadAutoSave = false;
@@ -1432,7 +1440,7 @@
 			else if (strcasecmp(argv[i], "falcon") == 0)
 			{
 #if ENABLE_DSP_EMU
-		ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
+				ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
 #endif
 				ConfigureParams.System.nMachineType = MACHINE_FALCON;
 				ConfigureParams.System.nCpuLevel = 3;
@@ -1442,6 +1450,22 @@
 			{
 				return Opt_ShowError(OPT_MACHINE, argv[i], "Unknown machine type");
 			}
+#if ENABLE_WINUAE_CPU
+			ConfigureParams.System.bMMU = false;	/* does this affect also other than 040 CPUs? */
+			ConfigureParams.System.bAddressSpace24 = true;
+			if (ConfigureParams.System.nCpuLevel > 0) {
+				/* TT / Falcon selected above */
+				ConfigureParams.System.bPrefetchCpu = true;
+				ConfigureParams.System.bCycleExactCpu = true;
+				ConfigureParams.System.bCompatibleFPU = true;
+				ConfigureParams.System.n_FPUType = FPU_68882;
+			} else {
+				/* WinUAE cycles are configured for Falcon/030, so disable this for ST/STE */
+				ConfigureParams.System.bPrefetchCpu = false;
+				ConfigureParams.System.bCycleExactCpu = false;
+				ConfigureParams.System.n_FPUType = FPU_NONE;	/* TODO: or leave it as-is? */
+			}
+#endif
 			bLoadAutoSave = false;
 			break;
 
diff -r f8b7da6c61de src/tos.c
--- a/src/tos.c	Thu May 31 23:00:07 2012 +0300
+++ b/src/tos.c	Thu May 31 23:14:19 2012 +0300
@@ -437,6 +437,7 @@
  */
 static void TOS_CheckSysConfig(void)
 {
+	int oldCpuLevel = ConfigureParams.System.nCpuLevel;
 	if ((TosVersion == 0x0106 || TosVersion == 0x0162) && ConfigureParams.System.nMachineType != MACHINE_STE)
 	{
 		Log_AlertDlg(LOG_ERROR, "TOS versions 1.06 and 1.62 are for Atari STE only.\n"
@@ -447,7 +448,6 @@
 		IoMem_Init();
 		ConfigureParams.System.nCpuFreq = 8;
 		ConfigureParams.System.nCpuLevel = 0;
-		M68000_CheckCpuSettings();
 	}
 	else if ((TosVersion & 0x0f00) == 0x0300 && ConfigureParams.System.nMachineType != MACHINE_TT)
 	{
@@ -459,7 +459,6 @@
 		IoMem_Init();
 		ConfigureParams.System.nCpuFreq = 32;
 		ConfigureParams.System.nCpuLevel = 3;
-		M68000_CheckCpuSettings();
 	}
 	else if ((TosVersion & 0x0f00) == 0x0400 && ConfigureParams.System.nMachineType != MACHINE_FALCON)
 	{
@@ -475,7 +474,6 @@
 		IoMem_Init();
 		ConfigureParams.System.nCpuFreq = 16;
 		ConfigureParams.System.nCpuLevel = 3;
-		M68000_CheckCpuSettings();
 	}
 	else if (TosVersion <= 0x0104 &&
 	         (ConfigureParams.System.nCpuLevel > 0 || ConfigureParams.System.nMachineType != MACHINE_ST))
@@ -489,7 +487,6 @@
 		IoMem_Init();
 		ConfigureParams.System.nCpuFreq = 8;
 		ConfigureParams.System.nCpuLevel = 0;
-		M68000_CheckCpuSettings();
 	}
 	else if ((TosVersion < 0x0300 && ConfigureParams.System.nMachineType == MACHINE_FALCON)
 	         || (TosVersion < 0x0200 && ConfigureParams.System.nMachineType == MACHINE_TT))
@@ -502,13 +499,31 @@
 		IoMem_Init();
 		ConfigureParams.System.nCpuFreq = 8;
 		ConfigureParams.System.nCpuLevel = 0;
-		M68000_CheckCpuSettings();
 	}
 	else if (TosVersion >= 0x0300 && ConfigureParams.System.nCpuLevel < 2)
 	{
 		Log_AlertDlg(LOG_ERROR, "This TOS version requires a CPU >= 68020.\n"
 		             " ==> Switching to 68020 mode now.\n");
 		ConfigureParams.System.nCpuLevel = 2;
+	}
+	/* TOS version triggered machine type change? */
+	if (ConfigureParams.System.nCpuLevel != oldCpuLevel)
+	{
+#if ENABLE_WINUAE_CPU
+		ConfigureParams.System.bMMU = false;		/* TODO: does this affect also other than 040 CPUs? */
+		ConfigureParams.System.bAddressSpace24 = true;
+		if (ConfigureParams.System.nCpuLevel > 0) {
+			/* TT / Falcon selected above */
+			ConfigureParams.System.bPrefetchCpu = true;
+			ConfigureParams.System.bCycleExactCpu = true;
+			ConfigureParams.System.n_FPUType = FPU_68882;
+		} else {
+			/* WinUAE cycles are configured for Falcon/030, so disable this for ST/STE */
+			ConfigureParams.System.bPrefetchCpu = false;
+			ConfigureParams.System.bCycleExactCpu = false;
+			ConfigureParams.System.n_FPUType = FPU_NONE;	/* TODO: or leave it as-is? */
+		}
+#endif
 		M68000_CheckCpuSettings();
 	}
 	if (TosVersion < 0x0104 && ConfigureParams.HardDisk.bUseHardDiskDirectories)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/