Backport several changes from M&K

This commit is contained in:
Jasmine Iwanek
2022-03-25 19:42:43 -04:00
parent 7d15a75cf4
commit 702f80e58a
9 changed files with 737 additions and 519 deletions

View File

@@ -90,7 +90,7 @@ typedef struct {
const char *default_string;
int default_int;
const char *file_filter;
device_config_spinner_t spinner;
const device_config_spinner_t spinner;
const device_config_selection_t selection[16];
} device_config_t;

View File

@@ -22,76 +22,122 @@
#ifndef EMU_MACHINE_H
# define EMU_MACHINE_H
/* Machine feature flags. */
// #define MACHINE_PC 0x00000000 /* PC architecture */
/* Feature flags for features. */
#define MACHINE_NONMI 0x00000001 /* sys does not have NMI's */
#define MACHINE_BUS_NONE 0x00000000 /* sys has no bus */
/* Feature flags for BUS'es. */
#define MACHINE_BUS_ISA 0x00000004 /* sys has ISA bus */
#define MACHINE_BUS_ISA16 0x00000008 /* sys has ISA16 bus - PC/AT architecture */
#define MACHINE_BUS_CBUS 0x00000010 /* sys has C-BUS bus */
#define MACHINE_BUS_PS2 0x00000020 /* system has PS/2 keyboard and mouse ports */
#define MACHINE_BUS_EISA 0x00000040 /* sys has EISA bus */
#define MACHINE_BUS_VLB 0x00000080 /* sys has VL bus */
#define MACHINE_BUS_MCA 0x00000100 /* sys has MCA bus */
#define MACHINE_BUS_PCI 0x00000200 /* sys has PCI bus */
#define MACHINE_BUS_PCMCIA 0x00000400 /* sys has PCMCIA bus */
#define MACHINE_BUS_AGP 0x00000800 /* sys has AGP bus */
#define MACHINE_BUS_AC97 0x00080000 /* sys has AC97 bus (ACR/AMR/CNR slot) */
#define MACHINE_BUS_ISA 0x00000001 /* sys has ISA bus */
#define MACHINE_BUS_CARTRIDGE 0x00000002 /* sys has two cartridge bays */
#define MACHINE_BUS_ISA16 0x00000004 /* sys has ISA16 bus - PC/AT architecture */
#define MACHINE_BUS_CBUS 0x00000008 /* sys has C-BUS bus */
#define MACHINE_BUS_PS2 0x00000010 /* system has PS/2 keyboard and mouse ports */
#define MACHINE_BUS_EISA 0x00000020 /* sys has EISA bus */
#define MACHINE_BUS_VLB 0x00000040 /* sys has VL bus */
#define MACHINE_BUS_MCA 0x00000080 /* sys has MCA bus */
#define MACHINE_BUS_PCI 0x00000100 /* sys has PCI bus */
#define MACHINE_BUS_PCMCIA 0x00000200 /* sys has PCMCIA bus */
#define MACHINE_BUS_AGP 0x00000400 /* sys has AGP bus */
#define MACHINE_BUS_AC97 0x00000800 /* sys has AC97 bus (ACR/AMR/CNR slot) */
/* Aliases. */
#define MACHINE_CARTRIDGE (MACHINE_BUS_CARTRIDGE) /* sys has two cartridge bays */
/* Combined flags. */
#define MACHINE_PC 0x00000004 /* sys is PC/XT-compatible (ISA) */
#define MACHINE_AT 0x0000000C /* sys is AT-compatible (ISA + ISA16) */
#define MACHINE_PC98 0x00000010 /* sys is NEC PC-98x1 series */
#define MACHINE_EISA 0x0000004C /* sys is AT-compatible with EISA */
#define MACHINE_VLB 0x0000008C /* sys is AT-compatible with VLB */
#define MACHINE_VLB98 0x00000090 /* sys is NEC PC-98x1 series with VLB (did that even exist?) */
#define MACHINE_VLBE 0x000000CC /* sys is AT-compatible with EISA and VLB */
#define MACHINE_MCA 0x00000100 /* sys is MCA */
#define MACHINE_PCI 0x0000020C /* sys is AT-compatible with PCI */
#define MACHINE_PCI98 0x00000210 /* sys is NEC PC-98x1 series with PCI */
#define MACHINE_PCIE 0x0000024C /* sys is AT-compatible with PCI, and EISA */
#define MACHINE_PCIV 0x0000028C /* sys is AT-compatible with PCI and VLB */
#define MACHINE_PCIVE 0x000002CC /* sys is AT-compatible with PCI, VLB, and EISA */
#define MACHINE_PCMCIA 0x00000400 /* sys is AT-compatible laptop with PCMCIA */
#define MACHINE_AGP 0x00000A0C /* sys is AT-compatible with AGP */
#define MACHINE_AGP98 0x00000A10 /* sys is NEC PC-98x1 series with AGP (did that even exist?) */
/* Feature flags for miscellaneous internal devices. */
#define MACHINE_VIDEO 0x00001000 /* sys has int video */
#define MACHINE_VIDEO_ONLY 0x00002000 /* sys has fixed video */
#define MACHINE_MOUSE 0x00004000 /* sys has int mouse */
#define MACHINE_SOUND 0x00008000 /* sys has int sound */
#define MACHINE_FDC 0x00010000 /* sys has int FDC */
#define MACHINE_NIC 0x00020000 /* sys has int NIC */
#define MACHINE_GAMEPORT 0x00040000 /* sys has int game port */
/* Combined flags. */
#define MACHINE_VIDEO_FIXED 0x00003000 /* sys has fixed int video */
/* Feature flags for internal storage controllers. */
#define MACHINE_HDC 0x07FC0000 /* sys has int HDC */
#define MACHINE_MFM 0x00100000 /* sys has int MFM/RLL */
#define MACHINE_XTA 0x00200000 /* sys has int XTA */
#define MACHINE_ESDI 0x00400000 /* sys has int ESDI */
#define MACHINE_IDE_PRI 0x00800000 /* sys has int pri IDE/ATAPI */
#define MACHINE_IDE_SEC 0x01000000 /* sys has int sec IDE/ATAPI */
#define MACHINE_IDE_TER 0x02000000 /* sys has int ter IDE/ATAPI */
#define MACHINE_IDE_QUA 0x04000000 /* sys has int qua IDE/ATAPI */
#define MACHINE_SCSI_PRI 0x08000000 /* sys has int pri SCSI */
#define MACHINE_SCSI_SEC 0x10000000 /* sys has int sec SCSI */
#define MACHINE_USB 0x20000000 /* sys has int USB */
/* Combined flags. */
#define MACHINE_IDE 0x00800000 /* sys has int single IDE/ATAPI - mark as pri IDE/ATAPI */
#define MACHINE_IDE_DUAL 0x01800000 /* sys has int dual IDE/ATAPI - mark as both pri and sec IDE/ATAPI */
#define MACHINE_IDE_QUAD 0x07800000 /* sys has int quad IDE/ATAPI - mark as dual + both ter and and qua IDE/ATAPI */
#define MACHINE_SCSI 0x08000000 /* sys has int single SCSI - mark as pri SCSI */
#define MACHINE_SCSI_DUAL 0x18000000 /* sys has int dual SCSI - mark as both pri and sec SCSI */
#define MACHINE_CARTRIDGE 0x20000000 /* sys has two cartridge bays */
#define MACHINE_PC (MACHINE_BUS_ISA) /* sys is PC/XT-compatible (ISA) */
#define MACHINE_AT (MACHINE_BUS_ISA | MACHINE_BUS_ISA16) /* sys is AT-compatible (ISA + ISA16) */
#define MACHINE_PC98 (MACHINE_BUS_CBUS) /* sys is NEC PC-98x1 series */
#define MACHINE_EISA (MACHINE_BUS_EISA | MACHINE_AT) /* sys is AT-compatible with EISA */
#define MACHINE_VLB (MACHINE_BUS_VLB | MACHINE_AT) /* sys is AT-compatible with VLB */
#define MACHINE_VLB98 (MACHINE_BUS_VLB | MACHINE_PC98) /* sys is NEC PC-98x1 series with VLB (did that even exist?) */
#define MACHINE_VLBE (MACHINE_BUS_VLB | MACHINE_EISA) /* sys is AT-compatible with EISA and VLB */
#define MACHINE_MCA (MACHINE_BUS_MCA) /* sys is MCA */
#define MACHINE_PCI (MACHINE_BUS_PCI | MACHINE_AT) /* sys is AT-compatible with PCI */
#define MACHINE_PCI98 (MACHINE_BUS_PCI | MACHINE_PC98) /* sys is NEC PC-98x1 series with PCI */
#define MACHINE_PCIE (MACHINE_BUS_PCI | MACHINE_EISA) /* sys is AT-compatible with PCI, and EISA */
#define MACHINE_PCIV (MACHINE_BUS_PCI | MACHINE_VLB) /* sys is AT-compatible with PCI and VLB */
#define MACHINE_PCIVE (MACHINE_BUS_PCI | MACHINE_VLBE) /* sys is AT-compatible with PCI, VLB, and EISA */
#define MACHINE_PCMCIA (MACHINE_BUS_PCMCIA | MACHINE_AT) /* sys is AT-compatible laptop with PCMCIA */
#define MACHINE_AGP (MACHINE_BUS_AGP | MACHINE_PCI) /* sys is AT-compatible with AGP */
#define MACHINE_AGP98 (MACHINE_BUS_AGP | MACHINE_PCI98) /* sys is NEC PC-98x1 series with AGP (did that even exist?) */
#define IS_ARCH(m, a) ((machines[m].flags & (a)) ? 1 : 0)
#define IS_AT(m) (((machines[m].flags & 0x00000FC8) && !(machines[m].flags & MACHINE_PC98)) ? 1 : 0)
#define MACHINE_PCJR (MACHINE_PC | MACHINE_CARTRIDGE) /* sys is PCjr */
#define MACHINE_PS2 (MACHINE_AT | MACHINE_BUS_PS2) /* sys is PS/2 */
#define MACHINE_PS2_MCA (MACHINE_MCA | MACHINE_BUS_PS2) /* sys is MCA PS/2 */
#define MACHINE_PS2_VLB (MACHINE_VLB | MACHINE_BUS_PS2) /* sys is VLB PS/2 */
#define MACHINE_PS2_PCI (MACHINE_PCI | MACHINE_BUS_PS2) /* sys is PCI PS/2 */
#define MACHINE_PS2_PCIV (MACHINE_PCIV | MACHINE_BUS_PS2) /* sys is VLB/PCI PS/2 */
#define MACHINE_PS2_AGP (MACHINE_AGP | MACHINE_BUS_PS2) /* sys is AGP PS/2 */
#define MACHINE_PS2_A97 (MACHINE_PS2_AGP | MACHINE_BUS_AC97) /* sys is AGP/AC97 PS/2 */
#define MACHINE_PS2_NOISA (MACHINE_PS2_AGP & ~MACHINE_AT) /* sys is AGP PS/2 without ISA */
#define MACHINE_PS2_NOI97 (MACHINE_PS2_A97 & ~MACHINE_AT) /* sys is AGP/AC97 PS/2 without ISA */
/* Feature flags for miscellaneous internal devices. */
#define MACHINE_FLAGS_NONE 0x00000000 /* sys has no int devices */
#define MACHINE_VIDEO 0x00000001 /* sys has int video */
#define MACHINE_VIDEO_ONLY 0x00000002 /* sys has fixed video */
#define MACHINE_MOUSE 0x00000004 /* sys has int mouse */
#define MACHINE_FDC 0x00000008 /* sys has int FDC */
#define MACHINE_LPT_PRI 0x00000010 /* sys has int pri LPT */
#define MACHINE_LPT_SEC 0x00000020 /* sys has int sec LPT */
#define MACHINE_UART_PRI 0x00000040 /* sys has int pri UART */
#define MACHINE_UART_SEC 0x00000080 /* sys has int sec UART */
#define MACHINE_UART_TER 0x00000100 /* sys has int ter UART */
#define MACHINE_UART_QUA 0x00000200 /* sys has int qua UART */
#define MACHINE_GAMEPORT 0x00000400 /* sys has int game port */
#define MACHINE_SOUND 0x00000800 /* sys has int sound */
#define MACHINE_NIC 0x00001000 /* sys has int NIC */
#define MACHINE_MODEM 0x00002000 /* sys has int modem */
/* Feature flags for advanced devices. */
#define MACHINE_APM 0x00004000 /* sys has APM */
#define MACHINE_ACPI 0x00008000 /* sys has ACPI */
#define MACHINE_HWM 0x00010000 /* sys has hw monitor */
/* Combined flags. */
#define MACHINE_VIDEO_FIXED (MACHINE_VIDEO | MACHINE_VIDEO_ONLY) /* sys has fixed int video */
#define MACHINE_SUPER_IO (MACHINE_FDC | MACHINE_LPT_PRI | MACHINE_UART_PRI | MACHINE_UART_SEC)
#define MACHINE_SUPER_IO_GAME (MACHINE_SUPER_IO | MACHINE_GAMEPORT)
#define MACHINE_SUPER_IO_DUAL (MACHINE_SUPER_IO | MACHINE_LPT_SEC | MACHINE_UART_TER | MACHINE_UART_QUA)
#define MACHINE_AV (MACHINE_VIDEO | MACHINE_SOUND) /* sys has video and sound */
#define MACHINE_AG (MACHINE_SOUND | MACHINE_GAMEPORT) /* sys has sound and game port */
/* Feature flags for internal storage controllers. */
#define MACHINE_HDC 0x03FE0000 /* sys has int HDC */
#define MACHINE_MFM 0x00020000 /* sys has int MFM/RLL */
#define MACHINE_XTA 0x00040000 /* sys has int XTA */
#define MACHINE_ESDI 0x00080000 /* sys has int ESDI */
#define MACHINE_IDE_PRI 0x00100000 /* sys has int pri IDE/ATAPI */
#define MACHINE_IDE_SEC 0x00200000 /* sys has int sec IDE/ATAPI */
#define MACHINE_IDE_TER 0x00400000 /* sys has int ter IDE/ATAPI */
#define MACHINE_IDE_QUA 0x00800000 /* sys has int qua IDE/ATAPI */
#define MACHINE_SCSI_PRI 0x01000000 /* sys has int pri SCSI */
#define MACHINE_SCSI_SEC 0x02000000 /* sys has int sec SCSI */
#define MACHINE_USB_PRI 0x04000000 /* sys has int pri USB */
#define MACHINE_USB_SEC 0x08000000 /* sys has int sec USB */
/* Combined flags. */
#define MACHINE_IDE (MACHINE_IDE_PRI) /* sys has int single IDE/ATAPI - mark as pri IDE/ATAPI */
#define MACHINE_IDE_DUAL (MACHINE_IDE_PRI | MACHINE_IDE_SEC) /* sys has int dual IDE/ATAPI - mark as both pri and sec IDE/ATAPI */
#define MACHINE_IDE_DUALTQ (MACHINE_IDE_TER | MACHINE_IDE_QUA)
#define MACHINE_IDE_QUAD (MACHINE_IDE_DUAL | MACHINE_IDE_DUALTQ) /* sys has int quad IDE/ATAPI - mark as dual + both ter and and qua IDE/ATAPI */
#define MACHINE_SCSI (MACHINE_SCSI_PRI) /* sys has int single SCSI - mark as pri SCSI */
#define MACHINE_SCSI_DUAL (MACHINE_SCSI_PRI | MACHINE_SCSI_SEC) /* sys has int dual SCSI - mark as both pri and sec SCSI */
#define MACHINE_USB (MACHINE_USB_PRI)
#define MACHINE_USB_DUAL (MACHINE_USB_PRI | MACHINE_USB_SEC)
/* Special combined flags. */
#define MACHINE_PIIX (MACHINE_IDE_DUAL)
#define MACHINE_PIIX3 (MACHINE_PIIX | MACHINE_USB)
/* TODO: ACPI flag. */
#define MACHINE_PIIX4 (MACHINE_PIIX3 | MACHINE_ACPI)
#define IS_ARCH(m, a) ((machines[m].bus_flags & (a)) ? 1 : 0)
#define IS_AT(m) (((machines[m].bus_flags & (MACHINE_BUS_ISA16 | MACHINE_BUS_EISA | MACHINE_BUS_VLB | MACHINE_BUS_MCA | MACHINE_BUS_PCI | MACHINE_BUS_PCMCIA | MACHINE_BUS_AGP | MACHINE_BUS_AC97)) && !(machines[m].bus_flags & MACHINE_PC98)) ? 1 : 0)
#define CPU_BLOCK(...) (const uint8_t[]) {__VA_ARGS__, 0}
#define MACHINE_MULTIPLIER_FIXED -1, -1
#define CPU_BLOCK_NONE 0
#define CPU_BLOCK_QDI_FMB CPU_BLOCK(CPU_WINCHIP, CPU_WINCHIP2, CPU_Cx6x86, CPU_Cx6x86L, CPU_Cx6x86MX)
#define CPU_BLOCK_SOYO_4SAW2 CPU_BLOCK(CPU_i486SX, CPU_i486DX, CPU_Am486SX, CPU_Am486DX)
/* Make sure it's always an invalid value to avoid misdetections. */
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
#define MACHINE_AVAILABLE 0xffffffffffffffffULL
#else
#define MACHINE_AVAILABLE 0xffffffff
#endif
enum {
MACHINE_TYPE_NONE = 0,
@@ -121,69 +167,130 @@ enum {
MACHINE_TYPE_MAX
};
enum {
MACHINE_CHIPSET_NONE = 0,
MACHINE_CHIPSET_DISCRETE,
MACHINE_CHIPSET_PROPRIETARY,
MACHINE_CHIPSET_GC100A,
MACHINE_CHIPSET_GC103,
MACHINE_CHIPSET_HT18,
MACHINE_CHIPSET_ACC_2168,
MACHINE_CHIPSET_ALI_M1217,
MACHINE_CHIPSET_ALI_M6117,
MACHINE_CHIPSET_ALI_M1409,
MACHINE_CHIPSET_ALI_M1429,
MACHINE_CHIPSET_ALI_M1429G,
MACHINE_CHIPSET_ALI_M1489,
MACHINE_CHIPSET_ALI_ALADDIN_IV_PLUS,
MACHINE_CHIPSET_ALI_ALADDIN_V,
MACHINE_CHIPSET_ALI_ALADDIN_PRO_II,
MACHINE_CHIPSET_SCAT,
MACHINE_CHIPSET_NEAT,
MACHINE_CHIPSET_CT_386,
MACHINE_CHIPSET_CT_CS4031,
MACHINE_CHIPSET_CONTAQ_82C596,
MACHINE_CHIPSET_CONTAQ_82C597,
MACHINE_CHIPSET_IMS_8848,
MACHINE_CHIPSET_INTEL_82335,
MACHINE_CHIPSET_INTEL_420TX,
MACHINE_CHIPSET_INTEL_420ZX,
MACHINE_CHIPSET_INTEL_420EX,
MACHINE_CHIPSET_INTEL_430LX,
MACHINE_CHIPSET_INTEL_430NX,
MACHINE_CHIPSET_INTEL_430FX,
MACHINE_CHIPSET_INTEL_430HX,
MACHINE_CHIPSET_INTEL_430VX,
MACHINE_CHIPSET_INTEL_430TX,
MACHINE_CHIPSET_INTEL_450KX,
MACHINE_CHIPSET_INTEL_440FX,
MACHINE_CHIPSET_INTEL_440EX,
MACHINE_CHIPSET_INTEL_440LX,
MACHINE_CHIPSET_INTEL_440BX,
MACHINE_CHIPSET_INTEL_440ZX,
MACHINE_CHIPSET_INTEL_440GX,
MACHINE_CHIPSET_OPTI_283,
MACHINE_CHIPSET_OPTI_291,
MACHINE_CHIPSET_OPTI_493,
MACHINE_CHIPSET_OPTI_495,
MACHINE_CHIPSET_OPTI_499,
MACHINE_CHIPSET_OPTI_895_802G,
MACHINE_CHIPSET_OPTI_547_597,
MACHINE_CHIPSET_SARC_RC2016A,
MACHINE_CHIPSET_SIS_310,
MACHINE_CHIPSET_SIS_401,
MACHINE_CHIPSET_SIS_460,
MACHINE_CHIPSET_SIS_461,
MACHINE_CHIPSET_SIS_471,
MACHINE_CHIPSET_SIS_496,
MACHINE_CHIPSET_SIS_501,
MACHINE_CHIPSET_SIS_5511,
MACHINE_CHIPSET_SIS_5571,
MACHINE_CHIPSET_SMSC_VICTORYBX_66,
MACHINE_CHIPSET_STPC_CLIENT,
MACHINE_CHIPSET_STPC_CONSUMER_II,
MACHINE_CHIPSET_STPC_ELITE,
MACHINE_CHIPSET_STPC_ATLAS,
MACHINE_CHIPSET_SYMPHONY_SL82C460,
MACHINE_CHIPSET_UMC_UM82C480,
MACHINE_CHIPSET_UMC_UM82C491,
MACHINE_CHIPSET_UMC_UM8881,
MACHINE_CHIPSET_UMC_UM8890BF,
MACHINE_CHIPSET_VIA_VT82C495,
MACHINE_CHIPSET_VIA_VT82C496G,
MACHINE_CHIPSET_VIA_APOLLO_VPX,
MACHINE_CHIPSET_VIA_APOLLO_VP3,
MACHINE_CHIPSET_VIA_APOLLO_MVP3,
MACHINE_CHIPSET_VIA_APOLLO_PRO,
MACHINE_CHIPSET_VIA_APOLLO_PRO_133,
MACHINE_CHIPSET_VIA_APOLLO_PRO_133A,
MACHINE_CHIPSET_VLSI_SCAMP,
MACHINE_CHIPSET_VLSI_VL82C480,
MACHINE_CHIPSET_VLSI_VL82C481,
MACHINE_CHIPSET_VLSI_VL82C486,
MACHINE_CHIPSET_WD76C10,
MACHINE_CHIPSET_MAX
};
typedef struct _machine_type_ {
typedef struct _machine_filter_ {
const char *name;
const char id;
} machine_type_t;
} machine_filter_t;
#ifdef NEW_STRUCT
typedef struct _machine_ {
const char *name;
const char *internal_name;
const char type;
const char *name;
const char *internal_name;
uint32_t type;
uint32_t chipset;
int (*init)(const struct _machine_ *);
uintptr_t pad, pad0, pad1, pad2;
uint32_t cpu_package;
const uint8_t *cpu_block;
uint32_t cpu_min_bus;
uint32_t cpu_max_bus;
uint16_t cpu_min_voltage;
uint16_t cpu_max_voltage;
float cpu_min_multi;
float cpu_max_multi;
uintptr_t bus_flags;
uintptr_t flags;
uint32_t min_ram, max_ram;
int ram_granularity;
int nvrmask;
#ifdef EMU_DEVICE_H
const device_t *device;
const device_t *(*get_device)(void);
const device_t *(*get_vid_device)(void);
#else
void *device;
#endif
struct {
const char *name;
#ifdef EMU_CPU_H
CPU *cpus;
#else
void *cpus;
#endif
} cpu[5];
int flags;
uint32_t min_ram, max_ram;
int ram_granularity;
int nvrmask;
} machine_t;
#else
typedef struct _machine_ {
const char *name;
const char *internal_name;
const char type;
uint32_t cpu_package;
const uint8_t *cpu_block;
uint32_t cpu_min_bus;
uint32_t cpu_max_bus;
uint16_t cpu_min_voltage;
uint16_t cpu_max_voltage;
double cpu_min_multi;
double cpu_max_multi;
int flags;
uint32_t min_ram, max_ram;
int ram_granularity;
int nvrmask;
int (*init)(const struct _machine_ *);
#ifdef EMU_DEVICE_H
const device_t *(*get_device)(void);
#else
void *get_device;
void *get_device;
void *get_vid_device;
#endif
} machine_t;
#endif
/* Global variables. */
extern const machine_type_t machine_types[];
extern const machine_t machines[];
extern int bios_only;
extern int machine;
extern const machine_filter_t machine_types[],
machine_chipsets[];
extern const machine_t machines[];
extern int bios_only;
extern int machine;
/* Core functions. */
extern int machine_count(void);
@@ -197,15 +304,15 @@ extern void machine_init(void);
extern const device_t *machine_getdevice(int m);
#endif
extern char *machine_get_internal_name_ex(int m);
extern int machine_get_nvrmask(int m);
extern int machine_has_flags(int m, int flags);
extern int machine_has_bus(int m, int bus_flags);
extern int machine_has_cartridge(int m);
extern int machine_get_min_ram(int m);
extern int machine_get_max_ram(int m);
extern int machine_get_ram_granularity(int m);
extern int machine_get_type(int m);
extern void machine_close(void);
extern int machine_get_nvrmask(int m);
extern int machine_has_flags(int m, int flags);
extern int machine_has_bus(int m, int bus_flags);
extern int machine_has_cartridge(int m);
extern int machine_get_min_ram(int m);
extern int machine_get_max_ram(int m);
extern int machine_get_ram_granularity(int m);
extern int machine_get_type(int m);
extern void machine_close(void);
/* Initialization functions for boards and systems. */
@@ -749,5 +856,4 @@ extern int machine_xt_xi8088_init(const machine_t *);
extern const device_t *xi8088_get_device(void);
#endif
#endif /*EMU_MACHINE_H*/

View File

@@ -93,6 +93,8 @@ extern const device_t ps_nvr_device;
extern const device_t amstrad_nvr_device;
extern const device_t ibmat_nvr_device;
extern const device_t piix4_nvr_device;
extern const device_t ps_no_nmi_nvr_device;
extern const device_t amstrad_no_nmi_nvr_device;
extern const device_t ami_1992_nvr_device;
extern const device_t ami_1994_nvr_device;
extern const device_t ami_1995_nvr_device;

View File

@@ -2348,7 +2348,16 @@ machine_amstrad_init(const machine_t *model, int type)
memset(ams, 0x00, sizeof(amstrad_t));
ams->type = type;
device_add(&amstrad_nvr_device);
switch(type) {
case AMS_PC200:
case AMS_PPC512:
device_add(&amstrad_no_nmi_nvr_device);
break;
default:
device_add(&amstrad_nvr_device);
break;
}
machine_common_init(model);

View File

@@ -1348,7 +1348,7 @@ machine_ps2_common_init(const machine_t *model)
dma16_init();
ps2_dma_init();
device_add(&ps_nvr_device);
device_add(&ps_no_nmi_nvr_device);
pic2_init();
pit_ps2_init();

File diff suppressed because it is too large Load Diff

View File

@@ -290,11 +290,12 @@
#define RTC_REGS 14 /* number of registers */
#define FLAG_AMI_1992_HACK 0x01
#define FLAG_AMI_1994_HACK 0x02
#define FLAG_AMI_1995_HACK 0x04
#define FLAG_P6RP4_HACK 0x08
#define FLAG_PIIX4 0x10
#define FLAG_NO_NMI 0x01
#define FLAG_AMI_1992_HACK 0x02
#define FLAG_AMI_1994_HACK 0x04
#define FLAG_AMI_1995_HACK 0x08
#define FLAG_P6RP4_HACK 0x10
#define FLAG_PIIX4 0x20
typedef struct {
@@ -667,8 +668,7 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
local->addr[addr_id] = (local->addr[addr_id] & 0x7f) | 0x80;
if (local->bank[addr_id] > 0)
local->addr[addr_id] = (local->addr[addr_id] & 0x7f) | (0x80 * local->bank[addr_id]);
if (!(machines[machine].flags & MACHINE_MCA) &&
!(machines[machine].flags & MACHINE_NONMI))
if (!(local->flags & FLAG_NO_NMI))
nmi_mask = (~val & 0x80);
}
}
@@ -1033,12 +1033,16 @@ nvr_at_init(const device_t *info)
nvr->irq = 8;
local->cent = RTC_CENTURY_PS;
local->def = 0x00;
if (info->local & 8)
local->flags |= FLAG_NO_NMI;
break;
case 3: /* Amstrad PC's */
nvr->irq = 1;
local->cent = RTC_CENTURY_AT;
local->def = 0xff;
if (info->local & 8)
local->flags |= FLAG_NO_NMI;
break;
case 4: /* IBM AT */
@@ -1204,6 +1208,26 @@ const device_t piix4_nvr_device = {
.config = NULL
};
const device_t ps_no_nmi_nvr_device = {
"PS/1 or PS/2 NVRAM (No NMI)",
"ps1_nvr",
DEVICE_PS2,
10,
nvr_at_init, nvr_at_close, nvr_at_reset,
{ NULL }, nvr_at_speed_changed,
NULL
};
const device_t amstrad_no_nmi_nvr_device = {
"Amstrad NVRAM (No NMI)",
"amstrad_nvr",
DEVICE_ISA | DEVICE_AT,
11,
nvr_at_init, nvr_at_close, nvr_at_reset,
{ NULL }, nvr_at_speed_changed,
NULL
};
const device_t ami_1992_nvr_device = {
.name = "AMI Color 1992 PC/AT NVRAM",
.internal_name = "ami_1992_nvr",

View File

@@ -130,7 +130,7 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting
break;
}
for (auto* sel = config->selection; (sel->description != nullptr) && (strlen(sel->description) > 0); ++sel) {
for (auto* sel = config->selection; (sel != nullptr) && (sel->description != nullptr) && (strlen(sel->description) > 0); ++sel) {
int row = Models::AddEntry(model, sel->description, sel->value);
if (selected == sel->value) {
currentIndex = row;

View File

@@ -81,7 +81,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
(char *) config->name, config->default_int);
c = 0;
while (selection->description && selection->description[0]) {
while (selection && selection->description && selection->description[0]) {
mbstowcs(lptsTemp, selection->description,
strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -146,7 +146,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
(char *) config->name, config->default_int);
c = 0;
while (selection->description && selection->description[0]) {
while (selection && selection->description && selection->description[0]) {
mbstowcs(lptsTemp, selection->description,
strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -163,7 +163,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
(char *) config->name, config->default_int);
c = 0;
while (selection->description && selection->description[0]) {
while (selection && selection->description && selection->description[0]) {
mbstowcs(lptsTemp, selection->description,
strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -391,6 +391,8 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
id++;
break;
case CONFIG_SELECTION:
case CONFIG_HEX16:
case CONFIG_HEX20:
case CONFIG_MIDI_OUT:
case CONFIG_MIDI_IN:
case CONFIG_SPINNER: