This commit is contained in:
starfrost013
2025-06-22 14:10:19 +01:00
107 changed files with 4493 additions and 2472 deletions

View File

@@ -70,6 +70,7 @@
#include <86box/unittester.h>
#include <86box/novell_cardkey.h>
#include <86box/isamem.h>
#include <86box/isarom.h>
#include <86box/isartc.h>
#include <86box/lpt.h>
#include <86box/serial.h>
@@ -181,6 +182,7 @@ int postcard_enabled = 0; /* (C) enable
int unittester_enabled = 0; /* (C) enable unit tester device */
int gameport_type[GAMEPORT_MAX] = { 0, 0 }; /* (C) enable gameports */
int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */
int isarom_type[ISAROM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA ROM cards */
int isartc_type = 0; /* (C) enable ISA RTC card */
int gfxcard[GFXCARD_MAX] = { 0, 0 }; /* (C) graphics/video card */
int show_second_monitors = 1; /* (C) show non-primary monitors */
@@ -1472,6 +1474,10 @@ pc_reset_hard_init(void)
zip_hard_reset();
/* Reset any ISA ROM cards. */
isarom_reset();
/* Reset any ISA RTC cards. */
isartc_reset();
@@ -1901,4 +1907,4 @@ int FindAccelerator(const char *name) {
}
// No key was found
return -1;
}
}

View File

@@ -979,28 +979,28 @@ cdrom_toc_dump(cdrom_t *dev)
uint8_t b[65536] = { 0 };
int len = cdrom_read_toc(dev, b, CD_TOC_RAW, 0, 0, 65536);
const char *fn2 = "d:\\86boxnew\\toc_cue.dmp";
FILE * f = fopen(fn2, "wb");
fwrite(b, 1, len, f);
fflush(f);
fclose(f);
FILE * fp = fopen(fn2, "wb");
fwrite(b, 1, len, fp);
fflush(fp);
fclose(fp);
cdrom_log(dev->log, "Written TOC of %i bytes to %s\n", len, fn2);
memset(b, 0x00, 65536);
len = cdrom_read_toc(dev, b, CD_TOC_NORMAL, 0, 0, 65536);
fn2 = "d:\\86boxnew\\toc_cue_cooked.dmp";
f = fopen(fn2, "wb");
fwrite(b, 1, len, f);
fflush(f);
fclose(f);
fp = fopen(fn2, "wb");
fwrite(b, 1, len, fp);
fflush(fp);
fclose(fp);
cdrom_log(dev->log, "Written cooked TOC of %i bytes to %s\n", len, fn2);
memset(b, 0x00, 65536);
len = cdrom_read_toc(dev, b, CD_TOC_SESSION, 0, 0, 65536);
fn2 = "d:\\86boxnew\\toc_cue_session.dmp";
f = fopen(fn2, "wb");
fwrite(b, 1, len, f);
fflush(f);
fclose(f);
fp = fopen(fn2, "wb");
fwrite(b, 1, len, fp);
fflush(fp);
fclose(fp);
cdrom_log(dev->log, "Written session TOC of %i bytes to %s\n", len, fn2);
}
#endif

View File

@@ -988,7 +988,7 @@ neat_read(uint16_t port, void *priv)
if ((dev->indx >= 0x60) && (dev->indx <= 0x6e))
ret = dev->regs[dev->indx];
else if (dev->indx == 0x6f)
ret = (dev->regs[dev->indx] & 0xfd) | ~(mem_a20_alt & 0x02);
ret = (dev->regs[dev->indx] & 0xfd) | ((~mem_a20_alt) & 0x02);
break;
default:

View File

@@ -46,6 +46,7 @@
#include <86box/ini.h>
#include <86box/config.h>
#include <86box/isamem.h>
#include <86box/isarom.h>
#include <86box/isartc.h>
#include <86box/lpt.h>
#include <86box/serial.h>
@@ -1699,6 +1700,7 @@ load_other_peripherals(void)
if (!novell_keycard_enabled)
ini_section_delete_var(cat, "novell_keycard_enabled");
// ISA RAM Boards
for (uint8_t c = 0; c < ISAMEM_MAX; c++) {
sprintf(temp, "isamem%d_type", c);
@@ -1709,6 +1711,17 @@ load_other_peripherals(void)
ini_section_delete_var(cat, temp);
}
// ISA ROM Boards
for (uint8_t c = 0; c < ISAROM_MAX; c++) {
sprintf(temp, "isarom%d_type", c);
p = ini_section_get_string(cat, temp, "none");
isarom_type[c] = isarom_get_from_internal_name(p);
if (!strcmp(p, "none"))
ini_section_delete_var(cat, temp);
}
p = ini_section_get_string(cat, "isartc_type", "none");
isartc_type = isartc_get_from_internal_name(p);
@@ -1858,6 +1871,8 @@ config_load(void)
cdrom[0].sound_on = 1;
mem_size = 64;
isartc_type = 0;
for (i = 0; i < ISAROM_MAX; i++)
isarom_type[i] = 0;
for (i = 0; i < ISAMEM_MAX; i++)
isamem_type[i] = 0;
@@ -2706,6 +2721,7 @@ save_other_peripherals(void)
else
ini_section_set_int(cat, "novell_keycard_enabled", novell_keycard_enabled);
// ISA RAM Boards
for (uint8_t c = 0; c < ISAMEM_MAX; c++) {
sprintf(temp, "isamem%d_type", c);
if (isamem_type[c] == 0)
@@ -2715,6 +2731,16 @@ save_other_peripherals(void)
isamem_get_internal_name(isamem_type[c]));
}
// ISA ROM Boards
for (uint8_t c = 0; c < ISAROM_MAX; c++) {
sprintf(temp, "isarom%d_type", c);
if (isarom_type[c] == 0)
ini_section_delete_var(cat, temp);
else
ini_section_set_string(cat, temp,
isarom_get_internal_name(isarom_type[c]));
}
if (isartc_type == 0)
ini_section_delete_var(cat, "isartc_type");
else

View File

