Fixed a few minor things with how the Mouse Systems Bus Mouse as added.

This commit is contained in:
OBattler
2025-04-28 11:18:57 +02:00
parent e35f11b305
commit 6fc6a16be6
9 changed files with 26 additions and 23 deletions

View File

@@ -174,7 +174,7 @@ int force_43 = 0; /* (C) video *
int video_filter_method = 1; /* (C) video */
int video_vsync = 0; /* (C) video */
int video_framerate = -1; /* (C) video */
bool serial_passthrough_enabled[SERIAL_MAX] = { 0, 0, 0, 0, 0, 0, 0 }; /* (C) activation and kind of
bool serial_passthrough_enabled[SERIAL_MAX - 1] = { 0, 0, 0, 0, 0, 0, 0 }; /* (C) activation and kind of
pass-through for serial ports */
int bugger_enabled = 0; /* (C) enable ISAbugger */
int novell_keycard_enabled = 0; /* (C) enable Novell NetWare 2.x key card emulation. */

View File

@@ -746,7 +746,7 @@ load_ports(void)
char temp[512];
memset(temp, 0, sizeof(temp));
for (int c = 0; c < SERIAL_MAX; c++) {
for (int c = 0; c < (SERIAL_MAX - 1); c++) {
sprintf(temp, "serial%d_enabled", c + 1);
com_ports[c].enabled = !!ini_section_get_int(cat, temp, (c >= 2) ? 0 : 1);
@@ -1839,7 +1839,7 @@ config_load(void)
com_ports[0].enabled = 1;
com_ports[1].enabled = 1;
for (i = 2; i < SERIAL_MAX; i++)
for (i = 2; i < (SERIAL_MAX - 1); i++)
com_ports[i].enabled = 0;
lpt_ports[0].enabled = 1;
@@ -2459,7 +2459,7 @@ save_ports(void)
ini_section_t cat = ini_find_or_create_section(config, "Ports (COM & LPT)");
char temp[512];
for (int c = 0; c < SERIAL_MAX; c++) {
for (int c = 0; c < (SERIAL_MAX - 1); c++) {
sprintf(temp, "serial%d_enabled", c + 1);
if (((c < 2) && com_ports[c].enabled) || ((c >= 2) && !com_ports[c].enabled))
ini_section_delete_var(cat, temp);

View File

@@ -843,10 +843,13 @@ sermouse_init(const device_t *info)
mouse_t *dev;
void (*rcr_callback)(struct serial_s *serial, void *priv);
void (*dev_write)(struct serial_s *serial, void *priv, uint8_t data);
void (*transmit_period_callback)(struct serial_s *serial, void *priv, double transmit_period);
void (*transmit_period_callback)(struct serial_s *serial, void *priv,
double transmit_period);
if (info->local == MOUSE_TYPE_MSYSTEMSB) {
uintptr_t irqbase = ((device_get_config_int("irq") << 16) | (device_get_config_hex16("addr") << 20)) | ns16450_device.local;
uintptr_t irqbase = ((device_get_config_int("irq") << 16) |
(device_get_config_hex16("addr") << 20)) |
ns16450_device.local;
device_add_params(&ns16450_device, (void*)irqbase);
}
@@ -894,7 +897,7 @@ sermouse_init(const device_t *info)
}
}
dev->port = (info->local == MOUSE_TYPE_MSYSTEMSB) ? SERIAL_MAX : device_get_config_int("port");
dev->port = (info->local == MOUSE_TYPE_MSYSTEMSB) ? (SERIAL_MAX - 1) : device_get_config_int("port");
/* Attach a serial port to the mouse. */
rcr_callback = dev->rts_toggle ? sermouse_callback : NULL;
@@ -982,6 +985,8 @@ static const device_config_t mssbusmouse_config[] = {
.selection = {
{ .description = "0x338", .value = 0x338 },
{ .description = "0x238", .value = 0x238 },
{ .description = "0x3f8", .value = 0x3f8 },
{ .description = "0x2f8", .value = 0x2f8 },
{ .description = "" }
},
.bios = { { 0 } }

View File

@@ -38,7 +38,7 @@
#include <86box/serial.h>
#include <86box/mouse.h>
serial_port_t com_ports[SERIAL_MAX + 1];
serial_port_t com_ports[SERIAL_MAX];
enum {
SERIAL_INT_LSR = 1,
@@ -53,7 +53,7 @@ enum {
void serial_update_ints(serial_t *dev);
static int next_inst = 0;
static serial_device_t serial_devices[SERIAL_MAX + 1];
static serial_device_t serial_devices[SERIAL_MAX];
static void serial_xmit_d_empty_evt(void *priv);
@@ -932,9 +932,8 @@ serial_init(const device_t *info)
serial_t *dev = (serial_t *) calloc(1, sizeof(serial_t));
int orig_inst = next_inst;
if (info->local & 0xFFF00000) {
next_inst = SERIAL_MAX;
}
if (info->local & 0xFFF00000)
next_inst = SERIAL_MAX - 1;
dev->inst = next_inst;
@@ -945,13 +944,12 @@ serial_init(const device_t *info)
dev->sd = &(serial_devices[next_inst]);
dev->sd->serial = dev;
if (info->local & 0xFFF00000) {
if (info->local & 0xfff00000) {
dev->base_address = info->local >> 20;
dev->irq = (info->local >> 16) & 0xF;
io_sethandler(dev->base_address, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, dev);
next_inst = orig_inst;
}
else if (next_inst == 6)
} else if (next_inst == 6)
serial_setup(dev, COM7_ADDR, COM7_IRQ);
else if (next_inst == 5)
serial_setup(dev, COM6_ADDR, COM6_IRQ);
@@ -996,7 +994,7 @@ serial_init(const device_t *info)
serial_reset_port(dev);
}
if (!(info->local & 0xFFF00000))
if (!(info->local & 0xfff00000))
next_inst++;
return dev;
@@ -1011,7 +1009,7 @@ serial_set_next_inst(int ni)
void
serial_standalone_init(void)
{
while (next_inst < SERIAL_MAX)
while (next_inst < (SERIAL_MAX - 1))
device_add_inst(&ns8250_device, next_inst + 1);
};

View File

@@ -54,7 +54,7 @@ serial_passthrough_log(const char *fmt, ...)
void
serial_passthrough_init(void)
{
for (uint8_t c = 0; c < SERIAL_MAX; c++) {
for (uint8_t c = 0; c < (SERIAL_MAX - 1); c++) {
if (serial_passthrough_enabled[c]) {
/* Instance n for COM n */
device_add_inst(&serial_passthrough_device, c + 1);

View File

@@ -27,7 +27,7 @@
/* Configuration values. */
#define GFXCARD_MAX 2
#define SERIAL_MAX 7
#define SERIAL_MAX 8
#define PARALLEL_MAX 4
#define SCREEN_RES_X 640
#define SCREEN_RES_Y 480

View File

@@ -116,7 +116,7 @@ typedef struct serial_port_s {
uint8_t enabled;
} serial_port_t;
extern serial_port_t com_ports[SERIAL_MAX + 1];
extern serial_port_t com_ports[SERIAL_MAX];
extern serial_t *serial_attach_ex(int port,
void (*rcr_callback)(struct serial_s *serial, void *priv),

View File

@@ -55,7 +55,7 @@ typedef struct serial_passthrough_s {
void *backend_priv; /* Private platform backend data */
} serial_passthrough_t;
extern bool serial_passthrough_enabled[SERIAL_MAX];
extern bool serial_passthrough_enabled[SERIAL_MAX - 1];
extern const device_t serial_passthrough_device;
extern void serial_passthrough_init(void);

View File

@@ -58,7 +58,7 @@ SettingsPorts::save()
lpt_ports[i].enabled = checkBox->isChecked() ? 1 : 0;
}
for (int i = 0; i < SERIAL_MAX; i++) {
for (int i = 0; i < (SERIAL_MAX - 1); i++) {
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
auto *checkBoxPass = findChild<QCheckBox *>(QString("checkBoxSerialPassThru%1").arg(i + 1));
if (checkBox != NULL)
@@ -118,7 +118,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId)
cbox[i]->setEnabled(lpt_ports[i].enabled > 0);
}
for (int i = 0; i < SERIAL_MAX; i++) {
for (int i = 0; i < (SERIAL_MAX - 1); i++) {
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
auto *checkBoxPass = findChild<QCheckBox *>(QString("checkBoxSerialPassThru%1").arg(i + 1));
auto *buttonPass = findChild<QPushButton *>(QString("pushButtonSerialPassThru%1").arg(i + 1));