Move LBA Enhancer to the ISA ROM system

This commit is contained in:
RichardG867
2025-07-10 12:10:16 -03:00
parent 030c25cf2d
commit 19bd891f86
10 changed files with 81 additions and 179 deletions

View File

@@ -188,7 +188,6 @@ int gfxcard[GFXCARD_MAX] = { 0, 0 }; /* (C) graphic
int show_second_monitors = 1; /* (C) show non-primary monitors */ int show_second_monitors = 1; /* (C) show non-primary monitors */
int sound_is_float = 1; /* (C) sound uses FP values */ int sound_is_float = 1; /* (C) sound uses FP values */
int voodoo_enabled = 0; /* (C) video option */ 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 ibm8514_standalone_enabled = 0; /* (C) video option */
int xga_standalone_enabled = 0; /* (C) video option */ int xga_standalone_enabled = 0; /* (C) video option */
int da2_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) if (unittester_enabled)
device_add(&unittester_device); device_add(&unittester_device);
if (lba_enhancer_enabled)
device_add(&lba_enhancer_device);
if (novell_keycard_enabled) if (novell_keycard_enabled)
device_add(&novell_keycard_device); device_add(&novell_keycard_device);

View File

@@ -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. */ /* Load "Hard Disks" section. */
@@ -1736,6 +1731,17 @@ load_other_peripherals(void)
ini_section_delete_var(cat, temp); 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"); p = ini_section_get_string(cat, "isartc_type", "none");
isartc_type = isartc_get_from_internal_name(p); 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"); 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); ini_delete_section_if_empty(config, cat);
} }

View File

@@ -29,9 +29,12 @@
enum { enum {
ISAROM_CARD = 0, ISAROM_CARD = 0,
ISAROM_CARD_DUAL, 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 #ifdef ENABLE_ISAROM_LOG
int isarom_do_log = 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); dev->socket[i].addr = device_get_config_hex20(s);
switch (dev->type) { switch (dev->type) {
case ISAROM_CARD_LBA_ENHANCER:
dev->socket[i].fn = BIOS_LBA_ENHANCER;
dev->socket[i].size = 0x4000;
break;
default: default:
snprintf(s, sizeof(s), "bios_fn%s", suffix); snprintf(s, sizeof(s), "bios_fn%s", suffix);
dev->socket[i].fn = device_get_config_string(s); dev->socket[i].fn = device_get_config_string(s);
@@ -179,6 +187,12 @@ isarom_init(const device_t *info)
return dev; 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_FILE_FILTER "ROM files (*.bin *.rom)|*.bin,*.rom"
#define BIOS_ADDR_SELECTION { \ #define BIOS_ADDR_SELECTION { \
@@ -539,6 +553,29 @@ static const device_config_t isarom_quad_config[] = {
}, },
{ .name = "", .description = "", .type = CONFIG_END } { .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 // clang-format on
static const device_t isarom_device = { static const device_t isarom_device = {
@@ -583,15 +620,30 @@ static const device_t isarom_quad_device = {
.config = isarom_quad_config .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 { static const struct {
const device_t *dev; const device_t *dev;
} boards[] = { } boards[] = {
// clang-format off // clang-format off
{ &device_none }, { &device_none },
{ &isarom_device }, { &isarom_device },
{ &isarom_dual_device }, { &isarom_dual_device },
{ &isarom_quad_device }, { &isarom_quad_device },
{ NULL } { &lba_enhancer_device },
{ NULL }
// clang-format on // clang-format on
}; };

View File

@@ -35,7 +35,6 @@ add_library(hdd OBJECT
hdc_ide_sff8038i.c hdc_ide_sff8038i.c
hdc_ide_um8673f.c hdc_ide_um8673f.c
hdc_ide_w83769f.c hdc_ide_w83769f.c
lba_enhancer.c
) )
add_library(zip OBJECT zip.c) add_library(zip OBJECT zip.c)

View File

@@ -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 <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#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
};

View File

@@ -149,7 +149,6 @@ extern int fpu_type; /* (C) fpu type */
extern int fpu_softfloat; /* (C) fpu uses softfloat */ extern int fpu_softfloat; /* (C) fpu uses softfloat */
extern int time_sync; /* (C) enable time sync */ extern int time_sync; /* (C) enable time sync */
extern int hdd_format_type; /* (C) hard disk file format */ 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_reset; /* (C) enable reset confirmation */
extern int confirm_exit; /* (C) enable exit confirmation */ extern int confirm_exit; /* (C) enable exit confirmation */
extern int confirm_save; /* (C) enable save confirmation */ extern int confirm_save; /* (C) enable save confirmation */

View File

@@ -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_device; /* xtide_at_ps2 */
extern const device_t xtide_at_ps2_2ch_device; /* xtide_at_ps2_2ch */ 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_init(void);
extern void hdc_reset(void); extern void hdc_reset(void);

View File

@@ -62,7 +62,6 @@ SettingsStorageControllers::save()
ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0; ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0;
ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0; ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0;
cassette_enable = ui->checkBoxCassette->isChecked() ? 1 : 0; cassette_enable = ui->checkBoxCassette->isChecked() ? 1 : 0;
lba_enhancer_enabled = ui->checkBoxLbaEnhancer->isChecked() ? 1 : 0;
} }
void void
@@ -232,9 +231,6 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
ui->checkBoxCassette->setChecked(false); ui->checkBoxCassette->setChecked(false);
ui->checkBoxCassette->setEnabled(false); ui->checkBoxCassette->setEnabled(false);
} }
ui->checkBoxLbaEnhancer->setChecked(lba_enhancer_enabled > 0 && device_available(&lba_enhancer_device));
ui->pushButtonConfigureLbaEnhancer->setEnabled(ui->checkBoxLbaEnhancer->isChecked());
} }
void void
@@ -365,15 +361,3 @@ SettingsStorageControllers::on_pushButtonSCSI4_clicked()
{ {
DeviceConfig::ConfigureDevice(scsi_card_getdevice(ui->comboBoxSCSI4->currentData().toInt()), 4); 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);
}

View File

@@ -44,9 +44,6 @@ private slots:
void on_comboBoxSCSI4_currentIndexChanged(int index); void on_comboBoxSCSI4_currentIndexChanged(int index);
void on_pushButtonSCSI4_clicked(); void on_pushButtonSCSI4_clicked();
void on_checkBoxLbaEnhancer_stateChanged(int arg1);
void on_pushButtonConfigureLbaEnhancer_clicked();
private: private:
Ui::SettingsStorageControllers *ui; Ui::SettingsStorageControllers *ui;
int machineId = 0; int machineId = 0;

View File

@@ -257,43 +257,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="checkBoxLbaEnhancer">
<property name="text">
<string>Vision Systems LBA Enhancer</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonConfigureLbaEnhancer">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">