Re: [hatari-devel] Separate --cpu-caches option

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


Hi,

On 17.3.2024 11.30, Nicolas Pomarède wrote:
Le 16/03/2024 à 23:53, Eero Tamminen a écrit :
As WinUAE CPU core supports it, attached is patch to enable CPU caches separately from cycle exact and prefetch/compatible options.

It should help in identifying compatibility issues better, and having more control over Hatari performance.
....
I think variable should be bCpuCacheData instead of just bCpuCaches because it's not the same thing as the instruction cache.

Ok. I changed it to --data-cache / bCpuDataCache option (after checking WinUAE CPU core code). New version attached.


Also, doing just a true/false that removes  the whole other tests in m68000.c is not good, because it can leave cache=true for 68000 cpu and have side effect later. so it should be something like :

         if ( ( changed_prefs.cpu_model < 68020 )
         ||  ( ( changed_prefs.cpu_compatible == false ) && ( changed_prefs.cpu_cycle_exact == false ) )
          || ( ConfigureParams.System.bCpuCaches == false )
  )
                 changed_prefs.cpu_data_cache = false;
         else
                 changed_prefs.cpu_data_cache = true;

But this check I changed to be against 030 as 020 does not have d-cache, only i-cache.


	- Eero
From 6af8373db76a42fbb23cc8392b21902e5e46f747 Mon Sep 17 00:00:00 2001
From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
Date: Mon, 22 Apr 2024 00:19:00 +0300
Subject: [PATCH 2/3] Document CPU data cache option

---
 doc/hatari.1          |   5 ++++-
 doc/images/cpu.png    | Bin 3256 -> 6951 bytes
 doc/manual.html       |  31 +++++++++++++++++++++----------
 doc/release-notes.txt |   2 ++
 4 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/doc/hatari.1 b/doc/hatari.1
index 4969d91a..07ec2cff 100644
--- a/doc/hatari.1
+++ b/doc/hatari.1
@@ -480,7 +480,10 @@ Use a more compatible 68000 CPU mode with better prefetch accuracy and
 cycle counting
 .TP
 .B \-\-cpu\-exact <bool>
-Use cycle exact CPU emulation (cache emulation)
+Use cycle exact CPU emulation
+.TP
+.B \-\-data\-cache <bool>
+Emulate >= 030 CPU data cache
 .TP
 .B \-\-addr24 <bool>
 Use 24-bit instead of 32-bit addressing mode
