]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Support CPU frequency multpliers in prefetch mode.
authorToni Wilen <twilen@winuae.net>
Sat, 15 Feb 2020 14:51:15 +0000 (16:51 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 15 Feb 2020 14:51:15 +0000 (16:51 +0200)
cfgfile.cpp
newcpu.cpp
od-win32/win32gui.cpp

index e30977014aebe6428234d5d8658c0bc4d80afdfc..00e29c3e0f49831095d1077788c8a99dce3667b5 100644 (file)
@@ -8164,6 +8164,10 @@ static void set_68020_compa (struct uae_prefs *p, int compa, int cd32)
        case 2:
                p->cpu_compatible = true;
                p->m68k_speed = 0;
+               if (p->cpu_model == 68020)
+                       p->cpu_clock_multiplier = 4 << 8;
+               else
+                       p->cpu_clock_multiplier = 5 << 8;
                break;
        case 3:
                p->cpu_compatible = 0;
index 29ea2eb816a757e18f79ad87eae01edfc7da591e..f6fcd78f2cfc4bbf5b31b9145ff11609c51ed06a 100644 (file)
@@ -1949,7 +1949,7 @@ static unsigned long cycles_mult;
 static void update_68k_cycles (void)
 {
        cycles_mult = 0;
-       if (currprefs.m68k_speed >= 0 && !currprefs.cpu_cycle_exact) {
+       if (currprefs.m68k_speed >= 0 && !currprefs.cpu_cycle_exact && !currprefs.cpu_compatible) {
                if (currprefs.m68k_speed_throttle < 0) {
                        cycles_mult = (unsigned long)(CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle));
                } else if (currprefs.m68k_speed_throttle > 0) {
@@ -1998,7 +1998,15 @@ static void update_68k_cycles (void)
        }
        if (cpucycleunit < 1)
                cpucycleunit = 1;
-       if (currprefs.cpu_cycle_exact)
+       if (!currprefs.cpu_cycle_exact && currprefs.cpu_compatible) {
+               if (cpucycleunit == CYCLE_UNIT / 2) {
+                       cycles_mult = 0;
+               } else {
+                       cycles_mult = cpucycleunit * (CYCLES_DIV / (CYCLE_UNIT / 2));
+               }
+       }
+
+       if (currprefs.cpu_cycle_exact || currprefs.cpu_compatible)
                write_log (_T("CPU cycleunit: %d (%.3f)\n"), cpucycleunit, (float)cpucycleunit / CYCLE_UNIT);
        set_config_changed ();
 }
@@ -4520,12 +4528,12 @@ static void m68k_run_1 (void)
                                if (debug_opcode_watch) {
                                        debug_trainer_match();
                                }
-                               do_cycles (cpu_cycles);
                                r->instruction_pc = m68k_getpc ();
                                cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode) & 0xffff;
                                if (!regs.loop_mode)
                                        regs.ird = regs.opcode;
                                cpu_cycles = adjust_cycles (cpu_cycles);
+                               do_cycles(cpu_cycles);
                                regs.instruction_cnt++;
                                if (r->spcflags) {
                                        if (do_specialties (cpu_cycles))
@@ -5810,7 +5818,7 @@ static void m68k_run_2p (void)
 
                                } else {
 
-                                       cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode) >> 16;
+                                       cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode);
                                        cpu_cycles = adjust_cycles (cpu_cycles);
                                        regs.instruction_cnt++;
 
index 93959b8df722c00fb8edafef1616c273259fbbd0..1e0b6d26155b7295b8f114f76773e95e0bf4737b 100644 (file)
@@ -12557,7 +12557,7 @@ static void enable_for_cpudlg (HWND hDlg)
 #if 0
        ew(hDlg, IDC_CPU_MULTIPLIER, workprefs.cpu_cycle_exact);
 #endif
