diff --git a/src/86box.c b/src/86box.c index f8c3365ef..d773e35cb 100644 --- a/src/86box.c +++ b/src/86box.c @@ -188,7 +188,6 @@ int gfxcard[GFXCARD_MAX] = { 0, 0 }; /* (C) graphic int show_second_monitors = 1; /* (C) show non-primary monitors */ int sound_is_float = 1; /* (C) sound uses FP values */ int voodoo_enabled = 0; /* (C) video option */ -int lba_enhancer_enabled = 0; /* (C) enable Vision Systems LBA Enhancer */ int ibm8514_standalone_enabled = 0; /* (C) video option */ int xga_standalone_enabled = 0; /* (C) video option */ int da2_standalone_enabled = 0; /* (C) video option */ @@ -1535,9 +1534,6 @@ pc_reset_hard_init(void) if (unittester_enabled) device_add(&unittester_device); - if (lba_enhancer_enabled) - device_add(&lba_enhancer_device); - if (novell_keycard_enabled) device_add(&novell_keycard_device); diff --git a/src/config.c b/src/config.c index bf9be4911..acfbec758 100644 --- a/src/config.c +++ b/src/config.c @@ -994,11 +994,6 @@ load_storage_controllers(void) } } } - - lba_enhancer_enabled = !!ini_section_get_int(cat, "lba_enhancer_enabled", 0); - - if (!lba_enhancer_enabled) - ini_section_delete_var(cat, "lba_enhancer_enabled"); } /* Load "Hard Disks" section. */ @@ -1736,6 +1731,17 @@ load_other_peripherals(void) ini_section_delete_var(cat, temp); } + /* Backwards compatibility for standalone LBA Enhancer from v4.2 and older. */ + if (ini_section_get_int(ini_find_section(config, "Storage controllers"), "lba_enhancer_enabled", 0) == 1) { + /* Migrate to the first available ISA ROM slot. */ + for (uint8_t c = 0; c < ISAROM_MAX; c++) { + if (!isarom_type[c]) { + isarom_type[c] = isarom_get_from_internal_name("lba_enhancer"); + break; + } + } + } + p = ini_section_get_string(cat, "isartc_type", "none"); isartc_type = isartc_get_from_internal_name(p); @@ -2706,10 +2712,19 @@ save_storage_controllers(void) } } - if (lba_enhancer_enabled == 0) + /* Downgrade compatibility for standalone LBA Enhancer from v4.2 and older. */ + int card_id = isarom_get_from_internal_name("lba_enhancer"); + for (c = 0; c < ISAROM_MAX; c++) { + if (isarom_type[c] == card_id) { + /* A special value of 2 still enables the cards on older versions, + but lets newer versions know that they've already been migrated. */ + ini_section_set_int(cat, "lba_enhancer_enabled", 2); + card_id = 0; /* mark as found */ + break; + } + } + if (card_id > 0) /* not found */ ini_section_delete_var(cat, "lba_enhancer_enabled"); - else - ini_section_set_int(cat, "lba_enhancer_enabled", 1); ini_delete_section_if_empty(config, cat); } diff --git a/src/device/isarom.c b/src/device/isarom.c index 0b7c38a54..d5158f4cd 100644 --- a/src/device/isarom.c +++ b/src/device/isarom.c @@ -29,9 +29,12 @@ enum { ISAROM_CARD = 0, ISAROM_CARD_DUAL, - ISAROM_CARD_QUAD + ISAROM_CARD_QUAD, + ISAROM_CARD_LBA_ENHANCER }; +#define BIOS_LBA_ENHANCER "roms/hdd/misc/lbaenhancer.bin" + #ifdef ENABLE_ISAROM_LOG int isarom_do_log = ENABLE_ISAROM_LOG; @@ -130,6 +133,11 @@ isarom_init(const device_t *info) dev->socket[i].addr = device_get_config_hex20(s); switch (dev->type) { + case ISAROM_CARD_LBA_ENHANCER: + dev->socket[i].fn = BIOS_LBA_ENHANCER; + dev->socket[i].size = 0x4000; + break; + default: snprintf(s, sizeof(s), "bios_fn%s", suffix); dev->socket[i].fn = device_get_config_string(s); @@ -179,6 +187,12 @@ isarom_init(const device_t *info) return dev; } +static int +isarom_lba_enhancer_available(void) +{ + return rom_present(BIOS_LBA_ENHANCER); +} + #define BIOS_FILE_FILTER "ROM files (*.bin *.rom)|*.bin,*.rom" #define BIOS_ADDR_SELECTION { \ @@ -539,6 +553,29 @@ static const device_config_t isarom_quad_config[] = { }, { .name = "", .description = "", .type = CONFIG_END } }; + +static const device_config_t lba_enhancer_config[] = { + { + .name = "bios_addr", + .description = "BIOS Address", + .type = CONFIG_HEX20, + .default_string = NULL, + .default_int = 0xc8000, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { + { .description = "C800H", .value = 0xc8000 }, + { .description = "CC00H", .value = 0xcc000 }, + { .description = "D000H", .value = 0xd0000 }, + { .description = "D400H", .value = 0xd4000 }, + { .description = "D800H", .value = 0xd8000 }, + { .description = "DC00H", .value = 0xdc000 }, + { .description = "" } + }, + .bios = { { 0 } } + }, + { .name = "", .description = "", .type = CONFIG_END } +}; // clang-format on static const device_t isarom_device = { @@ -583,15 +620,30 @@ static const device_t isarom_quad_device = { .config = isarom_quad_config }; +static const device_t lba_enhancer_device = { + .name = "Vision Systems LBA Enhancer", + .internal_name = "lba_enhancer", + .flags = DEVICE_ISA, + .local = ISAROM_CARD_LBA_ENHANCER, + .init = isarom_init, + .close = isarom_close, + .reset = NULL, + .available = isarom_lba_enhancer_available, + .speed_changed = NULL, + .force_redraw = NULL, + .config = lba_enhancer_config +}; + static const struct { const device_t *dev; } boards[] = { // clang-format off - { &device_none }, - { &isarom_device }, - { &isarom_dual_device }, - { &isarom_quad_device }, - { NULL } + { &device_none }, + { &isarom_device }, + { &isarom_dual_device }, + { &isarom_quad_device }, + { &lba_enhancer_device }, + { NULL } // clang-format on }; diff --git a/src/disk/CMakeLists.txt b/src/disk/CMakeLists.txt index bdbb9e74c..48d9e61ff 100644 --- a/src/disk/CMakeLists.txt +++ b/src/disk/CMakeLists.txt @@ -35,7 +35,6 @@ add_library(hdd OBJECT hdc_ide_sff8038i.c hdc_ide_um8673f.c hdc_ide_w83769f.c - lba_enhancer.c ) add_library(zip OBJECT zip.c) diff --git a/src/disk/lba_enhancer.c b/src/disk/lba_enhancer.c deleted file mode 100644 index ef9e167d3..000000000 --- a/src/disk/lba_enhancer.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 86Box A hypervisor and IBM PC system emulator that specializes in - * running old operating systems and software designed for IBM - * PC systems and compatibles from 1981 through fairly recent - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Vision Systems LBA Enhancer emulation. - * - * - * - * Authors: Cacodemon345 - * - * Copyright 2024 Cacodemon345 - */ - -#include -#include -#include -#include -#include -#define HAVE_STDARG_H -#include <86box/86box.h> -#include <86box/io.h> -#include <86box/device.h> -#include <86box/mem.h> -#include <86box/rom.h> -#include <86box/plat_unused.h> - -typedef struct lba_enhancer_t -{ - rom_t rom; -} lba_enhancer_t; - -#define BIOS_LBA_ENHANCER "roms/hdd/misc/lbaenhancer.bin" - -void -lba_enhancer_close(void* priv) -{ - free(priv); - - return; -} - -void * -lba_enhancer_init(UNUSED(const device_t *info)) -{ - lba_enhancer_t *dev = (lba_enhancer_t *) calloc(1, sizeof(lba_enhancer_t)); - - rom_init(&dev->rom, BIOS_LBA_ENHANCER, - device_get_config_hex20("bios_addr"), 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); - - return dev; -} - -static int -lba_enhancer_available(void) -{ - return rom_present(BIOS_LBA_ENHANCER); -} - -// clang-format off -static const device_config_t lba_enhancer_config[] = { - { - .name = "bios_addr", - .description = "BIOS Address", - .type = CONFIG_HEX20, - .default_string = NULL, - .default_int = 0xc8000, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "C800H", .value = 0xc8000 }, - { .description = "CC00H", .value = 0xcc000 }, - { .description = "D000H", .value = 0xd0000 }, - { .description = "D400H", .value = 0xd4000 }, - { .description = "D800H", .value = 0xd8000 }, - { .description = "DC00H", .value = 0xdc000 }, - { .description = "" } - }, - .bios = { { 0 } } - }, - { .name = "", .description = "", .type = CONFIG_END } -}; -// clang-format on - -const device_t lba_enhancer_device = { - .name = "Vision Systems LBA Enhancer", - .internal_name = "lba_enhancer", - .flags = DEVICE_ISA16, - .local = 0, - .init = lba_enhancer_init, - .close = lba_enhancer_close, - .reset = NULL, - .available = lba_enhancer_available, - .speed_changed = NULL, - .force_redraw = NULL, - .config = lba_enhancer_config -}; diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 55ba98567..4494290d6 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -149,7 +149,6 @@ extern int fpu_type; /* (C) fpu type */ extern int fpu_softfloat; /* (C) fpu uses softfloat */ extern int time_sync; /* (C) enable time sync */ extern int hdd_format_type; /* (C) hard disk file format */ -extern int lba_enhancer_enabled; /* (C) enable Vision Systems LBA Enhancer */ extern int confirm_reset; /* (C) enable reset confirmation */ extern int confirm_exit; /* (C) enable exit confirmation */ extern int confirm_save; /* (C) enable save confirmation */ diff --git a/src/include/86box/hdc.h b/src/include/86box/hdc.h index 0a5985370..ca020b4b2 100644 --- a/src/include/86box/hdc.h +++ b/src/include/86box/hdc.h @@ -112,9 +112,6 @@ extern const device_t xtide_acculogic_device; /* xtide_ps2 */ extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */ extern const device_t xtide_at_ps2_2ch_device; /* xtide_at_ps2_2ch */ -/* Miscellaneous */ -extern const device_t lba_enhancer_device; - extern void hdc_init(void); extern void hdc_reset(void); diff --git a/src/qt/qt_settingsstoragecontrollers.cpp b/src/qt/qt_settingsstoragecontrollers.cpp index d282bcb8b..5c9b24c46 100644 --- a/src/qt/qt_settingsstoragecontrollers.cpp +++ b/src/qt/qt_settingsstoragecontrollers.cpp @@ -62,7 +62,6 @@ SettingsStorageControllers::save() ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0; ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0; cassette_enable = ui->checkBoxCassette->isChecked() ? 1 : 0; - lba_enhancer_enabled = ui->checkBoxLbaEnhancer->isChecked() ? 1 : 0; } void @@ -232,9 +231,6 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId) ui->checkBoxCassette->setChecked(false); ui->checkBoxCassette->setEnabled(false); } - - ui->checkBoxLbaEnhancer->setChecked(lba_enhancer_enabled > 0 && device_available(&lba_enhancer_device)); - ui->pushButtonConfigureLbaEnhancer->setEnabled(ui->checkBoxLbaEnhancer->isChecked()); } void @@ -365,15 +361,3 @@ SettingsStorageControllers::on_pushButtonSCSI4_clicked() { DeviceConfig::ConfigureDevice(scsi_card_getdevice(ui->comboBoxSCSI4->currentData().toInt()), 4); } - -void -SettingsStorageControllers::on_checkBoxLbaEnhancer_stateChanged(int arg1) -{ - ui->pushButtonConfigureLbaEnhancer->setEnabled(arg1 != 0); -} - -void -SettingsStorageControllers::on_pushButtonConfigureLbaEnhancer_clicked() -{ - DeviceConfig::ConfigureDevice(&lba_enhancer_device); -} diff --git a/src/qt/qt_settingsstoragecontrollers.hpp b/src/qt/qt_settingsstoragecontrollers.hpp index 7c1c56086..074b48dbd 100644 --- a/src/qt/qt_settingsstoragecontrollers.hpp +++ b/src/qt/qt_settingsstoragecontrollers.hpp @@ -44,9 +44,6 @@ private slots: void on_comboBoxSCSI4_currentIndexChanged(int index); void on_pushButtonSCSI4_clicked(); - void on_checkBoxLbaEnhancer_stateChanged(int arg1); - void on_pushButtonConfigureLbaEnhancer_clicked(); - private: Ui::SettingsStorageControllers *ui; int machineId = 0; diff --git a/src/qt/qt_settingsstoragecontrollers.ui b/src/qt/qt_settingsstoragecontrollers.ui index cd1bf9baf..b9eb310ba 100644 --- a/src/qt/qt_settingsstoragecontrollers.ui +++ b/src/qt/qt_settingsstoragecontrollers.ui @@ -257,43 +257,6 @@ - - - - 0 - - - 0 - - - - - Vision Systems LBA Enhancer - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Configure - - - - -