|
|
1.1 ! root 1: /* ! 2: Hatari - dlgCpu.c ! 3: ! 4: This file is distributed under the GNU General Public License, version 2 ! 5: or at your option any later version. Read the file gpl.txt for details. ! 6: ! 7: This is the CPU settings dialog ! 8: */ ! 9: const char DlgCpu_fileid[] = "Hatari dlgCpu.c : " __DATE__ " " __TIME__; ! 10: ! 11: #include "main.h" ! 12: #include "configuration.h" ! 13: #include "dialog.h" ! 14: #include "sdlgui.h" ! 15: ! 16: #define FPU_JIT 0 ! 17: ! 18: #define DLGCPU_68000 4 ! 19: #define DLGCPU_68010 5 ! 20: #define DLGCPU_68020 6 ! 21: #define DLGCPU_68030 7 ! 22: #define DLGCPU_68040 8 ! 23: #define DLGCPU_68060 9 ! 24: #define DLGCPU_8MHZ 12 ! 25: #define DLGCPU_16MHZ 13 ! 26: #define DLGCPU_32MHZ 14 ! 27: #define DLGCPU_FPU_NONE 17 ! 28: #define DLGCPU_FPU_68881 18 ! 29: #define DLGCPU_FPU_68882 19 ! 30: #define DLGCPU_FPU_CPU_IN 20 ! 31: #if FPU_JIT ! 32: #define DLGCPU_FPU_JIT_COMPAT 21 ! 33: #define DLGCPU_PREFETCH 25 ! 34: #define DLGCPU_CYC_EXACT 26 ! 35: #define DLGCPU_MMU_EMUL 27 ! 36: #define DLGCPU_24BITS 28 ! 37: #else ! 38: #define DLGCPU_PREFETCH 23 ! 39: #define DLGCPU_CYC_EXACT 24 ! 40: #define DLGCPU_MMU_EMUL 25 ! 41: #define DLGCPU_24BITS 26 ! 42: #endif ! 43: ! 44: static SGOBJ cpudlg[] = ! 45: { ! 46: { SGBOX, 0, 0, 0,0, 46,23, NULL }, ! 47: { SGTEXT, 0, 0, 17,1, 14,1, "CPU options" }, ! 48: ! 49: { SGBOX, 0, 0, 2,3, 13,9, NULL }, ! 50: { SGTEXT, 0, 0, 3,3, 8,1, "CPU type" }, ! 51: { SGRADIOBUT, 0, 0, 3, 5, 7,1, "680_00" }, ! 52: { SGRADIOBUT, 0, 0, 3, 6, 7,1, "680_10" }, ! 53: { SGRADIOBUT, 0, 0, 3, 7, 7,1, "680_20" }, ! 54: #ifdef ENABLE_WINUAE_CPU ! 55: { SGRADIOBUT, 0, 0, 3, 8, 7,1, "680_30" }, ! 56: { SGRADIOBUT, 0, 0, 3, 9, 7,1, "680_40" }, ! 57: { SGRADIOBUT, 0, 0, 3,10, 7,1, "68060" }, ! 58: #else ! 59: { SGRADIOBUT, 0, 0, 3, 8,11,1, "680_30+FPU" }, ! 60: { SGRADIOBUT, 0, 0, 3, 9, 7,1, "680_40" }, ! 61: { SGTEXT, 0, 0, 3,10, 7,1, "" }, ! 62: #endif ! 63: ! 64: { SGBOX, 0, 0, 16,3, 13,9, NULL }, ! 65: { SGTEXT, 0, 0, 17,3, 15,1, "CPU clock" }, ! 66: { SGRADIOBUT, 0, 0, 17,5, 8,1, " _8 Mhz" }, ! 67: { SGRADIOBUT, 0, 0, 17,6, 8,1, "1_6 Mhz" }, ! 68: { SGRADIOBUT, 0, 0, 17,7, 8,1, "32 _Mhz" }, ! 69: ! 70: { SGBOX, 0, 0, 30,3, 14,9, NULL }, ! 71: { SGTEXT, 0, 0, 31,3, 11,1, "FPU" }, ! 72: #ifdef ENABLE_WINUAE_CPU ! 73: { SGRADIOBUT, 0, 0, 31,5, 6,1, "N_one" }, ! 74: { SGRADIOBUT, 0, 0, 31,6, 7,1, "68881" }, ! 75: { SGRADIOBUT, 0, 0, 31,7, 7,1, "68882" }, ! 76: { SGRADIOBUT, 0, 0, 31,8, 10,1, "_internal" }, ! 77: # if FPU_JIT ! 78: { SGCHECKBOX, 0, 0, 31,10, 12,1, "_compatible," }, ! 79: { SGTEXT, 0, 0, 33,11, 12,1, "but slower" }, ! 80: # endif ! 81: #else ! 82: { SGTEXT, 0, 0, 31,5, 10,1, "FPU config" }, ! 83: { SGTEXT, 0, 0, 31,6, 10,1, "unavailable" }, ! 84: { SGTEXT, 0, 0, 31,7, 10,1, "in old UAE" }, ! 85: { SGTEXT, 0, 0, 31,8, 10,1, "CPU core" }, ! 86: { SGTEXT, 0, 0, 31,10, 25,1, "" }, ! 87: { SGTEXT, 0, 0, 33,11, 12,1, "" }, ! 88: #endif ! 89: ! 90: { SGBOX, 0, 0, 2,13, 42,7, NULL }, ! 91: { SGTEXT, 0, 0, 3,13, 11,1, "CPU parameters" }, ! 92: { SGCHECKBOX, 0, 0, 3,15, 23,1, "Prefetc_h mode, slower" }, ! 93: #ifdef ENABLE_WINUAE_CPU ! 94: { SGCHECKBOX, 0, 0, 3,16, 21,1, "Cycle e_xact, slower" }, ! 95: { SGCHECKBOX, 0, 0, 3,17, 15,1, "MM_U emulation" }, ! 96: { SGCHECKBOX, 0, 0, 3,18, 20,1, "24 bits add_ressing" }, ! 97: #else ! 98: { SGTEXT, 0, 0, 3,16, 1,1, "" }, ! 99: { SGTEXT, 0, 0, 3,17, 1,1, "" }, ! 100: { SGTEXT, 0, 0, 3,18, 1,1, "" }, ! 101: #endif ! 102: ! 103: { SGBUTTON, SG_DEFAULT, 0, 13,21, 19,1, "Back to main menu" }, ! 104: { SGSTOP, 0, 0, 0,0, 0,0, NULL } ! 105: }; ! 106: ! 107: ! 108: /*-----------------------------------------------------------------------*/ ! 109: /** ! 110: * Show and process the "CPU" dialog ! 111: */ ! 112: void DlgCpu_Main(void) ! 113: { ! 114: int i; ! 115: ! 116: SDLGui_CenterDlg(cpudlg); ! 117: ! 118: /* CPU level: */ ! 119: for (i = DLGCPU_68000; i <= DLGCPU_68060; i++) ! 120: { ! 121: cpudlg[i].state &= ~SG_SELECTED; ! 122: } ! 123: cpudlg[DLGCPU_68000+ConfigureParams.System.nCpuLevel].state |= SG_SELECTED; ! 124: ! 125: /* CPU frequency: */ ! 126: for (i = DLGCPU_8MHZ; i <= DLGCPU_32MHZ; i++) ! 127: { ! 128: cpudlg[i].state &= ~SG_SELECTED; ! 129: } ! 130: if (ConfigureParams.System.nCpuFreq == 32) ! 131: cpudlg[DLGCPU_32MHZ].state |= SG_SELECTED; ! 132: else if (ConfigureParams.System.nCpuFreq == 16) ! 133: cpudlg[DLGCPU_16MHZ].state |= SG_SELECTED; ! 134: else ! 135: cpudlg[DLGCPU_8MHZ].state |= SG_SELECTED; ! 136: ! 137: /* More compatible CPU, Prefetch mode */ ! 138: if (ConfigureParams.System.bCompatibleCpu) ! 139: cpudlg[DLGCPU_PREFETCH].state |= SG_SELECTED; ! 140: else ! 141: cpudlg[DLGCPU_PREFETCH].state &= ~SG_SELECTED; ! 142: ! 143: #ifdef ENABLE_WINUAE_CPU ! 144: /* Address space 24 bits */ ! 145: if (ConfigureParams.System.bAddressSpace24) ! 146: cpudlg[DLGCPU_24BITS].state |= SG_SELECTED; ! 147: else ! 148: cpudlg[DLGCPU_24BITS].state &= ~SG_SELECTED; ! 149: ! 150: /* Cycle exact CPU */ ! 151: if (ConfigureParams.System.bCycleExactCpu) ! 152: cpudlg[DLGCPU_CYC_EXACT].state |= SG_SELECTED; ! 153: else ! 154: cpudlg[DLGCPU_CYC_EXACT].state &= ~SG_SELECTED; ! 155: ! 156: /* FPU emulation */ ! 157: for (i = DLGCPU_FPU_NONE; i <= DLGCPU_FPU_CPU_IN; i++) ! 158: { ! 159: cpudlg[i].state &= ~SG_SELECTED; ! 160: } ! 161: if (ConfigureParams.System.n_FPUType == FPU_NONE) ! 162: cpudlg[DLGCPU_FPU_NONE].state |= SG_SELECTED; ! 163: else if (ConfigureParams.System.n_FPUType == FPU_68881) ! 164: cpudlg[DLGCPU_FPU_68881].state |= SG_SELECTED; ! 165: else if (ConfigureParams.System.n_FPUType == FPU_68882) ! 166: cpudlg[DLGCPU_FPU_68882].state |= SG_SELECTED; ! 167: else ! 168: cpudlg[DLGCPU_FPU_CPU_IN].state |= SG_SELECTED; ! 169: ! 170: /* More compatible FPU JIT */ ! 171: # if FPU_JIT ! 172: if (ConfigureParams.System.bCompatibleFPU) ! 173: cpudlg[DLGCPU_FPU_JIT_COMPAT].state |= SG_SELECTED; ! 174: else ! 175: cpudlg[DLGCPU_FPU_JIT_COMPAT].state &= ~SG_SELECTED; ! 176: # endif ! 177: ! 178: /* MMU Emulation */ ! 179: if (ConfigureParams.System.bMMU) ! 180: cpudlg[DLGCPU_MMU_EMUL].state |= SG_SELECTED; ! 181: else ! 182: cpudlg[DLGCPU_MMU_EMUL].state &= ~SG_SELECTED; ! 183: #endif ! 184: ! 185: /* Show the dialog: */ ! 186: SDLGui_DoDialog(cpudlg, NULL, false); ! 187: ! 188: /* Read values from dialog: */ ! 189: ! 190: for (i = DLGCPU_68000; i <= DLGCPU_68060; i++) ! 191: { ! 192: if (cpudlg[i].state&SG_SELECTED) ! 193: { ! 194: ConfigureParams.System.nCpuLevel = i-DLGCPU_68000; ! 195: break; ! 196: } ! 197: } ! 198: ! 199: if (cpudlg[DLGCPU_32MHZ].state & SG_SELECTED) ! 200: ConfigureParams.System.nCpuFreq = 32; ! 201: else if (cpudlg[DLGCPU_16MHZ].state & SG_SELECTED) ! 202: ConfigureParams.System.nCpuFreq = 16; ! 203: else ! 204: ConfigureParams.System.nCpuFreq = 8; ! 205: ! 206: ConfigureParams.System.bCompatibleCpu = (cpudlg[DLGCPU_PREFETCH].state & SG_SELECTED); ! 207: ! 208: #ifdef ENABLE_WINUAE_CPU ! 209: ConfigureParams.System.bCycleExactCpu = (cpudlg[DLGCPU_CYC_EXACT].state & SG_SELECTED); ! 210: ConfigureParams.System.bMMU = (cpudlg[DLGCPU_MMU_EMUL].state & SG_SELECTED); ! 211: ConfigureParams.System.bAddressSpace24 = (cpudlg[DLGCPU_24BITS].state & SG_SELECTED); ! 212: ! 213: /* FPU emulation */ ! 214: if (cpudlg[DLGCPU_FPU_NONE].state & SG_SELECTED) ! 215: ConfigureParams.System.n_FPUType = FPU_NONE; ! 216: else if (cpudlg[DLGCPU_FPU_68881].state & SG_SELECTED) ! 217: ConfigureParams.System.n_FPUType = FPU_68881; ! 218: else if (cpudlg[DLGCPU_FPU_68882].state & SG_SELECTED) ! 219: ConfigureParams.System.n_FPUType = FPU_68882; ! 220: else ! 221: ConfigureParams.System.n_FPUType = FPU_CPU; ! 222: ! 223: # if FPU_JIT ! 224: ConfigureParams.System.bCompatibleFPU = (cpudlg[DLGCPU_FPU_JIT_COMPAT].state & SG_SELECTED); ! 225: # endif ! 226: #endif ! 227: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.