@@ -33,6 +33,7 @@ add_library(dev OBJECT
i2c_gpio.c
ibm_5161.c
isamem.c
isarom.c
isartc.c
isapnp.c
kbc_at.c
@@ -56,6 +57,7 @@ add_library(dev OBJECT
smbus_ali7101.c
smbus_piix4.c
smbus_sis5595.c
tulip_jumper.c
unittester.c
)

View File

@@ -2165,12 +2165,12 @@ isamem_get_internal_name(int board)
}
int
isamem_get_from_internal_name(const char *s)
isamem_get_from_internal_name(const char *str)
{
int c = 0;
while (boards[c].dev != NULL) {
if (!strcmp(boards[c].dev->internal_name, s))
if (!strcmp(boards[c].dev->internal_name, str))
return c;
c++;
}

643
src/device/isarom.c Normal file
View File

@@ -0,0 +1,643 @@
/*
* 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.
*
* Implementation of ISA ROM card Expansions.
*
* Authors: Jasmine Iwanek, <jriwanek@gmail.com>
*
* Copyright 2025 Jasmine Iwanek.
*/
#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/nvr.h>
#include <86box/isarom.h>
#define ISAROM_CARD 0
#define ISAROM_CARD_DUAL 1
#define ISAROM_CARD_QUAD 2
#ifdef ENABLE_ISAROM_LOG
int isarom_do_log = ENABLE_ISAROM_LOG;
static void
isarom_log(const char *fmt, ...)
{
va_list ap;
if (isarom_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
# define isarom_log(fmt, ...)
#endif
typedef struct isarom_t {
struct {
rom_t rom;
uint32_t addr;
const char *fn;
uint32_t size;
uint32_t len;
char nvr_path[64];
uint8_t wp;
} socket[4];
uint8_t inst;
uint8_t type;
} isarom_t;
static inline uint8_t
get_limit(uint8_t type)
{
if (type == ISAROM_CARD_DUAL)
return 2;
if (type == ISAROM_CARD_QUAD)
return 4;
return 1;
}
static inline void
isarom_save_nvr(char *path, uint8_t *data, size_t size)
{
if (path[0] == 0x00)
return;
FILE *fp = nvr_fopen(path, "wb");
if (fp) {
fwrite(data, 1, size, fp);
fclose(fp);
}
}
void
isarom_close(void *priv)
{
isarom_t *dev = (isarom_t *) priv;
if (!priv)
return;
for (uint8_t i = 0; i < get_limit(dev->type); i++)
if (dev->socket[i].rom.rom) {
isarom_log("isarom[%u]: saving NVR for socket %u -> %s (%u bytes)\n",
dev->inst, i, dev->socket[i].nvr_path, dev->socket[i].size);
isarom_save_nvr(dev->socket[i].nvr_path, dev->socket[i].rom.rom, dev->socket[i].size);
}
free(dev);
}
static void *
isarom_init(const device_t *info)
{
isarom_t *dev = (isarom_t *) calloc(1, sizeof(isarom_t));
if (!dev)
return NULL;
dev->inst = device_get_instance();
dev->type = (uint8_t) info->local;
isarom_log("isarom[%u]: initializing device (type=%u)\n", dev->inst, dev->type);
for (uint8_t i = 0; i < get_limit(dev->type); i++) {
char key_fn[12];
char key_addr[14];
char key_size[14];
char key_writes[22];
char suffix[4] = "";
if (i > 0)
snprintf(suffix, sizeof(suffix), "%d", i + 1);
snprintf(key_fn, sizeof(key_fn), "bios_fn%s", suffix);
snprintf(key_addr, sizeof(key_addr), "bios_addr%s", suffix);
snprintf(key_size, sizeof(key_size), "bios_size%s", suffix);
snprintf(key_writes, sizeof(key_writes), "rom_writes_enabled%s", suffix);
dev->socket[i].fn = device_get_config_string(key_fn);
dev->socket[i].addr = device_get_config_hex20(key_addr);
dev->socket[i].size = device_get_config_int(key_size);
// Note: 2K is the smallest ROM I've found, but 86box's memory granularity is 4k, the number below is fine
// as we'll end up allocating no less than 4k due to the device config limits.
dev->socket[i].len = (dev->socket[i].size > 2048) ? dev->socket[i].size - 1 : 0;
dev->socket[i].wp = (uint8_t) device_get_config_int(key_writes) ? 1 : 0;
isarom_log("isarom[%u]: socket %u: addr=0x%05X size=%u wp=%u fn=%s\n",
dev->inst, i, dev->socket[i].addr, dev->socket[i].size,
dev->socket[i].wp, dev->socket[i].fn ? dev->socket[i].fn : "(null)");
if (dev->socket[i].addr != 0 && dev->socket[i].fn != NULL) {
rom_init(&dev->socket[i].rom,
dev->socket[i].fn,
dev->socket[i].addr,
dev->socket[i].size,
dev->socket[i].len,
0,
MEM_MAPPING_EXTERNAL);
isarom_log("isarom[%u]: ROM initialized for socket %u\n", dev->inst, i);
if (dev->socket[i].wp) {
mem_mapping_set_write_handler(&dev->socket[i].rom.mapping, rom_write, rom_writew, rom_writel);
snprintf(dev->socket[i].nvr_path, sizeof(dev->socket[i].nvr_path), "isarom_%i_%i.nvr", dev->inst, i + 1);
FILE *fp = nvr_fopen(dev->socket[i].nvr_path, "rb");
if (fp != NULL) {
fread(dev->socket[i].rom.rom, 1, dev->socket[i].size, fp);
fclose(fp);
isarom_log("isarom[%u]: loaded %zu bytes from %s\n", dev->inst, read_bytes, dev->socket[i].nvr_path);
} else
isarom_log("isarom[%u]: NVR not found, skipping load (%s)\n", dev->inst, dev->socket[i].nvr_path);
}
}
}
return dev;
}
#define BIOS_FILE_FILTER "ROM files (*.bin *.rom)|*.bin,*.rom"
#define BIOS_ADDR_SELECTION { \
{ "Disabled", 0x00000 }, \
{ "C000H", 0xc0000 }, \
{ "C200H", 0xc2000 }, \
{ "C400H", 0xc4000 }, \
{ "C600H", 0xc6000 }, \
{ "C800H", 0xc8000 }, \
{ "CA00H", 0xca000 }, \
{ "CC00H", 0xcc000 }, \
{ "CE00H", 0xce000 }, \
{ "D000H", 0xd0000 }, \
{ "D200H", 0xd2000 }, \
{ "D400H", 0xd4000 }, \
{ "D600H", 0xd6000 }, \
{ "D800H", 0xd8000 }, \
{ "DA00H", 0xda000 }, \
{ "DC00H", 0xdc000 }, \
{ "DE00H", 0xde000 }, \
{ "E000H", 0xe0000 }, \
{ "E200H", 0xe2000 }, \
{ "E400H", 0xe4000 }, \
{ "E600H", 0xe6000 }, \
{ "E800H", 0xe8000 }, \
{ "EA00H", 0xea000 }, \
{ "EC00H", 0xec000 }, \
{ "EE00H", 0xee000 }, \
{ "", 0 } \
}
#define BIOS_SIZE_SELECTION { \
{ "4K", 4096 }, \
{ "8K", 8192 }, \
{ "16K", 16384 }, \
{ "32K", 32768 }, \
{ "64K", 65536 }, \
{ "", 0 } \
}
// clang-format off
static const device_config_t isarom_config[] = {
{
.name = "bios_fn",
.description = "BIOS File",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = BIOS_FILE_FILTER,
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size",
.description = "BIOS Size:",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled",
.description = "Enable BIOS extension ROM Writes",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t isarom_dual_config[] = {
{
.name = "bios_fn",
.description = "BIOS File (ROM #1)",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = BIOS_FILE_FILTER,
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address (ROM #1)",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size",
.description = "BIOS Size (ROM #1):",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled",
.description = "Enable BIOS extension ROM Writes (ROM #1)",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_fn2",
.description = "BIOS File (ROM #2)",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = BIOS_FILE_FILTER,
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr2",
.description = "BIOS Address (ROM #2)",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size2",
.description = "BIOS Size (ROM #2):",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled2",
.description = "Enable BIOS extension ROM Writes (ROM #2)",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t isarom_quad_config[] = {
{
.name = "bios_fn",
.description = "BIOS File (ROM #1)",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = BIOS_FILE_FILTER,
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address (ROM #1)",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size",
.description = "BIOS Size (ROM #1):",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled",
.description = "Enable BIOS extension ROM Writes (ROM #1)",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_fn2",
.description = "BIOS File (ROM #2)",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = BIOS_FILE_FILTER,
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr2",
.description = "BIOS Address (ROM #2)",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size2",
.description = "BIOS Size (ROM #2):",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled2",
.description = "Enable BIOS extension ROM Writes (ROM #2)",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_fn3",
.description = "BIOS File (ROM #3)",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = "ROM files (*.bin *.rom)|*.bin,*.rom",
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr3",
.description = "BIOS Address (ROM #3)",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size3",
.description = "BIOS Size (ROM #3):",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled3",
.description = "Enable BIOS extension ROM Writes (ROM #3)",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_fn4",
.description = "BIOS File (ROM #4)",
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = BIOS_FILE_FILTER,
.spinner = { 0 },
.selection = { },
.bios = { { 0 } }
},
{
.name = "bios_addr4",
.description = "BIOS Address (ROM #4)",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0x00000,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_ADDR_SELECTION,
.bios = { { 0 } }
},
{
.name = "bios_size4",
.description = "BIOS Size (ROM #4):",
.type = CONFIG_INT,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = BIOS_SIZE_SELECTION,
.bios = { { 0 } }
},
{
.name = "rom_writes_enabled4",
.description = "Enable BIOS extension ROM Writes (ROM #4)",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
// clang-format on
static const device_t isarom_device = {
.name = "Generic ISA ROM Board",
.internal_name = "isarom",
.flags = DEVICE_ISA,
.local = ISAROM_CARD,
.init = isarom_init,
.close = isarom_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = isarom_config
};
static const device_t isarom_dual_device = {
.name = "Generic Dual ISA ROM Board",
.internal_name = "isarom_dual",
.flags = DEVICE_ISA,
.local = ISAROM_CARD_DUAL,
.init = isarom_init,
.close = isarom_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = isarom_dual_config
};
static const device_t isarom_quad_device = {
.name = "Generic Quad ISA ROM Board",
.internal_name = "isarom_quad",
.flags = DEVICE_ISA,
.local = ISAROM_CARD_QUAD,
.init = isarom_init,
.close = isarom_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = isarom_quad_config
};
static const struct {
const device_t *dev;
} boards[] = {
// clang-format off
{ &device_none },
{ &isarom_device },
{ &isarom_dual_device },
{ &isarom_quad_device },
{ NULL }
// clang-format on
};
void
isarom_reset(void)
{
for (uint8_t i = 0; i < ISAROM_MAX; i++) {
if (isarom_type[i] == 0)
continue;
/* Add the device instance to the system. */
device_add_inst(boards[isarom_type[i]].dev, i + 1);
}
}
const char *
isarom_get_name(int board)
{
if (boards[board].dev == NULL)
return NULL;
return (boards[board].dev->name);
}
const char *
isarom_get_internal_name(int board)
{
return device_get_internal_name(boards[board].dev);
}
int
isarom_get_from_internal_name(const char *str)
{
int c = 0;
while (boards[c].dev != NULL) {
if (!strcmp(boards[c].dev->internal_name, str))
return c;
c++;
}
/* Not found. */
return 0;
}
const device_t *
isarom_get_device(int board)
{
/* Add the device instance to the system. */
return boards[board].dev;
}
int
isarom_has_config(int board)
{
if (boards[board].dev == NULL)
return 0;
return (boards[board].dev->config ? 1 : 0);
}

View File

@@ -532,8 +532,8 @@ isartc_init(const device_t *info)
switch (dev->board) {
case ISARTC_MM58167: /* Generic MM58167 RTC */
{
int rom_addr = device_get_config_hex20("bios_addr");
if (rom_addr != -1)
uint32_t rom_addr = device_get_config_hex20("bios_addr");
if (rom_addr != 0)
rom_init(&dev->rom, ISARTC_ROM_MM58167_1,
rom_addr, 0x0800, 0x7ff, 0, MEM_MAPPING_EXTERNAL);
@@ -830,7 +830,7 @@ static const device_config_t mm58167_config[] = {
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = -1 },
{ .description = "Disabled", .value = 0x00000 },
{ .description = "C800H", .value = 0xc8000 },
{ .description = "CA00H", .value = 0xca000 },
{ .description = "CC00H", .value = 0xcc000 },
@@ -919,12 +919,12 @@ isartc_get_internal_name(int board)
}
int
isartc_get_from_internal_name(char *s)
isartc_get_from_internal_name(const char *str)
{
int c = 0;
while (boards[c].dev != NULL) {
if (!strcmp(boards[c].dev->internal_name, s))
if (!strcmp(boards[c].dev->internal_name, str))
return c;
c++;
}

File diff suppressed because it is too large Load Diff

103
src/device/tulip_jumper.c Normal file
View File

@@ -0,0 +1,103 @@
/*
* 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.
*
* Implementation of the Tulip Jumper Readout.
*
* Bits 7-5 = board number, 0-5 valid, 6, 7 invalid.
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2025 Miran Grca.
*/
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include "cpu.h"
#include <86box/timer.h>
#include <86box/io.h>
#include <86box/device.h>
#include <86box/machine.h>
#include <86box/sound.h>
#include <86box/chipset.h>
#include <86box/plat.h>
#include <86box/plat_unused.h>
typedef struct tulip_jumper_t {
uint8_t jumper;
} tulip_jumper_t;
#ifdef ENABLE_TULIP_JUMPER_LOG
int tulip_jumper_do_log = ENABLE_TULIP_JUMPER_LOG;
static void
tulip_jumper_log(const char *fmt, ...)
{
va_list ap;
if (tulip_jumper_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
# define tulip_jumper_log(fmt, ...)
#endif
static uint8_t
tulip_jumper_read(uint16_t addr, void *priv)
{
const tulip_jumper_t *dev = (tulip_jumper_t *) priv;
uint8_t ret = 0xff;
tulip_jumper_log("Tulip Jumper: Read %02x\n", dev->jumper);
ret = dev->jumper;
return ret;
}
static void
tulip_jumper_close(void *priv)
{
tulip_jumper_t *dev = (tulip_jumper_t *) priv;
free(dev);
}
static void *
tulip_jumper_init(const device_t *info)
{
tulip_jumper_t *dev = (tulip_jumper_t *) calloc(1, sizeof(tulip_jumper_t));
/* Return board number 05. */
dev->jumper = 0xbf;
io_sethandler(0x0d80, 0x0001, tulip_jumper_read, NULL, NULL, NULL, NULL, NULL, dev);
return dev;
}
const device_t tulip_jumper_device = {
.name = "Tulip Jumper Readout",
.internal_name = "tulip_jumper",
.flags = 0,
.local = 0,
.init = tulip_jumper_init,
.close = tulip_jumper_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};

View File

@@ -187,10 +187,18 @@ fdc_ctrl_reset(void *priv)
fdc->stat = 0x80;
fdc->pnum = fdc->ptot = 0;
fdc->st0 = 0;
fdc->lock = 0;
fdc->head = 0;
fdc->step = 0;
fdc->power_down = 0;
if (!fdc->lock) {
fdc->fifo = 0;
fdc->tfifo = 1;
fifo_reset(fdc->fifo_p);
fifo_set_len(fdc->fifo_p, fdc->tfifo + 1);
fifo_set_trigger_len(fdc->fifo_p, fdc->tfifo + 1);
}
}
sector_id_t
@@ -1653,8 +1661,8 @@ fdc_callback(void *priv)
case 0x06: /* Read data */
case 0x0c: /* Read deleted data */
case 0x11: /* Scan equal */
case 0x16: /* Verify */
case 0x19: /* Scan low or equal */
case 0x1c: /* Verify */
case 0x1d: /* Scan high or equal */
if ((fdc->interrupt == 0x11) || (fdc->interrupt == 0x19) || (fdc->interrupt == 0x1D))
compare = 1;
@@ -2374,6 +2382,8 @@ fdc_reset(void *priv)
fdc->swwp = 0;
fdc->disable_write = 0;
fdc->lock = 0;
fdc_ctrl_reset(fdc);
if (!(fdc->flags & FDC_FLAG_AT))

View File

@@ -467,7 +467,7 @@ fdd_load(int drive, char *fn)
int c = 0;
int size;
const char *p;
FILE * fp;
FILE *fp;
fdd_log("FDD: loading drive %d with '%s'\n", drive, fn);

View File

@@ -134,6 +134,7 @@ extern int postcard_enabled; /* (C) enable POST card */
extern int unittester_enabled; /* (C) enable unit tester device */
extern int gameport_type[]; /* (C) enable gameports */
extern int isamem_type[]; /* (C) enable ISA mem cards */
extern int isarom_type[]; /* (C) enable ISA ROM cards */
extern int isartc_type; /* (C) enable ISA RTC card */
extern int sound_is_float; /* (C) sound uses FP values */
extern int voodoo_enabled; /* (C) video option */

View File

@@ -106,10 +106,10 @@ enum {
#define CDV EMU_VERSION_EX
static const struct cdrom_drive_types_s {
const char * vendor;
const char * model;
const char * revision;
const char * internal_name;
const char *vendor;
const char *model;
const char *revision;
const char *internal_name;
const int bus_type;
/* SCSI standard for SCSI (or both) devices, early for IDE. */
const int scsi_std;
@@ -296,7 +296,7 @@ typedef struct cdrom {
uint8_t speed;
uint8_t cur_speed;
void * priv;
void *priv;
char image_path[1024];
char prev_image_path[1280];
@@ -322,10 +322,10 @@ typedef struct cdrom {
const cdrom_ops_t *ops;
char * image_history[CD_IMAGE_HISTORY];
char *image_history[CD_IMAGE_HISTORY];
void * local;
void * log;
void *local;
void *log;
void (*insert)(void *priv);
void (*close)(void *priv);

View File

@@ -33,6 +33,6 @@ typedef struct track_file_t {
int motorola;
} track_file_t;
extern void * image_open(cdrom_t *dev, const char *path);
extern void *image_open(cdrom_t *dev, const char *path);
#endif /*CDROM_IMAGE_H*/

View File

@@ -201,6 +201,8 @@ extern const device_t vlsi_scamp_device;
extern const device_t wd76c10_device;
/* Miscellaneous Hardware */
extern const device_t tulip_jumper_device;
extern const device_t dell_jumper_device;
extern const device_t nec_mate_unk_device;

View File

@@ -122,6 +122,7 @@ typedef struct config_t {
int ide_qua_enabled; /* Quaternary IDE controller enabled */
int bugger_enabled; /* ISA bugger device enabled */
int isa_rtc_type; /* ISA RTC card */
int isa_rom_type[ISAROM_MAX]; /* ISA ROM boards */
int isa_mem_type[ISAMEM_MAX]; /* ISA memory boards */
/* Hard disks category */

View File

@@ -159,7 +159,7 @@ typedef struct hard_disk_t {
uint8_t pad;
uint8_t pad0;
void * priv;
void *priv;
char fn[1024]; /* Name of current image file */
/* Differential VHD parent file */
@@ -185,7 +185,7 @@ typedef struct hard_disk_t {
uint8_t max_multiple_block;
uint8_t pad1[3];
const char * model;
const char *model;
hdd_zone_t zones[HDD_MAX_ZONES];

View File

@@ -42,7 +42,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_ISAMEM_H
#define EMU_ISAMEM_H
@@ -52,17 +51,12 @@
extern "C" {
#endif
/* Global variables. */
extern const device_t isamem_device;
extern const device_t isamem_brat80_device;
extern const device_t isamem_ev159_device;
/* Functions. */
extern void isamem_reset(void);
extern const char *isamem_get_name(int t);
extern const char *isamem_get_internal_name(int t);
extern int isamem_get_from_internal_name(const char *s);
extern int isamem_get_from_internal_name(const char *str);
extern const device_t *isamem_get_device(int t);
extern int isamem_has_config(int board);

View File

@@ -0,0 +1,37 @@
/*
* 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.
*
* Implementation of ISA ROM card Expansions.
*
* Authors: Jasmine Iwanek, <jriwanek@gmail.com>
*
* Copyright 2025 Jasmine Iwanek.
*/
#ifndef EMU_ISAROM_H
#define EMU_ISAROM_H
#define ISAROM_MAX 4 /* max #cards in system */
#ifdef __cplusplus
extern "C" {
#endif
/* Functions. */
extern void isarom_reset(void);
extern const char *isarom_get_name(int t);
extern const char *isarom_get_internal_name(int t);
extern int isarom_get_from_internal_name(const char *str);
extern const device_t *isarom_get_device(int t);
extern int isarom_has_config(int board);
#ifdef __cplusplus
}
#endif
#endif /*EMU_ISAROM_H*/

View File

@@ -42,7 +42,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_ISARTC_H
#define EMU_ISARTC_H
@@ -50,13 +49,11 @@
extern "C" {
#endif
/* Global variables. */
/* Functions. */
extern void isartc_reset(void);
extern const char *isartc_get_internal_name(int t);
extern int isartc_get_from_internal_name(char *s);
extern int isartc_get_from_internal_name(const char *str);
extern const device_t *isartc_get_device(int t);
extern int isartc_has_config(int board);

View File

@@ -473,7 +473,9 @@ extern int machine_at_spc4216p_init(const machine_t *);
extern int machine_at_spc4620p_init(const machine_t *);
extern int machine_at_kmxc02_init(const machine_t *);
extern int machine_at_deskmaster286_init(const machine_t *);
extern int machine_at_dells200_init(const machine_t *);
extern int machine_at_tuliptc7_init(const machine_t *);
extern int machine_at_pc8_init(const machine_t *);
extern int machine_at_3302_init(const machine_t *);
@@ -546,6 +548,7 @@ extern int machine_at_exp4349_init(const machine_t *);
extern int machine_at_vect486vl_init(const machine_t *);
extern int machine_at_d824_init(const machine_t *);
extern int machine_at_tuliptc38_init(const machine_t *);
extern int machine_at_martin_init(const machine_t *);
extern int machine_at_403tg_init(const machine_t *);
@@ -610,6 +613,7 @@ extern int machine_at_iach488_init(const machine_t *);
extern int machine_at_pcm9340_init(const machine_t *);
extern int machine_at_pcm5330_init(const machine_t *);
extern int machine_at_84xxuuda_init(const machine_t *);
extern int machine_at_ecs486_init(const machine_t *);
extern int machine_at_hot433a_init(const machine_t *);
extern int machine_at_pl4600c_init(const machine_t *);
@@ -664,6 +668,7 @@ extern int machine_at_p5sp4_init(const machine_t *);
/* m_at_socket5.c */
extern int machine_at_plato_init(const machine_t *);
extern int machine_at_dellplato_init(const machine_t *);
extern int machine_at_d842_init(const machine_t *);
extern int machine_at_ambradp90_init(const machine_t *);
extern int machine_at_p54np4_init(const machine_t *);
extern int machine_at_586ip_init(const machine_t *);

View File

@@ -110,13 +110,13 @@ typedef struct mo_drive_t {
uint8_t pad;
uint8_t pad0;
FILE * fp;
void * priv;
FILE *fp;
void *priv;
char image_path[1024];
char prev_image_path[1024];
char * image_history[MO_IMAGE_HISTORY];
char *image_history[MO_IMAGE_HISTORY];
uint32_t type;
uint32_t medium_size;
@@ -129,16 +129,16 @@ typedef struct mo_drive_t {
typedef struct mo_t {
mode_sense_pages_t ms_pages_saved;
mo_drive_t * drv;
mo_drive_t *drv;
#ifdef EMU_IDE_H
ide_tf_t * tf;
ide_tf_t *tf;
#else
void * tf;
void *tf;
#endif
void * log;
uint8_t * buffer;
uint8_t *buffer;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint8_t sense[256];

View File

@@ -102,4 +102,6 @@ extern int picinterrupt(void);
extern uint8_t pic_irq_ack(void);
extern void pic_toggle_latch(int is_ps2);
#endif /*EMU_PIC_H*/

View File

@@ -24,6 +24,19 @@
#define INT_FIFO_EMP (1 << 3)
#define INT_MASK 0xf
typedef enum {
IBM_8514A_TYPE = 0,
ATI_38800_TYPE,
ATI_68800_TYPE,
TYPE_MAX
} ibm8514_card_type;
typedef enum {
IBM = 0,
ATI,
EXTENSIONS_MAX
} ibm8514_extensions_t;
typedef struct hwcursor8514_t {
int ena;
int x;
@@ -58,7 +71,7 @@ typedef struct ibm8514_t {
int force_old_addr;
int type;
int local;
ibm8514_card_type local;
int bpp;
int on;
int accel_bpp;
@@ -246,7 +259,8 @@ typedef struct ibm8514_t {
int pitch;
int ext_pitch;
int ext_crt_pitch;
int extensions;
ibm8514_extensions_t extensions;
int onboard;
int linear;
uint32_t vram_amount;
int vram_512k_8514;
@@ -263,9 +277,9 @@ typedef struct ibm8514_t {
} ibm8514_t;
#define IBM_8514A (((dev->local & 0xff) == 0x00) && (dev->extensions == 0x00))
#define ATI_8514A_ULTRA (((dev->local & 0xff) == 0x00) && (dev->extensions == 0x01))
#define ATI_GRAPHICS_ULTRA ((dev->local & 0xff) == 0x01)
#define ATI_MACH32 ((dev->local & 0xff) == 0x02)
#define IBM_8514A (((dev->local & 0xff) == IBM_8514A_TYPE) && (dev->extensions == IBM))
#define ATI_8514A_ULTRA (((dev->local & 0xff) == IBM_8514A_TYPE) && (dev->extensions == ATI))
#define ATI_GRAPHICS_ULTRA ((dev->local & 0xff) == ATI_38800_TYPE)
#define ATI_MACH32 ((dev->local & 0xff) == ATI_68800_TYPE)
#endif /*VIDEO_8514A_H*/

View File

@@ -15,16 +15,65 @@
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2025 starfrost (refactoring)
*/
#ifndef VIDEO_CGA_H
#define VIDEO_CGA_H
// Mode flags for the CGA.
// Set by writing to 3D8
typedef enum cga_mode_flags_e
{
CGA_MODE_FLAG_HIGHRES = 1 << 0, // 80-column text mode
CGA_MODE_FLAG_GRAPHICS = 1 << 1, // Graphics mode
CGA_MODE_FLAG_BW = 1 << 2, // Black and white
CGA_MODE_FLAG_VIDEO_ENABLE = 1 << 3, // 0 = no video (as if the video was 0)
CGA_MODE_FLAG_HIGHRES_GRAPHICS = 1 << 4, // 640*200 mode. Corrupts text mode if CGA_MODE_FLAG_GRAPHICS not set.
CGA_MODE_FLAG_BLINK = 1 << 5, // If this is set, bit 5 of textmode characters blinks. Otherwise it is a high-intensity bg mode.
} cga_mode_flags;
// Motorola MC6845 CRTC registers
typedef enum cga_crtc_registers_e
{
CGA_CRTC_HTOTAL = 0x0, // Horizontal total (total number of characters incl. hsync)
CGA_CRTC_HDISP = 0x1, // Horizontal display
CGA_CRTC_HSYNC_POS = 0x2, // Horizontal position of horizontal ysnc
CGA_CRTC_HSYNC_WIDTH = 0x3, // Width of horizontal sync
CGA_CRTC_VTOTAL = 0x4, // Vertical total (total number of scanlines incl. vsync)
CGA_CRTC_VTOTAL_ADJUST = 0x5, // Vertical total adjust value
CGA_CRTC_VDISP = 0x6, // Vertical display (total number of displayed scanline)
CGA_CRTC_VSYNC = 0x7, // Vertical sync scanline number
CGA_CRTC_INTERLACE = 0x8, // Interlacing mode
CGA_CRTC_MAX_SCANLINE_ADDR = 0x9, // Maximum scanline address
CGA_CRTC_CURSOR_START = 0xA, // Cursor start scanline
CGA_CRTC_CURSOR_END = 0xB, // Cursor end scanline
CGA_CRTC_START_ADDR_HIGH = 0xC, // Screen start address high 8 bits
CGA_CRTC_START_ADDR_LOW = 0xD, // Screen start address low 8 bits
CGA_CRTC_CURSOR_ADDR_HIGH = 0xE, // Cursor address high 8 bits
CGA_CRTC_CURSOR_ADDR_LOW = 0xF, // Cursor address low 8 bits
CGA_CRTC_LIGHT_PEN_ADDR_HIGH = 0x10, // Light pen address high 8 bits (not currently supported)
CGA_CRTC_LIGHT_PEN_ADDR_LOW = 0x11, // Light pen address low 8 bits (not currently supported)
} cga_crtc_registers;
typedef enum cga_registers_e
{
CGA_REGISTER_CRTC_INDEX = 0x3D4,
CGA_REGISTER_CRTC_DATA = 0x3D5,
CGA_REGISTER_MODE_CONTROL = 0x3D8,
CGA_REGISTER_COLOR_SELECT = 0x3D9,
CGA_REGISTER_STATUS = 0x3DA,
CGA_REGISTER_CLEAR_LIGHT_PEN_LATCH = 0x3DB,
CGA_REGISTER_SET_LIGHT_PEN_LATCH = 0x3DC,
} cga_registers;
#define CGA_NUM_CRTC_REGS 32
typedef struct cga_t {
mem_mapping_t mapping;
int crtcreg;
uint8_t crtc[32];
uint8_t crtc[CGA_NUM_CRTC_REGS];
uint8_t cgastat;
@@ -40,7 +89,6 @@ typedef struct cga_t {
int vc;
int cgadispon;
int con;
int coff;
int cursoron;
int cgablink;
int vsynctime;

View File

@@ -148,6 +148,8 @@ typedef struct ega_t {
card should not attempt to display anything. */
void (*render_override)(void *priv);
void * priv_parent;
uint8_t alt_addr; /* 0 for 0x3XX range, 1 for 0x2XX range */
} ega_t;
#endif

View File

@@ -47,7 +47,6 @@ typedef struct {
uint16_t ma;
uint16_t maback;
int con;
int coff;
int cursoron;
int dispon;
int blink;

View File

@@ -29,7 +29,6 @@ typedef struct mda_t {
uint16_t ma;
uint16_t maback;
int con;
int coff;
int cursoron;
int dispon;
int blink;

View File

@@ -116,7 +116,6 @@ typedef struct pgc {
int vc;
int cgadispon;
int con;
int coff;
int cursoron;
int cgablink;
int vsynctime;

View File

@@ -116,6 +116,7 @@ typedef struct svga_t {
int lastline_draw;
int displine;
int fullchange;
int left_overscan;
int x_add;
int y_add;
int pan;

View File

@@ -58,13 +58,13 @@ typedef struct zip_drive_t {
uint8_t pad;
uint8_t pad0;
FILE * fp;
void * priv;
FILE *fp;
void *priv;
char image_path[1024];
char prev_image_path[1024];
char * image_history[ZIP_IMAGE_HISTORY];
char *image_history[ZIP_IMAGE_HISTORY];
uint32_t is_250;
uint32_t medium_size;
@@ -74,16 +74,16 @@ typedef struct zip_drive_t {
typedef struct zip_t {
mode_sense_pages_t ms_pages_saved;
zip_drive_t * drv;
zip_drive_t *drv;
#ifdef EMU_IDE_H
ide_tf_t * tf;
ide_tf_t *tf;
#else
void * tf;
void *tf;
#endif
void * log;
void *log;
uint8_t * buffer;
uint8_t *buffer;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint8_t sense[256];

View File

@@ -117,7 +117,6 @@ typedef struct amsvid_t {
int vc;
int cgadispon;
int con;
int coff;
int cursoron;
int cgablink;
int vsynctime;
@@ -515,7 +514,6 @@ vid_poll_1512(void *priv)
}
if (vid->sc == (vid->crtc[11] & 31)) {
vid->con = 0;
vid->coff = 1;
}
if (vid->vadj) {
vid->sc++;
@@ -1319,7 +1317,6 @@ lcdm_poll(amsvid_t *vid)
}
if (mda->sc == (mda->crtc[11] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[11] & 31) >> 1))) {
mda->con = 0;
mda->coff = 1;
}
if (mda->vadj) {
mda->sc++;
@@ -1483,7 +1480,6 @@ lcdc_poll(amsvid_t *vid)
}
if (cga->sc == (cga->crtc[11] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[11] & 31) >> 1))) {
cga->con = 0;
cga->coff = 1;
}
if ((cga->crtc[8] & 3) == 3 && cga->sc == (cga->crtc[9] >> 1))
cga->maback = cga->ma;

View File

@@ -154,32 +154,68 @@ machine_at_ps2_ide_init(const machine_t *model)
static const device_config_t ibmat_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ibm5170_111585",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{ .name = "62X082x (11/15/85)", .internal_name = "ibm5170_111585", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmat/BIOS_5170_15NOV85_U27.BIN", "roms/machines/ibmat/BIOS_5170_15NOV85_U47.BIN", "" } },
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{
.name = "62X082x (11/15/85)",
.internal_name = "ibm5170_111585",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmat/BIOS_5170_15NOV85_U27.BIN", "roms/machines/ibmat/BIOS_5170_15NOV85_U47.BIN", "" }
},
{
.name = "61X9266 (11/15/85) (Alt)",
.internal_name = "ibm5170_111585_alt",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmat/BIOS_5170_15NOV85_U27_61X9266.BIN", "roms/machines/ibmat/BIOS_5170_15NOV85_U47_61X9265.BIN", "" }
},
{
.name = "648009x (06/10/85)",
.internal_name = "ibm5170_061085",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmat/BIOS_5170_10JUN85_U27.BIN", "roms/machines/ibmat/BIOS_5170_10JUN85_U47.BIN", "" }
},
{
.name = "618102x (01/10/84)",
.internal_name = "ibm5170_011084",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmat/BIOS_5170_10JAN84_U27.BIN", "roms/machines/ibmat/BIOS_5170_10JAN84_U47.BIN", "" }
},
// The following are Diagnostic ROMs.
{
.name = "Supersoft Diagnostics",
.internal_name = "diag_supersoft",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/5170_EVEN_LOW_U27_27256.bin", "roms/machines/diagnostic/5170_ODD_HIGH_U47_27256.bin", "" }
},
{ .name = "61X9266 (11/15/85) (Alt)", .internal_name = "ibm5170_111585_alt", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmat/BIOS_5170_15NOV85_U27_61X9266.BIN", "roms/machines/ibmat/BIOS_5170_15NOV85_U47_61X9265.BIN", "" } },
{ .name = "648009x (06/10/85)", .internal_name = "ibm5170_061085", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmat/BIOS_5170_10JUN85_U27.BIN", "roms/machines/ibmat/BIOS_5170_10JUN85_U47.BIN", "" } },
{ .name = "618102x (01/10/84)", .internal_name = "ibm5170_011084", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmat/BIOS_5170_10JAN84_U27.BIN", "roms/machines/ibmat/BIOS_5170_10JAN84_U47.BIN", "" } },
{ .files_no = 0 }
},
},
{
.name = "enable_5161",
.name = "enable_5161",
.description = "IBM 5161 Expansion Unit",
.type = CONFIG_BINARY,
.type = CONFIG_BINARY,
.default_int = 0
},
{ .name = "", .description = "", .type = CONFIG_END }

View File

@@ -262,6 +262,19 @@ machine_at_px286_init(const machine_t *model)
return ret;
}
static void
machine_at_ctat_common_init(const machine_t *model)
{
machine_at_common_init(model);
device_add(&cs8220_device);
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_at_device);
device_add(&keyboard_at_phoenix_device);
}
int
machine_at_dells200_init(const machine_t *model)
{
@@ -274,14 +287,24 @@ machine_at_dells200_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
machine_at_ctat_common_init(model);
device_add(&cs8220_device);
return ret;
}
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_at_device);
int
machine_at_tuliptc7_init(const machine_t *model)
{
int ret;
device_add(&keyboard_at_phoenix_device);
ret = bios_load_interleavedr("roms/machines/tuliptc7/tc7be.bin",
"roms/machines/tuliptc7/tc7bo.bin",
0x000f8000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_ctat_common_init(model);
return ret;
}

View File

@@ -413,7 +413,7 @@ machine_at_vect486vl_init(const machine_t *model) // has HDC problems
return ret;
if (gfxcard[0] == VID_INTERNAL)
device_add(&gd5428_onboard_device);
device_add(machine_get_vid_device(machine));
machine_at_common_init_ex(model, 2);
@@ -439,7 +439,7 @@ machine_at_d824_init(const machine_t *model)
return ret;
if (gfxcard[0] == VID_INTERNAL)
device_add(&gd5428_onboard_device);
device_add(machine_get_vid_device(machine));
machine_at_common_init_ex(model, 2);
@@ -457,6 +457,41 @@ machine_at_d824_init(const machine_t *model)
return ret;
}
int
machine_at_tuliptc38_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/tuliptc38/TULIP1.BIN",
0x000f0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
device_add(&vl82c486_device);
device_add(&tulip_jumper_device);
device_add(&vl82c113_device);
device_add(&ide_isa_device);
device_add(&fdc37c651_ide_device);
if (gfxcard[0] == VID_INTERNAL) {
bios_load_aux_linear("roms/machines/tuliptc38/VBIOS.BIN",
0x000c0000, 32768, 0);
device_add(machine_get_vid_device(machine));
} else for (uint16_t i = 0; i < 32768; i++)
rom[i] = mem_readb_phys(0x000c0000 + i);
mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000);
mem_mapping_set_exec(&bios_mapping, rom);
return ret;
}
int
machine_at_martin_init(const machine_t *model)
{
@@ -2197,18 +2232,66 @@ machine_at_ecs486_init(const machine_t *model)
return ret;
}
static const device_config_t hot433a_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "hot433a",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{ .name = "AMI", .internal_name = "hot433a", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/hot433/433AUS33.ROM", "" } },
{ .name = "Award (eSupport update)", .internal_name = "hot433a_award", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/hot433/2A4X5H21.BIN", "" } },
{ .files_no = 0 }
},
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t hot433a_device = {
.name = "Shuttle HOT-433A",
.internal_name = "hot433a_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = hot433a_config
};
int
machine_at_hot433a_init(const machine_t *model)
{
int ret;
int ret = 0;
const char* fn;
ret = bios_load_linear("roms/machines/hot433/433AUS33.ROM",
0x000e0000, 131072, 0);
/* No ROMs available */
if (!device_available(model->device))
return ret;
device_context(model->device);
int is_award = !strcmp(device_get_config_bios("bios"), "hot433a_award");
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;
machine_at_common_init(model);
machine_at_common_init_ex(model, 2);
if (is_award)
device_add(&amstrad_megapc_nvr_device);
else
device_add(&ami_1994_nvr_device);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x10, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
@@ -2220,9 +2303,46 @@ machine_at_hot433a_init(const machine_t *model)
device_add(&umc_hb4_device);
device_add(&umc_8886bf_device);
device_add(&um8669f_device);
if (is_award)
device_add(&um8663af_device);
else
device_add(&um8669f_device);
device_add(&winbond_flash_w29c010_device);
device_add(&keyboard_at_ami_device);
if (is_award)
device_add(&keyboard_ps2_ami_device);
else
device_add(&keyboard_at_ami_device);
pic_toggle_latch(is_award);
return ret;
}
int
machine_at_84xxuuda_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/84xxuuda/uud0520s.bin",
0x000e0000, 131072, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x10, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x12, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x03, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x04, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x05, PCI_CARD_NORMAL, 3, 4, 1, 2);
device_add(&umc_hb4_device);
device_add(&umc_8886bf_device);
device_add(&um8663bf_device);
device_add(&winbond_flash_w29c010_device);
device_add(&keyboard_ps2_ami_device);
return ret;
}

View File

@@ -80,6 +80,87 @@ machine_at_dellplato_init(const machine_t *model)
return ret;
}
int
machine_at_d842_init(const machine_t *model)
{
int ret = 0;
const char* fn;
/* 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_versions"), 0);
ret = bios_load_linear(fn, 0x000e0000, 131072, 0);
device_context_restore();
machine_at_common_init(model);
device_add(&ide_pci_2ch_device);
pci_init(PCI_CONFIG_TYPE_2 | PCI_NO_IRQ_STEERING);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x01, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); /* Onboard */
pci_register_slot(0x03, PCI_CARD_VIDEO, 4, 0, 0, 0); /* Onboard */
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); /* Slot 01 */
pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); /* Slot 02 */
device_add(&keyboard_ps2_pci_device);
device_add(&i430nx_device);
device_add(&sio_zb_device);
device_add(&fdc37c665_device);
device_add(&intel_flash_bxt_device);
return ret;
}
static const device_config_t d842_config[] = {
// clang-format off
{
.name = "bios_versions",
.description = "BIOS Versions",
.type = CONFIG_BIOS,
.default_string = "d842",
.default_int = 0,
.file_filter = "",
.spinner = { 0 }, /*W1*/
.bios = {
{ .name = "Version 1.03 Revision 1.03.842 (11/24/1994)", .internal_name = "d842", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/d842/d842.bin", "" } },
{ .name = "Version 4.04 Revision 1.05.842 (03/15/1996)", .internal_name = "d842_mar96", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/d842/d842_mar96.bin", "" } },
{ .name = "Version 4.04 Revision 1.06.842 (04/03/1998)", .internal_name = "d842_apr98", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/d842/d842_apr98.bin", "" } },
{ .name = "Version 4.04 Revision 1.07.842 (06/02/1998)", .internal_name = "d842_jun98", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/d842/d842_jun98.bin", "" } },
{ .name = "Version 1.03 Revision 1.09.842 (07/08/1996)", .internal_name = "d842_jul96", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/d842/d842_jul96.bin", "" } },
{ .name = "Version 1.03 Revision 1.10.842 (06/04/1998)", .internal_name = "d842_jun98_1", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/d842/d842_jun98_1.bin", "" } },
},
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t d842_device = {
.name = "Siemens-Nixdorf D842",
.internal_name = "d842",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = &d842_config[0]
};
int
machine_at_ambradp90_init(const machine_t *model)
{
@@ -394,6 +475,7 @@ machine_at_hawk_init(const machine_t *model)
return ret;
}
int
machine_at_pt2000_init(const machine_t *model)
{

View File

@@ -646,6 +646,7 @@ europc_boot(UNUSED(const device_t *info))
* (JS9) can be used to "move" it to 0x0350, to get it out of
* the way of other cards that need this range.
*/
sys->jim = device_get_config_hex16("js9");
io_sethandler(sys->jim, 16,
jim_read, NULL, NULL, jim_write, NULL, NULL, sys);
@@ -680,14 +681,14 @@ static const device_config_t europc_config[] = {
{
.name = "js9",
.description = "JS9 Jumper (JIM)",
.type = CONFIG_INT,
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0,
.default_int = 0x0250,
.file_filter = "",
.spinner = { 0 },
.selection = {
{ .description = "Disabled (250h)", .value = 0 },
{ .description = "Enabled (350h)", .value = 1 },
{ .description = "Disabled (250h)", .value = 0x0250 },
{ .description = "Enabled (350h)", .value = 0x0350 },
{ .description = "" }
},
},

View File

@@ -82,7 +82,6 @@ typedef struct pcjr_t {
int vc;
int dispon;
int con;
int coff;
int cursoron;
int blink;
int vsynctime;
@@ -1167,7 +1166,6 @@ vid_poll(void *priv)
}
if (pcjr->sc == (pcjr->crtc[11] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[11] & 31) >> 1))) {
pcjr->con = 0;
pcjr->coff = 1;
}
if (pcjr->vadj) {
pcjr->sc++;

View File

@@ -92,7 +92,6 @@ typedef struct t1kvid_t {
int vc;
int dispon;
int con;
int coff;
int cursoron;
int blink;
int fullchange;
@@ -1212,7 +1211,6 @@ vid_poll(void *priv)
}
if (vid->sc == (vid->crtc[11] & 31) || ((vid->crtc[8] & 3) == 3 && vid->sc == ((vid->crtc[11] & 31) >> 1))) {
vid->con = 0;
vid->coff = 1;
}
if (vid->vadj) {
vid->sc++;

View File

@@ -85,7 +85,7 @@ static const device_config_t ibmpc_config[] = {
{ .name = "Supersoft Diagnostics", .internal_name = "diag_supersoft", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/Supersoft_PCXT_8KB.bin", "" } },
{ .name = "Ruud's Diagnostic Rom", .internal_name = "diag_ruuds", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.3_8kb.bin", "" } },
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.4_8kb.bin", "" } },
{ .name = "XT RAM Test", .internal_name = "diag_xtramtest", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/xtramtest_8k.bin", "" } },
{ .files_no = 0 }
@@ -195,7 +195,7 @@ static const device_config_t ibmpc82_config[] = {
{ .name = "Supersoft Diagnostics", .internal_name = "diag_supersoft", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/Supersoft_PCXT_8KB.bin", "" } },
{ .name = "Ruud's Diagnostic Rom", .internal_name = "diag_ruuds", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.3_8kb.bin", "" } },
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.4_8kb.bin", "" } },
{ .name = "XT RAM Test", .internal_name = "diag_xtramtest", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/diagnostic/xtramtest_8k.bin", "" } },
{ .files_no = 0 }
@@ -282,48 +282,103 @@ machine_pc82_init(const machine_t *model)
static const device_config_t ibmxt_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ibm5160_1501512_5000027",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{ .name = "1501512 (11/08/82)", .internal_name = "ibm5160_1501512_5000027", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmxt/BIOS_5160_08NOV82_U18_1501512.BIN", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" } },
{ .name = "1501512 (11/08/82) (Alt)", .internal_name = "ibm5160_1501512_6359116", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmxt/BIOS_5160_08NOV82_U18_1501512.BIN", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_6359116.BIN", "" } },
{ .name = "5000026 (08/16/82)", .internal_name = "ibm5160_5000026_5000027", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmxt/BIOS_5160_16AUG82_U18_5000026.BIN", "roms/machines/ibmxt/BIOS_5160_16AUG82_U19_5000027.BIN", "" } },
#if 0
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.bios = {
{
.name = "1501512 (11/08/82)",
.internal_name = "ibm5160_1501512_5000027",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmxt/BIOS_5160_08NOV82_U18_1501512.BIN", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" }
},
{
.name = "1501512 (11/08/82) (Alt)",
.internal_name = "ibm5160_1501512_6359116",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmxt/BIOS_5160_08NOV82_U18_1501512.BIN", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_6359116.BIN", "" }
},
{
.name = "5000026 (08/16/82)",
.internal_name = "ibm5160_5000026_5000027",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmxt/BIOS_5160_16AUG82_U18_5000026.BIN", "roms/machines/ibmxt/BIOS_5160_16AUG82_U19_5000027.BIN", "" }
},
// GlaBIOS for IBM XT
{ .name = "GlaBIOS 0.2.5 (8088)", .internal_name = "glabios_025_8088", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/glabios/GLABIOS_0.2.5_8X.ROM", "" } },
{ .name = "GlaBIOS 0.2.5 (V20)", .internal_name = "glabios_025_v20", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/glabios/GLABIOS_0.2.5_VX.ROM", "" } },
{
.name = "GlaBIOS 0.2.5 (8088)",
.internal_name = "glabios_025_8088",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 1,
.size = 40960,
.files = { "roms/machines/glabios/GLABIOS_0.2.5_8X.ROM", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" }
},
{
.name = "GlaBIOS 0.2.5 (V20)",
.internal_name = "glabios_025_v20",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 1,
.size = 40960,
.files = { "roms/machines/glabios/GLABIOS_0.2.5_VX.ROM", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" }
},
// The following are Diagnostic ROMs.
{ .name = "Supersoft Diagnostics", .internal_name = "diag_supersoft", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/diagnostic/Supersoft_PCXT_8KB.bin", "" } },
{ .name = "Ruud's Diagnostic Rom", .internal_name = "diag_ruuds", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.3_8kb.bin", "" } },
{ .name = "XT RAM Test", .internal_name = "diag_xtramtest", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/diagnostic/xtramtest_8k.bin", "" } },
#endif
{
.name = "Supersoft Diagnostics",
.internal_name = "diag_supersoft",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/Supersoft_PCXT_32KB.bin", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" }
},
{
.name = "Ruud's Diagnostic Rom",
.internal_name = "diag_ruuds",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.4_32kb.bin", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" }
},
{
.name = "XT RAM Test",
.internal_name = "diag_xtramtest",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/xtramtest_32k.bin", "roms/machines/ibmxt/BIOS_5160_08NOV82_U19_5000027.BIN", "" }
},
{ .files_no = 0 }
},
},
{
.name = "enable_5161",
.name = "enable_5161",
.description = "IBM 5161 Expansion Unit",
.type = CONFIG_BINARY,
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "enable_basic",
.name = "enable_basic",
.description = "IBM Cassette Basic",
.type = CONFIG_BINARY,
.type = CONFIG_BINARY,
.default_int = 1
},
{ .name = "", .description = "", .type = CONFIG_END }
@@ -351,6 +406,8 @@ machine_xt_init(const machine_t *model)
uint8_t enable_5161;
uint8_t enable_basic;
const char *fn;
uint16_t offset = 0;
uint32_t local = 0;
/* No ROMs available. */
if (!device_available(model->device))
@@ -360,11 +417,17 @@ machine_xt_init(const machine_t *model)
enable_5161 = machine_get_config_int("enable_5161");
enable_basic = machine_get_config_int("enable_basic");
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000fe000, 65536, 0x6000);
local = device_get_bios_local(model->device, device_get_config_bios("bios"));
if (local == 0) // Offset for stock roms
offset = 0x6000;
ret = bios_load_linear(fn, 0x000fe000, 65536, offset);
if (enable_basic && ret) {
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
(void) bios_load_aux_linear(fn, 0x000f8000, 24576, 0);
if (local == 0) { // needed for stock roms
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
(void) bios_load_aux_linear(fn, 0x000f8000, 24576, 0);
}
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 1);
/* On the real machine, the BASIC is repeated. */
(void) bios_load_aux_linear(fn, 0x000f0000, 8192, 0);
@@ -408,42 +471,98 @@ machine_genxt_init(const machine_t *model)
static const device_config_t ibmxt86_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ibm5160_050986",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{ .name = "1501512 (05/09/86)", .internal_name = "ibm5160_050986", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmxt86/BIOS_5160_09MAY86_U18_59X7268_62X0890_27256_F800.BIN", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" } },
{ .name = "5000026 (01/10/86)", .internal_name = "ibm5160_011086", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmxt86/BIOS_5160_10JAN86_U18_62X0851_27256_F800.BIN", "roms/machines/ibmxt86/BIOS_5160_10JAN86_U19_62X0854_27256_F000.BIN", "" } },
{ .name = "1501512 (01/10/86) (Alt)", .internal_name = "ibm5160_011086_alt", .bios_type = BIOS_NORMAL,
.files_no = 2, .local = 0, .size = 65536, .files = { "roms/machines/ibmxt86/BIOS_5160_10JAN86_U18_62X0852_27256_F800.BIN", "roms/machines/ibmxt86/BIOS_5160_10JAN86_U19_62X0853_27256_F000.BIN", "" } },
#if 0
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.bios = {
{
.name = "1501512 (05/09/86)",
.internal_name = "ibm5160_050986",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmxt86/BIOS_5160_09MAY86_U18_59X7268_62X0890_27256_F800.BIN", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" }
},
{
.name = "5000026 (01/10/86)",
.internal_name = "ibm5160_011086",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmxt86/BIOS_5160_10JAN86_U18_62X0851_27256_F800.BIN", "roms/machines/ibmxt86/BIOS_5160_10JAN86_U19_62X0854_27256_F000.BIN", "" }
},
{
.name = "1501512 (01/10/86) (Alt)",
.internal_name = "ibm5160_011086_alt",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 0,
.size = 65536,
.files = { "roms/machines/ibmxt86/BIOS_5160_10JAN86_U18_62X0852_27256_F800.BIN", "roms/machines/ibmxt86/BIOS_5160_10JAN86_U19_62X0853_27256_F000.BIN", "" }
},
// GlaBIOS for IBM XT
{ .name = "GlaBIOS 0.2.5 (8088)", .internal_name = "glabios_025_8088", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/glabios/GLABIOS_0.2.5_8X.ROM", "" } },
{ .name = "GlaBIOS 0.2.5 (V20)", .internal_name = "glabios_025_v20", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 40960, .files = { "roms/machines/glabios/GLABIOS_0.2.5_VX.ROM", "" } },
{
.name = "GlaBIOS 0.2.5 (8088)",
.internal_name = "glabios_025_8088",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 1,
.size = 65536,
.files = { "roms/machines/glabios/GLABIOS_0.2.5_8X.ROM", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" }
},
{
.name = "GlaBIOS 0.2.5 (V20)",
.internal_name = "glabios_025_v20",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 1,
.size = 65536,
.files = { "roms/machines/glabios/GLABIOS_0.2.5_VX.ROM", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" }
},
// The following are Diagnostic ROMs.
{ .name = "Supersoft Diagnostics", .internal_name = "diag_supersoft", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/diagnostic/Supersoft_PCXT_8KB.bin", "" } },
{ .name = "Ruud's Diagnostic Rom", .internal_name = "diag_ruuds", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.3_8kb.bin", "" } },
{ .name = "XT RAM Test", .internal_name = "diag_xtramtest", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/diagnostic/xtramtest_8k.bin", "" } },
#endif
{
.name = "Supersoft Diagnostics",
.internal_name = "diag_supersoft",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/Supersoft_PCXT_32KB.bin", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" }
},
{
.name = "Ruud's Diagnostic Rom",
.internal_name = "diag_ruuds",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/ruuds_diagnostic_rom_v5.4_32kb.bin", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" }
},
{
.name = "XT RAM Test",
.internal_name = "diag_xtramtest",
.bios_type = BIOS_NORMAL,
.files_no = 2,
.local = 2,
.size = 65536,
.files = { "roms/machines/diagnostic/xtramtest_32k.bin", "roms/machines/ibmxt86/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", "" }
},
{ .files_no = 0 }
},
},
{
.name = "enable_5161",
.name = "enable_5161",
.description = "IBM 5161 Expansion Unit",
.type = CONFIG_BINARY,
.type = CONFIG_BINARY,
.default_int = 1
},
{ .name = "", .description = "", .type = CONFIG_END }
@@ -470,6 +589,8 @@ machine_xt86_init(const machine_t *model)
int ret = 0;
uint8_t enable_5161;
const char *fn;
uint16_t offset = 0;
uint32_t local = 0;
/* No ROMs available. */
if (!device_available(model->device))
@@ -478,11 +599,17 @@ machine_xt86_init(const machine_t *model)
device_context(model->device);
enable_5161 = machine_get_config_int("enable_5161");
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000fe000, 65536, 0x6000);
local = device_get_bios_local(model->device, device_get_config_bios("bios"));
if (local == 0) // Offset for stock roms
offset = 0x6000;
ret = bios_load_linear(fn, 0x000fe000, 65536, offset);
if (ret) {
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
(void) bios_load_aux_linear(fn, 0x000f8000, 24576, 0);
if (local == 0) { // needed for stock roms
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
(void) bios_load_aux_linear(fn, 0x000f8000, 24576, 0);
}
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 1);
(void) bios_load_aux_linear(fn, 0x000f0000, 32768, 0);
}

View File

@@ -39,6 +39,7 @@
#include <86box/video.h>
#include <86box/machine.h>
#include <86box/isamem.h>
#include <86box/isarom.h>
#include <86box/pci.h>
#include <86box/plat_unused.h>
@@ -111,6 +112,11 @@ machine_init_ex(int m)
/* Reset any ISA memory cards. */
isamem_reset();
#if 0
/* Reset any ISA ROM cards. */
isarom_reset();
#endif
/* Reset the fast off stuff. */
cpu_fast_off_reset();

View File

@@ -66,8 +66,10 @@ extern const device_t vendex_device;
extern const device_t c5sbm2_device;
extern const device_t sb486pv_device;
extern const device_t ap5s_device;
extern const device_t d842_device;
extern const device_t d943_device;
extern const device_t dells333sl_device;
extern const device_t hot433a_device;
const machine_filter_t machine_types[] = {
{ "None", MACHINE_TYPE_NONE },
@@ -2377,7 +2379,7 @@ const machine_t machines[] = {
.net_device = NULL
},
{
.name = "[8086] Olivetti M21/24/24SP",
.name = "[8086] Olivetti M21/24/24SP/AT&T PC 6300",
.internal_name = "m24",
.type = MACHINE_TYPE_8086,
.chipset = MACHINE_CHIPSET_PROPRIETARY,
@@ -2417,7 +2419,7 @@ const machine_t machines[] = {
},
/* Has Olivetti KBC firmware. */
{
.name = "[8086] Olivetti M240",
.name = "[8086] Olivetti M240/AT&T PC 6300 WGS",
.internal_name = "m240",
.type = MACHINE_TYPE_8086,
.chipset = MACHINE_CHIPSET_PROPRIETARY,
@@ -3414,6 +3416,47 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* No proper pictures of the KBC exist, though it seems to have the IBM AT KBC
firmware. */
{
.name = "[C&T PC/AT] Tulip AT Compact",
.internal_name = "tuliptc7",
.type = MACHINE_TYPE_286,
.chipset = MACHINE_CHIPSET_CT_AT,
.init = machine_at_tuliptc7_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_286,
.block = CPU_BLOCK_NONE,
.min_bus = 6000000,
.max_bus = 12000000,
.min_voltage = 0,
.max_voltage = 0,
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_AT,
.flags = MACHINE_FLAGS_NONE,
.ram = {
.min = 640,
.max = 16384,
.step = 128
},
.nvrmask = 127,
.kbc_device = NULL,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = NULL,
.net_device = NULL
},
/* Has Quadtel KBC firmware. */
{
.name = "[GC103] Quadtel 286 clone",
@@ -6604,6 +6647,46 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* Has a VLSI VL82C113A SCAMP Combination I/O which holds the KBC. */
{
.name = "[VLSI 82C486] Tulip 486 DC/DT",
.internal_name = "tuliptc38",
.type = MACHINE_TYPE_486,
.chipset = MACHINE_CHIPSET_VLSI_VL82C486,
.init = machine_at_tuliptc38_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET1,
.block = CPU_BLOCK_NONE,
.min_bus = 0,
.max_bus = 0,
.min_voltage = 0,
.max_voltage = 0,
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_AT,
.flags = MACHINE_IDE | MACHINE_VIDEO | MACHINE_APM,
.ram = {
.min = 2048,
.max = 32768,
.step = 2048
},
.nvrmask = 127,
.kbc_device = NULL,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.fdc_device = NULL,
.sio_device = NULL, /*Has SIO (sorta): VLSI VL82C113A SCAMP Combination I/O*/
.vid_device = &gd5426_onboard_device,
.snd_device = NULL,
.net_device = NULL
},
/* Has IBM PS/2 Type 1 KBC firmware. */
{
.name = "[MCA] IBM PS/2 model 70 (type 4)",
@@ -9035,6 +9118,47 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* This has the UMC 88xx on-chip KBC. All the copies of the BIOS string I can find, end in
in -H, so the UMC on-chip KBC likely emulates the AMI 'H' KBC firmware. */
{
.name = "[UMC 8881] Biostar MB-84xxUUD-A",
.internal_name = "84xxuuda",
.type = MACHINE_TYPE_486_S3_PCI,
.chipset = MACHINE_CHIPSET_UMC_UM8881,
.init = machine_at_84xxuuda_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET3,
.block = CPU_BLOCK_NONE,
.min_bus = 0,
.max_bus = 0,
.min_voltage = 0,
.max_voltage = 0,
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_PS2_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_APM,
.ram = {
.min = 1024,
.max = 131072,
.step = 1024
},
.nvrmask = 255,
.kbc_device = NULL,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = NULL,
.net_device = NULL
},
/* This has an AMIKey-2, which is an updated version of type 'H'. */
{
.name = "[UMC 8881] ECS Elite UM8810P-AIO",
@@ -9258,7 +9382,7 @@ const machine_t machines[] = {
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_PCI,
.bus_flags = MACHINE_PS2_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_APM,
.ram = {
.min = 1024,
@@ -9270,7 +9394,7 @@ const machine_t machines[] = {
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.device = &hot433a_device,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
@@ -10346,6 +10470,46 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
{
.name = "[i430NX] Siemens-Nixdorf D842",
.internal_name = "d842",
.type = MACHINE_TYPE_SOCKET5,
.chipset = MACHINE_CHIPSET_INTEL_430NX,
.init = machine_at_d842_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET5_7,
.block = CPU_BLOCK_NONE,
.min_bus = 50000000,
.max_bus = 66666667,
.min_voltage = 3380,
.max_voltage = 3520,
.min_multi = 1.5,
.max_multi = 2.0
},
.bus_flags = MACHINE_PS2_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_APM,
.ram = {
.min = 2048,
.max = 131072,
.step = 2048
},
.nvrmask = 127,
.kbc_device = NULL,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = &d842_device,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = NULL,
.net_device = NULL
},
/* This has the Phoenix MultiKey KBC firmware.
This is basically an Intel Premiere/PCI II with a fancier POST screen. */
{
@@ -11814,7 +11978,7 @@ const machine_t machines[] = {
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &gd5436_onboard_pci_device,
.snd_device = &sb_vibra16s_onboard_device,
.snd_device = &sb_vibra16c_onboard_device,
.net_device = NULL
},

View File

@@ -97,7 +97,8 @@ rom_check(const char *fn)
else {
fp = fopen(fn, "rb");
ret = (fp != NULL);
fclose(fp);
if (fp != NULL)
fclose(fp);
}
return ret;
@@ -134,6 +135,9 @@ rom_fopen(const char *fn, char *mode)
char temp[1024];
FILE *fp = NULL;
if ((fn == NULL) || (mode == NULL))
return NULL;
if (strstr(fn, "roms/") == fn) {
/* Relative path */
for (rom_path_t *rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) {
@@ -320,11 +324,12 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t
}
for (int i = 0; i < (sz >> 1); i++) {
if (fread(ptr + (addr + (i << 1) + 1), 1, 1, fp) != 1)
fatal("rom_load_linear(): Error reading od data\n");
fatal("rom_load_linear(): Error reading odd data\n");
}
}
(void) fclose(fp);
if (fp != NULL)
(void) fclose(fp);
return 1;
}
@@ -353,7 +358,8 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
fatal("rom_load_linear(): Error reading data\n");
}
(void) fclose(fp);
if (fp != NULL)
(void) fclose(fp);
return 1;
}
@@ -397,7 +403,8 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t
}
}
(void) fclose(fp);
if (fp != NULL)
(void) fclose(fp);
return 1;
}
@@ -438,8 +445,10 @@ rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, in
}
}
(void) fclose(fph);
(void) fclose(fpl);
if (fph != NULL)
(void) fclose(fph);
if (fpl != NULL)
(void) fclose(fpl);
return 1;
}

View File

@@ -291,8 +291,12 @@ net_slirp_get_revents(int idx, void *opaque)
WSA_TO_POLL(FD_WRITE, SLIRP_POLL_OUT);
WSA_TO_POLL(FD_CONNECT, SLIRP_POLL_OUT);
WSA_TO_POLL(FD_OOB, SLIRP_POLL_PRI);
WSA_TO_POLL(FD_CLOSE, SLIRP_POLL_IN);
WSA_TO_POLL(FD_CLOSE, SLIRP_POLL_HUP);
if (ret == 0)
ret |= SLIRP_POLL_IN;
return ret;
}
#else

View File

@@ -638,6 +638,25 @@ pic_reset_hard(void)
}
}
void
pic_toggle_latch(int is_ps2)
{
pic_kbd_latch(0x00);
pic_mouse_latch(0x00);
/* Explicitly reset the latches. */
kbd_latch = mouse_latch = 0;
latched_irqs = 0x0000;
/* The situation is as follows: There is a giant mess when it comes to these latches on real hardware,
to the point that there's even boards with board-level latched that get used in place of the latches
on the chipset, therefore, I'm just doing this here for the sake of simplicity. */
if (is_ps2) {
pic_kbd_latch(0x01);
pic_mouse_latch(0x01);
}
}
void
pic_init(void)
{

View File

@@ -2053,6 +2053,7 @@ escp_close(void *priv)
free(dev->page);
}
FT_Done_Face(dev->fontface);
free(dev);
}

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1833,7 +1833,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -1834,7 +1834,7 @@ msgid "2 MB"
msgstr "2 MB"
msgid "8 MB"
msgstr " 8 MB"
msgstr "8 MB"
msgid "28 MB"
msgstr "28 MB"

View File

@@ -2194,4 +2194,13 @@ msgid "Toggle pause"
msgstr "Переключить паузу"
msgid "Toggle mute"
msgstr "Переключить беззвучный режим"
msgstr "Переключить беззвучный режим"
msgid "Text files"
msgstr "Текстовые файлы"
msgid "ROM files"
msgstr "Файлы ПЗУ"
msgid "SoundFont files"
msgstr "Файлы SoundFont"

View File

@@ -31,6 +31,7 @@
#include <QLabel>
#include <QDir>
#include <QSettings>
#include <QStringBuilder>
extern "C" {
#include <86box/86box.h>
@@ -45,6 +46,7 @@ extern "C" {
#include "qt_filefield.hpp"
#include "qt_models_common.hpp"
#include "qt_util.hpp"
#ifdef Q_OS_LINUX
# include <sys/stat.h>
# include <sys/sysmacros.h>
@@ -276,11 +278,25 @@ DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep)
}
case CONFIG_FNAME:
{
auto *fileField = new FileField();
auto *fileField = new FileField(this);
fileField->setObjectName(config->name);
fileField->setFileName(selected);
fileField->setFilter(QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter,
"|"))));
/* Get the actually used part of the filter */
QString filter = QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter, "|")));
/* Extract the description and the extension list */
QRegularExpressionMatch match = QRegularExpression("(.+) \\((.+)\\)$").match(filter);
QString description = match.captured(1);
QString extensions = match.captured(2);
QStringList extensionList;
/* Split the extension list up and strip the filename globs */
QRegularExpression re("\\*\\.(.*)");
int i = 0;
while (extensions.section(' ', i, i) != "") {
QString extension = re.match(extensions.section(' ', i, i)).captured(1);
extensionList.append(extension);
i++;
}
fileField->setFilter(tr(description.toUtf8().constData()) % util::DlgFilter(extensionList) % tr("All files") % util::DlgFilter({ "*" }, true));
this->ui->formLayout->addRow(tr(config->description), fileField);
break;
}
@@ -388,6 +404,7 @@ DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *se
}
case CONFIG_MIDI_OUT:
case CONFIG_MIDI_IN:
case CONFIG_INT:
case CONFIG_SELECTION:
{
auto *cbox = dc.findChild<QComboBox *>(config->name);

View File

@@ -104,22 +104,22 @@ glsl_detect_bom(const char *fn)
static char *load_file(const char *fn) {
int bom = glsl_detect_bom(fn);
FILE *f = plat_fopen(fn, "rb");
if (!f)
FILE *fp = plat_fopen(fn, "rb");
if (!fp)
return 0;
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
if (bom) {
fsize -= 3;
fseek(f, 3, SEEK_SET);
fseek(fp, 3, SEEK_SET);
}
char *data = (char*)malloc(fsize + 1);
fread(data, fsize, 1, f);
fclose(f);
(void) fread(data, fsize, 1, fp);
fclose(fp);
data[fsize] = 0;

View File

@@ -214,7 +214,7 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
(GetForegroundWindow() == ((HWND) secondaryRenderer->winId())));
}
bool skip = ((nCode < 0) || (nCode != HC_ACTION) || !is_over_window);
bool skip = ((nCode < 0) || (nCode != HC_ACTION) || !is_over_window || (kbd_req_capture && !mouse_capture));
if (skip)
return CallNextHookEx(NULL, nCode, wParam, lParam);

View File

@@ -51,22 +51,29 @@ SettingsDisplay::~SettingsDisplay()
void
SettingsDisplay::save()
{
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
// TODO
#if 0
for (uint8_t i = 0; i < GFXCARD_MAX; ++i) {
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxVideo%1").arg(i + 1));
gfxcard[i] = cbox->currentData().toInt();
}
#else
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt();
gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt();
#endif
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0;
da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0;
}
void
SettingsDisplay::onCurrentMachineChanged(int machineId)
{
// win_settings_video_proc, WM_INITDIALOG
this->machineId = machineId;
this->machineId = machineId;
auto curVideoCard = videoCard[0];
auto *model = ui->comboBoxVideo->model();
@@ -98,25 +105,26 @@ SettingsDisplay::onCurrentMachineChanged(int machineId)
}
model->removeRows(0, removeRows);
// TODO
if (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0) {
ui->comboBoxVideo->setEnabled(false);
ui->comboBoxVideoSecondary->setEnabled(false);
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
selectedRow = 1;
} else {
ui->comboBoxVideo->setEnabled(true);
ui->comboBoxVideoSecondary->setEnabled(true);
ui->pushButtonConfigureSecondary->setEnabled(true);
ui->pushButtonConfigureVideoSecondary->setEnabled(true);
}
ui->comboBoxVideo->setCurrentIndex(selectedRow);
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
if (gfxcard[i] == 0)
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
}
void
SettingsDisplay::on_pushButtonConfigure_clicked()
SettingsDisplay::on_pushButtonConfigureVideo_clicked()
{
int videoCard = ui->comboBoxVideo->currentData().toInt();
auto *device = video_card_getdevice(videoCard);
@@ -160,17 +168,17 @@ SettingsDisplay::on_pushButtonConfigureDa2_clicked()
void
SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
static QRegularExpression voodooRegex("3dfx|voodoo|banshee", QRegularExpression::CaseInsensitiveOption);
static QRegularExpression voodooRegex("3dfx|voodoo|banshee|raven", QRegularExpression::CaseInsensitiveOption);
auto curVideoCard_2 = videoCard[1];
videoCard[0] = ui->comboBoxVideo->currentData().toInt();
if (videoCard[0] == VID_INTERNAL)
ui->pushButtonConfigure->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) &&
device_has_config(machine_get_vid_device(machineId)));
ui->pushButtonConfigureVideo->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) &&
device_has_config(machine_get_vid_device(machineId)));
else
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0);
ui->pushButtonConfigureVideo->setEnabled(video_card_has_config(videoCard[0]) > 0);
bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0;
ui->pushButtonConfigureVoodoo->setEnabled(machineHasPci && ui->checkBoxVoodoo->isChecked());
@@ -233,7 +241,7 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
if ((videoCard[1] == 0) || (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0)) {
ui->comboBoxVideoSecondary->setCurrentIndex(0);
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
}
// Is the currently selected video card a voodoo?
@@ -287,15 +295,15 @@ void
SettingsDisplay::on_comboBoxVideoSecondary_currentIndexChanged(int index)
{
if (index < 0) {
ui->pushButtonConfigureSecondary->setEnabled(false);
ui->pushButtonConfigureVideoSecondary->setEnabled(false);
return;
}
videoCard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
ui->pushButtonConfigureSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0);
ui->pushButtonConfigureVideoSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0);
}
void
SettingsDisplay::on_pushButtonConfigureSecondary_clicked()
SettingsDisplay::on_pushButtonConfigureVideoSecondary_clicked()
{
auto *device = video_card_getdevice(ui->comboBoxVideoSecondary->currentData().toInt());
DeviceConfig::ConfigureDevice(device);

View File

@@ -22,22 +22,23 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureSecondary_clicked();
private slots:
void on_comboBoxVideoSecondary_currentIndexChanged(int index);
private slots:
void on_checkBoxVoodoo_stateChanged(int state);
void on_checkBox8514_stateChanged(int state);
void on_checkBoxXga_stateChanged(int state);
void on_checkBoxDa2_stateChanged(int state);
void on_comboBoxVideo_currentIndexChanged(int index);
void on_pushButtonConfigureVideo_clicked();
void on_comboBoxVideoSecondary_currentIndexChanged(int index);
void on_pushButtonConfigureVideoSecondary_clicked();
void on_checkBoxVoodoo_stateChanged(int state);
void on_pushButtonConfigureVoodoo_clicked();
void on_checkBox8514_stateChanged(int state);
void on_pushButtonConfigure8514_clicked();
void on_checkBoxXga_stateChanged(int state);
void on_pushButtonConfigureXga_clicked();
void on_checkBoxDa2_stateChanged(int state);
void on_pushButtonConfigureDa2_clicked();
void on_pushButtonConfigure_clicked();
private:
Ui::SettingsDisplay *ui;

View File

@@ -26,28 +26,8 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigure">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxXga">
<property name="text">
<string>XGA Graphics</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -72,15 +52,21 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonConfigureVoodoo">
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -92,10 +78,23 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox8514">
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureVideoSecondary">
<property name="text">
<string>IBM 8514/A Graphics</string>
<string>Configure</string>
</property>
</widget>
</item>
@@ -106,6 +105,20 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonConfigureVoodoo">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox8514">
<property name="text">
<string>IBM 8514/A Graphics</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonConfigure8514">
<property name="text">
@@ -113,6 +126,13 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxXga">
<property name="text">
<string>XGA Graphics</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonConfigureXga">
<property name="text">
@@ -134,26 +154,6 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureSecondary">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">

View File

@@ -359,9 +359,9 @@ SettingsFloppyCDROM::on_comboBoxSpeed_activated(int index)
void
SettingsFloppyCDROM::on_comboBoxBus_activated(int)
{
auto i = ui->tableViewCDROM->selectionModel()->currentIndex().siblingAtColumn(0);
auto i = ui->tableViewCDROM->selectionModel()->currentIndex().siblingAtColumn(0);
uint8_t bus_type = ui->comboBoxBus->currentData().toUInt();
int cdromIdx = ui->tableViewCDROM->selectionModel()->currentIndex().data().toInt();
int cdromIdx = ui->tableViewCDROM->selectionModel()->currentIndex().data().toInt();
Harddrives::busTrackClass->device_track(0, DEV_CDROM, ui->tableViewCDROM->model()->data(i,
Qt::UserRole).toInt(), ui->tableViewCDROM->model()->data(i,
@@ -384,9 +384,9 @@ SettingsFloppyCDROM::on_comboBoxBus_activated(int)
auto *modelType = ui->comboBoxCDROMType->model();
int removeRows = modelType->rowCount();
uint32_t j = 0;
int selectedTypeRow = 0;
int eligibleRows = 0;
uint32_t j = 0;
int selectedTypeRow = 0;
int eligibleRows = 0;
while (cdrom_drive_types[j].bus_type != BUS_TYPE_NONE) {
if (((bus_type == CDROM_BUS_ATAPI) || (bus_type == CDROM_BUS_SCSI)) &&
((cdrom_drive_types[j].bus_type == bus_type) ||
@@ -414,11 +414,10 @@ void
SettingsFloppyCDROM::enableCurrentlySelectedChannel()
{
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxChannel->model());
const auto index = ui->comboBoxChannel->currentIndex();
auto *item = item_model->item(index);
if(item) {
const auto index = ui->comboBoxChannel->currentIndex();
auto *item = item_model->item(index);
if(item)
item->setEnabled(true);
}
}
void
@@ -449,9 +448,9 @@ SettingsFloppyCDROM::on_comboBoxCDROMType_activated(int)
ui->tableViewCDROM->resizeColumnsToContents();
ui->tableViewCDROM->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
int speed = cdrom_get_speed(type);
int speed = cdrom_get_speed(type);
if (speed == -1) {
speed = ui->comboBoxSpeed->currentData().toUInt();
speed = ui->comboBoxSpeed->currentData().toUInt();
ui->comboBoxSpeed->setEnabled(true);
} else
ui->comboBoxSpeed->setEnabled(false);

View File

@@ -19,17 +19,20 @@ public:
signals:
void cdromChannelChanged();
private slots:
void on_comboBoxCDROMType_activated(int index);
void on_comboBoxChannel_activated(int index);
void on_comboBoxBus_activated(int index);
void on_comboBoxSpeed_activated(int index);
void on_comboBoxBus_currentIndexChanged(int index);
void on_comboBoxFloppyType_activated(int index);
void on_checkBoxCheckBPB_stateChanged(int arg1);
void on_checkBoxTurboTimings_stateChanged(int arg1);
void onFloppyRowChanged(const QModelIndex &current);
void on_comboBoxFloppyType_activated(int index);
void on_checkBoxTurboTimings_stateChanged(int arg1);
void on_checkBoxCheckBPB_stateChanged(int arg1);
void onCDROMRowChanged(const QModelIndex &current);
void on_comboBoxBus_activated(int index);
void on_comboBoxBus_currentIndexChanged(int index);
void on_comboBoxChannel_activated(int index);
void on_comboBoxSpeed_activated(int index);
void on_comboBoxCDROMType_activated(int index);
private:
Ui::SettingsFloppyCDROM *ui;

View File

@@ -27,7 +27,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelFloppy">
<property name="text">
<string>Floppy drives:</string>
</property>
@@ -68,7 +68,7 @@
<widget class="QWidget" name="floppyControls" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelFloppyType">
<property name="text">
<string>Type:</string>
</property>
@@ -99,7 +99,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelCDROM">
<property name="text">
<string>CD-ROM drives:</string>
</property>
@@ -140,33 +140,12 @@
<widget class="QWidget" name="cdControls" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelBus">
<property name="text">
<string>Bus:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxBus">
<property name="maxVisibleItems">
@@ -174,6 +153,13 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="labelChannel">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="comboBoxChannel">
<property name="maxVisibleItems">
@@ -181,6 +167,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSpeed">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxSpeed">
<property name="maxVisibleItems">
@@ -188,6 +181,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelCDROMType">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxCDROMType">
<property name="maxVisibleItems">

View File

@@ -49,9 +49,8 @@ static void
normalize_hd_list()
{
hard_disk_t ihdd[HDD_NUM];
int j;
int j = 0;
j = 0;
memset(ihdd, 0x00, HDD_NUM * sizeof(hard_disk_t));
for (uint8_t i = 0; i < HDD_NUM; i++) {
@@ -75,8 +74,8 @@ static void
addRow(QAbstractItemModel *model, hard_disk_t *hd)
{
const QString userPath = usr_path;
int row = model->rowCount();
model->insertRow(row);
QString busName = Harddrives::BusChannelName(hd->bus_type, hd->channel);
@@ -88,11 +87,11 @@ addRow(QAbstractItemModel *model, hard_disk_t *hd)
model->setData(model->index(row, ColumnBus), hd->channel, DataBusChannelPrevious);
Harddrives::busTrackClass->device_track(1, DEV_HDD, hd->bus_type, hd->channel);
QString fileName = hd->fn;
if (fileName.startsWith(userPath, Qt::CaseInsensitive)) {
if (fileName.startsWith(userPath, Qt::CaseInsensitive))
model->setData(model->index(row, ColumnFilename), fileName.mid(userPath.size()));
} else {
else
model->setData(model->index(row, ColumnFilename), fileName);
}
model->setData(model->index(row, ColumnFilename), fileName, Qt::UserRole);
model->setData(model->index(row, ColumnCylinders), hd->tracks);
@@ -120,9 +119,8 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent)
ui->tableView->setModel(model);
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type > 0) {
if (hdd[i].bus_type > 0)
addRow(model, &hdd[i]);
}
}
if (model->rowCount() == HDD_NUM) {
ui->pushButtonNew->setEnabled(false);
@@ -176,9 +174,8 @@ void SettingsHarddisks::reloadBusChannels() {
void
SettingsHarddisks::on_comboBoxBus_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
buschangeinprogress = true;
auto idx = ui->tableView->selectionModel()->currentIndex();
@@ -226,9 +223,8 @@ SettingsHarddisks::on_comboBoxBus_currentIndexChanged(int index)
void
SettingsHarddisks::on_comboBoxChannel_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
auto idx = ui->tableView->selectionModel()->currentIndex();
if (idx.isValid()) {
@@ -250,17 +246,15 @@ SettingsHarddisks::enableCurrentlySelectedChannel()
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxChannel->model());
const auto index = ui->comboBoxChannel->currentIndex();
auto *item = item_model->item(index);
if(item) {
if(item)
item->setEnabled(true);
}
}
void
SettingsHarddisks::on_comboBoxSpeed_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
auto idx = ui->tableView->selectionModel()->currentIndex();
if (idx.isValid()) {
@@ -288,20 +282,19 @@ SettingsHarddisks::onTableRowChanged(const QModelIndex &current)
auto *model = ui->comboBoxBus->model();
auto match = model->match(model->index(0, 0), Qt::UserRole, bus);
if (!match.isEmpty()) {
if (!match.isEmpty())
ui->comboBoxBus->setCurrentIndex(match.first().row());
}
model = ui->comboBoxChannel->model();
match = model->match(model->index(0, 0), Qt::UserRole, busChannel);
if (!match.isEmpty()) {
if (!match.isEmpty())
ui->comboBoxChannel->setCurrentIndex(match.first().row());
}
model = ui->comboBoxSpeed->model();
match = model->match(model->index(0, 0), Qt::UserRole, speed);
if (!match.isEmpty()) {
if (!match.isEmpty())
ui->comboBoxSpeed->setCurrentIndex(match.first().row());
}
reloadBusChannels();
}
@@ -358,11 +351,10 @@ void
SettingsHarddisks::on_pushButtonRemove_clicked()
{
auto idx = ui->tableView->selectionModel()->currentIndex();
if (!idx.isValid()) {
if (!idx.isValid())
return;
}
auto *model = ui->tableView->model();
auto *model = ui->tableView->model();
const auto col = idx.siblingAtColumn(ColumnBus);
Harddrives::busTrackClass->device_track(0, DEV_HDD, model->data(col, DataBus).toInt(), model->data(col, DataBusChannel).toInt());
model->removeRow(idx.row());

View File

@@ -21,14 +21,13 @@ signals:
void driveChannelChanged();
private slots:
void on_comboBoxBus_currentIndexChanged(int index);
void on_comboBoxChannel_currentIndexChanged(int index);
void on_comboBoxSpeed_currentIndexChanged(int index);
private slots:
void on_pushButtonRemove_clicked();
void on_pushButtonExisting_clicked();
void on_pushButtonNew_clicked();
void on_comboBoxBus_currentIndexChanged(int index);
void on_pushButtonExisting_clicked();
void on_pushButtonRemove_clicked();
void onTableRowChanged(const QModelIndex &current);

View File

@@ -46,7 +46,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayoutHardDisks">
<item>
<widget class="QLabel" name="labelBus">
<property name="text">

View File

@@ -38,7 +38,7 @@ extern "C" {
#include "qt_keybind.hpp"
extern MainWindow *main_window;
// Temporary working copy of key list
accelKey acc_keys_t[NUM_ACCELS];
@@ -48,41 +48,40 @@ SettingsInput::SettingsInput(QWidget *parent)
{
ui->setupUi(this);
QStringList horizontalHeader;
QStringList verticalHeader;
horizontalHeader.append(tr("Action"));
QStringList horizontalHeader;
QStringList verticalHeader;
horizontalHeader.append(tr("Action"));
horizontalHeader.append(tr("Keybind"));
QTableWidget *keyTable = ui->tableKeys;
keyTable->setRowCount(10);
keyTable->setColumnCount(3);
keyTable->setColumnHidden(2, true);
keyTable->setColumnWidth(0, 200);
keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
QStringList headers;
//headers << "Action" << "Bound key";
keyTable->setHorizontalHeaderLabels(horizontalHeader);
keyTable->verticalHeader()->setVisible(false);
keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
keyTable->setSelectionBehavior(QAbstractItemView::SelectRows);
keyTable->setSelectionMode(QAbstractItemView::SingleSelection);
keyTable->setShowGrid(true);
// Make a working copy of acc_keys so we can check for dupes later without getting
// confused
for(int x=0;x<NUM_ACCELS;x++) {
strcpy(acc_keys_t[x].name, acc_keys[x].name);
strcpy(acc_keys_t[x].desc, acc_keys[x].desc);
strcpy(acc_keys_t[x].seq, acc_keys[x].seq);
}
QTableWidget *keyTable = ui->tableKeys;
keyTable->setRowCount(10);
keyTable->setColumnCount(3);
keyTable->setColumnHidden(2, true);
keyTable->setColumnWidth(0, 200);
keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
QStringList headers;
//headers << "Action" << "Bound key";
keyTable->setHorizontalHeaderLabels(horizontalHeader);
keyTable->verticalHeader()->setVisible(false);
keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
keyTable->setSelectionBehavior(QAbstractItemView::SelectRows);
keyTable->setSelectionMode(QAbstractItemView::SingleSelection);
keyTable->setShowGrid(true);
refreshInputList();
// Make a working copy of acc_keys so we can check for dupes later without getting
// confused
for(int x = 0; x < NUM_ACCELS; x++) {
strcpy(acc_keys_t[x].name, acc_keys[x].name);
strcpy(acc_keys_t[x].desc, acc_keys[x].desc);
strcpy(acc_keys_t[x].seq, acc_keys[x].seq);
}
refreshInputList();
onCurrentMachineChanged(machine);
}
SettingsInput::~SettingsInput()
{
delete ui;
@@ -93,16 +92,16 @@ SettingsInput::save()
{
mouse_type = ui->comboBoxMouse->currentData().toInt();
joystick_type = ui->comboBoxJoystick->currentData().toInt();
// Copy accelerators from working set to global set
for(int x=0;x<NUM_ACCELS;x++) {
strcpy(acc_keys[x].name, acc_keys_t[x].name);
strcpy(acc_keys[x].desc, acc_keys_t[x].desc);
strcpy(acc_keys[x].seq, acc_keys_t[x].seq);
}
ProgSettings::reloadStrings();
// Copy accelerators from working set to global set
for(int x = 0; x < NUM_ACCELS; x++) {
strcpy(acc_keys[x].name, acc_keys_t[x].name);
strcpy(acc_keys[x].desc, acc_keys_t[x].desc);
strcpy(acc_keys[x].seq, acc_keys_t[x].seq);
}
ProgSettings::reloadStrings();
}
void
SettingsInput::onCurrentMachineChanged(int machineId)
{
@@ -115,13 +114,11 @@ SettingsInput::onCurrentMachineChanged(int machineId)
int selectedRow = 0;
for (int i = 0; i < mouse_get_ndev(); ++i) {
const auto *dev = mouse_get_device(i);
if ((i == MOUSE_TYPE_INTERNAL) && (machine_has_flags(machineId, MACHINE_MOUSE) == 0)) {
if ((i == MOUSE_TYPE_INTERNAL) && (machine_has_flags(machineId, MACHINE_MOUSE) == 0))
continue;
}
if (device_is_valid(dev, machineId) == 0) {
if (device_is_valid(dev, machineId) == 0)
continue;
}
QString name = DeviceConfig::DeviceName(dev, mouse_get_internal_name(i), 0);
int row = mouseModel->rowCount();
@@ -131,9 +128,8 @@ SettingsInput::onCurrentMachineChanged(int machineId)
mouseModel->setData(idx, name, Qt::DisplayRole);
mouseModel->setData(idx, i, Qt::UserRole);
if (i == mouse_type) {
if (i == mouse_type)
selectedRow = row - removeRows;
}
}
mouseModel->removeRows(0, removeRows);
ui->comboBoxMouse->setCurrentIndex(selectedRow);
@@ -141,13 +137,12 @@ SettingsInput::onCurrentMachineChanged(int machineId)
int i = 0;
const char *joyName = joystick_get_name(i);
auto *joystickModel = ui->comboBoxJoystick->model();
removeRows = joystickModel->rowCount();
selectedRow = 0;
removeRows = joystickModel->rowCount();
selectedRow = 0;
while (joyName) {
int row = Models::AddEntry(joystickModel, tr(joyName).toUtf8().data(), i);
if (i == joystick_type) {
if (i == joystick_type)
selectedRow = row - removeRows;
}
++i;
joyName = joystick_get_name(i);
@@ -159,95 +154,95 @@ SettingsInput::onCurrentMachineChanged(int machineId)
void
SettingsInput::refreshInputList()
{
for (int x=0;x<NUM_ACCELS;x++) {
ui->tableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc)));
ui->tableKeys->setItem(x, 1, new QTableWidgetItem(QKeySequence(acc_keys_t[x].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText)));
ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name));
}
for (int x = 0; x < NUM_ACCELS; x++) {
ui->tableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc)));
ui->tableKeys->setItem(x, 1, new QTableWidgetItem(QKeySequence(acc_keys_t[x].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText)));
ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name));
}
}
void
SettingsInput::on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn)
{
// Enable/disable bind/clear buttons if user clicked valid row
QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1);
if (!cell)
{
ui->pushButtonBind->setEnabled(false);
ui->pushButtonClearBind->setEnabled(false);
}
else
{
ui->pushButtonBind->setEnabled(true);
ui->pushButtonClearBind->setEnabled(true);
}
// Enable/disable bind/clear buttons if user clicked valid row
QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1);
if (!cell) {
ui->pushButtonBind->setEnabled(false);
ui->pushButtonClearBind->setEnabled(false);
} else {
ui->pushButtonBind->setEnabled(true);
ui->pushButtonClearBind->setEnabled(true);
}
}
void
SettingsInput::on_tableKeys_cellDoubleClicked(int row, int col)
{
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->item(row,1);
if (!cell) return;
QKeySequence keyseq = KeyBinder::BindKey(this, cell->text());
if (keyseq != false) {
// If no change was made, don't change anything.
if (keyseq.toString(QKeySequence::NativeText) == cell->text()) return;
// Otherwise, check for conflicts.
// Check against the *working* copy - NOT the one in use by the app,
// so we don't test against shortcuts the user already changed.
for(int x=0;x<NUM_ACCELS;x++)
{
if(QString::fromStdString(acc_keys_t[x].seq) == keyseq.toString(QKeySequence::PortableText))
{
// That key is already in use
main_window->showMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false);
return;
}
}
// If we made it here, there were no conflicts.
// Go ahead and apply the bind.
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(row,2)->text().toUtf8().constData());
if (accKeyID < 0) return; // this should never happen
// Make the change
cell->setText(keyseq.toString(QKeySequence::NativeText));
strcpy(acc_keys_t[accKeyID].seq, keyseq.toString(QKeySequence::PortableText).toUtf8().constData());
refreshInputList();
}
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->item(row,1);
if (!cell)
return;
QKeySequence keyseq = KeyBinder::BindKey(this, cell->text());
if (keyseq != false) {
// If no change was made, don't change anything.
if (keyseq.toString(QKeySequence::NativeText) == cell->text())
return;
// Otherwise, check for conflicts.
// Check against the *working* copy - NOT the one in use by the app,
// so we don't test against shortcuts the user already changed.
for(int x = 0; x < NUM_ACCELS; x++) {
if(QString::fromStdString(acc_keys_t[x].seq) == keyseq.toString(QKeySequence::PortableText)) {
// That key is already in use
main_window->showMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false);
return;
}
}
// If we made it here, there were no conflicts.
// Go ahead and apply the bind.
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(row,2)->text().toUtf8().constData());
if (accKeyID < 0)
return; // this should never happen
// Make the change
cell->setText(keyseq.toString(QKeySequence::NativeText));
strcpy(acc_keys_t[accKeyID].seq, keyseq.toString(QKeySequence::PortableText).toUtf8().constData());
refreshInputList();
}
}
void
SettingsInput::on_pushButtonBind_clicked()
{
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->currentItem();
if (!cell) return;
on_tableKeys_cellDoubleClicked(cell->row(), cell->column());
// Edit bind
QTableWidgetItem *cell = ui->tableKeys->currentItem();
if (!cell)
return;
on_tableKeys_cellDoubleClicked(cell->row(), cell->column());
}
void
SettingsInput::on_pushButtonClearBind_clicked()
{
// Wipe bind
QTableWidgetItem *cell = ui->tableKeys->item(ui->tableKeys->currentRow(), 1);
if (!cell) return;
cell->setText("");
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(cell->row(),2)->text().toUtf8().constData());
if (accKeyID < 0) return; // this should never happen
// Make the change
cell->setText("");
strcpy(acc_keys_t[accKeyID].seq, "");
// Wipe bind
QTableWidgetItem *cell = ui->tableKeys->item(ui->tableKeys->currentRow(), 1);
if (!cell)
return;
cell->setText("");
// Find the correct accelerator key entry
int accKeyID = FindAccelerator(ui->tableKeys->item(cell->row(),2)->text().toUtf8().constData());
if (accKeyID < 0)
return; // this should never happen
// Make the change
cell->setText("");
strcpy(acc_keys_t[accKeyID].seq, "");
}
void
@@ -263,9 +258,9 @@ SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index)
int joystickId = ui->comboBoxJoystick->currentData().toInt();
for (int i = 0; i < MAX_JOYSTICKS; ++i) {
auto *btn = findChild<QPushButton *>(QString("pushButtonJoystick%1").arg(i + 1));
if (btn == nullptr) {
if (btn == nullptr)
continue;
}
btn->setEnabled(joystick_get_max_joysticks(joystickId) > i);
}
}
@@ -283,9 +278,8 @@ get_axis(JoystickConfiguration &jc, int axis, int joystick_nr)
int axis_sel = jc.selectedAxis(axis);
int nr_axes = plat_joystick_state[joystick_state[0][joystick_nr].plat_joystick_nr - 1].nr_axes;
if (axis_sel < nr_axes) {
if (axis_sel < nr_axes)
return axis_sel;
}
axis_sel -= nr_axes;
if (axis_sel & 1)

View File

@@ -26,17 +26,20 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureMouse_clicked();
void on_comboBoxJoystick_currentIndexChanged(int index);
void on_comboBoxMouse_currentIndexChanged(int index);
void on_pushButtonConfigureMouse_clicked();
void on_comboBoxJoystick_currentIndexChanged(int index);
void on_pushButtonJoystick1_clicked();
void on_pushButtonJoystick2_clicked();
void on_pushButtonJoystick3_clicked();
void on_pushButtonJoystick4_clicked();
void on_tableKeys_cellDoubleClicked(int row, int col);
void on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
void on_pushButtonBind_clicked();
void on_pushButtonClearBind_clicked();
void on_pushButtonBind_clicked();
private:
Ui::SettingsInput *ui;

View File

@@ -23,6 +23,13 @@
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelMouse">
<property name="text">
<string>Mouse:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxMouse">
<property name="sizePolicy">
@@ -36,75 +43,6 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonJoystick4">
<property name="text">
<string>Joystick 4...</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonJoystick3">
<property name="text">
<string>Joystick 3...</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButtonJoystick1">
<property name="text">
<string>Joystick 1...</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxJoystick">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Mouse:</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonClearBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Clear binding</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Joystick:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonJoystick2">
<property name="text">
<string>Joystick 2...</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButtonConfigureMouse">
<property name="sizePolicy">
@@ -118,8 +56,50 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelJoystick">
<property name="text">
<string>Joystick:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxJoystick">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButtonJoystick1">
<property name="text">
<string>Joystick 1...</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonJoystick2">
<property name="text">
<string>Joystick 2...</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonJoystick3">
<property name="text">
<string>Joystick 3...</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonJoystick4">
<property name="text">
<string>Joystick 4...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelKeys">
<property name="text">
<string>Key Bindings:</string>
</property>
@@ -144,6 +124,26 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonClearBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Clear binding</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonBind">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -358,4 +358,4 @@ void SettingsMachine::on_checkBoxFPUSoftfloat_stateChanged(int state) {
ui->softFloatWarningIcon->setVisible(false);
ui->softFloatWarningText->setVisible(false);
}
}
}

View File

@@ -18,22 +18,13 @@ public:
signals:
void currentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigure_clicked();
private slots:
void on_comboBoxFPU_currentIndexChanged(int index);
private slots:
void on_comboBoxSpeed_currentIndexChanged(int index);
private slots:
void on_comboBoxCPU_currentIndexChanged(int index);
private slots:
void on_comboBoxMachine_currentIndexChanged(int index);
private slots:
void on_comboBoxMachineType_currentIndexChanged(int index);
void on_checkBoxFPUSoftfloat_stateChanged(int state);

View File

@@ -41,6 +41,7 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMachineType">
<property name="maxVisibleItems">
@@ -48,6 +49,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
@@ -55,6 +57,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
@@ -62,6 +65,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxFPU">
<property name="maxVisibleItems">
@@ -69,6 +73,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="spinBoxRAM">
<property name="sizePolicy">
@@ -79,6 +84,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -86,6 +92,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
@@ -93,6 +100,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -121,6 +129,7 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
@@ -131,6 +140,7 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSpeed">
<property name="sizePolicy">
@@ -147,6 +157,7 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
@@ -154,6 +165,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@@ -161,6 +173,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -183,6 +196,7 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonConfigure">
<property name="sizePolicy">
@@ -199,6 +213,7 @@
</layout>
</widget>
</item>
<item row="4" column="1">
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -253,6 +268,7 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="dynamicRecompilerLayout">
<item>
@@ -270,6 +286,7 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="softFloatLayout">
<item>
@@ -285,6 +302,7 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="softFloatWarningIcon">
<property name="text">
@@ -292,6 +310,7 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="softFloatWarningText">
<property name="text">
@@ -314,6 +333,7 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">

View File

@@ -36,17 +36,17 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
auto *nic_cbox = findChild<QComboBox *>(QString("comboBoxNIC%1").arg(i + 1));
auto *net_type_cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
auto *intf_label = findChild<QLabel *>(QString("interfaceLabel%1").arg(i + 1));
auto *intf_label = findChild<QLabel *>(QString("labelIntf%1").arg(i + 1));
auto *intf_cbox = findChild<QComboBox *>(QString("comboBoxIntf%1").arg(i + 1));
auto *conf_btn = findChild<QPushButton *>(QString("pushButtonConf%1").arg(i + 1));
// auto *net_type_conf_btn = findChild<QPushButton *>(QString("pushButtonNetTypeConf%1").arg(i + 1));
auto *vde_socket_label = findChild<QLabel *>(QString("socketVDELabel%1").arg(i + 1));
auto *vde_socket_label = findChild<QLabel *>(QString("labelSocketVDENIC%1").arg(i + 1));
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
auto *option_list_label = findChild<QLabel *>(QString("optionListLabel%1").arg(i + 1));
auto *option_list_line = findChild<QWidget *>(QString("optionListLine%1").arg(i + 1));
auto *option_list_label = findChild<QLabel *>(QString("labelOptionList%1").arg(i + 1));
auto *option_list_line = findChild<QWidget *>(QString("lineOptionList%1").arg(i + 1));
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
conf_btn->setEnabled(network_card_has_config(nic_cbox->currentData().toInt()));
@@ -56,7 +56,6 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
option_list_label->setVisible(false);
option_list_line->setVisible(false);
// VDE
vde_socket_label->setVisible(false);
socket_line->setVisible(false);
@@ -70,21 +69,26 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
// Then only enable as needed based on network type
switch (net_type_cbox->currentData().toInt()) {
case NET_TYPE_VDE:
// option_list_label->setText("VDE Options");
// option_list_label->setText("VDE Options");
option_list_label->setVisible(true);
option_list_line->setVisible(true);
vde_socket_label->setVisible(true);
socket_line->setVisible(true);
break;
case NET_TYPE_PCAP:
// option_list_label->setText("PCAP Options");
// option_list_label->setText("PCAP Options");
option_list_label->setVisible(true);
option_list_line->setVisible(true);
intf_cbox->setVisible(true);
intf_label->setVisible(true);
break;
case NET_TYPE_SLIRP:
default:
break;
}
}
}
@@ -124,11 +128,10 @@ SettingsNetwork::save()
net_cards_conf[i].net_type = cbox->currentData().toInt();
cbox = findChild<QComboBox *>(QString("comboBoxIntf%1").arg(i + 1));
memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name));
if (net_cards_conf[i].net_type == NET_TYPE_PCAP) {
if (net_cards_conf[i].net_type == NET_TYPE_PCAP)
strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1);
} else if (net_cards_conf[i].net_type == NET_TYPE_VDE) {
else if (net_cards_conf[i].net_type == NET_TYPE_VDE)
strncpy(net_cards_conf[i].host_dev_name, socket_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name));
}
}
}
@@ -141,7 +144,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
int selectedRow = 0;
// Network Card
QComboBox * cbox_[NET_CARD_MAX] = { 0 };
QComboBox *cbox_[NET_CARD_MAX] = { 0 };
QAbstractItemModel *models[NET_CARD_MAX] = { 0 };
int removeRows_[NET_CARD_MAX] = { 0 };
int selectedRows[NET_CARD_MAX] = { 0 };
@@ -226,9 +229,8 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
void
SettingsNetwork::on_comboIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
enableElements(ui);
}
@@ -236,8 +238,8 @@ SettingsNetwork::on_comboIndexChanged(int index)
void
SettingsNetwork::on_pushButtonConf1_clicked()
{
int netCard = ui->comboBoxNIC1->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC1->currentData().toInt();
auto *device = network_card_getdevice(netCard);
if (netCard == NET_INTERNAL)
device = machine_get_net_device(machineId);
DeviceConfig::ConfigureDevice(device, 1);
@@ -246,23 +248,23 @@ SettingsNetwork::on_pushButtonConf1_clicked()
void
SettingsNetwork::on_pushButtonConf2_clicked()
{
int netCard = ui->comboBoxNIC2->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC2->currentData().toInt();
auto *device = network_card_getdevice(netCard);
DeviceConfig::ConfigureDevice(device, 2);
}
void
SettingsNetwork::on_pushButtonConf3_clicked()
{
int netCard = ui->comboBoxNIC3->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC3->currentData().toInt();
auto *device = network_card_getdevice(netCard);
DeviceConfig::ConfigureDevice(device, 3);
}
void
SettingsNetwork::on_pushButtonConf4_clicked()
{
int netCard = ui->comboBoxNIC4->currentData().toInt();
auto *device = network_card_getdevice(netCard);
int netCard = ui->comboBoxNIC4->currentData().toInt();
auto *device = network_card_getdevice(netCard);
DeviceConfig::ConfigureDevice(device, 4);
}

View File

@@ -27,15 +27,29 @@
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<widget class="QTabWidget" name="tabWidgetNet">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_1">
<widget class="QWidget" name="tabNet1">
<attribute name="title">
<string>Network Card #1</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayoutNet1">
<item row="0" column="0">
<widget class="QLabel" name="labelMode1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet1">
<property name="maxVisibleItems">
@@ -50,7 +64,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="labelAdapter1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -62,79 +76,6 @@
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel1">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel1">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC1">
<property name="sizePolicy">
@@ -151,10 +92,43 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC1">
<property name="maxLength">
<number>127</number>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList1">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
@@ -168,15 +142,22 @@
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Network Card #2</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC1">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC1">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer">
<spacer name="verticalSpacerNIC1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -188,28 +169,16 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel2">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabNet2">
<attribute name="title">
<string>Network Card #2</string>
</attribute>
<layout class="QGridLayout" name="gridLayoutNet2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="labelMode2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -234,22 +203,8 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel2">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<widget class="QLabel" name="labelAdapter2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -261,6 +216,22 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf2">
<property name="sizePolicy">
@@ -274,25 +245,33 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC2">
<property name="maxVisibleItems">
<number>30</number>
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList2">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC2"/>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIntf2">
<property name="sizePolicy">
@@ -303,13 +282,54 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC2">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC2">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacerNIC2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="tabNet3">
<attribute name="title">
<string>Network Card #3</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayoutNet3">
<item row="0" column="0">
<widget class="QLabel" name="labelMode3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet3">
<property name="maxVisibleItems">
@@ -323,17 +343,16 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel3">
<property name="text">
<string>VDE Socket:</string>
<item row="1" column="0">
<widget class="QLabel" name="labelAdapter3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel3">
<property name="text">
<string>Options</string>
<string>Adapter:</string>
</property>
</widget>
</item>
@@ -353,39 +372,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf3">
<property name="sizePolicy">
@@ -399,8 +385,22 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList3">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -408,13 +408,10 @@
</sizepolicy>
</property>
<property name="text">
<string>Adapter:</string>
<string>Interface:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC3"/>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIntf3">
<property name="sizePolicy">
@@ -425,8 +422,22 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC3">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC3">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_3">
<spacer name="verticalSpacerNIC3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -440,20 +451,14 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<widget class="QWidget" name="tabNet4">
<attribute name="title">
<string>Network Card #4</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<widget class="QLabel" name="optionListLabel4">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayoutNet4">
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<widget class="QLabel" name="labelMode4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -465,28 +470,21 @@
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="socketVDELabel4">
<property name="text">
<string>VDE Socket:</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_16">
<widget class="QLabel" name="labelAdapter4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -498,26 +496,6 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="optionListLine4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interfaceLabel4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxNIC4">
<property name="sizePolicy">
@@ -534,19 +512,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNet4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConf4">
<property name="sizePolicy">
@@ -560,8 +525,32 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC4"/>
<item row="2" column="0">
<widget class="QLabel" name="labelOptionList4">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Line" name="lineOptionList4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIntf4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interface:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIntf4">
@@ -573,8 +562,36 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelSocketVDENIC4">
<property name="text">
<string>VDE Socket:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="socketVDENIC4">
<property name="maxLength">
<number>127</number>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacerNIC4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@@ -11,8 +11,10 @@
*
*
* Authors: Joakim L. Gilje <jgilje@jgilje.net>
* Jasmine Iwanek <jriwanek@gmail.com>
*
* Copyright 2021 Joakim L. Gilje
* Copyright 2025 Jasmine Iwanek
*/
#include "qt_settingsotherperipherals.hpp"
#include "ui_qt_settingsotherperipherals.h"
@@ -22,6 +24,7 @@ extern "C" {
#include <86box/device.h>
#include <86box/machine.h>
#include <86box/isamem.h>
#include <86box/isarom.h>
#include <86box/isartc.h>
#include <86box/unittester.h>
#include <86box/novell_cardkey.h>
@@ -44,84 +47,131 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId)
this->machineId = machineId;
bool machineHasIsa = (machine_has_bus(machineId, MACHINE_BUS_ISA) > 0);
ui->pushButtonConfigureRTC->setEnabled(machineHasIsa);
ui->comboBoxRTC->setEnabled(machineHasIsa);
ui->checkBoxISABugger->setEnabled(machineHasIsa);
ui->pushButtonConfigureUT->setEnabled(unittester_enabled > 0);
ui->checkBoxKeyCard->setEnabled(machineHasIsa);
ui->pushButtonConfigureKeyCard->setEnabled(novell_keycard_enabled > 0);
ui->checkBoxISABugger->setChecked((machineHasIsa && (bugger_enabled > 0)) ? true : false);
ui->checkBoxPOSTCard->setChecked(postcard_enabled > 0 ? true : false);
ui->checkBoxUnitTester->setChecked(unittester_enabled > 0 ? true : false);
ui->checkBoxKeyCard->setChecked((machineHasIsa && (novell_keycard_enabled > 0)) ? true : false);
ui->checkBoxISABugger->setEnabled(machineHasIsa);
ui->checkBoxKeyCard->setEnabled(machineHasIsa);
ui->pushButtonConfigureKeyCard->setEnabled(novell_keycard_enabled > 0);
ui->pushButtonConfigureUT->setEnabled(unittester_enabled > 0);
ui->comboBoxRTC->setEnabled(machineHasIsa);
ui->pushButtonConfigureRTC->setEnabled(machineHasIsa);
ui->comboBoxCard1->clear();
ui->comboBoxCard2->clear();
ui->comboBoxCard3->clear();
ui->comboBoxCard4->clear();
ui->comboBoxRTC->clear();
auto *model = ui->comboBoxRTC->model();
int d = 0;
for (uint8_t i = 0; i < ISAMEM_MAX; ++i)
if (auto *cb = findChild<QComboBox *>(QString("comboBoxIsaMemCard%1").arg(i + 1)))
cb->clear();
for (uint8_t i = 0; i < ISAROM_MAX; ++i)
if (auto *cb = findChild<QComboBox *>(QString("comboBoxIsaRomCard%1").arg(i + 1)))
cb->clear();
int c = 0;
int selectedRow = 0;
// ISA RTC Cards
auto *model = ui->comboBoxRTC->model();
while (true) {
QString name = DeviceConfig::DeviceName(isartc_get_device(d), isartc_get_internal_name(d), 0);
if (name.isEmpty()) {
const QString name = DeviceConfig::DeviceName(isartc_get_device(c), isartc_get_internal_name(c), 0);
if (name.isEmpty())
break;
}
if (!device_is_valid(isartc_get_device(d), machineId)) {
if (!device_is_valid(isartc_get_device(c), machineId))
break;
}
int row = Models::AddEntry(model, name, d);
if (d == isartc_type) {
int row = Models::AddEntry(model, name, c);
if (c == isartc_type)
selectedRow = row;
}
++d;
++c;
}
ui->comboBoxRTC->setCurrentIndex(selectedRow);
ui->pushButtonConfigureRTC->setEnabled((isartc_type != 0) && isartc_has_config(isartc_type) && machineHasIsa);
// ISA Memory Expansion Card
QComboBox * cbox[ISAMEM_MAX] = { 0 };
QAbstractItemModel *models[ISAMEM_MAX] = { 0 };
int removeRows_[ISAMEM_MAX] = { 0 };
int selectedRows[ISAMEM_MAX] = { 0 };
// ISA Memory Expansion Cards
QComboBox *isamem_cbox[ISAMEM_MAX] = { 0 };
QAbstractItemModel *isamem_models[ISAMEM_MAX] = { 0 };
int isamem_removeRows_[ISAMEM_MAX] = { 0 };
int isamem_selectedRows[ISAMEM_MAX] = { 0 };
for (uint8_t c = 0; c < ISAMEM_MAX; ++c) {
cbox[c] = findChild<QComboBox *>(QString("comboBoxCard%1").arg(c + 1));
models[c] = cbox[c]->model();
removeRows_[c] = models[c]->rowCount();
for (uint8_t i = 0; i < ISAMEM_MAX; ++i) {
isamem_cbox[i] = findChild<QComboBox *>(QString("comboBoxIsaMemCard%1").arg(i + 1));
isamem_models[i] = isamem_cbox[i]->model();
isamem_removeRows_[i] = isamem_models[i]->rowCount();
}
d = 0;
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(isamem_get_device(d),
isamem_get_internal_name(d), 0);
const QString name = DeviceConfig::DeviceName(isamem_get_device(c),
isamem_get_internal_name(c), 0);
if (name.isEmpty())
break;
if (device_is_valid(isamem_get_device(d), machineId)) {
for (uint8_t c = 0; c < ISAMEM_MAX; ++c) {
int row = Models::AddEntry(models[c], name, d);
if (device_is_valid(isamem_get_device(c), machineId)) {
for (uint8_t i = 0; i < ISAMEM_MAX; ++i) {
int row = Models::AddEntry(isamem_models[i], name, c);
if (d == isamem_type[c])
selectedRows[c] = row - removeRows_[c];
if (c == isamem_type[i])
isamem_selectedRows[i] = row - isamem_removeRows_[i];
}
}
d++;
c++;
}
for (uint8_t c = 0; c < ISAMEM_MAX; ++c) {
models[c]->removeRows(0, removeRows_[c]);
cbox[c]->setEnabled(models[c]->rowCount() > 1);
cbox[c]->setCurrentIndex(-1);
cbox[c]->setCurrentIndex(selectedRows[c]);
findChild<QPushButton *>(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled((isamem_type[c] != 0) &&
isamem_has_config(isamem_type[c]) && machineHasIsa);
for (uint8_t i = 0; i < ISAMEM_MAX; ++i) {
isamem_models[i]->removeRows(0, isamem_removeRows_[i]);
isamem_cbox[i]->setEnabled(isamem_models[i]->rowCount() > 1);
isamem_cbox[i]->setCurrentIndex(-1);
isamem_cbox[i]->setCurrentIndex(isamem_selectedRows[i]);
findChild<QPushButton *>(QString("pushButtonConfigureIsaMemCard%1").arg(i + 1))->setEnabled((isamem_type[i] != 0) &&
isamem_has_config(isamem_type[i]) && machineHasIsa);
}
// ISA ROM Expansion Cards
QComboBox *isarom_cbox[ISAROM_MAX] = { 0 };
QAbstractItemModel *isarom_models[ISAROM_MAX] = { 0 };
int isarom_removeRows_[ISAROM_MAX] = { 0 };
int isarom_selectedRows[ISAROM_MAX] = { 0 };
for (uint8_t i = 0; i < ISAROM_MAX; ++i) {
isarom_cbox[i] = findChild<QComboBox *>(QString("comboBoxIsaRomCard%1").arg(i + 1));
isarom_models[i] = isarom_cbox[i]->model();
isarom_removeRows_[i] = isarom_models[i]->rowCount();
}
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(isarom_get_device(c),
isarom_get_internal_name(c), 0);
if (name.isEmpty())
break;
if (device_is_valid(isarom_get_device(c), machineId)) {
for (uint8_t i = 0; i < ISAROM_MAX; ++i) {
int row = Models::AddEntry(isarom_models[i], name, c);
if (c == isarom_type[i])
isarom_selectedRows[i] = row - isarom_removeRows_[i];
}
}
c++;
}
for (uint8_t i = 0; i < ISAROM_MAX; ++i) {
isarom_models[i]->removeRows(0, isarom_removeRows_[i]);
isarom_cbox[i]->setEnabled(isarom_models[i]->rowCount() > 1);
isarom_cbox[i]->setCurrentIndex(-1);
isarom_cbox[i]->setCurrentIndex(isarom_selectedRows[i]);
findChild<QPushButton *>(QString("pushButtonConfigureIsaRomCard%1").arg(i + 1))->setEnabled((isarom_type[i] != 0) &&
isarom_has_config(isarom_type[i]) && machineHasIsa);
}
}
@@ -134,25 +184,31 @@ void
SettingsOtherPeripherals::save()
{
/* Other peripherals category */
isartc_type = ui->comboBoxRTC->currentData().toInt();
bugger_enabled = ui->checkBoxISABugger->isChecked() ? 1 : 0;
postcard_enabled = ui->checkBoxPOSTCard->isChecked() ? 1 : 0;
unittester_enabled = ui->checkBoxUnitTester->isChecked() ? 1 : 0;
novell_keycard_enabled = ui->checkBoxKeyCard->isChecked() ? 1 : 0;
isartc_type = ui->comboBoxRTC->currentData().toInt();
/* ISA memory boards. */
for (int i = 0; i < ISAMEM_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxCard%1").arg(i + 1));
auto *cbox = findChild<QComboBox *>(QString("comboBoxIsaMemCard%1").arg(i + 1));
isamem_type[i] = cbox->currentData().toInt();
}
/* ISA ROM boards. */
for (int i = 0; i < ISAROM_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxIsaRomCard%1").arg(i + 1));
isarom_type[i] = cbox->currentData().toInt();
}
}
void
SettingsOtherPeripherals::on_comboBoxRTC_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureRTC->setEnabled((index != 0) && isartc_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
@@ -163,63 +219,123 @@ SettingsOtherPeripherals::on_pushButtonConfigureRTC_clicked()
}
void
SettingsOtherPeripherals::on_comboBoxCard1_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard1_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard1_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard1_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard1->currentData().toInt()), 1);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard1->currentData().toInt()), 1);
}
void
SettingsOtherPeripherals::on_comboBoxCard2_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard2_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard2_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard2_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard2->currentData().toInt()), 2);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard2->currentData().toInt()), 2);
}
void
SettingsOtherPeripherals::on_comboBoxCard3_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard3_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard3_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard3_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard3->currentData().toInt()), 3);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard3->currentData().toInt()), 3);
}
void
SettingsOtherPeripherals::on_comboBoxCard4_currentIndexChanged(int index)
SettingsOtherPeripherals::on_comboBoxIsaMemCard4_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureIsaMemCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureCard4_clicked()
SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard4_clicked()
{
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard4->currentData().toInt()), 4);
DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard4->currentData().toInt()), 4);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard1_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard1->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard1_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard1->currentData().toInt()), 1);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard2_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard2->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard2_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard2->currentData().toInt()), 2);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard3_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard3->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard3_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard3->currentData().toInt()), 3);
}
void
SettingsOtherPeripherals::on_comboBoxIsaRomCard4_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonConfigureIsaRomCard4->setEnabled((index != 0) && isarom_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA));
}
void
SettingsOtherPeripherals::on_pushButtonConfigureIsaRomCard4_clicked()
{
DeviceConfig::ConfigureDevice(isarom_get_device(ui->comboBoxIsaRomCard4->currentData().toInt()), 4);
}
void
@@ -234,13 +350,12 @@ SettingsOtherPeripherals::on_pushButtonConfigureUT_clicked()
DeviceConfig::ConfigureDevice(&unittester_device);
}
void SettingsOtherPeripherals::on_pushButtonConfigureKeyCard_clicked()
{
DeviceConfig::ConfigureDevice(&novell_keycard_device);
}
void SettingsOtherPeripherals::on_checkBoxKeyCard_stateChanged(int arg1)
{
ui->pushButtonConfigureKeyCard->setEnabled(arg1 != 0);
}
void SettingsOtherPeripherals::on_pushButtonConfigureKeyCard_clicked()
{
DeviceConfig::ConfigureDevice(&novell_keycard_device);
}

