1 ////////////////////////////////////////////////////////////////////
2 // $Id: wxdialog.h,v 1.70 2008/02/05 22:57:41 sshwarts Exp $
3 ////////////////////////////////////////////////////////////////////
5 // wxWidgets dialogs for Bochs
7 #include <wx/spinctrl.h>
9 ////////////////////////////////////////////////////////////////////
10 // text messages used in several places
11 ////////////////////////////////////////////////////////////////////
12 #define MSG_NO_HELP wxT("No help is available yet.")
13 #define MSG_NO_HELP_CAPTION wxT("No help")
14 #define MSG_ENABLED wxT("Enabled")
15 #define BTNLABEL_HELP wxT("Help")
16 #define BTNLABEL_CANCEL wxT("Cancel")
17 #define BTNLABEL_OK wxT("Ok")
18 #define BTNLABEL_CREATE_IMG wxT("Create Image")
19 #define BTNLABEL_BROWSE wxT("<--Browse")
20 #define BTNLABEL_DEBUG_CONTINUE wxT("Continue")
21 #define BTNLABEL_DEBUG_STOP wxT("Stop")
22 #define BTNLABEL_DEBUG_STEP wxT("Step")
23 #define BTNLABEL_DEBUG_COMMIT wxT("Commit")
24 #define BTNLABEL_CLOSE wxT("Close")
25 #define BTNLABEL_EXECUTE wxT("Execute")
28 // On win32, apparantly the spinctrl depends on a native control which only
29 // has a 16bit signed value. If you try to set the max above 32767, it
30 // overflows and does stupid things.
31 #define SPINCTRL_FIX_MAX(x) ((x)>32767 ? 32767 : (x))
33 #define SPINCTRL_FIX_MAX(x) x
36 // utility function prototype
37 void ChangeStaticText(wxSizer
*sizer
, wxStaticText
*win
, wxString newtext
);
38 bool CreateImage(int harddisk
, int sectors
, const char *filename
);
39 void SetTextCtrl(wxTextCtrl
*text
, const char *format
, int val
);
40 int GetTextCtrlInt(wxTextCtrl
*text
, bool *valid
= NULL
, bool complain
=false, wxString complaint
= wxT("Invalid integer!"));
41 bool BrowseTextCtrl(wxTextCtrl
*text
,
42 wxString prompt
= wxT("Choose a file"),
44 wxChoice
*makeLogOptionChoiceBox(wxWindow
*parent
, wxWindowID id
, int evtype
, bool includeNoChange
= false);
46 ////////////////////////////////////////////////////////////////////
47 // LogMsgAskDialog is a modal dialog box that shows the user a
48 // simulation error message and asks if they want to continue or
49 // not. It looks something like this:
51 // +----- PANIC ---------------------------------------------------+
53 // | Context: Hard Drive |
54 // | Message: could not open hard drive image file '30M.sample' |
56 // | [ ] Don't ask about future messages like this |
58 // | [Continue] [Die] [Dump Core] [Debugger] [Help] |
59 // +---------------------------------------------------------------+
61 // To use this dialog:
62 // After constructor, use SetContext, SetMessage, EnableButton to
63 // determine what will be displayed. Then call n = ShowModal(). The return
64 // value tells which button was pressed (button_t types). Call GetDontAsk()
65 // to see if they checked "Don't ask about..." or not.
66 //////////////////////////////////////////////////////////////////////
68 class LogMsgAskDialog
: public wxDialog
72 CONT
=0, DIE
, DUMP
, DEBUG
, HELP
,
73 N_BUTTONS
/* number of entries in enum */
75 #define LOG_MSG_ASK_IDS \
76 { ID_Continue, ID_Die, ID_DumpCore, ID_Debugger, wxHELP }
77 #define LOG_MSG_ASK_NAMES \
78 { wxT("Continue"), wxT("Kill Sim"), wxT("Dump Core"), wxT("Debugger"), wxT("Help") }
79 #define LOG_MSG_DONT_ASK_STRING \
80 wxT("Don't ask about future messages like this")
81 #define LOG_MSG_CONTEXT wxT("Context: ")
82 #define LOG_MSG_MSG wxT("Message: ")
84 wxStaticText
*context
, *message
;
86 bool enabled
[N_BUTTONS
];
87 wxBoxSizer
*btnSizer
, *vertSizer
;
88 void Init(); // called automatically by ShowModal()
91 LogMsgAskDialog(wxWindow
* parent
,
93 const wxString
& title
);
94 void EnableButton(button_t btn
, bool en
) { enabled
[(int)btn
] = en
; }
95 void SetContext(wxString s
);
96 void SetMessage(wxString s
);
97 bool GetDontAsk() { return dontAsk
->GetValue(); }
98 void OnEvent(wxCommandEvent
& event
);
99 int ShowModal() { Init(); return wxDialog::ShowModal(); }
100 DECLARE_EVENT_TABLE()
103 ////////////////////////////////////////////////////////////////////
104 // FloppyConfigDialog is a modal dialog box that asks the user
105 // what physical device or disk image should be used for emulation.
107 // +-----Configure Floppy Drive A----------------------------------+
109 // | Bochs can use a real floppy drive as Disk A, or use an |
112 // | [ ] None/Disabled |
113 // | [X] Physical floppy drive A: |
114 // | [ ] Physical floppy drive B: |
115 // | [ ] Disk image: [_____________________________] [Browse] |
117 // | What is the capacity of this disk? [1.44 MB] |
119 // | Hint: To create a disk image, choose the name and capacity |
120 // | above, then click Ok. |
122 // | [ Help ] [ Cancel ] [ Create Image ] [ Ok ] |
123 // +---------------------------------------------------------------+
124 // To use this dialog:
125 // After constructor, use AddRadio() to add radio buttons, SetFilename()
126 // to fill in the disk image filename, SetCapacity() to set the capacity.
127 // Then call ShowModal() to display it. Return value is wxID_OK or
128 // wxID_CANCEL. If you set a validation function, then it will be called when
129 // ok is pressed, and will get a chance to veto the "Ok" if it returns false.
130 // After ShowModal() returns, use GetFilename and GetCapacity to see what the
131 // user did. If the validation function sets parameters, this may be
134 // Volker reminded me that I wasn't paying much attention to
135 // the distinction between configuring the device (pre-boot) and
136 // configuring the media which can be done anytime. Here's a proposal
137 // to fix that... -Bryce
138 // +-----Configure Floppy Drive A----------------------------------+
140 // | +-- Device -----------------------------------------------+ |
142 // | | [ ] Enable Emulated Drive A | |
144 // | | Drive capacity [1.44 MB] | |
146 // | +---------------------------------------------------------+ |
148 // | +-- Media: Where does the data come from? ----------------+ |
150 // | | Bochs can use a physical floppy drive as the data | |
151 // | | source, or use an image file. | |
153 // | | [X] Physical floppy drive A: | |
154 // | | [ ] Physical floppy drive B: | |
155 // | | [ ] Disk image: [_________________________] [Browse] | |
157 // | | Media size [1.44 MB] | |
159 // | | Hint: To create a disk image, choose the name and | |
160 // | | capacity above, then click Ok. | |
161 // | | [ Create Image ] | |
162 // | +---------------------------------------------------------+ |
164 // | [ Help ] [ Cancel ] [ Ok ] |
165 // +---------------------------------------------------------------+
166 //////////////////////////////////////////////////////////////////////
168 class FloppyConfigDialog
: public wxDialog
171 #define FLOPPY_CONFIG_TITLE wxT("Configure ")
172 #define FLOPPY_CONFIG_INSTRS wxT("Select the device or image to use when simulating ")
173 #define FLOPPY_CONFIG_CAP wxT("What is the capacity of this disk?")
174 #define FLOPPY_CONFIG_HINT wxT("To create a disk image, choose the file name and capacity, then click on \"Create Image\".\n\n" \
175 "Clicking OK signals a media change for this drive.")
176 #define FLOPPY_CONFIG_DISKIMG wxT("Disk image: ")
178 void Init(); // called automatically by ShowModal()
181 #define FLOPPY_MAX_RBTNS 4
182 wxRadioButton
*rbtn
[FLOPPY_MAX_RBTNS
];
183 wxString equivalentFilename
[FLOPPY_MAX_RBTNS
];
186 wxRadioButton
*diskImageRadioBtn
;
187 wxTextCtrl
*filename
;
189 wxBoxSizer
*vertSizer
, *radioSizer
, *diskImageSizer
, *capacitySizer
, *buttonSizer
;
190 typedef bool (*validateFunc_t
)(FloppyConfigDialog
*dialog
);
191 validateFunc_t validate
;
193 FloppyConfigDialog(wxWindow
* parent
, wxWindowID id
);
194 void OnEvent(wxCommandEvent
& event
);
195 void OnTextEvent(wxCommandEvent
& event
);
196 int ShowModal() { Init(); return wxDialog::ShowModal(); }
197 void SetRadio(int val
);
198 void SetFilename(wxString f
);
199 // Use char* instead of wxString because the array we use is already
200 // expressed as a char *[].
201 void SetCapacityChoices(const char *choices
[]);
202 void SetCapacity(int cap
);
204 int GetCapacity() { return capacity
->GetSelection(); }
205 wxString
GetFilename();
206 void SetDriveName(wxString name
);
207 void SetValidateFunc(validateFunc_t v
) { validate
= v
; }
208 void AddRadio(const wxString
& description
, const wxString
& filename
);
209 DECLARE_EVENT_TABLE()
212 ////////////////////////////////////////////////////////////////////////////
213 // AdvancedLogOptionsDialog
214 ////////////////////////////////////////////////////////////////////////////
215 // +---- Advanced event configuration -----------------------+
217 // | Log file is [_____________________________] [ Browse ] |
219 // | This table determines how Bochs will respond to each |
220 // | kind of event coming from a particular source. For |
221 // | example if you are having problems with the keyboard, |
222 // | you could ask for debug and info events from the |
223 // | keyboard to be reported. |
225 // | [Use defaults for all devices] |
227 // | +---------------------------------------------------+-+ |
228 // | |Device Debug Info Error Panic |^| |
229 // | |-------- -------- ------- -------- --------- ||| |
230 // | |Keyboard [ignore] [ignore] [report] [report] ||| |
231 // | |VGA [ignore] [ignore] [report] [report] ||| |
232 // | |NE2000 [ignore] [ignore] [report] [report] ||| |
233 // | |Sound [ignore] [ignore] [report] [report] |v| |
234 // | +-----------------------------------------------------+ |
236 // | [ Help ] [ Cancel ] [ Ok ] |
237 // +-------------------------------------------------------+-+
239 class AdvancedLogOptionsDialog
: public wxDialog
242 #define ADVLOG_OPTS_TITLE wxT("Configure Log Events")
243 #define ADVLOG_OPTS_LOGFILE wxT("Log file")
244 #define ADVLOG_OPTS_PROMPT wxT( \
245 "This table determines how Bochs will respond to each kind of event coming\n" \
246 "from a particular source. For example if you are having problems with\n" \
247 "the keyboard, you could ask for debug and info events from the keyboard\n" \
249 #define ADVLOG_OPTS_TYPE_NAMES { wxT("Debug"), wxT("Info"), wxT("Error"), wxT("Panic"), wxT("Pass") }
250 #define ADVLOG_OPTS_N_TYPES 5
251 #define ADVLOG_DEFAULTS wxT("Use defaults for all devices")
252 void Init(); // called automatically by ShowModal()
254 wxBoxSizer
*vertSizer
, *logfileSizer
, *buttonSizer
;
255 wxScrolledWindow
*scrollWin
;
256 wxPanel
*scrollPanel
;
257 wxGridSizer
*headerSizer
, *gridSizer
;
259 wxButton
*applyDefault
;
260 // 2d array of wxChoice pointers. Each wxChoice* is action[dev][type].
263 AdvancedLogOptionsDialog(wxWindow
* parent
, wxWindowID id
);
264 ~AdvancedLogOptionsDialog();
265 void OnEvent(wxCommandEvent
& event
);
266 int ShowModal() { Init(); return wxDialog::ShowModal(); }
267 void SetLogfile(wxString f
) { logfile
->SetValue(f
); }
268 wxString
GetLogfile() { return logfile
->GetValue(); }
269 void CopyParamToGui();
270 void CopyGuiToParam();
271 void SetAction(int dev
, int evtype
, int act
);
272 int GetAction(int dev
, int evtype
);
273 DECLARE_EVENT_TABLE()
278 ////////////////////////////////////////////////////////////////////////////
280 ////////////////////////////////////////////////////////////////////////////
281 // DebugLogDialog allows the user to decide how Bochs will
282 // behave for each type of log event.
284 // +---- Debugger log ---------------------------------------+
286 // | +--------------------------------------------------+ |
287 // | |(0) f000:fff0: ea5be000f0: jmp f000:e05b | |
288 // | |(0) 0010:00001868: 83fb10: cmp EBX, #10 | |
293 // | +--------------------------------------------------+ |
294 // | Type a debugger command: |
295 // | +----------------------------------------+ +-------+ |
296 // | | step 1000 | |Execute| |
297 // | +----------------------------------------+ +-------+ |
300 // +---------------------------------------------------------+
301 class DebugLogDialog
: public wxDialog
304 #define DEBUG_LOG_TITLE wxT("Debugger log")
305 #define DEBUG_CMD_PROMPT wxT("Type a debugger command:")
306 wxBoxSizer
*mainSizer
, *commandSizer
, *buttonSizer
;
307 wxTextCtrl
*log
, *command
;
309 Bit32u lengthTolerance
;
310 #define DEBUG_LOG_DEFAULT_LENGTH_MAX (400*80)
311 #define DEBUG_LOG_DEFAULT_TOLERANCE (200*80)
313 DebugLogDialog(wxWindow
* parent
, wxWindowID id
);
314 void Init(); // called automatically by ShowModal()
315 void OnEvent(wxCommandEvent
& event
);
316 void OnEnterEvent(wxCommandEvent
& event
) { Execute(true); }
317 void OnKeyEvent(wxKeyEvent
& event
);
318 int ShowModal() { Init(); return wxDialog::ShowModal(); }
319 void Execute(bool clearCommand
);
320 void CheckLogLength();
321 void AppendCommand(const char *);
322 void AppendText(wxString text
);
323 void CopyParamToGui() { /* empty for now */ }
324 DECLARE_EVENT_TABLE()
328 ////////////////////////////////////////////////////////////////////////////
329 // ParamDialog is a general purpose dialog box that displays and edits
330 // any combination of parameters. It's always made up of a
331 // wxFlexGridSizer with three columns. Each parameter takes up one row.
332 // Column 1 shows the name of the parameter, column 2 shows the value of
333 // the parameter in some sort of control that can be edited. Column 3
334 // is used for anything that needs to appear to the right of the data, for
335 // example a Browse button on a filename control. Several buttons including
336 // Cancel and Ok will appear at the bottom.
338 // This will allow editing of all the miscellaneous parameters which do
339 // not need to be laid out by hand.
342 // Right now, there is always one wxFlexGridSizer with three columns
343 // where the fields go. It is possible to create a new wxFlexGridSizer
344 // and make that one the default. This is used when handling a bx_list_c
346 ////////////////////////////////////////////////////////////////////////////
348 struct ParamStruct
: public wxObject
{
358 wxCheckBox
*checkbox
;
359 wxStaticBox
*staticbox
;
360 wxNotebook
*notebook
;
362 int browseButtonId
; // only for filename params
363 wxButton
*browseButton
; // only for filename params
364 ParamStruct() { param
= NULL
; u
.window
= NULL
; browseButton
= NULL
; }
367 // This context structure is used by AddParam to keep track of where the
368 // next parameter's controls should be added. When AddParam is called on
369 // a list of parameters (bx_list_c), it calls itself recursively to add
370 // the child parameters, which in turn could be lists as well. When it
371 // calls itself recursively, it will create a new AddParamContext so that
372 // the various children can be added in the right place.
373 struct AddParamContext
{
376 wxBoxSizer
*vertSizer
;
377 wxFlexGridSizer
*gridSizer
;
381 class ParamDialog
: public wxDialog
386 wxTextCtrl
*serialDelay
, *pasteDelay
, *mappingFile
;
387 wxCheckBox
*enableKeymap
;
389 bool isGeneratedId(int id
);
394 wxBoxSizer
*mainSizer
, *buttonSizer
;
395 // hash table that maps the ID of a wxWidgets control (e.g. wxChoice,
396 // wxTextCtrl) to the associated ParamStruct object. Data in the hash table
397 // is of ParamStruct*.
399 // map parameter ID onto ParamStruct.
400 wxHashTable
*paramHash
;
401 virtual void EnableChanged();
402 void EnableParam(int param_id
, bool enabled
);
403 void EnableParam(const char *pname
, bool enabled
);
404 void EnableParam(const char *pname
, bx_list_c
*base
, bool enabled
);
405 void EnumChanged(ParamStruct
*pstr
);
406 void EnableChangedRecursive(bx_list_c
*list
, bool en
, ParamStruct
*pstrOfCheckbox
);
407 void EnableChanged(ParamStruct
*pstr
);
408 bool CopyGuiToParam();
410 ParamDialog(wxWindow
* parent
, wxWindowID id
);
411 virtual ~ParamDialog();
412 void OnEvent(wxCommandEvent
& event
);
413 wxButton
* AddButton(int id
, wxString label
);
414 virtual void AddDefaultButtons();
415 virtual void Init(); // called automatically by ShowModal()
419 int ret
= wxDialog::ShowModal();
423 bool Show(bool val
) { isShowing
= val
; return wxDialog::Show(val
); }
424 void AddParam(bx_param_c
*param
, wxFlexGridSizer
*sizer
, bool plain
= false);
425 void AddParam(bx_param_c
*param
, bool plain
= false, AddParamContext
*context
= NULL
);
426 void AddParamList(char *nameList
[], bx_param_c
*base
, wxFlexGridSizer
*sizer
= NULL
, bool plain
= false);
427 virtual void CopyParamToGui();
428 bool IsShowing() { return isShowing
; }
429 void SetRuntimeFlag(bool val
) { runtime
= val
; }
430 DECLARE_EVENT_TABLE()
433 ////////////////////////////////////////////////////////////////////////////
435 ////////////////////////////////////////////////////////////////////////////
437 // the new LogOptionsDialog is based on ParamDialog. It allows the user to
438 // configure the log file settings and to decide how Bochs will behave for
439 // each type of log event.
440 class LogOptionsDialog
: public ParamDialog
443 #define LOG_OPTS_TITLE wxT("Configure Log Events")
444 #define LOG_OPTS_PROMPT wxT("How should Bochs respond to each type of event?")
445 #define LOG_OPTS_TYPE_NAMES { wxT("Debug events: "), wxT("Info events: "), wxT("Error events: "), wxT("Panic events: "), wxT("Pass events: ") }
446 #define LOG_OPTS_N_TYPES 5
447 #define LOG_OPTS_CHOICES { wxT("ignore"), wxT("log"), wxT("ask user"), wxT("end simulation"), wxT("no change") }
448 #define LOG_OPTS_N_CHOICES_NORMAL 4
449 #define LOG_OPTS_N_CHOICES 5 // number of choices, including "no change"
450 #define LOG_OPTS_NO_CHANGE 4 // index of "no change"
451 // normally all choices are available for all event types. The exclude
452 // expression allows some choices to be eliminated if they don't make any
453 // sense. For example, it would be stupid to ignore a panic.
454 #define LOG_OPTS_EXCLUDE(type,choice) ( \
455 /* can't die or ask, on debug or info events */ \
456 (type <= 1 && (choice==2 || choice==3)) \
457 /* can't ignore panics or errors */ \
458 || (type >= 2 && choice==0) \
460 #define LOG_OPTS_ADV wxT("For additional control over how each device responds to events, use the menu option \"Log ... By Device\".")
461 wxFlexGridSizer
*gridSizer
;
462 wxChoice
*action
[LOG_OPTS_N_TYPES
];
464 LogOptionsDialog(wxWindow
* parent
, wxWindowID id
);
465 int GetAction(int evtype
);
466 void SetAction(int evtype
, int action
);
467 DECLARE_EVENT_TABLE()
470 ////////////////////////////////////////////////////////////////////////////
471 // CpuRegistersDialog
472 ////////////////////////////////////////////////////////////////////////////
474 // this would display the current values of all CPU registers, possibly you can
475 // enable different groups like debug, FPU, MMX registers. Certainly if you
476 // interrupt the simulation, these would be updated. we could update
477 // periodically during simulation if it was useful. If we get the debugger
478 // integrated with wxwidgets, you could single step and update the cpu
479 // registers, with regs that change marked in a different color. Modeless
482 // +--- CPU Registers ---------------------------------------+
484 // | EAX 0x00000000 EIP 0xffff LDTR 0x00000000 |
485 // | EBX 0x00000000 CS 0x0018 TR 0x00000000 |
486 // | ECX 0x00000000 SS 0x0018 GDTR 0x00000000 |
487 // | EDX 0x00000000 DS 0x0018 lim 0x00000000 |
488 // | EBP 0x00000000 ES 0x0018 IDTR 0x00000000 |
489 // | ESI 0x00000000 FS 0x0018 lim 0x00000000 |
490 // | EDI 0x00000000 GS 0x0018 |
491 // | ESP 0x00000000 EFLAGS 0x0012 |
493 // | ID AC VM RF NT IOPL CF PF AF ZF SF TF IF DF OF |
494 // | [] [] [] [] [] [0] [] [] [] [] [] [] [] [] [] |
496 // | DR0 0x00000000 TR3 0x00000000 CR0 0x00000000 |
497 // | DR1 0x00000000 TR4 0x00000000 CR1 0x00000000 |
498 // | DR2 0x00000000 TR5 0x00000000 CR2 0x00000000 |
499 // | DR3 0x00000000 TR6 0x00000000 CR3 0x00000000 |
500 // | DR6 0x00000000 TR7 0x00000000 CR4 0x00000000 |
501 // | DR7 0x00000000 |
503 // | [Go] [Stop] [Step] [Step N] N=[____] |
504 // +---------------------------------------------------------+
506 // +--- CPU Extended Registers ------------------------------+
509 // | [Go] [Stop] [Step] [Step N] N=[____] |
510 // +---------------------------------------------------------+
512 class CpuRegistersDialog
: public ParamDialog
515 #define CPU_REGS_MAIN_REGS1 \
516 { "EAX", "EBX", "ECX", "EDX", \
517 "EBP", "ESI", "EDI", "ESP", \
519 #define CPU_REGS_MAIN_REGS2 \
520 { "EIP", "CS", "SS", "DS", \
521 "ES", "FS", "GS", "EFLAGS", \
523 #define CPU_REGS_MAIN_REGS3 \
525 "GDTR_base", "IDTR_limit", \
526 "IDTR_base", "GDTR_limit", \
528 #define CPU_REGS_FLAGS \
529 { "ID", "VIP", "VIF", \
531 "NT", "IOPL", "OF", \
536 #define CPU_REGS_DEBUG_REGS \
537 { "DR0", "DR1", "DR2", \
538 "DR3", "DR6", "DR7", \
540 #define CPU_REGS_TEST_REGS \
541 { "TR3", "TR4", "TR5", "TR6", "TR7", \
543 #define CPU_REGS_CONTROL_REGS \
544 { "CR0", "CR1", "CR2", "CR3", "CR4", \
547 void Init(); // called automatically by ShowModal()
548 wxFlexGridSizer
*mainRegsSizer
, *flagsSizer
, *extRegsSizer
;
549 #define CPU_REGS_MAX_FLAGS 17
550 bx_param_c
*flagptr
[CPU_REGS_MAX_FLAGS
];
553 wxButton
*contButton
, *stopButton
, *stepButton
, *commitButton
;
555 void stateChanged(bool simRunning
);
557 CpuRegistersDialog(wxWindow
* parent
, wxWindowID id
);
558 int ShowModal() { Init(); return wxDialog::ShowModal(); }
559 void AddFlag(bx_param_c
*param
);
560 void OnEvent(wxCommandEvent
& event
);
561 virtual void CopyParamToGui();
562 DECLARE_EVENT_TABLE()
566 /**************************************************************************
567 Everything else in here is a comment!
572 ////////////////////////////////////////////////////////////////////////////
573 // proposed dialogs, not implemented
574 ////////////////////////////////////////////////////////////////////////////
576 Here are some quick sketches of what different parts of the interface
577 could look like. None of these is implemented yet, and everything is
578 open for debate. Whoever writes the wxwidgets code for any of these
579 screens gets several thousand votes!
583 Idea for large configuration dialog, based on Netscape's Edit:Preferences
584 dialog box. Here's a sketch of a dialog with all the components that can be
585 configured in a list on the left, and the details of the selected component
586 on the right. This is a pretty familiar structure that's used in a lot of
587 applications these days. In the first sketch, "IDE Interface" is selected on
588 the left, and the details of the IDE devices are shown on the right.
590 +-----Configure Bochs-------------------------------------------------------+
592 | +--------------------+ +-- IDE Controller ---------------------------+ |
594 | | | | | Master device: | |
595 | | |-Memory | | [X] Enable Hard Disk 0 | |
597 | | |-Video | | Slave device (choose one): | |
598 | | | | | [ ] No slave device | |
599 | | |-Floppy disks | | [ ] Hard Disk 1 | |
600 | | | |-Drive 0 | | [X] CD-ROM | |
601 | | | |-Drive 1 | | | |
602 | | | | +---------------------------------------------+ |
603 | |***IDE controller***| |
604 | | | |-Hard Drive 0 | |
605 | | | |-CD-ROM drive | |
613 | +--------------------+ |
614 | [Help] [Cancel] [Ok] |
615 +---------------------------------------------------------------------------+
617 If you click on Hard Drive 0 in the component list (left), then the
618 whole right panel changes to show the details of the hard drive.
620 +-----Configure Bochs-------------------------------------------------------+
622 | +--------------------+ +---- Configure Hard Drive 0 ----------------+ |
624 | | | | | [X] Enabled | |
626 | | | | +--------------------------------------------+ |
628 | | | | +---- Disk Image ----------------------------+ |
629 | | |-Floppy disks | | | |
630 | | | |-Drive 0 | | File name: [___________________] [Browse] | |
631 | | | |-Drive 1 | | Geometry: cylinders [____] | |
632 | | | | | heads [____] | |
633 | | |-IDE controller | | sectors/track [____] | |
634 | | |***Hard Drive 0***| | | |
635 | | | |-CD-ROM drive | | Size in Megabytes: 38.2 | |
636 | | | | | [Enter size/Compute Geometry] | |
637 | | |-Keyboard | | | |
638 | | | | | [Create Image] | |
639 | | |-Networking | +--------------------------------------------+ |
643 | +--------------------+ |
644 | [Help] [Cancel] [Ok] |
645 +---------------------------------------------------------------------------+
647 Or if you choose the CD-ROM, you get to edit the settings for it.
649 +---- Configure Bochs ------------------------------------------------------+
651 | +--------------------+ +-- CD-ROM Device ----------------------------+ |
653 | | | | | [ ] Enable Emulated CD-ROM | |
655 | | | | +---------------------------------------------+ |
657 | | | | +-- CD-ROM Media -----------------------------+ |
658 | | |-Floppy disks | | | |
659 | | | |-Drive 0 | | Bochs can use a physical CD-ROM drive as | |
660 | | | |-Drive 1 | | the data source, or use an image file. | |
662 | | |-IDE controller | | [X] Ejected | |
663 | | | |-Hard Drive 0 | | [ ] Physical CD-ROM drive /dev/cdrom | |
664 | |*****CD-ROM drive***| | [ ] Disk image: [_____________] [Browse] | |
666 | | |-Keyboard | +---------------------------------------------+ |
672 | +--------------------+ |
673 | [Help] [Cancel] [Ok] |
674 +---------------------------------------------------------------------------+
676 The CD-ROM media can still be configured during the simulation. In this
677 context we can just show the Media section. The same code can be written to
678 serve both purposes. This is the dialog that would appear when you click the
679 CD-ROM button on the toolbar at runtime.
681 +-- CD-ROM Media -----------------------------+
683 | Bochs can use a physical CD-ROM drive as |
684 | the data source, or use an image file. |
687 | [ ] Physical CD-ROM drive /dev/cdrom |
688 | [ ] Disk image: [_____________] [Browse] |
691 | [Help] [Cancel] [Ok] |
692 +---------------------------------------------+
695 ////////////////////////////////////////////////////////////////////////////
696 // ChooseConfigDialog
697 ////////////////////////////////////////////////////////////////////////////
698 The idea is that you could choose from a set of configurations
699 (individual bochsrc files, basically). When you first install
700 Bochs, it would just have DLX Linux Demo, and Create New.
701 As you create new configurations and save them, the list
703 +--------------------------------------------------------+
705 | Choose a configuration for the Bochs simulator: |
708 | | O | DLX Linux Demo |
709 | | | | Boot 10MB Hard Disk |
713 | | O | Redhat Linux Image |
714 | | | | Boot 10MB Hard Disk |
719 | | | | Boot 40MB Hard Disk |
722 | ?? Create new configuration |
724 +--------------------------------------------------------+
727 ////////////////////////////////////////////////////////////////////////////
729 ////////////////////////////////////////////////////////////////////////////
731 This dialog basically lets you choose which disk you want to boot: floppy A,
732 disk c, or cdrom. The boot selection could be as simple as
733 +-------------------------------------------+
734 | Choose boot drive |
738 | [ Help ] [ Cancel ] [ Ok ] |
739 +-------------------------------------------+
740 or fancier with icons for the device types, and Edit buttons that
741 let you go right to the configure screen for that disk drive.
742 +---------------------------------------------------------------+
745 | |= =| A Drive +----+ |
746 | [ ] | __ | Raw Floppy Drive |Edit| |
751 | |= =| B Drive +----+ |
752 | [ ] | __ | Floppy Disk Image |Edit| |
753 | || || C:\Bochs\Images\A.img +----+ |
757 | |=====| Hard Disk Image +----+ |
758 | [BOOT] | o| C:\Bochs\Images\HD30meg.img |Edit| |
762 | / \ D Drive +----+ |
763 | [ ] | O | ISO CD Image |Edit| |
764 | \___/ C:\Bochs\Images\BootCD.img +----+ |
766 | [ Help ] [ Cancel ] [ Ok ] |
767 +---------------------------------------------------------------+
769 ////////////////////////////////////////////////////////////////////////////
771 ////////////////////////////////////////////////////////////////////////////
772 more ambitious: create a button for each key on a standard keyboard, so that
773 you can view/edit/load/save key mappings, produce any combination of keys
774 (esp. ones that your OS or window manager won't allow)
776 ////////////////////////////////////////////////////////////////////////////
778 ////////////////////////////////////////////////////////////////////////////
781 select starting time for CMOS clock
782 turn on real time PIT or not (?)
785 This dialog can easily allow people to tune the IPS setting, or
786 various other speed-related values, at runtime. If you're running
787 some time-sensitive program you could adjust IPS until it's the right
788 speed, or if Bochs is wasting all of your CPU's cycles you could turn
789 a dial to some periodic delays to allow other processes a chance to
792 Suggestions from Greg Alexander:
793 > I'm using O for radio buttons and [ ] for check boxes.
795 > ---------Basic Configure Timing Dialog--------
797 > Instructions per second: [_________] (maybe have some default options
800 > Select timing behavior desired:
802 > O Full Speed, Real Time
804 > O Minimize CPU Use, Real Time
805 > O Full speed, NOT Real Time
809 > -----------------------------------------------
810 > The logic for the above would look like this:
811 > All options get the New PIT.
812 > Option 1 Gets you the Realtime PIT.
813 > Option 2 Gets you the Slowdown Timer.
814 > Option 3 Gets you neither.
816 > -------Advanced Configure Timing Dialog--------
818 > Instructions per second: [_________]
823 > O Realtime PIT (not reproducible)
825 > Select Optional Realtime Hacks:
826 > [ ] Slowdown Timer Maxmult setting [_________]
827 > [ ] Idle Hack (X Windows Only)
829 > ----------------------------------------------
831 ////////////////////////////////////////////////////////////////////////////
832 // OtherOptionsDialog
833 ////////////////////////////////////////////////////////////////////////////
835 everything in the bochsrc that doesn't fit into some other category,
836 or that is used so rarely (e.g. floppy command delay) that it's not worth
837 laying out manually in a dialog box. This will probably be done in
838 sort of a grid with parameter name, and value(editable) in different columns
840 ////////////////////////////////////////////////////////////////////////////
842 ////////////////////////////////////////////////////////////////////////////
843 lets you choose which events you want to write to the log, which you
844 want to ignore, etc. You can do this at a high level, like
846 +---- Configure events -----------------------------------+
848 | How should Bochs respond to each type of event? |
850 | Debug events: [ignore] |
851 | Info events: [ignore] |
852 | Error events: [report] |
853 | Panic events: [ask ] |
855 | For additional control over how each device responds |
856 | to events, press the "Advanced" button. |
858 | [ Advanced ] [ Help ] [ Cancel ] [ Ok ] |
859 +---------------------------------------------------------+
860 This sets up the default actions for all devices. The advanced
861 dialog lets you set different actions per device. I have two
862 attempts at the advanced dialog. The first creates a large
863 grid of wxChoice controls which choose between
864 ignore/report/ask/die. There will be enough rows in this
865 table that a scrolling subwindow will be needed to fit
868 +---- Advanced event configuration -----------------------+
870 | This table determines how Bochs will respond to each |
871 | kind of event coming from a particular source. For |
872 | example if you are having problems with the keyboard, |
873 | you could ask for debug and info events from the |
874 | keyboard to be reported. |
876 | [Use defaults for all devices] |
877 +-------------------------------------------------------+-+
878 | Device Debug Info Error Panic |^|
879 | -------- -------- ------- -------- --------- |||
880 | Keyboard [ignore] [ignore] [report] [report] |||
881 | VGA [ignore] [ignore] [report] [report] |||
882 | NE2000 [ignore] [ignore] [report] [report] |||
883 | Sound [ignore] [ignore] [report] [report] |v|
884 +---------------------------------------------------------+
885 | [ Help ] [ Cancel ] [ Ok ] |
886 +-------------------------------------------------------+-+
888 Try #2 for the advanced event configuration dialog.
889 It shows the selection of the default actions again
890 at the top, with some explanation. Then at bottom, you
891 can select a device in the list box and edit the settings
892 for that device individually. It would be possible to
893 allow selection of multiple devices and then edit several
896 +---- Advanced event configuration ---------------------+-+
898 | +--- Default Actions -------------+ |
899 | First choose the | | |
900 | default actions | Debug events: [ignore] | |
901 | that apply to all | Info events: [ignore] | |
902 | event sources. | Error events: [report] | |
903 | | Panic events: [ask ] | |
905 | | [Copy to All Devices] | |
906 | +---------------------------------+ |
908 | Then, if you want you can edit the actions for |
909 | individual devices. For example if you are having |
910 | problems with the keyboard, you could ask for debug |
911 | and info events from the keyboard to be reported. |
914 | +-------------+-+ +--- Actions for VGA -------------+ |
916 | | Interrupts ||| | Debug events: [ignore] | |
917 | |*VGA*********||| | Info events: [ignore] | |
918 | | Keyboard ||| | Error events: [report] | |
919 | | Mouse ||| | Panic events: [ask ] | |
920 | | Floppy Disk |v| | | |
921 | +-------------+-+ +---------------------------------+ |
923 | [ Help ] [ Cancel ] [ Ok ] |
924 +---------------------------------------------------------+
926 +---- Configure events -------------------------------------+
927 | __________ ____________ |
928 | | Default \ | Per Device \ |
929 | | \------------------------------------------+ |
931 | | Event log file [_______________________] [Browse] | |
933 | | How should Bochs respond to each type of event? | |
935 | | Debug events: [ignore] | |
936 | | Info events: [ignore] | |
937 | | Error events: [report] | |
938 | | Panic events: [ask ] | |
940 | | For additional control over how each device responds | |
941 | | to events, click the "Per Device" tab above. | |
943 | +------------------------------------------------------+ |
944 | [ Help ] [ Cancel ] [ Ok ] |
945 +-----------------------------------------------------------+
947 +---- Configure events -------------------------------------+
948 | __________ ____________ |
949 | | Default \ | Per Device \ |
950 | +-------------| \--------------------------+ |
952 | | This table determines how Bochs will respond to each | |
953 | | kind of event coming from a particular source. For | |
954 | | example if you are having problems with the keyboard,| |
955 | | you could ask for debug and info events from the | |
956 | | keyboard to be reported. | |
958 | | +------------------------------------------------+-+ | |
959 | | |Device Debug Info Error Panic |^| | |
960 | | |-------- -------- ------- -------- --------- ||| | |
961 | | |Keyboard [ignore] [ignore] [report] [report] ||| | |
962 | | |VGA [ignore] [ignore] [report] [report] ||| | |
963 | | |NE2000 [ignore] [ignore] [report] [report] ||| | |
964 | | |Sound [ignore] [ignore] [report] [report] |v| | |
965 | | +--------------------------------------------------+ | |
966 | | [Set defaults for all devices] | |
967 | +------------------------------------------------------+ |
968 | [ Help ] [ Cancel ] [ Ok ] |
969 +-----------------------------------------------------------+
973 ////////////////////////////////////////////////////////////////////////////
975 ////////////////////////////////////////////////////////////////////////////
977 shows portions of memory, in hex or hex+ASCII or disassembled. updates
978 whenever simulation stops (after single steps for example), or we could
979 update periodically. Modeless dialog, and there could be many
980 of them at once, showing different regions of memory.
982 ////////////////////////////////////////////////////////////////////////////
983 // DebugControlDialog
984 ////////////////////////////////////////////////////////////////////////////
985 has buttons for most common debugger commands such as step, breakpoint,
986 display registers, or whatever.
988 *****************************************************************/