Annotation of hatari/src/gui-sdl/dlgSystem.c, revision 1.1.1.13

1.1       root        1: /*
                      2:   Hatari - dlgSystem.c
                      3: 
1.1.1.12  root        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.
1.1.1.9   root        6:   
                      7:   This file contains 2 system panels :
                      8:     - 1 for the old uae CPU
                      9:     - 1 for the new WinUae cpu
                     10:     
                     11:   The selection is made during compilation with the ENABLE_WINUAE_CPU define
                     12: 
1.1       root       13: */
1.1.1.7   root       14: const char DlgSystem_fileid[] = "Hatari dlgSystem.c : " __DATE__ " " __TIME__;
1.1       root       15: 
                     16: #include "main.h"
                     17: #include "configuration.h"
                     18: #include "dialog.h"
                     19: #include "sdlgui.h"
                     20: 
                     21: 
1.1.1.13! root       22: #define DLGSYS_ST          4
        !            23: #define DLGSYS_STE         5
        !            24: #define DLGSYS_TT          6
        !            25: #define DLGSYS_FALCON      7
        !            26: #define DLGSYS_68000      10
        !            27: #define DLGSYS_68010      11
        !            28: #define DLGSYS_68020      12
        !            29: #define DLGSYS_68030      13
        !            30: #define DLGSYS_68040      14
        !            31: #define DLGSYS_68060      15
1.1.1.9   root       32: #define DLGSYS_8MHZ       18
                     33: #define DLGSYS_16MHZ      19
                     34: #define DLGSYS_32MHZ      20
                     35: #define DLGSYS_DSPOFF     23
                     36: #define DLGSYS_DSPDUMMY   24
                     37: #define DLGSYS_DSPON      25
1.1.1.13! root       38: #define DLGSYS_RTC        28
        !            39: #define DLGSYS_BLITTER    29
        !            40: #define DLGSYS_TIMERD     30
        !            41: #define DLGSYS_FASTBOOT   31
        !            42: #define DLGSYS_PREFETCH   32
        !            43: #define DLGSYS_CYC_EXACT  33
1.1.1.9   root       44: #define DLGSYS_MMU_EMUL   34
1.1.1.13! root       45: #define DLGSYS_24BITS     35
        !            46: #define DLGSYS_FPU_NONE   38
        !            47: #define DLGSYS_FPU_68881  39
        !            48: #define DLGSYS_FPU_68882  40
        !            49: #define DLGSYS_FPU_CPU_IN 41
        !            50: #define DLGSYS_FPU_COMPAT 42