View File

@@ -20,22 +20,32 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureCard4_clicked();
void on_comboBoxCard4_currentIndexChanged(int index);
void on_pushButtonConfigureCard3_clicked();
void on_comboBoxCard3_currentIndexChanged(int index);
void on_pushButtonConfigureCard2_clicked();
void on_comboBoxCard2_currentIndexChanged(int index);
void on_pushButtonConfigureCard1_clicked();
void on_comboBoxCard1_currentIndexChanged(int index);
void on_pushButtonConfigureRTC_clicked();
void on_comboBoxRTC_currentIndexChanged(int index);
void on_pushButtonConfigureRTC_clicked();
void on_comboBoxIsaMemCard1_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard1_clicked();
void on_comboBoxIsaMemCard2_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard2_clicked();
void on_comboBoxIsaMemCard3_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard3_clicked();
void on_comboBoxIsaMemCard4_currentIndexChanged(int index);
void on_pushButtonConfigureIsaMemCard4_clicked();
void on_comboBoxIsaRomCard1_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard1_clicked();
void on_comboBoxIsaRomCard2_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard2_clicked();
void on_comboBoxIsaRomCard3_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard3_clicked();
void on_comboBoxIsaRomCard4_currentIndexChanged(int index);
void on_pushButtonConfigureIsaRomCard4_clicked();
void on_checkBoxUnitTester_stateChanged(int arg1);
void on_pushButtonConfigureUT_clicked();
void on_pushButtonConfigureKeyCard_clicked();
void on_checkBoxKeyCard_stateChanged(int arg1);
void on_pushButtonConfigureKeyCard_clicked();
private:
Ui::SettingsOtherPeripherals *ui;