-       ew(hDlg, IDC_CPU_FREQUENCY, workprefs.cpu_cycle_exact && workprefs.m68k_speed >= 0);
+       ew(hDlg, IDC_CPU_FREQUENCY, (workprefs.cpu_cycle_exact || workprefs.cpu_compatible) && workprefs.m68k_speed >= 0);
        ew(hDlg, IDC_CPU_FREQUENCY2, workprefs.cpu_cycle_exact && !workprefs.cpu_clock_multiplier && workprefs.m68k_speed >= 0);
 
        ew(hDlg, IDC_FPU1, workprefs.cpu_model < 68040 && (workprefs.cpu_model >= 68020 || !workprefs.cpu_compatible));
@@ -12641,13 +12641,11 @@ static void values_to_cpudlg (HWND hDlg)
        CheckRadioButton (hDlg, IDC_MMUENABLEOFF, IDC_MMUENABLE, mmu == 0 ? IDC_MMUENABLEOFF : (mmu && workprefs.mmu_ec) ? IDC_MMUENABLEEC : IDC_MMUENABLE);
        CheckDlgButton(hDlg, IDC_CPU_PPC, workprefs.ppc_mode || is_ppc_cpu(&workprefs));
 
-       if (workprefs.cpu_cycle_exact) {
-               if (workprefs.cpu_clock_multiplier) {
-                       TCHAR txt[20];
-                       double f = getcpufreq (workprefs.cpu_clock_multiplier);
-                       _stprintf (txt, _T("%.6f"), f / 1000000.0);
-                       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt);
-               }
+       if ((workprefs.cpu_cycle_exact || workprefs.cpu_compatible) && workprefs.cpu_clock_multiplier) {
+               TCHAR txt[20];
+               double f = getcpufreq (workprefs.cpu_clock_multiplier);
+               _stprintf (txt, _T("%.6f"), f / 1000000.0);
+               SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt);
        } else {
                SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)_T(""));
        }
@@ -12822,12 +12820,12 @@ static void values_from_cpudlg (HWND hDlg)
                workprefs.cpu_clock_multiplier = 0;
                if (idx < 4) {
                        workprefs.cpu_clock_multiplier = (1 << 8) << idx;
-               } else {
+               } else if (workprefs.cpu_cycle_exact) {
                        TCHAR txt[20];
                        txt[0] = 0;
-                       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+                       SendDlgItemMessage(hDlg, IDC_CPU_FREQUENCY2, WM_GETTEXT, (WPARAM)sizeof(txt) / sizeof(TCHAR), (LPARAM)txt);
                        workprefs.cpu_clock_multiplier = 0;
-                       workprefs.cpu_frequency = (int)(_tstof (txt) * 1000000.0);
+                       workprefs.cpu_frequency = (int)(_tstof(txt) * 1000000.0);
                        if (workprefs.cpu_frequency < 1 * 1000000)
                                workprefs.cpu_frequency = 0;
                        if (workprefs.cpu_frequency >= 99 * 1000000)
@@ -12861,7 +12859,9 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)_T("2x (A500)"));
                SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)_T("4x (A1200)"));
                SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)_T("8x"));
-               SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)_T("Custom"));
+               if (workprefs.cpu_cycle_exact) {
+                       SendDlgItemMessage(hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)_T("Custom"));
+               }
 
                SendDlgItemMessage(hDlg, IDC_FPU_MODE, CB_RESETCONTENT, 0, 0);
                SendDlgItemMessage(hDlg, IDC_FPU_MODE, CB_ADDSTRING, 0, (LPARAM)_T("Host (64-bit)"));
@@ -12882,12 +12882,14 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                        idx = 2; // A1200
                }
                if (!workprefs.cpu_cycle_exact) {
-                       idx = 3;
-                       workprefs.cpu_clock_multiplier = 0;
                        workprefs.cpu_frequency = 0;
+                       if (!workprefs.cpu_clock_multiplier && (idx == 1 || idx == 2)) {
+                               workprefs.cpu_clock_multiplier = (1 << idx) << 8;
+                       }
                } else {
-                       if (!workprefs.cpu_frequency && (idx == 1 || idx == 2))
+                       if (!workprefs.cpu_frequency && (idx == 1 || idx == 2)) {
                                workprefs.cpu_clock_multiplier = (1 << idx) << 8;
+                       }
                }
                SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_SETCURSEL, idx, 0);
                if (!workprefs.cpu_clock_multiplier) {