|
|
1.1 root 1: /*
2: Hatari - dlgRom.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
6: */
7: const char DlgBoot_fileid[] = "Hatari dlgBoot.c : " __DATE__ " " __TIME__;
8:
9: #include "main.h"
10: #include "configuration.h"
11: #include "dialog.h"
12: #include "sdlgui.h"
13: #include "file.h"
14: #include "paths.h"
15:
16:
17: #define DLGBOOT_SCSI 4
18: #define DLGBOOT_ETHERNET 5
19: #define DLGBOOT_MO 6
20: #define DLGBOOT_FLOPPY 7
21: #define DLGBOOT_ROMMONITOR 8
22:
23: #define DLGBOOT_DRAMTEST 11
24: #define DLGBOOT_ENABLE_POT 12
25: #define DLGBOOT_SOUNDTEST 13
26: #define DLGBOOT_SCSITEST 14
27: #define DLGBOOT_LOOP 15
28: #define DLGBOOT_VERBOSE 16
29: #define DLGBOOT_EXTENDED_POT 17
30:
31: #define DLGBOOT_EXIT 19
32:
33:
34:
35: /* The Boot options dialog: */
36: static SGOBJ bootdlg[] =
37: {
38: { SGBOX, 0, 0, 0,0, 52,22, NULL },
39: { SGTEXT, 0, 0, 20,1, 9,1, "Boot options" },
40:
41: { SGBOX, 0, 0, 1,4, 19,11, NULL },
42: { SGTEXT, 0, 0, 2,5, 30,1, "Boot device:" },
43: { SGRADIOBUT, 0, 0, 2,7, 11,1, "SCSI disk" },
44: { SGRADIOBUT, 0, 0, 2,8, 10,1, "Ethernet" },
45: { SGRADIOBUT, 0, 0, 2,9, 9,1, "MO disk" },
46: { SGRADIOBUT, 0, 0, 2,10, 8,1, "Floppy" },
47: { SGRADIOBUT, 0, 0, 2,12, 13,1, "ROM monitor" },
48:
49: { SGBOX, 0, 0, 21,4, 30,11, NULL },
50: { SGTEXT, 0, 0, 22,5, 30,1, "Power-on test options:" },
51: { SGCHECKBOX, 0, 0, 22,7, 19,1, "perform DRAM test" },
52: { SGCHECKBOX, 0, 0, 22,8, 23,1, "perform power-on test" },
53: { SGCHECKBOX, 0, 0, 24,9, 16,1, "sound out test" },
54: { SGCHECKBOX, 0, 0, 24,10, 12,1, "SCSI tests" },
55: { SGCHECKBOX, 0, 0, 24,11, 21,1, "loop until keypress" },
56: { SGCHECKBOX, 0, 0, 24,12, 19,1, "verbose test mode" },
57: { SGCHECKBOX, 0, 0, 22,13, 27,1, "boot extended diagnostics" },
58:
59: { SGTEXT, 0, 0, 2,16, 25,1, "For advanced options boot to ROM monitor prompt." },
60:
1.1.1.2 ! root 61: { SGBUTTON, SG_DEFAULT, 0, 15,19, 21,1, "Back to main menu" },
1.1 root 62: { -1, 0, 0, 0,0, 0,0, NULL }
63: };
64:
65:
66:
67: /*-----------------------------------------------------------------------*/
68: /**
69: * Show and process the Boot options dialog.
70: */
71: void DlgBoot_Main(void)
72: {
73: int i;
74: int but;
75:
76: SDLGui_CenterDlg(bootdlg);
77:
78: /* Set up the dialog from actual values */
79: for (i = DLGBOOT_ROMMONITOR; i <= DLGBOOT_FLOPPY; i++)
80: {
81: bootdlg[i].state &= ~SG_SELECTED;
82: }
83: switch (ConfigureParams.Boot.nBootDevice) {
84: case BOOT_ROM:
85: bootdlg[DLGBOOT_ROMMONITOR].state |= SG_SELECTED;
86: break;
87: case BOOT_SCSI:
88: bootdlg[DLGBOOT_SCSI].state |= SG_SELECTED;
89: break;
90: case BOOT_ETHERNET:
91: bootdlg[DLGBOOT_ETHERNET].state |= SG_SELECTED;
92: break;
93: case BOOT_MO:
94: bootdlg[DLGBOOT_MO].state |= SG_SELECTED;
95: break;
96: case BOOT_FLOPPY:
97: bootdlg[DLGBOOT_FLOPPY].state |= SG_SELECTED;
98: break;
99:
100: default:
101: break;
102: }
103:
104: for (i = DLGBOOT_DRAMTEST; i <= DLGBOOT_EXTENDED_POT; i++) {
105: bootdlg[i].state &= ~SG_SELECTED;
106: }
107: if (ConfigureParams.Boot.bEnableDRAMTest)
108: bootdlg[DLGBOOT_DRAMTEST].state |= SG_SELECTED;
109: if (ConfigureParams.Boot.bEnablePot)
110: bootdlg[DLGBOOT_ENABLE_POT].state |= SG_SELECTED;
111: if (ConfigureParams.Boot.bEnableSoundTest)
112: bootdlg[DLGBOOT_SOUNDTEST].state |= SG_SELECTED;
113: if (ConfigureParams.Boot.bEnableSCSITest)
114: bootdlg[DLGBOOT_SCSITEST].state |= SG_SELECTED;
115: if (ConfigureParams.Boot.bLoopPot)
116: bootdlg[DLGBOOT_LOOP].state |= SG_SELECTED;
117: if (ConfigureParams.Boot.bVerbose)
118: bootdlg[DLGBOOT_VERBOSE].state |= SG_SELECTED;
119: if (ConfigureParams.Boot.bExtendedPot)
120: bootdlg[DLGBOOT_EXTENDED_POT].state |= SG_SELECTED;
121:
122:
123: /* Draw and process the dialog */
124:
125: do
126: {
127: but = SDLGui_DoDialog(bootdlg, NULL);
128: switch (but)
129: {
130: case DLGBOOT_ENABLE_POT:
131: if (!(bootdlg[DLGBOOT_ENABLE_POT].state & SG_SELECTED)) {
132: bootdlg[DLGBOOT_SOUNDTEST].state &= ~SG_SELECTED;
133: bootdlg[DLGBOOT_SCSITEST].state &= ~SG_SELECTED;
134: bootdlg[DLGBOOT_LOOP].state &= ~SG_SELECTED;
135: bootdlg[DLGBOOT_VERBOSE].state &= ~SG_SELECTED;
136: }
137:
138: case DLGBOOT_SOUNDTEST:
139: case DLGBOOT_SCSITEST:
140: case DLGBOOT_LOOP:
141: case DLGBOOT_VERBOSE:
142: if (bootdlg[but].state & SG_SELECTED) {
143: bootdlg[DLGBOOT_ENABLE_POT].state |= SG_SELECTED;
144: }
145: break;
146: default: break;
147: }
148: }
149: while (but != DLGBOOT_EXIT && but != SDLGUI_QUIT
150: && but != SDLGUI_ERROR && !bQuitProgram);
151:
152:
153: /* Read values from dialog */
154: if (bootdlg[DLGBOOT_ROMMONITOR].state & SG_SELECTED)
155: ConfigureParams.Boot.nBootDevice = BOOT_ROM;
156: else if (bootdlg[DLGBOOT_SCSI].state & SG_SELECTED)
157: ConfigureParams.Boot.nBootDevice = BOOT_SCSI;
158: else if (bootdlg[DLGBOOT_ETHERNET].state & SG_SELECTED)
159: ConfigureParams.Boot.nBootDevice = BOOT_ETHERNET;
160: else if (bootdlg[DLGBOOT_MO].state & SG_SELECTED)
161: ConfigureParams.Boot.nBootDevice = BOOT_MO;
162: else if (bootdlg[DLGBOOT_FLOPPY].state & SG_SELECTED)
163: ConfigureParams.Boot.nBootDevice = BOOT_FLOPPY;
164:
165: ConfigureParams.Boot.bEnableDRAMTest = bootdlg[DLGBOOT_DRAMTEST].state & SG_SELECTED;
166: ConfigureParams.Boot.bEnablePot = bootdlg[DLGBOOT_ENABLE_POT].state & SG_SELECTED;
167: ConfigureParams.Boot.bEnableSoundTest = bootdlg[DLGBOOT_SOUNDTEST].state & SG_SELECTED;
168: ConfigureParams.Boot.bEnableSCSITest = bootdlg[DLGBOOT_SCSITEST].state & SG_SELECTED;
169: ConfigureParams.Boot.bLoopPot = bootdlg[DLGBOOT_LOOP].state & SG_SELECTED;
170: ConfigureParams.Boot.bVerbose = bootdlg[DLGBOOT_VERBOSE].state & SG_SELECTED;
171: ConfigureParams.Boot.bExtendedPot = bootdlg[DLGBOOT_EXTENDED_POT].state & SG_SELECTED;
172: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.