View File

@@ -27,9 +27,9 @@
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayoutRtc">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelRtc">
<property name="text">
<string>ISA RTC:</string>
</property>
@@ -58,20 +58,74 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBoxMem">
<property name="title">
<string>ISA Memory Expansion</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard2">
<layout class="QGridLayout" name="gridLayoutMem">
<item row="0" column="0">
<widget class="QLabel" name="labelIsaMemCard1">
<property name="text">
<string>Card 1:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxIsaMemCard1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelIsaMemCard2">
<property name="text">
<string>Card 2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxCard2">
<widget class="QComboBox" name="comboBoxIsaMemCard2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelIsaMemCard3">
<property name="text">
<string>Card 3:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxIsaMemCard3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -84,68 +138,21 @@
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard3">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<item row="3" column="0">
<widget class="QLabel" name="labelIsaMemCard4">
<property name="text">
<string>Card 2:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Card 3:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxCard1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Card 1:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxCard3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
<string>Card 4:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxCard4">
<widget class="QComboBox" name="comboBoxIsaMemCard4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -158,24 +165,134 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureCard4">
<widget class="QPushButton" name="pushButtonConfigureIsaMemCard4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Card 4:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<widget class="QGroupBox" name="groupBoxRom">
<property name="title">
<string>ISA ROM Cards</string>
</property>
<layout class="QGridLayout" name="gridLayoutRom">
<item row="0" column="0">
<widget class="QLabel" name="labelIsaRomCard1">
<property name="text">
<string>Card 1:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelIsaRomCard2">
<property name="text">
<string>Card 2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelIsaRomCard3">
<property name="text">
<string>Card 3:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelIsaRomCard4">
<property name="text">
<string>Card 4:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxIsaRomCard4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonConfigureIsaRomCard4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutIBPC">
<item>
<widget class="QCheckBox" name="checkBoxISABugger">
<property name="text">
@@ -193,7 +310,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayoutUT">
<item>
<widget class="QCheckBox" name="checkBoxUnitTester">
<property name="sizePolicy">
@@ -217,7 +334,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QHBoxLayout" name="horizontalLayoutKeyCard">
<property name="topMargin">
<number>0</number>
</property>

