- moved optrom[1-4] options to an array of 4 elements.

Option reading/writing should really be done in a for loop.
  This was just a test to check if the new ata options could
  be handled that way.
This commit is contained in:
Christophe Bothamy 2002-08-22 22:38:40 +00:00
parent 65b715a6ed
commit b42c7228f0
2 changed files with 69 additions and 75 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.76 2002-08-17 09:23:42 vruppert Exp $
// $Id: bochs.h,v 1.77 2002-08-22 22:38:40 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -636,10 +636,7 @@ typedef struct {
bx_cdrom_options cdromd;
bx_rom_options rom;
bx_vgarom_options vgarom;
bx_rom_options optrom1; // Optional rom image (1)
bx_rom_options optrom2; // Optional rom image (2)
bx_rom_options optrom3; // Optional rom image (3)
bx_rom_options optrom4; // Optional rom image (4)
bx_rom_options optrom[4]; // Optional rom images
bx_mem_options memory;
bx_parport_options par1; // parallel port #1
bx_parport_options par2; // parallel port #2 (not implemented)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.113 2002-08-18 16:59:26 vruppert Exp $
// $Id: main.cc,v 1.114 2002-08-22 22:38:40 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -80,10 +80,7 @@ bx_options_t bx_options = {
{ 0, NULL, 0 }, // cdromd
{ NULL, NULL }, // rom
{ NULL }, // vgarom
{ NULL, NULL }, // optrom1
{ NULL, NULL }, // optrom2
{ NULL, NULL }, // optrom3
{ NULL, NULL }, // optrom4
{{ NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }}, // optrom[4]
{ NULL }, // memory
{ 0, NULL }, // parallel port 1
{ 0, NULL }, // parallel port 2
@ -694,57 +691,57 @@ void bx_init_options ()
bx_options.rom.Oaddress->set_format ("ROM BIOS address: 0x%05x");
bx_options.rom.Oaddress->set_base (16);
bx_options.optrom1.Opath = new bx_param_filename_c (BXP_OPTROM1_PATH,
bx_options.optrom[0].Opath = new bx_param_filename_c (BXP_OPTROM1_PATH,
"optional romimage #1",
"Pathname of optional ROM image #1 to load",
"", BX_PATHNAME_LEN);
bx_options.optrom1.Opath->set_format ("Name of optional ROM image #1 : %s");
bx_options.optrom1.Oaddress = new bx_param_num_c (BXP_OPTROM1_ADDRESS,
bx_options.optrom[0].Opath->set_format ("Name of optional ROM image #1 : %s");
bx_options.optrom[0].Oaddress = new bx_param_num_c (BXP_OPTROM1_ADDRESS,
"optional romaddr #1",
"The address at which the optional ROM image #1 should be loaded",
0, BX_MAX_INT,
0);
bx_options.optrom1.Oaddress->set_format ("optional ROM #1 address: 0x%05x");
bx_options.optrom1.Oaddress->set_base (16);
bx_options.optrom[0].Oaddress->set_format ("optional ROM #1 address: 0x%05x");
bx_options.optrom[0].Oaddress->set_base (16);
bx_options.optrom2.Opath = new bx_param_filename_c (BXP_OPTROM2_PATH,
bx_options.optrom[1].Opath = new bx_param_filename_c (BXP_OPTROM2_PATH,
"optional romimage #2",
"Pathname of optional ROM image #2 to load",
"", BX_PATHNAME_LEN);
bx_options.optrom2.Opath->set_format ("Name of optional ROM image #2 : %s");
bx_options.optrom2.Oaddress = new bx_param_num_c (BXP_OPTROM2_ADDRESS,
bx_options.optrom[1].Opath->set_format ("Name of optional ROM image #2 : %s");
bx_options.optrom[1].Oaddress = new bx_param_num_c (BXP_OPTROM2_ADDRESS,
"optional romaddr #2",
"The address at which the optional ROM image #2 should be loaded",
0, BX_MAX_INT,
0);
bx_options.optrom2.Oaddress->set_format ("optional ROM #2 address: 0x%05x");
bx_options.optrom2.Oaddress->set_base (16);
bx_options.optrom[1].Oaddress->set_format ("optional ROM #2 address: 0x%05x");
bx_options.optrom[1].Oaddress->set_base (16);
bx_options.optrom3.Opath = new bx_param_filename_c (BXP_OPTROM3_PATH,
bx_options.optrom[2].Opath = new bx_param_filename_c (BXP_OPTROM3_PATH,
"optional romimage #3",
"Pathname of optional ROM image #3 to load",
"", BX_PATHNAME_LEN);
bx_options.optrom3.Opath->set_format ("Name of optional ROM image #3 : %s");
bx_options.optrom3.Oaddress = new bx_param_num_c (BXP_OPTROM3_ADDRESS,
bx_options.optrom[2].Opath->set_format ("Name of optional ROM image #3 : %s");
bx_options.optrom[2].Oaddress = new bx_param_num_c (BXP_OPTROM3_ADDRESS,
"optional romaddr #3",
"The address at which the optional ROM image #3 should be loaded",
0, BX_MAX_INT,
0);
bx_options.optrom3.Oaddress->set_format ("optional ROM #3 address: 0x%05x");
bx_options.optrom3.Oaddress->set_base (16);
bx_options.optrom[2].Oaddress->set_format ("optional ROM #3 address: 0x%05x");
bx_options.optrom[2].Oaddress->set_base (16);
bx_options.optrom4.Opath = new bx_param_filename_c (BXP_OPTROM4_PATH,
bx_options.optrom[3].Opath = new bx_param_filename_c (BXP_OPTROM4_PATH,
"optional romimage #4",
"Pathname of optional ROM image #4 to load",
"", BX_PATHNAME_LEN);
bx_options.optrom4.Opath->set_format ("Name of optional ROM image #4 : %s");
bx_options.optrom4.Oaddress = new bx_param_num_c (BXP_OPTROM4_ADDRESS,
bx_options.optrom[3].Opath->set_format ("Name of optional ROM image #4 : %s");
bx_options.optrom[3].Oaddress = new bx_param_num_c (BXP_OPTROM4_ADDRESS,
"optional romaddr #4",
"The address at which the optional ROM image #4 should be loaded",
0, BX_MAX_INT,
0);
bx_options.optrom4.Oaddress->set_format ("optional ROM #4 address: 0x%05x");
bx_options.optrom4.Oaddress->set_base (16);
bx_options.optrom[3].Oaddress->set_format ("optional ROM #4 address: 0x%05x");
bx_options.optrom[3].Oaddress->set_base (16);
bx_options.vgarom.Opath = new bx_param_filename_c (BXP_VGA_ROM_PATH,
"vgaromimage",
@ -756,14 +753,14 @@ void bx_init_options ()
bx_options.vgarom.Opath,
bx_options.rom.Opath,
bx_options.rom.Oaddress,
bx_options.optrom1.Opath,
bx_options.optrom1.Oaddress,
bx_options.optrom2.Opath,
bx_options.optrom2.Oaddress,
bx_options.optrom3.Opath,
bx_options.optrom3.Oaddress,
bx_options.optrom4.Opath,
bx_options.optrom4.Oaddress,
bx_options.optrom[0].Opath,
bx_options.optrom[0].Oaddress,
bx_options.optrom[1].Opath,
bx_options.optrom[1].Oaddress,
bx_options.optrom[2].Opath,
bx_options.optrom[2].Oaddress,
bx_options.optrom[3].Opath,
bx_options.optrom[3].Oaddress,
NULL
};
menu = new bx_list_c (BXP_MENU_MEMORY, "Bochs Memory Options", "memmenu", memory_init_list);
@ -1356,14 +1353,14 @@ bx_init_hardware()
BX_MEM(0)->init_memory(bx_options.memory.Osize->get () * 1024*1024);
// First load the optional ROM images
if (bx_options.optrom1.Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom1.Opath->getptr (), bx_options.optrom1.Oaddress->get ());
if (bx_options.optrom2.Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom2.Opath->getptr (), bx_options.optrom2.Oaddress->get ());
if (bx_options.optrom3.Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom3.Opath->getptr (), bx_options.optrom3.Oaddress->get ());
if (bx_options.optrom4.Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom4.Opath->getptr (), bx_options.optrom4.Oaddress->get ());
if (bx_options.optrom[0].Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom[0].Opath->getptr (), bx_options.optrom[0].Oaddress->get ());
if (bx_options.optrom[1].Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom[1].Opath->getptr (), bx_options.optrom[1].Oaddress->get ());
if (bx_options.optrom[2].Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom[2].Opath->getptr (), bx_options.optrom[2].Oaddress->get ());
if (bx_options.optrom[3].Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom[3].Opath->getptr (), bx_options.optrom[3].Oaddress->get ());
// Then Load the BIOS and VGABIOS
BX_MEM(0)->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get ());
@ -1380,15 +1377,15 @@ bx_init_hardware()
bx_mem_array[0]->init_memory(bx_options.memory.Osize->get () * 1024*1024);
// First load the optional ROM images
if (bx_options.optrom1.Opath->getptr () > 0)
bx_mem_array[0]->load_ROM(bx_options.optrom1.Opath->getptr (), bx_options.optrom1.Oaddress->get ());
if (bx_options.optrom2.Opath->getptr () > 0)
bx_mem_array[0]->load_ROM(bx_options.optrom2.Opath->getptr (), bx_options.optrom2.Oaddress->get ());
if (bx_options.optrom3.Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom3.Opath->getptr (), bx_options.optrom3.Oaddress->get ());
bx_mem_array[0]->load_ROM(bx_options.optrom3.Opath->getptr (), bx_options.optrom3.Oaddress->get ());
if (bx_options.optrom4.Opath->getptr () > 0)
bx_mem_array[0]->load_ROM(bx_options.optrom4.Opath->getptr (), bx_options.optrom4.Oaddress->get ());
if (bx_options.optrom[0].Opath->getptr () > 0)
bx_mem_array[0]->load_ROM(bx_options.optrom[0].Opath->getptr (), bx_options.optrom[0].Oaddress->get ());
if (bx_options.optrom[1].Opath->getptr () > 0)
bx_mem_array[0]->load_ROM(bx_options.optrom[1].Opath->getptr (), bx_options.optrom[1].Oaddress->get ());
if (bx_options.optrom[2].Opath->getptr () > 0)
BX_MEM(0)->load_ROM(bx_options.optrom[2].Opath->getptr (), bx_options.optrom[2].Oaddress->get ());
bx_mem_array[0]->load_ROM(bx_options.optrom[2].Opath->getptr (), bx_options.optrom[2].Oaddress->get ());
if (bx_options.optrom[3].Opath->getptr () > 0)
bx_mem_array[0]->load_ROM(bx_options.optrom[3].Opath->getptr (), bx_options.optrom[3].Oaddress->get ());
// Then Load the BIOS and VGABIOS
bx_mem_array[0]->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get ());
@ -1983,11 +1980,11 @@ parse_line_formatted(char *context, int num_params, char *params[])
if (strncmp(params[2], "address=", 8)) {
BX_PANIC(("%s: optromimage2 directive malformed.", context));
}
bx_options.optrom1.Opath->set (&params[1][5]);
bx_options.optrom[0].Opath->set (&params[1][5]);
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
bx_options.optrom1.Oaddress->set (strtoul (&params[2][8], NULL, 16));
bx_options.optrom[0].Oaddress->set (strtoul (&params[2][8], NULL, 16));
else
bx_options.optrom1.Oaddress->set (strtoul (&params[2][8], NULL, 10));
bx_options.optrom[0].Oaddress->set (strtoul (&params[2][8], NULL, 10));
}
else if (!strcmp(params[0], "optromimage2")) {
if (num_params != 3) {
@ -1999,11 +1996,11 @@ parse_line_formatted(char *context, int num_params, char *params[])
if (strncmp(params[2], "address=", 8)) {
BX_PANIC(("%s: optromimage2 directive malformed.", context));
}
bx_options.optrom2.Opath->set (&params[1][5]);
bx_options.optrom[1].Opath->set (&params[1][5]);
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
bx_options.optrom2.Oaddress->set (strtoul (&params[2][8], NULL, 16));
bx_options.optrom[1].Oaddress->set (strtoul (&params[2][8], NULL, 16));
else
bx_options.optrom2.Oaddress->set (strtoul (&params[2][8], NULL, 10));
bx_options.optrom[1].Oaddress->set (strtoul (&params[2][8], NULL, 10));
}
else if (!strcmp(params[0], "optromimage3")) {
if (num_params != 3) {
@ -2015,11 +2012,11 @@ parse_line_formatted(char *context, int num_params, char *params[])
if (strncmp(params[2], "address=", 8)) {
BX_PANIC(("%s: optromimage2 directive malformed.", context));
}
bx_options.optrom3.Opath->set (&params[1][5]);
bx_options.optrom[2].Opath->set (&params[1][5]);
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
bx_options.optrom3.Oaddress->set (strtoul (&params[2][8], NULL, 16));
bx_options.optrom[2].Oaddress->set (strtoul (&params[2][8], NULL, 16));
else
bx_options.optrom3.Oaddress->set (strtoul (&params[2][8], NULL, 10));
bx_options.optrom[2].Oaddress->set (strtoul (&params[2][8], NULL, 10));
}
else if (!strcmp(params[0], "optromimage4")) {
if (num_params != 3) {
@ -2031,11 +2028,11 @@ parse_line_formatted(char *context, int num_params, char *params[])
if (strncmp(params[2], "address=", 8)) {
BX_PANIC(("%s: optromimage2 directive malformed.", context));
}
bx_options.optrom4.Opath->set (&params[1][5]);
bx_options.optrom[3].Opath->set (&params[1][5]);
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
bx_options.optrom4.Oaddress->set (strtoul (&params[2][8], NULL, 16));
bx_options.optrom[3].Oaddress->set (strtoul (&params[2][8], NULL, 16));
else
bx_options.optrom4.Oaddress->set (strtoul (&params[2][8], NULL, 10));
bx_options.optrom[3].Oaddress->set (strtoul (&params[2][8], NULL, 10));
}
else if (!strcmp(params[0], "vgaromimage")) {
if (num_params != 2) {
@ -2612,14 +2609,14 @@ bx_write_configuration (char *rc, int overwrite)
fprintf (fp, "vgaromimage: %s\n", bx_options.vgarom.Opath->getptr ());
else
fprintf (fp, "# no vgaromimage\n");
if (strlen (bx_options.optrom1.Opath->getptr ()) > 0)
fprintf (fp, "optromimage1: file=%s, address=0x%05x\n", bx_options.optrom1.Opath->getptr(), (unsigned int)bx_options.optrom1.Oaddress->get ());
if (strlen (bx_options.optrom2.Opath->getptr ()) > 0)
fprintf (fp, "optromimage2: file=%s, address=0x%05x\n", bx_options.optrom2.Opath->getptr(), (unsigned int)bx_options.optrom2.Oaddress->get ());
if (strlen (bx_options.optrom3.Opath->getptr ()) > 0)
fprintf (fp, "optromimage3: file=%s, address=0x%05x\n", bx_options.optrom3.Opath->getptr(), (unsigned int)bx_options.optrom3.Oaddress->get ());
if (strlen (bx_options.optrom4.Opath->getptr ()) > 0)
fprintf (fp, "optromimage4: file=%s, address=0x%05x\n", bx_options.optrom4.Opath->getptr(), (unsigned int)bx_options.optrom4.Oaddress->get ());
if (strlen (bx_options.optrom[0].Opath->getptr ()) > 0)
fprintf (fp, "optromimage1: file=%s, address=0x%05x\n", bx_options.optrom[0].Opath->getptr(), (unsigned int)bx_options.optrom[0].Oaddress->get ());
if (strlen (bx_options.optrom[1].Opath->getptr ()) > 0)
fprintf (fp, "optromimage2: file=%s, address=0x%05x\n", bx_options.optrom[1].Opath->getptr(), (unsigned int)bx_options.optrom[1].Oaddress->get ());
if (strlen (bx_options.optrom[2].Opath->getptr ()) > 0)
fprintf (fp, "optromimage3: file=%s, address=0x%05x\n", bx_options.optrom[2].Opath->getptr(), (unsigned int)bx_options.optrom[2].Oaddress->get ());
if (strlen (bx_options.optrom[3].Opath->getptr ()) > 0)
fprintf (fp, "optromimage4: file=%s, address=0x%05x\n", bx_options.optrom[3].Opath->getptr(), (unsigned int)bx_options.optrom[3].Oaddress->get ());
fprintf (fp, "megs: %d\n", bx_options.memory.Osize->get ());
bx_write_parport_options (fp, &bx_options.par1, 1);
//bx_write_parport_options (fp, &bx_options.par2);