From 8b4adebfd2bc22bc5f795c98ef288fd55b8ddae2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 May 2025 06:17:24 +0200 Subject: [PATCH] AOpen AP5S: Add two more BIOS'es, including a 4.50PG, fulfills #643. --- src/machine/m_at_386dx_486.c | 3 -- src/machine/m_at_socket7_3v.c | 55 +++++++++++++++++++++++++++++++---- src/machine/machine_table.c | 3 +- 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index e03b6d65d..46b93a37f 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -1727,9 +1727,6 @@ machine_at_sb486pv_init(const machine_t *model) device_context_restore(); machine_at_common_init(model); - // machine_at_common_init_ex(model, 2); - - // device_add(&amstrad_megapc_nvr_device); device_add(&ide_pci_device); pci_init(PCI_CONFIG_TYPE_2); diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index 39dc2d735..b587a8551 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -706,17 +706,62 @@ machine_at_gw2kma_init(const machine_t *model) return ret; } +static const device_config_t ap5s_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "ap5s", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .bios = { + { .name = "04/22/96 1.20 4.50PG", .internal_name = "ap5s_450pg", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/ap5s/ap5s120.bin", "" } }, + { .name = "11/13/96 1.50 4.51PG", .internal_name = "ap5s", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/ap5s/AP5S150.BIN", "" } }, + { .name = "06/25/97 1.60 4.51PG", .internal_name = "ap5s_latest", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/ap5s/ap5s160.bin", "" } }, + { .files_no = 0 } + }, + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t ap5s_device = { + .name = "AOpen AP5S", + .internal_name = "ap5s_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ap5s_config +}; + int machine_at_ap5s_init(const machine_t *model) { - int ret; + int ret = 0; + const char* fn; - ret = bios_load_linear("roms/machines/ap5s/AP5S150.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); + if (!strcmp(fn, "roms/machines/sb486pv/amiboot.rom")) + ret = bios_load_linear(fn, 0x000e0000, 131072, 0); + else + ret = bios_load_linear_inverted(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 ee3485373..17fde9581 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -70,6 +70,7 @@ extern const device_t jukopc_device; extern const device_t vendex_device; extern const device_t c5sbm2_device; extern const device_t sb486pv_device; +extern const device_t ap5s_device; const machine_filter_t machine_types[] = { { "None", MACHINE_TYPE_NONE }, @@ -11820,7 +11821,7 @@ const machine_t machines[] = { .kbc_p1 = 0xff, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, - .device = NULL, + .device = &ap5s_device, .fdc_device = NULL, .sio_device = NULL, .vid_device = NULL,