1.1.1.9   root       51: 
                     52: 
                     53: static SGOBJ systemdlg[] =
                     54: {
                     55:        { SGBOX, 0, 0, 0,0, 60,25, NULL },
                     56:        { SGTEXT, 0, 0, 23,1, 14,1, "System options" },
                     57: 
1.1.1.13! root       58:        { SGBOX, 0, 0, 2,3, 14,8, NULL },
1.1.1.9   root       59:        { SGTEXT, 0, 0, 3,3, 13,1, "Machine type" },
                     60:        { SGRADIOBUT, 0, 0, 3,5, 8,1, "ST" },
                     61:        { SGRADIOBUT, 0, 0, 3,6, 8,1, "STE" },
                     62:        { SGRADIOBUT, 0, 0, 3,7, 8,1, "TT" },
                     63:        { SGRADIOBUT, 0, 0, 3,8, 8,1, "Falcon" },
                     64: 
1.1.1.13! root       65:        { SGBOX, 0, 0, 17,3, 13,8, NULL },
        !            66:        { SGTEXT, 0, 0, 19,3, 8,1, "CPU type" },
        !            67:        { SGRADIOBUT, 0, 0, 19,5, 7,1, "68000" },
        !            68:        { SGRADIOBUT, 0, 0, 19,6, 7,1, "68010" },
        !            69:        { SGRADIOBUT, 0, 0, 19,7, 7,1, "68020" },
        !            70: #ifdef ENABLE_WINUAE_CPU
        !            71:        { SGRADIOBUT, 0, 0, 19,8, 7,1, "68030" },
        !            72:        { SGRADIOBUT, 0, 0, 19,9, 7,1, "68040" },
        !            73:        { SGRADIOBUT, 0, 0, 19,10, 7,1, "68060" },
        !            74: #else
        !            75:        { SGRADIOBUT, 0, 0, 19,8, 13,1, "68030+FPU" },
        !            76:        { SGRADIOBUT, 0, 0, 19,9, 7,1, "68040" },
        !            77:        { SGTEXT, 0, 0, 19,10, 7,1, "" },
        !            78: #endif
        !            79: 
        !            80:        { SGBOX, 0, 0, 31,3, 12,8, NULL },
        !            81:        { SGTEXT, 0, 0, 32,3, 15,1, "CPU clock" },
        !            82:        { SGRADIOBUT, 0, 0, 32,5, 8,1, " 8 Mhz" },
        !            83:        { SGRADIOBUT, 0, 0, 32,6, 8,1, "16 Mhz" },
        !            84:        { SGRADIOBUT, 0, 0, 32,7, 8,1, "32 Mhz" },
        !            85: 
        !            86:        { SGBOX, 0, 0, 44,3, 14,8, NULL },
        !            87:        { SGTEXT, 0, 0, 45,3, 11,1, "Falcon DSP" },
        !            88:        { SGRADIOBUT, 0, 0, 45,5, 6,1, "None" },
        !            89:        { SGRADIOBUT, 0, 0, 45,6, 7,1, "Dummy" },
        !            90:        { SGRADIOBUT, 0, 0, 45,7, 6,1, "Full" },
        !            91: 
        !            92: #ifdef ENABLE_WINUAE_CPU
        !            93:        { SGBOX, 0, 0, 2,12, 41,10, NULL },
        !            94: #else
        !            95:        { SGBOX, 0, 0, 2,12, 56,9, NULL },
        !            96: #endif
        !            97:        { SGTEXT, 0, 0, 3,12, 11,1, "CPU & system parameters" },
        !            98:        { SGCHECKBOX, 0, 0, 3,14, 27,1, "Real time clock emulation" },
        !            99:        { SGCHECKBOX, 0, 0, 3,15, 20,1, "Blitter emulation" },
        !           100:        { SGCHECKBOX, 0, 0, 3,16, 15,1, "Patch Timer-D" },
        !           101:        { SGCHECKBOX, 0, 0, 3,17, 39,1, "Boot faster by patching TOS & sysvars" },
        !           102:        { SGCHECKBOX, 0, 0, 3,18, 25,1, "Prefetch mode, slower" },
        !           103: #ifdef ENABLE_WINUAE_CPU
        !           104:        { SGCHECKBOX, 0, 0, 3,19, 22,1, "Cycle exact, slower" },
        !           105:        { SGCHECKBOX, 0, 0, 3,20, 15,1, "MMU emulation" },
        !           106:        { SGCHECKBOX, 0, 0, 3,21, 21,1, "24 bits addressing" },
        !           107: #else
        !           108:        { SGTEXT, 0, 0, 3,19, 1,1, "" },
        !           109:        { SGTEXT, 0, 0, 3,20, 1,1, "" },
        !           110:        { SGTEXT, 0, 0, 3,21, 1,1, "" },
        !           111: #endif
1.1.1.9   root      112: 
1.1.1.13! root      113: #ifdef ENABLE_WINUAE_CPU
        !           114:        { SGBOX, 0, 0, 44,12, 14,10, NULL },
        !           115:        { SGTEXT, 0, 0, 45,12, 11,1, "FPU" },
        !           116:        { SGRADIOBUT, 0, 0, 45,14, 6,1, "None" },
        !           117:        { SGRADIOBUT, 0, 0, 45,15, 7,1, "68881" },
        !           118:        { SGRADIOBUT, 0, 0, 45,16, 7,1, "68882" },
        !           119:        { SGRADIOBUT, 0, 0, 45,17, 14,1, "internal" },
        !           120:        { SGCHECKBOX, 0, 0, 45,19, 25,1, "compatible" },
        !           121:        { SGTEXT, 0, 0, 47,20, 12,1, "but slower" },
        !           122: #else
        !           123:        { SGTEXT, 0, 0, 44,12, 14,10, "" },
        !           124:        { SGTEXT, 0, 0, 45,12, 11,1, "" },
        !           125:        { SGTEXT, 0, 0, 45,14, 6,1, "" },
        !           126:        { SGTEXT, 0, 0, 45,15, 7,1, "" },
        !           127:        { SGTEXT, 0, 0, 45,16, 7,1, "" },
        !           128:        { SGTEXT, 0, 0, 45,17, 14,1, "" },
        !           129:        { SGTEXT, 0, 0, 45,19, 25,1, "" },
        !           130:        { SGTEXT, 0, 0, 47,20, 12,1, "" },
        !           131: #endif
1.1.1.9   root      132:        { SGBUTTON, SG_DEFAULT, 0, 21,23, 20,1, "Back to main menu" },
                    133:        { -1, 0, 0, 0,0, 0,0, NULL }
                    134: };
                    135: 
                    136: 
                    137: /*-----------------------------------------------------------------------*/
                    138: /**
1.1.1.13! root      139:  * Show and process the "System" dialog
1.1.1.9   root      140:  */
                    141: void Dialog_SystemDlg(void)
                    142: {
                    143:        int i;
                    144:        MACHINETYPE     mti;
                    145: 
                    146:        SDLGui_CenterDlg(systemdlg);
                    147: 
                    148:        /* Set up dialog from actual values: */
                    149: 
                    150:        for (i = DLGSYS_68000; i <= DLGSYS_68060; i++)
                    151:        {
                    152:                systemdlg[i].state &= ~SG_SELECTED;
                    153:        }
                    154:        systemdlg[DLGSYS_68000+ConfigureParams.System.nCpuLevel].state |= SG_SELECTED;
                    155: 
                    156:        for (i = DLGSYS_ST; i <= DLGSYS_FALCON; i++)
                    157:        {
                    158:                systemdlg[i].state &= ~SG_SELECTED;
                    159:        }
                    160:        systemdlg[DLGSYS_ST + ConfigureParams.System.nMachineType].state |= SG_SELECTED;
                    161: 
                    162:        /* CPU frequency: */
                    163:        for (i = DLGSYS_8MHZ; i <= DLGSYS_16MHZ; i++)
                    164:        {
                    165:                systemdlg[i].state &= ~SG_SELECTED;
                    166:        }
                    167:        if (ConfigureParams.System.nCpuFreq == 32)
                    168:                systemdlg[DLGSYS_32MHZ].state |= SG_SELECTED;
                    169:        else if (ConfigureParams.System.nCpuFreq == 16)
                    170:                systemdlg[DLGSYS_16MHZ].state |= SG_SELECTED;
                    171:        else
                    172:                systemdlg[DLGSYS_8MHZ].state |= SG_SELECTED;
                    173: 
                    174:        /* DSP mode: */
                    175:        for (i = DLGSYS_DSPOFF; i <= DLGSYS_DSPON; i++)
                    176:        {
                    177:                systemdlg[i].state &= ~SG_SELECTED;
                    178:        }
                    179:        if (ConfigureParams.System.nDSPType == DSP_TYPE_NONE)
                    180:                systemdlg[DLGSYS_DSPOFF].state |= SG_SELECTED;
                    181:        else if (ConfigureParams.System.nDSPType == DSP_TYPE_DUMMY)
                    182:                systemdlg[DLGSYS_DSPDUMMY].state |= SG_SELECTED;
                    183:        else
                    184:                systemdlg[DLGSYS_DSPON].state |= SG_SELECTED;
                    185: 
                    186:        /* More compatible CPU, Prefetch mode */
                    187:        if (ConfigureParams.System.bCompatibleCpu)
                    188:                systemdlg[DLGSYS_PREFETCH].state |= SG_SELECTED;
                    189:        else
                    190:                systemdlg[DLGSYS_PREFETCH].state &= ~SG_SELECTED;
                    191: 
                    192:        /* Emulate Blitter */
                    193:        if (ConfigureParams.System.bBlitter)
                    194:                systemdlg[DLGSYS_BLITTER].state |= SG_SELECTED;
                    195:        else
                    196:                systemdlg[DLGSYS_BLITTER].state &= ~SG_SELECTED;
                    197: 
                    198:        /* Real time clock CPU */
                    199:        if (ConfigureParams.System.bRealTimeClock)
                    200:                systemdlg[DLGSYS_RTC].state |= SG_SELECTED;
                    201:        else
                    202:                systemdlg[DLGSYS_RTC].state &= ~SG_SELECTED;
                    203: 
                    204:        /* Patch timer D */
                    205:        if (ConfigureParams.System.bPatchTimerD)
                    206:                systemdlg[DLGSYS_TIMERD].state |= SG_SELECTED;
                    207:        else
                    208:                systemdlg[DLGSYS_TIMERD].state &= ~SG_SELECTED;
                    209: 
1.1.1.13! root      210:        /* Boot faster by patching system variables */
        !           211:        if (ConfigureParams.System.bFastBoot)
        !           212:                systemdlg[DLGSYS_FASTBOOT].state |= SG_SELECTED;
        !           213:        else
        !           214:                systemdlg[DLGSYS_FASTBOOT].state &= ~SG_SELECTED;
        !           215: 
        !           216: #ifdef ENABLE_WINUAE_CPU
1.1.1.12  root      217:        /* Address space 24 bits */
1.1.1.9   root      218:        if (ConfigureParams.System.bAddressSpace24)
                    219:                systemdlg[DLGSYS_24BITS].state |= SG_SELECTED;
                    220:        else
                    221:                systemdlg[DLGSYS_24BITS].state &= ~SG_SELECTED;
                    222:                
                    223:        /* Cycle exact CPU */
                    224:        if (ConfigureParams.System.bCycleExactCpu)
                    225:                systemdlg[DLGSYS_CYC_EXACT].state |= SG_SELECTED;
                    226:        else
                    227:                systemdlg[DLGSYS_CYC_EXACT].state &= ~SG_SELECTED;
                    228: 
                    229:        /* FPU emulation */
                    230:        for (i = DLGSYS_FPU_NONE; i <= DLGSYS_FPU_CPU_IN; i++)
                    231:        {
                    232:                systemdlg[i].state &= ~SG_SELECTED;
                    233:        }
                    234:        if (ConfigureParams.System.n_FPUType == FPU_NONE)
                    235:                systemdlg[DLGSYS_FPU_NONE].state |= SG_SELECTED;
                    236:        else if (ConfigureParams.System.n_FPUType == FPU_68881)
                    237:                systemdlg[DLGSYS_FPU_68881].state |= SG_SELECTED;
                    238:        else if (ConfigureParams.System.n_FPUType == FPU_68882)
                    239:                systemdlg[DLGSYS_FPU_68882].state |= SG_SELECTED;
                    240:        else
                    241:                systemdlg[DLGSYS_FPU_CPU_IN].state |= SG_SELECTED;
                    242: 
                    243:        /* More compatible FPU */
                    244:        if (ConfigureParams.System.bCompatibleFPU)
                    245:                systemdlg[DLGSYS_FPU_COMPAT].state |= SG_SELECTED;
                    246:        else
                    247:                systemdlg[DLGSYS_FPU_COMPAT].state &= ~SG_SELECTED;
                    248: 
                    249:        /* MMU Emulation */
                    250:        if (ConfigureParams.System.bMMU)
                    251:                systemdlg[DLGSYS_MMU_EMUL].state |= SG_SELECTED;
                    252:        else
                    253:                systemdlg[DLGSYS_MMU_EMUL].state &= ~SG_SELECTED;
1.1.1.13! root      254: #endif
1.1.1.9   root      255: 
                    256:        /* Show the dialog: */
                    257:        SDLGui_DoDialog(systemdlg, NULL);
                    258: 
                    259:        /* Read values from dialog: */
                    260: 
                    261:        for (i = DLGSYS_68000; i <= DLGSYS_68060; i++)
                    262:        {
                    263:                if (systemdlg[i].state&SG_SELECTED)
                    264:                {
                    265:                        ConfigureParams.System.nCpuLevel = i-DLGSYS_68000;
                    266:                        break;
                    267:                }
                    268:        }
                    269: 
                    270:        for (mti = MACHINE_ST; mti <= MACHINE_FALCON; mti++)
                    271:        {
                    272:                if (systemdlg[mti + DLGSYS_ST].state&SG_SELECTED)
                    273:                {
                    274:                        ConfigureParams.System.nMachineType = mti;
                    275:                        break;
                    276:                }
                    277:        }
                    278: 
                    279:        if (systemdlg[DLGSYS_32MHZ].state & SG_SELECTED)
                    280:                ConfigureParams.System.nCpuFreq = 32;
                    281:        else if (systemdlg[DLGSYS_16MHZ].state & SG_SELECTED)
                    282:                ConfigureParams.System.nCpuFreq = 16;
                    283:        else
                    284:                ConfigureParams.System.nCpuFreq = 8;
                    285: 
                    286:        if (systemdlg[DLGSYS_DSPOFF].state & SG_SELECTED)
                    287:                ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
                    288:        else if (systemdlg[DLGSYS_DSPDUMMY].state & SG_SELECTED)
                    289:                ConfigureParams.System.nDSPType = DSP_TYPE_DUMMY;
                    290:        else
                    291:                ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
                    292: 
                    293:        ConfigureParams.System.bCompatibleCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);
                    294:        ConfigureParams.System.bBlitter = (systemdlg[DLGSYS_BLITTER].state & SG_SELECTED);
                    295:        ConfigureParams.System.bRealTimeClock = (systemdlg[DLGSYS_RTC].state & SG_SELECTED);
                    296:        ConfigureParams.System.bPatchTimerD = (systemdlg[DLGSYS_TIMERD].state & SG_SELECTED);