diff --git a/doc/images/cpu.png b/doc/images/cpu.png
index ea2d9588fae7dea5296644709e42785a47140e32..97a3b2ef05209f045eaf4f5ccd1bac8bcbcce272 100644
GIT binary patch
literal 6951
zcmb7Jc~sI{yT-E222C1G#Zu8crZguiYUONdY3k=(olJ8iaRg1%Cbe*uoJ&)~0Z--t
zh>~SFr8poaAW}FZa!irL>C$)ZJ>R<LkGs}g?B8O&?`E;~-tYT9`+449;#FJoJv)!=
z1ONbgEG<mz0RRcS_(|EZUF^}R|5PUa+J4L0+yt=s>+`a?JVWe}hFiEG#Ph1Z9*M|O
zqj0fPD%8@(RBBrCzyU=i{lm9l0KkztOOuP&Bk8<R|MYxaAb?$4lETps^$46l^W^0`
z8*0Z(8O`-R43f5(ZWWs97LR^5Fv$i=C#@~qCy&((b0q-HhaZ1ia5w|#Q<athh=-ak
zAe9X;j^Fyr_@^zN{ChrbSM=R2u8Yxzn+w95hn+TK{0Y;1302*WLgwR}KlLT5!F3%W
z&Gi%|^gcCRqD|1?wGpRsR!DkA9s96D=2^=1;s){m>nPsU0T(P-gp%fH&29Cl1UJT)
zx3T`Jw-U3DyeJ-bvebxZZ<+#qTU>GX2wDq9#Co|cC#~n<xIsewH1<nhdxbGF@if84
z{4_#oBMp_PJ?C|H<Wf-C@tJJf^RcTsFhB_}jeT^m<6+1lxuVxo(N}Xdt#Y|n+EpK)
z>8xH7p@W3e!`tnZYib}@o0R#&)pcZZon+7Rui0jDD19Ex?r0f{TwT6jmHX_z)Sm&X
zJ?kuoOltJS6Rj6tNoq?Qvm||zfN?sOa6o9MLni!`L&gnBDF9FrU;+O%j<!m~{cVel
zf7)=n&hClm*jWD|bSZ8_$FnUt@|ZIzx>Tlxs&C=(_-3R*k=;Uk<g3}pD1$54w)A0t
z`weM#X1VVBg1woStBwdor(PxnC|&LiWKAIcI0yV$m#|?P-!ykw7;UIbnL?cZ*JrYu
z8+t>(n#S?2M1W)5_%61a15b(_G7-*({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Q3{$K9;0|P-Z-Cm1*Krm}dK-Tz`(C^*6`^qCo>plQ
zfmi>G%9xUNF-Ix|nx*s(t`8d@z!V4Fq`ASGXvrR#JF5r*M_1mH+|IrD&-;va32$*{
zgGg^qb9-1`cS`IFP)RDd{s5cF_%0O7DXf{Mx~+kb2V!l;F&upTpC8pHl_e^_s4`-$
z&bMh&2;jNCo2K2A%@sk&ia&2(7R6sYV^hLR5RP$We{wh&$2=Q<M8#SY5S>G<LmcF~
zlJA(UpT=2*UDW{}&Q_+F#-*D=jqa5`Fg0{Gd2nr``tlQVmXj<%ZIIAwCAPfkc|AVZ
z0QAN4muCdc5fe2IwRkoP;Yel&el!pL)#M*fdr~6FZY||I-)@~P{saA>Tzl_FA>!uj
K<wQIap79^vTWQ?@

diff --git a/doc/manual.html b/doc/manual.html
index e5acbe32..01138965 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -990,7 +990,9 @@ disabled)</p>
 <p class="paramdesc">Use a more compatible 68000 CPU mode
 with better prefetch accuracy and cycle counting</p>
 <p class="parameter">--cpu-exact &lt;bool&gt;</p>
-<p class="paramdesc">Use cycle exact CPU emulation (cache emulation)</p>
+<p class="paramdesc">Use cycle exact CPU emulation</p>
+<p class="parameter">--data-cache &lt;bool&gt;</p>
+<p class="paramdesc">Emulate &gt;=030 CPU data cache</p>
 <p class="parameter">--addr24 &lt;bool&gt;</p>
 <p class="paramdesc">Use 24-bit instead of 32-bit addressing mode (24-bit is enabled by default)</p>
 <p class="parameter">--fpu &lt;x&gt;</p>
@@ -1382,7 +1384,7 @@ changes that you have made.
 <h4 class="gui">The CPU Dialog</h4>
 
 <div class="floatimage">
-  <img src="images/cpu.png" width="439" height="384"
+  <img src="images/cpu.png" width="440" height="399"
        alt="Hatari's GUI - the CPU dialog" />
 </div>
 
@@ -1404,7 +1406,7 @@ changes that you have made.
   If you are going to use TOS 1.0x, you also have to select the 68000 CPU,
   since these TOS versions are not aware of the higher CPU levels yet.
   If you want to use a higher CPU level with the ST or STE machine type,
-  you have to use TOS 2.0x instead.
+  you have to use TOS 2.0x (or EmuTOS) instead.
  </li>
  <li>
   Atari TT and Falcon computers were using the 68030 CPU, so you should select
@@ -1446,8 +1448,8 @@ changes that you have made.
  if you don't need it and if you have a slow host system.
 </p>
 <p>
- The &quot;Cycle exact&quot;, the &quot;MMU emulation&quot; and
- &quot;24-bit addressing&quot; options are considered as experimental and
+ The &quot;Cycle exact&quot;, &quot;Data cache&quot;, &quot;MMU emulation&quot;
+ and &quot;24-bit addressing&quot; options are considered as experimental and
  should only be changed if you know what you are doing.
 </p>
 
@@ -3041,13 +3043,22 @@ that do use DSP, many use it only for background music and work
 fine without the real DSP emulation.
 </p>
 
-<h4>CPU: cycle exact (030/TT/Falcon)</h4>
+<h4>CPU: data cache emulation (030/TT/Falcon)</h4>
 
 <p>
-CPU core supports 030 cache emulation for cycle accuracy. This
-is very heavy.  Unless program needs cycle accuracy to work correctly,
-you can disable it.  Many Falcon demos need it, applications and games
-normally don't.
+CPU core supports &gt;=030 data cache emulation for better m68k
+performance and cycle accuracy. This is very heavy.  Unless program
+needs cycle accuracy to work correctly, you can disable it.  Many
+Falcon demos need it, applications and games normally don't.
+</p>
+
+<h4>CPU: cycle exact</h4>
+
+<p>
+CPU core cycle supports CPU instruction cache emulation for cycle
+accuracy. This is heavy for &gt;= 020 m68k CPUs.  Unless program needs
+cycle accuracy to work correctly, you can disable it.  Many Falcon
+demos need it, applications and games normally don't.
 </p>
 
 <h4>Timer-D</h4>
diff --git a/doc/release-notes.txt b/doc/release-notes.txt
index d5ba65eb..5837369f 100644
--- a/doc/release-notes.txt
+++ b/doc/release-notes.txt
@@ -23,6 +23,8 @@ Following features are deprecated and will be removed in a future release:
  -------------------
 
 Emulator improvements:
+- Config options / SDL-GUI:
+  - Add separate option for enabling/disabling >=030 CPU data cache
 - GEMDOS HD:
   - Fix: Fattrib() call on a directory
 
-- 
2.39.2

From 17e894abe76d2e3e3eede26f2f9aa6aa43b50b59 Mon Sep 17 00:00:00 2001
From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
Date: Sat, 16 Mar 2024 20:28:40 +0200
Subject: [PATCH 1/3] Add config & SDL-GUI option for CPU cache emulation

---
 src/change.c                 |  4 ++++
 src/configuration.c          |  3 +++
 src/gui-sdl/dlgCpu.c         | 41 ++++++++++++++++++++++--------------
 src/includes/configuration.h |  1 +
 src/m68000.c                 | 11 +++++-----
 src/options.c                | 10 ++++++++-
 src/statusbar.c              | 15 ++++++++-----
 7 files changed, 58 insertions(+), 27 deletions(-)

diff --git a/src/change.c b/src/change.c
index f4ab4673..f9ab2fa2 100644
--- a/src/change.c
+++ b/src/change.c
@@ -149,6 +149,10 @@ bool Change_DoNeedReset(CNF_PARAMS *current, CNF_PARAMS *changed)
 	if (changed->System.bCycleExactCpu != current->System.bCycleExactCpu)
 		return true;
 
+	/* Did change CPU data cache? */
+	if (changed->System.bCpuDataCache != current->System.bCpuDataCache)
+		return true;
+
 	/* Did change MMU? */
 	if (changed->System.bMMU != current->System.bMMU)
 		return true;
diff --git a/src/configuration.c b/src/configuration.c
index b10cf378..c3529c12 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -542,6 +542,7 @@ static const struct Config_Tag configs_System[] =
 	{ "bFastForward", Bool_Tag, &ConfigureParams.System.bFastForward },
 	{ "bAddressSpace24", Bool_Tag, &ConfigureParams.System.bAddressSpace24 },
 	{ "bCycleExactCpu", Bool_Tag, &ConfigureParams.System.bCycleExactCpu },
+	{ "bCpuDataCache", Bool_Tag, &ConfigureParams.System.bCpuDataCache },
 	{ "n_FPUType", Int_Tag, &ConfigureParams.System.n_FPUType },
 /* JIT	{ "bCompatibleFPU", Bool_Tag, &ConfigureParams.System.bCompatibleFPU }, */
 	{ "bSoftFloatFPU", Bool_Tag, &ConfigureParams.System.bSoftFloatFPU },
@@ -847,6 +848,7 @@ void Configuration_SetDefault(void)
 	ConfigureParams.System.bCompatibleFPU = true; /* JIT */
 	ConfigureParams.System.bSoftFloatFPU = false;
 	ConfigureParams.System.bMMU = false;
+	ConfigureParams.System.bCpuDataCache = true;
 	ConfigureParams.System.bCycleExactCpu = true;
 	ConfigureParams.System.VideoTimingMode = VIDEO_TIMING_MODE_WS3;
 	ConfigureParams.System.bCompatibleCpu = true;
@@ -1232,6 +1234,7 @@ void Configuration_MemorySnapShot_Capture(bool bSave)
 	MemorySnapShot_Store(&ConfigureParams.System.bPatchTimerD, sizeof(ConfigureParams.System.bPatchTimerD));
 	MemorySnapShot_Store(&ConfigureParams.System.bAddressSpace24, sizeof(ConfigureParams.System.bAddressSpace24));
 
+	MemorySnapShot_Store(&ConfigureParams.System.bCpuDataCache, sizeof(ConfigureParams.System.bCpuDataCache));
 	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 --git a/src/gui-sdl/dlgCpu.c b/src/gui-sdl/dlgCpu.c
index 072af88b..77991e5e 100644
--- a/src/gui-sdl/dlgCpu.c
+++ b/src/gui-sdl/dlgCpu.c
@@ -28,13 +28,14 @@ const char DlgCpu_fileid[] = "Hatari dlgCpu.c";
 #define DLGCPU_FPU_CPU_IN 20
 #define DLGCPU_PREFETCH   23
 #define DLGCPU_CYC_EXACT  24
-#define DLGCPU_MMU_EMUL   25
-#define DLGCPU_24BITS     26
-#define DLGCPU_SOFTFLOAT  27
+#define DLGCPU_DATA_CACHE 25
+#define DLGCPU_MMU_EMUL   26
+#define DLGCPU_24BITS     27
+#define DLGCPU_SOFTFLOAT  28
 
 static SGOBJ cpudlg[] =
 {
-	{ SGBOX, 0, 0, 0,0, 44,24, NULL },
+	{ SGBOX, 0, 0, 0,0, 44,25, NULL },
 	{ SGTEXT, 0, 0, 17,1, 12,1, "CPU options" },
 
 	{ SGBOX, 0, 0, 2,3, 12,8, NULL },
@@ -49,26 +50,27 @@ static SGOBJ cpudlg[] =
 	{ SGBOX, 0, 0, 16,3, 12,8, NULL },
 	{ SGTEXT, 0, 0, 17,3, 10,1, "CPU clock:" },
 	{ SGRADIOBUT, 0, 0, 17,5, 8,1, " _8 Mhz" },
-	{ SGRADIOBUT, 0, 0, 17,6, 8,1, "1_6 Mhz" },
+	{ SGRADIOBUT, 0, 0, 17,6, 8,1, "16 M_hz" },
 	{ SGRADIOBUT, 0, 0, 17,7, 8,1, "32 Mh_z" },
 
 	{ SGBOX, 0, 0, 30,3, 12,8, NULL },
 	{ SGTEXT, 0, 0, 31,3, 4,1, "FPU:" },
 	{ SGRADIOBUT, 0, 0, 31,5, 6,1, "_None" },
 	{ SGRADIOBUT, 0, 0, 31,6, 7,1, "68881" },
-	{ SGRADIOBUT, 0, 0, 31,7, 7,1, "68882" },
+	{ SGRADIOBUT, 0, 0, 31,7, 7,1, "_68882" },
 	{ SGRADIOBUT, 0, 0, 31,8, 10,1, "_Internal" },
 
-	{ SGBOX, 0, 0, 2,12, 40,9, NULL },
+	{ SGBOX, 0, 0, 2,12, 40,10, NULL },
 	{ SGTEXT, 0, 0, 9,12, 24,1, "CPU emulation parameters" },
 	{ SGCHECKBOX, 0, 0, 3,14, 21,1, "_Prefetch emulation*" },
-	{ SGCHECKBOX, 0, 0, 3,15, 35,1, "_Cycle-exact with cache emulation*" },
-	{ SGCHECKBOX, 0, 0, 3,16, 16,1, "_MMU emulation*" },
-	{ SGCHECKBOX, 0, 0, 3,17, 20,1, "24-bit _addressing" },
-	{ SGCHECKBOX, 0, 0, 3,18, 26,1, "Accurate _FPU emulation*" },
-	{ SGTEXT, 0, 0, 3,20, 20,1, "* Uses more host CPU" },
-
-	{ SGBUTTON, SG_DEFAULT, 0, 13,22, 19,1, "Back to main menu" },
+	{ SGCHECKBOX, 0, 0, 3,15, 35,1, "_Cycle-exact emulation*" },
+	{ SGCHECKBOX, 0, 0, 3,16, 35,1, "_Data cache emulation* (>=030)" },
+	{ SGCHECKBOX, 0, 0, 3,17, 16,1, "_MMU emulation*" },
+	{ SGCHECKBOX, 0, 0, 3,18, 20,1, "24-bit _addressing" },
+	{ SGCHECKBOX, 0, 0, 3,19, 26,1, "Accurate _FPU emulation*" },
+	{ SGTEXT, 0, 0, 3,21, 20,1, "* Uses more host CPU" },
+
+	{ SGBUTTON, SG_DEFAULT, 0, 13,23, 19,1, "Back to main menu" },
 	{ SGSTOP, 0, 0, 0,0, 0,0, NULL }
 };
 
@@ -113,13 +115,19 @@ void DlgCpu_Main(void)
 		cpudlg[DLGCPU_24BITS].state |= SG_SELECTED;
 	else
 		cpudlg[DLGCPU_24BITS].state &= ~SG_SELECTED;
-		
+
 	/* Cycle exact CPU */
 	if (ConfigureParams.System.bCycleExactCpu)
 		cpudlg[DLGCPU_CYC_EXACT].state |= SG_SELECTED;
 	else
 		cpudlg[DLGCPU_CYC_EXACT].state &= ~SG_SELECTED;
 
+	/* CPU data cache */
+	if (ConfigureParams.System.bCpuDataCache)
+		cpudlg[DLGCPU_DATA_CACHE].state |= SG_SELECTED;
+	else
+		cpudlg[DLGCPU_DATA_CACHE].state &= ~SG_SELECTED;
+
 	/* FPU emulation */
 	for (i = DLGCPU_FPU_NONE; i <= DLGCPU_FPU_CPU_IN; i++)
 	{
@@ -168,8 +176,9 @@ void DlgCpu_Main(void)
 		Configuration_ChangeCpuFreq ( 8 );
 
 	ConfigureParams.System.bCompatibleCpu = (cpudlg[DLGCPU_PREFETCH].state & SG_SELECTED);
-
 	ConfigureParams.System.bCycleExactCpu = (cpudlg[DLGCPU_CYC_EXACT].state & SG_SELECTED);
+	ConfigureParams.System.bCpuDataCache = (cpudlg[DLGCPU_DATA_CACHE].state & SG_SELECTED);
+
 	ConfigureParams.System.bMMU = (cpudlg[DLGCPU_MMU_EMUL].state & SG_SELECTED);
 	ConfigureParams.System.bAddressSpace24 = (cpudlg[DLGCPU_24BITS].state & SG_SELECTED);
 	ConfigureParams.System.bSoftFloatFPU = (cpudlg[DLGCPU_SOFTFLOAT].state & SG_SELECTED);
diff --git a/src/includes/configuration.h b/src/includes/configuration.h
index 44d4ec06..0f91601c 100644
--- a/src/includes/configuration.h
+++ b/src/includes/configuration.h
@@ -403,6 +403,7 @@ typedef struct
   VIDEOTIMINGMODE VideoTimingMode;
 
   bool bCycleExactCpu;
+  bool bCpuDataCache;
   FPUTYPE n_FPUType;
   bool bCompatibleFPU;            /* More compatible FPU */
   bool bSoftFloatFPU;
diff --git a/src/m68000.c b/src/m68000.c
index e83f88de..a3889a4b 100644
--- a/src/m68000.c
+++ b/src/m68000.c
@@ -316,7 +316,7 @@ void M68000_Start(void)
  *	cpu_compatible : 0/false (no prefetch for 68000/20/30)  1/true (prefetch opcode for 68000/20/30)
  *	cpu_cycle_exact : 0/false   1/true (most accurate, implies cpu_compatible)
  *	cpu_memory_cycle_exact : 0/false   1/true (less accurate than cpu_cycle_exact)
- *	cpu_data_cache : 0/false (don't emulate caches)   1/true (emulate instr/data caches for 68020/30/40/60)
+ *	cpu_data_cache : 0/false (don't emulate data cache)   1/true (emulate data cache for 30/40/60)
  *	address_space_24 : 1 (68000/10 and 68030 LC for Falcon), 0 (68020/30/40/60)
  *	fpu_model : 0, 68881 (external), 68882 (external), 68040 (cpu) , 68060 (cpu)
  *	fpu_strict : true/false (more accurate rounding)
@@ -364,6 +364,7 @@ void M68000_CheckCpuSettings(void)
 
 	changed_prefs.int_no_unimplemented = true;
 	changed_prefs.fpu_no_unimplemented = true;
+	changed_prefs.cpu_data_cache = ConfigureParams.System.bCpuDataCache;
 	changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
 	changed_prefs.cpu_cycle_exact = ConfigureParams.System.bCycleExactCpu;
 	changed_prefs.cpu_memory_cycle_exact = ConfigureParams.System.bCycleExactCpu;
@@ -386,10 +387,10 @@ void M68000_CheckCpuSettings(void)
 	/* We don't use JIT */
 	changed_prefs.cachesize = 0;
 
-	/* Always emulate instr/data caches for cpu >= 68020 */
-	/* Cache emulation requires cpu_compatible or cpu_cycle_exact mode */
-	if ( ( changed_prefs.cpu_model < 68020 ) ||
-	     ( ( changed_prefs.cpu_compatible == false ) && ( changed_prefs.cpu_cycle_exact == false ) ) )
+	/* while 020 had i-cache, only 030+ had also d-cache */
+	if (changed_prefs.cpu_model < 68030 ||
+	    !ConfigureParams.System.bCpuDataCache ||
+	    !(changed_prefs.cpu_compatible || changed_prefs.cpu_cycle_exact))
 		changed_prefs.cpu_data_cache = false;
 	else
 		changed_prefs.cpu_data_cache = true;
diff --git a/src/options.c b/src/options.c
index 6b4d7d36..695730f9 100644
--- a/src/options.c
+++ b/src/options.c
@@ -165,6 +165,7 @@ enum {
 	OPT_CPULEVEL,		/* CPU options */
 	OPT_CPUCLOCK,
 	OPT_COMPATIBLE,
+	OPT_CPU_DATA_CACHE,
 	OPT_CPU_CYCLE_EXACT,
 	OPT_CPU_ADDR24,
 	OPT_FPU_TYPE,
@@ -435,7 +436,9 @@ static const opt_t HatariOptions[] = {
 	{ OPT_CPUCLOCK,  NULL, "--cpuclock",
 	  "<x>", "Set the CPU clock (x = 8/16/32)" },
 	{ OPT_COMPATIBLE, NULL, "--compatible",
-	  "<bool>", "Use a more compatible (but slower) prefetch mode for CPU" },
+	  "<bool>", "Use (more compatible) prefetch mode for CPU" },
+	{ OPT_CPU_DATA_CACHE, NULL, "--data-cache",
+	  "<bool>", "Emulate (>=030) CPU data cache" },
 	{ OPT_CPU_CYCLE_EXACT, NULL, "--cpu-exact",
 	  "<bool>", "Use cycle exact CPU emulation" },
 	{ OPT_CPU_ADDR24, NULL, "--addr24",
@@ -1848,6 +1851,11 @@ bool Opt_ParseParameters(int argc, const char * const argv[])
 			bLoadAutoSave = false;
 			break;
 
+		case OPT_CPU_DATA_CACHE:
+			ok = Opt_Bool(argv[++i], OPT_CPU_DATA_CACHE, &ConfigureParams.System.bCpuDataCache);
+			bLoadAutoSave = false;
+			break;
+
 		case OPT_CPU_CYCLE_EXACT:
 			ok = Opt_Bool(argv[++i], OPT_CPU_CYCLE_EXACT, &ConfigureParams.System.bCycleExactCpu);
 			bLoadAutoSave = false;
diff --git a/src/statusbar.c b/src/statusbar.c
index fdb05e53..0b5bc17c 100644
--- a/src/statusbar.c
+++ b/src/statusbar.c
@@ -501,10 +501,10 @@ void Statusbar_AddMessage(const char *msg, Uint32 msecs)
  */
 static char *Statusbar_AddString(char *buffer, const char *more)
 {
+	if (!more)
+		return buffer;
 	while (*more)
-	{
 		*buffer++ = *more++;
-	}
 	return buffer;
 }
 
@@ -540,11 +540,16 @@ void Statusbar_UpdateInfo(void)
 		*end++ = '0';
 	}
 
-	/* Prefetch mode or cycle exact mode ? */
+	const char *mode = NULL;
+	bool cache = ConfigureParams.System.bCpuDataCache && ConfigureParams.System.nCpuLevel > 2;
+	/* Prefetch / cycle exact mode and data cache? */
 	if ( ConfigureParams.System.bCycleExactCpu )
-		end = Statusbar_AddString(end, "(CE)");
+		mode = cache ? "(CED)" : "(CE)";
 	else if ( ConfigureParams.System.bCompatibleCpu )
-		end = Statusbar_AddString(end, "(PF)");
+		mode = cache ? "(PFD)" : "(PF)";
+	else if (cache)
+		mode = "(D)";
+	end = Statusbar_AddString(end, mode);
 
 	/* additional WinUAE CPU/FPU info */
 	*end++ = '/';
-- 
2.39.2



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