View File

@@ -21,33 +21,19 @@ public:
signals:
void moChannelChanged();
void zipChannelChanged();
private slots:
void on_checkBoxZIP250_stateChanged(int arg1);
private slots:
void on_comboBoxZIPChannel_activated(int index);
private slots:
void on_comboBoxZIPBus_activated(int index);
private slots:
void on_comboBoxZIPBus_currentIndexChanged(int index);
private slots:
void on_comboBoxMOType_activated(int index);
private slots:
void on_comboBoxMOChannel_activated(int index);
private slots:
void on_comboBoxMOBus_activated(int index);
private slots:
void on_comboBoxMOBus_currentIndexChanged(int index);
private slots:
void onMORowChanged(const QModelIndex &current);
void on_comboBoxMOBus_currentIndexChanged(int index);
void on_comboBoxMOBus_activated(int index);
void on_comboBoxMOChannel_activated(int index);
void on_comboBoxMOType_activated(int index);
void onZIPRowChanged(const QModelIndex &current);
void on_comboBoxZIPBus_currentIndexChanged(int index);
void on_comboBoxZIPBus_activated(int index);
void on_comboBoxZIPChannel_activated(int index);
void on_checkBoxZIP250_stateChanged(int arg1);
private:
Ui::SettingsOtherRemovable *ui;

View File

@@ -27,7 +27,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelMO">
<property name="text">
<string>MO drives:</string>
</property>
@@ -68,19 +68,12 @@
<widget class="QWidget" name="moControls" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelMOBus">
<property name="text">
<string>Bus:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMOBus">
<property name="maxVisibleItems">
@@ -88,6 +81,13 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="labelMOChannel">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="comboBoxMOChannel">
<property name="maxVisibleItems">
@@ -96,7 +96,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelMOType">
<property name="text">
<string>Type:</string>
</property>
@@ -113,7 +113,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelZIP">
<property name="text">
<string>ZIP drives:</string>
</property>
@@ -154,7 +154,7 @@
<widget class="QWidget" name="zipControls" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelZIPBus">
<property name="text">
<string>Bus:</string>
</property>
@@ -168,7 +168,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelZIPChannel">
<property name="text">
<string>Channel:</string>
</property>

View File

@@ -51,7 +51,7 @@ SettingsPorts::save()
{
for (int i = 0; i < PARALLEL_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxLpt%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
if (cbox != NULL)
lpt_ports[i].device = cbox->currentData().toInt();
if (checkBox != NULL)
@@ -73,7 +73,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId)
{
this->machineId = machineId;
int c = 0;
int c = 0;
// LPT Device
QComboBox * cbox[PARALLEL_MAX] = { 0 };
@@ -93,7 +93,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId)
if (lptName == nullptr)
break;
const QString name = tr(lptName);
const QString name = tr(lptName);
for (uint8_t i = 0; i < PARALLEL_MAX; ++i) {
int row = Models::AddEntry(models[i], name, c);

View File

@@ -35,22 +35,25 @@ private slots:
void on_checkBoxSerial7_stateChanged(int state);
#endif
void on_checkBoxSerialPassThru1_stateChanged(int state);
void on_pushButtonSerialPassThru1_clicked();
void on_checkBoxSerialPassThru2_stateChanged(int state);
void on_pushButtonSerialPassThru2_clicked();
void on_checkBoxSerialPassThru3_stateChanged(int state);
void on_pushButtonSerialPassThru3_clicked();
void on_checkBoxSerialPassThru4_stateChanged(int state);
void on_pushButtonSerialPassThru4_clicked();
#if 0
void on_checkBoxSerialPassThru5_stateChanged(int state);
void on_checkBoxSerialPassThru6_stateChanged(int state);
void on_checkBoxSerialPassThru7_stateChanged(int state);
#endif
void on_pushButtonSerialPassThru1_clicked();
void on_pushButtonSerialPassThru2_clicked();
void on_pushButtonSerialPassThru3_clicked();
void on_pushButtonSerialPassThru4_clicked();
#if 0
void on_pushButtonSerialPassThru5_clicked();
void on_checkBoxSerialPassThru6_stateChanged(int state);
void on_pushButtonSerialPassThru6_clicked();
void on_checkBoxSerialPassThru7_stateChanged(int state);
void on_pushButtonSerialPassThru7_clicked();
#endif

View File

@@ -29,7 +29,7 @@
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelLpt1">
<property name="text">
<string>LPT1 Device:</string>
</property>
@@ -43,7 +43,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelLpt2">
<property name="text">
<string>LPT2 Device:</string>
</property>
@@ -57,7 +57,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelLpt3">
<property name="text">
<string>LPT3 Device:</string>
</property>
@@ -71,7 +71,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelLpt4">
<property name="text">
<string>LPT4 Device:</string>
</property>
@@ -88,27 +88,6 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxParallel2">
<property name="text">
<string>Parallel port 2</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxParallel3">
<property name="text">
<string>Parallel port 3</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerial3">
<property name="text">
<string>Serial port 3</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSerial1">
<property name="text">
@@ -116,20 +95,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxParallel4">
<property name="text">
<string>Parallel port 4</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerial2">
<property name="text">
<string>Serial port 2</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBoxParallel1">
<property name="text">
@@ -137,6 +102,34 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerial2">
<property name="text">
<string>Serial port 2</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxParallel2">
<property name="text">
<string>Parallel port 2</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerial3">
<property name="text">
<string>Serial port 3</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxParallel3">
<property name="text">
<string>Parallel port 3</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSerial4">
<property name="text">
@@ -144,13 +137,76 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxParallel4">
<property name="text">
<string>Parallel port 4</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="gridLayoutPassThru">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru1">
<property name="text">
<string>Serial port passthrough 1</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru2">
<property name="text">
<string>Serial port passthrough 2</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru3">
<property name="text">
<string>Serial port passthrough 3</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru4">
<property name="text">
<string>Serial port passthrough 4</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
@@ -164,13 +220,6 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru3">
<property name="text">
<string>Serial port passthrough 3</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
@@ -184,55 +233,6 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru1">
<property name="text">
<string>Serial port passthrough 1</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru2">
<property name="text">
<string>Serial port passthrough 2</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSerialPassThru4">
<property name="text">
<string>Serial port passthrough 4</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pushButtonSerialPassThru4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -14,7 +14,7 @@
* Jasmine Iwanek <jriwanek@gmail.com>
*
* Copyright 2021 Joakim L. Gilje
* Copyright 2022-2023 Jasmine Iwanek
* Copyright 2022-2025 Jasmine Iwanek
*/
#include "qt_settingssound.hpp"
#include "ui_qt_settingssound.h"
@@ -76,8 +76,8 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
int c;
int selectedRow;
// Sound Card
QComboBox * cbox[SOUND_CARD_MAX] = { 0 };
// Sound Cards
QComboBox *cbox[SOUND_CARD_MAX] = { 0 };
QAbstractItemModel *models[SOUND_CARD_MAX] = { 0 };
int removeRows_[SOUND_CARD_MAX] = { 0 };
int selectedRows[SOUND_CARD_MAX] = { 0 };
@@ -89,7 +89,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
removeRows_[i] = models[i]->rowCount();
}
c = 0;
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(sound_card_getdevice(c),
sound_card_get_internal_name(c), 1);
@@ -110,7 +110,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
}
}
c++;
c++;
}
for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) {
@@ -122,21 +122,19 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
// Midi Out
c = 0;
auto model = ui->comboBoxMidiOut->model();
auto *model = ui->comboBoxMidiOut->model();
auto removeRows = model->rowCount();
selectedRow = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0);
if (name.isEmpty()) {
if (name.isEmpty())
break;
}
if (midi_out_device_available(c)) {
int row = Models::AddEntry(model, name, c);
if (c == midi_output_device_current) {
if (c == midi_output_device_current)
selectedRow = row - removeRows;
}
}
c++;
@@ -155,15 +153,13 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
while (true) {
const QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0);
if (name.isEmpty()) {
if (name.isEmpty())
break;
}
if (midi_in_device_available(c)) {
int row = Models::AddEntry(model, name, c);
if (c == midi_input_device_current) {
if (c == midi_input_device_current)
selectedRow = row - removeRows;
}
}
c++;
@@ -198,13 +194,11 @@ allowMpu401(Ui::SettingsSound *ui)
QString midiOut = midi_out_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt());
QString midiIn = midi_in_device_get_internal_name(ui->comboBoxMidiIn->currentData().toInt());
if (midiOut.isEmpty()) {
if (midiOut.isEmpty())
return false;
}
if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none")) {
if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none"))
return false;
}
return true;
}
@@ -212,9 +206,9 @@ allowMpu401(Ui::SettingsSound *ui)
void
SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
@@ -238,9 +232,8 @@ SettingsSound::on_pushButtonConfigureSoundCard1_clicked()
void
SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
@@ -258,9 +251,8 @@ SettingsSound::on_pushButtonConfigureSoundCard2_clicked()
void
SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
@@ -279,9 +271,8 @@ SettingsSound::on_pushButtonConfigureSoundCard3_clicked()
void
SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
@@ -300,9 +291,8 @@ SettingsSound::on_pushButtonConfigureSoundCard4_clicked()
void
SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureMidiOut->setEnabled(midi_out_device_has_config(ui->comboBoxMidiOut->currentData().toInt()));
ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA)));
@@ -318,9 +308,8 @@ SettingsSound::on_pushButtonConfigureMidiOut_clicked()
void
SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonConfigureMidiIn->setEnabled(midi_in_device_has_config(ui->comboBoxMidiIn->currentData().toInt()));
ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA)));

View File

@@ -20,20 +20,26 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonConfigureMPU401_clicked();
void on_checkBoxMPU401_stateChanged(int arg1);
void on_pushButtonConfigureMidiIn_clicked();
void on_pushButtonConfigureMidiOut_clicked();
void on_comboBoxMidiIn_currentIndexChanged(int index);
void on_comboBoxMidiOut_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard1_clicked();
void on_comboBoxSoundCard1_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard2_clicked();
void on_pushButtonConfigureSoundCard1_clicked();
void on_comboBoxSoundCard2_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard3_clicked();
void on_pushButtonConfigureSoundCard2_clicked();
void on_comboBoxSoundCard3_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard4_clicked();
void on_pushButtonConfigureSoundCard3_clicked();
void on_comboBoxSoundCard4_currentIndexChanged(int index);
void on_pushButtonConfigureSoundCard4_clicked();
void on_comboBoxMidiOut_currentIndexChanged(int index);
void on_pushButtonConfigureMidiOut_clicked();
void on_comboBoxMidiIn_currentIndexChanged(int index);
void on_pushButtonConfigureMidiIn_clicked();
void on_checkBoxMPU401_stateChanged(int arg1);
void on_pushButtonConfigureMPU401_clicked();
private:
Ui::SettingsSound *ui;

View File

@@ -26,17 +26,23 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<item row="0" column="0">
<widget class="QLabel" name="labelSoundCard1">
<property name="text">
<string>MIDI In Device:</string>
<string>Sound card #1:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Sound card #1:</string>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxSoundCard1">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
@@ -48,12 +54,25 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelSoundCard2">
<property name="text">
<string>Sound card #2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxSoundCard2">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonConfigureSoundCard2">
<property name="text">
@@ -62,12 +81,25 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelSoundCard3">
<property name="text">
<string>Sound card #3:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxSoundCard3">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonConfigureSoundCard3">
<property name="text">
@@ -75,14 +107,26 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelSoundCard4">
<property name="text">
<string>Sound card #4:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxSoundCard4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonConfigureSoundCard4">
<property name="text">
@@ -90,49 +134,13 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxMidiIn">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelMidiOut">
<property name="text">
<string>MIDI Out Device:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBoxMPU401">
<property name="text">
<string>Standalone MPU-401</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="pushButtonConfigureMPU401">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonConfigureMidiIn">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxMidiOut">
<property name="maxVisibleItems">
@@ -153,6 +161,47 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelMidiIn">
<property name="text">
<string>MIDI In Device:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxMidiIn">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButtonConfigureMidiIn">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBoxMPU401">
<property name="text">
<string>Standalone MPU-401</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="pushButtonConfigureMPU401">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="checkBoxFloat32">
<property name="text">
@@ -171,7 +220,7 @@
<property name="title">
<string>FM synth driver</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_1">
<layout class="QVBoxLayout" name="verticalLayoutFM">
<item>
<widget class="QRadioButton" name="radioButtonNuked">
<property name="text">
@@ -202,58 +251,6 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxSoundCard1">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxSoundCard2">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxSoundCard3">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxSoundCard4">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -56,8 +56,8 @@ SettingsStorageControllers::save()
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
scsi_card_current[i] = cbox->currentData().toInt();
}
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
fdc_current[0] = ui->comboBoxFD->currentData().toInt();
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
cdrom_interface_current = ui->comboBoxCDInterface->currentData().toInt();
ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0;
ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0;
@@ -84,18 +84,16 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
}
QString name = DeviceConfig::DeviceName(hdc_get_device(c), hdc_get_internal_name(c), 1);
if (name.isEmpty()) {
if (name.isEmpty())
break;
}
if (hdc_available(c)) {
const device_t *hdc_dev = hdc_get_device(c);
if (device_is_valid(hdc_dev, machineId)) {
int row = Models::AddEntry(model, name, c);
if (c == hdc_current[0]) {
if (c == hdc_current[0])
selectedRow = row - removeRows;
}
}
}
c++;
@@ -105,7 +103,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
ui->comboBoxHD->setCurrentIndex(-1);
ui->comboBoxHD->setCurrentIndex(selectedRow);
/*FD controller config*/
/* FD controller config */
model = ui->comboBoxFD->model();
removeRows = model->rowCount();
c = 0;
@@ -143,11 +141,11 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
/*CD interface controller config*/
#ifdef USE_CDROM_MITSUMI
ui->label_7->setVisible(true);
ui->labelCDInterface->setVisible(true);
ui->comboBoxCDInterface->setVisible(true);
ui->pushButtonCDInterface->setVisible(true);
#else
ui->label_7->setVisible(false);
ui->labelCDInterface->setVisible(false);
ui->comboBoxCDInterface->setVisible(false);
ui->pushButtonCDInterface->setVisible(false);
#endif
@@ -240,29 +238,29 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
}
void
SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index)
SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0);
ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0);
ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonCDInterface->setEnabled(cdrom_interface_has_config(ui->comboBoxCDInterface->currentData().toInt()) > 0);
}
@@ -278,18 +276,18 @@ SettingsStorageControllers::on_checkBoxQuaternaryIDE_stateChanged(int arg1)
ui->pushButtonQuaternaryIDE->setEnabled(arg1 == Qt::Checked);
}
void
SettingsStorageControllers::on_pushButtonHD_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonFD_clicked()
{
DeviceConfig::ConfigureDevice(fdc_card_getdevice(ui->comboBoxFD->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonCDInterface_clicked()
{
@@ -311,36 +309,36 @@ SettingsStorageControllers::on_pushButtonQuaternaryIDE_clicked()
void
SettingsStorageControllers::on_comboBoxSCSI1_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI1->setEnabled(scsi_card_has_config(ui->comboBoxSCSI1->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxSCSI2_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI2->setEnabled(scsi_card_has_config(ui->comboBoxSCSI2->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxSCSI3_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI3->setEnabled(scsi_card_has_config(ui->comboBoxSCSI3->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxSCSI4_currentIndexChanged(int index)
{
if (index < 0) {
if (index < 0)
return;
}
ui->pushButtonSCSI4->setEnabled(scsi_card_has_config(ui->comboBoxSCSI4->currentData().toInt()) > 0);
}

View File

@@ -20,27 +20,31 @@ public slots:
void onCurrentMachineChanged(int machineId);
private slots:
void on_pushButtonSCSI4_clicked();
void on_pushButtonSCSI3_clicked();
void on_pushButtonSCSI2_clicked();
void on_pushButtonSCSI1_clicked();
void on_comboBoxSCSI4_currentIndexChanged(int index);
void on_comboBoxSCSI3_currentIndexChanged(int index);
void on_comboBoxSCSI2_currentIndexChanged(int index);
void on_comboBoxSCSI1_currentIndexChanged(int index);
void on_pushButtonQuaternaryIDE_clicked();
void on_pushButtonTertiaryIDE_clicked();
void on_pushButtonFD_clicked();
void on_pushButtonHD_clicked();
void on_pushButtonCDInterface_clicked();
void on_checkBoxQuaternaryIDE_stateChanged(int arg1);
void on_checkBoxTertiaryIDE_stateChanged(int arg1);
void on_comboBoxFD_currentIndexChanged(int index);
void on_pushButtonFD_clicked();
void on_comboBoxHD_currentIndexChanged(int index);
void on_pushButtonHD_clicked();
void on_comboBoxCDInterface_currentIndexChanged(int index);
void on_pushButtonCDInterface_clicked();
void on_checkBoxTertiaryIDE_stateChanged(int arg1);
void on_pushButtonTertiaryIDE_clicked();
void on_checkBoxQuaternaryIDE_stateChanged(int arg1);
void on_pushButtonQuaternaryIDE_clicked();
void on_comboBoxSCSI1_currentIndexChanged(int index);
void on_pushButtonSCSI1_clicked();
void on_comboBoxSCSI2_currentIndexChanged(int index);
void on_pushButtonSCSI2_clicked();
void on_comboBoxSCSI3_currentIndexChanged(int index);
void on_pushButtonSCSI3_clicked();
void on_comboBoxSCSI4_currentIndexChanged(int index);
void on_pushButtonSCSI4_clicked();
void on_checkBoxLbaEnhancer_stateChanged(int arg1);
void on_pushButtonConfigureLbaEnhancer_clicked();
private:

View File

@@ -29,13 +29,20 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelFD">
<property name="text">
<string>HD Controller:</string>
<string>FD Controller:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxFD">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonFD">
<property name="text">
<string>Configure</string>
@@ -43,14 +50,34 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelHD">
<property name="text">
<string>FD Controller:</string>
<string>HD Controller:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxHD">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonHD">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="labelCDInterface">
<property name="text">
<string>CD-ROM Controller:</string>
</property>
@@ -70,33 +97,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxHD">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonHD">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxFD">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxTertiaryIDE">
<property name="text">
@@ -104,13 +104,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxQuaternaryIDE">
<property name="text">
<string>Quaternary IDE Controller</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonTertiaryIDE">
<property name="enabled">
@@ -121,6 +114,13 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxQuaternaryIDE">
<property name="text">
<string>Quaternary IDE Controller</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonQuaternaryIDE">
<property name="enabled">
@@ -134,29 +134,15 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBoxSCSI">
<property name="title">
<string>SCSI</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonSCSI2">
<layout class="QGridLayout" name="gridLayoutSCSI">
<item row="0" column="0">
<widget class="QLabel" name="labelSCSI1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonSCSI4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Controller 3:</string>
<string>Controller 1:</string>
</property>
</widget>
</item>
@@ -180,6 +166,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSCSI2">
<property name="text">
<string>Controller 2:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxSCSI2">
<property name="sizePolicy">
@@ -193,6 +186,20 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonSCSI2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSCSI3">
<property name="text">
<string>Controller 3:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="comboBoxSCSI3">
<property name="sizePolicy">
@@ -206,6 +213,20 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonSCSI3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelSCSI4">
<property name="text">
<string>Controller 4:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="comboBoxSCSI4">
<property name="sizePolicy">
@@ -219,29 +240,8 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Controller 1:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Controller 2:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Controller 4:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonSCSI3">
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonSCSI4">
<property name="text">
<string>Configure</string>
</property>

View File

@@ -92,6 +92,29 @@ DlgFilter(std::initializer_list<QString> extensions, bool last)
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
}
QString
DlgFilter(QStringList extensions, bool last)
{
QStringList temp;
for (auto ext : extensions) {
#ifdef Q_OS_UNIX
if (ext == "*") {
temp.append("*");
continue;
}
temp.append("*." % ext.toUpper());
#endif
temp.append("*." % ext);
}
#ifdef Q_OS_UNIX
temp.removeDuplicates();
#endif
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
}
QString currentUuid()
{
auto configPath = QFileInfo(cfg_path).dir().canonicalPath();

View File

@@ -11,6 +11,7 @@ namespace util {
static constexpr auto UUID_MIN_LENGTH = 36;
/* Creates extension list for qt filedialog */
QString DlgFilter(std::initializer_list<QString> extensions, bool last = false);
QString DlgFilter(QStringList extensions, bool last = false);
/* Returns screen the widget is on */
QScreen *screenOfWidget(QWidget *widget);
#ifdef Q_OS_WINDOWS

View File

@@ -161,6 +161,7 @@ fluidsynth_init(UNUSED(const device_t *info))
fluid_settings_setnum(data->settings, "synth.sample-rate", 44100);
fluid_settings_setnum(data->settings, "synth.gain", device_get_config_int("output_gain") / 100.0f);
fluid_settings_setint(data->settings, "synth.dynamic-sample-loading", device_get_config_int("dynamic_sample_loading"));
data->synth = new_fluid_synth(data->settings);
@@ -324,7 +325,7 @@ static const device_config_t fluidsynth_config[] = {
.type = CONFIG_FNAME,
.default_string = NULL,
.default_int = 0,
.file_filter = "SF2 Sound Fonts (*.sf2)|*.sf2",
.file_filter = "SoundFont files (*.sf2 *.sf3)|*.sf2,*.sf3",
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
@@ -509,6 +510,17 @@ static const device_config_t fluidsynth_config[] = {
},
.bios = { { 0 } }
},
{
.name = "dynamic_sample_loading",
.description = "Dynamic Sample Loading",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};

View File

@@ -731,9 +731,11 @@ ad1848_poll(void *priv)
if (!(ad1848->status & 0x01)) {
ad1848->status |= 0x01;
ad1848->regs[24] |= 0x10;
if (ad1848->regs[10] & 2)
picint(1 << ad1848->irq);
}
if (ad1848->regs[10] & 2)
picint(1 << ad1848->irq);
else
picintc(1 << ad1848->irq);
}
if (!(ad1848->adpcm_pos & 7)) /* ADPCM counts down every 4 bytes */

View File

@@ -3693,10 +3693,10 @@ ibm8514_poll(void *priv)
svga->render8514(svga);
svga->x_add = (overscan_x >> 1);
svga->x_add = svga->left_overscan;
ibm8514_render_overscan_left(dev, svga);
ibm8514_render_overscan_right(dev, svga);
svga->x_add = (overscan_x >> 1);
svga->x_add = svga->left_overscan;
if (dev->hwcursor_on) {
if (svga->hwcursor_draw)
@@ -3796,7 +3796,7 @@ ibm8514_poll(void *priv)
dev->dispon = 1;
dev->displine = (dev->interlace && dev->oddeven) ? 1 : 0;
svga->x_add = (overscan_x >> 1);
svga->x_add = svga->left_overscan;
dev->hwcursor_on = 0;
dev->hwcursor_latch = dev->hwcursor;
@@ -3966,7 +3966,7 @@ ibm8514_init(const device_t *info)
bios_addr = 0xc6000;
switch (dev->extensions) {
case 1:
case ATI:
if (rom_present(BIOS_MACH8_ROM_PATH)) {
mach_t * mach = (mach_t *) calloc(1, sizeof(mach_t));
svga->ext8514 = mach;
@@ -3977,13 +3977,14 @@ ibm8514_init(const device_t *info)
0, MEM_MAPPING_EXTERNAL);
ati8514_init(svga, svga->ext8514, svga->dev8514);
mach->accel.scratch0 = ((((bios_addr >> 7) - 0x1000) >> 4));
mach->accel.scratch0 = ((bios_addr >> 7) - 0x1000) >> 4;
bios_rom_eeprom = mach->accel.scratch0;
if (dev->type & DEVICE_MCA) {
dev->pos_regs[0] = 0x88;
dev->pos_regs[1] = 0x80;
mach->eeprom.data[0] = 0x0000;
mach->eeprom.data[1] = bios_rom_eeprom | ((bios_rom_eeprom | 0x01) << 8);
ibm8514_log("EEPROM Data1=%04x.\n", mach->eeprom.data[1]);
mca_add(ati8514_mca_read, ati8514_mca_write, ibm8514_mca_feedb, ibm8514_mca_reset, svga);
ati_eeprom_load_mach8(&mach->eeprom, "ati8514_mca.nvr", 1);
mem_mapping_disable(&dev->bios_rom.mapping);
@@ -4067,12 +4068,12 @@ static const device_config_t isa_ext8514_config[] = {
.description = "Vendor",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.default_int = IBM,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IBM", .value = 0 },
{ .description = "ATI", .value = 1 },
{ .description = "IBM", .value = IBM },
{ .description = "ATI", .value = ATI },
{ .description = "" }
},
.bios = { { 0 } }
@@ -4127,12 +4128,12 @@ static const device_config_t mca_ext8514_config[] = {
.description = "Vendor",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.default_int = IBM,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IBM", .value = 0 },
{ .description = "ATI", .value = 1 },
{ .description = "IBM", .value = IBM },
{ .description = "ATI", .value = ATI },
{ .description = "" }
},
.bios = { { 0 } }
@@ -4145,7 +4146,7 @@ const device_t gen8514_isa_device = {
.name = "IBM 8514/A clone (ISA)",
.internal_name = "8514_isa",
.flags = DEVICE_ISA16,
.local = 0,
.local = IBM_8514A_TYPE,
.init = ibm8514_init,
.close = ibm8514_close,
.reset = NULL,
@@ -4159,7 +4160,7 @@ const device_t ibm8514_mca_device = {
.name = "IBM 8514/A (MCA)",
.internal_name = "8514_mca",
.flags = DEVICE_MCA,
.local = 0,
.local = IBM_8514A_TYPE,
.init = ibm8514_init,
.close = ibm8514_close,
.reset = NULL,

View File

@@ -7409,7 +7409,7 @@ const device_t mach8_vga_isa_device = {
.name = "ATI Mach8 (ATI Graphics Ultra) (ISA)",
.internal_name = "mach8_vga_isa",
.flags = DEVICE_ISA,
.local = 1,
.local = ATI_38800_TYPE,
.init = mach8_init,
.close = mach_close,
.reset = mach_reset,
@@ -7423,7 +7423,7 @@ const device_t mach32_isa_device = {
.name = "ATI Mach32 (ISA)",
.internal_name = "mach32_isa",
.flags = DEVICE_ISA,
.local = 2,
.local = ATI_68800_TYPE,
.init = mach8_init,
.close = mach_close,
.reset = mach_reset,
@@ -7437,7 +7437,7 @@ const device_t mach32_vlb_device = {
.name = "ATI Mach32 (VLB)",
.internal_name = "mach32_vlb",
.flags = DEVICE_VLB,
.local = 2,
.local = ATI_68800_TYPE,
.init = mach8_init,
.close = mach_close,
.reset = mach_reset,
@@ -7451,7 +7451,7 @@ const device_t mach32_mca_device = {
.name = "ATI Mach32 (MCA)",
.internal_name = "mach32_mca",
.flags = DEVICE_MCA,
.local = 2,
.local = ATI_68800_TYPE,
.init = mach8_init,
.close = mach_close,
.reset = mach_reset,
@@ -7465,7 +7465,7 @@ const device_t mach32_pci_device = {
.name = "ATI Mach32 (PCI)",
.internal_name = "mach32_pci",
.flags = DEVICE_PCI,
.local = 2,
.local = ATI_68800_TYPE,
.init = mach8_init,
.close = mach_close,
.reset = mach_reset,
@@ -7479,7 +7479,7 @@ const device_t mach32_onboard_pci_device = {
.name = "ATI Mach32 (PCI) On-Board",
.internal_name = "mach32_pci_onboard",
.flags = DEVICE_PCI,
.local = 2 | 0x100,
.local = ATI_68800_TYPE | 0x100,
.init = mach8_init,
.close = mach_close,
.reset = mach_reset,

View File

@@ -16,7 +16,7 @@
*
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2023 W. M. Martinez
* Copyright 2023 W. M. Martine
*/
#include <stdio.h>
#include <stdint.h>
@@ -73,10 +73,10 @@ void cga_recalctimings(cga_t *cga);
static void
cga_update_latch(cga_t *cga)
{
uint32_t lp_latch = cga->displine * cga->crtc[1];
uint32_t lp_latch = cga->displine * cga->crtc[CGA_CRTC_HDISP];
cga->crtc[0x10] = (lp_latch >> 8) & 0x3f;
cga->crtc[0x11] = lp_latch & 0xff;
cga->crtc[CGA_CRTC_LIGHT_PEN_ADDR_LOW] = lp_latch & 0xff;
}
void
@@ -89,20 +89,22 @@ cga_out(uint16_t addr, uint8_t val, void *priv)
addr = (addr & 0xff9) | 0x004;
switch (addr) {
case 0x3D4:
case CGA_REGISTER_CRTC_INDEX:
cga->crtcreg = val & 31;
return;
case 0x3D5:
case CGA_REGISTER_CRTC_DATA:
old = cga->crtc[cga->crtcreg];
cga->crtc[cga->crtcreg] = val & crtcmask[cga->crtcreg];
if (old != val) {
// Recalc the timings if we are writing any invalid CRTC register or a valid CRTC register
// except the CURSOR and LIGHT PEN registers
if ((cga->crtcreg < 0xe) || (cga->crtcreg > 0x11)) {
cga->fullchange = changeframecount;
cga_recalctimings(cga);
}
}
return;
case 0x3D8:
case CGA_REGISTER_MODE_CONTROL:
old = cga->cgamode;
cga->cgamode = val;
@@ -113,18 +115,18 @@ cga_out(uint16_t addr, uint8_t val, void *priv)
cga_recalctimings(cga);
}
return;
case 0x3D9:
case CGA_REGISTER_COLOR_SELECT:
old = cga->cgacol;
cga->cgacol = val;
if (old ^ val)
cga_recalctimings(cga);
return;
case 0x3DB:
case CGA_REGISTER_CLEAR_LIGHT_PEN_LATCH:
if (cga->lp_strobe == 1)
cga->lp_strobe = 0;
return;
case 0x3DC:
case CGA_REGISTER_SET_LIGHT_PEN_LATCH:
if (cga->lp_strobe == 0) {
cga->lp_strobe = 1;
cga_update_latch(cga);
@@ -146,21 +148,20 @@ cga_in(uint16_t addr, void *priv)
addr = (addr & 0xff9) | 0x004;
switch (addr) {
case 0x3D4:
case CGA_REGISTER_CRTC_INDEX:
ret = cga->crtcreg;
break;
case 0x3D5:
case CGA_REGISTER_CRTC_DATA:
ret = cga->crtc[cga->crtcreg];
break;
case 0x3DA:
case CGA_REGISTER_STATUS:
ret = cga->cgastat;
break;
case 0x3DB:
case CGA_REGISTER_CLEAR_LIGHT_PEN_LATCH:
if (cga->lp_strobe == 1)
cga->lp_strobe = 0;
break;
case 0x3DC:
case CGA_REGISTER_SET_LIGHT_PEN_LATCH:
if (cga->lp_strobe == 0) {
cga->lp_strobe = 1;
cga_update_latch(cga);
@@ -235,12 +236,12 @@ cga_recalctimings(cga_t *cga)
double _dispontime;
double _dispofftime;
if (cga->cgamode & 1) {
disptime = (double) (cga->crtc[0] + 1);
_dispontime = (double) cga->crtc[1];
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) {
disptime = (double) (cga->crtc[CGA_CRTC_HTOTAL] + 1);
_dispontime = (double) cga->crtc[CGA_CRTC_HDISP];
} else {
disptime = (double) ((cga->crtc[0] + 1) << 1);
_dispontime = (double) (cga->crtc[1] << 1);
disptime = (double) ((cga->crtc[CGA_CRTC_HTOTAL] + 1) << 1);
_dispontime = (double) (cga->crtc[CGA_CRTC_HDISP] << 1);
}
_dispofftime = disptime - _dispontime;
_dispontime = _dispontime * CGACONST;
@@ -252,7 +253,7 @@ cga_recalctimings(cga_t *cga)
static void
cga_render(cga_t *cga, int line)
{
uint16_t ca = (cga->crtc[15] | (cga->crtc[14] << 8)) & 0x3fff;
uint16_t ca = (cga->crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (cga->crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
int drawcursor;
int x;
int c;
@@ -262,33 +263,35 @@ cga_render(cga_t *cga, int line)
int cols[4];
int col;
if ((cga->cgamode & 0x12) == 0x12) {
int32_t highres_graphics_flag = (CGA_MODE_FLAG_HIGHRES_GRAPHICS | CGA_MODE_FLAG_GRAPHICS);
if (((cga->cgamode & highres_graphics_flag) == highres_graphics_flag)) {
for (c = 0; c < 8; ++c) {
buffer32->line[line][c] = 0;
if (cga->cgamode & 1)
buffer32->line[line][c + (cga->crtc[1] << 3) + 8] = 0;
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
buffer32->line[line][c + (cga->crtc[CGA_CRTC_HDISP] << 3) + 8] = 0;
else
buffer32->line[line][c + (cga->crtc[1] << 4) + 8] = 0;
buffer32->line[line][c + (cga->crtc[CGA_CRTC_HDISP] << 4) + 8] = 0;
}
} else {
for (c = 0; c < 8; ++c) {
buffer32->line[line][c] = (cga->cgacol & 15) + 16;
if (cga->cgamode & 1)
buffer32->line[line][c + (cga->crtc[1] << 3) + 8] = (cga->cgacol & 15) + 16;
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
buffer32->line[line][c + (cga->crtc[CGA_CRTC_HDISP] << 3) + 8] = (cga->cgacol & 15) + 16;
else
buffer32->line[line][c + (cga->crtc[1] << 4) + 8] = (cga->cgacol & 15) + 16;
buffer32->line[line][c + (cga->crtc[CGA_CRTC_HDISP] << 4) + 8] = (cga->cgacol & 15) + 16;
}
}
if (cga->cgamode & 1) {
for (x = 0; x < cga->crtc[1]; x++) {
if (cga->cgamode & 8) {
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) {
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
if (cga->cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
chr = cga->charbuffer[x << 1];
attr = cga->charbuffer[(x << 1) + 1];
} else
chr = attr = 0;
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
cols[1] = (attr & 15) + 16;
if (cga->cgamode & 0x20) {
if (cga->cgamode & CGA_MODE_FLAG_BLINK) {
cols[0] = ((attr >> 4) & 7) + 16;
if ((cga->cgablink & 8) && (attr & 0x80) && !cga->drawcursor)
cols[1] = cols[0];
@@ -308,15 +311,15 @@ cga_render(cga_t *cga, int line)
cga->ma++;
}
} else if (!(cga->cgamode & 2)) {
for (x = 0; x < cga->crtc[1]; x++) {
if (cga->cgamode & 8) {
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
if (cga->cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
chr = cga->vram[(cga->ma << 1) & 0x3fff];
attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff];
} else
chr = attr = 0;
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
cols[1] = (attr & 15) + 16;
if (cga->cgamode & 0x20) {
if (cga->cgamode & CGA_MODE_FLAG_BLINK) {
cols[0] = ((attr >> 4) & 7) + 16;
if ((cga->cgablink & 8) && (attr & 0x80))
cols[1] = cols[0];
@@ -337,10 +340,10 @@ cga_render(cga_t *cga, int line)
}
}
}
} else if (!(cga->cgamode & 16)) {
} else if (!(cga->cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
cols[0] = (cga->cgacol & 15) | 16;
col = (cga->cgacol & 16) ? 24 : 16;
if (cga->cgamode & 4) {
if (cga->cgamode & CGA_MODE_FLAG_BW) {
cols[1] = col | 3; /* Cyan */
cols[2] = col | 4; /* Red */
cols[3] = col | 7; /* White */
@@ -353,8 +356,8 @@ cga_render(cga_t *cga, int line)
cols[2] = col | 4; /* Red */
cols[3] = col | 6; /* Yellow */
}
for (x = 0; x < cga->crtc[1]; x++) {
if (cga->cgamode & 8)
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
if (cga->cgamode & CGA_MODE_FLAG_VIDEO_ENABLE)
dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) |
cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1];
else
@@ -370,8 +373,8 @@ cga_render(cga_t *cga, int line)
} else {
cols[0] = 0;
cols[1] = (cga->cgacol & 15) + 16;
for (x = 0; x < cga->crtc[1]; x++) {
if (cga->cgamode & 8)
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
if (cga->cgamode & CGA_MODE_FLAG_VIDEO_ENABLE)
dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) |
cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1];
else
@@ -388,12 +391,14 @@ cga_render(cga_t *cga, int line)
static void
cga_render_blank(cga_t *cga, int line)
{
int col = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15) + 16;
int32_t highres_graphics_flag = (CGA_MODE_FLAG_HIGHRES_GRAPHICS | CGA_MODE_FLAG_GRAPHICS);
if (cga->cgamode & 1)
hline(buffer32, 0, line, (cga->crtc[1] << 3) + 16, col);
int col = ((cga->cgamode & highres_graphics_flag) == highres_graphics_flag) ? 0 : (cga->cgacol & 15) + 16;
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
hline(buffer32, 0, line, (cga->crtc[CGA_CRTC_HDISP] << 3) + 16, col);
else
hline(buffer32, 0, line, (cga->crtc[1] << 4) + 16, col);
hline(buffer32, 0, line, (cga->crtc[CGA_CRTC_HDISP] << 4) + 16, col);
}
static void
@@ -401,14 +406,15 @@ cga_render_process(cga_t *cga, int line)
{
int x;
uint8_t border;
int32_t highres_graphics_flag = (CGA_MODE_FLAG_HIGHRES_GRAPHICS | CGA_MODE_FLAG_GRAPHICS);
if (cga->cgamode & 1)
x = (cga->crtc[1] << 3) + 16;
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
x = (cga->crtc[CGA_CRTC_HDISP] << 3) + 16;
else
x = (cga->crtc[1] << 4) + 16;
x = (cga->crtc[CGA_CRTC_HDISP] << 4) + 16;
if (cga->composite) {
border = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15);
border = ((cga->cgamode & highres_graphics_flag) == highres_graphics_flag) ? 0 : (cga->cgacol & 15);
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[line]);
} else
@@ -524,7 +530,7 @@ cga_poll(void *priv)
cga->cgastat |= 1;
cga->linepos = 1;
oldsc = cga->sc;
if ((cga->crtc[8] & 3) == 3)
if ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3)
cga->sc = ((cga->sc << 1) + cga->oddeven) & 7;
if (cga->cgadispon) {
if (cga->displine < cga->firstline) {
@@ -573,7 +579,7 @@ cga_poll(void *priv)
}
cga->sc = oldsc;
if (cga->vc == cga->crtc[7] && !cga->sc)
if (cga->vc == cga->crtc[CGA_CRTC_VSYNC] && !cga->sc)
cga->cgastat |= 8;
cga->displine++;
if (cga->displine >= 360)
@@ -586,12 +592,11 @@ cga_poll(void *priv)
if (!cga->vsynctime)
cga->cgastat &= ~8;
}
if (cga->sc == (cga->crtc[11] & 31) || ((cga->crtc[8] & 3) == 3 &&
cga->sc == ((cga->crtc[11] & 31) >> 1))) {
if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_END] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 &&
cga->sc == ((cga->crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) {
cga->con = 0;
cga->coff = 1;
}
if ((cga->crtc[8] & 3) == 3 && cga->sc == (cga->crtc[9] >> 1))
if ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == (cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
cga->maback = cga->ma;
if (cga->vadj) {
cga->sc++;
@@ -600,27 +605,27 @@ cga_poll(void *priv)
cga->vadj--;
if (!cga->vadj) {
cga->cgadispon = 1;
cga->ma = cga->maback = (cga->crtc[13] | (cga->crtc[12] << 8)) & 0x3fff;
cga->ma = cga->maback = (cga->crtc[CGA_CRTC_START_ADDR_LOW] | (cga->crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
cga->sc = 0;
}
} else if (cga->sc == cga->crtc[9]) {
} else if (cga->sc == cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR]) {
cga->maback = cga->ma;
cga->sc = 0;
oldvc = cga->vc;
cga->vc++;
cga->vc &= 127;
if (cga->vc == cga->crtc[6])
if (cga->vc == cga->crtc[CGA_CRTC_VDISP])
cga->cgadispon = 0;
if (oldvc == cga->crtc[4]) {
if (oldvc == cga->crtc[CGA_CRTC_VTOTAL]) {
cga->vc = 0;
cga->vadj = cga->crtc[5];
cga->vadj = cga->crtc[CGA_CRTC_VTOTAL_ADJUST];
if (!cga->vadj) {
cga->cgadispon = 1;
cga->ma = cga->maback = (cga->crtc[13] | (cga->crtc[12] << 8)) & 0x3fff;
cga->ma = cga->maback = (cga->crtc[CGA_CRTC_START_ADDR_LOW] | (cga->crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
}
switch (cga->crtc[10] & 0x60) {
switch (cga->crtc[CGA_CRTC_CURSOR_START] & 0x60) {
case 0x20:
cga->cursoron = 0;
break;
@@ -633,15 +638,15 @@ cga_poll(void *priv)
}
}
if (cga->vc == cga->crtc[7]) {
if (cga->vc == cga->crtc[CGA_CRTC_VSYNC]) {
cga->cgadispon = 0;
cga->displine = 0;
cga->vsynctime = 16;
if (cga->crtc[7]) {
if (cga->cgamode & 1)
x = (cga->crtc[1] << 3) + 16;
if (cga->crtc[CGA_CRTC_VSYNC]) {
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
x = (cga->crtc[CGA_CRTC_HDISP] << 3) + 16;
else
x = (cga->crtc[1] << 4) + 16;
x = (cga->crtc[CGA_CRTC_HDISP] << 4) + 16;
cga->lastline++;
xs_temp = x;
@@ -657,7 +662,7 @@ cga_poll(void *priv)
if (!enable_overscan)
xs_temp -= 16;
if ((cga->cgamode & 8) && ((xs_temp != xsize) ||
if ((cga->cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && ((xs_temp != xsize) ||
(ys_temp != ysize) || video_force_resize_get())) {
xsize = xs_temp;
ysize = ys_temp;
@@ -691,15 +696,15 @@ cga_poll(void *priv)
video_res_x = xsize;
video_res_y = ysize;
if (cga->cgamode & 1) {
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) {
video_res_x /= 8;
video_res_y /= cga->crtc[9] + 1;
video_res_y /= cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
video_bpp = 0;
} else if (!(cga->cgamode & 2)) {
} else if (!(cga->cgamode & CGA_MODE_FLAG_GRAPHICS)) {
video_res_x /= 16;
video_res_y /= cga->crtc[9] + 1;
video_res_y /= cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
video_bpp = 0;
} else if (!(cga->cgamode & 16)) {
} else if (!(cga->cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
video_res_x /= 2;
video_bpp = 2;
} else
@@ -717,11 +722,11 @@ cga_poll(void *priv)
}
if (cga->cgadispon)
cga->cgastat &= ~1;
if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 &&
cga->sc == ((cga->crtc[10] & 31) >> 1)))
if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_START] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 &&
cga->sc == ((cga->crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
cga->con = 1;
if (cga->cgadispon && (cga->cgamode & 1)) {
for (x = 0; x < (cga->crtc[1] << 1); x++)
if (cga->cgadispon && (cga->cgamode & CGA_MODE_FLAG_HIGHRES)) {
for (x = 0; x < (cga->crtc[CGA_CRTC_HDISP] << 1); x++)
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];
}
}

View File

@@ -42,9 +42,6 @@
#define COLORPLUS_320x200_MODE 0x10 /* 320x200x16 mode active */
#define COLORPLUS_EITHER_MODE 0x30 /* Either mode active */
/* Bits in the CGA graphics mode register */
#define CGA_GRAPHICS_MODE 0x02 /* CGA graphics mode selected? */
#define CGA_RGB 0
#define CGA_COMPOSITE 1
@@ -80,7 +77,7 @@ colorplus_write(uint32_t addr, uint8_t val, void *priv)
{
colorplus_t *colorplus = (colorplus_t *) priv;
if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_GRAPHICS_MODE)) {
if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
addr ^= 0x4000;
} else if (!(colorplus->control & COLORPLUS_EITHER_MODE)) {
addr &= 0x3FFF;
@@ -99,7 +96,7 @@ colorplus_read(uint32_t addr, void *priv)
{
colorplus_t *colorplus = (colorplus_t *) priv;
if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_GRAPHICS_MODE)) {
if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
addr ^= 0x4000;
} else if (!(colorplus->control & COLORPLUS_EITHER_MODE)) {
addr &= 0x3FFF;
@@ -140,7 +137,7 @@ colorplus_poll(void *priv)
/* If one of the extra modes is not selected, drop down to the CGA
* drawing code. */
if (!((colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_GRAPHICS_MODE))) {
if (!((colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_MODE_FLAG_GRAPHICS))) {
cga_poll(&colorplus->cga);
return;
}
@@ -229,7 +226,6 @@ colorplus_poll(void *priv)
}
if (colorplus->cga.sc == (colorplus->cga.crtc[11] & 31) || ((colorplus->cga.crtc[8] & 3) == 3 && colorplus->cga.sc == ((colorplus->cga.crtc[11] & 31) >> 1))) {
colorplus->cga.con = 0;
colorplus->cga.coff = 1;
}
if ((colorplus->cga.crtc[8] & 3) == 3 && colorplus->cga.sc == (colorplus->cga.crtc[9] >> 1))
colorplus->cga.maback = colorplus->cga.ma;

View File

@@ -44,10 +44,6 @@
static uint32_t vflags;
static uint8_t mdaattr[256][2][2];
typedef struct compaq_cga_t {
cga_t cga;
} compaq_cga_t;
#ifdef ENABLE_COMPAQ_CGA_LOG
int compaq_cga_do_log = ENABLE_COMPAQ_CGA_LOG;
@@ -66,93 +62,93 @@ compaq_cga_log(const char *fmt, ...)
# define compaq_cga_log(fmt, ...)
#endif
void
compaq_cga_recalctimings(compaq_cga_t *self)
static void
compaq_cga_recalctimings(cga_t *dev)
{
double _dispontime;
double _dispofftime;
double disptime;
disptime = self->cga.crtc[0] + 1;
disptime = dev->crtc[0] + 1;
_dispontime = self->cga.crtc[1];
_dispontime = dev->crtc[1];
_dispofftime = disptime - _dispontime;
_dispontime *= MDACONST;
_dispofftime *= MDACONST;
self->cga.dispontime = (uint64_t) (_dispontime);
self->cga.dispofftime = (uint64_t) (_dispofftime);
dev->dispontime = (uint64_t) (_dispontime);
dev->dispofftime = (uint64_t) (_dispofftime);
}
void
static void
compaq_cga_poll(void *priv)
{
compaq_cga_t *self = (compaq_cga_t *) priv;
uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr;
uint8_t attr;
uint8_t border;
uint8_t cols[4];
int oldsc;
int underline = 0;
int blink = 0;
cga_t *dev = (cga_t *) priv;
uint16_t ca = (dev->crtc[15] | (dev->crtc[14] << 8)) & 0x3fff;
int underline = 0;
int blink = 0;
int drawcursor;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr;
uint8_t attr;
uint8_t border;
uint8_t cols[4];
int oldsc;
/* If in graphics mode or character height is not 13, behave as CGA */
if ((self->cga.cgamode & 0x12) || (self->cga.crtc[9] != 13)) {
if ((dev->cgamode & 0x12) || (dev->crtc[9] != 13)) {
overscan_x = overscan_y = 16;
cga_poll(&self->cga);
cga_poll(dev);
return;
} else
overscan_x = overscan_y = 0;
/* We are in Compaq 350-line CGA territory */
if (!self->cga.linepos) {
timer_advance_u64(&self->cga.timer, self->cga.dispofftime);
self->cga.cgastat |= 1;
self->cga.linepos = 1;
oldsc = self->cga.sc;
if ((self->cga.crtc[8] & 3) == 3)
self->cga.sc = ((self->cga.sc << 1) + self->cga.oddeven) & 7;
if (self->cga.cgadispon) {
if (self->cga.displine < self->cga.firstline) {
self->cga.firstline = self->cga.displine;
if (!dev->linepos) {
timer_advance_u64(&dev->timer, dev->dispofftime);
dev->cgastat |= 1;
dev->linepos = 1;
oldsc = dev->sc;
if ((dev->crtc[8] & 3) == 3)
dev->sc = ((dev->sc << 1) + dev->oddeven) & 7;
if (dev->cgadispon) {
if (dev->displine < dev->firstline) {
dev->firstline = dev->displine;
video_wait_for_buffer();
compaq_cga_log("Firstline %i\n", self->cga.firstline);
compaq_cga_log("Firstline %i\n", dev->firstline);
}
self->cga.lastline = self->cga.displine;
dev->lastline = dev->displine;
cols[0] = (self->cga.cgacol & 15) + 16;
cols[0] = (dev->cgacol & 15) + 16;
for (c = 0; c < 8; c++) {
buffer32->line[self->cga.displine][c] = cols[0];
if (self->cga.cgamode & 1)
buffer32->line[self->cga.displine][c + (self->cga.crtc[1] << 3) + 8] = cols[0];
buffer32->line[dev->displine][c] = cols[0];
if (dev->cgamode & 1)
buffer32->line[dev->displine][c + (dev->crtc[1] << 3) + 8] = cols[0];
else
buffer32->line[self->cga.displine][c + (self->cga.crtc[1] << 4) + 8] = cols[0];
buffer32->line[dev->displine][c + (dev->crtc[1] << 4) + 8] = cols[0];
}
if (self->cga.cgamode & 1) {
for (x = 0; x < self->cga.crtc[1]; x++) {
chr = self->cga.charbuffer[x << 1];
attr = self->cga.charbuffer[(x << 1) + 1];
drawcursor = ((self->cga.ma == ca) && self->cga.con && self->cga.cursoron);
if (dev->cgamode & 1) {
for (x = 0; x < dev->crtc[1]; x++) {
chr = dev->charbuffer[x << 1];
attr = dev->charbuffer[(x << 1) + 1];
drawcursor = ((dev->ma == ca) && dev->con && dev->cursoron);
if (vflags) {
underline = 0;
blink = ((self->cga.cgablink & 8) && (self->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
blink = ((dev->cgablink & 8) && (dev->cgamode & 0x20) && (attr & 0x80) && !drawcursor);
}
if (vflags && (self->cga.cgamode & 0x80)) {
if (vflags && (dev->cgamode & 0x80)) {
cols[0] = mdaattr[attr][blink][0];
cols[1] = mdaattr[attr][blink][1];
if ((self->cga.sc == 12) && ((attr & 7) == 1))
if ((dev->sc == 12) && ((attr & 7) == 1))
underline = 1;
} else if (self->cga.cgamode & 0x20) {
} else if (dev->cgamode & 0x20) {
cols[1] = (attr & 15) + 16;
cols[0] = ((attr >> 4) & 7) + 16;
@@ -160,7 +156,7 @@ compaq_cga_poll(void *priv)
if (blink)
cols[1] = cols[0];
} else {
if ((self->cga.cgablink & 8) && (attr & 0x80) && !self->cga.drawcursor)
if ((dev->cgablink & 8) && (attr & 0x80) && !dev->drawcursor)
cols[1] = cols[0];
}
} else {
@@ -170,33 +166,35 @@ compaq_cga_poll(void *priv)
if (vflags && underline) {
for (c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c + 8] = mdaattr[attr][blink][1];
buffer32->line[dev->displine][(x << 3) + c + 8] = mdaattr[attr][blink][1];
} else if (drawcursor) {
for (c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c + 8] = cols[(fontdatm[chr + self->cga.fontbase][self->cga.sc & 15] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
buffer32->line[dev->displine][(x << 3) + c + 8] =
cols[(fontdatm[chr + dev->fontbase][dev->sc & 15] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
} else {
for (c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c + 8] = cols[(fontdatm[chr + self->cga.fontbase][self->cga.sc & 15] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[dev->displine][(x << 3) + c + 8] =
cols[(fontdatm[chr + dev->fontbase][dev->sc & 15] & (1 << (c ^ 7))) ? 1 : 0];
}
self->cga.ma++;
dev->ma++;
}
} else {
for (x = 0; x < self->cga.crtc[1]; x++) {
chr = self->cga.vram[(self->cga.ma << 1) & 0x3fff];
attr = self->cga.vram[((self->cga.ma << 1) + 1) & 0x3fff];
drawcursor = ((self->cga.ma == ca) && self->cga.con && self->cga.cursoron);
for (x = 0; x < dev->crtc[1]; x++) {
chr = dev->vram[(dev->ma << 1) & 0x3fff];
attr = dev->vram[((dev->ma << 1) + 1) & 0x3fff];
drawcursor = ((dev->ma == ca) && dev->con && dev->cursoron);
if (vflags) {
underline = 0;
blink = ((self->cga.cgablink & 8) && (self->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
blink = ((dev->cgablink & 8) && (dev->cgamode & 0x20) && (attr & 0x80) && !drawcursor);
}
if (vflags && (self->cga.cgamode & 0x80)) {
if (vflags && (dev->cgamode & 0x80)) {
cols[0] = mdaattr[attr][blink][0];
cols[1] = mdaattr[attr][blink][1];
if (self->cga.sc == 12 && (attr & 7) == 1)
if (dev->sc == 12 && (attr & 7) == 1)
underline = 1;
} else if (self->cga.cgamode & 0x20) {
} else if (dev->cgamode & 0x20) {
cols[1] = (attr & 15) + 16;
cols[0] = ((attr >> 4) & 7) + 16;
@@ -204,129 +202,134 @@ compaq_cga_poll(void *priv)
if (blink)
cols[1] = cols[0];
} else {
if ((self->cga.cgablink & 8) && (attr & 0x80) && !self->cga.drawcursor)
if ((dev->cgablink & 8) && (attr & 0x80) && !dev->drawcursor)
cols[1] = cols[0];
}
} else {
cols[1] = (attr & 15) + 16;
cols[0] = (attr >> 4) + 16;
}
self->cga.ma++;
dev->ma++;
if (vflags && underline) {
for (c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 9] = mdaattr[attr][blink][1];
buffer32->line[dev->displine][(x << 4) + (c << 1) + 8] =
buffer32->line[dev->displine][(x << 4) + (c << 1) + 9] = mdaattr[attr][blink][1];
} else if (drawcursor) {
for (c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr + self->cga.fontbase][self->cga.sc & 15] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
buffer32->line[dev->displine][(x << 4) + (c << 1) + 8] =
buffer32->line[dev->displine][(x << 4) + (c << 1) + 1 + 8] =
cols[(fontdatm[chr + dev->fontbase][dev->sc & 15] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
} else {
for (c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr + self->cga.fontbase][self->cga.sc & 15] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[dev->displine][(x << 4) + (c << 1) + 8] =
buffer32->line[dev->displine][(x << 4) + (c << 1) + 1 + 8] =
cols[(fontdatm[chr + dev->fontbase][dev->sc & 15] & (1 << (c ^ 7))) ? 1 : 0];
}
}
}
} else {
cols[0] = (self->cga.cgacol & 15) + 16;
cols[0] = (dev->cgacol & 15) + 16;
if (self->cga.cgamode & 1)
hline(buffer32, 0, self->cga.displine, (self->cga.crtc[1] << 3) + 16, cols[0]);
if (dev->cgamode & 1)
hline(buffer32, 0, dev->displine, (dev->crtc[1] << 3) + 16, cols[0]);
else
hline(buffer32, 0, self->cga.displine, (self->cga.crtc[1] << 4) + 16, cols[0]);
hline(buffer32, 0, dev->displine, (dev->crtc[1] << 4) + 16, cols[0]);
}
if (self->cga.cgamode & 1)
x = (self->cga.crtc[1] << 3) + 16;
if (dev->cgamode & 1)
x = (dev->crtc[1] << 3) + 16;
else
x = (self->cga.crtc[1] << 4) + 16;
x = (dev->crtc[1] << 4) + 16;
if (self->cga.composite) {
if (self->cga.cgamode & 0x10)
if (dev->composite) {
if (dev->cgamode & 0x10)
border = 0x00;
else
border = self->cga.cgacol & 0x0f;
border = dev->cgacol & 0x0f;
if (vflags)
Composite_Process(self->cga.cgamode & 0x7f, border, x >> 2, buffer32->line[self->cga.displine]);
Composite_Process(dev->cgamode & 0x7f, border, x >> 2, buffer32->line[dev->displine]);
else
Composite_Process(self->cga.cgamode, border, x >> 2, buffer32->line[self->cga.displine]);
Composite_Process(dev->cgamode, border, x >> 2, buffer32->line[dev->displine]);
} else
video_process_8(x, self->cga.displine);
video_process_8(x, dev->displine);
self->cga.sc = oldsc;
if (self->cga.vc == self->cga.crtc[7] && !self->cga.sc)
self->cga.cgastat |= 8;
self->cga.displine++;
if (self->cga.displine >= 500)
self->cga.displine = 0;
dev->sc = oldsc;
if (dev->vc == dev->crtc[7] && !dev->sc)
dev->cgastat |= 8;
dev->displine++;
if (dev->displine >= 500)
dev->displine = 0;
} else {
timer_advance_u64(&self->cga.timer, self->cga.dispontime);
self->cga.linepos = 0;
if (self->cga.vsynctime) {
self->cga.vsynctime--;
if (!self->cga.vsynctime)
self->cga.cgastat &= ~8;
timer_advance_u64(&dev->timer, dev->dispontime);
dev->linepos = 0;
if (dev->vsynctime) {
dev->vsynctime--;
if (!dev->vsynctime)
dev->cgastat &= ~8;
}
if (self->cga.sc == (self->cga.crtc[11] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[11] & 31) >> 1))) {
self->cga.con = 0;
self->cga.coff = 1;
if (dev->sc == (dev->crtc[11] & 31) || (((dev->crtc[8] & 3) == 3) &&
(dev->sc == ((dev->crtc[11] & 31) >> 1)))) {
dev->con = 0;
}
if ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == (self->cga.crtc[9] >> 1))
self->cga.maback = self->cga.ma;
if (self->cga.vadj) {
self->cga.sc++;
self->cga.sc &= 31;
self->cga.ma = self->cga.maback;
self->cga.vadj--;
if (!self->cga.vadj) {
self->cga.cgadispon = 1;
self->cga.ma = self->cga.maback = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x3fff;
self->cga.sc = 0;
if ((dev->crtc[8] & 3) == 3 && dev->sc == (dev->crtc[9] >> 1))
dev->maback = dev->ma;
if (dev->vadj) {
dev->sc++;
dev->sc &= 31;
dev->ma = dev->maback;
dev->vadj--;
if (!dev->vadj) {
dev->cgadispon = 1;
dev->ma = dev->maback = (dev->crtc[13] | (dev->crtc[12] << 8)) & 0x3fff;
dev->sc = 0;
}
} else if (self->cga.sc == self->cga.crtc[9]) {
self->cga.maback = self->cga.ma;
self->cga.sc = 0;
oldvc = self->cga.vc;
self->cga.vc++;
self->cga.vc &= 127;
} else if (dev->sc == dev->crtc[9]) {
dev->maback = dev->ma;
dev->sc = 0;
oldvc = dev->vc;
dev->vc++;
dev->vc &= 127;
if (self->cga.vc == self->cga.crtc[6])
self->cga.cgadispon = 0;
if (dev->vc == dev->crtc[6])
dev->cgadispon = 0;
if (oldvc == self->cga.crtc[4]) {
self->cga.vc = 0;
self->cga.vadj = self->cga.crtc[5];
if (oldvc == dev->crtc[4]) {
dev->vc = 0;
dev->vadj = dev->crtc[5];
if (!self->cga.vadj)
self->cga.cgadispon = 1;
if (!dev->vadj)
dev->cgadispon = 1;
if (!self->cga.vadj)
self->cga.ma = self->cga.maback = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x3fff;
if (!dev->vadj)
dev->ma = dev->maback = (dev->crtc[13] | (dev->crtc[12] << 8)) & 0x3fff;
if ((self->cga.crtc[10] & 0x60) == 0x20)
self->cga.cursoron = 0;
if ((dev->crtc[10] & 0x60) == 0x20)
dev->cursoron = 0;
else
self->cga.cursoron = self->cga.cgablink & 8;
dev->cursoron = dev->cgablink & 8;
}
if (self->cga.vc == self->cga.crtc[7]) {
self->cga.cgadispon = 0;
self->cga.displine = 0;
self->cga.vsynctime = 16;
if (dev->vc == dev->crtc[7]) {
dev->cgadispon = 0;
dev->displine = 0;
dev->vsynctime = 16;
if (self->cga.crtc[7]) {
compaq_cga_log("Lastline %i Firstline %i %i\n", self->cga.lastline,
self->cga.firstline, self->cga.lastline - self->cga.firstline);
if (dev->crtc[7]) {
compaq_cga_log("Lastline %i Firstline %i %i\n", dev->lastline,
dev->firstline, dev->lastline - dev->firstline);
if (self->cga.cgamode & 1)
x = (self->cga.crtc[1] << 3) + 16;
if (dev->cgamode & 1)
x = (dev->crtc[1] << 3) + 16;
else
x = (self->cga.crtc[1] << 4) + 16;
x = (dev->crtc[1] << 4) + 16;
self->cga.lastline++;
dev->lastline++;
xs_temp = x;
ys_temp = (self->cga.lastline - self->cga.firstline);
ys_temp = (dev->lastline - dev->firstline);
if ((xs_temp > 0) && (ys_temp > 0)) {
if (xs_temp < 64)
@@ -336,7 +339,8 @@ compaq_cga_poll(void *priv)
if (!enable_overscan)
xs_temp -= 16;
if ((self->cga.cgamode & 8) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
if ((dev->cgamode & 8) && ((xs_temp != xsize) ||
(ys_temp != ysize) || video_force_resize_get())) {
xsize = xs_temp;
ysize = ys_temp;
set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0));
@@ -346,9 +350,9 @@ compaq_cga_poll(void *priv)
}
if (enable_overscan)
video_blit_memtoscreen(0, self->cga.firstline - 8, xsize, (self->cga.lastline - self->cga.firstline) + 16);
video_blit_memtoscreen(0, dev->firstline - 8, xsize, (dev->lastline - dev->firstline) + 16);
else
video_blit_memtoscreen(8, self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline);
video_blit_memtoscreen(8, dev->firstline, xsize, dev->lastline - dev->firstline);
}
frames++;
@@ -357,63 +361,69 @@ compaq_cga_poll(void *priv)
if (enable_overscan)
xsize -= 16;
video_res_y = ysize;
if (self->cga.cgamode & 1) {
if (dev->cgamode & 1) {
video_res_x /= 8;
video_res_y /= self->cga.crtc[9] + 1;
video_res_y /= dev->crtc[9] + 1;
video_bpp = 0;
} else if (!(self->cga.cgamode & 2)) {
} else if (!(dev->cgamode & 2)) {
video_res_x /= 16;
video_res_y /= self->cga.crtc[9] + 1;
video_res_y /= dev->crtc[9] + 1;
video_bpp = 0;
} else if (!(self->cga.cgamode & 16)) {
} else if (!(dev->cgamode & 16)) {
video_res_x /= 2;
video_bpp = 2;
} else
video_bpp = 1;
}
self->cga.firstline = 1000;
self->cga.lastline = 0;
self->cga.cgablink++;
self->cga.oddeven ^= 1;
dev->firstline = 1000;
dev->lastline = 0;
dev->cgablink++;
dev->oddeven ^= 1;
}
} else {
self->cga.sc++;
self->cga.sc &= 31;
self->cga.ma = self->cga.maback;
dev->sc++;
dev->sc &= 31;
dev->ma = dev->maback;
}
if (self->cga.cgadispon)
self->cga.cgastat &= ~1;
if (dev->cgadispon)
dev->cgastat &= ~1;
if (self->cga.sc == (self->cga.crtc[10] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[10] & 31) >> 1)))
self->cga.con = 1;
if (dev->sc == (dev->crtc[10] & 31) ||
(((dev->crtc[8] & 3) == 3) && (dev->sc == ((dev->crtc[10] & 31) >> 1))))
dev->con = 1;
if (self->cga.cgadispon && (self->cga.cgamode & 1)) {
for (x = 0; x < (self->cga.crtc[1] << 1); x++)
self->cga.charbuffer[x] = self->cga.vram[((self->cga.ma << 1) + x) & 0x3fff];
if (dev->cgadispon && (dev->cgamode & 1)) {
for (x = 0; x < (dev->crtc[1] << 1); x++)
dev->charbuffer[x] = dev->vram[((dev->ma << 1) + x) & 0x3fff];
}
}
}
void *
static void *
compaq_cga_init(const device_t *info)
{
int display_type;
compaq_cga_t *self = malloc(sizeof(compaq_cga_t));
memset(self, 0, sizeof(compaq_cga_t));
int display_type;
cga_t *dev = calloc(1, sizeof(cga_t));
display_type = device_get_config_int("display_type");
self->cga.composite = (display_type != CGA_RGB);
self->cga.revision = device_get_config_int("composite_type");
self->cga.snow_enabled = device_get_config_int("snow_enabled");
display_type = device_get_config_int("display_type");
dev->composite = (display_type != CGA_RGB);
dev->revision = device_get_config_int("composite_type");
dev->snow_enabled = device_get_config_int("snow_enabled");
self->cga.vram = malloc(0x4000);
dev->vram = malloc(0x4000);
cga_comp_init(self->cga.revision);
timer_add(&self->cga.timer, compaq_cga_poll, self, 1);
mem_mapping_add(&self->cga.mapping, 0xb8000, 0x08000, cga_read, NULL, NULL, cga_write, NULL, NULL, NULL /*self->cga.vram*/, MEM_MAPPING_EXTERNAL, self);
io_sethandler(0x03d0, 0x0010, cga_in, NULL, NULL, cga_out, NULL, NULL, self);
cga_comp_init(dev->revision);
timer_add(&dev->timer, compaq_cga_poll, dev, 1);
mem_mapping_add(&dev->mapping, 0xb8000, 0x08000,
cga_read, NULL, NULL,
cga_write, NULL, NULL,
NULL, MEM_MAPPING_EXTERNAL, dev);
io_sethandler(0x03d0, 0x0010,
cga_in, NULL, NULL,
cga_out, NULL, NULL,
dev);
if (info->local) {
for (uint16_t c = 0; c < 256; c++) {
@@ -442,33 +452,34 @@ compaq_cga_init(const device_t *info)
overscan_x = overscan_y = 16;
self->cga.rgb_type = device_get_config_int("rgb_type");
cga_palette = (self->cga.rgb_type << 1);
dev->rgb_type = device_get_config_int("rgb_type");
cga_palette = (dev->rgb_type << 1);
cgapal_rebuild();
self->cga.crtc[9] = 13;
dev->crtc[9] = 13;
return self;
return dev;
}
void
static void
compaq_cga_close(void *priv)
{
compaq_cga_t *self = (compaq_cga_t *) priv;
cga_t *dev = (cga_t *) priv;
free(self->cga.vram);
free(self);
free(dev->vram);
free(dev);
}
void
static void
compaq_cga_speed_changed(void *priv)
{
compaq_cga_t *self = (compaq_cga_t *) priv;
cga_t *dev = (cga_t *) priv;
if (self->cga.crtc[9] == 13) /* Character height */
compaq_cga_recalctimings(self);
if (dev->crtc[9] == 13)
/* Character height */
compaq_cga_recalctimings(dev);
else
cga_recalctimings(&self->cga);
cga_recalctimings(dev);
}
extern const device_config_t cga_config[];

View File

@@ -47,7 +47,7 @@ void ega_doblit(int wx, int wy, ega_t *ega);
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
static uint8_t ega_rotate[8][256];
static int active = 0;
static int active = 0;
uint32_t pallook16[256];
uint32_t pallook64[256];
static int ega_type = EGA_TYPE_IBM;
@@ -72,7 +72,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
uint8_t gdcmask = (ega_type == EGA_SUPEREGA) ? 0xff : 0x0f;
uint8_t crtcmask = (atype == EGA_SUPEREGA) ? 0xff : 0x1f;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1))
if (((((addr & 0xfff0) == 0x3d0) || ((addr & 0xfff0) == 0x2d0)) || (((addr & 0xfff0) == 0x3b0) || ((addr & 0xfff0) == 0x2b0))) && !(ega->miscout & 1))
addr ^= 0x60;
switch (addr) {
@@ -94,7 +94,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
}
break;
case 0x2c0:
case 0x3c0:
case 0x2c1:
case 0x3c1:
if (atype == EGA_SUPEREGA)
val &= 0x7f; /* Bit 7 indicates the flipflop status (read only) */
@@ -108,8 +110,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
} else {
if ((ega->attraddr == 0x13) && (ega->attrregs[0x13] != val))
ega->fullchange = changeframecount;
o = ega->attrregs[ega->attraddr & 31];
ega->attrregs[ega->attraddr & 31] = val;
uint8_t aidx = ega->attraddr & 31;
o = ega->attrregs[aidx];
ega->attrregs[aidx] = val;
if (ega->attraddr < 16)
ega->fullchange = changeframecount;
int is_attr14 = ega->chipset && (ega->attraddr == 0x14);
@@ -139,6 +142,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
}
ega->attrff ^= 1;
break;
case 0x2c2:
case 0x3c2:
o = ega->miscout;
egaswitchread = (val & 0xc) >> 2;
@@ -148,13 +152,19 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
ega->miscout = val;
ega->overscan_color = ega->vres ? pallook16[ega->attrregs[0x11] & 0x0f] :
pallook64[ega->attrregs[0x11] & 0x3f];
io_removehandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
uint16_t base_addr = 0x03a0;
#ifdef EGA_ALT_ADDR_SUPPORT
if (ega->alt_addr == 1)
base_addr = 0x02a0;
#endif
io_removehandler(base_addr, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if (!(val & 1))
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
io_sethandler(base_addr, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
ega_recalctimings(ega);
if ((type == EGA_TYPE_COMPAQ) && !(val & 0x02))
mem_mapping_disable(&ega->mapping);
else switch (ega->gdcreg[6] & 0xc) {
else switch (ega->gdcreg[6] & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
break;
@@ -172,9 +182,11 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
break;
}
break;
case 0x2c4:
case 0x3c4:
ega->seqaddr = val;
break;
case 0x2c5:
case 0x3c5:
o = ega->seqregs[ega->seqaddr & 0xf];
ega->seqregs[ega->seqaddr & 0xf] = val;
@@ -201,16 +213,20 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
break;
}
break;
case 0x2c6:
case 0x3c6:
if (type == EGA_TYPE_COMPAQ)
ega->ctl_mode = val;
break;
case 0x2ce:
case 0x3ce:
ega->gdcaddr = val;
break;
case 0x3cf:
ega->gdcreg[ega->gdcaddr & gdcmask] = val;
switch (ega->gdcaddr & gdcmask) {
case 0x2cf:
case 0x3cf: {
uint8_t reg = ega->gdcaddr & gdcmask;
ega->gdcreg[reg] = val;
switch (reg) {
case 2:
ega->colourcompare = val;
break;
@@ -225,7 +241,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
case 6:
if ((type == EGA_TYPE_COMPAQ) && !(ega->miscout & 0x02))
mem_mapping_disable(&ega->mapping);
else switch (val & 0xc) {
else switch (val & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
break;
@@ -264,32 +280,34 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
break;
}
break;
}
case 0x2d0:
case 0x3d0:
case 0x2d4:
case 0x3d4:
if (ega->chipset)
ega->crtcreg = val & 0x3f;
else
ega->crtcreg = val;
ega->crtcreg = ega->chipset ? (val & 0x3f) : val;
return;
case 0x2d1:
case 0x3d1:
case 0x2d5:
case 0x3d5: {
int idx = ega->crtcreg;
if (ega->chipset) {
if ((ega->crtcreg < 7) && (ega->crtc[0x11] & 0x80) && !(ega->regs[0xb4] & 0x80))
if ((idx < 7) && (ega->crtc[0x11] & 0x80) && !(ega->regs[0xb4] & 0x80))
return;
if ((ega->crtcreg == 7) && (ega->crtc[0x11] & 0x80) && !(ega->regs[0xb4] & 0x80))
if ((idx == 7) && (ega->crtc[0x11] & 0x80) && !(ega->regs[0xb4] & 0x80))
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
} else {
idx &= crtcmask;
if ((idx >= 0x19) & (idx <= 0xf6))
if ((idx >= 0x19) && (idx <= 0xf6))
return;
if ((idx < 7) && (ega->crtc[0x11] & 0x80))
return;
if ((idx == 7) && (ega->crtc[0x11] & 0x80))
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
}
old = ega->crtc[idx];
old = ega->crtc[idx];
ega->crtc[idx] = val;
if (old != val) {
if ((idx < 0xe) || (idx > 0x10)) {
@@ -305,7 +323,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
}
break;
} default:
}
default:
break;
}
}
@@ -313,14 +333,14 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
uint8_t
ega_in(uint16_t addr, void *priv)
{
ega_t *ega = (ega_t *) priv;
ega_t *ega = (ega_t *) priv;
uint8_t ret = 0xff;
int type = ega_type;
int atype = ega->actual_type;
uint8_t gdcmask = (atype == EGA_SUPEREGA) ? 0xff : 0x0f;
uint8_t crtcmask = (atype == EGA_SUPEREGA) ? 0xff : 0x1f;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1))
if (((((addr & 0xfff0) == 0x3d0) || ((addr & 0xfff0) == 0x2d0)) || (((addr & 0xfff0) == 0x3b0) || ((addr & 0xfff0) == 0x2b0))) && !(ega->miscout & 1))
addr ^= 0x60;
switch (addr) {
@@ -341,7 +361,9 @@ ega_in(uint16_t addr, void *priv)
}
break;
case 0x2c0:
case 0x3c0:
case 0x2c1:
case 0x3c1:
if (type == EGA_TYPE_OTHER) {
int data = (atype == EGA_SUPEREGA) ? (ega->attrff & 1) : (addr & 1);
@@ -354,9 +376,11 @@ ega_in(uint16_t addr, void *priv)
ret = (ret & 0x3f) | (ega->attrff ? 0x80 : 0x00);
}
break;
case 0x2c2:
case 0x3c2:
ret = (egaswitches & (8 >> egaswitchread)) ? 0x10 : 0x00;
break;
case 0x2c4:
case 0x3c4:
if (type == EGA_TYPE_OTHER) {
if (atype == EGA_SUPEREGA)
@@ -365,28 +389,34 @@ ega_in(uint16_t addr, void *priv)
ret = ega->seqaddr;
}
break;
case 0x2c5:
case 0x3c5:
if (type == EGA_TYPE_OTHER) {
if ((ega->seqaddr & 0x0f) > 0x04)
ret = ega->chipset ? ega->seqregs[ega->seqaddr & 0xf] : 0xff;
uint8_t idx = ega->seqaddr & 0xf;
if (idx > 0x04)
ret = ega->chipset ? ega->seqregs[idx] : 0xff;
else
ret = ega->seqregs[ega->seqaddr & 0xf];
ret = ega->seqregs[idx];
}
break;
case 0x2c6:
case 0x3c6:
if (type == EGA_TYPE_COMPAQ)
ret = ega->ctl_mode;
break;
case 0x2c8:
case 0x3c8:
if (type == EGA_TYPE_OTHER)
ret = 2;
break;
case 0x2cc:
case 0x3cc:
if (type == EGA_TYPE_OTHER)
ret = ega->miscout;
break;
case 0x2ce:
case 0x3ce:
if (ega_type == EGA_TYPE_OTHER) {
if (type == EGA_TYPE_OTHER) {
ret = ega->gdcaddr;
if (atype == EGA_SUPEREGA) {
ret = (ret & 0x0f) | 0xe0;
@@ -395,14 +425,16 @@ ega_in(uint16_t addr, void *priv)
}
}
break;
case 0x2cf:
case 0x3cf:
if (type == EGA_TYPE_OTHER) {
switch (ega->gdcaddr & gdcmask) {
uint8_t gidx = ega->gdcaddr & gdcmask;
switch (gidx) {
default:
ret = ega->gdcreg[ega->gdcaddr & gdcmask];
ret = ega->gdcreg[gidx];
break;
case 0x09 ... 0xf7:
ret = ega->chipset ? ega->gdcreg[ega->gdcaddr & gdcmask] : 0xff;
ret = ega->chipset ? ega->gdcreg[gidx] : 0xff;
break;
case 0xf8:
ret = ega->la;
@@ -419,9 +451,11 @@ ega_in(uint16_t addr, void *priv)
}
}
break;
case 0x2d0:
case 0x3d0:
case 0x2d4:
case 0x3d4:
if (ega_type == EGA_TYPE_OTHER) {
if (type == EGA_TYPE_OTHER) {
ret = ega->crtcreg;
if (atype == EGA_SUPEREGA) {
ret = (ret & 0x1f) | 0xc0;
@@ -430,7 +464,9 @@ ega_in(uint16_t addr, void *priv)
}
}
break;
case 0x2d1:
case 0x3d1:
case 0x2d5:
case 0x3d5:
switch (ega->crtcreg & crtcmask) {
case 0xc:
@@ -465,6 +501,7 @@ ega_in(uint16_t addr, void *priv)
break;
}
break;
case 0x2da:
case 0x3da:
ega->attrff = 0;
if (type == EGA_TYPE_COMPAQ) {
@@ -494,7 +531,7 @@ ega_in(uint16_t addr, void *priv)
}
break;
case 0x7c6:
ret = 0xfd; /* EGA mode supported. */
ret = 0xfd; /* EGA mode supported. */
break;
case 0xbc6:
/* 0000 = None;
@@ -525,6 +562,7 @@ ega_recalctimings(ega_t *ega)
double _dispofftime;
double disptime;
double crtcconst;
double mdiv = (ega->seqregs[1] & 1) ? 8.0 : 9.0;
ega->vtotal = ega->crtc[6];
ega->dispend = ega->crtc[0x12];
@@ -578,10 +616,7 @@ ega_recalctimings(ega_t *ega)
else
crtcconst = (cpuclock / 16872000.0 * (double) (1ULL << 32));
}
if (!(ega->seqregs[1] & 1))
crtcconst *= 9.0;
else
crtcconst *= 8.0;
crtcconst *= mdiv;
} else if (ega->eeprom) {
clksel = ((ega->miscout & 0xc) >> 2) | ((ega->regs[0xbe] & 0x10) ? 4 : 0);
@@ -603,20 +638,14 @@ ega_recalctimings(ega_t *ega)
crtcconst = (cpuclock / 36000000.0 * (double) (1ULL << 32));
break;
}
if (!(ega->seqregs[1] & 1))
crtcconst *= 9.0;
else
crtcconst *= 8.0;
crtcconst *= mdiv;
} else {
if (ega->vidclock)
crtcconst = (ega->seqregs[1] & 1) ? MDACONST : (MDACONST * (9.0 / 8.0));
else
crtcconst = (ega->seqregs[1] & 1) ? CGACONST : (CGACONST * (9.0 / 8.0));
}
if (!(ega->seqregs[1] & 1))
ega->dot_clock = crtcconst / 9.0;
else
ega->dot_clock = crtcconst / 8.0;
ega->dot_clock = crtcconst / mdiv;
ega->interlace = 0;
@@ -629,17 +658,16 @@ ega_recalctimings(ega_t *ega)
ega->hdisp *= (ega->seqregs[1] & 1) ? 16 : 18;
else
ega->hdisp *= (ega->seqregs[1] & 1) ? 8 : 9;
ega->render = ega_render_text;
ega->hdisp_old = ega->hdisp;
ega->render = ega_render_text;
} else {
ega->hdisp *= (ega->seqregs[1] & 8) ? 16 : 8;
ega->render = ega_render_graphics;
ega->hdisp_old = ega->hdisp;
ega->render = ega_render_graphics;
}
ega->hdisp_old = ega->hdisp;
}
if (ega->chipset) {
if (ega->hdisp > 640) {
if (ega->hdisp >= 800) {
ega->dispend <<= 1;
ega->vtotal <<= 1;
ega->split <<= 1;
@@ -696,7 +724,7 @@ ega_recalctimings(ega_t *ega)
timer_disable(&ega->dot_timer);
timer_set_delay_u64(&ega->dot_timer, ega->dot_time);
ega->cca = 0;
active = 1;
active = 1;
ega->dot = 0;
}
@@ -708,30 +736,30 @@ ega_recalctimings(ega_t *ega)
void
ega_dot_poll(void *priv)
{
ega_t *ega = (ega_t *) priv;
static uint8_t chr;
static uint8_t attr;
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
const bool attrlinechars = (ega->attrregs[0x10] & 4);
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
const bool blinked = ega->blink & 0x10;
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
const int charwidth = dotwidth * (seq9dot ? 9 : 8);
const int cursoron = (ega->sc == (ega->crtc[10] & 31));
const int cursoraddr = (ega->crtc[0xe] << 8) | ega->crtc[0xf];
uint32_t addr;
int drawcursor;
uint32_t charaddr;
static int fg = 0;
static int bg = 0;
static uint32_t dat = 0x00000000;
static int cclock = 0;
static int disptime;
static int _dispontime;
static int _dispofftime;
ega_t *ega = (ega_t *) priv;
static uint8_t chr;
static uint8_t attr;
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
const bool attrlinechars = (ega->attrregs[0x10] & 4);
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
const bool blinked = ega->blink & 0x10;
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
const int charwidth = dotwidth * (seq9dot ? 9 : 8);
const int cursoron = (ega->sc == (ega->crtc[10] & 31));
const int cursoraddr = (ega->crtc[0xe] << 8) | ega->crtc[0xf];
uint32_t addr;
int drawcursor;
uint32_t charaddr;
static int fg = 0;
static int bg = 0;
static uint32_t dat = 0x00000000;
static int cclock = 0;
static int disptime;
static int _dispontime;
static int _dispofftime;
if (ega->seqregs[1] & 8) {
disptime = ((ega->crtc[0] + 2) << 1);
@@ -803,11 +831,9 @@ void
ega_poll(void *priv)
{
ega_t *ega = (ega_t *) priv;
int x, y;
int old_ma;
int wx = 640;
int wy = 350;
uint32_t blink_delay;
if (!ega->linepos) {
timer_advance_u64(&ega->timer, ega->dispofftime);
@@ -826,7 +852,7 @@ ega_poll(void *priv)
old_ma = ega->ma;
ega->displine *= ega->vres + 1;
ega->y_add *= ega->vres + 1;
for (y = 0; y <= ega->vres; y++) {
for (int y = 0; y <= ega->vres; y++) {
/* Render scanline */
ega->render(ega);
@@ -855,7 +881,7 @@ ega_poll(void *priv)
ega->stat &= ~8;
ega->vslines++;
if (ega->chipset) {
if (ega->hdisp > 640) {
if (ega->hdisp >= 800) {
if (ega->displine > 2000)
ega->displine = 0;
} else {
@@ -906,7 +932,7 @@ ega_poll(void *priv)
!(ega->real_vc & 1))
ega->vc++;
if (ega->chipset) {
if (ega->hdisp > 640)
if (ega->hdisp >= 800)
ega->vc &= 1023;
else
ega->vc &= 511;
@@ -925,7 +951,7 @@ ega_poll(void *priv)
}
if (ega->vc == ega->dispend) {
ega->dispon = 0;
blink_delay = (ega->crtc[11] & 0x60) >> 5;
uint32_t blink_delay = (ega->crtc[11] & 0x60) >> 5;
if (ega->crtc[10] & 0x20)
ega->cursoron = 0;
else if (blink_delay == 2)
@@ -946,14 +972,14 @@ ega_poll(void *priv)
#if 0
picint(1 << 2);
#endif
x = ega->hdisp;
// x = ega->hdisp;
if (ega->interlace && !ega->oddeven)
ega->lastline++;
if (ega->interlace && ega->oddeven)
ega->firstline--;
wx = x;
wx = ega->hdisp;
if (ega->vres) {
wy = (ega->lastline - ega->firstline) << 1;
@@ -1024,9 +1050,6 @@ ega_doblit(int wx, int wy, ega_t *ega)
int y_start = enable_overscan ? 0 : (unscaled_overscan_y >> 1);
int x_start = enable_overscan ? 0 : (overscan_x >> 1);
int bottom = (unscaled_overscan_y >> 1);
uint32_t *p;
int i;
int j;
int xs_temp;
int ys_temp;
@@ -1073,17 +1096,17 @@ ega_doblit(int wx, int wy, ega_t *ega)
if ((wx >= 160) && ((wy + 1) >= 120)) {
/* Draw (overscan_size - scroll size) lines of overscan on top and bottom. */
for (i = 0; i < ega->y_add; i++) {
p = &buffer32->line[i & 0x7ff][0];
for (int i = 0; i < ega->y_add; i++) {
uint32_t *p = &buffer32->line[i & 0x7ff][0];
for (j = 0; j < (xsize + x_add); j++)
for (int j = 0; j < (xsize + x_add); j++)
p[j] = ega->overscan_color;
}
for (i = 0; i < bottom; i++) {
p = &buffer32->line[(ysize + ega->y_add + i) & 0x7ff][0];
for (int i = 0; i < bottom; i++) {
uint32_t *p = &buffer32->line[(ysize + ega->y_add + i) & 0x7ff][0];
for (j = 0; j < (xsize + x_add); j++)
for (int j = 0; j < (xsize + x_add); j++)
p[j] = ega->overscan_color;
}
}
@@ -1107,12 +1130,11 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega)
// bit 2: 1 = 128K mapping, 0 = other mapping (from memory decode PROM)
a0mux = 0;
if (ega->gdcreg[6] & 2) {
if (ega->gdcreg[6] & 2)
a0mux |= 2;
}
if (ega->vram_limit <= 64 * 1024) {
if (ega->vram_limit <= 64 * 1024)
a0mux |= 1;
}
switch (ega->gdcreg[6] & 0xC) {
case 0x0: // 128K A000
@@ -1179,9 +1201,8 @@ ega_write(uint32_t addr, uint8_t val, void *priv)
cycles -= video_timing_write_b;
if (ega->chain2_write) {
if (ega->chain2_write)
writemask2 &= 0x5 << (addr & 1);
}
addr = ega_remap_cpu_addr(addr, ega);
@@ -1361,9 +1382,8 @@ ega_read(uint32_t addr, void *priv)
cycles -= video_timing_read_b;
if (ega->chain2_read) {
if (ega->chain2_read)
readplane = (readplane & 2) | (addr & 1);
}
addr = ega_remap_cpu_addr(addr, ega);
@@ -1401,23 +1421,19 @@ ega_read(uint32_t addr, void *priv)
void
ega_init(ega_t *ega, int monitor_type, int is_mono)
{
int c;
int d;
int e;
ega->vram = malloc(0x40000);
ega->vrammask = 0x3ffff;
for (c = 0; c < 256; c++) {
e = c;
for (d = 0; d < 8; d++) {
for (uint16_t c = 0; c < 256; c++) {
int e = c;
for (uint8_t d = 0; d < 8; d++) {
ega_rotate[d][c] = e;
e = (e >> 1) | ((e & 1) ? 0x80 : 0);
}
}
if (is_mono) {
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
if (((c >> 3) & 3) == 0)
pallook64[c] = pallook16[c] = makecol32(0, 0, 0);
else
@@ -1474,9 +1490,14 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
}
}
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
uint16_t base_addr = 0x03a0;
#ifdef EGA_ALT_ADDR_SUPPORT
if (ega->alt_addr == 1)
base_addr = 0x02a0;
#endif
io_sethandler(base_addr, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
} else {
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
pallook64[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa);
pallook64[c] += makecol32(((c >> 5) & 1) * 0x55, ((c >> 4) & 1) * 0x55, ((c >> 3) & 1) * 0x55);
pallook16[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa);
@@ -1562,11 +1583,9 @@ ega_set_type(void *priv, uint32_t local)
static void *
ega_standalone_init(const device_t *info)
{
ega_t *ega = malloc(sizeof(ega_t));
ega_t *ega = calloc(1, sizeof(ega_t));
int monitor_type;
memset(ega, 0x00, sizeof(ega_t));
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_ega);
overscan_x = 16;
@@ -1622,7 +1641,7 @@ ega_standalone_init(const device_t *info)
}
}
monitor_type = device_get_config_int("monitor_type");
monitor_type = ega->chipset ? 0x09 : device_get_config_int("monitor_type");
ega_init(ega, monitor_type, (monitor_type & 0x0F) == 0x0B);
ega->vram_limit = device_get_config_int("memory") * 1024;
@@ -1631,12 +1650,19 @@ ega_standalone_init(const device_t *info)
mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, ega);
if (ega_type == EGA_TYPE_COMPAQ)
mem_mapping_disable(&ega->mapping);
io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
uint16_t addr = 0x03c0;
#ifdef EGA_ALT_ADDR_SUPPORT
if (ega_type == EGA_TYPE_IBM) {
addr = device_get_config_hex16("base");
if (addr == 0x02c0)
ega->alt_addr = 1;
}
#endif
io_sethandler(addr, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if (ega->chipset) {
io_sethandler(0x01ce, 0x0002, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
ega->eeprom = malloc(sizeof(ati_eeprom_t));
memset(ega->eeprom, 0, sizeof(ati_eeprom_t));
ega->eeprom = calloc(1, sizeof(ati_eeprom_t));
ati_eeprom_load((ati_eeprom_t *) ega->eeprom, "egawonder800p.nvr", 0);
} else if (info->local == EGA_COMPAQ) {
io_sethandler(0x0084, 0x0001, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
@@ -1712,6 +1738,66 @@ ega_speed_changed(void *priv)
0 = Switch closed (ON);
1 = Switch open (OFF). */
static const device_config_t ega_ibm_config[] = {
// clang-format off
{
.name = "memory",
.description = "Memory size",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 256,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "32 KB", .value = 32 },
{ .description = "64 KB", .value = 64 },
{ .description = "128 KB", .value = 128 },
{ .description = "256 KB", .value = 256 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "monitor_type",
.description = "Monitor type",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 9,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Monochrome (5151/MDA) (white)", .value = 0x0B | (DISPLAY_WHITE << 4) },
{ .description = "Monochrome (5151/MDA) (green)", .value = 0x0B | (DISPLAY_GREEN << 4) },
{ .description = "Monochrome (5151/MDA) (amber)", .value = 0x0B | (DISPLAY_AMBER << 4) },
{ .description = "Color 40x25 (5153/CGA)", .value = 0x06 },
{ .description = "Color 80x25 (5153/CGA)", .value = 0x07 },
{ .description = "Enhanced Color - Normal Mode (5154/ECD)", .value = 0x08 },
{ .description = "Enhanced Color - Enhanced Mode (5154/ECD)", .value = 0x09 },
{ .description = "" }
},
.bios = { { 0 } }
},
#ifdef EGA_ALT_ADDR_SUPPORT
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x03c0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x3C0", .value = 0x03c0 },
{ .description = "0x2C0", .value = 0x02c0 },
{ .description = "" }
},
.bios = { { 0 } }
},
#endif
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
static const device_config_t ega_config[] = {
// clang-format off
{
@@ -1755,6 +1841,29 @@ static const device_config_t ega_config[] = {
// clang-format on
};
static const device_config_t atiega800p_config[] = {
// clang-format off
{
.name = "memory",
.description = "Memory size",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 256,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "32 KB", .value = 32 },
{ .description = "64 KB", .value = 64 },
{ .description = "128 KB", .value = 128 },
{ .description = "256 KB", .value = 256 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t ega_device = {
.name = "IBM EGA",
.internal_name = "ega",
@@ -1766,7 +1875,7 @@ const device_t ega_device = {
.available = ega_standalone_available,
.speed_changed = ega_speed_changed,
.force_redraw = NULL,
.config = ega_config
.config = ega_ibm_config
};
const device_t cpqega_device = {
@@ -1808,7 +1917,7 @@ const device_t atiega800p_device = {
.available = atiega800p_standalone_available,
.speed_changed = ega_speed_changed,
.force_redraw = NULL,
.config = ega_config
.config = atiega800p_config
};
const device_t iskra_ega_device = {

View File

@@ -399,7 +399,6 @@ hercules_poll(void *priv)
if (dev->sc == (dev->crtc[11] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[11] & 31) >> 1))) {
dev->con = 0;
dev->coff = 1;
}
if (dev->vadj) {

View File

@@ -77,7 +77,7 @@ typedef struct {
int linepos, displine;
int vc, sc;
uint16_t ma, maback;
int con, coff, cursoron;
int con, cursoron;
int dispon, blink;
int vsynctime;
int vadj;
@@ -536,7 +536,6 @@ herculesplus_poll(void *priv)
if (dev->sc == (dev->crtc[11] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[11] & 31) >> 1))) {
dev->con = 0;
dev->coff = 1;
}
if (dev->vadj) {
dev->sc++;

View File

@@ -167,7 +167,7 @@ typedef struct {
int linepos, displine;
int vc, sc;
uint16_t ma, maback;
int con, coff, cursoron;
int con, cursoron;
int dispon, blink;
int vsynctime;
int vadj;
@@ -899,7 +899,6 @@ incolor_poll(void *priv)
if (dev->sc == (dev->crtc[11] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[11] & 31) >> 1))) {
dev->con = 0;
dev->coff = 1;
}
if (dev->vadj) {

Some files were not shown because too many files have changed in this diff Show More