diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 77aff35ce..9f5a7c119 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1128,6 +1128,9 @@ extern int machine_at_p6i440e2_init(const machine_t *); /* i440BX */ extern int machine_at_bf6_init(const machine_t *); +#ifdef EMU_DEVICE_H +extern const device_t bx6_device; +#endif extern int machine_at_bx6_init(const machine_t *); extern int machine_at_ax6bc_init(const machine_t *); extern int machine_at_p2bls_init(const machine_t *); diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 12fd9861f..b3a4a2857 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -348,17 +348,57 @@ machine_at_bf6_init(const machine_t *model) return ret; } +static const device_config_t bx6_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "bx6", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .bios = { + { .name = "1998/07/28 - BIOS EG", .internal_name = "bx6", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/bx6/BX6_EG.BIN", "" } }, + { .name = "2000/03/10 - BIOS QS", .internal_name = "bx6_qs", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/bx6/BX6_QS.bin", "" } }, + { .files_no = 0 } + }, + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t bx6_device = { + .name = "ABIT BX6", + .internal_name = "bx6_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = bx6_config +}; + int machine_at_bx6_init(const machine_t *model) { - int ret; + int ret = 0; + const char* fn; - ret = bios_load_linear("roms/machines/bx6/BX6_EG.BIN", - 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); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 97b71cdb6..2d5d81f10 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -17491,7 +17491,7 @@ const machine_t machines[] = { .kbc_p1 = 0x00000cf0, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, - .device = NULL, + .device = &bx6_device, .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL,