diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 8cc928f91..ef9031068 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1105,6 +1105,9 @@ extern int machine_at_via809ds_init(const machine_t *); /* SiS 5571 */ extern int machine_at_cb52xsi_init(const machine_t *); +#ifdef EMU_DEVICE_H +extern const device_t ms5146_device; +#endif extern int machine_at_ms5146_init(const machine_t *); #ifdef EMU_DEVICE_H extern const device_t r534f_device; diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 15e0316f2..03f20f42e 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -1825,17 +1825,72 @@ machine_at_cb52xsi_init(const machine_t *model) return ret; } +static const device_config_t ms5146_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "ms5146", + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { + { + .name = "AMIBIOS 6 (071595) - Revision 1.1", + .internal_name = "ms5146", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms5146/A546MS11.ROM", "" } + }, + { + .name = "Award Modular BIOS v4.51PG - Revision 2.1", + .internal_name = "ms5146_451pg", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms5146/W546MS21.BIN", "" } + }, + { .files_no = 0 } + } + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t ms5146_device = { + .name = "MSI MS-5146", + .internal_name = "ms5146_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ms5146_config +}; + int machine_at_ms5146_init(const machine_t *model) { - int ret; + int ret = 0; + const char *fn; - ret = bios_load_linear("roms/machines/ms5146/A546MS11.ROM", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) + /* No ROMs available */ + if (!device_available(model->device)) return ret; + device_context(model->device); + fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0); + ret = bios_load_linear(fn, 0x000e0000, 131072, 0); + device_context_restore(); + machine_at_common_init_ex(model, 2); pci_init(PCI_CONFIG_TYPE_1 | FLAG_TRC_CONTROLS_CPURST); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 8816ce42c..e2861fd0f 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -16221,7 +16221,7 @@ const machine_t machines[] = { .kbc_p1 = 0x00000cf0, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, - .device = NULL, + .device = &ms5146_device, .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL,