Annotation of hatari/src/gui-sdl/dlgCpu.c, revision 1.1.1.3

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.