1.1.1.13! root      297:        ConfigureParams.System.bFastBoot = (systemdlg[DLGSYS_FASTBOOT].state & SG_SELECTED);
        !           298: 
        !           299: #ifdef ENABLE_WINUAE_CPU
1.1.1.9   root      300:        ConfigureParams.System.bCycleExactCpu = (systemdlg[DLGSYS_CYC_EXACT].state & SG_SELECTED);
1.1.1.13! root      301:        ConfigureParams.System.bMMU = (systemdlg[DLGSYS_MMU_EMUL].state & SG_SELECTED);
        !           302:        ConfigureParams.System.bAddressSpace24 = (systemdlg[DLGSYS_24BITS].state & SG_SELECTED);
1.1.1.9   root      303: 
                    304:        /* FPU emulation */
                    305:        if (systemdlg[DLGSYS_FPU_NONE].state & SG_SELECTED)
                    306:                ConfigureParams.System.n_FPUType = FPU_NONE;
                    307:        else if (systemdlg[DLGSYS_FPU_68881].state & SG_SELECTED)
                    308:                ConfigureParams.System.n_FPUType = FPU_68881;
                    309:        else if (systemdlg[DLGSYS_FPU_68882].state & SG_SELECTED)
                    310:                ConfigureParams.System.n_FPUType = FPU_68882;
                    311:        else
                    312:                ConfigureParams.System.n_FPUType = FPU_CPU;
                    313: 
                    314:        ConfigureParams.System.bCompatibleFPU = (systemdlg[DLGSYS_FPU_COMPAT].state & SG_SELECTED);
                    315: #endif
1.1.1.13! root      316: }

unix.superglobalmegacorp.com

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