diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index b6acf140f..35cdf1a75 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1056,6 +1056,9 @@ extern int machine_at_sq578_init(const machine_t *); extern int machine_at_ms5172_init(const machine_t *); /* ALi ALADDiN IV+ */ +#ifdef EMU_DEVICE_H +extern const device_t m5ata_device; +#endif extern int machine_at_m5ata_init(const machine_t *); extern int machine_at_ms5164_init(const machine_t *); extern int machine_at_m560_init(const machine_t *); diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 9614e2d1d..cbc5ec05f 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -1702,17 +1702,57 @@ machine_at_ms5172_init(const machine_t *model) } /* ALi ALADDiN IV+ */ +static const device_config_t m5ata_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "m5ata", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .bios = { + { .name = "12/23/97", .internal_name = "m5ata", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/m5ata/ATA1223.BIN", "" } }, + { .name = "05/27/98", .internal_name = "m5ata_0527b", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/m5ata/ATA0527B.BIN", "" } }, + { .files_no = 0 } + }, + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t m5ata_device = { + .name = "Biostar M5ATA", + .internal_name = "m5ata_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = m5ata_config +}; + int machine_at_m5ata_init(const machine_t *model) { - int ret; + int ret = 0; + const char* fn; - ret = bios_load_linear("roms/machines/m5ata/ATA1223.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 796ef6751..80ac485f0 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -15777,7 +15777,7 @@ const machine_t machines[] = { .kbc_p1 = 0x00000cf0, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, - .device = NULL, + .device = &m5ata_device, .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL,