Re: [hatari-devel] WinUAE core freeze with ST emulation

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


Hi,

On maanantai 04 kesäkuu 2012, Thomas Huth wrote:
> Ok, thanks for the extensive tests! I think I found and fixed the
> problem with extended VDI/GEMDOS now: The problem was how the CPU cores
> emulated the CPU internal prefetch ... the code changed between our old
> core and WinUAE core.
> Could you please do again some regression test to see whether it works
> now as expected and take care of the TT FPU (Falcon was not shipped with
> a FPU by default, so I think you only have to set it for TT mode).

OK, attached is the winuae patch with CPU prefetch/exact stuff removed,
does it look OK to apply?

I tested your changes with it and now all TOS versions boot fine
with the WinUAE core in all HW configs TOS tester checks!


I guess also some tests with few cycle exact Falcon demos would also
be needed to verify that the changes didn't affect the Falcon emulation
side negatively.


	- Eero
diff -r 559973ee3775 src/change.c
--- a/src/change.c	Mon Jun 04 23:16:15 2012 +0300
+++ b/src/change.c	Tue Jun 05 00:27:41 2012 +0300
@@ -129,6 +129,10 @@
 	/* Did change MMU? */
 	if (changed->System.bMMU != current->System.bMMU)
 		return true;
+ 
+	/* Did change FPU? */
+	if (changed->System.n_FPUType != current->System.n_FPUType)
+		return true;
 #endif
 
 	/* Did change size of memory? */
diff -r 559973ee3775 src/configuration.c
--- a/src/configuration.c	Mon Jun 04 23:16:15 2012 +0300
+++ b/src/configuration.c	Tue Jun 05 00:27:41 2012 +0300
@@ -512,23 +512,29 @@
 	strcpy(ConfigureParams.Rom.szCartridgeImageFileName, "");
 
 	/* Set defaults for System */
-	ConfigureParams.System.nCpuLevel = 0;
-	ConfigureParams.System.nCpuFreq = 8;
+#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.n_FPUType = FPU_NONE;
+	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
diff -r 559973ee3775 src/options.c
--- a/src/options.c	Mon Jun 04 23:16:15 2012 +0300
+++ b/src/options.c	Tue Jun 05 00:27:41 2012 +0300
@@ -1432,7 +1432,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 +1442,17 @@
 			{
 				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 (strcasecmp(argv[i], "tt") == 0)
+			{
+				ConfigureParams.System.bCompatibleFPU = true;
+				ConfigureParams.System.n_FPUType = FPU_68882;
+			} else {
+				ConfigureParams.System.n_FPUType = FPU_NONE;	/* TODO: or leave it as-is? */
+			}
+#endif
 			bLoadAutoSave = false;
 			break;
 
diff -r 559973ee3775 src/tos.c
--- a/src/tos.c	Mon Jun 04 23:16:15 2012 +0300
+++ b/src/tos.c	Tue Jun 05 00:27:41 2012 +0300
@@ -437,6 +437,7 @@
  */
 static void TOS_CheckSysConfig(void)
 {
+	MACHINETYPE oldMachineType = ConfigureParams.System.nMachineType;
 	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,27 @@
 		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 changes? */
+	if (ConfigureParams.System.nMachineType != oldMachineType)
+	{
+#if ENABLE_WINUAE_CPU
+		if (ConfigureParams.System.nMachineType == MACHINE_TT)
+		{
+			ConfigureParams.System.bCompatibleFPU = true;
+			ConfigureParams.System.n_FPUType = FPU_68882;
+		} else {
+			ConfigureParams.System.n_FPUType = FPU_NONE;	/* TODO: or leave it as-is? */
+		}
+		ConfigureParams.System.bAddressSpace24 = true;
+		ConfigureParams.System.bMMU = false;	/* does this affect also other than 040 CPUs? */
+#endif
 		M68000_CheckCpuSettings();
 	}
 	if (TosVersion < 0x0104 && ConfigureParams.HardDisk.bUseHardDiskDirectories)


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