From 462e9232b3633ac54e4abf2935cce95ae8426d53 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 May 2025 05:05:56 +0200 Subject: [PATCH] Chaintech 5SBM2: Rename to 5SBM/5SBM2 and add the 4.50PG BIOS from 1996 as an option. --- src/machine/m_at_socket7_3v.c | 49 ++++++++++++++++++++++++++++++++--- src/machine/machine_table.c | 7 ++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index 913c82518..04bc6b5ef 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -825,13 +825,56 @@ machine_at_vectra54_init(const machine_t *model) return ret; } +static const device_config_t c5sbm2_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "5sbm2", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .bios = { + { .name = "4.50GP (07/17/1995)", .internal_name = "5sbm2", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/5sbm2/5SBM0717.BIN", "" } }, + { .name = "4.50PG (03/21/1996)", .internal_name = "5sbm2_450pg", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/5sbm2/5SBM0326.BIN", "" } }, + { .files_no = 0 } + }, + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t c5sbm2_device = { + .name = "Chaintech 5SBM/5SBM2 (M103)", + .internal_name = "5sbm2_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = c5sbm2_config +}; + int machine_at_5sbm2_init(const machine_t *model) { - int ret; + int ret = 0; + const char* fn; - ret = bios_load_linear("roms/machines/5sbm2/5SBM0717.BIN", - 0x000e0000, 131072, 0); + /* 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(); if (bios_only || !ret) return ret; diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index e0317f40f..34e69ed24 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -68,6 +68,7 @@ extern const device_t ibmxt286_device; extern const device_t pb450_device; extern const device_t jukopc_device; extern const device_t vendex_device; +extern const device_t c5sbm2_device; const machine_filter_t machine_types[] = { { "None", MACHINE_TYPE_NONE }, @@ -11545,7 +11546,7 @@ const machine_t machines[] = { /* SiS 5501 */ /* Has the Lance LT38C41 KBC. */ { - .name = "[SiS 5501] Chaintech 5SBM2 (M103)", + .name = "[SiS 5501] Chaintech 5SBM/5SBM2 (M103)", .internal_name = "5sbm2", .type = MACHINE_TYPE_SOCKET7_3V, .chipset = MACHINE_CHIPSET_SIS_5501, @@ -11568,7 +11569,7 @@ const machine_t machines[] = { .flags = MACHINE_IDE_DUAL | MACHINE_APM, .ram = { .min = 8192, - .max = 262144, + .max = 131072, .step = 8192 }, .nvrmask = 255, @@ -11576,7 +11577,7 @@ const machine_t machines[] = { .kbc_p1 = 0xff, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, - .device = NULL, + .device = &c5sbm2_device, .fdc_device = NULL, .sio_device = NULL, .vid_device = NULL,