From 0faf6692c9f9190bf5978959bd4deebab0b333a2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 16 Nov 2020 00:01:21 +0100 Subject: [PATCH] WARNING: CONFIGS MIGHT PARTIALLY BREAK WHERE DEVICE NAMES HAVE CHANGED. Changes to device_t struct to accomodate the upcoming PCI IRQ arbitration rewrite; Added device.c/h API to obtain name from the device_t struct; Significant changes to win/win_settings.c to clean up the code a bit and fix bugs; Ported all the CPU and AudioPCI commits from PCem; Added an API call to allow ACPI soft power off to gracefully stop the emulator; Removed the Siemens PCD-2L from the Dev branch because it now works; Removed the Socket 5 HP Vectra from the Dev branch because it now works; Fixed the Compaq Presario and the Micronics Spitfire; Give the IBM PC330 its own list of 486 CPU so it can have DX2's with CPUID 0x470; SMM fixes; Rewrote the SYSENTER, SYSEXIT, SYSCALL, and SYSRET instructions; Changed IDE reset period to match the specification, fixes #929; The keyboard input and output ports are now forced in front of the queue when read, fixes a number of bugs, including the AMI Apollo hanging on soft reset; Added the Intel AN430TX but Dev branched because it does not work; The network code no longer drops packets if the emulated network card has failed to receive them (eg. when the buffer is full); Changes to PCI card adding and renamed some PCI slot types, also added proper AGP bridge slot types; USB UHCI emulation is no longer a stub (still doesn't fully work, but at least Windows XP chk with Debug no longer ASSERT's on it); Fixed NVR on the the SMC FDC37C932QF and APM variants; A number of fixes to Intel 4x0 chipsets, including fixing every register of the 440LX and 440EX; Some ACPI changes. --- src/acpi.c | 55 +- src/apm.c | 6 +- src/chipset/acc2168.c | 2 +- src/chipset/ali1429.c | 2 +- src/chipset/ali1489.c | 4 +- src/chipset/ali6117.c | 2 +- src/chipset/cs4031.c | 2 +- src/chipset/cs8230.c | 2 +- src/chipset/headland.c | 8 +- src/chipset/intel_420ex.c | 2 +- src/chipset/intel_4x0.c | 463 ++-- src/chipset/intel_82335.c | 2 +- src/chipset/intel_piix.c | 48 +- src/chipset/intel_sio.c | 5 +- src/chipset/neat.c | 2 +- src/chipset/opti283.c | 2 +- src/chipset/opti291.c | 2 +- src/chipset/opti495.c | 4 +- src/chipset/opti5x7.c | 2 +- src/chipset/opti895.c | 4 +- src/chipset/scamp.c | 2 +- src/chipset/scat.c | 6 +- src/chipset/sis_85c310.c | 2 +- src/chipset/sis_85c496.c | 4 +- src/chipset/sis_85c4xx.c | 8 +- src/chipset/sis_85c50x.c | 2 +- src/chipset/stpc.c | 20 +- src/chipset/umc491.c | 2 +- src/chipset/via_apollo.c | 16 +- src/chipset/via_pipc.c | 10 +- src/chipset/via_vt82c49x.c | 4 +- src/chipset/via_vt82c505.c | 4 +- src/chipset/vl82c480.c | 2 +- src/chipset/wd76c10.c | 2 +- src/codegen_new/codegen.c | 2 +- src/codegen_new/codegen_backend_x86-64.h | 2 + src/codegen_new/codegen_backend_x86-64_ops.c | 44 + src/codegen_new/codegen_backend_x86-64_ops.h | 3 + src/codegen_new/codegen_backend_x86-64_uops.c | 17 + src/codegen_new/codegen_backend_x86.h | 2 + src/codegen_new/codegen_backend_x86_ops.c | 39 + src/codegen_new/codegen_backend_x86_ops.h | 3 + src/codegen_new/codegen_backend_x86_uops.c | 23 + src/codegen_new/codegen_block.c | 44 +- src/codegen_new/codegen_ir.c | 78 +- src/codegen_new/codegen_ir_defs.h | 7 + src/codegen_new/codegen_reg.c | 155 +- src/codegen_new/codegen_reg.h | 23 +- src/config.c | 3 + src/cpu/386.c | 52 +- src/cpu/386_common.c | 394 +-- src/cpu/386_common.h | 10 +- src/cpu/386_dynarec.c | 1023 ++++--- src/cpu/386_ops.h | 110 +- src/cpu/808x.c | 1 + src/cpu/codegen_timing_common.c | 122 +- src/cpu/cpu.c | 82 +- src/cpu/cpu.h | 29 +- src/cpu/cpu_table.c | 13 +- src/cpu/x86.h | 12 + src/cpu/x86_ops.h | 2 + src/cpu/x86_ops_cyrix.h | 274 ++ src/cpu/x86_ops_flag.h | 6 +- src/cpu/x86_ops_int.h | 2 +- src/cpu/x86_ops_mmx_mov.h | 48 +- src/cpu/x86_ops_pmode.h | 8 +- src/cpu/x86_ops_ret.h | 4 +- src/cpu/x86seg.c | 59 +- src/cpu/x86seg.h | 3 + src/ddma.c | 2 +- src/device.c | 123 + src/device/bugger.c | 2 +- src/device/hwm_gl518sm.c | 4 +- src/device/hwm_lm75.c | 4 +- src/device/hwm_lm78.c | 10 +- src/device/hwm_vt82c686.c | 2 +- src/device/ibm_5161.c | 2 +- src/device/isamem.c | 107 +- src/device/isartc.c | 32 +- src/device/keyboard_at.c | 83 +- src/device/keyboard_xt.c | 16 +- src/device/mouse.c | 10 +- src/device/mouse_bus.c | 20 +- src/device/mouse_ps2.c | 4 +- src/device/mouse_serial.c | 14 +- src/device/pci_bridge.c | 76 +- src/device/phoenix_486_jumper.c | 2 +- src/device/postcard.c | 2 +- src/device/serial.c | 8 +- src/device/smbus_piix4.c | 2 +- src/device/vpc2007.c | 2 +- src/disk/hdc.c | 119 +- src/disk/hdc_esdi_at.c | 2 +- src/disk/hdc_esdi_mca.c | 4 +- src/disk/hdc_ide.c | 24 +- src/disk/hdc_ide_cmd640.c | 10 +- src/disk/hdc_ide_opti611.c | 2 +- src/disk/hdc_ide_sff8038i.c | 2 +- src/disk/hdc_st506_at.c | 2 +- src/disk/hdc_st506_xt.c | 36 +- src/disk/hdc_xta.c | 10 +- src/disk/hdc_xtide.c | 16 +- src/dma.c | 3 + src/floppy/fdc.c | 39 +- src/floppy/fdc_pii15xb.c | 6 +- src/game/gameport.c | 6 +- src/include/86box/acpi.h | 4 +- src/include/86box/cdrom.h | 14 +- src/include/86box/device.h | 45 +- src/include/86box/fdc_ext.h | 1 - src/include/86box/hdc.h | 3 +- src/include/86box/hdd.h | 16 +- src/include/86box/isartc.h | 3 +- src/include/86box/machine.h | 8 +- src/include/86box/midi.h | 22 +- src/include/86box/mo.h | 14 +- src/include/86box/net_dp8390.h | 2 +- src/include/86box/net_ne2000.h | 2 +- src/include/86box/network.h | 4 +- src/include/86box/pci.h | 15 +- src/include/86box/plat.h | 4 + src/include/86box/scsi.h | 1 - src/include/86box/sio.h | 2 + src/include/86box/sound.h | 1 - src/include/86box/usb.h | 2 +- src/include/86box/video.h | 2 - src/include/86box/zip.h | 14 +- src/ioapic.c | 2 +- src/machine/m_amstrad.c | 40 +- src/machine/m_at.c | 9 +- src/machine/m_at_386dx_486.c | 32 +- src/machine/m_at_compaq.c | 8 +- src/machine/m_at_slot1.c | 33 +- src/machine/m_at_slot2.c | 6 +- src/machine/m_at_socket370.c | 24 +- src/machine/m_at_socket4_5.c | 67 +- src/machine/m_at_socket7.c | 72 +- src/machine/m_at_socket8.c | 2 +- src/machine/m_at_sockets7.c | 6 +- src/machine/m_at_t3100e_vid.c | 2 +- src/machine/m_europc.c | 4 +- src/machine/m_olivetti_m24.c | 2 +- src/machine/m_pcjr.c | 4 +- src/machine/m_ps1.c | 2 +- src/machine/m_ps1_hdc.c | 2 +- src/machine/m_tandy.c | 12 +- src/machine/m_xt_t1000_vid.c | 4 +- src/machine/m_xt_xi8088.c | 2 +- src/machine/m_xt_zenith.c | 2 +- src/machine/machine_table.c | 132 +- src/mem/catalyst_flash.c | 2 +- src/mem/intel_flash.c | 26 +- src/mem/rom.c | 3 +- src/mem/sst_flash.c | 10 +- src/network/net_3c503.c | 31 +- src/network/net_dp8390.c | 41 +- src/network/net_ne2000.c | 20 +- src/network/net_pcap.c | 5 +- src/network/net_pcnet.c | 32 +- src/network/net_plip.c | 12 +- src/network/net_wd8003.c | 32 +- src/network/network.c | 79 +- src/nvr_at.c | 33 +- src/nvr_ps2.c | 2 +- src/pc.c | 5 +- src/pci.c | 98 +- src/pit.c | 8 +- src/port_92.c | 8 +- src/scsi/scsi.c | 56 +- src/scsi/scsi_aha154x.c | 38 +- src/scsi/scsi_buslogic.c | 20 +- src/scsi/scsi_ncr5380.c | 22 +- src/scsi/scsi_ncr53c8xx.c | 20 +- src/scsi/scsi_pcscsi.c | 4 +- src/scsi/scsi_spock.c | 4 +- src/sio/sio_82091aa.c | 10 +- src/sio/sio_acc3221.c | 2 +- src/sio/sio_detect.c | 2 +- src/sio/sio_f82c710.c | 2 +- src/sio/sio_fdc37c661.c | 2 +- src/sio/sio_fdc37c669.c | 2 +- src/sio/sio_fdc37c66x.c | 61 +- src/sio/sio_fdc37c93x.c | 89 +- src/sio/sio_pc87306.c | 2 +- src/sio/sio_pc87307.c | 89 +- src/sio/sio_pc87309.c | 4 +- src/sio/sio_pc87332.c | 4 +- src/sio/sio_um8669f.c | 2 +- src/sio/sio_vt82c686.c | 2 +- src/sio/sio_w83787f.c | 2 +- src/sio/sio_w83877f.c | 8 +- src/sio/sio_w83977f.c | 10 +- src/sound/midi.c | 34 +- src/sound/midi_fluidsynth.c | 13 +- src/sound/midi_mt32.c | 4 +- src/sound/midi_system.c | 4 +- src/sound/snd_adlib.c | 4 +- src/sound/snd_adlibgold.c | 2 +- src/sound/snd_audiopci.c | 141 +- src/sound/snd_azt2316a.c | 8 +- src/sound/snd_cms.c | 2 +- src/sound/snd_emu8k.c | 195 +- src/sound/snd_gus.c | 8 +- src/sound/snd_mpu401.c | 8 +- src/sound/snd_pas16.c | 2 +- src/sound/snd_pssj.c | 2 +- src/sound/snd_sb.c | 70 +- src/sound/snd_sn76489.c | 4 +- src/sound/snd_ssi2001.c | 2 +- src/sound/snd_wss.c | 6 +- src/sound/sound.c | 51 +- src/usb.c | 101 +- src/video/vid_ati18800.c | 6 +- src/video/vid_ati28800.c | 12 +- src/video/vid_ati68860_ramdac.c | 2 +- src/video/vid_ati_mach64.c | 12 +- src/video/vid_att20c49x_ramdac.c | 4 +- src/video/vid_av9194.c | 2 +- src/video/vid_bt48x_ramdac.c | 10 +- src/video/vid_cga.c | 8 +- src/video/vid_cl54xx.c | 60 +- src/video/vid_colorplus.c | 6 +- src/video/vid_compaq_cga.c | 4 +- src/video/vid_ega.c | 12 +- src/video/vid_et4000.c | 12 +- src/video/vid_et4000w32.c | 10 +- src/video/vid_genius.c | 2 +- src/video/vid_hercules.c | 4 +- src/video/vid_herculesplus.c | 4 +- src/video/vid_ht216.c | 8 +- src/video/vid_icd2061.c | 4 +- src/video/vid_ics2494.c | 2 +- src/video/vid_ics2595.c | 2 +- src/video/vid_im1024.c | 2 +- src/video/vid_incolor.c | 2 +- src/video/vid_mda.c | 4 +- src/video/vid_mga.c | 4 +- src/video/vid_oak_oti.c | 14 +- src/video/vid_paradise.c | 16 +- src/video/vid_pgc.c | 2 +- src/video/vid_s3.c | 71 +- src/video/vid_s3_virge.c | 26 +- src/video/vid_sc1148x_ramdac.c | 4 +- src/video/vid_sc1502x_ramdac.c | 2 +- src/video/vid_sdac_ramdac.c | 4 +- src/video/vid_sigma.c | 6 +- src/video/vid_stg_ramdac.c | 2 +- src/video/vid_table.c | 255 +- src/video/vid_tgui9440.c | 6 +- src/video/vid_ti_cf62011.c | 2 +- src/video/vid_tkd8001_ramdac.c | 2 +- src/video/vid_tvga.c | 8 +- src/video/vid_vga.c | 6 +- src/video/vid_voodoo.c | 2 +- src/video/vid_wy700.c | 2 +- src/win/86Box.rc | 18 +- src/win/Makefile.mingw | 30 - src/win/win_devconf.c | 26 +- src/win/win_settings.c | 2449 ++++++----------- src/win/win_ui.c | 19 + 260 files changed, 5122 insertions(+), 4471 deletions(-) create mode 100644 src/cpu/x86_ops_cyrix.h diff --git a/src/acpi.c b/src/acpi.c index c77a18d79..467fad473 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -82,25 +82,34 @@ acpi_update_irq(void *priv) static void -acpi_raise_smi(void *priv) +acpi_raise_smi_common(void *priv) { acpi_t *dev = (acpi_t *) priv; if ((dev->vendor == VEN_VIA) || (dev->vendor == VEN_VIA_596B)) { - if ((dev->regs.glbctl & 0x01) && (!dev->regs.smi_lock || !dev->regs.smi_active)) { + if ((!dev->regs.smi_lock || !dev->regs.smi_active)) { smi_line = 1; dev->regs.smi_active = 1; } } else if (dev->vendor == VEN_INTEL) { - if (dev->regs.glbctl & 0x01) { - smi_line = 1; - /* Clear bit 16 of GLBCTL. */ - dev->regs.glbctl &= ~0x00010000; - } - } else if (dev->vendor == VEN_SMC) { - if (dev->regs.glbctl & 0x01) - smi_line = 1; - } + smi_line = 1; + /* Clear bit 16 of GLBCTL. */ + dev->regs.glbctl &= ~0x00010000; + } else if (dev->vendor == VEN_SMC) + smi_line = 1; +} + + +static void +acpi_raise_smi(void *priv) +{ + acpi_t *dev = (acpi_t *) priv; + + if ((dev->vendor == VEN_INTEL) && !(dev->regs.glbctl & 0x00010000)) + return; + + if (dev->regs.glbctl & 0x01) + acpi_raise_smi_common(dev); } @@ -449,7 +458,7 @@ acpi_reg_write_common_regs(int size, uint16_t addr, uint8_t val, void *p) switch (sus_typ) { case 0: /* Soft power off. */ - quited = 1; + plat_power_off(); break; case 1: /* Suspend to RAM. */ @@ -1081,6 +1090,14 @@ acpi_set_irq_line(acpi_t *dev, int irq_line) } +void +acpi_set_gpireg2_default(acpi_t *dev, uint8_t gpireg2_default) +{ + dev->gpireg2_default = gpireg2_default; + dev->regs.gpireg[2] = dev->gpireg2_default; +} + + void acpi_set_nvr(acpi_t *dev, nvr_t *nvr) { @@ -1093,7 +1110,7 @@ acpi_apm_out(uint16_t port, uint8_t val, void *p) { acpi_t *dev = (acpi_t *) p; - acpi_log("[%04X:%08X] APM write: %04X = %02X (BX = %04X, CX = %04X)\n", CS, cpu_state.pc, port, val, BX, CX); + acpi_log("[%04X:%08X] APM write: %04X = %02X (AX = %04X, BX = %04X, CX = %04X)\n", CS, cpu_state.pc, port, val, AX, BX, CX); port &= 0x0001; @@ -1102,7 +1119,7 @@ acpi_apm_out(uint16_t port, uint8_t val, void *p) if (dev->apm->do_smi) { if (dev->vendor == VEN_INTEL) dev->regs.glbsts |= 0x20; - acpi_raise_smi(dev); + acpi_raise_smi_common(dev); } } else dev->apm->stat = val; @@ -1141,7 +1158,7 @@ acpi_reset(void *priv) - Bit 2: 80-conductor cable on primary IDE channel (active low) Gigabyte GA-686BX: - Bit 1: CMOS battery low (active high) */ - dev->regs.gpireg[2] = 0xf1; + dev->regs.gpireg[2] = dev->gpireg2_default; for (i = 0; i < 4; i++) dev->regs.gporeg[i] = dev->gporeg_default[i]; if (dev->vendor == VEN_VIA_596B) { @@ -1212,7 +1229,7 @@ const device_t acpi_intel_device = acpi_init, acpi_close, acpi_reset, - NULL, + { NULL }, acpi_speed_changed, NULL, NULL @@ -1227,7 +1244,7 @@ const device_t acpi_via_device = acpi_init, acpi_close, acpi_reset, - NULL, + { NULL }, acpi_speed_changed, NULL, NULL @@ -1242,7 +1259,7 @@ const device_t acpi_via_596b_device = acpi_init, acpi_close, acpi_reset, - NULL, + { NULL }, acpi_speed_changed, NULL, NULL @@ -1257,7 +1274,7 @@ const device_t acpi_smc_device = acpi_init, acpi_close, acpi_reset, - NULL, + { NULL }, acpi_speed_changed, NULL, NULL diff --git a/src/apm.c b/src/apm.c index 38d223e88..9b667d72c 100644 --- a/src/apm.c +++ b/src/apm.c @@ -131,7 +131,7 @@ const device_t apm_device = apm_init, apm_close, NULL, - NULL, + { NULL }, NULL, NULL, NULL @@ -146,7 +146,7 @@ const device_t apm_pci_device = apm_init, apm_close, apm_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -161,7 +161,7 @@ const device_t apm_pci_acpi_device = apm_init, apm_close, apm_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/acc2168.c b/src/chipset/acc2168.c index 8fc75a9fe..5461cb71a 100644 --- a/src/chipset/acc2168.c +++ b/src/chipset/acc2168.c @@ -106,6 +106,6 @@ const device_t acc2168_device = { 0, 0, acc2168_init, acc2168_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/ali1429.c b/src/chipset/ali1429.c index f52c5ef50..e9c83b0f7 100644 --- a/src/chipset/ali1429.c +++ b/src/chipset/ali1429.c @@ -189,6 +189,6 @@ const device_t ali1429_device = { 0, 0, ali1429_init, ali1429_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/ali1489.c b/src/chipset/ali1489.c index 010ab274f..180db433d 100644 --- a/src/chipset/ali1489.c +++ b/src/chipset/ali1489.c @@ -512,7 +512,7 @@ ali1489_init(const device_t *info) io_sethandler(0x0fc, 0x0001, ali1489_ide_read, NULL, NULL, ali1489_ide_write, NULL, NULL, dev); /* Dummy M1489 PCI device */ - pci_add_card(0, ali1489_pci_read, ali1489_pci_write, dev); + pci_add_card(PCI_ADD_NORTHBRIDGE, ali1489_pci_read, ali1489_pci_write, dev); ide_pri_disable(); ide_sec_disable(); @@ -540,7 +540,7 @@ const device_t ali1489_device = { ali1489_init, ali1489_close, ali1489_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index efd6937f6..d9d2444df 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -336,7 +336,7 @@ const device_t ali6117d_device = ali6117_init, ali6117_close, ali6117_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/cs4031.c b/src/chipset/cs4031.c index d958dad7f..2765025d9 100644 --- a/src/chipset/cs4031.c +++ b/src/chipset/cs4031.c @@ -195,6 +195,6 @@ const device_t cs4031_device = { 0, 0, cs4031_init, cs4031_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/cs8230.c b/src/chipset/cs8230.c index a0f64d55c..90432e271 100644 --- a/src/chipset/cs8230.c +++ b/src/chipset/cs8230.c @@ -155,6 +155,6 @@ const device_t cs8230_device = { 0, 0, cs8230_init, cs8230_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; \ No newline at end of file diff --git a/src/chipset/headland.c b/src/chipset/headland.c index 1c569111c..333dcd009 100644 --- a/src/chipset/headland.c +++ b/src/chipset/headland.c @@ -694,7 +694,7 @@ const device_t headland_gc10x_device = { 0, 0, headland_init, headland_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -703,7 +703,7 @@ const device_t headland_ht18a_device = { 0, 1, headland_init, headland_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -712,7 +712,7 @@ const device_t headland_ht18b_device = { 0, 2, headland_init, headland_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -721,6 +721,6 @@ const device_t headland_ht18c_device = { 0, 8, headland_init, headland_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/intel_420ex.c b/src/chipset/intel_420ex.c index 21c57da44..6885bf9d3 100644 --- a/src/chipset/intel_420ex.c +++ b/src/chipset/intel_420ex.c @@ -546,7 +546,7 @@ const device_t i420ex_device = i420ex_init, i420ex_close, i420ex_reset, - NULL, + { NULL }, i420ex_speed_changed, NULL, NULL diff --git a/src/chipset/intel_4x0.c b/src/chipset/intel_4x0.c index efe6a394a..7373e48e9 100644 --- a/src/chipset/intel_4x0.c +++ b/src/chipset/intel_4x0.c @@ -108,7 +108,8 @@ i4x0_smram_handler_phase0(i4x0_t *dev) { uint32_t tom = (mem_size << 10); - if ((dev->type >= INTEL_440BX) && smram_enabled(dev->smram_high)) { + if (((dev->type == INTEL_430TX) || (dev->type >= INTEL_440BX)) && + smram_enabled(dev->smram_high)) { tom -= (1 << 20); mem_set_mem_state_smm(tom, (1 << 20), MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); } @@ -123,33 +124,39 @@ i4x0_smram_handler_phase1(i4x0_t *dev) { uint8_t *regs = (uint8_t *) dev->regs; uint32_t tom = (mem_size << 10); + uint8_t *ext_reg = (dev->type >= INTEL_440BX) ? &(regs[0x73]) : &(regs[0x71]); - uint32_t s, base[2] = { 0x000a0000, 0x00020000 }; - uint32_t size[2] = { 0, 0 }; + uint32_t s, base[2] = { 0x000a0000, 0x00000000 }; + uint32_t size[2] = { 0x00010000, 0x00000000 }; if (dev->type >= INTEL_430FX) { /* Set temporary bases and sizes. */ - if ((dev->type >= INTEL_440BX) && (regs[0x73] & 0x80)) { + if (((dev->type == INTEL_430TX) || (dev->type >= INTEL_440BX)) && + (*ext_reg & 0x80)) { base[0] = 0x100a0000; size[0] = 0x00060000; + } else if (((dev->type == INTEL_440LX) || (dev->type == INTEL_440EX)) && ((regs[0x72] & 0x07) == 0x04)) { + base[0] = 0x000c0000; + size[0] = 0x00010000; } else { - if (((dev->type == INTEL_440LX) || (dev->type == INTEL_440EX)) && ((regs[0x72] & 0x07) == 0x04)) { - base[0] = 0x000c0000; - size[0] = 0x00010000; - } else { - base[0] = 0x000a0000; - size[0] = 0x00020000; - } + base[0] = 0x000a0000; + size[0] = 0x00020000; } - if (((regs[0x72] & 0x70) == 0x40) || ((regs[0x72] & 0x08) && !(regs[0x72] & 0x20))) + if (((regs[0x72] & 0x78) == 0x48) || ((regs[0x72] & 0x28) == 0x08)) smram_enable(dev->smram_low, base[0], base[0] & 0x000f0000, size[0], - ((regs[0x72] & 0x70) == 0x40), ((regs[0x72] & 0x08) && !(regs[0x72] & 0x20))); + ((regs[0x72] & 0x78) == 0x48), (regs[0x72] & 0x08)); + + if ((regs[0x72] & 0x28) == 0x28) { + /* If SMRAM is enabled and DCLS is set, then data goes to PCI, but + code still goes to DRAM. */ + mem_set_mem_state_smram_ex(1, base[0], size[0], 0x02); + } /* TSEG mapping. */ - if (dev->type >= INTEL_440BX) { - if ((regs[0x72] & 0x08) && (regs[0x73] & 0x01)) { - size[1] = (1 << (17 + ((regs[0x73] >> 1) & 0x03))); + if ((dev->type == INTEL_430TX) || (dev->type >= INTEL_440BX)) { + if ((regs[0x72] & 0x08) && (*ext_reg & 0x01)) { + size[1] = (1 << (17 + ((*ext_reg >> 1) & 0x03))); tom -= size[1]; base[1] = tom; } else @@ -184,9 +191,15 @@ i4x0_smram_handler_phase1(i4x0_t *dev) break; } - if (((((regs[0x72] & 0x38) == 0x20) || s) || (!(regs[0x72] & 0x10) || s)) && (size[0] != 0x00000000)) { + if (size[0] != 0x00000000) { smram_enable(dev->smram_low, base[0], base[0], size[0], - (((regs[0x72] & 0x38) == 0x20) || s), (!(regs[0x72] & 0x10) || s)); + (((regs[0x72] & 0x38) == 0x20) || s), 1); + + if (regs[0x72] & 0x10) { + /* If SMRAM is enabled and DCLS is set, then data goes to PCI, but + code still goes to DRAM. */ + mem_set_mem_state_smram_ex(1, base[0], size[0], 0x02); + } } } @@ -232,12 +245,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) uint8_t *regs_l = (uint8_t *) dev->regs_locked; int i; - if (func) + if (func > 0) return; - if ((addr >= 0x10) && (addr < 0x4f)) - return; - if (func == 0) switch (addr) { case 0x04: /*Command register*/ switch (dev->type) { @@ -247,34 +257,45 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) regs[0x04] = (regs[0x04] & ~0x42) | (val & 0x42); break; case INTEL_430FX: case INTEL_430HX: case INTEL_430VX: case INTEL_430TX: - case INTEL_440FX: case INTEL_440LX: case INTEL_440EX: + case INTEL_440FX: regs[0x04] = (regs[0x04] & ~0x02) | (val & 0x02); break; + case INTEL_440LX: case INTEL_440EX: + regs[0x04] = val & 0x40; + break; } break; case 0x05: switch (dev->type) { - case INTEL_420TX: case INTEL_420ZX: case INTEL_430LX: case INTEL_430NX: case INTEL_430HX: - case INTEL_440FX: case INTEL_440LX: case INTEL_440EX: - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_420TX: case INTEL_420ZX: case INTEL_430LX: case INTEL_430NX: + case INTEL_430HX: case INTEL_440FX: case INTEL_440BX: case INTEL_440GX: + case INTEL_440ZX: regs[0x05] = (regs[0x05] & ~0x01) | (val & 0x01); break; + case INTEL_440LX: case INTEL_440EX: + regs[0x05] = val & 0x01; + break; } break; case 0x07: switch (dev->type) { - case INTEL_420TX: case INTEL_420ZX: case INTEL_430LX: case INTEL_430NX: case INTEL_430HX: + case INTEL_420TX: case INTEL_420ZX: case INTEL_430LX: case INTEL_430NX: + case INTEL_430HX: default: regs[0x07] &= ~(val & 0x70); break; - case INTEL_430FX: case INTEL_430VX: case INTEL_430TX: - case INTEL_440LX: case INTEL_440EX: + case INTEL_430FX: case INTEL_430VX: + case INTEL_430TX: regs[0x07] &= ~(val & 0x30); break; case INTEL_440FX: regs[0x07] &= ~(val & 0xf9); break; - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + regs[0x07] &= ~(val & 0xf1); + break; + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x07] &= ~(val & 0xf0); break; } @@ -298,7 +319,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0x12: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x12] = (val & 0xc0); i4x0_mask_bar(regs); break; @@ -306,7 +329,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0x13: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x13] = val; i4x0_mask_bar(regs); break; @@ -314,7 +339,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0x2c: case 0x2d: case 0x2e: case 0x2f: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: if (!regs_l[addr]) { regs[addr] = val; regs_l[addr] = 1; @@ -323,14 +349,6 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) } break; - case 0x34: - switch (dev->type) { - case INTEL_440LX: case INTEL_440EX: - regs[0x34] = (val & 0xa0); - break; - } - break; - case 0x4f: switch (dev->type) { case INTEL_430HX: @@ -366,18 +384,16 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) regs[0x50] = (val & 0xf4); break; case INTEL_440LX: - regs[0x50] = (val & 0x03); + regs[0x50] = (val & 0x70); break; case INTEL_440EX: - regs[0x50] = (val & 0x23); + regs[0x50] = (val & 0x20); break; case INTEL_440BX: regs[0x50] = (regs[0x50] & 0x14) | (val & 0xeb); break; case INTEL_440GX: - /* TODO: Understand it more specifically */ - regs[0x50] = (regs[0x50] & 0x2b) | (val & 0x28); - /*regs[0x50] = (regs[0x50] & 0x2b) | (val & 0xd7);*/ + regs[0x50] = (regs[0x50] & 0x04) | (val & 0xe8); break; case INTEL_440ZX: regs[0x50] = (regs[0x50] & 0x34) | (val & 0xcb); @@ -393,17 +409,17 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440FX: regs[0x51] = (val & 0xc3); break; - case INTEL_440LX: case INTEL_440EX: - regs[0x51] = (val & 0x80); + case INTEL_440LX: + regs[0x51] = (regs[0x51] & 0x40) | (val & 0x87); + break; + case INTEL_440EX: + regs[0x51] = (val & 0x86); break; case INTEL_440BX: case INTEL_440ZX: - regs[0x51] = (regs[0x50] & 0x70) | (val & 0x8f); - if (is_vpc) - regs[0x51] |= 0x10; /* Virtual PC 2007 BIOS requires a reserved bus speed bit to be set */ + regs[0x51] = (regs[0x51] & 0x70) | (val & 0x8f); break; case INTEL_440GX: - regs[0x51] = (regs[0x50] & 0x88) | (val & 0x08); - /*regs[0x51] = (regs[0x50] & 0x88) | (val & 0x77);*/ + regs[0x51] = (regs[0x51] & 0xb0) | (val & 0x4f); break; } break; @@ -419,10 +435,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440FX: regs[0x52] = val; break; - case INTEL_440LX: - regs[0x52] = (val & 0xd0); - break; - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x52] = val & 0x07; break; } @@ -439,10 +453,10 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430VX: case INTEL_430TX: regs[0x53] = val & 0x3f; break; - case INTEL_440LX: - regs[0x53] = val & 0x0a; + case INTEL_440LX: case INTEL_440EX: + regs[0x53] = val & 0x60; break; - case INTEL_440EX: case INTEL_440BX: case INTEL_440GX: + case INTEL_440BX: case INTEL_440GX: /* Not applicable to 440ZX as that does not support ECC. */ regs[0x53] = val; break; @@ -463,9 +477,6 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440FX: regs[0x54] = val & 0x82; break; - case INTEL_440LX: - regs[0x54] = val; - break; } break; case 0x55: @@ -500,8 +511,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430TX: regs[0x56] = val & 0x76; break; - case INTEL_440FX: case INTEL_440LX: - case INTEL_440EX: + case INTEL_440FX: + case INTEL_440LX: case INTEL_440EX: regs[0x56] = val; break; } @@ -512,7 +523,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430LX: default: regs[0x57] = val & 0x3f; break; - case INTEL_430NX: case INTEL_440EX: + case INTEL_430NX: regs[0x57] = val; break; case INTEL_430FX: case INTEL_430HX: @@ -525,8 +536,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440FX: regs[0x57] = val & 0x77; break; - case INTEL_440LX: - regs[0x57] = val & 0x11; + case INTEL_440LX: case INTEL_440EX: + regs[0x57] = val & 0x37; break; case INTEL_440BX: case INTEL_440GX: regs[0x57] = val & 0x3f; @@ -542,7 +553,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430LX: default: regs[0x58] = val & 0x01; break; - case INTEL_430NX: case INTEL_440LX: + case INTEL_430NX: case INTEL_440BX: case INTEL_440ZX: regs[0x58] = val & 0x03; break; @@ -550,13 +561,11 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) regs[0x58] = val & 0x7f; break; case INTEL_430HX: case INTEL_430VX: - regs[0x57] = val; + case INTEL_440LX: case INTEL_440EX: + regs[0x58] = val; break; case INTEL_430TX: - regs[0x57] = val & 0x7b; - break; - case INTEL_440EX: - regs[0x58] = val & 0xbf; + regs[0x58] = val & 0x7b; break; } break; @@ -628,6 +637,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440FX: case INTEL_440LX: case INTEL_440EX: case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: default: regs[addr] = val; break; @@ -683,8 +693,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) } switch (dev->type) { case INTEL_430NX: case INTEL_430HX: - case INTEL_440FX: case INTEL_440LX: - case INTEL_440EX: + case INTEL_440FX: + case INTEL_440LX: case INTEL_440EX: case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: regs[addr] = val; @@ -706,16 +716,14 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430FX: regs[0x68] = val & 0x1f; break; - case INTEL_440FX: case INTEL_440LX: - case INTEL_440EX: + case INTEL_440FX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440GX: regs[0x68] = val & 0xc0; break; case INTEL_440BX: regs[0x68] = (regs[0x68] & 0x38) | (val & 0xc7); break; - case INTEL_440GX: - regs[0x68] = (regs[0x68] & 0xc0) | (val & 0x3f); - break; case INTEL_440ZX: regs[0x68] = (regs[0x68] & 0x3f) | (val & 0xc0); break; @@ -724,14 +732,13 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x69: switch (dev->type) { case INTEL_430NX: - case INTEL_440BX: - case INTEL_440GX: + case INTEL_440BX: case INTEL_440GX: regs[0x69] = val; break; case INTEL_430VX: regs[0x69] = val & 0x07; break; - case INTEL_440ZX: + case INTEL_440ZX: regs[0x69] = val & 0x3f; break; } @@ -739,12 +746,13 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x6a: case 0x6b: switch (dev->type) { case INTEL_430NX: - case INTEL_440LX: - case INTEL_440EX: - case INTEL_440BX: - case INTEL_440GX: + case INTEL_440BX: case INTEL_440GX: regs[addr] = val; break; + case INTEL_440LX: case INTEL_440EX: + if (addr == 0x6a) + regs[addr] = val & 0xef; + break; case INTEL_440ZX: if (addr == 0x6a) regs[addr] = val & 0xfc; @@ -755,11 +763,10 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0x6c: case 0x6d: case 0x6e: switch (dev->type) { - case INTEL_440LX: - case INTEL_440EX: - case INTEL_440BX: - case INTEL_440GX: - regs[addr] = val; + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440GX: + if (addr != 0x6e) + regs[addr] = val; break; case INTEL_440ZX: if (addr == 0x6c) @@ -770,11 +777,13 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) } break; case 0x6f: - switch (dev->type){ + switch (dev->type) { case INTEL_440LX: + regs[addr] = val; + break; case INTEL_440EX: - regs[addr] = val; - break; + regs[addr] = val & 0xcf; + break; } break; case 0x70: @@ -789,8 +798,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430VX: case INTEL_430TX: regs[addr] = val & 0xfc; break; - case INTEL_440FX: case INTEL_440LX: - case INTEL_440EX: + case INTEL_440FX: + case INTEL_440LX: case INTEL_440EX: regs[addr] = val & 0xf8; break; } @@ -801,7 +810,14 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430LX: regs[addr] = val & 0x4d; break; - case INTEL_430TX: case INTEL_440EX: + case INTEL_430TX: + if (!dev->smram_locked) { + i4x0_smram_handler_phase0(dev); + regs[0x71] = (regs[0x71] & 0x20) | (val & 0xdf); + i4x0_smram_handler_phase1(dev); + } + break; + case INTEL_440EX: regs[addr] = val; break; case INTEL_440FX: case INTEL_440LX: @@ -815,8 +831,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) if (dev->smram_locked) regs[0x72] = (regs[0x72] & 0xdf) | (val & 0x20); else { - if ((dev->type == INTEL_440LX) || (dev->type == INTEL_440EX)) - regs[0x72] = (regs[0x72] & 0x80) | (val & 0x7f); + if ((dev->type == INTEL_440LX) || (dev->type == INTEL_440EX) || + (dev->type == INTEL_440GX)) + regs[0x72] = (val & 0x7f); else regs[0x72] = (regs[0x72] & 0x87) | (val & 0x78); dev->smram_locked = (val & 0x10); @@ -840,10 +857,11 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430VX: regs[0x73] = val & 0x03; break; - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: if (!dev->smram_locked) { i4x0_smram_handler_phase0(dev); - regs[0x73] = (regs[0x72] & 0x38) | (val & 0xc7); + regs[0x73] = (regs[0x73] & 0x38) | (val & 0xc7); i4x0_smram_handler_phase1(dev); } break; @@ -853,6 +871,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) switch (dev->type) { case INTEL_430VX: case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x74] = val; break; } @@ -860,13 +879,14 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x75: case 0x76: case 0x7b: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[addr] = val; } break; case 0x77: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: regs[0x77] = val & 0x03; } break; @@ -875,9 +895,12 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_430VX: regs[0x78] = val & 0xcf; break; - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: regs[0x78] = val & 0x0f; break; + case INTEL_440GX: + regs[0x78] = val & 0x1f; + break; } break; case 0x79: @@ -888,14 +911,16 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) if (val & 0x40) io_sethandler(0x0022, 0x01, pm2_cntrl_read, NULL, NULL, pm2_cntrl_write, NULL, NULL, dev); break; - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x79] = val; break; } break; case 0x7a: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x7a] = (regs[0x7a] & 0x0a) | (val & 0xf5); io_removehandler(0x0022, 0x01, pm2_cntrl_read, NULL, NULL, pm2_cntrl_write, NULL, NULL, dev); if (val & 0x40) @@ -931,6 +956,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x80: switch (dev->type) { case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x80] &= ~(val & 0x03); break; } @@ -938,19 +964,20 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x90: switch (dev->type) { case INTEL_430HX: - regs[0x80] = val & 0x87; + regs[0x90] = val & 0x87; break; case INTEL_440FX: - regs[0x80] = val & 0x1b; + regs[0x90] = val & 0x1b; break; case INTEL_440LX: - regs[0x80] = val & 0x08; + regs[0x90] = val & 0xfb; break; - case INTEL_440EX: case INTEL_440GX: - regs[0x80] = val & 0x18; + case INTEL_440EX: + regs[0x90] = val & 0xf8; break; case INTEL_440BX: case INTEL_440ZX: - regs[0x7c] = val; + case INTEL_440GX: + regs[0x90] = val; break; } break; @@ -958,8 +985,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) switch (dev->type) { case INTEL_430HX: case INTEL_440BX: case INTEL_440FX: case INTEL_440LX: - case INTEL_440EX: case INTEL_440GX: - /* Not applicable on 82443ZX. */ + case INTEL_440GX: + /* Not applicable on 82443EX and 82443ZX. */ regs[0x91] &= ~(val & 0x11); break; } @@ -967,8 +994,10 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x92: switch (dev->type) { case INTEL_440LX: case INTEL_440EX: - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + regs[0x92] &= ~(val & 0x07); + break; + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0x92] &= ~(val & 0x1f); break; } @@ -976,45 +1005,56 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0x93: switch (dev->type) { case INTEL_440FX: - case INTEL_440LX: - case INTEL_440EX: regs[0x93] = (val & 0x0f); trc_write(0x0093, val & 0x06, NULL); break; + case INTEL_440LX: case INTEL_440EX: + regs[0x93] = (val & 0x0e); + trc_write(0x0093, val & 0x06, NULL); + break; + } + break; + case 0xa7: + switch (dev->type) { + case INTEL_440LX: case INTEL_440EX: + regs[0xa7] = val & 0x1f; + break; } break; case 0xa8: case 0xa9: switch (dev->type) { + case INTEL_440LX: case INTEL_440EX: case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[addr] = (val & 0x03); break; } break; case 0xb0: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0xb0] = (val & 0x80); break; } break; case 0xb1: switch (dev->type) { - case INTEL_440EX: + case INTEL_440LX: case INTEL_440EX: regs[0xb1] = (val & 0x22); break; case INTEL_440BX: case INTEL_440ZX: - regs[0xb1] = (val & 0xa0); - break; case INTEL_440GX: - regs[0xb1] = (val & 0xa2); + regs[0xb1] = (val & 0xa0); break; } break; case 0xb4: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0xb4] = (val & 0x3f); i4x0_mask_bar(regs); break; @@ -1022,8 +1062,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0xb9: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0xb9] = (val & 0xf0); break; } @@ -1031,8 +1072,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0xba: case 0xbb: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440LX: case INTEL_440EX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[addr] = val; break; } @@ -1040,7 +1082,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0xbc: switch (dev->type) { - case INTEL_440EX: case INTEL_440GX: + case INTEL_440LX: case INTEL_440EX: regs[addr] = (val & 0xf8); break; } @@ -1048,16 +1090,17 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0xbd: switch (dev->type) { - case INTEL_440EX: case INTEL_440GX: + case INTEL_440LX: case INTEL_440EX: regs[addr] = (val & 0xf8); break; } break; - case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7: + case 0xd0: case 0xd1: case 0xd2: case 0xd3: + case 0xd4: case 0xd5: case 0xd6: case 0xd7: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[addr] = val; break; } @@ -1095,8 +1138,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: if (!regs_l[addr]) regs[addr] = val; break; @@ -1104,8 +1147,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0xe5: case 0xed: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: if (!regs_l[addr]) regs[addr] = (val & 0x3f); break; @@ -1113,8 +1156,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0xe7: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0xe7] = 0x80; for (i = 0; i < 16; i++) regs_l[0xe0 + i] = !!(val & 0x80); @@ -1126,79 +1169,17 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case 0xf0: switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: + case INTEL_440BX: case INTEL_440ZX: + case INTEL_440GX: regs[0xf0] = (val & 0xc0); break; } break; case 0xf1: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[0xf1] = (val & 0x03); - break; - } - break; - } else if (func == 1) switch (addr) { - case 0x04: switch (dev->type) { case INTEL_440BX: case INTEL_440ZX: - regs[0x04] = (val & 0x1f); - break; - case INTEL_440GX: - regs[0x04] = val; - } - break; - case 0x05: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[0x05] = (val & 0x01); - break; - } - break; - case 0x0d: case 0x1b: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[addr] = (val & 0xf8); - break; - } - break; - case 0x19: case 0x1a: - case 0x21: case 0x23: - case 0x25: case 0x27: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[addr] = val; - break; - } - break; - case 0x1c: case 0x1d: - case 0x20: case 0x22: - case 0x24: case 0x26: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[addr] = (val & 0xf0); - break; - } - break; - case 0x1f: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[0x1f] &= ~(val & 0xf0); - break; - } - break; - case 0x3e: - switch (dev->type) { - case INTEL_440BX: case INTEL_440GX: - case INTEL_440ZX: - regs[0x3e] = (val & 0xed); + case INTEL_440GX: + regs[0xf1] = (val & 0x03); break; } break; @@ -1213,13 +1194,13 @@ i4x0_read(int func, int addr, void *priv) uint8_t ret = 0xff; uint8_t *regs = (uint8_t *) dev->regs; - if (func) - ret = 0xff; - else { + if (func == 0) { ret = regs[addr]; /* Special behavior for 440FX register 0x93 which is basically TRC in PCI space with the addition of bits 3 and 0. */ - if ((func == 0) && (addr == 0x93) && (dev->type == INTEL_440FX)) + if ((func == 0) && (addr == 0x93) && + ((dev->type == INTEL_440FX) || (dev->type == INTEL_440LX) || + (dev->type == INTEL_440EX))) ret = (ret & 0xf9) | (trc_read(0x0093, NULL) & 0x06); } @@ -1252,9 +1233,9 @@ i4x0_reset(void *priv) i4x0_write(0, 0x72, 0x00, priv); } - if ((dev->type == INTEL_440LX) || (dev->type == INTEL_440BX) || (dev->type == INTEL_440ZX)) { + if ((dev->type == INTEL_440LX) || (dev->type == INTEL_440BX) || + (dev->type == INTEL_440ZX)) memset(dev->regs_locked, 0x00, 256 * sizeof(uint8_t)); - } } @@ -1453,15 +1434,16 @@ static void break; case INTEL_440LX: regs[0x02] = 0x80; regs[0x03] = 0x71; /* 82443LX */ + regs[0x08] = 0x03; regs[0x06] = 0x90; regs[0x10] = 0x08; regs[0x34] = 0xa0; - if (cpu_busspeed <= 66666667) + if (cpu_busspeed <= 60000000) + regs[0x51] |= 0x40; + else if ((cpu_busspeed > 60000000) && (cpu_busspeed <= 66666667)) regs[0x51] |= 0x00; - else if ((cpu_busspeed > 66666667) && (cpu_busspeed <= 100000000)) - regs[0x51] |= 0x20; regs[0x53] = 0x83; - regs[0x57] = 0x28; + regs[0x57] = 0x01; regs[0x60] = regs[0x61] = regs[0x62] = regs[0x63] = regs[0x64] = regs[0x65] = regs[0x66] = regs[0x67] = 0x01; regs[0x6c] = regs[0x6d] = regs[0x6e] = regs[0x6f] = 0x55; regs[0x72] = 0x02; @@ -1476,15 +1458,13 @@ static void break; case INTEL_440EX: regs[0x02] = 0x80; regs[0x03] = 0x71; /* 82443EX. Same Vendor ID as 440LX */ + regs[0x08] = 0x03; regs[0x06] = 0x90; regs[0x10] = 0x08; regs[0x34] = 0xa0; - if (cpu_busspeed <= 66666667) - regs[0x51] |= 0x00; - else if ((cpu_busspeed > 66666667) && (cpu_busspeed <= 100000000)) - regs[0x51] |= 0x20; + regs[0x51] = 0x80; regs[0x53] = 0x83; - regs[0x57] = 0x28; + regs[0x57] = 0x01; regs[0x60] = regs[0x61] = regs[0x62] = regs[0x63] = regs[0x64] = regs[0x65] = regs[0x66] = regs[0x67] = 0x01; regs[0x6c] = regs[0x6d] = regs[0x6e] = regs[0x6f] = 0x55; regs[0x72] = 0x02; @@ -1509,8 +1489,6 @@ static void regs[0x51] |= 0x20; else if ((cpu_busspeed > 66666667) && (cpu_busspeed <= 100000000)) regs[0x51] |= 0x00; - if (is_vpc) - regs[0x51] |= 0x10; /* Virtual PC 2007 BIOS requires a reserved bus speed bit to be set */ regs[0x57] = 0x28; /* 4 DIMMs, SDRAM */ regs[0x58] = 0x03; regs[0x60] = regs[0x61] = regs[0x62] = regs[0x63] = regs[0x64] = regs[0x65] = regs[0x66] = regs[0x67] = 0x01; @@ -1532,12 +1510,9 @@ static void regs[0x02] = (regs[0x7a] & 0x02) ? 0xa2 : 0xa0; regs[0x03] = 0x71; /* 82443GX */ regs[0x06] = (regs[0x7a] & 0x02) ? 0x00 : 0x10; - regs[0x08] = 0x02; regs[0x10] = 0x08; regs[0x34] = (regs[0x7a] & 0x02) ? 0x00 : 0xa0; - regs[0x51] |= 0x20; regs[0x57] = 0x28; - regs[0x58] = 0x03; regs[0x60] = regs[0x61] = regs[0x62] = regs[0x63] = regs[0x64] = regs[0x65] = regs[0x66] = regs[0x67] = 0x01; regs[0x72] = 0x02; regs[0x73] = 0x38; @@ -1590,7 +1565,7 @@ const device_t i420tx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1605,7 +1580,7 @@ const device_t i420zx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1620,7 +1595,7 @@ const device_t i430lx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1635,7 +1610,7 @@ const device_t i430nx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1650,7 +1625,7 @@ const device_t i430fx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1665,7 +1640,7 @@ const device_t i430fx_rev02_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1680,7 +1655,7 @@ const device_t i430hx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1695,7 +1670,7 @@ const device_t i430vx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1710,7 +1685,7 @@ const device_t i430tx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1725,7 +1700,7 @@ const device_t i440fx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1739,7 +1714,7 @@ const device_t i440lx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1753,7 +1728,7 @@ const device_t i440ex_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1768,7 +1743,7 @@ const device_t i440bx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1782,7 +1757,7 @@ const device_t i440gx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1796,7 +1771,7 @@ const device_t i440zx_device = i4x0_init, i4x0_close, i4x0_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/intel_82335.c b/src/chipset/intel_82335.c index 07d84f8c5..f64da0330 100644 --- a/src/chipset/intel_82335.c +++ b/src/chipset/intel_82335.c @@ -206,6 +206,6 @@ const device_t intel_82335_device = { 0, 0, intel_82335_init, intel_82335_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index 4d2919219..2d87cdf70 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -539,6 +539,9 @@ piix_write(int func, int addr, uint8_t val, void *priv) fregs[addr] = (fregs[addr] & 0x8c) | (val & 0x73); else if (dev->type == 5) fregs[addr] = val & 0x7f; + + if (dev->type >= 4) + alt_access = !!(val & 0x20); break; case 0xb1: if (dev->type > 3) @@ -1069,7 +1072,7 @@ piix_reset_hard(piix_t *dev) if (dev->type == 4) fregs[0x08] = dev->rev & 0x07; else if (dev->type < 4) - fregs[0x08] = dev->rev; + fregs[0x08] = 0x01; else fregs[0x08] = 0x02; if (dev->type > 4) @@ -1096,7 +1099,7 @@ piix_reset_hard(piix_t *dev) if (dev->type > 4) fregs[0x08] = 0x02; else - fregs[0x08] = (dev->rev & 0x08) ? 0x02 : (dev->rev & 0x07); + fregs[0x08] = (dev->rev & 0x08) ? 0x02 : 0x01 /*(dev->rev & 0x07)*/; fregs[0x0a] = 0x80; fregs[0x0b] = 0x06; /* NOTE: The Specification Update says this should default to 0x00 and be read-only. */ #ifdef WRONG_SPEC @@ -1192,6 +1195,32 @@ piix_reset(void *p) ide_pri_disable(); ide_sec_disable(); + + if (dev->type >= 3) { + piix_write(2, 0x04, 0x00, p); + if (dev->type == 5) { + piix_write(2, 0x10, 0x00, p); + piix_write(2, 0x11, 0x00, p); + piix_write(2, 0x12, 0x00, p); + piix_write(2, 0x13, 0x00, p); + } else { + piix_write(2, 0x20, 0x01, p); + piix_write(2, 0x21, 0x00, p); + piix_write(2, 0x22, 0x00, p); + piix_write(2, 0x23, 0x00, p); + } + } + + if (dev->type >= 4) { + piix_write(0, 0xb0, (is_pentium) ? 0x00 : 0x04, p); + piix_write(3, 0x40, 0x01, p); + piix_write(3, 0x41, 0x00, p); + piix_write(3, 0x5b, 0x00, p); + piix_write(3, 0x80, 0x00, p); + piix_write(3, 0x90, 0x01, p); + piix_write(3, 0x91, 0x00, p); + piix_write(3, 0xd2, 0x00, p); + } } @@ -1253,6 +1282,7 @@ static void dev->acpi = device_add(&acpi_intel_device); acpi_set_slot(dev->acpi, dev->pci_slot); acpi_set_nvr(dev->acpi, dev->nvr); + acpi_set_gpireg2_default(dev->acpi, (dev->type > 4) ? 0xf1 : 0xfd); dev->ddma = device_add(&ddma_device); } else @@ -1283,7 +1313,9 @@ static void if (dev->type < 3) pci_enable_mirq(1); + dev->readout_regs[0] = 0xff; dev->readout_regs[1] = 0x40; + dev->readout_regs[2] = 0xff; /* Port E1 register 01 (TODO: Find how multipliers > 3.0 are defined): @@ -1356,7 +1388,7 @@ const device_t piix_device = piix_init, piix_close, piix_reset, - NULL, + { NULL }, piix_speed_changed, NULL, NULL @@ -1370,7 +1402,7 @@ const device_t piix_rev02_device = piix_init, piix_close, piix_reset, - NULL, + { NULL }, piix_speed_changed, NULL, NULL @@ -1384,7 +1416,7 @@ const device_t piix3_device = piix_init, piix_close, piix_reset, - NULL, + { NULL }, piix_speed_changed, NULL, NULL @@ -1398,7 +1430,7 @@ const device_t piix4_device = piix_init, piix_close, piix_reset, - NULL, + { NULL }, piix_speed_changed, NULL, NULL @@ -1412,7 +1444,7 @@ const device_t piix4e_device = piix_init, piix_close, piix_reset, - NULL, + { NULL }, piix_speed_changed, NULL, NULL @@ -1426,7 +1458,7 @@ const device_t slc90e66_device = piix_init, piix_close, piix_reset, - NULL, + { NULL }, piix_speed_changed, NULL, NULL diff --git a/src/chipset/intel_sio.c b/src/chipset/intel_sio.c index 370bed928..cf587170a 100644 --- a/src/chipset/intel_sio.c +++ b/src/chipset/intel_sio.c @@ -218,6 +218,7 @@ sio_write(int func, int addr, uint8_t val, void *priv) break; case 0x60: case 0x61: case 0x62: case 0x63: if (dev->id == 0x03) { + pclog("Set IRQ routing: INT %c -> %02X\n", 0x41 + (addr & 0x03), val); sio_log("Set IRQ routing: INT %c -> %02X\n", 0x41 + (addr & 0x03), val); dev->regs[addr] = val & 0x8f; if (val & 0x80) @@ -551,7 +552,7 @@ const device_t sio_device = sio_init, sio_close, sio_reset, - NULL, + { NULL }, sio_speed_changed, NULL, NULL @@ -566,7 +567,7 @@ const device_t sio_zb_device = sio_init, sio_close, sio_reset, - NULL, + { NULL }, sio_speed_changed, NULL, NULL diff --git a/src/chipset/neat.c b/src/chipset/neat.c index 8e4e710f2..73aaea0ec 100644 --- a/src/chipset/neat.c +++ b/src/chipset/neat.c @@ -856,6 +856,6 @@ const device_t neat_device = { 0, 0, neat_init, neat_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/opti283.c b/src/chipset/opti283.c index c0950e563..dc1d74599 100644 --- a/src/chipset/opti283.c +++ b/src/chipset/opti283.c @@ -166,6 +166,6 @@ const device_t opti283_device = { 0, 0, opti283_init, opti283_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/opti291.c b/src/chipset/opti291.c index f9dadc72f..b59b0b7b7 100644 --- a/src/chipset/opti291.c +++ b/src/chipset/opti291.c @@ -151,6 +151,6 @@ const device_t opti291_device = { 0, 0, opti291_init, opti291_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/opti495.c b/src/chipset/opti495.c index 688bbf492..b93d09a3c 100644 --- a/src/chipset/opti495.c +++ b/src/chipset/opti495.c @@ -246,7 +246,7 @@ const device_t opti493_device = { 0, 0, opti495_init, opti495_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -256,6 +256,6 @@ const device_t opti495_device = { 0, 1, opti495_init, opti495_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/opti5x7.c b/src/chipset/opti5x7.c index d851da766..8b232e682 100644 --- a/src/chipset/opti5x7.c +++ b/src/chipset/opti5x7.c @@ -171,6 +171,6 @@ const device_t opti5x7_device = { 0, 0, opti5x7_init, opti5x7_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/opti895.c b/src/chipset/opti895.c index 7c69e4c39..1b878c2ed 100644 --- a/src/chipset/opti895.c +++ b/src/chipset/opti895.c @@ -273,7 +273,7 @@ const device_t opti802g_device = { 0, 0, opti895_init, opti895_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -283,6 +283,6 @@ const device_t opti895_device = { 0, 0, opti895_init, opti895_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/scamp.c b/src/chipset/scamp.c index bed13ab0f..222b483f9 100644 --- a/src/chipset/scamp.c +++ b/src/chipset/scamp.c @@ -770,6 +770,6 @@ const device_t vlsi_scamp_device = { 0, 0, scamp_init, scamp_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; \ No newline at end of file diff --git a/src/chipset/scat.c b/src/chipset/scat.c index 64af1846e..c4f1a6ffd 100644 --- a/src/chipset/scat.c +++ b/src/chipset/scat.c @@ -1600,7 +1600,7 @@ const device_t scat_device = { 0, 0, scat_init, scat_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -1609,7 +1609,7 @@ const device_t scat_4_device = { 0, 4, scat_init, scat_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -1618,6 +1618,6 @@ const device_t scat_sx_device = { 0, 32, scat_init, scat_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/sis_85c310.c b/src/chipset/sis_85c310.c index 2a11f9654..71cfe5adc 100644 --- a/src/chipset/sis_85c310.c +++ b/src/chipset/sis_85c310.c @@ -145,6 +145,6 @@ const device_t rabbit_device = { 0, 0, rabbit_init, rabbit_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; \ No newline at end of file diff --git a/src/chipset/sis_85c496.c b/src/chipset/sis_85c496.c index 9f1a80284..1ad76bb14 100644 --- a/src/chipset/sis_85c496.c +++ b/src/chipset/sis_85c496.c @@ -618,7 +618,7 @@ const device_t sis_85c496_device = sis_85c496_init, sis_85c496_close, sis_85c496_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -633,7 +633,7 @@ const device_t sis_85c496_ls486e_device = sis_85c496_init, sis_85c496_close, sis_85c496_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/sis_85c4xx.c b/src/chipset/sis_85c4xx.c index b7976fecd..431703ea3 100644 --- a/src/chipset/sis_85c4xx.c +++ b/src/chipset/sis_85c4xx.c @@ -419,7 +419,7 @@ const device_t sis_85c401_device = { 0, 0x060, sis_85c4xx_init, sis_85c4xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -428,7 +428,7 @@ const device_t sis_85c460_device = { 0, 0x050, sis_85c4xx_init, sis_85c4xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -438,7 +438,7 @@ const device_t sis_85c461_device = { 0, 0x050, sis_85c4xx_init, sis_85c4xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -447,6 +447,6 @@ const device_t sis_85c471_device = { 0, 0x150, sis_85c4xx_init, sis_85c4xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/sis_85c50x.c b/src/chipset/sis_85c50x.c index d8ff68704..9e50ef3c9 100644 --- a/src/chipset/sis_85c50x.c +++ b/src/chipset/sis_85c50x.c @@ -434,7 +434,7 @@ const device_t sis_85c50x_device = sis_85c50x_init, sis_85c50x_close, sis_85c50x_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/stpc.c b/src/chipset/stpc.c index ccbd7e4bb..3d5ceee0f 100644 --- a/src/chipset/stpc.c +++ b/src/chipset/stpc.c @@ -910,13 +910,13 @@ stpc_init(const device_t *info) dev->local = info->local; - pci_add_card(0x0B, stpc_nb_read, stpc_nb_write, dev); - dev->ide_slot = pci_add_card(0x0C, stpc_isab_read, stpc_isab_write, dev); + pci_add_card(PCI_ADD_NORTHBRIDGE, stpc_nb_read, stpc_nb_write, dev); + dev->ide_slot = pci_add_card(PCI_ADD_SOUTHBRIDGE, stpc_isab_read, stpc_isab_write, dev); if (dev->local & STPC_IDE_ATLAS) - dev->ide_slot = pci_add_card(0x0D, stpc_ide_read, stpc_ide_write, dev); + dev->ide_slot = pci_add_card(PCI_ADD_SOUTHBRIDGE, stpc_ide_read, stpc_ide_write, dev); if (dev->local & STPC_USB) { dev->usb = device_add(&usb_device); - pci_add_card(0x0E, stpc_usb_read, stpc_usb_write, dev); + pci_add_card(PCI_ADD_SOUTHBRIDGE, stpc_usb_read, stpc_usb_write, dev); } dev->bm[0] = device_add_inst(&sff8038i_device, 1); @@ -1096,7 +1096,7 @@ const device_t stpc_client_device = stpc_init, stpc_close, stpc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1110,7 +1110,7 @@ const device_t stpc_consumer2_device = stpc_init, stpc_close, stpc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1124,7 +1124,7 @@ const device_t stpc_elite_device = stpc_init, stpc_close, stpc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1138,7 +1138,7 @@ const device_t stpc_atlas_device = stpc_init, stpc_close, stpc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -1153,7 +1153,7 @@ const device_t stpc_serial_device = stpc_serial_init, stpc_serial_close, NULL, - NULL, + { NULL }, NULL, NULL, NULL @@ -1167,7 +1167,7 @@ const device_t stpc_lpt_device = stpc_lpt_init, stpc_lpt_close, stpc_lpt_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/umc491.c b/src/chipset/umc491.c index 4de917784..26aeec985 100644 --- a/src/chipset/umc491.c +++ b/src/chipset/umc491.c @@ -174,6 +174,6 @@ const device_t umc491_device = { 0, 0, umc491_init, umc491_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/via_apollo.c b/src/chipset/via_apollo.c index 905316232..c8055fbb4 100644 --- a/src/chipset/via_apollo.c +++ b/src/chipset/via_apollo.c @@ -715,7 +715,7 @@ const device_t via_vpx_device = via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -729,7 +729,7 @@ const device_t amd640_device = via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -743,7 +743,7 @@ const device_t via_vp3_device = via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -757,7 +757,7 @@ const device_t via_mvp3_device = via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -770,7 +770,7 @@ const device_t via_apro_device = { via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -783,7 +783,7 @@ const device_t via_apro133_device = { via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -796,7 +796,7 @@ const device_t via_apro133a_device = { via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -809,7 +809,7 @@ const device_t via_vt8601_device = { via_apollo_init, via_apollo_close, via_apollo_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index bd22cd072..bbf82e083 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -923,7 +923,7 @@ const device_t via_vt82c586b_device = pipc_init, pipc_close, pipc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -937,7 +937,7 @@ const device_t via_vt82c596_device = pipc_init, pipc_close, pipc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -952,7 +952,7 @@ const device_t via_vt82c596b_device = pipc_init, pipc_close, pipc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -967,7 +967,7 @@ const device_t via_vt82c686a_device = pipc_init, pipc_close, pipc_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -982,7 +982,7 @@ const device_t via_vt82c686b_device = pipc_init, pipc_close, pipc_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/via_vt82c49x.c b/src/chipset/via_vt82c49x.c index 3b63d46c7..b46f2d974 100644 --- a/src/chipset/via_vt82c49x.c +++ b/src/chipset/via_vt82c49x.c @@ -311,7 +311,7 @@ const device_t via_vt82c49x_device = { 0, 0, vt82c49x_init, vt82c49x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -321,6 +321,6 @@ const device_t via_vt82c49x_ide_device = { 0, 1, vt82c49x_init, vt82c49x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/via_vt82c505.c b/src/chipset/via_vt82c505.c index c9f3578b6..653fd35ff 100644 --- a/src/chipset/via_vt82c505.c +++ b/src/chipset/via_vt82c505.c @@ -124,7 +124,7 @@ vt82c505_init(const device_t *info) vt82c505_t *dev = (vt82c505_t *) malloc(sizeof(vt82c505_t)); memset(dev, 0, sizeof(vt82c505_t)); - pci_add_card(0, vt82c505_read, vt82c505_write, dev); + pci_add_card(PCI_ADD_NORTHBRIDGE, vt82c505_read, vt82c505_write, dev); dev->pci_conf[0x00] = 0x06; dev->pci_conf[0x01] = 0x11; @@ -152,7 +152,7 @@ const device_t via_vt82c505_device = { vt82c505_init, vt82c505_close, vt82c505_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/chipset/vl82c480.c b/src/chipset/vl82c480.c index a55cf846c..d4205a6df 100644 --- a/src/chipset/vl82c480.c +++ b/src/chipset/vl82c480.c @@ -183,6 +183,6 @@ const device_t vl82c480_device = { 0, 0, vl82c480_init, vl82c480_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/chipset/wd76c10.c b/src/chipset/wd76c10.c index 98e0d24d5..6233177ba 100644 --- a/src/chipset/wd76c10.c +++ b/src/chipset/wd76c10.c @@ -287,6 +287,6 @@ const device_t wd76c10_device = { 0, 0, wd76c10_init, wd76c10_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/codegen_new/codegen.c b/src/codegen_new/codegen.c index 6f25ef12a..aa0791b3e 100644 --- a/src/codegen_new/codegen.c +++ b/src/codegen_new/codegen.c @@ -32,7 +32,7 @@ int codegen_get_instruction_uop(codeblock_t *block, uint32_t pc, int *first_inst { int c; - for (c = 0; c < block->ins; c++) + for (c = 0; c <= block->ins; c++) { if (codegen_instructions[c].pc == pc) { diff --git a/src/codegen_new/codegen_backend_x86-64.h b/src/codegen_new/codegen_backend_x86-64.h index 70e953a6b..ccc526b30 100644 --- a/src/codegen_new/codegen_backend_x86-64.h +++ b/src/codegen_new/codegen_backend_x86-64.h @@ -10,3 +10,5 @@ #define HASH(l) ((l) & 0x1ffff) #define BLOCK_MAX 0x3c0 + +#define CODEGEN_BACKEND_HAS_MOV_IMM diff --git a/src/codegen_new/codegen_backend_x86-64_ops.c b/src/codegen_new/codegen_backend_x86-64_ops.c index 1ffec61b9..89d065498 100644 --- a/src/codegen_new/codegen_backend_x86-64_ops.c +++ b/src/codegen_new/codegen_backend_x86-64_ops.c @@ -521,6 +521,26 @@ void host_x86_MOV8_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data) codegen_addbyte(block, imm_data); } } +void host_x86_MOV16_ABS_IMM(codeblock_t *block, void *p, uint16_t imm_data) +{ + int64_t offset = (uintptr_t)p - (((uintptr_t)&cpu_state) + 128); + + if (offset >= -128 && offset < 127) + { + codegen_alloc_bytes(block, 6); + codegen_addbyte4(block, 0x66, 0xc7, 0x45, offset); /*MOV offset[RBP], imm_data*/ + codegen_addword(block, imm_data); + } + else + { + if ((uintptr_t)p >> 32) + fatal("host_x86_MOV32_ABS_IMM - out of range %p\n", p); + codegen_alloc_bytes(block, 10); + codegen_addbyte4(block, 0x66, 0xc7, 0x04, 0x25); /*MOV p, imm_data*/ + codegen_addlong(block, (uint32_t)(uintptr_t)p); + codegen_addword(block, imm_data); + } +} void host_x86_MOV32_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data) { int64_t offset = (uintptr_t)p - (((uintptr_t)&cpu_state) + 128); @@ -945,6 +965,30 @@ void host_x86_MOV64_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset fatal("MOV64_BASE_OFFSET_REG - offset %i\n", offset); } +void host_x86_MOV32_BASE_OFFSET_IMM(codeblock_t *block, int base_reg, int offset, uint32_t imm_data) +{ + if (base_reg & 8) + fatal("host_x86_MOV32_BASE_OFFSET_IMM reg & 8\n"); + + if (offset >= -128 && offset < 127) + { + if (base_reg == REG_RSP) + { + codegen_alloc_bytes(block, 8); + codegen_addbyte4(block, 0xc7, 0x40 | base_reg, 0x24, offset); + codegen_addlong(block, imm_data); + } + else + { + codegen_alloc_bytes(block, 7); + codegen_addbyte3(block, 0xc7, 0x40 | base_reg, offset); + codegen_addlong(block, imm_data); + } + } + else + fatal("MOV32_BASE_OFFSET_IMM - offset %i\n", offset); +} + void host_x86_MOV8_REG_IMM(codeblock_t *block, int reg, uint16_t imm_data) { if (reg >= 8) diff --git a/src/codegen_new/codegen_backend_x86-64_ops.h b/src/codegen_new/codegen_backend_x86-64_ops.h index 62a9ba203..e570813de 100644 --- a/src/codegen_new/codegen_backend_x86-64_ops.h +++ b/src/codegen_new/codegen_backend_x86-64_ops.h @@ -56,6 +56,7 @@ void host_x86_LEA_REG_REG(codeblock_t *block, int dst_reg, int src_reg_a, int sr void host_x86_LEA_REG_REG_SHIFT(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b, int shift); void host_x86_MOV8_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data); +void host_x86_MOV16_ABS_IMM(codeblock_t *block, void *p, uint16_t imm_data); void host_x86_MOV32_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data); void host_x86_MOV8_ABS_REG(codeblock_t *block, void *p, int src_reg); @@ -72,6 +73,8 @@ void host_x86_MOV32_BASE_INDEX_REG(codeblock_t *block, int dst_reg, int base_reg void host_x86_MOV32_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int src_reg); void host_x86_MOV64_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int src_reg); +void host_x86_MOV32_BASE_OFFSET_IMM(codeblock_t *block, int base_reg, int offset, uint32_t imm_data); + void host_x86_MOV8_REG_ABS(codeblock_t *block, int dst_reg, void *p); void host_x86_MOV16_REG_ABS(codeblock_t *block, int dst_reg, void *p); void host_x86_MOV32_REG_ABS(codeblock_t *block, int dst_reg, void *p); diff --git a/src/codegen_new/codegen_backend_x86-64_uops.c b/src/codegen_new/codegen_backend_x86-64_uops.c index c87ce26e1..9ce20590a 100644 --- a/src/codegen_new/codegen_backend_x86-64_uops.c +++ b/src/codegen_new/codegen_backend_x86-64_uops.c @@ -3145,4 +3145,21 @@ void codegen_set_jump_dest(codeblock_t *block, void *p) *(uint32_t *)p = (uintptr_t)&block_write_data[block_pos] - ((uintptr_t)p + 4); } +void codegen_direct_write_8_imm(codeblock_t *block, void *p, uint8_t imm_data) +{ + host_x86_MOV8_ABS_IMM(block, p, imm_data); +} +void codegen_direct_write_16_imm(codeblock_t *block, void *p, uint16_t imm_data) +{ + host_x86_MOV16_ABS_IMM(block, p, imm_data); +} +void codegen_direct_write_32_imm(codeblock_t *block, void *p, uint32_t imm_data) +{ + host_x86_MOV32_ABS_IMM(block, p, imm_data); +} +void codegen_direct_write_32_imm_stack(codeblock_t *block, int stack_offset, uint32_t imm_data) +{ + host_x86_MOV32_BASE_OFFSET_IMM(block, REG_ESP, stack_offset, imm_data); +} + #endif diff --git a/src/codegen_new/codegen_backend_x86.h b/src/codegen_new/codegen_backend_x86.h index a5aec727c..582e46430 100644 --- a/src/codegen_new/codegen_backend_x86.h +++ b/src/codegen_new/codegen_backend_x86.h @@ -10,3 +10,5 @@ #define HASH(l) ((l) & 0x1ffff) #define BLOCK_MAX 0x3c0 + +#define CODEGEN_BACKEND_HAS_MOV_IMM diff --git a/src/codegen_new/codegen_backend_x86_ops.c b/src/codegen_new/codegen_backend_x86_ops.c index 3d71cc081..5e89ffbc8 100644 --- a/src/codegen_new/codegen_backend_x86_ops.c +++ b/src/codegen_new/codegen_backend_x86_ops.c @@ -449,6 +449,24 @@ void host_x86_MOV8_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data) codegen_addbyte(block, imm_data); } } +void host_x86_MOV16_ABS_IMM(codeblock_t *block, void *p, uint16_t imm_data) +{ + int offset = (uintptr_t)p - (((uintptr_t)&cpu_state) + 128); + + if (offset >= -128 && offset < 127) + { + codegen_alloc_bytes(block, 6); + codegen_addbyte4(block, 0x66, 0xc7, 0x45, offset); /*MOV offset[EBP], imm_data*/ + codegen_addword(block, imm_data); + } + else + { + codegen_alloc_bytes(block, 9); + codegen_addbyte3(block, 0x66, 0xc7, 0x05); /*MOV p, imm_data*/ + codegen_addlong(block, (uint32_t)p); + codegen_addword(block, imm_data); + } +} void host_x86_MOV32_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data) { int offset = (uintptr_t)p - (((uintptr_t)&cpu_state) + 128); @@ -705,6 +723,27 @@ void host_x86_MOV32_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset fatal("MOV32_BASE_OFFSET_REG - offset %i\n", offset); } +void host_x86_MOV32_BASE_OFFSET_IMM(codeblock_t *block, int base_reg, int offset, uint32_t imm_data) +{ + if (offset >= -128 && offset < 127) + { + if (base_reg == REG_ESP) + { + codegen_alloc_bytes(block, 8); + codegen_addbyte4(block, 0xc7, 0x40 | base_reg, 0x24, offset); + codegen_addlong(block, imm_data); + } + else + { + codegen_alloc_bytes(block, 7); + codegen_addbyte3(block, 0xc7, 0x40 | base_reg, offset); + codegen_addlong(block, imm_data); + } + } + else + fatal("MOV32_BASE_OFFSET_IMM - offset %i\n", offset); +} + void host_x86_MOV8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data) { codegen_alloc_bytes(block, 2); diff --git a/src/codegen_new/codegen_backend_x86_ops.h b/src/codegen_new/codegen_backend_x86_ops.h index 294b42236..53b6e0e73 100644 --- a/src/codegen_new/codegen_backend_x86_ops.h +++ b/src/codegen_new/codegen_backend_x86_ops.h @@ -60,6 +60,7 @@ void host_x86_LEA_REG_REG(codeblock_t *block, int dst_reg, int src_reg_a, int sr void host_x86_LEA_REG_REG_SHIFT(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b, int shift); void host_x86_MOV8_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data); +void host_x86_MOV16_ABS_IMM(codeblock_t *block, void *p, uint16_t imm_data); void host_x86_MOV32_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data); void host_x86_MOV8_ABS_REG(codeblock_t *block, void *p, int src_reg); @@ -75,6 +76,8 @@ void host_x86_MOV32_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg void host_x86_MOV16_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int dst_reg); void host_x86_MOV32_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int dst_reg); +void host_x86_MOV32_BASE_OFFSET_IMM(codeblock_t *block, int base_reg, int offset, uint32_t imm_data); + void host_x86_MOV8_REG_ABS(codeblock_t *block, int dst_reg, void *p); void host_x86_MOV16_REG_ABS(codeblock_t *block, int dst_reg, void *p); void host_x86_MOV32_REG_ABS(codeblock_t *block, int dst_reg, void *p); diff --git a/src/codegen_new/codegen_backend_x86_uops.c b/src/codegen_new/codegen_backend_x86_uops.c index 43737560c..9d423f772 100644 --- a/src/codegen_new/codegen_backend_x86_uops.c +++ b/src/codegen_new/codegen_backend_x86_uops.c @@ -2643,6 +2643,11 @@ static int codegen_STORE_PTR_IMM_8(codeblock_t *block, uop_t *uop) host_x86_MOV8_ABS_IMM(block, uop->p, uop->imm_data); return 0; } +static int codegen_STORE_PTR_IMM_16(codeblock_t *block, uop_t *uop) +{ + host_x86_MOV16_ABS_IMM(block, uop->p, uop->imm_data); + return 0; +} static int codegen_SUB(codeblock_t *block, uop_t *uop) { @@ -2838,6 +2843,7 @@ const uOpFn uop_handlers[UOP_MAX] = [UOP_STORE_P_IMM & UOP_MASK] = codegen_STORE_PTR_IMM, [UOP_STORE_P_IMM_8 & UOP_MASK] = codegen_STORE_PTR_IMM_8, + [UOP_STORE_P_IMM_16 & UOP_MASK] = codegen_STORE_PTR_IMM_16, [UOP_MEM_LOAD_ABS & UOP_MASK] = codegen_MEM_LOAD_ABS, [UOP_MEM_LOAD_REG & UOP_MASK] = codegen_MEM_LOAD_REG, @@ -3138,4 +3144,21 @@ void codegen_set_jump_dest(codeblock_t *block, void *p) *(uint32_t *)p = (uintptr_t)&block_write_data[block_pos] - ((uintptr_t)p + 4); } +void codegen_direct_write_8_imm(codeblock_t *block, void *p, uint8_t imm_data) +{ + host_x86_MOV8_ABS_IMM(block, p, imm_data); +} +void codegen_direct_write_16_imm(codeblock_t *block, void *p, uint16_t imm_data) +{ + host_x86_MOV16_ABS_IMM(block, p, imm_data); +} +void codegen_direct_write_32_imm(codeblock_t *block, void *p, uint32_t imm_data) +{ + host_x86_MOV32_ABS_IMM(block, p, imm_data); +} +void codegen_direct_write_32_imm_stack(codeblock_t *block, int stack_offset, uint32_t imm_data) +{ + host_x86_MOV32_BASE_OFFSET_IMM(block, REG_ESP, stack_offset, imm_data); +} + #endif diff --git a/src/codegen_new/codegen_block.c b/src/codegen_new/codegen_block.c index a6413b87e..609d0927f 100644 --- a/src/codegen_new/codegen_block.c +++ b/src/codegen_new/codegen_block.c @@ -67,8 +67,10 @@ static int dirty_list_size = 0; static void block_free_list_add(codeblock_t *block) { +#ifndef RELEASE_BUILD if (block->flags & CODEBLOCK_IN_DIRTY_LIST) fatal("block_free_list_add: block=%p in dirty list\n", block); +#endif if (block_free_list) block->next = block_free_list; else @@ -79,8 +81,10 @@ static void block_free_list_add(codeblock_t *block) static void block_dirty_list_add(codeblock_t *block) { +#ifndef RELEASE_BUILD if (block->flags & CODEBLOCK_IN_DIRTY_LIST) fatal("block_dirty_list_add: block=%p already in dirty list\n", block); +#endif if (block_dirty_list_head != BLOCK_INVALID) { codeblock_t *old_head = &codeblock[block_dirty_list_head]; @@ -102,12 +106,14 @@ static void block_dirty_list_add(codeblock_t *block) /*Evict oldest block to the free list*/ codeblock_t *evict_block = &codeblock[block_dirty_list_tail]; +#ifndef RELEASE_BUILD if (!(evict_block->flags & CODEBLOCK_IN_DIRTY_LIST)) fatal("block_dirty_list_add: evict_block=%p %x %x not in dirty list\n", evict_block, evict_block->phys, evict_block->flags); if (!block_dirty_list_tail) fatal("block_dirty_list_add - !block_dirty_list_tail\n"); if (evict_block->prev == BLOCK_INVALID) fatal("block_dirty_list_add - evict_block->prev == BLOCK_INVALID\n"); +#endif block_dirty_list_tail = evict_block->prev; codeblock[evict_block->prev].next = BLOCK_INVALID; @@ -123,8 +129,10 @@ static void block_dirty_list_remove(codeblock_t *block) codeblock_t *prev_block = &codeblock[block->prev]; codeblock_t *next_block = &codeblock[block->next]; +#ifndef RELEASE_BUILD if (!(block->flags & CODEBLOCK_IN_DIRTY_LIST)) fatal("block_dirty_list_remove: block=%p not in dirty list\n", block); +#endif /*Is block head of list*/ if (block->prev == BLOCK_INVALID) @@ -139,8 +147,10 @@ static void block_dirty_list_remove(codeblock_t *block) next_block->prev = block->prev; dirty_list_size--; +#ifndef RELEASE_BUILD if (dirty_list_size < 0) fatal("remove - dirty_list_size < 0!\n"); +#endif block->flags &= ~CODEBLOCK_IN_DIRTY_LIST; } @@ -170,9 +180,10 @@ static codeblock_t *block_free_list_get() /*Free list is empty, check the dirty list*/ if (block_dirty_list_tail) { +#ifndef RELEASE_BUILD if (dirty_list_size <= 0) fatal("get - dirty_list_size <= 0!\n"); - +#endif /*Reuse oldest block*/ block = &codeblock[block_dirty_list_tail]; @@ -296,8 +307,10 @@ static void add_to_block_list(codeblock_t *block) uint16_t block_prev_nr = pages[block->phys >> 12].block; uint16_t block_nr = get_block_nr(block); +#ifndef RELEASE_BUILD if (!block->page_mask) fatal("add_to_block_list - mask = 0 %llx %llx\n", block->page_mask,block->page_mask2); +#endif if (block_prev_nr) { @@ -313,8 +326,10 @@ static void add_to_block_list(codeblock_t *block) if (block->next) { +#ifndef RELEASE_BUILD if (codeblock[block->next].pc == BLOCK_PC_INVALID) fatal("block->next->pc=BLOCK_PC_INVALID %p %p %x %x\n", (void *)&codeblock[block->next], (void *)codeblock, block_current, block_pos); +#endif } if (block->page_mask2) @@ -341,9 +356,10 @@ static void remove_from_block_list(codeblock_t *block, uint32_t pc) { if (!block->page_mask) return; +#ifndef RELEASE_BUILD if (block->flags & CODEBLOCK_IN_DIRTY_LIST) fatal("remove_from_block_list: in dirty list\n"); - +#endif if (block->prev) { codeblock[block->prev].next = block->next; @@ -361,8 +377,10 @@ static void remove_from_block_list(codeblock_t *block, uint32_t pc) if (!(block->flags & CODEBLOCK_HAS_PAGE2)) { +#ifndef RELEASE_BUILD if (block->prev_2 || block->next_2) fatal("Invalid block_2 %x %p %08x\n", block->flags, block, block->phys); +#endif return; } block->flags &= ~CODEBLOCK_HAS_PAGE2; @@ -387,11 +405,12 @@ static void invalidate_block(codeblock_t *block) { uint32_t old_pc = block->pc; +#ifndef RELEASE_BUILD if (block->flags & CODEBLOCK_IN_DIRTY_LIST) fatal("invalidate_block: already in dirty list\n"); if (block->pc == BLOCK_PC_INVALID) fatal("Invalidating deleted block\n"); - +#endif remove_from_block_list(block, old_pc); block_dirty_list_add(block); if (block->head_mem_block) @@ -406,8 +425,10 @@ static void delete_block(codeblock_t *block) if (block == &codeblock[codeblock_hash[HASH(block->phys)]]) codeblock_hash[HASH(block->phys)] = BLOCK_INVALID; +#ifndef RELEASE_BUILD if (block->pc == BLOCK_PC_INVALID) fatal("Deleting deleted block\n"); +#endif block->pc = BLOCK_PC_INVALID; codeblock_tree_delete(block); @@ -426,8 +447,10 @@ static void delete_dirty_block(codeblock_t *block) if (block == &codeblock[codeblock_hash[HASH(block->phys)]]) codeblock_hash[HASH(block->phys)] = BLOCK_INVALID; +#ifndef RELEASE_BUILD if (block->pc == BLOCK_PC_INVALID) fatal("Deleting deleted block\n"); +#endif block->pc = BLOCK_PC_INVALID; codeblock_tree_delete(block); @@ -475,8 +498,10 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr) { invalidate_block(block); } +#ifndef RELEASE_BUILD if (block_nr == next_block) fatal("Broken 1\n"); +#endif block_nr = next_block; } @@ -491,8 +516,10 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr) { invalidate_block(block); } +#ifndef RELEASE_BUILD if (block_nr == next_block) fatal("Broken 2\n"); +#endif block_nr = next_block; } @@ -520,8 +547,10 @@ void codegen_block_init(uint32_t phys_addr) if (!page->block) mem_flush_write_page(phys_addr, cs+cpu_state.pc); block = block_free_list_get(); +#ifndef RELEASE_BUILD if (!block) fatal("codegen_block_init: block_free_list_get() returned NULL\n"); +#endif block_current = get_block_nr(block); block_num = HASH(phys_addr); @@ -560,8 +589,10 @@ void codegen_block_start_recompile(codeblock_t *block) block_num = HASH(block->phys); block_current = get_block_nr(block);//block->pnt; +#ifndef RELEASE_BUILD if (block->pc != cs + cpu_state.pc || (block->flags & CODEBLOCK_WAS_RECOMPILED)) fatal("Recompile to used block!\n"); +#endif block->head_mem_block = codegen_allocator_allocate(NULL, block_current); block->data = codeblock_allocator_get_ptr(block->head_mem_block); @@ -668,6 +699,7 @@ void codegen_block_generate_end_mask_recompile() if (!pages[block->phys_2 >> 12].block_2) mem_flush_write_page(block->phys_2, codegen_endpc); +#ifndef RELEASE_BUILD if (!block->page_mask2) fatal("!page_mask2\n"); if (block->next_2) @@ -675,6 +707,7 @@ void codegen_block_generate_end_mask_recompile() if (codeblock[block->next_2].pc == BLOCK_PC_INVALID) fatal("block->next_2->pc=BLOCK_PC_INVALID %p\n", (void *)&codeblock[block->next_2]); } +#endif } else { @@ -695,8 +728,10 @@ void codegen_block_generate_end_mask_mark() uint32_t end_pc; page_t *p; +#ifndef RELEASE_BUILD if (block->flags & CODEBLOCK_BYTE_MASK) fatal("codegen_block_generate_end_mask2() - BYTE_MASK\n"); +#endif block->page_mask = 0; start_pc = (block->pc & 0xfff) & ~63; @@ -741,6 +776,7 @@ void codegen_block_generate_end_mask_mark() if (!pages[block->phys_2 >> 12].block_2) mem_flush_write_page(block->phys_2, codegen_endpc); +#ifndef RELEASE_BUILD if (!block->page_mask2) fatal("!page_mask2\n"); if (block->next_2) @@ -748,7 +784,7 @@ void codegen_block_generate_end_mask_mark() if (codeblock[block->next_2].pc == BLOCK_PC_INVALID) fatal("block->next_2->pc=BLOCK_PC_INVALID %p\n", (void *)&codeblock[block->next_2]); } - +#endif block->dirty_mask2 = &page_2->dirty_mask; } else diff --git a/src/codegen_new/codegen_ir.c b/src/codegen_new/codegen_ir.c index aa27f206e..a949b7f86 100644 --- a/src/codegen_new/codegen_ir.c +++ b/src/codegen_new/codegen_ir.c @@ -71,8 +71,10 @@ void codegen_ir_compile(ir_data_t *ir, codeblock_t *block) for (unroll_count = 1; unroll_count < codegen_unroll_count; unroll_count++) { int offset = ir->wr_pos - codegen_unroll_start; +// pclog("Unroll from %i to %i, offset %i - iteration %i\n", codegen_unroll_start, ir->wr_pos, offset, unroll_count); for (c = codegen_unroll_start; c < unroll_end; c++) { +// pclog(" Duplicate uop %i\n", c); duplicate_uop(ir, &ir->uops[c], offset); } } @@ -87,6 +89,8 @@ void codegen_ir_compile(ir_data_t *ir, codeblock_t *block) for (c = 0; c < ir->wr_pos; c++) { uop_t *uop = &ir->uops[c]; + +// pclog("uOP %i : %08x\n", c, uop->type); if (uop->type & UOP_TYPE_BARRIER) codegen_reg_flush_invalidate(ir, block); @@ -105,37 +109,61 @@ void codegen_ir_compile(ir_data_t *ir, codeblock_t *block) if ((uop->type & UOP_MASK) == UOP_INVALID) continue; - if (uop->type & UOP_TYPE_PARAMS_REGS) +#ifdef CODEGEN_BACKEND_HAS_MOV_IMM + if ((uop->type & UOP_MASK) == (UOP_MOV_IMM & UOP_MASK) && reg_is_native_size(uop->dest_reg_a) && !codegen_reg_is_loaded(uop->dest_reg_a) && reg_version[IREG_GET_REG(uop->dest_reg_a.reg)][uop->dest_reg_a.version].refcount <= 0) { - codegen_reg_alloc_register(uop->dest_reg_a, uop->src_reg_a, uop->src_reg_b, uop->src_reg_c); - if (uop->src_reg_a.reg != IREG_INVALID) - { - uop->src_reg_a_real = codegen_reg_alloc_read_reg(block, uop->src_reg_a, NULL); - } - if (uop->src_reg_b.reg != IREG_INVALID) - { - uop->src_reg_b_real = codegen_reg_alloc_read_reg(block, uop->src_reg_b, NULL); - } - if (uop->src_reg_c.reg != IREG_INVALID) - { - uop->src_reg_c_real = codegen_reg_alloc_read_reg(block, uop->src_reg_c, NULL); - } + /*Special case for UOP_MOV_IMM - if destination not already in host register + and won't be used again then just store directly to memory*/ + codegen_reg_write_imm(block, uop->dest_reg_a, uop->imm_data); } - - if (uop->type & UOP_TYPE_ORDER_BARRIER) - codegen_reg_flush(ir, block); + else +#endif + if ((uop->type & UOP_MASK) == (UOP_MOV & UOP_MASK) && reg_version[IREG_GET_REG(uop->src_reg_a.reg)][uop->src_reg_a.version].refcount <= 1 && + reg_is_native_size(uop->src_reg_a) && reg_is_native_size(uop->dest_reg_a)) + { + /*Special case for UOP_MOV - if source register won't be used again then + just rename it to dest register instead of moving*/ + codegen_reg_alloc_register(invalid_ir_reg, uop->src_reg_a, invalid_ir_reg, invalid_ir_reg); + uop->src_reg_a_real = codegen_reg_alloc_read_reg(block, uop->src_reg_a, NULL); + codegen_reg_rename(block, uop->src_reg_a, uop->dest_reg_a); + if (uop->type & UOP_TYPE_ORDER_BARRIER) + codegen_reg_flush(ir, block); + } + else + { + if (uop->type & UOP_TYPE_PARAMS_REGS) + { + codegen_reg_alloc_register(uop->dest_reg_a, uop->src_reg_a, uop->src_reg_b, uop->src_reg_c); + if (uop->src_reg_a.reg != IREG_INVALID) + { + uop->src_reg_a_real = codegen_reg_alloc_read_reg(block, uop->src_reg_a, NULL); + } + if (uop->src_reg_b.reg != IREG_INVALID) + { + uop->src_reg_b_real = codegen_reg_alloc_read_reg(block, uop->src_reg_b, NULL); + } + if (uop->src_reg_c.reg != IREG_INVALID) + { + uop->src_reg_c_real = codegen_reg_alloc_read_reg(block, uop->src_reg_c, NULL); + } + } - if (uop->type & UOP_TYPE_PARAMS_REGS) - { - if (uop->dest_reg_a.reg != IREG_INVALID) + if (uop->type & UOP_TYPE_ORDER_BARRIER) + codegen_reg_flush(ir, block); + + if (uop->type & UOP_TYPE_PARAMS_REGS) { - uop->dest_reg_a_real = codegen_reg_alloc_write_reg(block, uop->dest_reg_a); + if (uop->dest_reg_a.reg != IREG_INVALID) + { + uop->dest_reg_a_real = codegen_reg_alloc_write_reg(block, uop->dest_reg_a); + } } +#ifndef RELEASE_BUILD + if (!uop_handlers[uop->type & UOP_MASK]) + fatal("!uop_handlers[uop->type & UOP_MASK] %08x\n", uop->type); +#endif + uop_handlers[uop->type & UOP_MASK](block, uop); } - - if (!uop_handlers[uop->type & UOP_MASK]) - fatal("!uop_handlers[uop->type & UOP_MASK] %08x\n", uop->type); - uop_handlers[uop->type & UOP_MASK](block, uop); if (uop->type & UOP_TYPE_JUMP) { diff --git a/src/codegen_new/codegen_ir_defs.h b/src/codegen_new/codegen_ir_defs.h index 9d6c0e69d..86276a053 100644 --- a/src/codegen_new/codegen_ir_defs.h +++ b/src/codegen_new/codegen_ir_defs.h @@ -55,6 +55,7 @@ /*UOP_JMP_DEST - jump to ptr*/ #define UOP_JMP_DEST (UOP_TYPE_PARAMS_IMM | UOP_TYPE_PARAMS_POINTER | 0x17 | UOP_TYPE_ORDER_BARRIER | UOP_TYPE_JUMP) #define UOP_NOP_BARRIER (UOP_TYPE_BARRIER | 0x18) +#define UOP_STORE_P_IMM_16 (UOP_TYPE_PARAMS_IMM | 0x19) #ifdef DEBUG_EXTRA /*UOP_LOG_INSTR - log non-recompiled instruction in imm_data*/ @@ -765,6 +766,7 @@ static inline void uop_gen_reg_src2_pointer(uint32_t uop_type, ir_data_t *ir, in #define uop_STORE_PTR_IMM(ir, p, imm) uop_gen_pointer_imm(UOP_STORE_P_IMM, ir, p, imm) #define uop_STORE_PTR_IMM_8(ir, p, imm) uop_gen_pointer_imm(UOP_STORE_P_IMM_8, ir, p, imm) +#define uop_STORE_PTR_IMM_16(ir, p, imm) uop_gen_pointer_imm(UOP_STORE_P_IMM_16, ir, p, imm) #define uop_TEST_JNS_DEST(ir, src_reg) uop_gen_reg_src1(UOP_TEST_JNS_DEST, ir, src_reg) #define uop_TEST_JS_DEST(ir, src_reg) uop_gen_reg_src1(UOP_TEST_JS_DEST, ir, src_reg) @@ -807,4 +809,9 @@ void codegen_direct_write_double_stack(codeblock_t *block, int stack_offset, int void codegen_set_jump_dest(codeblock_t *block, void *p); +void codegen_direct_write_8_imm(codeblock_t *block, void *p, uint8_t imm_data); +void codegen_direct_write_16_imm(codeblock_t *block, void *p, uint16_t imm_data); +void codegen_direct_write_32_imm(codeblock_t *block, void *p, uint32_t imm_data); +void codegen_direct_write_32_imm_stack(codeblock_t *block, int stack_offset, uint32_t imm_data); + #endif diff --git a/src/codegen_new/codegen_reg.c b/src/codegen_new/codegen_reg.c index ed067f707..c8ad46cea 100644 --- a/src/codegen_new/codegen_reg.c +++ b/src/codegen_new/codegen_reg.c @@ -277,8 +277,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, switch (ireg_data[IREG_GET_REG(ir_reg.reg)].native_size) { case REG_WORD: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER) fatal("codegen_reg_load - REG_WORD !REG_INTEGER\n"); +#endif if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256) codegen_direct_read_16_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p); else @@ -286,8 +288,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_DWORD: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER) fatal("codegen_reg_load - REG_DWORD !REG_INTEGER\n"); +#endif if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256) codegen_direct_read_32_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p); else @@ -295,8 +299,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_QWORD: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP) fatal("codegen_reg_load - REG_QWORD !REG_FP\n"); +#endif if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256) codegen_direct_read_64_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p); else @@ -304,8 +310,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_POINTER: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER) fatal("codegen_reg_load - REG_POINTER !REG_INTEGER\n"); +#endif if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256) codegen_direct_read_pointer_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p); else @@ -313,8 +321,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_DOUBLE: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP) fatal("codegen_reg_load - REG_DOUBLE !REG_FP\n"); +#endif if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256) codegen_direct_read_double_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p); else @@ -322,8 +332,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_FPU_ST_BYTE: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER) fatal("codegen_reg_load - REG_FPU_ST_BYTE !REG_INTEGER\n"); +#endif if (block->flags & CODEBLOCK_STATIC_TOP) codegen_direct_read_8(block, reg_set->reg_list[c].reg, &cpu_state.tag[ir_reg.reg & 7]); else @@ -331,8 +343,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_FPU_ST_QWORD: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP) fatal("codegen_reg_load - REG_FPU_ST_QWORD !REG_FP\n"); +#endif if (block->flags & CODEBLOCK_STATIC_TOP) codegen_direct_read_64(block, reg_set->reg_list[c].reg, &cpu_state.MM[ir_reg.reg & 7]); else @@ -340,8 +354,10 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c, break; case REG_FPU_ST_DOUBLE: +#ifndef RELEASE_BUILD if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP) fatal("codegen_reg_load - REG_FPU_ST_DOUBLE !REG_FP\n"); +#endif if (block->flags & CODEBLOCK_STATIC_TOP) codegen_direct_read_double(block, reg_set->reg_list[c].reg, &cpu_state.ST[ir_reg.reg & 7]); else @@ -366,24 +382,30 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i switch (ireg_data[ir_reg].native_size) { case REG_BYTE: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_INTEGER) fatal("codegen_reg_writeback - REG_BYTE !REG_INTEGER\n"); if ((uintptr_t)p < 256) fatal("codegen_reg_writeback - REG_BYTE %p\n", p); +#endif codegen_direct_write_8(block, p, reg_set->reg_list[c].reg); break; case REG_WORD: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_INTEGER) fatal("codegen_reg_writeback - REG_WORD !REG_INTEGER\n"); if ((uintptr_t)p < 256) fatal("codegen_reg_writeback - REG_WORD %p\n", p); +#endif codegen_direct_write_16(block, p, reg_set->reg_list[c].reg); break; case REG_DWORD: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_INTEGER) fatal("codegen_reg_writeback - REG_DWORD !REG_INTEGER\n"); +#endif if ((uintptr_t)p < 256) codegen_direct_write_32_stack(block, (int)(uintptr_t)p, reg_set->reg_list[c].reg); else @@ -391,8 +413,10 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i break; case REG_QWORD: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_FP) fatal("codegen_reg_writeback - REG_QWORD !REG_FP\n"); +#endif if ((uintptr_t)p < 256) codegen_direct_write_64_stack(block, (int)(uintptr_t)p, reg_set->reg_list[c].reg); else @@ -400,16 +424,20 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i break; case REG_POINTER: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_INTEGER) fatal("codegen_reg_writeback - REG_POINTER !REG_INTEGER\n"); if ((uintptr_t)p < 256) fatal("codegen_reg_writeback - REG_POINTER %p\n", p); +#endif codegen_direct_write_ptr(block, p, reg_set->reg_list[c].reg); break; case REG_DOUBLE: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_FP) fatal("codegen_reg_writeback - REG_DOUBLE !REG_FP\n"); +#endif if ((uintptr_t)p < 256) codegen_direct_write_double_stack(block, (int)(uintptr_t)p, reg_set->reg_list[c].reg); else @@ -417,8 +445,10 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i break; case REG_FPU_ST_BYTE: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_INTEGER) fatal("codegen_reg_writeback - REG_FPU_ST_BYTE !REG_INTEGER\n"); +#endif if (block->flags & CODEBLOCK_STATIC_TOP) codegen_direct_write_8(block, &cpu_state.tag[reg_set->regs[c].reg & 7], reg_set->reg_list[c].reg); else @@ -426,8 +456,10 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i break; case REG_FPU_ST_QWORD: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_FP) fatal("codegen_reg_writeback - REG_FPU_ST_QWORD !REG_FP\n"); +#endif if (block->flags & CODEBLOCK_STATIC_TOP) codegen_direct_write_64(block, &cpu_state.MM[reg_set->regs[c].reg & 7], reg_set->reg_list[c].reg); else @@ -435,8 +467,10 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i break; case REG_FPU_ST_DOUBLE: +#ifndef RELEASE_BUILD if (ireg_data[ir_reg].type != REG_FP) fatal("codegen_reg_writeback - REG_FPU_ST_DOUBLE !REG_FP\n"); +#endif if (block->flags & CODEBLOCK_STATIC_TOP) codegen_direct_write_double(block, &cpu_state.ST[reg_set->regs[c].reg & 7], reg_set->reg_list[c].reg); else @@ -452,6 +486,49 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i reg_set->dirty[c] = 0; } +#ifdef CODEGEN_BACKEND_HAS_MOV_IMM +void codegen_reg_write_imm(codeblock_t *block, ir_reg_t ir_reg, uint32_t imm_data) +{ + int reg_idx = IREG_GET_REG(ir_reg.reg); + void *p = ireg_data[reg_idx].p; + + switch (ireg_data[reg_idx].native_size) + { + case REG_BYTE: +#ifndef RELEASE_BUILD + if ((uintptr_t)p < 256) + fatal("codegen_reg_write_imm - REG_BYTE %p\n", p); +#endif + codegen_direct_write_8_imm(block, p, imm_data); + break; + + case REG_WORD: +#ifndef RELEASE_BUILD + if ((uintptr_t)p < 256) + fatal("codegen_reg_write_imm - REG_WORD %p\n", p); +#endif + codegen_direct_write_16_imm(block, p, imm_data); + break; + + case REG_DWORD: + if ((uintptr_t)p < 256) + codegen_direct_write_32_imm_stack(block, (int)p, imm_data); + else + codegen_direct_write_32_imm(block, p, imm_data); + break; + + case REG_POINTER: + case REG_QWORD: + case REG_DOUBLE: + case REG_FPU_ST_BYTE: + case REG_FPU_ST_QWORD: + case REG_FPU_ST_DOUBLE: + default: + fatal("codegen_reg_write_imm - native_size=%i\n", ireg_data[reg_idx].native_size); + } +} +#endif + static void alloc_reg(ir_reg_t ir_reg) { host_reg_set_t *reg_set = get_reg_set(ir_reg); @@ -462,8 +539,10 @@ static void alloc_reg(ir_reg_t ir_reg) { if (IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(ir_reg.reg)) { +#ifndef RELEASE_BUILD if (reg_set->regs[c].version != ir_reg.version) fatal("alloc_reg - host_regs[c].version != ir_reg.version %i %p %p %i %i\n", c, reg_set, &host_reg_set, reg_set->regs[c].reg, ir_reg.reg); +#endif reg_set->locked |= (1 << c); return; } @@ -551,8 +630,10 @@ ir_host_reg_t codegen_reg_alloc_read_reg(codeblock_t *block, ir_reg_t ir_reg, in break; } +#ifndef RELEASE_BUILD if (!ir_reg_is_invalid(reg_set->regs[c]) && IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(ir_reg.reg) && reg_version[IREG_GET_REG(reg_set->regs[c].reg)][reg_set->regs[c].version].refcount) fatal("codegen_reg_alloc_read_reg - version mismatch!\n"); +#endif } if (c == reg_set->nr_regs) @@ -571,8 +652,10 @@ ir_host_reg_t codegen_reg_alloc_read_reg(codeblock_t *block, ir_reg_t ir_reg, in if (!(reg_set->locked & (1 << c))) break; } +#ifndef RELEASE_BUILD if (c == reg_set->nr_regs) fatal("codegen_reg_alloc_read_reg - out of registers\n"); +#endif } if (reg_set->dirty[c]) codegen_reg_writeback(reg_set, block, c, 1); @@ -582,8 +665,10 @@ ir_host_reg_t codegen_reg_alloc_read_reg(codeblock_t *block, ir_reg_t ir_reg, in } reg_version[IREG_GET_REG(reg_set->regs[c].reg)][reg_set->regs[c].version].refcount--; +#ifndef RELEASE_BUILD if (reg_version[IREG_GET_REG(reg_set->regs[c].reg)][reg_set->regs[c].version].refcount == (uint8_t)-1) fatal("codegen_reg_alloc_read_reg - refcount < 0\n"); +#endif if (host_reg_idx) *host_reg_idx = c; @@ -606,11 +691,13 @@ ir_host_reg_t codegen_reg_alloc_write_reg(codeblock_t *block, ir_reg_t ir_reg) codegen_reg_alloc_read_reg(block, parent_reg, &c); +#ifndef RELEASE_BUILD if (IREG_GET_REG(reg_set->regs[c].reg) != IREG_GET_REG(ir_reg.reg) || reg_set->regs[c].version > ir_reg.version-1) fatal("codegen_reg_alloc_write_reg sub_reg - doesn't match %i %02x.%i %02x.%i\n", c, reg_set->regs[c].reg,reg_set->regs[c].version, ir_reg.reg,ir_reg.version); - +#endif + reg_set->regs[c].reg = ir_reg.reg; reg_set->regs[c].version = ir_reg.version; reg_set->dirty[c] = 1; @@ -624,8 +711,10 @@ ir_host_reg_t codegen_reg_alloc_write_reg(codeblock_t *block, ir_reg_t ir_reg) { if (reg_set->regs[c].version <= ir_reg.version-1) { +#ifndef RELEASE_BUILD if (reg_version[IREG_GET_REG(reg_set->regs[c].reg)][reg_set->regs[c].version].refcount != 0) fatal("codegen_reg_alloc_write_reg - previous version refcount != 0\n"); +#endif break; } } @@ -648,8 +737,10 @@ ir_host_reg_t codegen_reg_alloc_write_reg(codeblock_t *block, ir_reg_t ir_reg) if (!(reg_set->locked & (1 << c))) break; } +#ifndef RELEASE_BUILD if (c == reg_set->nr_regs) fatal("codegen_reg_alloc_write_reg - out of registers\n"); +#endif if (reg_set->dirty[c]) codegen_reg_writeback(reg_set, block, c, 1); } @@ -661,6 +752,68 @@ ir_host_reg_t codegen_reg_alloc_write_reg(codeblock_t *block, ir_reg_t ir_reg) return reg_set->reg_list[c].reg | IREG_GET_SIZE(ir_reg.reg); } +#ifdef CODEGEN_BACKEND_HAS_MOV_IMM +int codegen_reg_is_loaded(ir_reg_t ir_reg) +{ + host_reg_set_t *reg_set = get_reg_set(ir_reg); + int c; + + /*Search for previous version in host register*/ + for (c = 0; c < reg_set->nr_regs; c++) + { + if (!ir_reg_is_invalid(reg_set->regs[c]) && IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(ir_reg.reg)) + { + if (reg_set->regs[c].version <= ir_reg.version-1) + { +#ifndef RELEASE_BUILD + if (reg_version[IREG_GET_REG(reg_set->regs[c].reg)][reg_set->regs[c].version].refcount != 0) + fatal("codegen_reg_alloc_write_reg - previous version refcount != 0\n"); +#endif + return 1; + } + } + } + return 0; +} +#endif + +void codegen_reg_rename(codeblock_t *block, ir_reg_t src, ir_reg_t dst) +{ + host_reg_set_t *reg_set = get_reg_set(src); + int c; + int target; + +// pclog("rename: %i.%i -> %i.%i\n", src.reg,src.version, dst.reg, dst.version); + /*Search for required register*/ + for (c = 0; c < reg_set->nr_regs; c++) + { + if (!ir_reg_is_invalid(reg_set->regs[c]) && IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(src.reg) && reg_set->regs[c].version == src.version) + break; + } +#ifndef RELEASE_BUILD + if (c == reg_set->nr_regs) + fatal("codegen_reg_rename: Can't find register to rename\n"); +#endif + target = c; + if (reg_set->dirty[target]) + codegen_reg_writeback(reg_set, block, target, 0); + reg_set->regs[target] = dst; + reg_set->dirty[target] = 1; +// pclog("renamed reg %i dest=%i.%i\n", target, dst.reg, dst.version); + + /*Invalidate any stale copies of the dest register*/ + for (c = 0; c < reg_set->nr_regs; c++) + { + if (c == target) + continue; + if (!ir_reg_is_invalid(reg_set->regs[c]) && IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(dst.reg)) + { + reg_set->regs[c] = invalid_ir_reg; + reg_set->dirty[c] = 0; + } + } +} + void codegen_reg_flush(ir_data_t *ir, codeblock_t *block) { host_reg_set_t *reg_set; diff --git a/src/codegen_new/codegen_reg.h b/src/codegen_new/codegen_reg.h index 329e5a6b3..32ce54b3b 100644 --- a/src/codegen_new/codegen_reg.h +++ b/src/codegen_new/codegen_reg.h @@ -325,17 +325,21 @@ static inline ir_reg_t codegen_reg_read(int reg) ir_reg_t ireg; reg_version_t *version; +#ifndef RELEASE_BUILD if (IREG_GET_REG(reg) == IREG_INVALID) fatal("codegen_reg_read - IREG_INVALID\n"); - +#endif ireg.reg = reg; ireg.version = reg_last_version[IREG_GET_REG(reg)]; version = ®_version[IREG_GET_REG(ireg.reg)][ireg.version]; version->flags = 0; version->refcount++; +#ifndef RELEASE_BUILD if (!version->refcount) fatal("codegen_reg_read - refcount overflow\n"); - else if (version->refcount > REG_REFCOUNT_MAX) + else +#endif + if (version->refcount > REG_REFCOUNT_MAX) CPU_BLOCK_END(); if (version->refcount > max_version_refcount) max_version_refcount = version->refcount; @@ -350,9 +354,10 @@ static inline ir_reg_t codegen_reg_write(int reg, int uop_nr) int last_version = reg_last_version[IREG_GET_REG(reg)]; reg_version_t *version; +#ifndef RELEASE_BUILD if (IREG_GET_REG(reg) == IREG_INVALID) fatal("codegen_reg_write - IREG_INVALID\n"); - +#endif ireg.reg = reg; ireg.version = last_version + 1; @@ -364,9 +369,12 @@ static inline ir_reg_t codegen_reg_write(int reg, int uop_nr) } reg_last_version[IREG_GET_REG(reg)]++; +#ifndef RELEASE_BUILD if (!reg_last_version[IREG_GET_REG(reg)]) fatal("codegen_reg_write - version overflow\n"); - else if (reg_last_version[IREG_GET_REG(reg)] > REG_VERSION_MAX) + else +#endif + if (reg_last_version[IREG_GET_REG(reg)] > REG_VERSION_MAX) CPU_BLOCK_END(); if (reg_last_version[IREG_GET_REG(reg)] > max_version_refcount) max_version_refcount = reg_last_version[IREG_GET_REG(reg)]; @@ -394,9 +402,16 @@ void codegen_reg_flush_invalidate(struct ir_data_t *ir, codeblock_t *block); /*Register ir_reg usage for this uOP. This ensures that required registers aren't evicted*/ void codegen_reg_alloc_register(ir_reg_t dest_reg_a, ir_reg_t src_reg_a, ir_reg_t src_reg_b, ir_reg_t src_reg_c); +#ifdef CODEGEN_BACKEND_HAS_MOV_IMM +int codegen_reg_is_loaded(ir_reg_t ir_reg); +void codegen_reg_write_imm(codeblock_t *block, ir_reg_t ir_reg, uint32_t imm_data); +#endif + ir_host_reg_t codegen_reg_alloc_read_reg(codeblock_t *block, ir_reg_t ir_reg, int *host_reg_idx); ir_host_reg_t codegen_reg_alloc_write_reg(codeblock_t *block, ir_reg_t ir_reg); +void codegen_reg_rename(codeblock_t *block, ir_reg_t src, ir_reg_t dst); + void codegen_reg_mark_as_required(); void codegen_reg_process_dead_list(struct ir_data_t *ir); #endif diff --git a/src/config.c b/src/config.c index b4c8ca141..292c461d1 100644 --- a/src/config.c +++ b/src/config.c @@ -668,6 +668,9 @@ load_sound(void) char *p; p = config_get_string(cat, "sndcard", NULL); + /* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */ + if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci"))) + p = "es1371"; if (p != NULL) sound_card_current = sound_card_get_from_internal_name(p); else diff --git a/src/cpu/386.c b/src/cpu/386.c index 9929dc639..ade157a32 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -199,10 +199,10 @@ static inline void fetch_ea_16_long(uint32_t rmdat) #include "x86_ops.h" + void exec386(int cycs) { - // uint8_t opcode; int vector, tempi, cycdiff, oldcyc; int cycle_period, ins_cycles; uint32_t addr; @@ -257,30 +257,6 @@ exec386(int cycs) if (!use32) cpu_state.pc &= 0xffff; #endif - if (cpu_state.abrt) { - flags_rebuild(); - tempi = cpu_state.abrt; - cpu_state.abrt = 0; - x86_doabrt(tempi); - if (cpu_state.abrt) { - cpu_state.abrt = 0; -#ifndef USE_NEW_DYNAREC - CS = oldcs; -#endif - cpu_state.pc = cpu_state.oldpc; - x386_log("Double fault %i\n", ins); - pmodeint(8, 0); - if (cpu_state.abrt) { - cpu_state.abrt = 0; - softresetx86(); - cpu_set_edx(); -#ifdef ENABLE_386_LOG - x386_log("Triple fault - reset\n"); -#endif - } - } - } - ins_cycles -= cycles; tsc += ins_cycles; @@ -314,7 +290,7 @@ exec386(int cycs) nmi_auto_clear = 0; nmi = 0; } - } else if ((cpu_state.flags & I_FLAG) && pic.int_pending) { + } else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins) { vector = picinterrupt(); if (vector != -1) { flags_rebuild(); @@ -332,8 +308,32 @@ exec386(int cycs) loadcs(readmemw(0, addr + 2)); } } + } else if (cpu_state.abrt) { + flags_rebuild(); + tempi = cpu_state.abrt & ABRT_MASK; + cpu_state.abrt = 0; + x86_doabrt(tempi); + if (cpu_state.abrt) { + cpu_state.abrt = 0; +#ifndef USE_NEW_DYNAREC + CS = oldcs; +#endif + cpu_state.pc = cpu_state.oldpc; + x386_log("Double fault %i\n", ins); + pmodeint(8, 0); + if (cpu_state.abrt) { + cpu_state.abrt = 0; + softresetx86(); + cpu_set_edx(); +#ifdef ENABLE_386_LOG + x386_log("Triple fault - reset\n"); +#endif + } + } } + cpu_end_block_after_ins = 0; + if (timetolive) { timetolive--; if (!timetolive) diff --git a/src/cpu/386_common.c b/src/cpu/386_common.c index 3ff6b5fb1..28caf5047 100644 --- a/src/cpu/386_common.c +++ b/src/cpu/386_common.c @@ -46,7 +46,7 @@ uint32_t *eal_r, *eal_w; int nmi_enable = 1; -int cpl_override=0; +int alt_access, cpl_override = 0; #ifdef USE_NEW_DYNAREC uint16_t cpu_cur_status = 0; @@ -322,7 +322,10 @@ x386_common_log(const char *fmt, ...) static __inline void set_stack32(int s) { - stack32 = s; + if ((cr0 & 1) && ! (cpu_state.eflags & VM_FLAG)) + stack32 = s; + else + stack32 = 0; if (stack32) cpu_cur_status |= CPU_STATUS_STACK32; @@ -334,13 +337,15 @@ set_stack32(int s) static __inline void set_use32(int u) { - if (u) { - use32 = 0x300; - cpu_cur_status |= CPU_STATUS_USE32; - } else { + if ((cr0 & 1) && ! (cpu_state.eflags & VM_FLAG)) + use32 = u ? 0x300 : 0; + else use32 = 0; + + if (use32) + cpu_cur_status |= CPU_STATUS_USE32; + else cpu_cur_status &= ~CPU_STATUS_USE32; - } } @@ -984,6 +989,30 @@ smram_restore_state_amd_k(uint32_t *saved_state) } +static void +smram_save_state_cyrix(uint32_t *saved_state, int in_hlt) +{ + saved_state[0] = dr[7]; + saved_state[1] = cpu_state.flags | (cpu_state.eflags << 16); + saved_state[2] = cr0; + saved_state[3] = cpu_state.oldpc; + saved_state[4] = cpu_state.pc; + saved_state[5] = CS | (CPL << 21); + saved_state[6] = 0x00000000; +} + + +static void +smram_restore_state_cyrix(uint32_t *saved_state) +{ + dr[7] = saved_state[0]; + cpu_state.flags = saved_state[1] & 0xffff; + cpu_state.eflags = saved_state[1] >> 16; + cr0 = saved_state[2]; + cpu_state.pc = saved_state[4]; +} + + void enter_smm(int in_hlt) { @@ -991,9 +1020,15 @@ enter_smm(int in_hlt) uint32_t smram_state = smbase + 0x10000; /* If it's a CPU on which SMM is not supporter, do nothing. */ - if (!is_am486 && !is_pentium && !is_k5 && !is_k6 && !is_p6) + if (!is_am486 && !is_pentium && !is_k5 && !is_k6 && !is_p6 && !is_cx6x86) return; + if (cpu_iscyrix) { + if (!cyrix.smhr & SMHR_VALID) + cyrix.smhr = (cyrix.arr[3].base + cyrix.arr[3].size) | SMHR_VALID; + smram_state = cyrix.smhr & SMHR_ADDR_MASK; + } + x386_common_log("enter_smm(): smbase = %08X\n", smbase); x386_common_log("CS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n", cpu_state.seg_cs.seg, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low, @@ -1030,8 +1065,16 @@ enter_smm(int in_hlt) smram_backup_all(); smram_recalc_all(0); + if (cpu_iscyrix) { + if (!cyrix.smhr & SMHR_VALID) + cyrix.smhr = (cyrix.arr[3].base + cyrix.arr[3].size) | SMHR_VALID; + smram_state = cyrix.smhr & SMHR_ADDR_MASK; + } + memset(saved_state, 0x00, SMM_SAVE_STATE_MAP_SIZE * sizeof(uint32_t)); + if (cpu_iscyrix) /* Cx6x86 */ + smram_save_state_cyrix(saved_state, in_hlt); if (is_pentium || is_am486) /* Am486 / 5x86 / Intel P5 (Pentium) */ smram_save_state_p5(saved_state, in_hlt); else if (is_k5 || is_k6) /* AMD K5 and K6 */ @@ -1046,44 +1089,69 @@ enter_smm(int in_hlt) cr4 = 0; dr[7] = 0x400; - cpu_state.pc = 0x8000; - cpu_state.seg_ds.seg = 0x00000000; - cpu_state.seg_ds.base = 0x00000000; - cpu_state.seg_ds.limit = 0xffffffff; - cpu_state.seg_ds.access = 0x93; - cpu_state.seg_ds.ar_high = 0x80; + if (cpu_iscyrix) { + cpu_state.pc = 0x0000; + cpu_state.seg_cs.seg = (cyrix.arr[3].base >> 4); + cpu_state.seg_cs.base = cyrix.arr[3].base; + cpu_state.seg_cs.limit = 0xffffffff; + cpu_state.seg_cs.access = 0x93; + cpu_state.seg_cs.ar_high = 0x80; + cpu_state.seg_cs.checked = 1; - memcpy(&cpu_state.seg_es, &cpu_state.seg_ds, sizeof(x86seg)); - memcpy(&cpu_state.seg_ss, &cpu_state.seg_ds, sizeof(x86seg)); - memcpy(&cpu_state.seg_fs, &cpu_state.seg_ds, sizeof(x86seg)); - memcpy(&cpu_state.seg_gs, &cpu_state.seg_ds, sizeof(x86seg)); + smm_seg_load(&cpu_state.seg_cs); + } else { + cpu_state.pc = 0x8000; + cpu_state.seg_ds.seg = 0x00000000; + cpu_state.seg_ds.base = 0x00000000; + cpu_state.seg_ds.limit = 0xffffffff; + cpu_state.seg_ds.access = 0x93; + cpu_state.seg_ds.ar_high = 0x80; - if (is_p6) - cpu_state.seg_cs.seg = (smbase >> 4); - else - cpu_state.seg_cs.seg = 0x3000; + memcpy(&cpu_state.seg_es, &cpu_state.seg_ds, sizeof(x86seg)); + memcpy(&cpu_state.seg_ss, &cpu_state.seg_ds, sizeof(x86seg)); + memcpy(&cpu_state.seg_fs, &cpu_state.seg_ds, sizeof(x86seg)); + memcpy(&cpu_state.seg_gs, &cpu_state.seg_ds, sizeof(x86seg)); - /* On Pentium, CS selector in SMM is always 3000, regardless of SMBASE. */ - cpu_state.seg_cs.base = smbase; - cpu_state.seg_cs.limit = 0xffffffff; - cpu_state.seg_cs.access = 0x93; - cpu_state.seg_cs.ar_high = 0x80; - cpu_state.seg_cs.checked = 1; + if (is_p6) + cpu_state.seg_cs.seg = (smbase >> 4); + else + cpu_state.seg_cs.seg = 0x3000; - smm_seg_load(&cpu_state.seg_es); - smm_seg_load(&cpu_state.seg_cs); - smm_seg_load(&cpu_state.seg_ds); - smm_seg_load(&cpu_state.seg_ss); - smm_seg_load(&cpu_state.seg_fs); - smm_seg_load(&cpu_state.seg_gs); + /* On Pentium, CS selector in SMM is always 3000, regardless of SMBASE. */ + cpu_state.seg_cs.base = smbase; + cpu_state.seg_cs.limit = 0xffffffff; + cpu_state.seg_cs.access = 0x93; + cpu_state.seg_cs.ar_high = 0x80; + cpu_state.seg_cs.checked = 1; + + smm_seg_load(&cpu_state.seg_es); + smm_seg_load(&cpu_state.seg_cs); + smm_seg_load(&cpu_state.seg_ds); + smm_seg_load(&cpu_state.seg_ss); + smm_seg_load(&cpu_state.seg_fs); + smm_seg_load(&cpu_state.seg_gs); + } cpu_state.op32 = use32; - for (n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) { - smram_state -= 4; - writememl(0, smram_state, saved_state[n]); + cpl_override = 1; + if (cpu_iscyrix) { + writememl(0, smram_state - 0x04, saved_state[0]); + writememl(0, smram_state - 0x08, saved_state[1]); + writememl(0, smram_state - 0x0c, saved_state[2]); + writememl(0, smram_state - 0x10, saved_state[3]); + writememl(0, smram_state - 0x14, saved_state[4]); + writememl(0, smram_state - 0x18, saved_state[5]); + cyrix_write_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs); + writememl(0, smram_state - 0x18, saved_state[6]); + } else { + for (n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) { + smram_state -= 4; + writememl(0, smram_state, saved_state[n]); + } } + cpl_override = 0; nmi_mask = 0; @@ -1102,6 +1170,7 @@ enter_smm(int in_hlt) flushmmucache(); } + cpu_cur_status &= ~(CPU_STATUS_PMODE | CPU_STATUS_V86); CPU_BLOCK_END(); } @@ -1142,16 +1211,30 @@ leave_smm(void) uint32_t smram_state = smbase + 0x10000; /* If it's a CPU on which SMM is not supported (or not implemented in 86Box), do nothing. */ - if (!is_am486 && !is_pentium && !is_k5 && !is_k6 && !is_p6) + if (!is_am486 && !is_pentium && !is_k5 && !is_k6 && !is_p6 && !is_cx6x86) return; memset(saved_state, 0x00, SMM_SAVE_STATE_MAP_SIZE * sizeof(uint32_t)); - for (n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) { - smram_state -= 4; - saved_state[n] = readmeml(0, smram_state); - x386_common_log("Reading %08X from memory at %08X to array element %i\n", saved_state[n], smram_state, n); + cpl_override = 1; + if (cpu_iscyrix) { + smram_state = cyrix.smhr & SMHR_ADDR_MASK; + saved_state[0] = readmeml(0, smram_state - 0x04); + saved_state[1] = readmeml(0, smram_state - 0x08); + saved_state[2] = readmeml(0, smram_state - 0x0c); + saved_state[3] = readmeml(0, smram_state - 0x10); + saved_state[4] = readmeml(0, smram_state - 0x14); + saved_state[5] = readmeml(0, smram_state - 0x18); + cyrix_load_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs); + saved_state[6] = readmeml(0, smram_state - 0x24); + } else { + for (n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) { + smram_state -= 4; + saved_state[n] = readmeml(0, smram_state); + x386_common_log("Reading %08X from memory at %08X to array element %i\n", saved_state[n], smram_state, n); + } } + cpl_override = 0; if (unmask_a20_in_smm) { rammask = old_rammask; @@ -1160,17 +1243,25 @@ leave_smm(void) } x386_common_log("New SMBASE: %08X (%08X)\n", saved_state[SMRAM_FIELD_P5_SMBASE_OFFSET], saved_state[66]); - if (is_pentium) /* Intel P5 (Pentium) */ + if (cpu_iscyrix) /* Cx6x86 */ + smram_restore_state_cyrix(saved_state); + else if (is_pentium) /* Intel P5 (Pentium) */ smram_restore_state_p5(saved_state); else if (is_k5 || is_k6) /* AMD K5 and K6 */ smram_restore_state_amd_k(saved_state); - else if (is_p6) /* Intel P6 (Pentium Pro, Pentium II, Celeron) */ + else if (is_p6) /* Intel P6 (Pentium Pro, Pentium II, Celeron) */ smram_restore_state_p6(saved_state); in_smm = 0; smram_recalc_all(1); - cpu_state.op32 = use32; + cpu_386_flags_extract(); + cpu_cur_status &= ~(CPU_STATUS_PMODE | CPU_STATUS_V86); + if (cr0 & 1) { + cpu_cur_status |= CPU_STATUS_PMODE; + if (cpu_state.eflags & VM_FLAG) + cpu_cur_status |= CPU_STATUS_V86; + } nmi_mask = 1; @@ -1502,8 +1593,6 @@ read_seg_data(uint16_t *seg_data, uint16_t seg, x86seg *s) int sysenter(uint32_t fetchdat) { - uint16_t seg_data[4]; - #ifdef ENABLE_386_COMMON_LOG x386_common_log("SYSENTER called\n"); #endif @@ -1542,46 +1631,34 @@ sysenter(uint32_t fetchdat) oldcs = CS; #endif cpu_state.oldpc = cpu_state.pc; -#if 0 - old_pc = cpu_state.pc; -#endif ESP = esp_msr; cpu_state.pc = eip_msr; -#ifdef ENABLE_386_COMMON_LOG - x386_common_log("SYSENTER: Loading CS...\n"); -#endif - CS = (cs_msr & 0xFFFC); - cpu_state.seg_cs.access &= 0x9f; - read_seg_data(seg_data, CS, &cpu_state.seg_cs); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_cs, seg_data); - cpu_state.seg_cs.checked = 0; - set_use32(0x40); + cpu_state.seg_cs.seg = (cs_msr & 0xfffc); + cpu_state.seg_cs.base = 0; + cpu_state.seg_cs.limit_low = 0; + cpu_state.seg_cs.limit = 0xffffffff; + cpu_state.seg_cs.limit_raw = 0x000fffff; + cpu_state.seg_cs.limit_high = 0xffffffff; + cpu_state.seg_cs.access = 0x9b; + cpu_state.seg_cs.ar_high = 0xcf; + cpu_state.seg_cs.checked = 1; -#ifdef ENABLE_386_COMMON_LOG - x386_common_log("SYSENTER: Loading SS...\n"); -#endif - SS = ((cs_msr + 8) & 0xFFFC); - read_seg_data(seg_data, SS, &cpu_state.seg_ss); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_ss, seg_data); - cpu_state.seg_ss.checked = 0; -#ifdef USE_DYNAREC - codegen_flat_ss = 0; -#endif - if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 && - cpu_state.seg_ss.limit_high == 0xffffffff) - cpu_cur_status &= ~CPU_STATUS_NOTFLATSS; - else - cpu_cur_status |= CPU_STATUS_NOTFLATSS; + cpu_state.seg_ss.seg = ((cs_msr + 8) & 0xfffc); + cpu_state.seg_ss.base = 0; + cpu_state.seg_ss.limit_low = 0; + cpu_state.seg_ss.limit = 0xffffffff; + cpu_state.seg_ss.limit_raw = 0x000fffff; + cpu_state.seg_ss.limit_high = 0xffffffff; + cpu_state.seg_ss.access = 0x93; + cpu_state.seg_ss.ar_high = 0xcf; + cpu_state.seg_ss.checked = 1; + + cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS | CPU_STATUS_V86); + cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE); + set_use32(1); set_stack32(1); - oldcpl = CPL; - flags_extract(); - trap = 0; in_sys = 1; #ifdef ENABLE_386_COMMON_LOG @@ -1599,8 +1676,6 @@ sysenter(uint32_t fetchdat) int sysexit(uint32_t fetchdat) { - uint16_t seg_data[4]; - #ifdef ENABLE_386_COMMON_LOG x386_common_log("SYSEXIT called\n"); #endif @@ -1644,39 +1719,33 @@ sysexit(uint32_t fetchdat) ESP = ECX; cpu_state.pc = EDX; -#ifdef ENABLE_386_COMMON_LOG - x386_common_log("SYSEXIT: Loading CS...\n"); -#endif - CS = (((cs_msr + 16) & 0xFFFC) | 3); - read_seg_data(seg_data, CS, &cpu_state.seg_cs); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_cs, seg_data); - cpu_state.seg_cs.checked = 0; - set_use32(0x40); + cpu_state.seg_cs.seg = (((cs_msr + 16) & 0xfffc) | 3); + cpu_state.seg_cs.base = 0; + cpu_state.seg_cs.limit_low = 0; + cpu_state.seg_cs.limit = 0xffffffff; + cpu_state.seg_cs.limit_raw = 0x000fffff; + cpu_state.seg_cs.limit_high = 0xffffffff; + cpu_state.seg_cs.access = 0xfb; + cpu_state.seg_cs.ar_high = 0xcf; + cpu_state.seg_cs.checked = 1; + oldcpl = 3; -#ifdef ENABLE_386_COMMON_LOG - x386_common_log("SYSEXIT: Loading SS...\n"); -#endif - SS = (((cs_msr + 24) & 0xFFFC) | 3); - read_seg_data(seg_data, SS, &cpu_state.seg_ss); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_ss, seg_data); - cpu_state.seg_ss.checked = 0; -#ifdef USE_DYNAREC - codegen_flat_ss = 0; -#endif - if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 && - cpu_state.seg_ss.limit_high == 0xffffffff) - cpu_cur_status &= ~CPU_STATUS_NOTFLATSS; - else - cpu_cur_status |= CPU_STATUS_NOTFLATSS; + cpu_state.seg_ss.seg = (((cs_msr + 24) & 0xfffc) | 3); + cpu_state.seg_ss.base = 0; + cpu_state.seg_ss.limit_low = 0; + cpu_state.seg_ss.limit = 0xffffffff; + cpu_state.seg_ss.limit_raw = 0x000fffff; + cpu_state.seg_ss.limit_high = 0xffffffff; + cpu_state.seg_ss.access = 0xf3; + cpu_state.seg_cs.ar_high = 0xcf; + cpu_state.seg_ss.checked = 1; + + cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS | CPU_STATUS_V86); + cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE); + flushmmucache_cr3(); + set_use32(1); set_stack32(1); - flushmmucache_cr3(); - oldcpl = CPL; - trap = 0; in_sys = 0; #ifdef ENABLE_386_COMMON_LOG @@ -1694,8 +1763,6 @@ sysexit(uint32_t fetchdat) int syscall(uint32_t fetchdat) { - uint16_t seg_data[4]; - #ifdef ENABLE_386_COMMON_LOG x386_common_log("SYSCALL called\n"); #endif @@ -1719,34 +1786,32 @@ syscall(uint32_t fetchdat) cpu_cur_status &= ~CPU_STATUS_V86; /* CS */ - CS = AMD_SYSCALL_SB & 0xFFFC; - read_seg_data(seg_data, CS, &cpu_state.seg_cs); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_cs, seg_data); - cpu_state.seg_cs.checked = 0; - set_use32(0x40); + CS = AMD_SYSCALL_SB & 0xfffc; + cpu_state.seg_cs.base = 0; + cpu_state.seg_cs.limit_low = 0; + cpu_state.seg_cs.limit = 0xffffffff; + cpu_state.seg_cs.limit_raw = 0x000fffff; + cpu_state.seg_cs.limit_high = 0xffffffff; + cpu_state.seg_cs.access = 0x9b; + cpu_state.seg_cs.ar_high = 0xcf; + cpu_state.seg_cs.checked = 1; /* SS */ - SS = (AMD_SYSCALL_SB + 8) & 0xFFFC; - read_seg_data(seg_data, SS, &cpu_state.seg_ss); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_ss, seg_data); - cpu_state.seg_ss.checked = 0; -#ifdef USE_DYNAREC - codegen_flat_ss = 0; -#endif - if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 && - cpu_state.seg_ss.limit_high == 0xffffffff) - cpu_cur_status &= ~CPU_STATUS_NOTFLATSS; - else - cpu_cur_status |= CPU_STATUS_NOTFLATSS; + SS = (AMD_SYSCALL_SB + 8) & 0xfffc; + cpu_state.seg_ss.base = 0; + cpu_state.seg_ss.limit_low = 0; + cpu_state.seg_ss.limit = 0xffffffff; + cpu_state.seg_ss.limit_raw = 0x000fffff; + cpu_state.seg_ss.limit_high = 0xffffffff; + cpu_state.seg_ss.access = 0x93; + cpu_state.seg_ss.ar_high = 0xcf; + cpu_state.seg_ss.checked = 1; + + cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS | CPU_STATUS_V86); + cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE); + set_use32(1); set_stack32(1); - oldcpl = CPL; - flags_extract(); - trap = 0; in_sys = 1; return 1; @@ -1756,8 +1821,6 @@ syscall(uint32_t fetchdat) int sysret(uint32_t fetchdat) { - uint16_t seg_data[4]; - #ifdef ENABLE_386_COMMON_LOG x386_common_log("SYSRET called\n"); #endif @@ -1777,35 +1840,34 @@ sysret(uint32_t fetchdat) cpu_state.eflags |= (1 << 1); /* CS */ - CS = (AMD_SYSRET_SB & 0xFFFC) | 3; - cpu_state.seg_cs.seg = AMD_SYSRET_SB & ~7; - read_seg_data(seg_data, CS, &cpu_state.seg_cs); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_cs, seg_data); - cpu_state.seg_cs.checked = 0; - set_use32(0x40); + CS = (AMD_SYSRET_SB & 0xfffc) | 3; + cpu_state.seg_cs.base = 0; + cpu_state.seg_cs.limit_low = 0; + cpu_state.seg_cs.limit = 0xffffffff; + cpu_state.seg_cs.limit_raw = 0x000fffff; + cpu_state.seg_cs.limit_high = 0xffffffff; + cpu_state.seg_cs.access = 0xfb; + cpu_state.seg_cs.ar_high = 0xcf; + cpu_state.seg_cs.checked = 1; + oldcpl = 3; /* SS */ - SS = ((AMD_SYSRET_SB + 8) & 0xFFFC) | 3; - read_seg_data(seg_data, SS, &cpu_state.seg_ss); - if (cpu_state.abrt) - return 1; - do_seg_load(&cpu_state.seg_ss, seg_data); - cpu_state.seg_ss.checked = 0; -#ifdef USE_DYNAREC - codegen_flat_ss = 0; -#endif - if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 && - cpu_state.seg_ss.limit_high == 0xffffffff) - cpu_cur_status &= ~CPU_STATUS_NOTFLATSS; - else - cpu_cur_status |= CPU_STATUS_NOTFLATSS; + SS = ((AMD_SYSRET_SB + 8) & 0xfffc) | 3; + cpu_state.seg_ss.base = 0; + cpu_state.seg_ss.limit_low = 0; + cpu_state.seg_ss.limit = 0xffffffff; + cpu_state.seg_ss.limit_raw = 0x000fffff; + cpu_state.seg_ss.limit_high = 0xffffffff; + cpu_state.seg_ss.access = 0xf3; + cpu_state.seg_cs.ar_high = 0xcf; + cpu_state.seg_ss.checked = 1; + + cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS | CPU_STATUS_V86); + cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE); + flushmmucache_cr3(); + set_use32(1); set_stack32(1); - flushmmucache_cr3(); - oldcpl = CPL; - trap = 0; in_sys = 0; return 1; diff --git a/src/cpu/386_common.h b/src/cpu/386_common.h index 1b146275b..baf5a63e1 100644 --- a/src/cpu/386_common.h +++ b/src/cpu/386_common.h @@ -57,7 +57,10 @@ int checkio(int port); if (cpu_state.abrt) return 1; \ if (tempi) \ { \ - x86gpf("check_io_perm(): no permission",0); \ + if (cpu_state.eflags & VM_FLAG) \ + x86gpf_expected(NULL,0); \ + else \ + x86gpf(NULL,0); \ return 1; \ } \ } @@ -68,7 +71,10 @@ int checkio(int port); if (cpu_state.abrt) return 1; \ if (tempi) \ { \ - x86gpf("check_io_perm(): no permission",0); \ + if (cpu_state.eflags & VM_FLAG) \ + x86gpf_expected(NULL,0); \ + else \ + x86gpf(NULL,0); \ return 1; \ } \ } diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index ebbc39b04..d24ec71ab 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -36,6 +36,7 @@ int inrecomp = 0, cpu_block_end = 0; +int cpu_end_block_after_ins = 0; #ifdef ENABLE_386_DYNAREC_LOG @@ -305,549 +306,525 @@ update_tsc(void) } } -void exec386_dynarec(int cycs) + +static __inline void +exec386_dynarec_int(void) { - int vector; - uint32_t addr; - int tempi; - int cycdiff; - int oldcyc; - int oldcyc2; - uint64_t oldtsc, delta; - uint32_t start_pc = 0; + cpu_block_end = 0; + x86_was_reset = 0; - int cyc_period = cycs / 2000; /*5us*/ + while (!cpu_block_end) { +#ifndef USE_NEW_DYNAREC + oldcs = CS; + oldcpl = CPL; +#endif + cpu_state.oldpc = cpu_state.pc; + cpu_state.op32 = use32; + cpu_state.ea_seg = &cpu_state.seg_ds; + cpu_state.ssegs = 0; + + fetchdat = fastreadl(cs + cpu_state.pc); +#ifdef ENABLE_386_DYNAREC_LOG + if (in_smm) + x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat); +#endif + + if (!cpu_state.abrt) { + opcode = fetchdat & 0xFF; + fetchdat >>= 8; + + trap = cpu_state.flags & T_FLAG; + + cpu_state.pc++; + x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); + } + +#ifndef USE_NEW_DYNAREC + if (!use32) + cpu_state.pc &= 0xffff; +#endif + + if (((cs + cpu_state.pc) >> 12) != pccache) + CPU_BLOCK_END(); + + if (cpu_state.abrt) + CPU_BLOCK_END(); + if (smi_line) + CPU_BLOCK_END(); + else if (trap) + CPU_BLOCK_END(); + else if (nmi && nmi_enable && nmi_mask) + CPU_BLOCK_END(); + else if ((cpu_state.flags & I_FLAG) && pic.int_pending) + CPU_BLOCK_END(); + + if (cpu_end_block_after_ins) { + cpu_end_block_after_ins--; + if (!cpu_end_block_after_ins) + CPU_BLOCK_END(); + } + } + + if (trap) { + trap = 0; +#ifndef USE_NEW_DYNAREC + oldcs = CS; +#endif + cpu_state.oldpc = cpu_state.pc; + x86_int(1); + } + + cpu_end_block_after_ins = 0; +} + + +static __inline void +exec386_dynarec_dyn(void) +{ + uint32_t start_pc = 0, phys_addr = get_phys(cs + cpu_state.pc); + int hash = HASH(phys_addr); +#ifdef USE_NEW_DYNAREC + codeblock_t *block = &codeblock[codeblock_hash[hash]]; +#else + codeblock_t *block = codeblock_hash[hash]; +#endif + int valid_block = 0; +#ifdef USE_NEW_DYNAREC + if (!cpu_state.abrt) +#else + + if (block && !cpu_state.abrt) +#endif + { + page_t *page = &pages[phys_addr >> 12]; + + /* Block must match current CS, PC, code segment size, + and physical address. The physical address check will + also catch any page faults at this stage */ + valid_block = (block->pc == cs + cpu_state.pc) && (block->_cs == cs) && + (block->phys == phys_addr) && !((block->status ^ cpu_cur_status) & CPU_STATUS_FLAGS) && + ((block->status & cpu_cur_status & CPU_STATUS_MASK) == (cpu_cur_status & CPU_STATUS_MASK)); + if (!valid_block) { + uint64_t mask = (uint64_t)1 << ((phys_addr >> PAGE_MASK_SHIFT) & PAGE_MASK_MASK); +#ifdef USE_NEW_DYNAREC + int byte_offset = (phys_addr >> PAGE_BYTE_MASK_SHIFT) & PAGE_BYTE_MASK_OFFSET_MASK; + uint64_t byte_mask = 1ull << (PAGE_BYTE_MASK_MASK & 0x3f); + + if ((page->code_present_mask & mask) || (page->byte_code_present_mask[byte_offset] & byte_mask)) +#else + if (page->code_present_mask[(phys_addr >> PAGE_MASK_INDEX_SHIFT) & PAGE_MASK_INDEX_MASK] & mask) +#endif + { + /* Walk page tree to see if we find the correct block */ + codeblock_t *new_block = codeblock_tree_find(phys_addr, cs); + if (new_block) { + valid_block = (new_block->pc == cs + cpu_state.pc) && (new_block->_cs == cs) && + (new_block->phys == phys_addr) && !((new_block->status ^ cpu_cur_status) & CPU_STATUS_FLAGS) && + ((new_block->status & cpu_cur_status & CPU_STATUS_MASK) == (cpu_cur_status & CPU_STATUS_MASK)); + if (valid_block) { + block = new_block; +#ifdef USE_NEW_DYNAREC + codeblock_hash[hash] = get_block_nr(block); +#endif + } + } + } + } + + if (valid_block && (block->page_mask & *block->dirty_mask)) { +#ifdef USE_NEW_DYNAREC + codegen_check_flush(page, page->dirty_mask, phys_addr); + if (block->pc == BLOCK_PC_INVALID) + valid_block = 0; + else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) + block->flags &= ~CODEBLOCK_WAS_RECOMPILED; +#else + codegen_check_flush(page, page->dirty_mask[(phys_addr >> 10) & 3], phys_addr); + page->dirty_mask[(phys_addr >> 10) & 3] = 0; + if (!block->valid) + valid_block = 0; +#endif + } + if (valid_block && block->page_mask2) { + /* We don't want the second page to cause a page + fault at this stage - that would break any + code crossing a page boundary where the first + page is present but the second isn't. Instead + allow the first page to be interpreted and for + the page fault to occur when the page boundary + is actually crossed.*/ +#ifdef USE_NEW_DYNAREC + uint32_t phys_addr_2 = get_phys_noabrt(block->pc + ((block->flags & CODEBLOCK_BYTE_MASK) ? 0x40 : 0x400)); +#else + uint32_t phys_addr_2 = get_phys_noabrt(block->endpc); +#endif + page_t *page_2 = &pages[phys_addr_2 >> 12]; + + if ((block->phys_2 ^ phys_addr_2) & ~0xfff) + valid_block = 0; + else if (block->page_mask2 & *block->dirty_mask2) { +#ifdef USE_NEW_DYNAREC + codegen_check_flush(page_2, page_2->dirty_mask, phys_addr_2); + if (block->pc == BLOCK_PC_INVALID) + valid_block = 0; + else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) + block->flags &= ~CODEBLOCK_WAS_RECOMPILED; +#else + codegen_check_flush(page_2, page_2->dirty_mask[(phys_addr_2 >> 10) & 3], phys_addr_2); + page_2->dirty_mask[(phys_addr_2 >> 10) & 3] = 0; + if (!block->valid) + valid_block = 0; +#endif + } + } +#ifdef USE_NEW_DYNAREC + if (valid_block && (block->flags & CODEBLOCK_IN_DIRTY_LIST)) { + block->flags &= ~CODEBLOCK_WAS_RECOMPILED; + if (block->flags & CODEBLOCK_BYTE_MASK) + block->flags |= CODEBLOCK_NO_IMMEDIATES; + else + block->flags |= CODEBLOCK_BYTE_MASK; + } + if (valid_block && (block->flags & CODEBLOCK_WAS_RECOMPILED) && (block->flags & CODEBLOCK_STATIC_TOP) && block->TOP != (cpu_state.TOP & 7)) +#else + if (valid_block && block->was_recompiled && (block->flags & CODEBLOCK_STATIC_TOP) && block->TOP != cpu_state.TOP) +#endif + { + /* FPU top-of-stack does not match the value this block was compiled + with, re-compile using dynamic top-of-stack*/ +#ifdef USE_NEW_DYNAREC + block->flags &= ~(CODEBLOCK_STATIC_TOP | CODEBLOCK_WAS_RECOMPILED); +#else + block->flags &= ~CODEBLOCK_STATIC_TOP; + block->was_recompiled = 0; +#endif + } + } + +#ifdef USE_NEW_DYNAREC + if (valid_block && (block->flags & CODEBLOCK_WAS_RECOMPILED)) +#else + if (valid_block && block->was_recompiled) +#endif + { + void (*code)() = (void *)&block->data[BLOCK_START]; + +#ifndef USE_NEW_DYNAREC + codeblock_hash[hash] = block; +#endif + inrecomp = 1; + code(); #ifdef USE_ACYCS acycs = 0; #endif - cycles_main += cycs; - while (cycles_main > 0) - { - int cycles_start; + inrecomp = 0; - cycles += cyc_period; - cycles_start = cycles; +#ifndef USE_NEW_DYNAREC + if (!use32) cpu_state.pc &= 0xffff; +#endif + } else if (valid_block && !cpu_state.abrt) { +#ifdef USE_NEW_DYNAREC + start_pc = cs + cpu_state.pc; + const int max_block_size = (block->flags & CODEBLOCK_BYTE_MASK) ? ((128 - 25) - (start_pc & 0x3f)) : 1000; +#else + start_pc = cpu_state.pc; +#endif - while (cycles>0) + cpu_block_end = 0; + x86_was_reset = 0; + + codegen_block_start_recompile(block); + codegen_in_recompile = 1; + + while (!cpu_block_end) { +#ifndef USE_NEW_DYNAREC + oldcs = CS; + oldcpl = CPL; +#endif + cpu_state.oldpc = cpu_state.pc; + cpu_state.op32 = use32; + + cpu_state.ea_seg = &cpu_state.seg_ds; + cpu_state.ssegs = 0; + + fetchdat = fastreadl(cs + cpu_state.pc); +#ifdef ENABLE_386_DYNAREC_LOG + if (in_smm) + x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat); +#endif + + if (!cpu_state.abrt) { + opcode = fetchdat & 0xFF; + fetchdat >>= 8; + + cpu_state.pc++; + + codegen_generate_call(opcode, x86_opcodes[(opcode | cpu_state.op32) & 0x3ff], fetchdat, cpu_state.pc, cpu_state.pc-1); + + x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); + + if (x86_was_reset) + break; + } + +#ifndef USE_NEW_DYNAREC + if (!use32) + cpu_state.pc &= 0xffff; +#endif + + /* Cap source code at 4000 bytes per block; this + will prevent any block from spanning more than + 2 pages. In practice this limit will never be + hit, as host block size is only 2kB*/ +#ifdef USE_NEW_DYNAREC + if (((cs + cpu_state.pc) - start_pc) >= max_block_size) +#else + if ((cpu_state.pc - start_pc) > 1000) +#endif + CPU_BLOCK_END(); + + if (smi_line) + CPU_BLOCK_END(); + else if (cpu_state.flags & T_FLAG) + CPU_BLOCK_END(); + else if (nmi && nmi_enable && nmi_mask) + CPU_BLOCK_END(); + else if ((cpu_state.flags & I_FLAG) && pic.int_pending) + CPU_BLOCK_END(); + + if (cpu_end_block_after_ins) { + cpu_end_block_after_ins--; + if (!cpu_end_block_after_ins) + CPU_BLOCK_END(); + } + + if (cpu_state.abrt) { + if (!(cpu_state.abrt & ABRT_EXPECTED)) + codegen_block_remove(); + CPU_BLOCK_END(); + } + } + + cpu_end_block_after_ins = 0; + + if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !x86_was_reset) + codegen_block_end_recompile(block); + + if (x86_was_reset) + codegen_reset(); + + codegen_in_recompile = 0; + } else if (!cpu_state.abrt) { + /* Mark block but do not recompile */ +#ifdef USE_NEW_DYNAREC + start_pc = cs + cpu_state.pc; + const int max_block_size = (block->flags & CODEBLOCK_BYTE_MASK) ? ((128 - 25) - (start_pc & 0x3f)) : 1000; +#else + start_pc = cpu_state.pc; +#endif + + cpu_block_end = 0; + x86_was_reset = 0; + + codegen_block_init(phys_addr); + + while (!cpu_block_end) { +#ifndef USE_NEW_DYNAREC + oldcs = CS; + oldcpl = CPL; +#endif + cpu_state.oldpc = cpu_state.pc; + cpu_state.op32 = use32; + + cpu_state.ea_seg = &cpu_state.seg_ds; + cpu_state.ssegs = 0; + + codegen_endpc = (cs + cpu_state.pc) + 8; + + fetchdat = fastreadl(cs + cpu_state.pc); +#ifdef ENABLE_386_DYNAREC_LOG + if (in_smm) + x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat); +#endif + + if (!cpu_state.abrt) { + opcode = fetchdat & 0xFF; + fetchdat >>= 8; + + cpu_state.pc++; + + x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); + + if (x86_was_reset) + break; + } + +#ifndef USE_NEW_DYNAREC + if (!use32) + cpu_state.pc &= 0xffff; +#endif + + /* Cap source code at 4000 bytes per block; this + will prevent any block from spanning more than + 2 pages. In practice this limit will never be + hit, as host block size is only 2kB */ +#ifdef USE_NEW_DYNAREC + if (((cs + cpu_state.pc) - start_pc) >= max_block_size) +#else + if ((cpu_state.pc - start_pc) > 1000) +#endif + CPU_BLOCK_END(); + + if (smi_line) + CPU_BLOCK_END(); + else if (cpu_state.flags & T_FLAG) + CPU_BLOCK_END(); + else if (nmi && nmi_enable && nmi_mask) + CPU_BLOCK_END(); + else if ((cpu_state.flags & I_FLAG) && pic.int_pending) + CPU_BLOCK_END(); + + if (cpu_end_block_after_ins) { + cpu_end_block_after_ins--; + if (!cpu_end_block_after_ins) + CPU_BLOCK_END(); + } + + if (cpu_state.abrt) { + if (!(cpu_state.abrt & ABRT_EXPECTED)) + codegen_block_remove(); + CPU_BLOCK_END(); + } + } + + cpu_end_block_after_ins = 0; + + if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !x86_was_reset) + codegen_block_end(); + + if (x86_was_reset) + codegen_reset(); + } +#ifdef USE_NEW_DYNAREC + else + cpu_state.oldpc = cpu_state.pc; +#endif +} + + +void +exec386_dynarec(int cycs) +{ + int vector, tempi; + int cycdiff; + int oldcyc, oldcyc2; + uint64_t oldtsc, delta; + + int cyc_period = cycs / 2000; /*5us*/ + +#ifdef USE_ACYCS + acycs = 0; +#endif + cycles_main += cycs; + while (cycles_main > 0) { + int cycles_start; + + cycles += cyc_period; + cycles_start = cycles; + + while (cycles > 0) { +#ifndef USE_NEW_DYNAREC + oldcs = CS; + cpu_state.oldpc = cpu_state.pc; + oldcpl = CPL; + cpu_state.op32 = use32; + + cycdiff = 0; +#endif + oldcyc = oldcyc2 = cycles; + cycles_old = cycles; + oldtsc = tsc; + tsc_old = tsc; + if (!CACHE_ON()) /*Interpret block*/ { + exec386_dynarec_int(); + } + else + { + exec386_dynarec_dyn(); + } + + cycdiff = oldcyc - cycles; + delta = tsc - oldtsc; + if (delta > 0) { + /* TSC has changed, this means interim timer processing has happened, + see how much we still need to add. */ + cycdiff -= delta; + if (cycdiff > 0) + tsc += cycdiff; + } else { + /* TSC has not changed. */ + tsc += cycdiff; + } + + if (cpu_state.abrt) { + flags_rebuild(); + tempi = cpu_state.abrt & ABRT_MASK; + cpu_state.abrt = 0; + x86_doabrt(tempi); + if (cpu_state.abrt) { + cpu_state.abrt = 0; + cpu_state.pc = cpu_state.oldpc; +#ifndef USE_NEW_DYNAREC + CS = oldcs; +#endif + pmodeint(8, 0); + if (cpu_state.abrt) { + cpu_state.abrt = 0; + softresetx86(); + cpu_set_edx(); +#ifdef ENABLE_386_DYNAREC_LOG + x386_dynarec_log("Triple fault - reset\n"); +#endif + } + } + } + + if (smi_line) + enter_smm_check(0); + else if (nmi && nmi_enable && nmi_mask) { + if (AT && (cpu_fast_off_flags & 0x20000000)) + cpu_fast_off_count = cpu_fast_off_val + 1; + #ifndef USE_NEW_DYNAREC oldcs = CS; +#endif cpu_state.oldpc = cpu_state.pc; - oldcpl = CPL; - cpu_state.op32 = use32; - - cycdiff=0; -#endif - oldcyc = oldcyc2 = cycles; - cycles_old = cycles; - oldtsc = tsc; - tsc_old = tsc; - if (!CACHE_ON()) /*Interpret block*/ - { - cpu_block_end = 0; - x86_was_reset = 0; - while (!cpu_block_end) - { -#ifndef USE_NEW_DYNAREC - oldcs = CS; - oldcpl = CPL; -#endif - cpu_state.oldpc = cpu_state.pc; - cpu_state.op32 = use32; - - cpu_state.ea_seg = &cpu_state.seg_ds; - cpu_state.ssegs = 0; - - fetchdat = fastreadl(cs + cpu_state.pc); -#ifdef ENABLE_386_DYNAREC_LOG - if (in_smm) - x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat); -#endif - - if (!cpu_state.abrt) - { - opcode = fetchdat & 0xFF; - fetchdat >>= 8; - - trap = cpu_state.flags & T_FLAG; - - cpu_state.pc++; - x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); - } - -#ifndef USE_NEW_DYNAREC - if (!use32) cpu_state.pc &= 0xffff; -#endif - - if (((cs + cpu_state.pc) >> 12) != pccache) - CPU_BLOCK_END(); - - if (cpu_state.abrt) - CPU_BLOCK_END(); - if (trap) - CPU_BLOCK_END(); - else if (smi_line) - CPU_BLOCK_END(); - else if (nmi && nmi_enable && nmi_mask) - CPU_BLOCK_END(); - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) - CPU_BLOCK_END(); - } + x86_int(2); + nmi_enable = 0; + if (nmi_auto_clear) { + nmi_auto_clear = 0; + nmi = 0; } - else - { - uint32_t phys_addr = get_phys(cs+cpu_state.pc); - int hash = HASH(phys_addr); -#ifdef USE_NEW_DYNAREC - codeblock_t *block = &codeblock[codeblock_hash[hash]]; -#else - codeblock_t *block = codeblock_hash[hash]; -#endif - int valid_block = 0; -#ifdef USE_NEW_DYNAREC - - if (!cpu_state.abrt) -#else - trap = 0; - - if (block && !cpu_state.abrt) -#endif - { - page_t *page = &pages[phys_addr >> 12]; - - /*Block must match current CS, PC, code segment size, - and physical address. The physical address check will - also catch any page faults at this stage*/ - valid_block = (block->pc == cs + cpu_state.pc) && (block->_cs == cs) && - (block->phys == phys_addr) && !((block->status ^ cpu_cur_status) & CPU_STATUS_FLAGS) && - ((block->status & cpu_cur_status & CPU_STATUS_MASK) == (cpu_cur_status & CPU_STATUS_MASK)); - if (!valid_block) - { - uint64_t mask = (uint64_t)1 << ((phys_addr >> PAGE_MASK_SHIFT) & PAGE_MASK_MASK); -#ifdef USE_NEW_DYNAREC - int byte_offset = (phys_addr >> PAGE_BYTE_MASK_SHIFT) & PAGE_BYTE_MASK_OFFSET_MASK; - uint64_t byte_mask = 1ull << (PAGE_BYTE_MASK_MASK & 0x3f); - - if ((page->code_present_mask & mask) || (page->byte_code_present_mask[byte_offset] & byte_mask)) -#else - if (page->code_present_mask[(phys_addr >> PAGE_MASK_INDEX_SHIFT) & PAGE_MASK_INDEX_MASK] & mask) -#endif - { - /*Walk page tree to see if we find the correct block*/ - codeblock_t *new_block = codeblock_tree_find(phys_addr, cs); - if (new_block) - { - valid_block = (new_block->pc == cs + cpu_state.pc) && (new_block->_cs == cs) && - (new_block->phys == phys_addr) && !((new_block->status ^ cpu_cur_status) & CPU_STATUS_FLAGS) && - ((new_block->status & cpu_cur_status & CPU_STATUS_MASK) == (cpu_cur_status & CPU_STATUS_MASK)); - if (valid_block) - { - block = new_block; -#ifdef USE_NEW_DYNAREC - codeblock_hash[hash] = get_block_nr(block); -#endif - } - } - } - } - - if (valid_block && (block->page_mask & *block->dirty_mask)) - { -#ifdef USE_NEW_DYNAREC - codegen_check_flush(page, page->dirty_mask, phys_addr); - if (block->pc == BLOCK_PC_INVALID) - valid_block = 0; - else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) - block->flags &= ~CODEBLOCK_WAS_RECOMPILED; -#else - codegen_check_flush(page, page->dirty_mask[(phys_addr >> 10) & 3], phys_addr); - page->dirty_mask[(phys_addr >> 10) & 3] = 0; - if (!block->valid) - valid_block = 0; -#endif - } - if (valid_block && block->page_mask2) - { - /*We don't want the second page to cause a page - fault at this stage - that would break any - code crossing a page boundary where the first - page is present but the second isn't. Instead - allow the first page to be interpreted and for - the page fault to occur when the page boundary - is actually crossed.*/ -#ifdef USE_NEW_DYNAREC - uint32_t phys_addr_2 = get_phys_noabrt(block->pc + ((block->flags & CODEBLOCK_BYTE_MASK) ? 0x40 : 0x400)); -#else - uint32_t phys_addr_2 = get_phys_noabrt(block->endpc); -#endif - page_t *page_2 = &pages[phys_addr_2 >> 12]; - - if ((block->phys_2 ^ phys_addr_2) & ~0xfff) - valid_block = 0; - else if (block->page_mask2 & *block->dirty_mask2) - { -#ifdef USE_NEW_DYNAREC - codegen_check_flush(page_2, page_2->dirty_mask, phys_addr_2); - if (block->pc == BLOCK_PC_INVALID) - valid_block = 0; - else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) - block->flags &= ~CODEBLOCK_WAS_RECOMPILED; -#else - codegen_check_flush(page_2, page_2->dirty_mask[(phys_addr_2 >> 10) & 3], phys_addr_2); - page_2->dirty_mask[(phys_addr_2 >> 10) & 3] = 0; - if (!block->valid) - valid_block = 0; -#endif - } - } -#ifdef USE_NEW_DYNAREC - if (valid_block && (block->flags & CODEBLOCK_IN_DIRTY_LIST)) - { - block->flags &= ~CODEBLOCK_WAS_RECOMPILED; - if (block->flags & CODEBLOCK_BYTE_MASK) - block->flags |= CODEBLOCK_NO_IMMEDIATES; - else - block->flags |= CODEBLOCK_BYTE_MASK; - } - if (valid_block && (block->flags & CODEBLOCK_WAS_RECOMPILED) && (block->flags & CODEBLOCK_STATIC_TOP) && block->TOP != (cpu_state.TOP & 7)) -#else - if (valid_block && block->was_recompiled && (block->flags & CODEBLOCK_STATIC_TOP) && block->TOP != cpu_state.TOP) -#endif - { - /*FPU top-of-stack does not match the value this block was compiled - with, re-compile using dynamic top-of-stack*/ -#ifdef USE_NEW_DYNAREC - block->flags &= ~(CODEBLOCK_STATIC_TOP | CODEBLOCK_WAS_RECOMPILED); -#else - block->flags &= ~CODEBLOCK_STATIC_TOP; - block->was_recompiled = 0; -#endif - } - } - -#ifdef USE_NEW_DYNAREC - if (valid_block && (block->flags & CODEBLOCK_WAS_RECOMPILED)) -#else - if (valid_block && block->was_recompiled) -#endif - { - void (*code)() = (void *)&block->data[BLOCK_START]; - -#ifndef USE_NEW_DYNAREC - codeblock_hash[hash] = block; -#endif - - inrecomp=1; - code(); -#ifdef USE_ACYCS - acycs = 0; -#endif - inrecomp=0; - -#ifndef USE_NEW_DYNAREC - if (!use32) cpu_state.pc &= 0xffff; -#endif - } - else if (valid_block && !cpu_state.abrt) - { -#ifdef USE_NEW_DYNAREC - start_pc = cs+cpu_state.pc; - const int max_block_size = (block->flags & CODEBLOCK_BYTE_MASK) ? ((128 - 25) - (start_pc & 0x3f)) : 1000; -#else - start_pc = cpu_state.pc; -#endif - - cpu_block_end = 0; - x86_was_reset = 0; - - codegen_block_start_recompile(block); - codegen_in_recompile = 1; - - while (!cpu_block_end) - { -#ifndef USE_NEW_DYNAREC - oldcs = CS; - oldcpl = CPL; -#endif - cpu_state.oldpc = cpu_state.pc; - cpu_state.op32 = use32; - - cpu_state.ea_seg = &cpu_state.seg_ds; - cpu_state.ssegs = 0; - - fetchdat = fastreadl(cs + cpu_state.pc); -#ifdef ENABLE_386_DYNAREC_LOG - if (in_smm) - x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat); -#endif - - if (!cpu_state.abrt) - { - opcode = fetchdat & 0xFF; - fetchdat >>= 8; - - trap = cpu_state.flags & T_FLAG; - - cpu_state.pc++; - - codegen_generate_call(opcode, x86_opcodes[(opcode | cpu_state.op32) & 0x3ff], fetchdat, cpu_state.pc, cpu_state.pc-1); - - x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); - - if (x86_was_reset) - break; - } - -#ifndef USE_NEW_DYNAREC - if (!use32) cpu_state.pc &= 0xffff; -#endif - - /*Cap source code at 4000 bytes per block; this - will prevent any block from spanning more than - 2 pages. In practice this limit will never be - hit, as host block size is only 2kB*/ -#ifdef USE_NEW_DYNAREC - if (((cs+cpu_state.pc) - start_pc) >= max_block_size) -#else - if ((cpu_state.pc - start_pc) > 1000) -#endif - CPU_BLOCK_END(); - - if (cpu_state.abrt) - { - codegen_block_remove(); - CPU_BLOCK_END(); - } - - if (trap) - CPU_BLOCK_END(); - else if (smi_line) - CPU_BLOCK_END(); - else if (nmi && nmi_enable && nmi_mask) - CPU_BLOCK_END(); - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) - CPU_BLOCK_END(); - } - - if (!cpu_state.abrt && !x86_was_reset) - codegen_block_end_recompile(block); - - if (x86_was_reset) - codegen_reset(); - - codegen_in_recompile = 0; - } - else if (!cpu_state.abrt) - { - /*Mark block but do not recompile*/ -#ifdef USE_NEW_DYNAREC - start_pc = cs+cpu_state.pc; - const int max_block_size = (block->flags & CODEBLOCK_BYTE_MASK) ? ((128 - 25) - (start_pc & 0x3f)) : 1000; -#else - start_pc = cpu_state.pc; -#endif - - cpu_block_end = 0; - x86_was_reset = 0; - - codegen_block_init(phys_addr); - - while (!cpu_block_end) - { -#ifndef USE_NEW_DYNAREC - oldcs=CS; - oldcpl = CPL; -#endif - cpu_state.oldpc = cpu_state.pc; - cpu_state.op32 = use32; - - cpu_state.ea_seg = &cpu_state.seg_ds; - cpu_state.ssegs = 0; - - codegen_endpc = (cs + cpu_state.pc) + 8; - - fetchdat = fastreadl(cs + cpu_state.pc); -#ifdef ENABLE_386_DYNAREC_LOG - if (in_smm) - x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat); -#endif - - if (!cpu_state.abrt) - { - opcode = fetchdat & 0xFF; - fetchdat >>= 8; - - trap = cpu_state.flags & T_FLAG; - - cpu_state.pc++; - - x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); - - if (x86_was_reset) - break; - } - -#ifndef USE_NEW_DYNAREC - if (!use32) cpu_state.pc &= 0xffff; -#endif - - /*Cap source code at 4000 bytes per block; this - will prevent any block from spanning more than - 2 pages. In practice this limit will never be - hit, as host block size is only 2kB*/ -#ifdef USE_NEW_DYNAREC - if (((cs+cpu_state.pc) - start_pc) >= max_block_size) -#else - if ((cpu_state.pc - start_pc) > 1000) -#endif - CPU_BLOCK_END(); - - if (cpu_state.abrt) - { - codegen_block_remove(); - CPU_BLOCK_END(); - } - - if (trap) - CPU_BLOCK_END(); - else if (smi_line) - CPU_BLOCK_END(); - else if (nmi && nmi_enable && nmi_mask) - CPU_BLOCK_END(); - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) - CPU_BLOCK_END(); - } - - if (!cpu_state.abrt && !x86_was_reset) - codegen_block_end(); - - if (x86_was_reset) - codegen_reset(); - } -#ifdef USE_NEW_DYNAREC - else - cpu_state.oldpc = cpu_state.pc; -#endif - } - - cycdiff = oldcyc - cycles; - delta = tsc - oldtsc; - if (delta > 0) { - /* TSC has changed, this means interim timer processing has happened, - see how much we still need to add. */ - cycdiff -= delta; - if (cycdiff > 0) - tsc += cycdiff; - } else { - /* TSC has not changed. */ - tsc += cycdiff; - } - - if (cpu_state.abrt) - { - flags_rebuild(); - tempi = cpu_state.abrt; - cpu_state.abrt = 0; - x86_doabrt(tempi); - if (cpu_state.abrt) - { - cpu_state.abrt = 0; - cpu_state.pc = cpu_state.oldpc; -#ifndef USE_NEW_DYNAREC - CS = oldcs; -#endif - pmodeint(8, 0); - if (cpu_state.abrt) - { - cpu_state.abrt = 0; - softresetx86(); - cpu_set_edx(); -#ifdef ENABLE_386_DYNAREC_LOG - x386_dynarec_log("Triple fault - reset\n"); -#endif - } - } - } - - if (smi_line) - enter_smm_check(0); - else if (trap) - { -#ifdef USE_NEW_DYNAREC - trap = 0; -#endif - flags_rebuild(); - if (msw&1) - { - pmodeint(1,0); - } - else - { - writememw(ss,(SP-2)&0xFFFF,cpu_state.flags); - writememw(ss,(SP-4)&0xFFFF,CS); - writememw(ss,(SP-6)&0xFFFF,cpu_state.pc); - SP-=6; - addr = (1 << 2) + idt.base; - cpu_state.flags &= ~I_FLAG; - cpu_state.flags &= ~T_FLAG; - cpu_state.pc=readmemw(0,addr); - loadcs(readmemw(0,addr+2)); - } - } - else if (nmi && nmi_enable && nmi_mask) - { - if (AT && (cpu_fast_off_flags & 0x20000000)) - cpu_fast_off_count = cpu_fast_off_val + 1; - - CPU_BLOCK_END(); + } else if ((cpu_state.flags & I_FLAG) && pic.int_pending) { + vector = picinterrupt(); + if (vector != -1) { #ifndef USE_NEW_DYNAREC oldcs = CS; #endif cpu_state.oldpc = cpu_state.pc; - x86_int(2); - nmi_enable = 0; - if (nmi_auto_clear) - { - nmi_auto_clear = 0; - nmi = 0; - } - } - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) - { - vector = picinterrupt(); - if (vector != -1) - { - flags_rebuild(); - if (msw&1) - { - pmodeint(vector,0); - } - else - { - writememw(ss,(SP-2)&0xFFFF,cpu_state.flags); - writememw(ss,(SP-4)&0xFFFF,CS); - writememw(ss,(SP-6)&0xFFFF,cpu_state.pc); - SP-=6; - addr=vector<<2; - cpu_state.flags &= ~I_FLAG; - cpu_state.flags &= ~T_FLAG; -#ifndef USE_NEW_DYNAREC - oxpc=cpu_state.pc; -#endif - cpu_state.pc=readmemw(0,addr); - loadcs(readmemw(0,addr+2)); - } - } - } - - if (cycdiff > 0) { - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) - timer_process_inline(); + x86_int(vector); } } - cycles_main -= (cycles_start - cycles); + if (cycdiff > 0) { + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) + timer_process_inline(); + } } + + cycles_main -= (cycles_start - cycles); + } } #endif diff --git a/src/cpu/386_ops.h b/src/cpu/386_ops.h index 9ee76bbe9..1dccc2a29 100644 --- a/src/cpu/386_ops.h +++ b/src/cpu/386_ops.h @@ -170,6 +170,7 @@ extern void x386_dynarec_log(const char *fmt, ...); #include "x86_ops_bcd.h" #include "x86_ops_bit.h" #include "x86_ops_bitscan.h" +#include "x86_ops_cyrix.h" #include "x86_ops_flag.h" #include "x86_ops_fpu.h" #include "x86_ops_inc_dec.h" @@ -996,6 +997,99 @@ const OpFn OP_TABLE(pentium_0f)[1024] = /*f0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, }; +#if defined(DEV_BRANCH) && defined(USE_CYRIX_6X86) +const OpFn OP_TABLE(c6x86_0f)[1024] = +{ + /*16-bit data, 16-bit addr*/ +/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ +/*00*/ op0F00_a16, op0F01_w_a16, opLAR_w_a16, opLSL_w_a16, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*20*/ opMOV_r_CRx_a16,opMOV_r_DRx_a16,opMOV_CRx_r_a16,opMOV_DRx_r_a16,opMOV_r_TRx_a16,ILLEGAL, opMOV_TRx_r_a16,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + +/*40*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*60*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*70*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opSVDC_a16, opRSDC_a16, opSVLDT_a16, opRSLDT_a16, opSVTS_a16, opRSTS_a16, opSMINT, ILLEGAL, + +/*80*/ opJO_w, opJNO_w, opJB_w, opJNB_w, opJE_w, opJNE_w, opJBE_w, opJNBE_w, opJS_w, opJNS_w, opJP_w, opJNP_w, opJL_w, opJNL_w, opJLE_w, opJNLE_w, +/*90*/ opSETO_a16, opSETNO_a16, opSETB_a16, opSETNB_a16, opSETE_a16, opSETNE_a16, opSETBE_a16, opSETNBE_a16, opSETS_a16, opSETNS_a16, opSETP_a16, opSETNP_a16, opSETL_a16, opSETNL_a16, opSETLE_a16, opSETNLE_a16, +/*a0*/ opPUSH_FS_w, opPOP_FS_w, opCPUID, opBT_w_r_a16, opSHLD_w_i_a16, opSHLD_w_CL_a16,ILLEGAL, ILLEGAL, opPUSH_GS_w, opPOP_GS_w, opRSM, opBTS_w_r_a16, opSHRD_w_i_a16, opSHRD_w_CL_a16,ILLEGAL, opIMUL_w_w_a16, +/*b0*/ opCMPXCHG_b_a16,opCMPXCHG_w_a16,opLSS_w_a16, opBTR_w_r_a16, opLFS_w_a16, opLGS_w_a16, opMOVZX_w_b_a16,opMOVZX_w_w_a16,ILLEGAL, ILLEGAL, opBA_w_a16, opBTC_w_r_a16, opBSF_w_a16, opBSR_w_a16, opMOVSX_w_b_a16,ILLEGAL, + +/*c0*/ opXADD_b_a16, opXADD_w_a16, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opCMPXCHG8B_a16,opBSWAP_EAX, opBSWAP_ECX, opBSWAP_EDX, opBSWAP_EBX, opBSWAP_ESP, opBSWAP_EBP, opBSWAP_ESI, opBSWAP_EDI, +/*d0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*e0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*f0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + + /*32-bit data, 16-bit addr*/ +/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ +/*00*/ op0F00_a16, op0F01_l_a16, opLAR_l_a16, opLSL_l_a16, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*20*/ opMOV_r_CRx_a16,opMOV_r_DRx_a16,opMOV_CRx_r_a16,opMOV_DRx_r_a16,opMOV_r_TRx_a16,ILLEGAL, opMOV_TRx_r_a16,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + +/*40*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*60*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*70*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opSVDC_a16, opRSDC_a16, opSVLDT_a16, opRSLDT_a16, opSVTS_a16, opRSTS_a16, opSMINT, ILLEGAL, + +/*80*/ opJO_l, opJNO_l, opJB_l, opJNB_l, opJE_l, opJNE_l, opJBE_l, opJNBE_l, opJS_l, opJNS_l, opJP_l, opJNP_l, opJL_l, opJNL_l, opJLE_l, opJNLE_l, +/*90*/ opSETO_a16, opSETNO_a16, opSETB_a16, opSETNB_a16, opSETE_a16, opSETNE_a16, opSETBE_a16, opSETNBE_a16, opSETS_a16, opSETNS_a16, opSETP_a16, opSETNP_a16, opSETL_a16, opSETNL_a16, opSETLE_a16, opSETNLE_a16, +/*a0*/ opPUSH_FS_l, opPOP_FS_l, opCPUID, opBT_l_r_a16, opSHLD_l_i_a16, opSHLD_l_CL_a16,ILLEGAL, ILLEGAL, opPUSH_GS_l, opPOP_GS_l, opRSM, opBTS_l_r_a16, opSHRD_l_i_a16, opSHRD_l_CL_a16,ILLEGAL, opIMUL_l_l_a16, +/*b0*/ opCMPXCHG_b_a16,opCMPXCHG_l_a16,opLSS_l_a16, opBTR_l_r_a16, opLFS_l_a16, opLGS_l_a16, opMOVZX_l_b_a16,opMOVZX_l_w_a16,ILLEGAL, ILLEGAL, opBA_l_a16, opBTC_l_r_a16, opBSF_l_a16, opBSR_l_a16, opMOVSX_l_b_a16,opMOVSX_l_w_a16, + +/*c0*/ opXADD_b_a16, opXADD_l_a16, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opCMPXCHG8B_a16,opBSWAP_EAX, opBSWAP_ECX, opBSWAP_EDX, opBSWAP_EBX, opBSWAP_ESP, opBSWAP_EBP, opBSWAP_ESI, opBSWAP_EDI, +/*d0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*e0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*f0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + + /*16-bit data, 32-bit addr*/ +/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ +/*00*/ op0F00_a32, op0F01_w_a32, opLAR_w_a32, opLSL_w_a32, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*20*/ opMOV_r_CRx_a32,opMOV_r_DRx_a32,opMOV_CRx_r_a32,opMOV_DRx_r_a32,opMOV_r_TRx_a32,ILLEGAL, opMOV_TRx_r_a32,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + +/*40*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*60*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*70*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opSVDC_a32, opRSDC_a32, opSVLDT_a32, opRSLDT_a32, opSVTS_a32, opRSTS_a32, opSMINT, ILLEGAL, + +/*80*/ opJO_w, opJNO_w, opJB_w, opJNB_w, opJE_w, opJNE_w, opJBE_w, opJNBE_w, opJS_w, opJNS_w, opJP_w, opJNP_w, opJL_w, opJNL_w, opJLE_w, opJNLE_w, +/*90*/ opSETO_a32, opSETNO_a32, opSETB_a32, opSETNB_a32, opSETE_a32, opSETNE_a32, opSETBE_a32, opSETNBE_a32, opSETS_a32, opSETNS_a32, opSETP_a32, opSETNP_a32, opSETL_a32, opSETNL_a32, opSETLE_a32, opSETNLE_a32, +/*a0*/ opPUSH_FS_w, opPOP_FS_w, opCPUID, opBT_w_r_a32, opSHLD_w_i_a32, opSHLD_w_CL_a32,ILLEGAL, ILLEGAL, opPUSH_GS_w, opPOP_GS_w, opRSM, opBTS_w_r_a32, opSHRD_w_i_a32, opSHRD_w_CL_a32,ILLEGAL, opIMUL_w_w_a32, +/*b0*/ opCMPXCHG_b_a32,opCMPXCHG_w_a32,opLSS_w_a32, opBTR_w_r_a32, opLFS_w_a32, opLGS_w_a32, opMOVZX_w_b_a32,opMOVZX_w_w_a32,ILLEGAL, ILLEGAL, opBA_w_a32, opBTC_w_r_a32, opBSF_w_a32, opBSR_w_a32, opMOVSX_w_b_a32,ILLEGAL, + +/*c0*/ opXADD_b_a32, opXADD_w_a32, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opCMPXCHG8B_a32,opBSWAP_EAX, opBSWAP_ECX, opBSWAP_EDX, opBSWAP_EBX, opBSWAP_ESP, opBSWAP_EBP, opBSWAP_ESI, opBSWAP_EDI, +/*d0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*e0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*f0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + + /*32-bit data, 32-bit addr*/ +/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ +/*00*/ op0F00_a32, op0F01_l_a32, opLAR_l_a32, opLSL_l_a32, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*20*/ opMOV_r_CRx_a32,opMOV_r_DRx_a32,opMOV_CRx_r_a32,opMOV_DRx_r_a32,opMOV_r_TRx_a32,ILLEGAL, opMOV_TRx_r_a32,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + +/*40*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*60*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*70*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opSVDC_a32, opRSDC_a32, opSVLDT_a32, opRSLDT_a32, opSVTS_a32, opRSTS_a32, opSMINT, ILLEGAL, + +/*80*/ opJO_l, opJNO_l, opJB_l, opJNB_l, opJE_l, opJNE_l, opJBE_l, opJNBE_l, opJS_l, opJNS_l, opJP_l, opJNP_l, opJL_l, opJNL_l, opJLE_l, opJNLE_l, +/*90*/ opSETO_a32, opSETNO_a32, opSETB_a32, opSETNB_a32, opSETE_a32, opSETNE_a32, opSETBE_a32, opSETNBE_a32, opSETS_a32, opSETNS_a32, opSETP_a32, opSETNP_a32, opSETL_a32, opSETNL_a32, opSETLE_a32, opSETNLE_a32, +/*a0*/ opPUSH_FS_l, opPOP_FS_l, opCPUID, opBT_l_r_a32, opSHLD_l_i_a32, opSHLD_l_CL_a32,ILLEGAL, ILLEGAL, opPUSH_GS_l, opPOP_GS_l, opRSM, opBTS_l_r_a32, opSHRD_l_i_a32, opSHRD_l_CL_a32,ILLEGAL, opIMUL_l_l_a32, +/*b0*/ opCMPXCHG_b_a32,opCMPXCHG_l_a32,opLSS_l_a32, opBTR_l_r_a32, opLFS_l_a32, opLGS_l_a32, opMOVZX_l_b_a32,opMOVZX_l_w_a32,ILLEGAL, ILLEGAL, opBA_l_a32, opBTC_l_r_a32, opBSF_l_a32, opBSR_l_a32, opMOVSX_l_b_a32,opMOVSX_l_w_a32, + +/*c0*/ opXADD_b_a32, opXADD_l_a32, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opCMPXCHG8B_a32,opBSWAP_EAX, opBSWAP_ECX, opBSWAP_EDX, opBSWAP_EBX, opBSWAP_ESP, opBSWAP_EBP, opBSWAP_ESI, opBSWAP_EDI, +/*d0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*e0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*f0*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +}; +#endif + const OpFn OP_TABLE(pentiummmx_0f)[1024] = { /*16-bit data, 16-bit addr*/ @@ -1277,12 +1371,12 @@ const OpFn OP_TABLE(c6x86mx_0f)[1024] = /*00*/ op0F00_a16, op0F01_w_a16, opLAR_w_a16, opLSL_w_a16, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*20*/ opMOV_r_CRx_a16,opMOV_r_DRx_a16,opMOV_CRx_r_a16,opMOV_DRx_r_a16,opMOV_r_TRx_a16,ILLEGAL, opMOV_TRx_r_a16,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, -/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, opRDSHR_a16, opWRSHR_a16, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*40*/ opCMOVO_w_a16, opCMOVNO_w_a16, opCMOVB_w_a16, opCMOVNB_w_a16, opCMOVE_w_a16, opCMOVNE_w_a16, opCMOVBE_w_a16, opCMOVNBE_w_a16,opCMOVS_w_a16, opCMOVNS_w_a16, opCMOVP_w_a16, opCMOVNP_w_a16, opCMOVL_w_a16, opCMOVNL_w_a16, opCMOVLE_w_a16, opCMOVNLE_w_a16, /*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*60*/ opPUNPCKLBW_a16,opPUNPCKLWD_a16,opPUNPCKLDQ_a16,opPACKSSWB_a16, opPCMPGTB_a16, opPCMPGTW_a16, opPCMPGTD_a16, opPACKUSWB_a16, opPUNPCKHBW_a16,opPUNPCKHWD_a16,opPUNPCKHDQ_a16,opPACKSSDW_a16, ILLEGAL, ILLEGAL, opMOVD_l_mm_a16,opMOVQ_q_mm_a16, -/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a16, opPCMPEQW_a16, opPCMPEQD_a16, opEMMS, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opMOVD_mm_l_a16,opMOVQ_mm_q_a16, +/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a16, opPCMPEQW_a16, opPCMPEQD_a16, opEMMS, opSVDC_a16, opRSDC_a16, opSVLDT_a16, opRSLDT_a16, opSVTS_a16, opRSTS_a16, opMOVD_mm_l_a16_cx,opMOVQ_mm_q_a16, /*80*/ opJO_w, opJNO_w, opJB_w, opJNB_w, opJE_w, opJNE_w, opJBE_w, opJNBE_w, opJS_w, opJNS_w, opJP_w, opJNP_w, opJL_w, opJNL_w, opJLE_w, opJNLE_w, /*90*/ opSETO_a16, opSETNO_a16, opSETB_a16, opSETNB_a16, opSETE_a16, opSETNE_a16, opSETBE_a16, opSETNBE_a16, opSETS_a16, opSETNS_a16, opSETP_a16, opSETNP_a16, opSETL_a16, opSETNL_a16, opSETLE_a16, opSETNLE_a16, @@ -1299,12 +1393,12 @@ const OpFn OP_TABLE(c6x86mx_0f)[1024] = /*00*/ op0F00_a16, op0F01_l_a16, opLAR_l_a16, opLSL_l_a16, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*20*/ opMOV_r_CRx_a16,opMOV_r_DRx_a16,opMOV_CRx_r_a16,opMOV_DRx_r_a16,opMOV_r_TRx_a16,ILLEGAL, opMOV_TRx_r_a16,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, -/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, opRDSHR_a16, opWRSHR_a16, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*40*/ opCMOVO_l_a16, opCMOVNO_l_a16, opCMOVB_l_a16, opCMOVNB_l_a16, opCMOVE_l_a16, opCMOVNE_l_a16, opCMOVBE_l_a16, opCMOVNBE_l_a16,opCMOVS_l_a16, opCMOVNS_l_a16, opCMOVP_l_a16, opCMOVNP_l_a16, opCMOVL_l_a16, opCMOVNL_l_a16, opCMOVLE_l_a16, opCMOVNLE_l_a16, /*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*60*/ opPUNPCKLBW_a16,opPUNPCKLWD_a16,opPUNPCKLDQ_a16,opPACKSSWB_a16, opPCMPGTB_a16, opPCMPGTW_a16, opPCMPGTD_a16, opPACKUSWB_a16, opPUNPCKHBW_a16,opPUNPCKHWD_a16,opPUNPCKHDQ_a16,opPACKSSDW_a16, ILLEGAL, ILLEGAL, opMOVD_l_mm_a16,opMOVQ_q_mm_a16, -/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a16, opPCMPEQW_a16, opPCMPEQD_a16, opEMMS, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opMOVD_mm_l_a16,opMOVQ_mm_q_a16, +/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a16, opPCMPEQW_a16, opPCMPEQD_a16, opEMMS, opSVDC_a16, opRSDC_a16, opSVLDT_a16, opRSLDT_a16, opSVTS_a16, opRSTS_a16, opMOVD_mm_l_a16_cx,opMOVQ_mm_q_a16, /*80*/ opJO_l, opJNO_l, opJB_l, opJNB_l, opJE_l, opJNE_l, opJBE_l, opJNBE_l, opJS_l, opJNS_l, opJP_l, opJNP_l, opJL_l, opJNL_l, opJLE_l, opJNLE_l, /*90*/ opSETO_a16, opSETNO_a16, opSETB_a16, opSETNB_a16, opSETE_a16, opSETNE_a16, opSETBE_a16, opSETNBE_a16, opSETS_a16, opSETNS_a16, opSETP_a16, opSETNP_a16, opSETL_a16, opSETNL_a16, opSETLE_a16, opSETNLE_a16, @@ -1321,12 +1415,12 @@ const OpFn OP_TABLE(c6x86mx_0f)[1024] = /*00*/ op0F00_a32, op0F01_w_a32, opLAR_w_a32, opLSL_w_a32, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*20*/ opMOV_r_CRx_a32,opMOV_r_DRx_a32,opMOV_CRx_r_a32,opMOV_DRx_r_a32,opMOV_r_TRx_a32,ILLEGAL, opMOV_TRx_r_a32,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, -/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, opRDSHR_a32, opWRSHR_a32, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*40*/ opCMOVO_w_a32, opCMOVNO_w_a32, opCMOVB_w_a32, opCMOVNB_w_a32, opCMOVE_w_a32, opCMOVNE_w_a32, opCMOVBE_w_a32, opCMOVNBE_w_a32,opCMOVS_w_a32, opCMOVNS_w_a32, opCMOVP_w_a32, opCMOVNP_w_a32, opCMOVL_w_a32, opCMOVNL_w_a32, opCMOVLE_w_a32, opCMOVNLE_w_a32, /*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*60*/ opPUNPCKLBW_a32,opPUNPCKLWD_a32,opPUNPCKLDQ_a32,opPACKSSWB_a32, opPCMPGTB_a32, opPCMPGTW_a32, opPCMPGTD_a32, opPACKUSWB_a32, opPUNPCKHBW_a32,opPUNPCKHWD_a32,opPUNPCKHDQ_a32,opPACKSSDW_a32, ILLEGAL, ILLEGAL, opMOVD_l_mm_a32,opMOVQ_q_mm_a32, -/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a32, opPCMPEQW_a32, opPCMPEQD_a32, opEMMS, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opMOVD_mm_l_a32,opMOVQ_mm_q_a32, +/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a32, opPCMPEQW_a32, opPCMPEQD_a32, opEMMS, opSVDC_a32, opRSDC_a32, opSVLDT_a32, opRSLDT_a32, opSVTS_a32, opRSTS_a32, opMOVD_mm_l_a32_cx,opMOVQ_mm_q_a32, /*80*/ opJO_w, opJNO_w, opJB_w, opJNB_w, opJE_w, opJNE_w, opJBE_w, opJNBE_w, opJS_w, opJNS_w, opJP_w, opJNP_w, opJL_w, opJNL_w, opJLE_w, opJNLE_w, /*90*/ opSETO_a32, opSETNO_a32, opSETB_a32, opSETNB_a32, opSETE_a32, opSETNE_a32, opSETBE_a32, opSETNBE_a32, opSETS_a32, opSETNS_a32, opSETP_a32, opSETNP_a32, opSETL_a32, opSETNL_a32, opSETLE_a32, opSETNLE_a32, @@ -1343,12 +1437,12 @@ const OpFn OP_TABLE(c6x86mx_0f)[1024] = /*00*/ op0F00_a32, op0F01_l_a32, opLAR_l_a32, opLSL_l_a32, ILLEGAL, ILLEGAL, opCLTS, ILLEGAL, opINVD, opWBINVD, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*10*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*20*/ opMOV_r_CRx_a32,opMOV_r_DRx_a32,opMOV_CRx_r_a32,opMOV_DRx_r_a32,opMOV_r_TRx_a32,ILLEGAL, opMOV_TRx_r_a32,ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, -/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, +/*30*/ opWRMSR, opRDTSC, opRDMSR, opRDPMC, ILLEGAL, ILLEGAL, opRDSHR_a32, opWRSHR_a32, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*40*/ opCMOVO_l_a32, opCMOVNO_l_a32, opCMOVB_l_a32, opCMOVNB_l_a32, opCMOVE_l_a32, opCMOVNE_l_a32, opCMOVBE_l_a32, opCMOVNBE_l_a32,opCMOVS_l_a32, opCMOVNS_l_a32, opCMOVP_l_a32, opCMOVNP_l_a32, opCMOVL_l_a32, opCMOVNL_l_a32, opCMOVLE_l_a32, opCMOVNLE_l_a32, /*50*/ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*60*/ opPUNPCKLBW_a32,opPUNPCKLWD_a32,opPUNPCKLDQ_a32,opPACKSSWB_a32, opPCMPGTB_a32, opPCMPGTW_a32, opPCMPGTD_a32, opPACKUSWB_a32, opPUNPCKHBW_a32,opPUNPCKHWD_a32,opPUNPCKHDQ_a32,opPACKSSDW_a32, ILLEGAL, ILLEGAL, opMOVD_l_mm_a32,opMOVQ_q_mm_a32, -/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a32, opPCMPEQW_a32, opPCMPEQD_a32, opEMMS, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, opMOVD_mm_l_a32,opMOVQ_mm_q_a32, +/*70*/ ILLEGAL, opPSxxW_imm, opPSxxD_imm, opPSxxQ_imm, opPCMPEQB_a32, opPCMPEQW_a32, opPCMPEQD_a32, opEMMS, opSVDC_a16, opRSDC_a16, opSVLDT_a16, opRSLDT_a16, opSVTS_a16, opRSTS_a16, opMOVD_mm_l_a32_cx,opMOVQ_mm_q_a32, /*80*/ opJO_l, opJNO_l, opJB_l, opJNB_l, opJE_l, opJNE_l, opJBE_l, opJNBE_l, opJS_l, opJNS_l, opJP_l, opJNP_l, opJL_l, opJNL_l, opJLE_l, opJNLE_l, /*90*/ opSETO_a32, opSETNO_a32, opSETB_a32, opSETNB_a32, opSETE_a32, opSETNE_a32, opSETBE_a32, opSETNBE_a32, opSETS_a32, opSETNS_a32, opSETP_a32, opSETNP_a32, opSETL_a32, opSETNL_a32, opSETLE_a32, opSETNLE_a32, diff --git a/src/cpu/808x.c b/src/cpu/808x.c index ffdca9a63..7b961961b 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -964,6 +964,7 @@ reset_common(int hard) in_sys = 0; shadowbios = shadowbios_write = 0; + alt_access = cpu_end_block_after_ins = 0; } diff --git a/src/cpu/codegen_timing_common.c b/src/cpu/codegen_timing_common.c index 7d4a37453..b6945cd0c 100644 --- a/src/cpu/codegen_timing_common.c +++ b/src/cpu/codegen_timing_common.c @@ -10,41 +10,41 @@ uint64_t opcode_deps[256] = { -/* ADD ADD ADD ADD*/ -/*00*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* ADD ADD PUSH ES POP ES*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, IMPL_ESP, -/* OR OR OR OR*/ - SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* OR OR PUSH CS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, 0, +/* ADD ADD ADD ADD*/ +/*00*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* ADD ADD PUSH ES POP ES*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, IMPL_ESP, +/* OR OR OR OR*/ + SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* OR OR PUSH CS*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, 0, -/* ADC ADC ADC ADC*/ -/*10*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* ADC ADC PUSH SS POP SS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, IMPL_ESP, -/* SBB SBB SBB SBB*/ - SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* SBB SBB PUSH DS POP DS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, IMPL_ESP, +/* ADC ADC ADC ADC*/ +/*10*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* ADC ADC PUSH SS POP SS*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, IMPL_ESP, +/* SBB SBB SBB SBB*/ + SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* SBB SBB PUSH DS POP DS*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, IMPL_ESP, -/* AND AND AND AND*/ -/*20*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* AND AND DAA*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX | MODRM, 0, SRCDEP_EAX | DSTDEP_EAX, -/* SUB SUB SUB SUB*/ - SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* SUB SUB DAS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX | MODRM, 0, SRCDEP_EAX | DSTDEP_EAX, +/* AND AND AND AND*/ +/*20*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* AND AND DAA*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, +/* SUB SUB SUB SUB*/ + SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* SUB SUB DAS*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, -/* XOR XOR XOR XOR*/ -/*30*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, -/* XOR XOR AAA*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX | MODRM, 0, SRCDEP_EAX | DSTDEP_EAX, -/* CMP CMP CMP CMP*/ - SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, -/* CMP CMP AAS*/ - SRCDEP_EAX, SRCDEP_EAX, 0, SRCDEP_EAX | DSTDEP_EAX, +/* XOR XOR XOR XOR*/ +/*30*/ SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, SRCDEP_REG | DSTDEP_REG | MODRM, +/* XOR XOR AAA*/ + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, +/* CMP CMP CMP CMP*/ + SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, SRCDEP_REG | MODRM, +/* CMP CMP AAS*/ + SRCDEP_EAX | HAS_IMM8, SRCDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, /* INC EAX INC ECX INC EDX INC EBX*/ /*40*/ SRCDEP_EAX | DSTDEP_EAX, SRCDEP_ECX | DSTDEP_ECX, SRCDEP_EDX | DSTDEP_EDX, SRCDEP_EBX | DSTDEP_EBX, @@ -68,7 +68,7 @@ uint64_t opcode_deps[256] = /*60*/ IMPL_ESP, IMPL_ESP, 0, 0, 0, 0, 0, 0, /* PUSH imm IMUL PUSH imm IMUL*/ - IMPL_ESP, DSTDEP_REG | MODRM, IMPL_ESP, DSTDEP_REG | MODRM, + IMPL_ESP | HAS_IMM1632,DSTDEP_REG | MODRM, IMPL_ESP | HAS_IMM8, DSTDEP_REG | MODRM, /* INSB INSW OUTSB OUTSW*/ 0, 0, 0, 0, @@ -102,15 +102,15 @@ uint64_t opcode_deps[256] = 0, 0, 0, 0, /* MOV*/ -/*b0*/ DSTDEP_EAX, DSTDEP_ECX, DSTDEP_EDX, DSTDEP_EBX, - DSTDEP_EAX, DSTDEP_ECX, DSTDEP_EDX, DSTDEP_EBX, - DSTDEP_EAX, DSTDEP_ECX, DSTDEP_EDX, DSTDEP_EBX, - DSTDEP_ESP, DSTDEP_EBP, DSTDEP_ESI, DSTDEP_EDI, +/*b0*/ DSTDEP_EAX | HAS_IMM8, DSTDEP_ECX | HAS_IMM8, DSTDEP_EDX | HAS_IMM8, DSTDEP_EBX | HAS_IMM8, + DSTDEP_EAX | HAS_IMM8, DSTDEP_ECX | HAS_IMM8, DSTDEP_EDX | HAS_IMM8, DSTDEP_EBX | HAS_IMM8, + DSTDEP_EAX | HAS_IMM1632, DSTDEP_ECX | HAS_IMM1632, DSTDEP_EDX | HAS_IMM1632, DSTDEP_EBX | HAS_IMM1632, + DSTDEP_ESP | HAS_IMM1632, DSTDEP_EBP | HAS_IMM1632, DSTDEP_ESI | HAS_IMM1632, DSTDEP_EDI | HAS_IMM1632, /* RET imm RET*/ /*c0*/ 0, 0, SRCDEP_ESP | DSTDEP_ESP, IMPL_ESP, /* LES LDS MOV MOV*/ - DSTDEP_REG | MODRM, DSTDEP_REG | MODRM, MODRM, MODRM, + DSTDEP_REG | MODRM, DSTDEP_REG | MODRM, MODRM | HAS_IMM8, MODRM | HAS_IMM1632, /* ENTER LEAVE RETF RETF*/ IMPL_ESP, IMPL_ESP, IMPL_ESP, IMPL_ESP, /* INT3 INT INTO IRET*/ @@ -147,38 +147,38 @@ uint64_t opcode_deps_mod3[256] = /* ADD ADD ADD ADD*/ /*00*/ SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* ADD ADD PUSH ES POP ES*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, IMPL_ESP, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, IMPL_ESP, /* OR OR OR OR*/ SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* OR OR PUSH CS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, 0, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, 0, /* ADC ADC ADC ADC*/ /*10*/ SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* ADC ADC PUSH SS POP SS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, IMPL_ESP, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, IMPL_ESP, /* SBB SBB SBB SBB*/ SRCDEP_REG |SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* SBB SBB PUSH DS POP DS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX, IMPL_ESP, IMPL_ESP, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, IMPL_ESP, IMPL_ESP, /* AND AND AND AND*/ /*20*/ SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* AND AND DAA*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX | MODRM, 0, SRCDEP_EAX | DSTDEP_EAX, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, /* SUB SUB SUB SUB*/ SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* SUB SUB DAS*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX | MODRM, 0, SRCDEP_EAX | DSTDEP_EAX, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, /* XOR XOR XOR XOR*/ /*30*/ SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | DSTDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | DSTDEP_REG | SRCDEP_RM | MODRM, /* XOR XOR AAA*/ - SRCDEP_EAX | DSTDEP_EAX, SRCDEP_EAX | DSTDEP_EAX | MODRM, 0, SRCDEP_EAX | DSTDEP_EAX, + SRCDEP_EAX | DSTDEP_EAX | HAS_IMM8, SRCDEP_EAX | DSTDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, /* CMP CMP CMP CMP*/ SRCDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | MODRM, SRCDEP_REG | SRCDEP_RM | MODRM, /* CMP CMP AAS*/ - SRCDEP_EAX, SRCDEP_EAX, 0, SRCDEP_EAX | DSTDEP_EAX, + SRCDEP_EAX | HAS_IMM8, SRCDEP_EAX | HAS_IMM1632, 0, SRCDEP_EAX | DSTDEP_EAX, /* INC EAX INC ECX INC EDX INC EBX*/ /*40*/ SRCDEP_EAX | DSTDEP_EAX, SRCDEP_ECX | DSTDEP_ECX, SRCDEP_EDX | DSTDEP_EDX, SRCDEP_EBX | DSTDEP_EBX, @@ -202,7 +202,7 @@ uint64_t opcode_deps_mod3[256] = /*60*/ IMPL_ESP, IMPL_ESP, 0, 0, 0, 0, 0, 0, /* PUSH imm IMUL PUSH imm IMUL*/ - IMPL_ESP, DSTDEP_REG | SRCDEP_RM | MODRM, IMPL_ESP, DSTDEP_REG | SRCDEP_RM | MODRM, + IMPL_ESP | HAS_IMM1632,DSTDEP_REG | SRCDEP_RM | MODRM, IMPL_ESP | HAS_IMM8, DSTDEP_REG | SRCDEP_RM | MODRM, /* INSB INSW OUTSB OUTSW*/ 0, 0, 0, 0, @@ -236,19 +236,19 @@ uint64_t opcode_deps_mod3[256] = 0, 0, 0, 0, /* MOV*/ -/*b0*/ DSTDEP_EAX, DSTDEP_ECX, DSTDEP_EDX, DSTDEP_EBX, - DSTDEP_EAX, DSTDEP_ECX, DSTDEP_EDX, DSTDEP_EBX, - DSTDEP_EAX, DSTDEP_ECX, DSTDEP_EDX, DSTDEP_EBX, - DSTDEP_ESP, DSTDEP_EBP, DSTDEP_ESI, DSTDEP_EDI, +/*b0*/ DSTDEP_EAX | HAS_IMM8, DSTDEP_ECX | HAS_IMM8, DSTDEP_EDX | HAS_IMM8, DSTDEP_EBX | HAS_IMM8, + DSTDEP_EAX | HAS_IMM8, DSTDEP_ECX | HAS_IMM8, DSTDEP_EDX | HAS_IMM8, DSTDEP_EBX | HAS_IMM8, + DSTDEP_EAX | HAS_IMM1632, DSTDEP_ECX | HAS_IMM1632, DSTDEP_EDX | HAS_IMM1632, DSTDEP_EBX | HAS_IMM1632, + DSTDEP_ESP | HAS_IMM1632, DSTDEP_EBP | HAS_IMM1632, DSTDEP_ESI | HAS_IMM1632, DSTDEP_EDI | HAS_IMM1632, -/* RET imm RET*/ -/*c0*/ 0, 0, SRCDEP_ESP | DSTDEP_ESP, IMPL_ESP, -/* LES LDS MOV MOV*/ - DSTDEP_REG | MODRM, DSTDEP_REG | MODRM, DSTDEP_RM | MODRM, DSTDEP_RM | MODRM, -/* ENTER LEAVE RETF RETF*/ - IMPL_ESP, IMPL_ESP, IMPL_ESP, IMPL_ESP, -/* INT3 INT INTO IRET*/ - 0, 0, 0, 0, +/* RET imm RET*/ +/*c0*/ 0, 0, SRCDEP_ESP | DSTDEP_ESP, IMPL_ESP, +/* LES LDS MOV MOV*/ + DSTDEP_REG | MODRM, DSTDEP_REG | MODRM, DSTDEP_RM | MODRM | HAS_IMM8, DSTDEP_RM | MODRM | HAS_IMM1632, +/* ENTER LEAVE RETF RETF*/ + IMPL_ESP, IMPL_ESP, IMPL_ESP, IMPL_ESP, +/* INT3 INT INTO IRET*/ + 0, 0, 0, 0, /*d0*/ 0, 0, 0, 0, @@ -331,7 +331,7 @@ uint64_t opcode_deps_0f[256] = /*a0*/ MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, 0, 0, MODRM, MODRM, 0, MODRM, - MODRM, MODRM, 0, MODRM, + MODRM, MODRM, MODRM, MODRM, /*b0*/ MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, @@ -413,7 +413,7 @@ uint64_t opcode_deps_0f_mod3[256] = /*a0*/ MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, 0, 0, MODRM, MODRM, 0, MODRM, - MODRM, MODRM, 0, MODRM, + MODRM, MODRM, MODRM, MODRM, /*b0*/ MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, MODRM, diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index a18cef6b4..708387b38 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -61,6 +61,18 @@ #endif #include "x87_timings.h" + +#define CCR1_USE_SMI (1 << 1) +#define CCR1_SMAC (1 << 2) +#define CCR1_SM3 (1 << 7) + +#define CCR3_SMI_LOCK (1 << 0) +#define CCR3_NMI_EN (1 << 1) + + +cyrix_t cyrix; + + static void cpu_write(uint16_t addr, uint8_t val, void *priv); static uint8_t cpu_read(uint16_t addr, void *priv); @@ -169,7 +181,7 @@ int is286, hascache, isibm486, israpidcad, - is_am486, is_pentium, is_k5, is_k6, is_p6; + is_am486, is_pentium, is_k5, is_k6, is_p6, is_cx6x86; int hasfpu; @@ -251,6 +263,8 @@ int timing_misaligned; static uint8_t ccr0, ccr1, ccr2, ccr3, ccr4, ccr5, ccr6; +static int cyrix_addr; + #ifdef ENABLE_CPU_LOG int cpu_do_log = ENABLE_CPU_LOG; @@ -399,6 +413,13 @@ cpu_set(void) (cpu_s->cpu_type == CPU_PENTIUM2D); /* The Samuel 2 datasheet claims it's Celeron-compatible. */ is_p6 |= (cpu_s->cpu_type == CPU_CYRIX3S); +#if defined(DEV_BRANCH) && defined(USE_CYRIX_6X86) + is_cx6x86 = (cpu_s->cpu_type == CPU_PENTIUMPRO) || (cpu_s->cpu_type == CPU_PENTIUM2) || + (cpu_s->cpu_type == CPU_PENTIUM2D); +#else + is_cx6x86 = (cpu_s->cpu_type == CPU_Cx6x86) || (cpu_s->cpu_type == CPU_Cx6x86MX) || + (cpu_s->cpu_type == CPU_Cx6x86L) || (cpu_s->cpu_type == CPU_CxGX1); +#endif hasfpu = (fpu_type != FPU_NONE); hascache = (cpu_s->cpu_type >= CPU_486SLC) || (cpu_s->cpu_type == CPU_IBM386SLC || cpu_s->cpu_type == CPU_IBM486SLC || cpu_s->cpu_type == CPU_IBM486BL); #if defined(DEV_BRANCH) && defined(USE_CYRIX_6X86) @@ -444,10 +465,13 @@ cpu_set(void) else io_removehandler(0x0022, 0x0002, cpu_read, NULL, NULL, cpu_write, NULL, NULL, NULL); - if (hasfpu) + if (hasfpu) { io_sethandler(0x00f0, 0x000f, cpu_read, NULL, NULL, cpu_write, NULL, NULL, NULL); - else + io_sethandler(0xf007, 0x0001, cpu_read, NULL, NULL, cpu_write, NULL, NULL, NULL); + } else { io_removehandler(0x00f0, 0x000f, cpu_read, NULL, NULL, cpu_write, NULL, NULL, NULL); + io_removehandler(0xf007, 0x0001, cpu_read, NULL, NULL, cpu_write, NULL, NULL, NULL); + } #ifdef USE_DYNAREC x86_setopcodes(ops_386, ops_386_0f, dynarec_ops_386, dynarec_ops_386_0f); @@ -548,6 +572,7 @@ cpu_set(void) timing_misaligned = 0; cpu_cyrix_alignment = 0; + cpu_CR4_mask = 0; switch (cpu_s->cpu_type) { @@ -1191,9 +1216,9 @@ cpu_set(void) #if defined(DEV_BRANCH) && defined(USE_CYRIX_6X86) case CPU_Cx6x86: #ifdef USE_DYNAREC - x86_setopcodes(ops_386, ops_pentium_0f, dynarec_ops_386, dynarec_ops_pentium_0f); + x86_setopcodes(ops_386, ops_c6x86_0f, dynarec_ops_386, dynarec_ops_c6x86_0f); #else - x86_setopcodes(ops_386, ops_pentium_0f); + x86_setopcodes(ops_386, ops_c6x86_0f); #endif timing_rr = 1; /*register dest - register src*/ timing_rm = 1; /*register dest - memory src*/ @@ -2366,10 +2391,7 @@ cpu_CPUID(void) { EAX = CPUID; EBX = ECX = 0; - EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR/* | CPUID_SEP*/ | CPUID_CMOV; -#ifdef USE_SEP - EDX |= CPUID_SEP; -#endif + EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_SEP | CPUID_CMOV; } else if (EAX == 2) { @@ -2393,10 +2415,7 @@ cpu_CPUID(void) { EAX = CPUID; EBX = ECX = 0; - EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR/* | CPUID_SEP*/ | CPUID_FXSR | CPUID_CMOV; -#ifdef USE_SEP - EDX |= CPUID_SEP; -#endif + EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_SEP | CPUID_FXSR | CPUID_CMOV; } else if (EAX == 2) { @@ -3555,8 +3574,6 @@ i686_invalid_wrmsr: } } -static int cyrix_addr; - static void cpu_write(uint16_t addr, uint8_t val, void *priv) { if (addr == 0xf0) { @@ -3577,14 +3594,46 @@ static void cpu_write(uint16_t addr, uint8_t val, void *priv) ccr0 = val; break; case 0xc1: /*CCR1*/ + if ((ccr3 & CCR3_SMI_LOCK) && !in_smm) + val = (val & ~(CCR1_USE_SMI | CCR1_SMAC | CCR1_SM3)) | (ccr1 & (CCR1_USE_SMI | CCR1_SMAC | CCR1_SM3)); ccr1 = val; break; case 0xc2: /*CCR2*/ ccr2 = val; break; case 0xc3: /*CCR3*/ + if ((ccr3 & CCR3_SMI_LOCK) && !in_smm) + val = (val & ~(CCR3_NMI_EN)) | (ccr3 & CCR3_NMI_EN) | CCR3_SMI_LOCK; ccr3 = val; break; + case 0xcd: + if (!(ccr3 & CCR3_SMI_LOCK) || in_smm) + { + cyrix.arr[3].base = (cyrix.arr[3].base & ~0xff000000) | (val << 24); + cyrix.smhr &= ~SMHR_VALID; + } + break; + case 0xce: + if (!(ccr3 & CCR3_SMI_LOCK) || in_smm) + { + cyrix.arr[3].base = (cyrix.arr[3].base & ~0x00ff0000) | (val << 16); + cyrix.smhr &= ~SMHR_VALID; + } + break; + case 0xcf: + if (!(ccr3 & CCR3_SMI_LOCK) || in_smm) + { + cyrix.arr[3].base = (cyrix.arr[3].base & ~0x0000f000) | ((val & 0xf0) << 8); + if ((val & 0xf) == 0xf) + cyrix.arr[3].size = 1ull << 32; /*4 GB*/ + else if (val & 0xf) + cyrix.arr[3].size = 2048 << (val & 0xf); + else + cyrix.arr[3].size = 0; /*Disabled*/ + cyrix.smhr &= ~SMHR_VALID; + } + break; + case 0xe8: /*CCR4*/ if ((ccr3 & 0xf0) == 0x10) { @@ -3613,6 +3662,9 @@ static void cpu_write(uint16_t addr, uint8_t val, void *priv) static uint8_t cpu_read(uint16_t addr, void *priv) { + if (addr == 0xf007) + return 0x7f; + if (addr >= 0xf0) return 0xff; /* FPU stuff */ diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index f8e27a903..c2b39a6f4 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -150,6 +150,7 @@ extern CPU cpus_i486S1[]; extern CPU cpus_Am486S1[]; extern CPU cpus_Cx486S1[]; extern CPU cpus_i486[]; +extern CPU cpus_i486_PC330[]; extern CPU cpus_Am486[]; extern CPU cpus_Cx486[]; #if defined(DEV_BRANCH) && defined(USE_STPC) @@ -225,7 +226,8 @@ typedef struct { uint8_t access, ar_high; int8_t checked; /*Non-zero if selector is known to be valid*/ uint16_t seg; - uint32_t base, limit, + uint32_t base, + limit, limit_raw, limit_low, limit_high; } x86seg; @@ -311,6 +313,7 @@ typedef struct { #define CPU_STATUS_STACK32 (1 << 1) #define CPU_STATUS_PMODE (1 << 2) #define CPU_STATUS_V86 (1 << 3) +#define CPU_STATUS_SMM (1 << 4) #define CPU_STATUS_FLAGS 0xffff /*If the cpu_state.flags below are set in cpu_cur_status, they must be set in block->status. @@ -388,7 +391,7 @@ extern int cpu_cyrix_alignment; /*Cyrix 5x86/6x86 only has data misalignment penalties when crossing 8-byte boundaries*/ extern int is8086, is286, is386, is486, is486sx, is486dx, is486sx2, is486dx2, isdx4; -extern int is_am486, is_pentium, is_k5, is_k6, is_p6; +extern int is_am486, is_pentium, is_k5, is_k6, is_p6, is_cx6x86; extern int hascache; extern int isibm486; extern int is_rapidcad; @@ -492,7 +495,8 @@ extern uint32_t old_rammask; extern int acycs; #endif extern int pic_pending, is_vpc; -extern int soft_reset_mask; +extern int soft_reset_mask, alt_access; +extern int cpu_end_block_after_ins; extern uint16_t cpu_fast_off_count, cpu_fast_off_val; extern uint32_t cpu_fast_off_flags; @@ -590,4 +594,23 @@ extern const char *fpu_get_internal_name(int machine, int cpu_manufacturer, int extern const char *fpu_get_name_from_index(int machine, int cpu_manufacturer, int cpu, int c); extern int fpu_get_type_from_index(int machine, int cpu_manufacturer, int cpu, int c); +void cyrix_load_seg_descriptor(uint32_t addr, x86seg *seg); +void cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg); + +#define SMHR_VALID (1 << 0) +#define SMHR_ADDR_MASK (0xfffffffc) + +typedef struct +{ + struct + { + uint32_t base; + uint64_t size; + } arr[8]; + uint32_t smhr; +} cyrix_t; + + +extern cyrix_t cyrix; + #endif /*EMU_CPU_H*/ diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index 087e66fa4..da71b0ca8 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -342,6 +342,17 @@ CPU cpus_i486[] = { {"", -1, 0, 0, 0, 0, 0x0000, 0, 0, 0, 0, 0, 0} }; +CPU cpus_i486_PC330[] = { + /*i486/P24T*/ + {"i486DX2/50", CPU_i486DX2, fpus_internal, 50000000, 2.0, 0x470, 0x470, 0x0000, CPU_SUPPORTS_DYNAREC, 8, 8, 6, 6, 6}, + {"i486DX2/66", CPU_i486DX2, fpus_internal, 66666666, 2.0, 0x470, 0x470, 0x0000, CPU_SUPPORTS_DYNAREC, 12,12, 6, 6, 8}, + {"iDX4/75", CPU_iDX4, fpus_internal, 75000000, 3.0, 0x480, 0x480, 0x0000, CPU_SUPPORTS_DYNAREC, 12,12, 9, 9, 9}, /*CPUID available on DX4, >= 75 MHz*/ + {"iDX4/100", CPU_iDX4, fpus_internal, 100000000, 3.0, 0x483, 0x483, 0x0000, CPU_SUPPORTS_DYNAREC, 18,18, 9, 9, 12}, /*Is on some real Intel DX2s, limit here is pretty arbitary*/ + {"Pentium OverDrive 63", CPU_P24T, fpus_internal, 62500000, 2.5, 0x1531, 0x1531, 0x0000, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 10,10,7,7, 15/2}, + {"Pentium OverDrive 83", CPU_P24T, fpus_internal, 83333333, 2.5, 0x1532, 0x1532, 0x0000, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 15,15,8,8, 10}, + {"", -1, 0, 0, 0, 0, 0x0000, 0, 0, 0, 0, 0, 0} +}; + CPU cpus_Am486[] = { /*Am486/5x86*/ {"Am486SX/33", CPU_Am486SX, fpus_486sx, 33333333, 1.0, 0x42a, 0, 0, CPU_SUPPORTS_DYNAREC, 6, 6, 3, 3, 4}, @@ -579,7 +590,7 @@ CPU cpus_Pentium3V[] = { CPU cpus_Pentium[] = { /*Intel Pentium*/ - {"Pentium 75", CPU_PENTIUM, fpus_internal, 75000000, 1.5, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 7, 7, 4, 4, 9}, + {"Pentium 75", CPU_PENTIUM, fpus_internal, 75000000, 1.5, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC /*| CPU_REQUIRES_DYNAREC*/, 7, 7, 4, 4, 9}, {"Pentium OverDrive MMX 75", CPU_PENTIUMMMX, fpus_internal, 75000000, 1.5, 0x1542, 0x1542, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 7, 7, 4, 4, 9}, {"Pentium 90", CPU_PENTIUM, fpus_internal, 90000000, 1.5, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 9, 9, 4, 4, 21/2}, {"Pentium 100/50", CPU_PENTIUM, fpus_internal, 100000000, 2.0, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 10,10, 6, 6, 12}, diff --git a/src/cpu/x86.h b/src/cpu/x86.h index bb2b1d322..c5e59551f 100644 --- a/src/cpu/x86.h +++ b/src/cpu/x86.h @@ -1,3 +1,14 @@ +#define ABRT_MASK 0x7f +/*An 'expected' exception is one that would be expected to occur on every execution + of this code path; eg a GPF due to being in v86 mode. An 'unexpected' exception is + one that would be unlikely to occur on the next exception, eg a page fault may be + fixed up by the exception handler and the next execution would not hit it. + + This distinction is used by the dynarec; a block that hits an 'expected' exception + would be compiled, a block that hits an 'unexpected' exception would be rejected so + that we don't end up with an unnecessarily short block*/ +#define ABRT_EXPECTED 0x80 + extern uint8_t opcode, opcode2; extern uint8_t flags_p; extern uint8_t znptable8[256]; @@ -68,3 +79,4 @@ extern void x86_doabrt(int x86_abrt); extern void x86illegal(); extern void x86seg_reset(); extern void x86gpf(char *s, uint16_t error); +extern void x86gpf_expected(char *s, uint16_t error); diff --git a/src/cpu/x86_ops.h b/src/cpu/x86_ops.h index 6ee001b0b..1e81b386a 100644 --- a/src/cpu/x86_ops.h +++ b/src/cpu/x86_ops.h @@ -88,6 +88,7 @@ extern const OpFn dynarec_ops_pentium_0f[1024]; extern const OpFn dynarec_ops_pentiummmx_0f[1024]; #if defined(DEV_BRANCH) && defined(USE_CYRIX_6X86) +extern const OpFn dynarec_ops_c6x86_0f[1024]; extern const OpFn dynarec_ops_c6x86mx_0f[1024]; #endif @@ -184,6 +185,7 @@ extern const OpFn ops_pentium_0f[1024]; extern const OpFn ops_pentiummmx_0f[1024]; #if defined(DEV_BRANCH) && defined(USE_CYRIX_6X86) +extern const OpFn ops_c6x86_0f[1024]; extern const OpFn ops_c6x86mx_0f[1024]; #endif diff --git a/src/cpu/x86_ops_cyrix.h b/src/cpu/x86_ops_cyrix.h new file mode 100644 index 000000000..e6464ce84 --- /dev/null +++ b/src/cpu/x86_ops_cyrix.h @@ -0,0 +1,274 @@ +/*Cyrix-only instructions*/ +/*System Management Mode*/ +static void opSVDC_common(uint32_t fetchdat) +{ + switch (rmdat & 0x38) + { + case 0x00: /*ES*/ + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_es); + writememw(0, easeg+cpu_state.eaaddr+8, ES); + break; + case 0x08: /*CS*/ + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_cs); + writememw(0, easeg+cpu_state.eaaddr+8, CS); + break; + case 0x18: /*DS*/ + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_ds); + writememw(0, easeg+cpu_state.eaaddr+8, DS); + break; + case 0x10: /*SS*/ + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_ss); + writememw(0, easeg+cpu_state.eaaddr+8, SS); + break; + case 0x20: /*FS*/ + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_fs); + writememw(0, easeg+cpu_state.eaaddr+8, FS); + break; + case 0x28: /*GS*/ + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_gs); + writememw(0, easeg+cpu_state.eaaddr+8, GS); + break; + default: + pclog("opSVDC: unknown rmdat %02x\n", rmdat); + x86illegal(); + } +} +static int opSVDC_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_16(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + opSVDC_common(fetchdat); + } + else + x86illegal(); + + return cpu_state.abrt; +} +static int opSVDC_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_32(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + opSVDC_common(fetchdat); + } + else + x86illegal(); + + return cpu_state.abrt; +} + +static void opRSDC_common(uint32_t fetchdat) +{ + switch (rmdat & 0x38) + { + case 0x00: /*ES*/ + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_es); + break; + case 0x18: /*DS*/ + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_ds); + break; + case 0x10: /*SS*/ + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_ss); + break; + case 0x20: /*FS*/ + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_fs); + break; + case 0x28: /*GS*/ + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &cpu_state.seg_gs); + break; + default: + pclog("opRSDC: unknown rmdat %02x\n", rmdat); + x86illegal(); + } +} +static int opRSDC_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_16(fetchdat); + SEG_CHECK_READ(cpu_state.ea_seg); + opRSDC_common(fetchdat); + } + else + x86illegal(); + + return cpu_state.abrt; +} +static int opRSDC_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_32(fetchdat); + SEG_CHECK_READ(cpu_state.ea_seg); + opRSDC_common(fetchdat); + } + else + x86illegal(); + + return cpu_state.abrt; +} + +static int opSVLDT_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_16(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &ldt); + writememw(0, easeg+cpu_state.eaaddr+8, ldt.seg); + } + else + x86illegal(); + + return cpu_state.abrt; +} +static int opSVLDT_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_32(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &ldt); + writememw(0, easeg+cpu_state.eaaddr+8, ldt.seg); + } + else + x86illegal(); + + return cpu_state.abrt; +} + +static int opRSLDT_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_16(fetchdat); + SEG_CHECK_READ(cpu_state.ea_seg); + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &ldt); + } + else + x86illegal(); + + return cpu_state.abrt; +} +static int opRSLDT_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_32(fetchdat); + SEG_CHECK_READ(cpu_state.ea_seg); + cyrix_load_seg_descriptor(easeg+cpu_state.eaaddr, &ldt); + } + else + x86illegal(); + + return cpu_state.abrt; +} + +static int opSVTS_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_16(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &tr); + writememw(0, easeg+cpu_state.eaaddr+8, tr.seg); + } + else + x86illegal(); + + return cpu_state.abrt; +} +static int opSVTS_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_32(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &tr); + writememw(0, easeg+cpu_state.eaaddr+8, tr.seg); + } + else + x86illegal(); + + return cpu_state.abrt; +} + +static int opRSTS_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_16(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &tr); + writememw(0, easeg+cpu_state.eaaddr+8, tr.seg); + } + else + x86illegal(); + + return cpu_state.abrt; +} +static int opRSTS_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + { + fetch_ea_32(fetchdat); + SEG_CHECK_WRITE(cpu_state.ea_seg); + cyrix_write_seg_descriptor(easeg+cpu_state.eaaddr, &tr); + writememw(0, easeg+cpu_state.eaaddr+8, tr.seg); + } + else + x86illegal(); + + return cpu_state.abrt; +} + +static int opSMINT(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + fatal("opSMINT\n"); + else + x86illegal(); + + return 1; +} + +static int opRDSHR_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + fatal("opRDSHR_a16\n"); + else + x86illegal(); + + return 1; +} +static int opRDSHR_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + fatal("opRDSHR_a32\n"); + else + x86illegal(); + + return 1; +} + +static int opWRSHR_a16(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + fatal("opWRSHR_a16\n"); + else + x86illegal(); + + return 1; +} +static int opWRSHR_a32(uint32_t fetchdat) +{ + if (cpu_cur_status & CPU_STATUS_SMM) + fatal("opWRSHR_a32\n"); + else + x86illegal(); + + return 1; +} diff --git a/src/cpu/x86_ops_flag.h b/src/cpu/x86_ops_flag.h index 68f1bac2a..b5e16ee0e 100644 --- a/src/cpu/x86_ops_flag.h +++ b/src/cpu/x86_ops_flag.h @@ -85,8 +85,10 @@ static int opSTI(uint32_t fetchdat) else cpu_state.flags |= I_FLAG; - CPU_BLOCK_END(); - + /*First instruction after STI will always execute, regardless of whether + there is a pending interrupt*/ + cpu_end_block_after_ins = 2; + CLOCK_CYCLES(2); PREFETCH_RUN(2, 1, -1, 0,0,0,0, 0); return 0; diff --git a/src/cpu/x86_ops_int.h b/src/cpu/x86_ops_int.h index 260fcdad5..4e18e6f4b 100644 --- a/src/cpu/x86_ops_int.h +++ b/src/cpu/x86_ops_int.h @@ -59,7 +59,7 @@ static int opINT(uint32_t fetchdat) } } } - x86gpf(NULL,0); + x86gpf_expected(NULL,0); return 1; } diff --git a/src/cpu/x86_ops_mmx_mov.h b/src/cpu/x86_ops_mmx_mov.h index e17721229..a980c6b9a 100644 --- a/src/cpu/x86_ops_mmx_mov.h +++ b/src/cpu/x86_ops_mmx_mov.h @@ -50,7 +50,7 @@ static int opMOVD_l_mm_a32(uint32_t fetchdat) static int opMOVD_mm_l_a16(uint32_t fetchdat) { MMX_ENTER(); - + fetch_ea_16(fetchdat); if (cpu_mod == 3) { @@ -69,6 +69,52 @@ static int opMOVD_mm_l_a16(uint32_t fetchdat) static int opMOVD_mm_l_a32(uint32_t fetchdat) { MMX_ENTER(); + + fetch_ea_32(fetchdat); + if (cpu_mod == 3) + { + cpu_state.regs[cpu_rm].l = cpu_state.MM[cpu_reg].l[0]; + CLOCK_CYCLES(1); + } + else + { + SEG_CHECK_WRITE(cpu_state.ea_seg); + CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3); + writememl(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].l[0]); if (cpu_state.abrt) return 1; + CLOCK_CYCLES(2); + } + return 0; +} + +/*Cyrix maps both MOVD and SMINT to the same opcode*/ +static int opMOVD_mm_l_a16_cx(uint32_t fetchdat) +{ + if (in_smm) + return opSMINT(fetchdat); + + MMX_ENTER(); + + fetch_ea_16(fetchdat); + if (cpu_mod == 3) + { + cpu_state.regs[cpu_rm].l = cpu_state.MM[cpu_reg].l[0]; + CLOCK_CYCLES(1); + } + else + { + SEG_CHECK_WRITE(cpu_state.ea_seg); + CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3); + writememl(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].l[0]); if (cpu_state.abrt) return 1; + CLOCK_CYCLES(2); + } + return 0; +} +static int opMOVD_mm_l_a32_cx(uint32_t fetchdat) +{ + if (in_smm) + return opSMINT(fetchdat); + + MMX_ENTER(); fetch_ea_32(fetchdat); if (cpu_mod == 3) diff --git a/src/cpu/x86_ops_pmode.h b/src/cpu/x86_ops_pmode.h index cafcdf6d5..b372da126 100644 --- a/src/cpu/x86_ops_pmode.h +++ b/src/cpu/x86_ops_pmode.h @@ -163,7 +163,7 @@ static int op0F00_common(uint32_t fetchdat, int ea32) int dpl, valid, granularity; uint32_t addr, base, limit; uint16_t desc, sel; - uint8_t access; + uint8_t access, ar_high; switch (rmdat & 0x38) { @@ -194,10 +194,13 @@ static int op0F00_common(uint32_t fetchdat, int ea32) limit = readmemw(0, addr) + ((readmemb(0, addr + 6) & 0xf) << 16); base = (readmemw(0, addr + 2)) | (readmemb(0, addr + 4) << 16) | (readmemb(0, addr + 7) << 24); access = readmemb(0, addr + 5); + ar_high = readmemb(0, addr + 6); granularity = readmemb(0, addr + 6) & 0x80; if (cpu_state.abrt) return 1; ldt.limit = limit; + ldt.limit_raw = limit; ldt.access = access; + ldt.ar_high = ar_high; if (granularity) { ldt.limit <<= 12; @@ -221,6 +224,7 @@ static int op0F00_common(uint32_t fetchdat, int ea32) limit = readmemw(0, addr) + ((readmemb(0, addr + 6) & 0xf) << 16); base = (readmemw(0, addr + 2)) | (readmemb(0, addr + 4) << 16) | (readmemb(0, addr + 7) << 24); access = readmemb(0, addr + 5); + ar_high = readmemb(0, addr + 6); granularity = readmemb(0, addr + 6) & 0x80; if (cpu_state.abrt) return 1; access |= 2; @@ -228,7 +232,9 @@ static int op0F00_common(uint32_t fetchdat, int ea32) if (cpu_state.abrt) return 1; tr.seg = sel; tr.limit = limit; + tr.limit_raw = limit; tr.access = access; + tr.ar_high = ar_high; if (granularity) { tr.limit <<= 12; diff --git a/src/cpu/x86_ops_ret.h b/src/cpu/x86_ops_ret.h index 1ebe67b9c..3d6386956 100644 --- a/src/cpu/x86_ops_ret.h +++ b/src/cpu/x86_ops_ret.h @@ -175,7 +175,7 @@ static int opIRET(uint32_t fetchdat) } else { - x86gpf(NULL,0); + x86gpf_expected(NULL,0); return 1; } } @@ -224,7 +224,7 @@ static int opIRETD(uint32_t fetchdat) if ((cr0 & 1) && (cpu_state.eflags & VM_FLAG) && (IOPL != 3)) { - x86gpf(NULL,0); + x86gpf_expected(NULL,0); return 1; } if (msw & 1) diff --git a/src/cpu/x86seg.c b/src/cpu/x86seg.c index 9ff257590..b15e4bd46 100644 --- a/src/cpu/x86seg.c +++ b/src/cpu/x86seg.c @@ -168,6 +168,14 @@ x86gpf(char *s, uint16_t error) } +void +x86gpf_expected(char *s, uint16_t error) +{ + cpu_state.abrt = ABRT_GPF | ABRT_EXPECTED; + abrt_error = error; +} + + void x86ss(char *s, uint16_t error) { @@ -219,6 +227,7 @@ void do_seg_load(x86seg *s, uint16_t *segdat) { s->limit = segdat[0] | ((segdat[3] & 0x000f) << 16); + s->limit_raw = s->limit; if (segdat[3] & 0x0080) s->limit = (s->limit << 12) | 0xfff; s->base = segdat[1] | ((segdat[2] & 0x00ff) << 16); @@ -1469,7 +1478,11 @@ pmodeint(int num, int soft) x86seg_log("Addr %08X seg %04X %04X %04X %04X\n", addr, segdat[0], segdat[1], segdat[2], segdat[3]); if (!(segdat[2] & 0x1f00)) { - x86gpf("pmodeint(): Vector descriptor with bad type", (num << 3) + 2); + /* This fires on all V86 interrupts in EMM386. Mark as expected to prevent code churn */ + if (cpu_state.eflags & VM_FLAG) + x86gpf_expected("pmodeint(): Expected vector descriptor with bad type", (num << 3) + 2); + else + x86gpf("pmodeint(): Vector descriptor with bad type", (num << 3) + 2); return; } if ((DPL < CPL) && soft) { @@ -2364,3 +2377,47 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32) tr.access = segdat[2] >> 8; tr.ar_high = segdat[3] & 0xff; } + + +void +cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg) +{ + writememl(0, addr, (seg->limit_raw & 0xffff) | (seg->base << 16)); + writememl(0, addr + 4, ((seg->base >> 16) & 0xff) | (seg->access << 8) | + (seg->limit_raw & 0xf0000) | (seg->ar_high << 16) | + (seg->base & 0xff000000)); +} + + +void +cyrix_load_seg_descriptor(uint32_t addr, x86seg *seg) +{ + uint16_t segdat[4], selector; + + segdat[0] = readmemw(0, addr); + segdat[1] = readmemw(0, addr + 2); + segdat[2] = readmemw(0, addr + 4); + segdat[3] = readmemw(0, addr + 6); + selector = readmemw(0, addr+8); + + if (!cpu_state.abrt) { + do_seg_load(seg, segdat); + seg->seg = selector; + seg->checked = 0; + if (seg == &cpu_state.seg_ds) { + if (seg->base == 0 && seg->limit_low == 0 && seg->limit_high == 0xffffffff) + cpu_cur_status &= ~CPU_STATUS_NOTFLATDS; + else + cpu_cur_status |= CPU_STATUS_NOTFLATDS; + codegen_flat_ds = 0; + } + if (seg == &cpu_state.seg_ss) { + if (seg->base == 0 && seg->limit_low == 0 && seg->limit_high == 0xffffffff) + cpu_cur_status &= ~CPU_STATUS_NOTFLATSS; + else + cpu_cur_status |= CPU_STATUS_NOTFLATSS; + set_stack32((segdat[3] & 0x40) ? 1 : 0); + codegen_flat_ss = 0; + } + } +} diff --git a/src/cpu/x86seg.h b/src/cpu/x86seg.h index d740f9cea..d98db1586 100644 --- a/src/cpu/x86seg.h +++ b/src/cpu/x86seg.h @@ -16,3 +16,6 @@ */ extern void do_seg_load(x86seg *s, uint16_t *segdat); + +extern void cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg); +extern void cyrix_load_seg_descriptor(uint32_t addr, x86seg *seg); diff --git a/src/ddma.c b/src/ddma.c index 92ee1f4d3..a1c6ab76b 100644 --- a/src/ddma.c +++ b/src/ddma.c @@ -193,7 +193,7 @@ const device_t ddma_device = ddma_init, ddma_close, NULL, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/device.c b/src/device.c index 070fb8656..09f522867 100644 --- a/src/device.c +++ b/src/device.c @@ -318,6 +318,129 @@ device_available(const device_t *d) } +int +device_poll(const device_t *d, int x, int y, int z, int b) +{ + int c; + + for (c = 0; c < DEVICE_MAX; c++) { + if (devices[c] != NULL) { + if (devices[c] == d) { + if (devices[c]->poll) + return(devices[c]->poll(x, y, z, b, device_priv[c])); + } + } + } + + return(0); +} + + +void +device_register_pci_slot(const device_t *d, int device, int type, int inta, int intb, int intc, int intd) +{ + int c; + + for (c = 0; c < DEVICE_MAX; c++) { + if (devices[c] != NULL) { + if (devices[c] == d) { + if (devices[c]->register_pci_slot) + devices[c]->register_pci_slot(device, type, inta, intb, intc, intd, device_priv[c]); + return; + } + } + } + + return; +} + + +void +device_get_name(const device_t *d, int bus, char *name) +{ + char *sbus = NULL, *fbus; + char *tname, pbus[8] = { 0 }; + + if (d == NULL) + return; + + name[0] = 0x00; + + if (bus) { + if (d->flags & DEVICE_LPT) + sbus = "LPT"; + else if (d->flags & DEVICE_ISA) + sbus = (d->flags & DEVICE_AT) ? "ISA16" : "ISA"; + else if (d->flags & DEVICE_CBUS) + sbus = "C-BUS"; + else if (d->flags & DEVICE_MCA) + sbus = "MCA"; + else if (d->flags & DEVICE_EISA) + sbus = "EISA"; + else if (d->flags & DEVICE_VLB) + sbus = "VLB"; + else if (d->flags & DEVICE_PCI) + sbus = "PCI"; + else if (d->flags & DEVICE_AGP) + sbus = "AGP"; + + if (sbus != NULL) { + /* First concatenate [] before the device's name. */ + strcat(name, "["); + strcat(name, sbus); + strcat(name, "] "); + + /* Then change string from ISA16 to ISA if applicable. */ + if (!strcmp(sbus, "ISA16")) + sbus = "ISA"; + else if (!strcmp(sbus, "LPT")) { + sbus = NULL; + strcat(name, d->name); + return; + } + + /* Generate the bus string with parentheses. */ + strcat(pbus, "("); + strcat(pbus, sbus); + strcat(pbus, ")"); + + /* Allocate the temporary device name string and set it to all zeroes. */ + tname = (char *) malloc(strlen(d->name) + 1); + memset(tname, 0x00, strlen(d->name) + 1); + + /* First strip the bus string with parentheses. */ + fbus = strstr(d->name, pbus); + if (fbus == d->name) + strcat(tname, d->name + strlen(pbus) + 1); + else if (fbus == NULL) + strcat(tname, d->name); + else { + strncat(tname, d->name, fbus - d->name - 1); + strcat(tname, fbus + strlen(pbus)); + } + + /* Then also strip the bus string with parentheses. */ + fbus = strstr(tname, sbus); + if (fbus == tname) + strcat(name, tname + strlen(sbus) + 1); + /* Special case to not strip the "oPCI" from "Ensoniq AudioPCI". */ + else if ((fbus == NULL) || (*(fbus - 1) == 'o')) + strcat(name, tname); + else { + strncat(name, tname, fbus - tname - 1); + strcat(name, fbus + strlen(sbus)); + } + + /* Free the temporary device name string. */ + free(tname); + tname = NULL; + } else + strcat(name, d->name); + } else + strcat(name, d->name); +} + + void device_speed_changed(void) { diff --git a/src/device/bugger.c b/src/device/bugger.c index 492261fe2..170b610c6 100644 --- a/src/device/bugger.c +++ b/src/device/bugger.c @@ -360,6 +360,6 @@ const device_t bugger_device = { DEVICE_ISA | DEVICE_AT, 0, bug_init, bug_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/hwm_gl518sm.c b/src/device/hwm_gl518sm.c index 4bfc6c455..ce347655e 100644 --- a/src/device/hwm_gl518sm.c +++ b/src/device/hwm_gl518sm.c @@ -296,7 +296,7 @@ const device_t gl518sm_2c_device = { DEVICE_ISA, 0x2c, gl518sm_init, gl518sm_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -306,6 +306,6 @@ const device_t gl518sm_2d_device = { DEVICE_ISA, 0x2d, gl518sm_init, gl518sm_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/hwm_lm75.c b/src/device/hwm_lm75.c index 7210cf8ef..9f48bfb78 100644 --- a/src/device/hwm_lm75.c +++ b/src/device/hwm_lm75.c @@ -261,7 +261,7 @@ const device_t lm75_1_4a_device = { DEVICE_ISA, 0x14a, lm75_init, lm75_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -273,6 +273,6 @@ const device_t lm75_w83781d_device = { DEVICE_ISA, 0, lm75_init, lm75_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/hwm_lm78.c b/src/device/hwm_lm78.c index 8b95bbade..8e133ffbd 100644 --- a/src/device/hwm_lm78.c +++ b/src/device/hwm_lm78.c @@ -560,7 +560,7 @@ const device_t lm78_device = { DEVICE_ISA, 0x290 | LM78_SMBUS, lm78_init, lm78_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -571,7 +571,7 @@ const device_t w83781d_device = { DEVICE_ISA, 0x290 | LM78_SMBUS | LM78_W83781D, lm78_init, lm78_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -583,7 +583,7 @@ const device_t as99127f_device = { DEVICE_ISA, LM78_SMBUS | LM78_AS99127F_REV1, lm78_init, lm78_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -594,7 +594,7 @@ const device_t as99127f_rev2_device = { DEVICE_ISA, LM78_SMBUS | LM78_AS99127F_REV2, lm78_init, lm78_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -605,6 +605,6 @@ const device_t w83782d_device = { DEVICE_ISA, 0x290 | LM78_SMBUS | LM78_W83782D, lm78_init, lm78_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/hwm_vt82c686.c b/src/device/hwm_vt82c686.c index 734aabfe4..d91c0aab7 100644 --- a/src/device/hwm_vt82c686.c +++ b/src/device/hwm_vt82c686.c @@ -193,6 +193,6 @@ const device_t via_vt82c686_hwm_device = { DEVICE_ISA, 0, vt82c686_init, vt82c686_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/ibm_5161.c b/src/device/ibm_5161.c index 3e7d4845f..3924e61dd 100644 --- a/src/device/ibm_5161.c +++ b/src/device/ibm_5161.c @@ -106,7 +106,7 @@ const device_t ibm_5161_device = ibm_5161_init, ibm_5161_close, NULL, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/device/isamem.c b/src/device/isamem.c index b40dee6d1..76080c328 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -667,16 +667,14 @@ isamem_close(void *priv) static const device_config_t ibmxt_config[] = { { - "size", "Memory Size", CONFIG_SPINNER, "", 128, - { { 0 } }, - { { 0 } }, - { 0, 512, 16 } + "size", "Memory Size", CONFIG_SPINNER, "", 128, "", + { 0, 512, 16 }, + { { 0 } } }, { - "start", "Start Address", CONFIG_SPINNER, "", 256, - { { 0 } }, - { { 0 } }, - { 0, 640-64, 64 } + "start", "Start Address", CONFIG_SPINNER, "", 256, "", + { 0, 640-64, 64 }, + { { 0 } } }, { "", "", -1 @@ -688,7 +686,7 @@ static const device_t ibmxt_device = { DEVICE_ISA, 0, isamem_init, isamem_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ibmxt_config }; @@ -696,16 +694,14 @@ static const device_t ibmxt_device = { static const device_config_t ibmat_config[] = { { - "size", "Memory Size", CONFIG_SPINNER, "", 512, - { { 0 } }, - { { 0 } }, - { 0, 4096, 512 } + "size", "Memory Size", CONFIG_SPINNER, "", 512, "", + { 0, 4096, 512 }, + { { 0 } } }, { - "start", "Start Address", CONFIG_SPINNER, "", 512, - { { 0 } }, - { { 0 } }, - { 0, 16128, 128 } + "start", "Start Address", CONFIG_SPINNER, "", 512, "", + { 0, 16128, 128 }, + { { 0 } } }, { "", "", -1 @@ -717,7 +713,7 @@ static const device_t ibmat_device = { DEVICE_ISA, 1, isamem_init, isamem_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ibmat_config }; @@ -725,16 +721,14 @@ static const device_t ibmat_device = { static const device_config_t p5pak_config[] = { { - "size", "Memory Size", CONFIG_SPINNER, "", 128, - { { 0 } }, - { { 0 } }, - { 0, 384, 64 } + "size", "Memory Size", CONFIG_SPINNER, "", 128, "", + { 0, 384, 64 }, + { { 0 } } }, { - "start", "Start Address", CONFIG_SPINNER, "", 512, - { { 0 } }, - { { 0 } }, - { 64, 576, 64 } + "start", "Start Address", CONFIG_SPINNER, "", 512, "", + { 64, 576, 64 }, + { { 0 } } }, { "", "", -1 @@ -746,7 +740,7 @@ static const device_t p5pak_device = { DEVICE_ISA, 2, isamem_init, isamem_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, p5pak_config }; @@ -755,12 +749,12 @@ static const device_config_t ems5150_config[] = { { "size", "Memory Size", CONFIG_SPINNER, "", 256, - { { 0 } }, - { { 0 } }, - { 0, 2048, 64 } + "", + { 0, 2048, 64 }, + { { 0 } } }, { - "base", "Address", CONFIG_HEX16, "", 0, + "base", "Address", CONFIG_HEX16, "", 0, "", { 0 }, { { "Disabled", 0 @@ -792,7 +786,7 @@ static const device_t ems5150_device = { DEVICE_ISA, 3, isamem_init, isamem_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ems5150_config }; @@ -800,25 +794,22 @@ static const device_t ems5150_device = { static const device_config_t ev159_config[] = { { - "size", "Memory Size", CONFIG_SPINNER, "", 512, - { { 0 } }, - { { 0 } }, - { 0, 3072, 512 } + "size", "Memory Size", CONFIG_SPINNER, "", 512, "", + { 0, 3072, 512 }, + { { 0 } } }, { - "start", "Start Address", CONFIG_SPINNER, "", 0, - { { 0 } }, - { { 0 } }, - { 0, 16128, 128 } + "start", "Start Address", CONFIG_SPINNER, "", 0, "", + { 0, 16128, 128 }, + { { 0 } } }, { - "length", "Contiguous Size", CONFIG_SPINNER, "", 0, - { { 0 } }, - { { 0 } }, - { 0, 16384, 128 } + "length", "Contiguous Size", CONFIG_SPINNER, "", 0, "", + { 0, 16384, 128 }, + { { 0 } } }, { - "width", "I/O Width", CONFIG_SELECTION, "", 0, + "width", "I/O Width", CONFIG_SELECTION, "", 0, "", { 0 }, { { "8-bit", 0 @@ -832,7 +823,7 @@ static const device_config_t ev159_config[] = }, }, { - "speed", "Transfer Speed", CONFIG_SELECTION, "", 0, + "speed", "Transfer Speed", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Standard (150ns)", 0 @@ -846,7 +837,7 @@ static const device_config_t ev159_config[] = } }, { - "ems", "EMS mode", CONFIG_SELECTION, "", 0, + "ems", "EMS mode", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Disabled", 0 @@ -860,7 +851,7 @@ static const device_config_t ev159_config[] = }, }, { - "base", "Address", CONFIG_HEX16, "", 0x0258, + "base", "Address", CONFIG_HEX16, "", 0x0258, "", { 0 }, { { "208H", 0x0208 @@ -898,7 +889,7 @@ static const device_t ev159_device = { DEVICE_ISA, 10, isamem_init, isamem_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ev159_config }; @@ -907,7 +898,7 @@ static const device_t ev159_device = { static const device_config_t rampage_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x0258, + "base", "Address", CONFIG_HEX16, "", 0x0258, "", { 0 }, { { "208H", 0x0208 @@ -936,7 +927,7 @@ static const device_config_t rampage_config[] = }, }, { - "frame", "Frame Address", CONFIG_HEX20, "", 0, + "frame", "Frame Address", CONFIG_HEX20, "", 0, "", { 0 }, { { "Disabled", 0x00000 @@ -956,7 +947,7 @@ static const device_config_t rampage_config[] = }, }, { - "width", "I/O Width", CONFIG_SELECTION, "", 8, + "width", "I/O Width", CONFIG_SELECTION, "", 8, "", { 0 }, { { "8-bit", 8 @@ -970,7 +961,7 @@ static const device_config_t rampage_config[] = }, }, { - "speed", "Transfer Speed", CONFIG_SELECTION, "", 0, + "speed", "Transfer Speed", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Standard", 0 @@ -985,9 +976,9 @@ static const device_config_t rampage_config[] = }, { "size", "Memory Size", CONFIG_SPINNER, "", 128, - { { 0 } }, - { { 0 } }, - { 0, 8192, 128 } + "", + { 0, 8192, 128 }, + { 0 } }, { "", "", -1 @@ -999,7 +990,7 @@ static const device_t isamem_rampage_device = { DEVICE_ISA, 11, isamem_init, isamem_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, rampage_config }; #endif @@ -1024,7 +1015,7 @@ static const struct { #ifdef USE_ISAMEM_IAB { "iab", &iab_device }, #endif - { NULL, NULL } + { "", NULL } }; diff --git a/src/device/isartc.c b/src/device/isartc.c index 632ac0b1f..a14d7e82d 100644 --- a/src/device/isartc.c +++ b/src/device/isartc.c @@ -586,7 +586,7 @@ isartc_close(void *priv) static const device_config_t ev170_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x02C0, + "base", "Address", CONFIG_HEX16, "", 0x02C0, "", { 0 }, { { "240H", 0x0240 @@ -600,7 +600,7 @@ static const device_config_t ev170_config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", -1, + "irq", "IRQ", CONFIG_SELECTION, "", -1, "", { 0 }, { { "Disabled", -1 @@ -629,14 +629,14 @@ static const device_t ev170_device = { DEVICE_ISA, 0, isartc_init, isartc_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ev170_config }; static const device_config_t pii147_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x0240, + "base", "Address", CONFIG_HEX16, "", 0x0240, "", { 0 }, { { "Clock 1", 0x0240 @@ -659,14 +659,14 @@ static const device_t pii147_device = { DEVICE_ISA, 1, isartc_init, isartc_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, pii147_config }; static const device_config_t p5pak_config[] = { { - "irq", "IRQ", CONFIG_SELECTION, "", -1, + "irq", "IRQ", CONFIG_SELECTION, "", -1, "", { 0 }, { { "Disabled", -1 @@ -695,21 +695,20 @@ static const device_t p5pak_device = { DEVICE_ISA, 2, isartc_init, isartc_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, p5pak_config }; static const struct { - const char *name; const char *internal_name; const device_t *dev; } boards[] = { - { "None", "none", NULL, }, - { "Everex EV-170 Magic I/O", "ev170", &ev170_device, }, - { "DTK PII-147 Hexa I/O Plus", "pii147", &pii147_device, }, - { "Paradise Systems 5-PAK", "p5pak", &p5pak_device, }, - { "", "", NULL, }, + { "none", NULL }, + { "ev170", &ev170_device }, + { "pii147", &pii147_device }, + { "p5pak", &p5pak_device }, + { "", NULL }, }; @@ -723,13 +722,6 @@ isartc_reset(void) } -char * -isartc_get_name(int board) -{ - return((char *)boards[board].name); -} - - char * isartc_get_internal_name(int board) { diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index 50283a713..5f158b608 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -90,14 +90,15 @@ typedef struct { - uint8_t command, status, out, secr_phase, + uint8_t command, status, old_status, out, old_out, secr_phase, mem_addr, input_port, output_port, old_output_port, key_command, output_locked, ami_stat, initialized, want60, wantirq, key_wantdata, refresh, first_write; uint8_t mem[0x100]; - int last_irq, reset_delay; + int last_irq, old_last_irq, + reset_delay; uint32_t flags; @@ -649,22 +650,37 @@ channel_queue_get(uint8_t channel) static void +add_to_kbc_queue_front(atkbd_t *dev, uint8_t val) +{ + dev->wantirq = 0; + picint(0x0000); + dev->out = val; + dev->status |= STAT_OFULL; + dev->status &= ~STAT_IFULL; + dev->status &= ~STAT_MFULL; + dev->last_irq = 0x0000; +} + + +static int channel_queue_check(atkbd_t *dev, uint8_t channel) { int val; if (channel >= 0x03) - return; + return 0; if ((channel == 0x01) && (dev->mem[0] & 0x10)) - return; + return 0; if ((channel == 0x02) && (((dev->flags & KBC_TYPE_MASK) < KBC_TYPE_PS2_NOREF) || (dev->mem[0] & 0x20))) - return; + return 0; val = channel_queue_get(channel); if (val == -1) - return; + return 0; kbc_queue_add(val & 0xff, channel); + + return 1; } @@ -748,9 +764,10 @@ kbd_poll(void *priv) } } - channel_queue_check(dev, 0x00); /* Transfer the next controller byte to the controller queue if there is any. */ - channel_queue_check(dev, 0x01); /* Transfer the next keyboard byte to the controller queue if there is any. */ - channel_queue_check(dev, 0x02); /* Transfer the next mouse byte to the controller queue if there is any. */ + for (i = 0x00; i < 0x03; i++) { + if (channel_queue_check(dev, i)) + break; + } if (dev->reset_delay > 0) { dev->reset_delay--; @@ -1168,16 +1185,16 @@ write64_generic(void *priv, uint8_t val) fixed_bits |= 0x40; if ((dev->flags & KBC_VEN_MASK) == KBC_VEN_IBM_PS1) { current_drive = fdc_get_current_drive(); - add_data(dev, dev->input_port | fixed_bits | (fdd_is_525(current_drive) ? 0x40 : 0x00)); + add_to_kbc_queue_front(dev, dev->input_port | fixed_bits | (fdd_is_525(current_drive) ? 0x40 : 0x00)); dev->input_port = ((dev->input_port + 1) & 3) | (dev->input_port & 0xfc) | (fdd_is_525(current_drive) ? 0x40 : 0x00); } else { if (((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) && ((dev->flags & KBC_VEN_MASK) != KBC_VEN_INTEL_AMI)) - add_data(dev, (dev->input_port | fixed_bits) & (((dev->flags & KBC_VEN_MASK) == KBC_VEN_ACER) ? 0xeb : 0xef)); + add_to_kbc_queue_front(dev, (dev->input_port | fixed_bits) & (((dev->flags & KBC_VEN_MASK) == KBC_VEN_ACER) ? 0xeb : 0xef)); else - add_data(dev, dev->input_port | fixed_bits); + add_to_kbc_queue_front(dev, dev->input_port | fixed_bits); dev->input_port = ((dev->input_port + 1) & 3) | (dev->input_port & 0xfc); } @@ -1977,7 +1994,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv) mask &= 0xbf; if (((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) && (dev->mem[0] & 0x20)) mask &= 0xf7; - add_data(dev, dev->output_port & mask); + add_to_kbc_queue_front(dev, dev->output_port & mask); break; case 0xd1: /* write output port */ @@ -2042,6 +2059,13 @@ kbd_read(uint16_t port, void *priv) if ((dev->last_irq == 0x0002) || (dev->last_irq == 0x1000)) picintc(dev->last_irq); dev->last_irq = 0xffff; + if (dev->old_last_irq != 0xffff) { + dev->out = dev->old_out; + dev->last_irq = dev->old_last_irq; + dev->status = dev->old_status; + dev->old_last_irq = 0xffff; + picint(dev->last_irq); + } break; case 0x61: @@ -2110,6 +2134,7 @@ kbd_reset(void *priv) dev->wantirq = 0; write_output(dev, 0xcf); dev->last_irq = 0xffff; + dev->old_last_irq = 0xffff; dev->secr_phase = 0; dev->key_wantdata = 0; @@ -2243,7 +2268,7 @@ const device_t keyboard_at_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_at_ami_device = { @@ -2253,7 +2278,7 @@ const device_t keyboard_at_ami_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_at_toshiba_device = { @@ -2263,7 +2288,7 @@ const device_t keyboard_at_toshiba_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_device = { @@ -2273,7 +2298,7 @@ const device_t keyboard_ps2_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_ps2_device = { @@ -2283,7 +2308,7 @@ const device_t keyboard_ps2_ps2_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_ps1_device = { @@ -2293,7 +2318,7 @@ const device_t keyboard_ps2_ps1_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_ps1_pci_device = { @@ -2303,7 +2328,7 @@ const device_t keyboard_ps2_ps1_pci_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_xi8088_device = { @@ -2313,7 +2338,7 @@ const device_t keyboard_ps2_xi8088_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_ami_device = { @@ -2323,7 +2348,7 @@ const device_t keyboard_ps2_ami_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_mca_device = { @@ -2333,7 +2358,7 @@ const device_t keyboard_ps2_mca_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_mca_2_device = { @@ -2343,7 +2368,7 @@ const device_t keyboard_ps2_mca_2_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_quadtel_device = { @@ -2353,7 +2378,7 @@ const device_t keyboard_ps2_quadtel_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_pci_device = { @@ -2363,7 +2388,7 @@ const device_t keyboard_ps2_pci_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_ami_pci_device = { @@ -2373,7 +2398,7 @@ const device_t keyboard_ps2_ami_pci_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_intel_ami_pci_device = { @@ -2383,7 +2408,7 @@ const device_t keyboard_ps2_intel_ami_pci_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t keyboard_ps2_acer_pci_device = { @@ -2393,7 +2418,7 @@ const device_t keyboard_ps2_acer_pci_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index 0ca9fa9e9..c46d02c87 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -738,7 +738,7 @@ const device_t keyboard_pc_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t keyboard_pc82_device = { @@ -748,7 +748,7 @@ const device_t keyboard_pc82_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t keyboard_xt_device = { @@ -758,7 +758,7 @@ const device_t keyboard_xt_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t keyboard_xt86_device = { @@ -768,7 +768,7 @@ const device_t keyboard_xt86_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t keyboard_xt_compaq_device = { @@ -778,7 +778,7 @@ const device_t keyboard_xt_compaq_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t keyboard_tandy_device = { @@ -788,7 +788,7 @@ const device_t keyboard_tandy_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t keyboard_xt_t1x00_device = { @@ -798,7 +798,7 @@ const device_t keyboard_xt_t1x00_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; #if defined(DEV_BRANCH) && defined(USE_LASERXT) @@ -809,6 +809,6 @@ const device_t keyboard_xt_lxt3_device = { kbd_init, kbd_close, kbd_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; #endif diff --git a/src/device/mouse.c b/src/device/mouse.c index 7eb3cd8f0..1bab34dd1 100644 --- a/src/device/mouse.c +++ b/src/device/mouse.c @@ -47,14 +47,14 @@ static const device_t mouse_none_device = { "None", 0, MOUSE_TYPE_NONE, NULL, NULL, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; static const device_t mouse_internal_device = { "Internal Mouse", 0, MOUSE_TYPE_INTERNAL, NULL, NULL, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -172,9 +172,9 @@ mouse_process(void) mouse_poll(); - if ((mouse_dev_poll != NULL) || (mouse_curr->available != NULL)) { - if (mouse_curr->available != NULL) - mouse_curr->available(mouse_x,mouse_y,mouse_z,mouse_buttons, mouse_priv); + if ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL)) { + if (mouse_curr->poll != NULL) + mouse_curr->poll(mouse_x,mouse_y,mouse_z,mouse_buttons, mouse_priv); else mouse_dev_poll(mouse_x,mouse_y,mouse_z,mouse_buttons, mouse_priv); diff --git a/src/device/mouse_bus.c b/src/device/mouse_bus.c index c2b4afad7..86f456981 100644 --- a/src/device/mouse_bus.c +++ b/src/device/mouse_bus.c @@ -696,7 +696,7 @@ bm_init(const device_t *info) static const device_config_t lt_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x23c, + "base", "Address", CONFIG_HEX16, "", 0x23c, "", { 0 }, { { "0x230", 0x230 @@ -716,7 +716,7 @@ static const device_config_t lt_config[] = { } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, { + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 }, @@ -735,7 +735,7 @@ static const device_config_t lt_config[] = { } }, { - "hz", "Hz", CONFIG_SELECTION, "", 45, { + "hz", "Hz", CONFIG_SELECTION, "", 45, "", { 0 }, { { "Non-timed (original)", 0 }, @@ -754,7 +754,7 @@ static const device_config_t lt_config[] = { } }, { - "buttons", "Buttons", CONFIG_SELECTION, "", 2, { + "buttons", "Buttons", CONFIG_SELECTION, "", 2, "", { 0 }, { { "Two", 2 }, @@ -774,7 +774,7 @@ static const device_config_t lt_config[] = { static const device_config_t ms_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x23c, + "base", "Address", CONFIG_HEX16, "", 0x23c, "", { 0 }, { { "0x230", 0x230 @@ -794,7 +794,7 @@ static const device_config_t ms_config[] = { } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, { + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 }, @@ -813,7 +813,7 @@ static const device_config_t ms_config[] = { } }, { - "buttons", "Buttons", CONFIG_SELECTION, "", 2, { + "buttons", "Buttons", CONFIG_SELECTION, "", 2, "", { 0 }, { { "Two", 2 }, @@ -836,7 +836,7 @@ const device_t mouse_logibus_device = { DEVICE_ISA, MOUSE_TYPE_LOGIBUS, bm_init, bm_close, NULL, - bm_poll, NULL, NULL, + { .poll = bm_poll }, NULL, NULL, lt_config }; @@ -845,7 +845,7 @@ const device_t mouse_logibus_onboard_device = { DEVICE_ISA, MOUSE_TYPE_LOGIBUS | MOUSE_TYPE_ONBOARD, bm_init, bm_close, NULL, - bm_poll, NULL, NULL + { .poll = bm_poll }, NULL, NULL }; const device_t mouse_msinport_device = { @@ -853,6 +853,6 @@ const device_t mouse_msinport_device = { DEVICE_ISA, MOUSE_TYPE_INPORT, bm_init, bm_close, NULL, - bm_poll, NULL, NULL, + { .poll = bm_poll }, NULL, NULL, ms_config }; diff --git a/src/device/mouse_ps2.c b/src/device/mouse_ps2.c index 1ce118214..b31ffdd52 100644 --- a/src/device/mouse_ps2.c +++ b/src/device/mouse_ps2.c @@ -325,7 +325,7 @@ ps2_close(void *priv) static const device_config_t ps2_config[] = { { - "buttons", "Buttons", CONFIG_SELECTION, "", 2, { + "buttons", "Buttons", CONFIG_SELECTION, "", 2, "", { 0 }, { { "Two", 2 }, @@ -351,6 +351,6 @@ const device_t mouse_ps2_device = { DEVICE_PS2, MOUSE_TYPE_PS2, mouse_ps2_init, ps2_close, NULL, - ps2_poll, NULL, NULL, + { .poll = ps2_poll }, NULL, NULL, ps2_config }; diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index b89595f28..5ae1cd36b 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -832,7 +832,7 @@ sermouse_init(const device_t *info) static const device_config_t mssermouse_config[] = { { - "port", "Serial Port", CONFIG_SELECTION, "", 0, { + "port", "Serial Port", CONFIG_SELECTION, "", 0, "", { 0 }, { { "COM1", 0 }, @@ -845,7 +845,7 @@ static const device_config_t mssermouse_config[] = { } }, { - "buttons", "Buttons", CONFIG_SELECTION, "", 2, { + "buttons", "Buttons", CONFIG_SELECTION, "", 2, "", { 0 }, { { "Two", 2 }, @@ -868,7 +868,7 @@ static const device_config_t mssermouse_config[] = { static const device_config_t ltsermouse_config[] = { { - "port", "Serial Port", CONFIG_SELECTION, "", 0, { + "port", "Serial Port", CONFIG_SELECTION, "", 0, "", { 0 }, { { "COM1", 0 }, @@ -881,7 +881,7 @@ static const device_config_t ltsermouse_config[] = { } }, { - "buttons", "Buttons", CONFIG_SELECTION, "", 2, { + "buttons", "Buttons", CONFIG_SELECTION, "", 2, "", { 0 }, { { "Two", 2 }, @@ -904,7 +904,7 @@ const device_t mouse_mssystems_device = { 0, MOUSE_TYPE_MSYSTEMS, sermouse_init, sermouse_close, NULL, - sermouse_poll, sermouse_speed_changed, NULL, + { .poll = sermouse_poll }, sermouse_speed_changed, NULL, mssermouse_config }; @@ -913,7 +913,7 @@ const device_t mouse_msserial_device = { 0, 0, sermouse_init, sermouse_close, NULL, - sermouse_poll, sermouse_speed_changed, NULL, + { .poll = sermouse_poll }, sermouse_speed_changed, NULL, mssermouse_config }; @@ -922,6 +922,6 @@ const device_t mouse_ltserial_device = { 0, 1, sermouse_init, sermouse_close, NULL, - sermouse_poll, sermouse_speed_changed, NULL, + { .poll = sermouse_poll }, sermouse_speed_changed, NULL, ltsermouse_config }; diff --git a/src/device/pci_bridge.c b/src/device/pci_bridge.c index 53e64f989..5b846d986 100644 --- a/src/device/pci_bridge.c +++ b/src/device/pci_bridge.c @@ -41,6 +41,7 @@ #define AGP_BRIDGE_VIA_691 0x11068691 #define AGP_BRIDGE_VIA_8601 0x11068601 +#define AGP_BRIDGE_INTEL(x) (((x) >> 16) == 0x8086) #define AGP_BRIDGE_VIA(x) (((x) >> 16) == 0x1106) #define AGP_BRIDGE(x) ((x) >= AGP_BRIDGE_VIA_597) @@ -88,19 +89,36 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv) switch (addr) { case 0x00: case 0x01: case 0x02: case 0x03: - case 0x06: case 0x07: case 0x08: case 0x09: - case 0x0a: case 0x0b: case 0x0e: case 0x1e: - case 0x1f: case 0x34: case 0x3d: case 0x67: - case 0xdc: case 0xdd: case 0xde: case 0xdf: - case 0xe0: case 0xe1: case 0xe2: case 0xe3: + case 0x06: case 0x08: case 0x09: case 0x0a: + case 0x0b: case 0x0e: case 0x1e: case 0x34: + case 0x3d: case 0x67: case 0xdc: case 0xdd: + case 0xde: case 0xdf: case 0xe0: case 0xe1: + case 0xe2: case 0xe3: return; case 0x04: - val &= 0x67; + if (AGP_BRIDGE_INTEL(dev->local)) { + if (dev->local == AGP_BRIDGE_INTEL_440BX) + val &= 0x1f; + } else + val &= 0x67; break; case 0x05: - val &= 0x03; + if (AGP_BRIDGE_INTEL(dev->local)) + val &= 0x01; + else + val &= 0x03; + break; + + case 0x07: + if (dev->local == AGP_BRIDGE_INTEL_440LX) + dev->regs[addr] &= ~(val & 0x40); + return; + + case 0x0d: + if (AGP_BRIDGE_INTEL(dev->local)) + val &= 0xf8; break; case 0x18: @@ -115,6 +133,16 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv) pci_remap_bus(dev->bus_index, val); break; + case 0x1f: + if (AGP_BRIDGE_INTEL(dev->local)) { + if (dev->local == AGP_BRIDGE_INTEL_440LX) + dev->regs[addr] &= ~(val & 0xf1); + else if ((dev->local == AGP_BRIDGE_INTEL_440BX) || + (dev->local == AGP_BRIDGE_INTEL_440GX)) + dev->regs[addr] &= ~(val & 0xf0); + } + return; + case 0x1c: case 0x1d: case 0x20: case 0x22: case 0x24: case 0x26: val &= 0xf0; @@ -123,16 +151,22 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv) case 0x3e: if (AGP_BRIDGE_VIA(dev->local)) val &= 0x0c; - else if (AGP_BRIDGE(dev->local)) - val &= 0x0f; + else if (AGP_BRIDGE(dev->local)) { + if ((dev->local == AGP_BRIDGE_INTEL_440BX) || + (dev->local == AGP_BRIDGE_INTEL_440GX)) + val &= 0xed; + else + val &= 0x0f; + } else if (dev->local == PCI_BRIDGE_DEC_21150) val &= 0xef; break; case 0x3f: - if (dev->local == AGP_BRIDGE_INTEL_440LX) - val &= 0x02; - else if (AGP_BRIDGE(dev->local)) + if (dev->local == AGP_BRIDGE_INTEL_440LX) { + dev->regs[addr] = ((dev->regs[addr] & 0x04) | (val & 0x02)) & ~(val & 0x04); + return; + } else if (AGP_BRIDGE(dev->local)) return; else if (dev->local == PCI_BRIDGE_DEC_21150) val &= 0x0f; @@ -282,7 +316,7 @@ pci_bridge_init(const device_t *info) pci_bridge_reset(dev); - dev->slot = pci_add_card(AGP_BRIDGE(dev->local) ? 0x01 : PCI_ADD_BRIDGE, pci_bridge_read, pci_bridge_write, dev); + dev->slot = pci_add_card(AGP_BRIDGE(dev->local) ? PCI_ADD_AGPBRIDGE : PCI_ADD_BRIDGE, pci_bridge_read, pci_bridge_write, dev); interrupt_count = sizeof(interrupts); interrupt_mask = interrupt_count - 1; for (i = 0; i < interrupt_count; i++) @@ -318,7 +352,7 @@ const device_t dec21150_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -333,7 +367,7 @@ const device_t i440lx_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -347,7 +381,7 @@ const device_t i440bx_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -361,7 +395,7 @@ const device_t i440gx_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -375,7 +409,7 @@ const device_t via_vp3_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -389,7 +423,7 @@ const device_t via_mvp3_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -403,7 +437,7 @@ const device_t via_apro_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL @@ -417,7 +451,7 @@ const device_t via_vt8601_agp_device = pci_bridge_init, NULL, pci_bridge_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/device/phoenix_486_jumper.c b/src/device/phoenix_486_jumper.c index 4383a828d..3af30a257 100644 --- a/src/device/phoenix_486_jumper.c +++ b/src/device/phoenix_486_jumper.c @@ -102,6 +102,6 @@ const device_t phoenix_486_jumper_device = { 0, 0, phoenix_486_jumper_init, phoenix_486_jumper_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/postcard.c b/src/device/postcard.c index 7212a01bc..c00af66cf 100644 --- a/src/device/postcard.c +++ b/src/device/postcard.c @@ -143,6 +143,6 @@ const device_t postcard_device = { DEVICE_ISA, 0, postcard_init, postcard_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/serial.c b/src/device/serial.c index d8bf13280..b331d4d99 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -739,7 +739,7 @@ const device_t i8250_device = { 0, SERIAL_8250, serial_init, serial_close, NULL, - NULL, serial_speed_changed, NULL, + { NULL }, serial_speed_changed, NULL, NULL }; @@ -748,7 +748,7 @@ const device_t i8250_pcjr_device = { DEVICE_PCJR, SERIAL_8250_PCJR, serial_init, serial_close, NULL, - NULL, serial_speed_changed, NULL, + { NULL }, serial_speed_changed, NULL, NULL }; @@ -757,7 +757,7 @@ const device_t ns16450_device = { 0, SERIAL_NS16450, serial_init, serial_close, NULL, - NULL, serial_speed_changed, NULL, + { NULL }, serial_speed_changed, NULL, NULL }; @@ -766,6 +766,6 @@ const device_t ns16550_device = { 0, SERIAL_NS16550, serial_init, serial_close, NULL, - NULL, serial_speed_changed, NULL, + { NULL }, serial_speed_changed, NULL, NULL }; diff --git a/src/device/smbus_piix4.c b/src/device/smbus_piix4.c index 131c5c126..f9b68f6d8 100644 --- a/src/device/smbus_piix4.c +++ b/src/device/smbus_piix4.c @@ -249,6 +249,6 @@ const device_t piix4_smbus_device = { DEVICE_AT, 0, smbus_piix4_init, smbus_piix4_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/device/vpc2007.c b/src/device/vpc2007.c index 7dd9ba1e0..4caf77fbb 100644 --- a/src/device/vpc2007.c +++ b/src/device/vpc2007.c @@ -181,6 +181,6 @@ const device_t vpc2007_device = { DEVICE_ISA, 0, vpc2007_init, vpc2007_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/disk/hdc.c b/src/disk/hdc.c index 86ea25fe4..816e5cef2 100644 --- a/src/disk/hdc.c +++ b/src/disk/hdc.c @@ -69,7 +69,7 @@ null_close(void *priv) static const device_t null_device = { "Null HDC", 0, 0, null_init, null_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; @@ -89,83 +89,37 @@ inthdc_close(void *priv) static const device_t inthdc_device = { "Internal controller", 0, 0, inthdc_init, inthdc_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; static const struct { - const char *name; const char *internal_name; const device_t *device; } controllers[] = { - { "None", "none", - &null_device }, - - { "Internal controller", "internal", - &inthdc_device }, - - { "[ISA] [MFM] IBM PC Fixed Disk Adapter", "st506_xt", - &st506_xt_xebec_device }, - - { "[ISA] [MFM] DTC-5150X Fixed Disk Adapter", "st506_xt_dtc5150x", - &st506_xt_dtc5150x_device }, - - { "[ISA] [MFM] ST-11M Fixed Disk Adapter", "st506_xt_st11_m", - &st506_xt_st11_m_device }, - - { "[ISA] [MFM] WD1002A-WX1 Fixed Disk Adapter", "st506_xt_wd1002a_wx1", - &st506_xt_wd1002a_wx1_device }, - - { "[ISA] [MFM/RLL] IBM PC/AT Fixed Disk Adapter", "st506_at", - &st506_at_wd1003_device }, - - { "[ISA] [RLL] ST-11R Fixed Disk Adapter", "st506_xt_st11_r", - &st506_xt_st11_r_device }, - - { "[ISA] [RLL] WD1002A-27X Fixed Disk Adapter", "st506_xt_wd1002a_27x", - &st506_xt_wd1002a_27x_device }, - - { "[ISA] [ESDI] PC/AT ESDI Fixed Disk Adapter", "esdi_at", - &esdi_at_wd1007vse1_device }, - - { "[ISA] [IDE] PC/AT IDE Adapter", "ide_isa", - &ide_isa_device }, - - { "[ISA] [IDE] PC/AT IDE Adapter (Dual-Channel)", "ide_isa_2ch", - &ide_isa_2ch_device }, - - { "[ISA] [IDE] PC/AT XTIDE", "xtide_at", - &xtide_at_device }, - - { "[ISA] [IDE] PS/2 AT XTIDE (1.1.5)", "xtide_at_ps2", - &xtide_at_ps2_device }, - - { "[ISA] [IDE] WDXT-150 IDE (XTA) Adapter", "xta_wdxt150", - &xta_wdxt150_device }, - - { "[ISA] [XT IDE] Acculogic XT IDE", "xtide_acculogic", - &xtide_acculogic_device }, - - { "[ISA] [XT IDE] PC/XT XTIDE", "xtide", - &xtide_device }, - - { "[MCA] [ESDI] IBM PS/2 ESDI Fixed Disk Adapter","esdi_mca", - &esdi_ps2_device }, - - { "[PCI] [IDE] PCI IDE Adapter", "ide_pci", - &ide_pci_device }, - - { "[PCI] [IDE] PCI IDE Adapter (Dual-Channel)", "ide_pci_2ch", - &ide_pci_2ch_device }, - - { "[VLB] [IDE] PC/AT IDE Adapter", "vlb_isa", - &ide_vlb_device }, - - { "[VLB] [IDE] PC/AT IDE Adapter (Dual-Channel)", "vlb_isa_2ch", - &ide_vlb_2ch_device }, - - { "", "", - NULL } + { "none", &null_device }, + { "internal", &inthdc_device }, + { "st506_xt", &st506_xt_xebec_device }, + { "st506_xt_dtc5150x", &st506_xt_dtc5150x_device }, + { "st506_xt_st11_m", &st506_xt_st11_m_device }, + { "st506_xt_wd1002a_wx1", &st506_xt_wd1002a_wx1_device }, + { "st506_at", &st506_at_wd1003_device }, + { "st506_xt_st11_r", &st506_xt_st11_r_device }, + { "st506_xt_wd1002a_27x", &st506_xt_wd1002a_27x_device }, + { "esdi_at", &esdi_at_wd1007vse1_device }, + { "ide_isa", &ide_isa_device }, + { "ide_isa_2ch", &ide_isa_2ch_device }, + { "xtide_at", &xtide_at_device }, + { "xtide_at_ps2", &xtide_at_ps2_device }, + { "xta_wdxt150", &xta_wdxt150_device }, + { "xtide_acculogic", &xtide_acculogic_device }, + { "xtide", &xtide_device }, + { "esdi_mca", &esdi_ps2_device }, + { "ide_pci", &ide_pci_device }, + { "ide_pci_2ch", &ide_pci_2ch_device }, + { "vlb_isa", &ide_vlb_device }, + { "vlb_isa_2ch", &ide_vlb_2ch_device }, + { "", NULL } }; @@ -199,13 +153,6 @@ hdc_reset(void) } -char * -hdc_get_name(int hdc) -{ - return((char *) controllers[hdc].name); -} - - char * hdc_get_internal_name(int hdc) { @@ -213,22 +160,6 @@ hdc_get_internal_name(int hdc) } -int -hdc_get_id(char *s) -{ - int c = 0; - - while (strlen((char *) controllers[c].name)) - { - if (!strcmp((char *) controllers[c].name, s)) - return c; - c++; - } - - return 0; -} - - int hdc_get_from_internal_name(char *s) { diff --git a/src/disk/hdc_esdi_at.c b/src/disk/hdc_esdi_at.c index c8b738c38..a301cb834 100644 --- a/src/disk/hdc_esdi_at.c +++ b/src/disk/hdc_esdi_at.c @@ -849,7 +849,7 @@ const device_t esdi_at_wd1007vse1_device = { DEVICE_ISA | DEVICE_AT, 0, wd1007vse1_init, wd1007vse1_close, NULL, - wd1007vse1_available, + { wd1007vse1_available }, NULL, NULL, NULL }; diff --git a/src/disk/hdc_esdi_mca.c b/src/disk/hdc_esdi_mca.c index a675b6abf..1e1fb19e2 100644 --- a/src/disk/hdc_esdi_mca.c +++ b/src/disk/hdc_esdi_mca.c @@ -1180,8 +1180,8 @@ esdi_available(void) const device_t esdi_ps2_device = { - "IBM ESDI Fixed Disk Adapter (MCA)", + "IBM PS/2 ESDI Fixed Disk Adapter (MCA)", DEVICE_MCA, 0, esdi_init, esdi_close, NULL, - esdi_available, NULL, NULL, NULL + { esdi_available }, NULL, NULL, NULL }; diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 1198198cc..b2a708414 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -886,7 +886,7 @@ ide_set_board_callback(uint8_t board, double callback) { ide_board_t *dev = ide_boards[board]; - ide_log("ide_set_callback(%i)\n", board); + ide_log("ide_set_board_callback(%i)\n", board); if (!dev) { ide_log("Set board callback failed\n"); @@ -1340,7 +1340,7 @@ ide_write_devctl(uint16_t addr, uint8_t val, void *priv) ide->reset = 1; ide_set_callback(ide, 0.0); ide_set_callback(ide_other, 0.0); - ide_set_board_callback(ide->board, 500 * IDE_TIME); + ide_set_board_callback(ide->board, 1000.4); /* 1 ms + 400 ns, per the specification */ } else { /* Currently active device is 1, simply reset the status and the active device. */ dev_reset(ide); @@ -2848,7 +2848,7 @@ const device_t ide_isa_device = { DEVICE_ISA | DEVICE_AT, 0, ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t ide_isa_2ch_device = { @@ -2856,7 +2856,7 @@ const device_t ide_isa_2ch_device = { DEVICE_ISA | DEVICE_AT, 1, ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t ide_vlb_device = { @@ -2864,7 +2864,7 @@ const device_t ide_vlb_device = { DEVICE_VLB | DEVICE_AT, 2, ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t ide_vlb_2ch_device = { @@ -2872,7 +2872,7 @@ const device_t ide_vlb_2ch_device = { DEVICE_VLB | DEVICE_AT, 3, ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t ide_pci_device = { @@ -2880,7 +2880,7 @@ const device_t ide_pci_device = { DEVICE_PCI | DEVICE_AT, 4, ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t ide_pci_2ch_device = { @@ -2888,13 +2888,13 @@ const device_t ide_pci_2ch_device = { DEVICE_PCI | DEVICE_AT, 5, ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; static const device_config_t ide_ter_config[] = { { - "irq", "IRQ", CONFIG_SELECTION, "", 10, + "irq", "IRQ", CONFIG_SELECTION, "", 10, "", { 0 }, { { "IRQ 2", 2 @@ -2936,7 +2936,7 @@ static const device_config_t ide_ter_config[] = static const device_config_t ide_qua_config[] = { { - "irq", "IRQ", CONFIG_SELECTION, "", 11, + "irq", "IRQ", CONFIG_SELECTION, "", 11, "", { 0 }, { { "IRQ 2", 2 @@ -2980,7 +2980,7 @@ const device_t ide_ter_device = { DEVICE_AT, 0, ide_ter_init, ide_ter_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ide_ter_config }; @@ -2989,6 +2989,6 @@ const device_t ide_qua_device = { DEVICE_AT, 0, ide_qua_init, ide_qua_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ide_qua_config }; diff --git a/src/disk/hdc_ide_cmd640.c b/src/disk/hdc_ide_cmd640.c index 1613dbab0..53500f52a 100644 --- a/src/disk/hdc_ide_cmd640.c +++ b/src/disk/hdc_ide_cmd640.c @@ -442,7 +442,7 @@ const device_t ide_cmd640_vlb_device = { DEVICE_VLB, 0x0078, cmd640_init, cmd640_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -451,7 +451,7 @@ const device_t ide_cmd640_vlb_178_device = { DEVICE_VLB, 0x0178, cmd640_init, cmd640_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -460,7 +460,7 @@ const device_t ide_cmd640_pci_device = { DEVICE_PCI, 0x0a, cmd640_init, cmd640_close, cmd640_reset, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -469,7 +469,7 @@ const device_t ide_cmd640_pci_legacy_only_device = { DEVICE_PCI, 0x00, cmd640_init, cmd640_close, cmd640_reset, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -478,6 +478,6 @@ const device_t ide_cmd640_pci_single_channel_device = { DEVICE_PCI, 0x2000a, cmd640_init, cmd640_close, cmd640_reset, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/disk/hdc_ide_opti611.c b/src/disk/hdc_ide_opti611.c index 19c298396..73a52a723 100644 --- a/src/disk/hdc_ide_opti611.c +++ b/src/disk/hdc_ide_opti611.c @@ -317,6 +317,6 @@ const device_t ide_opti611_vlb_device = { 0, 0, opti611_init, opti611_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/disk/hdc_ide_sff8038i.c b/src/disk/hdc_ide_sff8038i.c index cde2f1d8a..97a77388c 100644 --- a/src/disk/hdc_ide_sff8038i.c +++ b/src/disk/hdc_ide_sff8038i.c @@ -524,7 +524,7 @@ const device_t sff8038i_device = sff_init, sff_close, sff_reset, - NULL, + { NULL }, NULL, NULL, NULL diff --git a/src/disk/hdc_st506_at.c b/src/disk/hdc_st506_at.c index 2e30b1e52..4ac81314d 100644 --- a/src/disk/hdc_st506_at.c +++ b/src/disk/hdc_st506_at.c @@ -773,5 +773,5 @@ const device_t st506_at_wd1003_device = { DEVICE_ISA | DEVICE_AT, 0, mfm_init, mfm_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; diff --git a/src/disk/hdc_st506_xt.c b/src/disk/hdc_st506_xt.c index 15e1c2a70..5862588c0 100644 --- a/src/disk/hdc_st506_xt.c +++ b/src/disk/hdc_st506_xt.c @@ -1617,7 +1617,7 @@ wd1002a_27x_available(void) static const device_config_t dtc_config[] = { { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, "", { 0 }, { { "Disabled", 0x00000 @@ -1646,7 +1646,7 @@ static const device_config_t dtc_config[] = { static const device_config_t st11_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x0320, + "base", "Address", CONFIG_HEX16, "", 0x0320, "", { 0 }, { { "320H", 0x0320 @@ -1666,7 +1666,7 @@ static const device_config_t st11_config[] = { } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 @@ -1680,7 +1680,7 @@ static const device_config_t st11_config[] = { } }, { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, "", { 0 }, { { "Disabled", 0x00000 @@ -1703,7 +1703,7 @@ static const device_config_t st11_config[] = { } }, { - "revision", "Board Revision", CONFIG_SELECTION, "", 19, + "revision", "Board Revision", CONFIG_SELECTION, "", 19, "", { 0 }, { { "Rev. 05 (v1.7)", 5 @@ -1723,7 +1723,7 @@ static const device_config_t st11_config[] = { static const device_config_t wd_config[] = { { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, "", { 0 }, { { "Disabled", 0x00000 @@ -1737,7 +1737,7 @@ static const device_config_t wd_config[] = { } }, { - "base", "Address", CONFIG_HEX16, "", 0x0320, + "base", "Address", CONFIG_HEX16, "", 0x0320, "", { 0 }, { { "320H", 0x0320 @@ -1751,7 +1751,7 @@ static const device_config_t wd_config[] = { } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 @@ -1771,7 +1771,7 @@ static const device_config_t wd_config[] = { static const device_config_t wd_rll_config[] = { { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xc8000, "", { 0 }, { { "Disabled", 0x00000 @@ -1785,7 +1785,7 @@ static const device_config_t wd_rll_config[] = { } }, { - "base", "Address", CONFIG_HEX16, "", 0x0320, + "base", "Address", CONFIG_HEX16, "", 0x0320, "", { 0 }, { { "320H", 0x0320 @@ -1799,7 +1799,7 @@ static const device_config_t wd_rll_config[] = { } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 @@ -1813,7 +1813,7 @@ static const device_config_t wd_rll_config[] = { } }, { - "translate", "Translate 26 -> 17", CONFIG_SELECTION, "", 0, + "translate", "Translate 26 -> 17", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Off", 0 @@ -1837,7 +1837,7 @@ const device_t st506_xt_xebec_device = { DEVICE_ISA, (HDD_BUS_MFM << 8) | 0, st506_init, st506_close, NULL, - xebec_available, + { xebec_available }, NULL, NULL, NULL }; @@ -1847,7 +1847,7 @@ const device_t st506_xt_dtc5150x_device = { DEVICE_ISA, (HDD_BUS_MFM << 8) | 1, st506_init, st506_close, NULL, - dtc5150x_available, + { dtc5150x_available }, NULL, NULL, dtc_config }; @@ -1857,7 +1857,7 @@ const device_t st506_xt_st11_m_device = { DEVICE_ISA, (HDD_BUS_MFM << 8) | 11, st506_init, st506_close, NULL, - st11_m_available, + { st11_m_available }, NULL, NULL, st11_config }; @@ -1867,7 +1867,7 @@ const device_t st506_xt_st11_r_device = { DEVICE_ISA, (HDD_BUS_MFM << 8) | 12, st506_init, st506_close, NULL, - st11_r_available, + { st11_r_available }, NULL, NULL, st11_config }; @@ -1877,7 +1877,7 @@ const device_t st506_xt_wd1002a_wx1_device = { DEVICE_ISA, (HDD_BUS_MFM << 8) | 21, st506_init, st506_close, NULL, - wd1002a_wx1_available, + { wd1002a_wx1_available }, NULL, NULL, wd_config }; @@ -1887,7 +1887,7 @@ const device_t st506_xt_wd1002a_27x_device = { DEVICE_ISA, (HDD_BUS_MFM << 8) | 22, st506_init, st506_close, NULL, - wd1002a_27x_available, + { wd1002a_27x_available }, NULL, NULL, wd_rll_config }; diff --git a/src/disk/hdc_xta.c b/src/disk/hdc_xta.c index 18d66d898..a585f7226 100644 --- a/src/disk/hdc_xta.c +++ b/src/disk/hdc_xta.c @@ -1104,7 +1104,7 @@ xta_close(void *priv) static const device_config_t wdxt150_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x0320, /*W2*/ + "base", "Address", CONFIG_HEX16, "", 0x0320, "", { 0 }, /*W2*/ { { "320H", 0x0320 @@ -1118,7 +1118,7 @@ static const device_config_t wdxt150_config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, /*W3*/ + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, /*W3*/ { { "IRQ 5", 5 @@ -1132,7 +1132,7 @@ static const device_config_t wdxt150_config[] = { }, }, { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xc8000, /*W1*/ + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xc8000, "", { 0 }, /*W1*/ { { "C800H", 0xc8000 @@ -1156,7 +1156,7 @@ const device_t xta_wdxt150_device = { DEVICE_ISA, 0, xta_init, xta_close, NULL, - xta_available, NULL, NULL, + { xta_available }, NULL, NULL, wdxt150_config }; @@ -1166,6 +1166,6 @@ const device_t xta_hd20_device = { DEVICE_ISA, 1, xta_init, xta_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/disk/hdc_xtide.c b/src/disk/hdc_xtide.c index c9497e120..7dc6ec095 100644 --- a/src/disk/hdc_xtide.c +++ b/src/disk/hdc_xtide.c @@ -248,37 +248,37 @@ xtide_at_close(void *priv) const device_t xtide_device = { - "XTIDE", + "PC/XT XTIDE", DEVICE_ISA, 0, xtide_init, xtide_close, NULL, - xtide_available, NULL, NULL, + { xtide_available }, NULL, NULL, NULL }; const device_t xtide_at_device = { - "XTIDE (AT)", + "PC/AT XTIDE", DEVICE_ISA | DEVICE_AT, 0, xtide_at_init, xtide_at_close, NULL, - xtide_at_available, NULL, NULL, + { xtide_at_available }, NULL, NULL, NULL }; const device_t xtide_acculogic_device = { - "XTIDE (Acculogic)", + "Acculogic XT IDE", DEVICE_ISA, 0, xtide_acculogic_init, xtide_close, NULL, - xtide_acculogic_available, NULL, NULL, + { xtide_acculogic_available }, NULL, NULL, NULL }; const device_t xtide_at_ps2_device = { - "XTIDE (AT) (1.1.5)", + "PS/2 AT XTIDE (1.1.5)", DEVICE_AT, 0, xtide_at_ps2_init, xtide_at_close, NULL, - xtide_at_ps2_available, NULL, NULL, + { xtide_at_ps2_available }, NULL, NULL, NULL }; diff --git a/src/dma.c b/src/dma.c index 3e7ac0152..55338e9e4 100644 --- a/src/dma.c +++ b/src/dma.c @@ -865,6 +865,9 @@ dma_page_write(uint16_t addr, uint8_t val, void *priv) { uint8_t convert[8] = CHANNELS; + if ((addr == 0x84) && cpu_use_dynarec) + update_tsc(); + addr &= 0x0f; dmaregs[2][addr] = val; diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 39296c406..82191881c 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -102,19 +102,19 @@ fdc_log(const char *fmt, ...) typedef const struct { - const char *name; const char *internal_name; const device_t *device; } fdc_cards_t; /* All emulated machines have at least one integrated FDC controller */ static fdc_cards_t fdc_cards[] = { - { "Internal controller", "internal", NULL, }, - { "DTK PII-151B", "dtk_pii151b", &fdc_pii151b_device, }, - { "DTK PII-158B", "dtk_pii158b", &fdc_pii158b_device, }, - { "", "", NULL, }, + { "internal", NULL }, + { "dtk_pii151b", &fdc_pii151b_device }, + { "dtk_pii158b", &fdc_pii158b_device }, + { "", NULL }, }; + int fdc_card_available(int card) { @@ -125,13 +125,6 @@ fdc_card_available(int card) } -char * -fdc_card_getname(int card) -{ - return((char *) fdc_cards[card].name); -} - - const device_t * fdc_card_getdevice(int card) { @@ -2336,7 +2329,7 @@ const device_t fdc_xt_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_xt_t1x00_device = { @@ -2346,7 +2339,7 @@ const device_t fdc_xt_t1x00_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_xt_amstrad_device = { @@ -2356,7 +2349,7 @@ const device_t fdc_xt_amstrad_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; @@ -2367,7 +2360,7 @@ const device_t fdc_pcjr_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_at_device = { @@ -2377,7 +2370,7 @@ const device_t fdc_at_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_at_actlow_device = { @@ -2387,7 +2380,7 @@ const device_t fdc_at_actlow_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_at_ps1_device = { @@ -2397,7 +2390,7 @@ const device_t fdc_at_ps1_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_at_smc_device = { @@ -2407,7 +2400,7 @@ const device_t fdc_at_smc_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_at_winbond_device = { @@ -2417,7 +2410,7 @@ const device_t fdc_at_winbond_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_at_nsc_device = { @@ -2427,7 +2420,7 @@ const device_t fdc_at_nsc_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; const device_t fdc_dp8473_device = { @@ -2437,5 +2430,5 @@ const device_t fdc_dp8473_device = { fdc_init, fdc_close, fdc_reset, - NULL, NULL, NULL + { NULL }, NULL, NULL }; diff --git a/src/floppy/fdc_pii15xb.c b/src/floppy/fdc_pii15xb.c index 55dd55460..b85738129 100644 --- a/src/floppy/fdc_pii15xb.c +++ b/src/floppy/fdc_pii15xb.c @@ -165,7 +165,7 @@ static int pii_158_available(void) static const device_config_t pii_config[] = { { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0x0ce000, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0x0ce000, "", { 0 }, { { "Disabled", 0 @@ -194,7 +194,7 @@ const device_t fdc_pii151b_device = { DEVICE_ISA, 151, pii_init, pii_close, NULL, - pii_151b_available, NULL, NULL, + { pii_151b_available }, NULL, NULL, pii_config }; @@ -203,6 +203,6 @@ const device_t fdc_pii158b_device = { DEVICE_ISA, 158, pii_init, pii_close, NULL, - pii_158_available, NULL, NULL, + { pii_158_available }, NULL, NULL, pii_config }; diff --git a/src/game/gameport.c b/src/game/gameport.c index b9b418eeb..d1fc35492 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -90,7 +90,7 @@ static const joystick_if_t *joystick_list[] = { &joystick_standard_4button, &joystick_standard_6button, &joystick_standard_8button, - &joystick_4axis_4button, + &joystick_4axis_4button, &joystick_ch_flightstick_pro, &joystick_sw_pad, &joystick_tm_fcs, @@ -319,7 +319,7 @@ const device_t gameport_device = { 0, 0, gameport_init, gameport_close, - NULL, NULL, NULL, + NULL, { NULL }, NULL, NULL }; @@ -328,6 +328,6 @@ const device_t gameport_201_device = { 0, 0, gameport_201_init, gameport_close, - NULL, NULL, NULL, + NULL, { NULL }, NULL, NULL }; diff --git a/src/include/86box/acpi.h b/src/include/86box/acpi.h index affc34264..ab5c1e9f2 100644 --- a/src/include/86box/acpi.h +++ b/src/include/86box/acpi.h @@ -75,7 +75,8 @@ typedef struct typedef struct { acpi_regs_t regs; - uint8_t gporeg_default[4]; + uint8_t gpireg2_default, pad[3], + gporeg_default[4]; uint16_t io_base, aux_io_base; int vendor, slot, irq_mode, @@ -102,6 +103,7 @@ extern void acpi_set_slot(acpi_t *dev, int slot); extern void acpi_set_irq_mode(acpi_t *dev, int irq_mode); extern void acpi_set_irq_pin(acpi_t *dev, int irq_pin); extern void acpi_set_irq_line(acpi_t *dev, int irq_line); +extern void acpi_set_gpireg2_default(acpi_t *dev, uint8_t gpireg2_default); extern void acpi_set_nvr(acpi_t *dev, nvr_t *nvr); #ifdef __cplusplus diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 24b3c6ed2..a5752057a 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -90,11 +90,15 @@ typedef struct { } cdrom_ops_t; typedef struct cdrom { - uint8_t id, - res, res0, /* Reserved for other ID's. */ - res1, - ide_channel, scsi_device_id, - bus_type, /* 0 = ATAPI, 1 = SCSI */ + uint8_t id; + + union { + uint8_t res, res0, /* Reserved for other ID's. */ + res1, + ide_channel, scsi_device_id; + }; + + uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */ bus_mode, /* Bit 0 = PIO suported; Bit 1 = DMA supportd. */ cd_status, /* Struct variable reserved for diff --git a/src/include/86box/device.h b/src/include/86box/device.h index ecfb5bc59..4226eee81 100644 --- a/src/include/86box/device.h +++ b/src/include/86box/device.h @@ -55,16 +55,17 @@ enum { DEVICE_NOT_WORKING = 1, /* does not currently work correctly and will be disabled in a release build */ - DEVICE_PCJR = 2, /* requires an IBM PCjr */ - DEVICE_AT = 4, /* requires an AT-compatible system */ - DEVICE_PS2 = 8, /* requires a PS/1 or PS/2 system */ - DEVICE_ISA = 0x10, /* requires the ISA bus */ - DEVICE_CBUS = 0x20, /* requires the C-BUS bus */ - DEVICE_MCA = 0x40, /* requires the MCA bus */ - DEVICE_EISA = 0x80, /* requires the EISA bus */ - DEVICE_VLB = 0x100, /* requires the PCI bus */ - DEVICE_PCI = 0x200, /* requires the VLB bus */ - DEVICE_AGP = 0x400 /* requires the AGP bus */ + DEVICE_LPT = 2, /* requires a parallel port */ + DEVICE_PCJR = 4, /* requires an IBM PCjr */ + DEVICE_AT = 8, /* requires an AT-compatible system */ + DEVICE_PS2 = 0x10, /* requires a PS/1 or PS/2 system */ + DEVICE_ISA = 0x20, /* requires the ISA bus */ + DEVICE_CBUS = 0x40, /* requires the C-BUS bus */ + DEVICE_MCA = 0x80, /* requires the MCA bus */ + DEVICE_EISA = 0x100, /* requires the EISA bus */ + DEVICE_VLB = 0x200, /* requires the PCI bus */ + DEVICE_PCI = 0x400, /* requires the VLB bus */ + DEVICE_AGP = 0x800 /* requires the AGP bus */ }; @@ -74,14 +75,9 @@ typedef struct { } device_config_selection_t; typedef struct { - const char *description; - const char *extensions[5]; -} device_config_file_filter_t; - -typedef struct { - int min; - int max; - int step; + int16_t min; + int16_t max; + int16_t step; } device_config_spinner_t; typedef struct { @@ -90,9 +86,9 @@ typedef struct { int type; const char *default_string; int default_int; - device_config_selection_t selection[16]; - device_config_file_filter_t file_filter[16]; + const char *file_filter; device_config_spinner_t spinner; + const device_config_selection_t selection[16]; } device_config_t; typedef struct _device_ { @@ -103,7 +99,11 @@ typedef struct _device_ { void *(*init)(const struct _device_ *); void (*close)(void *priv); void (*reset)(void *priv); - int (*available)(/*void*/); + union { + int (*available)(void); + int (*poll)(int x, int y, int z, int b, void *priv); + void (*register_pci_slot)(int device, int type, int inta, int intb, int intc, int intd, void *priv); + }; void (*speed_changed)(void *priv); void (*force_redraw)(void *priv); @@ -138,8 +138,11 @@ extern void device_reset_all(void); extern void device_reset_all_pci(void); extern void *device_get_priv(const device_t *d); extern int device_available(const device_t *d); +extern int device_poll(const device_t *d, int x, int y, int z, int b); +extern void device_register_pci_slot(const device_t *d, int device, int type, int inta, int intb, int intc, int intd); extern void device_speed_changed(void); extern void device_force_redraw(void); +extern void device_get_name(const device_t *d, int bus, char *name); extern int device_is_valid(const device_t *, int machine_flags); diff --git a/src/include/86box/fdc_ext.h b/src/include/86box/fdc_ext.h index 1e10e4b7a..a9aa000f3 100644 --- a/src/include/86box/fdc_ext.h +++ b/src/include/86box/fdc_ext.h @@ -32,7 +32,6 @@ extern const device_t fdc_pii158b_device; extern void fdc_card_init(void); -extern char *fdc_card_getname(int card); extern char *fdc_card_get_internal_name(int card); extern int fdc_card_get_from_internal_name(char *s); extern const device_t *fdc_card_getdevice(int card); diff --git a/src/include/86box/hdc.h b/src/include/86box/hdc.h index 14bd1e5e7..25dcfe0d1 100644 --- a/src/include/86box/hdc.h +++ b/src/include/86box/hdc.h @@ -24,6 +24,7 @@ #define ESDI_NUM 2 /* 2 drives per controller supported */ #define XTA_NUM 2 /* 2 drives per controller supported */ #define IDE_NUM 10 /* 8 drives per AT IDE + 2 for XT IDE */ +#define ATAPI_NUM 8 /* 8 drives per AT IDE */ #define SCSI_NUM 16 /* theoretically the controller can have at * least 7 devices, with each device being * able to support 8 units, but hey... */ @@ -73,9 +74,7 @@ extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */ extern void hdc_init(void); extern void hdc_reset(void); -extern char *hdc_get_name(int hdc); extern char *hdc_get_internal_name(int hdc); -extern int hdc_get_id(char *s); extern int hdc_get_from_internal_name(char *s); extern int hdc_has_config(int hdc); extern const device_t *hdc_get_device(int hdc); diff --git a/src/include/86box/hdd.h b/src/include/86box/hdd.h index 4e991286a..4da0e190f 100644 --- a/src/include/86box/hdd.h +++ b/src/include/86box/hdd.h @@ -19,7 +19,7 @@ # define EMU_HDD_H -#define HDD_NUM 30 /* total of 30 images supported */ +#define HDD_NUM 40 /* total of 40 images supported */ /* Hard Disk bus types. */ @@ -76,11 +76,15 @@ enum { /* Define the virtual Hard Disk. */ typedef struct { uint8_t id; - uint8_t mfm_channel; /* Should rename and/or unionize */ - uint8_t esdi_channel; - uint8_t xta_channel; - uint8_t ide_channel; - uint8_t scsi_id; + union { + uint8_t channel; /* Needed for Settings to reduce the number of if's */ + + uint8_t mfm_channel; /* Should rename and/or unionize */ + uint8_t esdi_channel; + uint8_t xta_channel; + uint8_t ide_channel; + uint8_t scsi_id; + }; uint8_t bus, res; /* Reserved for bus mode */ uint8_t wp; /* Disk has been mounted READ-ONLY */ diff --git a/src/include/86box/isartc.h b/src/include/86box/isartc.h index 0d5147251..e2cb82b97 100644 --- a/src/include/86box/isartc.h +++ b/src/include/86box/isartc.h @@ -58,8 +58,7 @@ extern "C" { /* Functions. */ extern void isartc_reset(void); -extern char *isartc_get_name(int t); -extern char *isartc_get_internal_name(int t); +extern char *isartc_get_internal_name(int t); extern int isartc_get_from_internal_name(char *s); extern const device_t *isartc_get_device(int t); diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 88b29953d..3cb191f94 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -226,9 +226,7 @@ extern int machine_at_ibmatquadtel_init(const machine_t *); // IBM AT with Quadt extern int machine_at_ibmxt286_init(const machine_t *); -#if defined(DEV_BRANCH) && defined(USE_SIEMENS) extern int machine_at_siemens_init(const machine_t *); //Siemens PCD-2L. N82330 discrete machine. It segfaults in some places -#endif #if defined(DEV_BRANCH) && defined(USE_OPEN_AT) extern int machine_at_open_at_init(const machine_t *); @@ -372,14 +370,13 @@ extern int machine_at_endeavor_init(const machine_t *); extern int machine_at_zappa_init(const machine_t *); extern int machine_at_mb500n_init(const machine_t *); extern int machine_at_apollo_init(const machine_t *); -#if defined(DEV_BRANCH) && defined(USE_VECTRA54) extern int machine_at_vectra54_init(const machine_t *); -#endif extern int machine_at_powermate_v_init(const machine_t *); extern int machine_at_acerv30_init(const machine_t *); #ifdef EMU_DEVICE_H extern const device_t *at_endeavor_get_device(void); +#define at_vectra54_get_device at_endeavor_get_device extern const device_t *at_pb520r_get_device(void); extern const device_t *at_thor_get_device(void); #endif @@ -416,6 +413,9 @@ extern int machine_at_pb680_init(const machine_t *); extern int machine_at_nupro592_init(const machine_t *); extern int machine_at_tx97_init(const machine_t *); extern int machine_at_ym430tx_init(const machine_t *); +#if defined(DEV_BRANCH) && defined(NO_SIO) +extern int machine_at_an430tx_init(const machine_t *); +#endif extern int machine_at_mb540n_init(const machine_t *); extern int machine_at_p5mms98_init(const machine_t *); diff --git a/src/include/86box/midi.h b/src/include/86box/midi.h index a41f369da..5ff8b505e 100644 --- a/src/include/86box/midi.h +++ b/src/include/86box/midi.h @@ -14,22 +14,20 @@ extern void (*input_msg)(void *p, uint8_t *msg); extern int (*input_sysex)(void *p, uint8_t *buf, uint32_t len, int abort); extern void *midi_in_p; -int midi_device_available(int card); -int midi_in_device_available(int card); -char *midi_device_getname(int card); -char *midi_in_device_getname(int card); +extern int midi_device_available(int card); +extern int midi_in_device_available(int card); #ifdef EMU_DEVICE_H const device_t *midi_device_getdevice(int card); const device_t *midi_in_device_getdevice(int card); #endif -int midi_device_has_config(int card); -int midi_in_device_has_config(int card); -char *midi_device_get_internal_name(int card); -char *midi_in_device_get_internal_name(int card); -int midi_device_get_from_internal_name(char *s); -int midi_in_device_get_from_internal_name(char *s); -void midi_device_init(); -void midi_in_device_init(); +extern int midi_device_has_config(int card); +extern int midi_in_device_has_config(int card); +extern char * midi_device_get_internal_name(int card); +extern char * midi_in_device_get_internal_name(int card); +extern int midi_device_get_from_internal_name(char *s); +extern int midi_in_device_get_from_internal_name(char *s); +extern void midi_device_init(); +extern void midi_in_device_init(); typedef struct midi_device_t diff --git a/src/include/86box/mo.h b/src/include/86box/mo.h index 58984a3e8..81efb6927 100644 --- a/src/include/86box/mo.h +++ b/src/include/86box/mo.h @@ -91,11 +91,15 @@ enum { }; typedef struct { - uint8_t id, - res, res0, /* Reserved for other ID's. */ - res1, - ide_channel, scsi_device_id, - bus_type, /* 0 = ATAPI, 1 = SCSI */ + uint8_t id; + + union { + uint8_t res, res0, /* Reserved for other ID's. */ + res1, + ide_channel, scsi_device_id; + }; + + uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */ bus_mode, /* Bit 0 = PIO suported; Bit 1 = DMA supportd. */ read_only, /* Struct variable reserved for diff --git a/src/include/86box/net_dp8390.h b/src/include/86box/net_dp8390.h index 02c9763fa..1365f7ec8 100644 --- a/src/include/86box/net_dp8390.h +++ b/src/include/86box/net_dp8390.h @@ -196,7 +196,7 @@ extern void dp8390_chipmem_write(dp8390_t *dev, uint32_t addr, uint32_t val, uns extern uint32_t dp8390_read_cr(dp8390_t *dev); extern void dp8390_write_cr(dp8390_t *dev, uint32_t val); -extern void dp8390_rx(void *priv, uint8_t *buf, int io_len); +extern int dp8390_rx(void *priv, uint8_t *buf, int io_len); extern uint32_t dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len); extern void dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len); diff --git a/src/include/86box/net_ne2000.h b/src/include/86box/net_ne2000.h index c7e466080..b2581e98e 100644 --- a/src/include/86box/net_ne2000.h +++ b/src/include/86box/net_ne2000.h @@ -40,7 +40,7 @@ enum { NE2K_NONE = 0, NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */ NE2K_NE2000 = 2, /* 16-bit ISA NE2000 */ - NE2K_ETHERNEXT_MC = 3, /* 16-bit MCA EtherNext/MC */ + NE2K_ETHERNEXT_MC = 3, /* 16-bit MCA EtherNext/MC */ NE2K_RTL8019AS = 4, /* 16-bit ISA PnP Realtek 8019AS */ NE2K_RTL8029AS = 5 /* 32-bit PCI Realtek 8029AS */ }; diff --git a/src/include/86box/network.h b/src/include/86box/network.h index c6bb348df..d256209d0 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -64,7 +64,7 @@ enum { }; -typedef void (*NETRXCB)(void *, uint8_t *, int); +typedef int (*NETRXCB)(void *, uint8_t *, int); typedef int (*NETWAITCB)(void *); typedef int (*NETSETLINKSTATE)(void *); @@ -78,7 +78,6 @@ typedef struct netpkt { } netpkt_t; typedef struct { - const char *name; const char *internal_name; const device_t *device; void *priv; @@ -133,7 +132,6 @@ extern void net_slirp_in(uint8_t *, int); extern int network_dev_to_id(char *); extern int network_card_available(int); -extern char *network_card_getname(int); extern int network_card_has_config(int); extern char *network_card_get_internal_name(int); extern int network_card_get_from_internal_name(char *); diff --git a/src/include/86box/pci.h b/src/include/86box/pci.h index 07b1f3097..db4e7f332 100644 --- a/src/include/86box/pci.h +++ b/src/include/86box/pci.h @@ -49,24 +49,29 @@ enum { PCI_CARD_NORTHBRIDGE = 0, + PCI_CARD_AGPBRIDGE, PCI_CARD_SOUTHBRIDGE, - PCI_CARD_NORMAL, + PCI_CARD_NORMAL = 0x10, PCI_CARD_NORMAL_NOBRIDGE, - PCI_CARD_ONBOARD, + PCI_CARD_VIDEO, PCI_CARD_SCSI, PCI_CARD_SOUND, PCI_CARD_IDE, - PCI_CARD_SPECIAL + PCI_CARD_NETWORK, + PCI_CARD_BRIDGE, }; enum { - PCI_ADD_NORTHBRIDGE = 0x80, + PCI_ADD_NORTHBRIDGE = 0, + PCI_ADD_AGPBRIDGE, PCI_ADD_SOUTHBRIDGE, - PCI_ADD_NORMAL, + PCI_ADD_NORMAL = 0x10, + PCI_ADD_NORMAL_NOBRIDGE, PCI_ADD_VIDEO, PCI_ADD_SCSI, PCI_ADD_SOUND, PCI_ADD_IDE, + PCI_ADD_NETWORK, PCI_ADD_BRIDGE }; diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 2033ef02f..dafef5e72 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -118,6 +118,10 @@ extern void do_start(void); extern void do_stop(void); +/* Power off. */ +extern void plat_power_off(void); + + /* Platform-specific device support. */ extern void floppy_mount(uint8_t id, wchar_t *fn, uint8_t wp); extern void floppy_eject(uint8_t id); diff --git a/src/include/86box/scsi.h b/src/include/86box/scsi.h index 364c2c60a..376a0cf30 100644 --- a/src/include/86box/scsi.h +++ b/src/include/86box/scsi.h @@ -24,7 +24,6 @@ extern int scsi_card_current; extern int scsi_card_available(int card); -extern char *scsi_card_getname(int card); #ifdef EMU_DEVICE_H extern const device_t *scsi_card_getdevice(int card); #endif diff --git a/src/include/86box/sio.h b/src/include/86box/sio.h index c3a4801d3..f913d9835 100644 --- a/src/include/86box/sio.h +++ b/src/include/86box/sio.h @@ -26,6 +26,7 @@ extern const device_t fdc37c665_device; extern const device_t fdc37c666_device; extern const device_t fdc37c669_device; extern const device_t fdc37c931apm_device; +extern const device_t fdc37c931apm_compaq_device; extern const device_t fdc37c932fr_device; extern const device_t fdc37c932qf_device; extern const device_t fdc37c935_device; @@ -35,6 +36,7 @@ extern const device_t i82091aa_ide_device; extern const device_t pc87306_device; extern const device_t pc87307_device; extern const device_t pc87307_15c_device; +extern const device_t pc87307_both_device; extern const device_t pc87309_device; extern const device_t pc87309_15c_device; extern const device_t pc87332_device; diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index 79bc7b5a2..c4b03f1a5 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -49,7 +49,6 @@ extern void sound_set_cd_audio_filter(void (*filter)(int channel, \ double *buffer, void *p), void *p); extern int sound_card_available(int card); -extern char *sound_card_getname(int card); #ifdef EMU_DEVICE_H extern const device_t *sound_card_getdevice(int card); #endif diff --git a/src/include/86box/usb.h b/src/include/86box/usb.h index aced538c8..375fc89e7 100644 --- a/src/include/86box/usb.h +++ b/src/include/86box/usb.h @@ -24,7 +24,7 @@ extern "C" { typedef struct { - uint8_t ohci_mmio[4096]; + uint8_t uhci_io[32], ohci_mmio[4096]; uint16_t uhci_io_base; int uhci_enable, ohci_enable; uint32_t ohci_mem_base; diff --git a/src/include/86box/video.h b/src/include/86box/video.h index ce82b0c01..5db33976e 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -138,12 +138,10 @@ extern void (*video_recalctimings)(void); /* Table functions. */ extern int video_card_available(int card); -extern char *video_card_getname(int card); #ifdef EMU_DEVICE_H extern const device_t *video_card_getdevice(int card); #endif extern int video_card_has_config(int card); -extern int video_card_getid(char *s); extern char *video_get_internal_name(int card); extern int video_get_video_from_internal_name(char *s); extern int video_is_mda(void); diff --git a/src/include/86box/zip.h b/src/include/86box/zip.h index 1b1b555db..4fd9bb5e5 100644 --- a/src/include/86box/zip.h +++ b/src/include/86box/zip.h @@ -39,11 +39,15 @@ enum { typedef struct { - uint8_t id, - res, res0, /* Reserved for other ID's. */ - res1, - ide_channel, scsi_device_id, - bus_type, /* 0 = ATAPI, 1 = SCSI */ + uint8_t id; + + union { + uint8_t res, res0, /* Reserved for other ID's. */ + res1, + ide_channel, scsi_device_id; + }; + + uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */ bus_mode, /* Bit 0 = PIO suported; Bit 1 = DMA supportd. */ read_only, /* Struct variable reserved for diff --git a/src/ioapic.c b/src/ioapic.c index 498787582..b2ce9dd52 100644 --- a/src/ioapic.c +++ b/src/ioapic.c @@ -125,6 +125,6 @@ const device_t ioapic_device = { DEVICE_AT, 0, ioapic_init, ioapic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 46cf9a215..bc22e11f9 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -668,7 +668,7 @@ vid_speed_change_1512(void *priv) device_config_t vid_1512_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", 0, + "display_type", "Display type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "PC-CM (Colour)", 0 @@ -682,7 +682,7 @@ device_config_t vid_1512_config[] = } }, { - "codepage", "Hardware font", CONFIG_SELECTION, "", 3, + "codepage", "Hardware font", CONFIG_SELECTION, "", 3, "", { 0 }, { { "US English", 3 @@ -699,7 +699,7 @@ device_config_t vid_1512_config[] = } }, { - "language", "BIOS language", CONFIG_SELECTION, "", 7, + "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, { { "English", 7 @@ -740,7 +740,7 @@ static const device_t vid_1512_device = { "Amstrad PC1512 (video)", 0, 0, NULL, vid_close_1512, NULL, - NULL, + { NULL }, vid_speed_change_1512, NULL, vid_1512_config @@ -896,7 +896,7 @@ vid_speed_changed_1640(void *priv) device_config_t vid_1640_config[] = { { - "language", "BIOS language", CONFIG_SELECTION, "", 7, + "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, { { "English", 7 @@ -936,7 +936,7 @@ static const device_t vid_1640_device = { "Amstrad PC1640 (video)", 0, 0, NULL, vid_close_1640, NULL, - NULL, + { NULL }, vid_speed_changed_1640, NULL, vid_1640_config @@ -1729,7 +1729,7 @@ device_config_t vid_200_config[] = * > Display port (TTL or RF) */ { - "video_emulation", "Display type", CONFIG_SELECTION, "", PC200_CGA, + "video_emulation", "Display type", CONFIG_SELECTION, "", PC200_CGA, "", { 0 }, { { "CGA monitor", PC200_CGA @@ -1746,7 +1746,7 @@ device_config_t vid_200_config[] = } }, { - "display_type", "Monitor type", CONFIG_SELECTION, "", 0, + "display_type", "Monitor type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "RGB", 0 @@ -1769,7 +1769,7 @@ device_config_t vid_200_config[] = } }, { - "codepage", "Hardware font", CONFIG_SELECTION, "", 3, + "codepage", "Hardware font", CONFIG_SELECTION, "", 3, "", { 0 }, { { "US English", 3 @@ -1789,7 +1789,7 @@ device_config_t vid_200_config[] = } }, { - "language", "BIOS language", CONFIG_SELECTION, "", 7, + "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, { { "English", 7 @@ -1830,7 +1830,7 @@ static const device_t vid_200_device = { "Amstrad PC200 (video)", 0, 0, NULL, vid_close_200, NULL, - NULL, + { NULL }, vid_speed_changed_200, NULL, vid_200_config @@ -1851,7 +1851,7 @@ device_config_t vid_ppc512_config[] = * > Display port (TTL or RF) */ { - "video_emulation", "Display type", CONFIG_SELECTION, "", PC200_LCDC, + "video_emulation", "Display type", CONFIG_SELECTION, "", PC200_LCDC, "", { 0 }, { { "CGA monitor", PC200_CGA @@ -1871,7 +1871,7 @@ device_config_t vid_ppc512_config[] = }, }, { - "display_type", "Monitor type", CONFIG_SELECTION, "", 0, + "display_type", "Monitor type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "RGB", 0 @@ -1894,7 +1894,7 @@ device_config_t vid_ppc512_config[] = }, }, { - "codepage", "Hardware font", CONFIG_SELECTION, "", 3, + "codepage", "Hardware font", CONFIG_SELECTION, "", 3, "", { 0 }, { { "US English", 3 @@ -1914,7 +1914,7 @@ device_config_t vid_ppc512_config[] = }, }, { - "language", "BIOS language", CONFIG_SELECTION, "", 7, + "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, { { "English", 7 @@ -1954,7 +1954,7 @@ static const device_t vid_ppc512_device = { "Amstrad PPC512 (video)", 0, 0, NULL, vid_close_200, NULL, - NULL, + { NULL }, vid_speed_changed_200, NULL, vid_ppc512_config @@ -1971,7 +1971,7 @@ ppc512_get_device(void) device_config_t vid_pc2086_config[] = { { - "language", "BIOS language", CONFIG_SELECTION, "", 7, + "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, { { "English", 7 @@ -1993,7 +1993,7 @@ static const device_t vid_pc2086_device = { "Amstrad PC2086", 0, 0, NULL, NULL, NULL, - NULL, + { NULL }, NULL, NULL, vid_pc2086_config @@ -2010,7 +2010,7 @@ pc2086_get_device(void) device_config_t vid_pc3086_config[] = { { - "language", "BIOS language", CONFIG_SELECTION, "", 7, + "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, { { "English", 7 @@ -2032,7 +2032,7 @@ static const device_t vid_pc3086_device = { "Amstrad PC3086", 0, 0, NULL, NULL, NULL, - NULL, + { NULL }, NULL, NULL, vid_pc3086_config diff --git a/src/machine/m_at.c b/src/machine/m_at.c index 9ee653a32..53e0b4367 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -171,7 +171,8 @@ machine_at_ibm_init(const machine_t *model) return ret; } -//IBM AT machines with custom BIOSes + +/* IBM AT machines with custom BIOSes */ int machine_at_ibmatquadtel_init(const machine_t *model) { @@ -189,6 +190,7 @@ machine_at_ibmatquadtel_init(const machine_t *model) return ret; } + int machine_at_ibmatami_init(const machine_t *model) { @@ -206,6 +208,7 @@ machine_at_ibmatami_init(const machine_t *model) return ret; } + int machine_at_ibmatpx_init(const machine_t *model) { @@ -223,6 +226,7 @@ machine_at_ibmatpx_init(const machine_t *model) return ret; } + int machine_at_ibmxt286_init(const machine_t *model) { @@ -240,7 +244,6 @@ machine_at_ibmxt286_init(const machine_t *model) return ret; } -#if defined(DEV_BRANCH) && defined(USE_SIEMENS) int machine_at_siemens_init(const machine_t *model) { @@ -256,7 +259,7 @@ machine_at_siemens_init(const machine_t *model) return ret; } -#endif + #if defined(DEV_BRANCH) && defined(USE_OPEN_AT) int diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index 4440df5fb..2f4a11871 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -629,6 +629,7 @@ machine_at_r418_init(const machine_t *model) return ret; } + int machine_at_m4li_init(const machine_t *model) { @@ -646,8 +647,8 @@ machine_at_m4li_init(const machine_t *model) device_add(&sis_85c496_device); pci_register_slot(0x0B, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x07, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); device_add(&fdc37c665_device); device_add(&keyboard_ps2_pci_device); @@ -655,6 +656,7 @@ machine_at_m4li_init(const machine_t *model) return ret; } + int machine_at_ls486e_init(const machine_t *model) { @@ -756,7 +758,7 @@ machine_at_alfredo_init(const machine_t *model) 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_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_IDE, 0, 0, 0, 0); pci_register_slot(0x06, PCI_CARD_NORMAL, 3, 2, 1, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); @@ -788,7 +790,7 @@ machine_at_486sp3g_init(const machine_t *model) 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_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_IDE, 0, 0, 0, 0); pci_register_slot(0x03, PCI_CARD_NORMAL, 1, 2, 3, 4); /* 03 = Slot 1 */ pci_register_slot(0x04, PCI_CARD_NORMAL, 2, 3, 4, 1); /* 04 = Slot 2 */ pci_register_slot(0x05, PCI_CARD_NORMAL, 3, 4, 1, 2); /* 05 = Slot 3 */ @@ -851,7 +853,7 @@ machine_at_486vipio2_init(const machine_t *model) machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x00, PCI_CARD_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -882,7 +884,7 @@ machine_at_abpb4_init(const machine_t *model) machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x00, PCI_CARD_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); 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); @@ -911,8 +913,8 @@ machine_at_itoxstar_init(const machine_t *model) machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x0B, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x0B, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0C, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x1F, PCI_CARD_NORMAL, 1, 2, 3, 4); device_add(&w83977f_device); device_add(&keyboard_ps2_ami_pci_device); @@ -941,8 +943,8 @@ machine_at_arb1479_init(const machine_t *model) machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x0B, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x0B, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0C, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x1F, PCI_CARD_NORMAL, 1, 0, 0, 0); pci_register_slot(0x1E, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x1D, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -969,8 +971,8 @@ machine_at_pcm9340_init(const machine_t *model) machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x0B, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x0B, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0C, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x1D, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x1E, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x1F, PCI_CARD_NORMAL, 2, 3, 4, 1); @@ -998,10 +1000,10 @@ machine_at_pcm5330_init(const machine_t *model) machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x0B, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x0D, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x0E, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x0B, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0C, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0D, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0E, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); device_add(&stpc_serial_device); device_add(&w83977f_370_device); diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index 58814891d..3eae38627 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -673,7 +673,7 @@ compaq_plasma_speed_changed(void *p) const device_config_t compaq_plasma_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, + "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, "", { 0 }, { { "RGB", CGA_RGB @@ -687,7 +687,7 @@ const device_config_t compaq_plasma_config[] = } }, { - "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, + "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, "", { 0 }, { { "Old", COMPOSITE_OLD @@ -701,7 +701,7 @@ const device_config_t compaq_plasma_config[] = } }, { - "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, + "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Color", 0 @@ -736,7 +736,7 @@ static const device_t compaq_plasma_device = compaq_plasma_init, compaq_plasma_close, NULL, - NULL, + { NULL }, compaq_plasma_speed_changed, NULL, compaq_plasma_config diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 3346b6bec..3fe6d5394 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -109,7 +109,7 @@ machine_at_lx6_init(const machine_t *model) pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440lx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -136,7 +136,12 @@ machine_at_spitfire_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 1, 2, 0, 0); + pci_register_slot(0x12, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x11, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x10, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440lx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_pci_device); @@ -167,7 +172,7 @@ machine_at_p6i440e2_init(const machine_t *model) pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); pci_register_slot(0x09, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0A, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440ex_device); device_add(&piix4_device); device_add(&keyboard_ps2_ami_pci_device); @@ -204,7 +209,7 @@ machine_at_p2bls_init(const machine_t *model) pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x09, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -241,7 +246,7 @@ machine_at_p3bf_init(const machine_t *model) pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -278,7 +283,7 @@ machine_at_bf6_init(const machine_t *model) pci_register_slot(0x0D, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0F, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x13, PCI_CARD_NORMAL, 3, 3, 1, 2); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_pci_device); @@ -311,7 +316,7 @@ machine_at_ax6bc_init(const machine_t *model) pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -345,7 +350,7 @@ machine_at_atc6310bxii_init(const machine_t *model) pci_register_slot(0x0C, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0E, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&slc90e66_device); device_add(&keyboard_ps2_pci_device); @@ -377,7 +382,7 @@ machine_at_ga686bx_init(const machine_t *model) pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -417,7 +422,7 @@ machine_at_p6sba_init(const machine_t *model) pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 0, 0); pci_register_slot(0x0D, PCI_CARD_NORMAL, 3, 0, 0, 0); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 0, 0); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&w83977tf_device); @@ -456,7 +461,7 @@ machine_at_tsunamiatx_init(const machine_t *model) pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x13, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x14, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); @@ -495,10 +500,10 @@ machine_at_ergox365_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); - pci_register_slot(0x14, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); + pci_register_slot(0x14, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x12, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 3, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 3, 0, 0, 0); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -530,7 +535,7 @@ machine_at_ficka6130_init(const machine_t *model) pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_apro_device); device_add(&via_vt82c596_device); device_add(&w83877tf_device); diff --git a/src/machine/m_at_slot2.c b/src/machine/m_at_slot2.c index 7e0300412..86b1e8dbd 100644 --- a/src/machine/m_at_slot2.c +++ b/src/machine/m_at_slot2.c @@ -59,7 +59,7 @@ machine_at_6gxu_init(const machine_t *model) pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); /* On-Board SCSI. Not emulated at the moment */ - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440gx_device); device_add(&piix4e_device); @@ -99,7 +99,7 @@ machine_at_s2dge_init(const machine_t *model) pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 0, 0); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 0, 0); device_add(&i440gx_device); device_add(&piix4e_device); @@ -137,7 +137,7 @@ machine_at_fw6400gx_init(const machine_t *model) pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0E, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0F, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 0, 0); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 0, 0); device_add(&i440gx_device); device_add(&piix4e_device); diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index 56df424fb..75ac5ab46 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -57,7 +57,7 @@ machine_at_s370slm_init(const machine_t *model) pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440lx_device); device_add(&piix4e_device); device_add(&w83977tf_device); @@ -93,7 +93,7 @@ machine_at_trinity371_init(const machine_t *model) pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x13, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x14, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -124,7 +124,7 @@ machine_at_p6bap_init(const machine_t *model) pci_register_slot(0x12, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_apro133a_device); //Rebranded as ET82C693A device_add(&via_vt82c596b_device); //Rebranded as ET82C696B device_add(&w83977ef_device); @@ -157,7 +157,7 @@ machine_at_cubx_init(const machine_t *model) pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); @@ -190,7 +190,7 @@ machine_at_atc7020bxii_init(const machine_t *model) pci_register_slot(0x0C, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0E, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&slc90e66_device); device_add(&keyboard_ps2_pci_device); @@ -222,7 +222,7 @@ machine_at_ambx133_init(const machine_t *model) pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0C, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add(&w83977ef_device); @@ -254,7 +254,7 @@ machine_at_awo671r_init(const machine_t *model) pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0C, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); device_add_inst(&w83977ef_device, 1); @@ -287,7 +287,7 @@ machine_at_63a_init(const machine_t *model) pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); /* Integrated Sound? */ - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440zx_device); device_add(&piix4e_device); device_add(&w83977tf_device); @@ -318,7 +318,7 @@ machine_at_apas3_init(const machine_t *model) pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x13, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_apro_device); device_add(&via_vt82c586b_device); device_add(&fdc37c669_device); @@ -350,7 +350,7 @@ machine_at_wcf681_init(const machine_t *model) pci_register_slot(0x12, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_apro133a_device); device_add(&via_vt82c596b_device); device_add(&w83977tf_device); @@ -381,7 +381,7 @@ machine_at_6via85x_init(const machine_t *model) pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0C, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_apro133a_device); device_add(&via_vt82c686b_device); device_add(&via_vt82c686_sio_device); @@ -413,7 +413,7 @@ machine_at_603tcf_init(const machine_t *model) pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_vt8601_device); device_add(&via_vt82c686b_device); device_add(&via_vt82c686_sio_device); diff --git a/src/machine/m_at_socket4_5.c b/src/machine/m_at_socket4_5.c index 7ef6becad..de61ed113 100644 --- a/src/machine/m_at_socket4_5.c +++ b/src/machine/m_at_socket4_5.c @@ -36,6 +36,7 @@ #include <86box/keyboard.h> #include <86box/flash.h> #include <86box/nvr.h> +#include <86box/scsi_ncr53c8xx.h> #include <86box/sio.h> #include <86box/video.h> #include <86box/machine.h> @@ -70,7 +71,7 @@ machine_at_premiere_common_init(const machine_t *model, int pci_switch) pci_init(PCI_CONFIG_TYPE_2 | pci_switch); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_IDE, 0, 0, 0, 0); pci_register_slot(0x06, PCI_CARD_NORMAL, 3, 2, 1, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); @@ -90,7 +91,7 @@ machine_at_award_common_init(const machine_t *model) 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_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_IDE, 0, 0, 0, 0); pci_register_slot(0x03, PCI_CARD_NORMAL, 1, 2, 3, 4); /* 03 = Slot 1 */ pci_register_slot(0x04, PCI_CARD_NORMAL, 2, 3, 4, 1); /* 04 = Slot 2 */ pci_register_slot(0x05, PCI_CARD_NORMAL, 3, 4, 1, 2); /* 05 = Slot 3 */ @@ -120,14 +121,15 @@ machine_at_batman_init(const machine_t *model) return ret; } + #if defined(DEV_BRANCH) && defined(USE_DELLS4) int machine_at_dellxp60_init(const machine_t *model) { int ret; - ret = bios_load_linear(L"roms/machines/dellxp60/XP60-A08.ROM", - 0x000e0000, 131072, 0); + ret = bios_load_linear_inverted(L"roms/machines/dellxp60/XP60-A08.ROM", + 0x000e0000, 131072, 0); if (bios_only || !ret) return ret; @@ -135,29 +137,32 @@ machine_at_dellxp60_init(const machine_t *model) machine_at_common_init(model); device_add(&ide_pci_2ch_device); - pci_init(PCI_CONFIG_TYPE_2 | PCI_NO_IRQ_STEERING); + pci_init(PCI_CONFIG_TYPE_2); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x06, PCI_CARD_NORMAL, 3, 2, 1, 4); - pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); - pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); + /* Not: 00, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F. */ + /* Yes: 01, 10, 11, 12, 13, 14. */ + pci_register_slot(0x01, PCI_CARD_NORMAL, 1, 3, 2, 4); + pci_register_slot(0x04, PCI_CARD_NORMAL, 4, 4, 3, 3); + pci_register_slot(0x05, PCI_CARD_NORMAL, 1, 4, 3, 2); + pci_register_slot(0x06, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x02, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); device_add(&i430lx_device); device_add(&keyboard_ps2_intel_ami_pci_device); - device_add(&sio_device); + device_add(&sio_zb_device); device_add(&fdc37c665_device); device_add(&intel_flash_bxt_ami_device); return ret; } + int machine_at_opti560l_init(const machine_t *model) { int ret; - ret = bios_load_linear(L"roms/machines/opti560l/560L_A06.ROM", - 0x000e0000, 131072, 0); + ret = bios_load_linear_inverted(L"roms/machines/opti560l/560L_A06.ROM", + 0x000e0000, 131072, 0); if (bios_only || !ret) return ret; @@ -165,23 +170,23 @@ machine_at_opti560l_init(const machine_t *model) machine_at_common_init(model); device_add(&ide_pci_2ch_device); - pci_init(PCI_CONFIG_TYPE_2 | PCI_NO_IRQ_STEERING); + pci_init(PCI_CONFIG_TYPE_2); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 0, 0, 0, 0); - pci_register_slot(0x06, PCI_CARD_NORMAL, 3, 2, 1, 4); - pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); - pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); + pci_register_slot(0x03, PCI_CARD_NORMAL, 4, 4, 3, 3); + pci_register_slot(0x07, PCI_CARD_NORMAL, 1, 4, 3, 2); + pci_register_slot(0x08, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x02, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); device_add(&i430lx_device); device_add(&keyboard_ps2_intel_ami_pci_device); - device_add(&sio_device); - device_add(&fdc37c665_device); + device_add(&sio_zb_device); + device_add(&i82091aa_device); device_add(&intel_flash_bxt_ami_device); return ret; } #endif + int machine_at_ambradp60_init(const machine_t *model) { @@ -217,7 +222,7 @@ machine_at_valuepointp60_init(const machine_t *model) 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_SPECIAL, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_IDE, 0, 0, 0, 0); pci_register_slot(0x06, PCI_CARD_NORMAL, 3, 2, 1, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); @@ -249,7 +254,7 @@ machine_at_pb520r_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_2); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x01, PCI_CARD_IDE, 0, 0, 0, 0); - pci_register_slot(0x03, PCI_CARD_ONBOARD, 3, 3, 3, 3); + pci_register_slot(0x03, PCI_CARD_VIDEO, 3, 3, 3, 3); pci_register_slot(0x06, PCI_CARD_NORMAL, 3, 2, 1, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 3, 2, 4); @@ -432,7 +437,7 @@ machine_at_endeavor_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -549,7 +554,6 @@ machine_at_apollo_init(const machine_t *model) } -#if defined(DEV_BRANCH) && defined(USE_VECTRA54) int machine_at_vectra54_init(const machine_t *model) { @@ -565,20 +569,23 @@ machine_at_vectra54_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x09, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x0F, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0D, PCI_CARD_VIDEO, 0, 0, 0, 0); + pci_register_slot(0x06, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x07, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x08, PCI_CARD_NORMAL, 3, 4, 1, 2); + + if (gfxcard == VID_INTERNAL) + device_add(&s3_phoenix_trio64_onboard_pci_device); + device_add(&keyboard_ps2_ami_pci_device); device_add(&i430fx_device); device_add(&piix_device); - device_add(&fdc37c932qf_device); - device_add(&intel_flash_bxt_device); + device_add(&fdc37c931apm_device); + device_add(&sst_flash_29ee010_device); return ret; } -#endif int diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index f4d203536..af7016e8f 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -40,6 +40,10 @@ #include <86box/spd.h> #include "cpu.h" #include <86box/machine.h> +#include <86box/timer.h> +#include <86box/fdd.h> +#include <86box/fdc.h> +#include <86box/nvr.h> int machine_at_chariot_init(const machine_t *model) @@ -108,7 +112,7 @@ machine_at_thor_common_init(const machine_t *model, int mr) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 2, 1); @@ -189,7 +193,7 @@ machine_at_pb640_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 2, 1, 4); @@ -234,7 +238,7 @@ machine_at_acerm3a_init(const machine_t *model) pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0F, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x10, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x10, PCI_CARD_VIDEO, 4, 0, 0, 0); device_add(&i430hx_device); device_add(&piix3_device); device_add(&keyboard_ps2_pci_device); @@ -298,7 +302,7 @@ machine_at_ap53_init(const machine_t *model) pci_register_slot(0x13, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x06, PCI_CARD_ONBOARD, 1, 2, 3, 4); + pci_register_slot(0x06, PCI_CARD_VIDEO, 1, 2, 3, 4); device_add(&i430hx_device); device_add(&piix3_device); device_add(&keyboard_ps2_ami_pci_device); @@ -447,7 +451,7 @@ machine_at_tc430hx_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -482,7 +486,7 @@ machine_at_equium5200_init(const machine_t *model) // Information about that mac pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -516,7 +520,7 @@ machine_at_pcv240_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -649,7 +653,7 @@ machine_at_brio80xx_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x14, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x14, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x12, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x11, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -707,15 +711,15 @@ machine_at_presario4500_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x14, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x14, PCI_CARD_VIDEO, 3, 0, 0, 0); device_add(&i430vx_device); device_add(&piix3_device); device_add(&keyboard_ps2_ami_pci_device); - device_add(&fdc37c931apm_device); - device_add(&intel_flash_bxt_device); + device_add(&fdc37c931apm_compaq_device); + device_add(&sst_flash_29ee020_device); return ret; } @@ -739,7 +743,7 @@ machine_at_pb680_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -773,7 +777,7 @@ machine_at_gw2kte_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); @@ -899,6 +903,44 @@ machine_at_ym430tx_init(const machine_t *model) } +#if defined(DEV_BRANCH) && defined(NO_SIO) +int +machine_at_an430tx_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear_combined2(L"roms/machines/an430tx/P10-0095.BIO", + L"roms/machines/an430tx/P10-0095.BI1", + L"roms/machines/an430tx/P10-0095.BI2", + L"roms/machines/an430tx/P10-0095.BI3", + NULL, + 0x3a000, 160); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); /* PIIX4 */ + pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x10, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0); + device_add(&i430tx_device); + device_add(&piix4_device); + device_add(&keyboard_ps2_ami_pci_device); + device_add(&pc87307_both_device); + device_add(&intel_flash_bxt_ami_device); + spd_register(SPD_TYPE_SDRAM, 0x3, 128); + + return ret; +} +#endif + + int machine_at_mb540n_init(const machine_t *model) { @@ -1014,7 +1056,7 @@ machine_at_ficpa2012_init(const machine_t *model) pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_vp3_device); device_add(&via_vt82c586b_device); diff --git a/src/machine/m_at_socket8.c b/src/machine/m_at_socket8.c index 27702d53b..648598ab6 100644 --- a/src/machine/m_at_socket8.c +++ b/src/machine/m_at_socket8.c @@ -179,7 +179,7 @@ machine_at_ap440fx_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x08, PCI_CARD_ONBOARD, 3, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_VIDEO, 3, 0, 0, 0); pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 3, 2, 4); pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 1, 3, 4); pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 2, 1, 4); diff --git a/src/machine/m_at_sockets7.c b/src/machine/m_at_sockets7.c index a03f348e2..7ccd8136b 100644 --- a/src/machine/m_at_sockets7.c +++ b/src/machine/m_at_sockets7.c @@ -62,7 +62,7 @@ machine_at_ax59pro_init(const machine_t *model) pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_mvp3_device); device_add(&via_vt82c586b_device); @@ -94,7 +94,7 @@ machine_at_mvp3_init(const machine_t *model) pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4); pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_mvp3_device); device_add(&via_vt82c586b_device); @@ -127,7 +127,7 @@ machine_at_ficva503a_init(const machine_t *model) pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x01, PCI_CARD_SPECIAL, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&via_mvp3_device); device_add(&via_vt82c686a_device); diff --git a/src/machine/m_at_t3100e_vid.c b/src/machine/m_at_t3100e_vid.c index ecfef4437..1f27b7392 100644 --- a/src/machine/m_at_t3100e_vid.c +++ b/src/machine/m_at_t3100e_vid.c @@ -767,7 +767,7 @@ const device_t t3100e_device = t3100e_init, t3100e_close, NULL, - NULL, + { NULL }, t3100e_speed_changed, NULL }; diff --git a/src/machine/m_europc.c b/src/machine/m_europc.c index 1ce423ee7..f901f51a7 100644 --- a/src/machine/m_europc.c +++ b/src/machine/m_europc.c @@ -669,7 +669,7 @@ europc_close(void *priv) static const device_config_t europc_config[] = { { - "js9", "JS9 Jumper (JIM)", CONFIG_INT, "", 0, + "js9", "JS9 Jumper (JIM)", CONFIG_INT, "", 0, "", { 0 }, { { "Disabled (250h)", 0 @@ -692,7 +692,7 @@ const device_t europc_device = { "EuroPC System Board", 0, 0, europc_boot, europc_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, europc_config }; diff --git a/src/machine/m_olivetti_m24.c b/src/machine/m_olivetti_m24.c index c01363167..216e926f3 100644 --- a/src/machine/m_olivetti_m24.c +++ b/src/machine/m_olivetti_m24.c @@ -812,7 +812,7 @@ const device_t m24_device = { "Olivetti M24", 0, 0, NULL, vid_close, NULL, - NULL, + { NULL }, speed_changed, NULL, NULL diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index 5d3c77525..31aa9f5bc 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -763,7 +763,7 @@ speed_changed(void *priv) static const device_config_t pcjr_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", PCJR_RGB, + "display_type", "Display type", CONFIG_SELECTION, "", PCJR_RGB, "", { 0 }, { { "RGB", PCJR_RGB @@ -786,7 +786,7 @@ static const device_t pcjr_device = { "IBM PCjr", 0, 0, NULL, NULL, NULL, - NULL, + { NULL }, speed_changed, NULL, pcjr_config diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index f308d969a..539448c2e 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -265,7 +265,7 @@ static const device_t snd_device = { "PS/1 Audio Card", 0, 0, snd_init, snd_close, NULL, - NULL, + { NULL }, NULL, NULL }; diff --git a/src/machine/m_ps1_hdc.c b/src/machine/m_ps1_hdc.c index 7bea2ef7a..ab9d84491 100644 --- a/src/machine/m_ps1_hdc.c +++ b/src/machine/m_ps1_hdc.c @@ -1355,7 +1355,7 @@ const device_t ps1_hdc_device = { DEVICE_ISA | DEVICE_PS2, 0, ps1_hdc_init, ps1_hdc_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 44fc7f533..f38f60767 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1129,7 +1129,7 @@ vid_init(tandy_t *dev) static const device_config_t vid_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", TANDY_RGB, + "display_type", "Display type", CONFIG_SELECTION, "", TANDY_RGB, "", { 0 }, { { "RGB", TANDY_RGB @@ -1152,7 +1152,7 @@ static const device_t vid_device = { "Tandy 1000", 0, 0, NULL, vid_close, NULL, - NULL, + { NULL }, vid_speed_changed, NULL, vid_config @@ -1162,7 +1162,7 @@ static const device_t vid_device_hx = { "Tandy 1000 HX", 0, 0, NULL, vid_close, NULL, - NULL, + { NULL }, vid_speed_changed, NULL, vid_config @@ -1172,7 +1172,7 @@ static const device_t vid_device_sl = { "Tandy 1000SL2", 0, 1, NULL, vid_close, NULL, - NULL, + { NULL }, vid_speed_changed, NULL, NULL @@ -1330,7 +1330,7 @@ static const device_t eep_1000hx_device = { "Tandy 1000HX EEPROM", 0, TYPE_TANDY1000HX, eep_init, eep_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -1339,7 +1339,7 @@ static const device_t eep_1000sl2_device = { "Tandy 1000SL2 EEPROM", 0, TYPE_TANDY1000SL2, eep_init, eep_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/machine/m_xt_t1000_vid.c b/src/machine/m_xt_t1000_vid.c index 7b298d330..15a9f699c 100644 --- a/src/machine/m_xt_t1000_vid.c +++ b/src/machine/m_xt_t1000_vid.c @@ -752,7 +752,7 @@ const device_t t1000_video_device = { "Toshiba T1000 Video", 0, 0, t1000_init, t1000_close, NULL, - NULL, + { NULL }, t1000_speed_changed, NULL, t1000_config @@ -763,7 +763,7 @@ const device_t t1200_video_device = { "Toshiba T1200 Video", 0, 0, t1000_init, t1000_close, NULL, - NULL, + { NULL }, t1000_speed_changed, NULL, t1000_config diff --git a/src/machine/m_xt_xi8088.c b/src/machine/m_xt_xi8088.c index 875a2ba11..6944d1b3a 100644 --- a/src/machine/m_xt_xi8088.c +++ b/src/machine/m_xt_xi8088.c @@ -131,7 +131,7 @@ const device_t xi8088_device = xi8088_init, NULL, NULL, - NULL, + { NULL }, NULL, NULL, xi8088_config diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index c0448bd09..7b7ea2409 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -99,7 +99,7 @@ static const device_t zenith_scratchpad_device = { "Zenith scratchpad RAM", 0, 0, zenith_scratchpad_init, zenith_scratchpad_close, NULL, - NULL, + { NULL }, NULL, NULL }; diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index fefc93029..9a9f04184 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -96,15 +96,15 @@ const machine_t machines[] = { { "[8088] IBM XT (1986)", "ibmxt86", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 256, 640, 64, 0, machine_xt86_init, NULL }, { "[8088] American XT Computer", "americxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_xt_americxt_init, NULL }, { "[8088] AMI XT clone", "amixt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_xt_amixt_init, NULL }, - { "[8088] Tandy 1000", "tandy", MACHINE_TYPE_8088, {{"Intel", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_tandy_init, tandy1k_get_device }, - { "[8088] Tandy 1000 HX", "tandy1000hx", MACHINE_TYPE_8088, {{"Intel", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 128, 0, machine_tandy1000hx_init, tandy1k_hx_get_device }, { "[8088] Compaq Portable", "portable", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_VIDEO, 128, 640, 128, 0, machine_xt_compaq_portable_init, NULL }, - { "[8088] Generic XT clone", "genxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_genxt_init, NULL }, { "[8088] DTK XT clone", "dtk", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_xt_dtk_init, NULL }, + { "[8088] Generic XT clone", "genxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_genxt_init, NULL }, { "[8088] Juko XT clone", "jukopc", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_xt_jukopc_init, NULL }, { "[8088] OpenXT", "open_xt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_xt_open_xt_init, NULL }, { "[8088] Phoenix XT clone", "pxxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 64, 640, 64, 0, machine_xt_pxxt_init, NULL }, { "[8088] Schneider EuroPC", "europc", MACHINE_TYPE_8088, {{"Siemens", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_XTA | MACHINE_MOUSE, 512, 640, 128, 15, machine_europc_init, NULL }, + { "[8088] Tandy 1000", "tandy", MACHINE_TYPE_8088, {{"Intel", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_tandy_init, tandy1k_get_device }, + { "[8088] Tandy 1000 HX", "tandy1000hx", MACHINE_TYPE_8088, {{"Intel", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 128, 0, machine_tandy1000hx_init, tandy1k_hx_get_device }, { "[8088] Toshiba T1000", "t1000", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC | MACHINE_VIDEO, 512, 1280, 768, 63, machine_xt_t1000_init, t1000_get_device }, #if defined(DEV_BRANCH) && defined(USE_LASERXT) { "[8088] VTech Laser Turbo XT", "ltxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PC, 256, 640, 256, 0, machine_xt_laserxt_init, NULL }, @@ -136,15 +136,23 @@ const machine_t machines[] = { /* 286 AT machines */ { "[ISA] IBM AT", "ibmat", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibm_init, NULL }, - { "[ISA] AMI IBM AT", "ibmatami", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibmatami_init, NULL }, - { "[ISA] Quadtel IBM AT", "ibmatquadtel", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibmatquadtel_init, NULL }, - { "[ISA] Phoenix IBM AT", "ibmatpx", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibmatpx_init, NULL }, { "[ISA] IBM PS/1 model 2011", "ibmps1es", MACHINE_TYPE_286, {{"", cpus_ps1_m2011}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_XTA | MACHINE_VIDEO_FIXED, 512,16384, 512, 63, machine_ps1_m2011_init, NULL }, { "[ISA] IBM PS/2 model 30-286", "ibmps2_m30_286", MACHINE_TYPE_286, {{"Intel", cpus_ps2_m30_286}, {"IBM",cpus_IBM486SLC},{"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_XTA | MACHINE_VIDEO_FIXED, 1, 16, 1, 127, machine_ps2_m30_286_init, NULL }, { "[ISA] IBM XT Model 286", "ibmxt286", MACHINE_TYPE_286, {{"", cpus_ibmxt286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 127, machine_at_ibmxt286_init, NULL }, + { "[ISA] AMI IBM AT", "ibmatami", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibmatami_init, NULL }, { "[ISA] Commodore PC 30 III", "cmdpc30", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 640,16384, 128, 127, machine_at_cmdpc_init, NULL }, { "[ISA] Compaq Portable II", "portableii", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 640,16384, 128, 127, machine_at_portableii_init, NULL }, { "[ISA] Compaq Portable III", "portableiii", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_VIDEO, 640,16384, 128, 127, machine_at_portableiii_init, at_cpqiii_get_device }, + { "[ISA] MR 286 clone", "mr286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE, 512,16384, 128, 127, machine_at_mr286_init, NULL }, +#if defined(DEV_BRANCH) && defined(USE_OPEN_AT) + { "[ISA] OpenAT", "open_at", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_open_at_init, NULL }, +#endif + { "[ISA] Phoenix IBM AT", "ibmatpx", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibmatpx_init, NULL }, + { "[ISA] Quadtel IBM AT", "ibmatquadtel", MACHINE_TYPE_286, {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_ibmatquadtel_init, NULL }, + { "[ISA] Siemens PCD-2L", "siemens", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_siemens_init, NULL }, + { "[ISA] Toshiba T3100e", "t3100e", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE | MACHINE_VIDEO_FIXED, 1024, 5120, 256, 63, machine_at_t3100e_init, NULL }, + { "[GC103] Quadtel 286 clone", "quadt286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_quadt286_init, NULL }, + { "[GC103] Trigem 286M", "tg286m", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE, 512, 8192, 128, 127, machine_at_tg286m_init, NULL }, { "[NEAT] AMI 286 clone", "ami286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_neat_ami_init, NULL }, { "[NEAT] Phoenix 286 clone", "px286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_px286_init, NULL }, { "[SCAT] Award 286 clone", "award286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_award286_init, NULL }, @@ -154,16 +162,6 @@ const machine_t machines[] = { { "[SCAT] Samsung SPC-4200P", "spc4200p", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2, 512, 2048, 128, 127, machine_at_spc4200p_init, NULL }, { "[SCAT] Samsung SPC-4216P", "spc4216p", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2, 1, 5, 1, 127, machine_at_spc4216p_init, NULL }, { "[SCAT] Samsung Deskmaster 286", "deskmaster286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_deskmaster286_init, NULL }, - { "[GC103] Quadtel 286 clone", "quadt286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_quadt286_init, NULL }, - { "[GC103] Trigem 286M", "tg286m", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE, 512, 8192, 128, 127, machine_at_tg286m_init, NULL }, - { "[ISA] MR 286 clone", "mr286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE, 512,16384, 128, 127, machine_at_mr286_init, NULL }, -#if defined(DEV_BRANCH) && defined(USE_SIEMENS) - { "[ISA] Siemens PCD-2L", "siemens", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_siemens_init, NULL }, -#endif -#if defined(DEV_BRANCH) && defined(USE_OPEN_AT) - { "[ISA] OpenAT", "open_at", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT, 256,15872, 128, 63, machine_at_open_at_init, NULL }, -#endif - { "[ISA] Toshiba T3100e", "t3100e", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE | MACHINE_VIDEO_FIXED, 1024, 5120, 256, 63, machine_at_t3100e_init, NULL }, /* 286 machines that utilize the MCA bus */ { "[MCA] IBM PS/2 model 50", "ibmps2_m50", MACHINE_TYPE_286, {{"Intel", cpus_ps2_m30_286}, {"IBM",cpus_IBM486SLC},{"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_MCA | MACHINE_BUS_PS2 | MACHINE_VIDEO, 1, 10, 1, 63, machine_ps2_model_50_init, NULL }, @@ -171,28 +169,28 @@ const machine_t machines[] = { /* 386SX machines */ { "[ISA] IBM PS/1 model 2121", "ibmps1_2121", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO_FIXED, 2, 6, 1, 63, machine_ps1_m2121_init, NULL }, { "[ISA] IBM PS/1 m.2121+ISA", "ibmps1_2121_isa", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2, 6, 1, 63, machine_ps1_m2121_init, NULL }, - { "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL }, - { "[Intel 82335] ADI 386SX", "adi386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_adi386sx_init, NULL }, - { "[HT18] AMA-932J", "ama932j", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE | MACHINE_VIDEO, 512, 8192, 128, 127, machine_at_ama932j_init, at_ama932j_get_device }, - { "[WD76C10] Amstrad MegaPC", "megapc", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1, 32, 1, 127, machine_at_wd76c10_init, NULL }, - { "[SCAMP] Commodore SL386SX", "cbm_sl386sx25", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 8192, 512, 127,machine_at_commodore_sl386sx_init, at_commodore_sl386sx_get_device }, - { "[NEAT] DTK 386SX clone", "dtk386", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_neat_init, NULL }, - { "[SCAT] KMX-C-02", "kmxc02", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 512, 127, machine_at_kmxc02_init, NULL }, - { "[OPTi 291] DTK PPM-3333P", "awardsx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 1, 16, 1, 127, machine_at_awardsx_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_M6117) { "[ALi M6117D] Acrosser AR-B1375", "arb1375", MACHINE_TYPE_386SX, {{"ALi", cpus_ALiM6117}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1, 32, 1, 127, machine_at_arb1375_init, NULL }, { "[ALi M6117D] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, {{"ALi", cpus_ALiM6117}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1, 32, 1, 127, machine_at_pja511m_init, NULL }, #endif + { "[HT18] AMA-932J", "ama932j", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE | MACHINE_VIDEO, 512, 8192, 128, 127, machine_at_ama932j_init, at_ama932j_get_device }, + { "[Intel 82335] ADI 386SX", "adi386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_adi386sx_init, NULL }, + { "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL }, + { "[NEAT] DTK 386SX clone", "dtk386", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_neat_init, NULL }, + { "[OPTi 291] DTK PPM-3333P", "awardsx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 1, 16, 1, 127, machine_at_awardsx_init, NULL }, + { "[SCAMP] Commodore SL386SX", "cbm_sl386sx25", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 8192, 512, 127,machine_at_commodore_sl386sx_init, at_commodore_sl386sx_get_device }, + { "[SCAT] KMX-C-02", "kmxc02", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 512, 127, machine_at_kmxc02_init, NULL }, + { "[WD76C10] Amstrad MegaPC", "megapc", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1, 32, 1, 127, machine_at_wd76c10_init, NULL }, /* 386SX machines which utilize the MCA bus */ { "[MCA] IBM PS/2 model 55SX", "ibmps2_m55sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"IBM",cpus_IBM486SLC},{"", NULL}}, MACHINE_MCA | MACHINE_BUS_PS2 | MACHINE_VIDEO, 1, 8, 1, 63, machine_ps2_model_55sx_init, NULL }, /* 386DX machines */ { "[ACC 2168] AMI 386DX clone", "acc386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 1, 16, 1, 127, machine_at_acc386_init, NULL }, - { "[SiS 310] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_asus386_init, NULL }, + { "[C&T 386] ECS 386/32", "ecs386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 1, 16, 1, 127, machine_at_ecs386_init, NULL }, { "[ISA] Compaq Portable III (386)", "portableiii386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE | MACHINE_VIDEO, 1, 14, 1, 127, machine_at_portableiii386_init, at_cpqiii_get_device }, { "[ISA] Micronics 386 clone", "micronics386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512, 8192, 128, 127, machine_at_micronics386_init, NULL }, - { "[C&T 386] ECS 386/32", "ecs386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 1, 16, 1, 127, machine_at_ecs386_init, NULL }, + { "[SiS 310] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 512,16384, 128, 127, machine_at_asus386_init, NULL }, { "[UMC 491] US Technologies 386", "ustechnologies386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_AT, 1, 16, 1, 127,machine_at_ustechnologies386_init, NULL }, /* 386DX machines which utilize the VLB bus */ @@ -208,29 +206,29 @@ const machine_t machines[] = { { "[ACC 2168] Packard Bell PB410A", "pb410a", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 4, 36, 1, 127, machine_at_pb410a_init, NULL }, /* 486 machines */ + { "[ALi M1429G] Acer A1G", "acera1g", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 4, 36, 1, 127, machine_at_acera1g_init, at_acera1g_get_device }, + { "[ALi M1429] AMI WinBIOS 486", "win486", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_winbios1429_init, NULL }, + { "[ALi M1429] Olystar LIL1429", "ali1429", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_ali1429_init, NULL }, + { "[CS4031] AMI 486 CS4031", "cs4031", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB, 1, 64, 1, 127, machine_at_cs4031_init, NULL }, { "[OPTi 283] RYC Leopard LX", "rycleopardlx", MACHINE_TYPE_486, {{"IBM", cpus_IBM486SLC}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE, 1, 16, 1, 127, machine_at_rycleopardlx_init, NULL }, { "[OPTi 495] Award 486 clone", "award486", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_opti495_init, NULL }, - { "[OPTi 495] MR 486 clone", "mr486", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_opti495_mr_init, NULL }, { "[OPTi 495] Dataexpert SX495 (486)", "ami486", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_opti495_ami_init, NULL }, + { "[OPTi 495] MR 486 clone", "mr486", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_opti495_mr_init, NULL }, + { "[OPTi 802G] IBM PC 330 (type 6571)", "pc330_6571", MACHINE_TYPE_486, {{"Intel", cpus_i486_PC330}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_BUS_PS2 | MACHINE_IDE, 1, 64, 1, 127, machine_at_pc330_6571_init, NULL }, { "[OPTi 895] Jetway J-403TG", "403tg", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB, 1, 64, 1, 127, machine_at_403tg_init, NULL }, - { "[OPTi 802G] IBM PC 330 (type 6571)", "pc330_6571", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_BUS_PS2 | MACHINE_IDE, 1, 64, 1, 127, machine_at_pc330_6571_init, NULL }, - { "[CS4031] AMI 486 CS4031", "cs4031", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB, 1, 64, 1, 127, machine_at_cs4031_init, NULL }, { "[SiS 401] AMI 486 Clone", "sis401", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_IDE, 1, 64, 1, 127, machine_at_sis401_init, NULL }, - { "[SiS 461] IBM PS/ValuePoint 433DX/Si", "valuepoint433", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1, 64, 1, 127, machine_at_valuepoint433_init, NULL }, - { "[SiS 471] ASUS VL/I-486SV2G (GX4)", "vli486sv2g", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE_DUAL, 1, 64, 1, 127, machine_at_vli486sv2g_init, NULL }, + { "[SiS 461] IBM PS/ValuePoint 433DX/Si", "valuepoint433", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1, 64, 1, 127, machine_at_valuepoint433_init, NULL }, { "[SiS 471] AMI 486 Clone", "ami471", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 64, 1, 127, machine_at_ami471_init, NULL }, { "[SiS 471] AMI WinBIOS 486 clone", "win471", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 64, 1, 127, machine_at_win471_init, NULL }, { "[SiS 471] AOpen Vi15G", "vi15g", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 64, 1, 127, machine_at_vi15g_init, NULL }, + { "[SiS 471] ASUS VL/I-486SV2G (GX4)", "vli486sv2g", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE_DUAL, 1, 64, 1, 127, machine_at_vli486sv2g_init, NULL }, { "[SiS 471] DTK PKM-0038S E-2", "dtk486", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 64, 1, 127, machine_at_dtk486_init, NULL }, { "[SiS 471] Phoenix SiS 471", "px471", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 128, 1, 127, machine_at_px471_init, NULL }, - { "[ALi M1429G] Acer A1G", "acera1g", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 4, 36, 1, 127, machine_at_acera1g_init, at_acera1g_get_device }, - { "[ALi M1429] Olystar LIL1429", "ali1429", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_ali1429_init, NULL }, - { "[ALi M1429] AMI WinBIOS 486", "win486", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 1, 32, 1, 127, machine_at_winbios1429_init, NULL }, + { "[VIA VT82C495] FIC 486-VC-HD", "486vchd", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_AT, 1, 32, 1, 127, machine_at_486vchd_init, NULL }, { "[VLSI 82C480] IBM PS/1 model 2133", "ibmps1_2133", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_NONMI | MACHINE_VIDEO, 2, 32, 1, 127, machine_ps1_m2133_init, ps1_m2133_get_device }, #if defined(DEV_BRANCH) && defined(USE_VECT486VL) - { "[VLSI 82C480] HP Vectra 486VL", "vect486vl", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2, 64, 1, 127, machine_at_vect486vl_init, at_vect486vl_get_device }, + { "[VLSI 82C480] HP Vectra 486VL", "vect486vl", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2, 64, 1, 127, machine_at_vect486vl_init, at_vect486vl_get_device }, #endif - { "[VIA VT82C495] FIC 486-VC-HD", "486vchd", MACHINE_TYPE_486, {{"Intel", cpus_i486S1}, {"AMD", cpus_Am486S1}, {"Cyrix", cpus_Cx486S1},{"", NULL}, {"", NULL}}, MACHINE_AT, 1, 32, 1, 127, machine_at_486vchd_init, NULL }, /* 486 machines with utilize the MCA bus */ #if defined(DEV_BRANCH) && defined(USE_PS2M70T4) @@ -238,43 +236,43 @@ const machine_t machines[] = { #endif /* 486 machines which utilize the PCI bus */ +#if defined(DEV_BRANCH) && defined(USE_M1489) + { "[ALi M1489] ABIT AB-PB4", "abpb4", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 64, 1, 255, machine_at_abpb4_init, NULL }, +#endif { "[i420EX] ASUS PVI-486AP4", "486ap4", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCIV | MACHINE_IDE_DUAL, 1, 128, 1, 127, machine_at_486ap4_init, NULL }, { "[i420ZX] ASUS PCI/I-486SP3G", "486sp3g", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 128, 1, 127, machine_at_486sp3g_init, NULL }, { "[i420TX] Intel Classic/PCI", "alfredo", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_alfredo_init, NULL }, { "[SiS 496] Lucky Star LS-486E", "ls486e", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 128, 1, 255, machine_at_ls486e_init, NULL }, + { "[SiS 496] Micronics M4Li", "m4li", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 1, 128, 1, 127, machine_at_m4li_init, NULL }, { "[SiS 496] Rise Computer R418", "r418", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 255, 1, 255, machine_at_r418_init, NULL }, { "[SiS 496] Soyo 4SA2", "4sa2", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 255, 1, 255, machine_at_4sa2_init, NULL }, - { "[SiS 496] Micronics M4Li", "m4li", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 1, 128, 1, 127, machine_at_m4li_init, NULL }, - { "[SiS 496] Zida Tomato 4DPS", "4dps", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 255, 1, 255, machine_at_4dps_init, NULL }, -#if defined(DEV_BRANCH) && defined(NO_SIO) - { "[VIA VT82C496G] FIC VIP-IO2", "486vipio2", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCIV | MACHINE_IDE_DUAL, 1, 128, 1, 255, machine_at_486vipio2_init, NULL }, -#endif -#if defined(DEV_BRANCH) && defined(USE_M1489) - { "[ALi M1489] ABIT AB-PB4", "abpb4", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 64, 1, 255, machine_at_abpb4_init, NULL }, -#endif + { "[SiS 496] Zida Tomato 4DP", "4dps", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_IDE_DUAL, 1, 255, 1, 255, machine_at_4dps_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_STPC) { "[STPC Client] ITOX STAR", "itoxstar", MACHINE_TYPE_486, {{"ST", cpus_STPCDX}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 255, machine_at_itoxstar_init, NULL }, { "[STPC Consumer-II] Acrosser AR-B1479", "arb1479", MACHINE_TYPE_486, {{"ST", cpus_STPCDX2}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 32, 160, 8, 255, machine_at_arb1479_init, NULL }, { "[STPC Elite] Advantech PCM-9340", "pcm9340", MACHINE_TYPE_486, {{"ST", cpus_STPCDX2}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 32, 96, 8, 255, machine_at_pcm9340_init, NULL }, { "[STPC Atlas] AAEON PCM-5330", "pcm5330", MACHINE_TYPE_486, {{"ST", cpus_STPCDX2}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 32, 128, 32, 255, machine_at_pcm5330_init, NULL }, #endif +#if defined(DEV_BRANCH) && defined(NO_SIO) + { "[VIA VT82C496G] FIC VIP-IO2", "486vipio2", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCIV | MACHINE_IDE_DUAL, 1, 128, 1, 255, machine_at_486vipio2_init, NULL }, +#endif /* Socket 4 machines */ - /* OPTi 596/597 */ - { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 2, 64, 2, 127, machine_at_excalibur_init, NULL }, - /* 430LX */ - { "[i430LX] IBM Ambra DP60 PCI", "ambradp60", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_ambradp60_init, NULL }, - { "[i430LX] IBM PS/ValuePoint P60", "valuepointp60", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_valuepointp60_init, NULL }, + { "[i430LX] ASUS P/I-P5MP3", "p5mp3", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE, 2, 192, 2, 127, machine_at_p5mp3_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_DELLS4) - { "[i430LX] Dell Dimension XPS P60", "dellxp60", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_dellxp60_init, NULL }, + { "[i430LX] Dell Dimension XPS P60", "dellxp60", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE, 2, 128, 2, 127, machine_at_dellxp60_init, NULL }, { "[i430LX] Dell OptiPlex 560/L", "opti560l", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_opti560l_init, NULL }, #endif + { "[i430LX] IBM Ambra DP60 PCI", "ambradp60", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_ambradp60_init, NULL }, + { "[i430LX] IBM PS/ValuePoint P60", "valuepointp60", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_valuepointp60_init, NULL }, { "[i430LX] Intel Premiere/PCI", "revenge", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_batman_init, NULL }, - { "[i430LX] ASUS P/I-P5MP3", "p5mp3", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE, 2, 192, 2, 127, machine_at_p5mp3_init, NULL }, { "[i430LX] Micro Star 586MC1", "586mc1", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_586mc1_init, NULL }, { "[i430LX] Packard Bell PB520R", "pb520r", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8, 136, 2, 127, machine_at_pb520r_init, at_pb520r_get_device }, + /* OPTi 596/597 */ + { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_VLB | MACHINE_IDE, 2, 64, 2, 127, machine_at_excalibur_init, NULL }, + /* Socket 5 machines */ /* 430NX */ { "[i430NX] Intel Premiere/PCI II", "plato", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2, 128, 2, 127, machine_at_plato_init, NULL }, @@ -284,9 +282,7 @@ const machine_t machines[] = { /* 430FX */ { "[i430FX] Acer V30", "acerv30", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_acerv30_init, NULL }, { "[i430FX] AMI Apollo", "apollo", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_apollo_init, NULL }, -#if defined(DEV_BRANCH) && defined(USE_VECTRA54) - { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 511, machine_at_vectra54_init, NULL }, -#endif + { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8, 128, 8, 511, machine_at_vectra54_init, at_vectra54_get_device }, { "[i430FX] Intel Advanced/ZP", "zappa", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_zappa_init, NULL }, { "[i430FX] NEC PowerMate V", "powermate_v", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_powermate_v_init, NULL }, { "[i430FX] PC Partner MB500N", "mb500n", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_mb500n_init, NULL }, @@ -318,17 +314,20 @@ const machine_t machines[] = { /* 430VX */ { "[i430VX] ASUS P/I-P55TVP4", "p55tvp4", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_p55tvp4_init, NULL }, - { "[i430VX] Shuttle HOT-557", "430vx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_i430vx_init, NULL }, + { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL }, + { "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_presario4500_init, NULL }, { "[i430VX] Epox P55-VA", "p55va", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_p55va_init, NULL }, { "[i430VX] Gateway 2000 Tigereye", "gw2kte", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_gw2kte_init, NULL }, { "[i430VX] HP Brio 80xx", "brio80xx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_brio80xx_init, NULL }, - { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL }, - { "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_presario4500_init, NULL }, { "[i430VX] Packard Bell PB680", "pb680", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_pb680_init, NULL }, + { "[i430VX] Shuttle HOT-557", "430vx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_i430vx_init, NULL }, /* 430TX */ { "[i430TX] ADLink NuPRO-592", "nupro592", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 256, 8, 255, machine_at_nupro592_init, NULL }, { "[i430TX] ASUS TX97", "tx97", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 256, 8, 255, machine_at_tx97_init, NULL }, +#if defined(DEV_BRANCH) && defined(NO_SIO) + { "[i430TX] Intel AN430TX", "an430tx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 256, 8, 255, machine_at_an430tx_init, NULL }, +#endif { "[i430TX] Intel YM430TX", "ym430tx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 256, 8, 255, machine_at_ym430tx_init, NULL }, { "[i430TX] PC Partner MB540N", "mb540n", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 256, 8, 255, machine_at_mb540n_init, NULL }, { "[i430TX] SuperMicro Super P5MMS98", "p5mms98", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 256, 8, 255, machine_at_p5mms98_init, NULL }, @@ -347,10 +346,10 @@ const machine_t machines[] = { /* Socket 8 machines */ /* 440FX */ + { "[i440FX] Acer V60N", "v60n", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 127, machine_at_v60n_init, NULL }, { "[i440FX] ASUS P/I-P65UP5 (C-P6ND)", "p65up5_cp6nd", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 127, machine_at_p65up5_cp6nd_init, NULL }, { "[i440FX] Biostar MB-8600TTC", "8600ttc", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 127, machine_at_8500ttc_init, NULL }, { "[i440FX] Gigabyte GA-686NX", "686nx", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 127, machine_at_686nx_init, NULL }, - { "[i440FX] Acer V60N", "v60n", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 127, machine_at_v60n_init, NULL }, { "[i440FX] Intel AP440FX", "ap440fx", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_ap440fx_init, NULL }, { "[i440FX] Intel VS440FX", "vs440fx", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 127, machine_at_vs440fx_init, NULL }, { "[i440FX] Micronics M6Mi", "m6mi", MACHINE_TYPE_SOCKET8, {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 127, machine_at_m6mi_init, NULL }, @@ -367,6 +366,7 @@ const machine_t machines[] = { /* 440EX */ { "[i440EX] QDI EXCELLENT II", "p6i440e2", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII66}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 255, machine_at_p6i440e2_init, NULL }, + /* 440BX */ { "[i440BX] ASUS P2B-LS", "p2bls", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 255, machine_at_p2bls_init, NULL }, { "[i440BX] ASUS P3B-F", "p3bf", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 255, machine_at_p3bf_init, NULL }, @@ -377,7 +377,7 @@ const machine_t machines[] = { { "[i440BX] Tyan Tsunami ATX", "tsunamiatx", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8, 1024, 8, 255, machine_at_tsunamiatx_init, at_tsunamiatx_get_device }, { "[i440BX] SuperMicro Super P6SBA", "p6sba", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_p6sba_init, NULL }, #if defined(DEV_BRANCH) && defined(NO_SIO) - { "[i440BX] Fujitsu ErgoPro x365", "ergox365", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 384, 8, 511, machine_at_ergox365_init, NULL }, + { "[i440BX] Fujitsu ErgoPro x365", "ergox365", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 384, 8, 511, machine_at_ergox365_init, NULL }, #endif /* 440GX */ @@ -389,29 +389,29 @@ const machine_t machines[] = { /* Slot 2 machines(Including Slot 1/2 Hybrids) */ /* 440GX */ { "[i440GX] Gigabyte GA-6GXU", "6gxu", MACHINE_TYPE_SLOT2, {{"Intel", cpus_Xeon}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16, 2048, 16, 511, machine_at_6gxu_init, NULL }, - { "[i440GX] SuperMicro Super S2DGE", "s2dge", MACHINE_TYPE_SLOT2, {{"Intel", cpus_Xeon}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16, 2048, 16, 511, machine_at_s2dge_init, NULL }, { "[i440GX] Freeway FW-6400GX", "fw6400gx", MACHINE_TYPE_SLOT2, {{"Intel", cpus_Xeon}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16, 2032, 16, 511, machine_at_fw6400gx_init, NULL }, + { "[i440GX] SuperMicro Super S2DGE", "s2dge", MACHINE_TYPE_SLOT2, {{"Intel", cpus_Xeon}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16, 2048, 16, 511, machine_at_s2dge_init, NULL }, /* PGA370 machines */ /* 440LX */ { "[i440LX] SuperMicro Super 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_s370slm_init, NULL }, /* 440BX */ + { "[i440BX] AEWIN AW-O671R", "awo671r", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 255, machine_at_awo671r_init, NULL }, { "[i440BX] ASUS CUBX", "cubx", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 255, machine_at_cubx_init, NULL }, { "[i440BX] A-Trend ATC7020BXII", "atc7020bxii", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 255, machine_at_atc7020bxii_init, NULL }, { "[i440BX] AmazePC AM-BX133", "ambx133", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_ambx133_init, NULL }, - { "[i440BX] AEWIN AW-O671R", "awo671r", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 255, machine_at_awo671r_init, NULL }, - { "[i440BX] TYAN Trinity 371", "trinity371", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_trinity371_init, NULL }, + { "[i440BX] TYAN Trinity 371", "trinity371", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_trinity371_init, NULL }, /* 440ZX */ { "[i440ZX] Soltek SL-63A1", "63a", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 255, machine_at_63a_init, NULL }, /* VIA Apollo Pro */ { "[VIA Apollo Pro] PC Partner APAS3", "apas3", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_apas3_init, NULL }, - { "[VIA Apollo Pro133A] Aewin WCF-681", "wcf681", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_wcf681_init, NULL }, - { "[VIA Apollo Pro133A] Acorp 6VIA85X", "6via85x", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_6via85x_init, NULL }, - { "[VIA Apollo Pro133A] ECS P6BAP", "p6bap", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_p6bap_init, NULL }, - { "[VIA Apollo ProMedia] Jetway 603TCF", "603tcf", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 255, machine_at_603tcf_init, NULL }, + { "[VIA Apollo Pro133A] Aewin WCF-681", "wcf681", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_wcf681_init, NULL }, + { "[VIA Apollo Pro133A] Acorp 6VIA85X", "6via85x", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_6via85x_init, NULL }, + { "[VIA Apollo Pro133A] ECS P6BAP", "p6bap", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 768, 8, 255, machine_at_p6bap_init, NULL }, + { "[VIA Apollo ProMedia] Jetway 603TCF", "603tcf", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 512, 8, 255, machine_at_603tcf_init, NULL }, /* Miscellaneous/Fake/Hypervisor machines */ { "[i440BX] Microsoft Virtual PC 2007", "vpc2007", MACHINE_TYPE_MISC, {{"Intel", cpus_PentiumIID}, {"Intel/PGA370", cpus_Celeron},{"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 1024, 8, 255, machine_at_vpc2007_init, NULL }, diff --git a/src/mem/catalyst_flash.c b/src/mem/catalyst_flash.c index 7e672e5a8..615387ee2 100644 --- a/src/mem/catalyst_flash.c +++ b/src/mem/catalyst_flash.c @@ -265,5 +265,5 @@ const device_t catalyst_flash_device = catalyst_flash_init, catalyst_flash_close, catalyst_flash_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; diff --git a/src/mem/intel_flash.c b/src/mem/intel_flash.c index 9f4f50ea7..4d0c8b6f3 100644 --- a/src/mem/intel_flash.c +++ b/src/mem/intel_flash.c @@ -14,8 +14,8 @@ * Authors: Sarah Walker, * Miran Grca, * - * Copyright 2008-2019 Sarah Walker. - * Copyright 2016-2019 Miran Grca. + * Copyright 2008-2020 Sarah Walker. + * Copyright 2016-2020 Miran Grca. */ #include #include @@ -186,7 +186,7 @@ flash_write(uint32_t addr, uint8_t val, void *p) case CMD_ERASE_SETUP: if (val == CMD_ERASE_CONFIRM) { for (i = 0; i < 3; i++) { - if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) + if ((i == dev->program_addr) && (addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) memset(&(dev->array[dev->block_start[i]]), 0xff, dev->block_len[i]); } @@ -209,6 +209,12 @@ flash_write(uint32_t addr, uint8_t val, void *p) case CMD_CLEAR_STATUS: dev->status = 0; break; + case CMD_ERASE_SETUP: + for (i = 0; i < 3; i++) { + if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) + dev->program_addr = i; + } + break; case CMD_PROGRAM_SETUP: case CMD_PROGRAM_SETUP_ALT: dev->program_addr = addr; @@ -237,7 +243,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p) case CMD_ERASE_SETUP: if (val == CMD_ERASE_CONFIRM) { for (i = 0; i < 3; i++) { - if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) + if ((i == dev->program_addr) && (addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) memset(&(dev->array[dev->block_start[i]]), 0xff, dev->block_len[i]); } @@ -260,6 +266,12 @@ flash_writew(uint32_t addr, uint16_t val, void *p) case CMD_CLEAR_STATUS: dev->status = 0; break; + case CMD_ERASE_SETUP: + for (i = 0; i < 3; i++) { + if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) + dev->program_addr = i; + } + break; case CMD_PROGRAM_SETUP: case CMD_PROGRAM_SETUP_ALT: dev->program_addr = addr; @@ -555,7 +567,7 @@ const device_t intel_flash_bxt_ami_device = intel_flash_init, intel_flash_close, intel_flash_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; @@ -566,7 +578,7 @@ const device_t intel_flash_bxt_device = intel_flash_init, intel_flash_close, intel_flash_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; @@ -577,5 +589,5 @@ const device_t intel_flash_bxb_device = intel_flash_init, intel_flash_close, intel_flash_reset, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; diff --git a/src/mem/rom.c b/src/mem/rom.c index 040afca50..a94d7f4ab 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -470,7 +470,8 @@ bios_load_linear_combined2(wchar_t *fn1, wchar_t *fn2, wchar_t *fn3, wchar_t *fn ret &= bios_load_aux_linear(fn1, 0x000d0000, 65536, off); ret &= bios_load_aux_linear(fn2, 0x000c0000, 65536, off); ret &= bios_load_aux_linear(fn4, 0x000e0000, sz - 196608, off); - ret &= bios_load_aux_linear(fn5, 0x000ec000, 16384, off); + if (fn5 != NULL) + ret &= bios_load_aux_linear(fn5, 0x000ec000, 16384, off); return ret; } diff --git a/src/mem/sst_flash.c b/src/mem/sst_flash.c index 1c73e8bd3..a7a5d942f 100644 --- a/src/mem/sst_flash.c +++ b/src/mem/sst_flash.c @@ -434,7 +434,7 @@ const device_t sst_flash_29ee010_device = sst_init, sst_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; @@ -446,7 +446,7 @@ const device_t sst_flash_29ee020_device = sst_init, sst_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; @@ -458,7 +458,7 @@ const device_t sst_flash_39sf010_device = sst_init, sst_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; @@ -470,7 +470,7 @@ const device_t sst_flash_39sf020_device = sst_init, sst_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; const device_t sst_flash_39sf040_device = @@ -481,5 +481,5 @@ const device_t sst_flash_39sf040_device = sst_init, sst_close, NULL, - NULL, NULL, NULL, NULL + { NULL }, NULL, NULL, NULL }; diff --git a/src/network/net_3c503.c b/src/network/net_3c503.c index c75c07353..66221c62a 100644 --- a/src/network/net_3c503.c +++ b/src/network/net_3c503.c @@ -639,7 +639,7 @@ threec503_nic_close(void *priv) static const device_config_t threec503_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x300, + "base", "Address", CONFIG_HEX16, "", 0x300, "", { 0 }, { { "0x250", 0x250 @@ -669,11 +669,9 @@ static const device_config_t threec503_config[] = "", 0 } }, - { { NULL, { NULL } } }, - { 0, 0, 0 } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 2", 2 @@ -691,11 +689,9 @@ static const device_config_t threec503_config[] = "", 0 } }, - { { NULL, { NULL } } }, - { 0, 0, 0 } }, { - "dma", "DMA", CONFIG_SELECTION, "", 3, + "dma", "DMA", CONFIG_SELECTION, "", 3, "", { 0 }, { { "DMA 1", 1 @@ -710,21 +706,17 @@ static const device_config_t threec503_config[] = "", 0 } }, - { { NULL, { NULL } } }, - { 0, 0, 0 } }, { - "mac", "MAC Address", CONFIG_MAC, "", -1, + "mac", "MAC Address", CONFIG_MAC, "", -1, "", { 0 }, { { "", 0 } }, - { { NULL, { NULL } } }, - { 0, 0, 0 } }, { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xCC000, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0xCC000, "", { 0 }, { { "DC00", 0xDC000 @@ -742,18 +734,9 @@ static const device_config_t threec503_config[] = "", 0 } }, - { { NULL, { NULL } } }, - { 0, 0, 0 } }, { - "", "", -1, "", -1, - { - { - "", 0 - } - }, - { { NULL, { NULL } } }, - { 0, 0, 0 } + "", "", -1 } }; @@ -763,6 +746,6 @@ const device_t threec503_device = { DEVICE_ISA, 0, threec503_nic_init, threec503_nic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, threec503_config }; diff --git a/src/network/net_dp8390.c b/src/network/net_dp8390.c index 892101976..5f31ba58a 100644 --- a/src/network/net_dp8390.c +++ b/src/network/net_dp8390.c @@ -30,7 +30,8 @@ static void dp8390_tx(dp8390_t *dev, uint32_t val); -void dp8390_rx(void *priv, uint8_t *buf, int io_len); +static int dp8390_rx_common(void *priv, uint8_t *buf, int io_len); +int dp8390_rx(void *priv, uint8_t *buf, int io_len); #ifdef ENABLE_DP8390_LOG @@ -204,7 +205,7 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val) /* Check for start-tx */ if ((val & 0x04) && dev->TCR.loop_cntl) { if (dev->TCR.loop_cntl) { - dp8390_rx(dev, &dev->mem[(dev->tx_page_start * 256) - dev->mem_start], + dp8390_rx_common(dev, &dev->mem[(dev->tx_page_start * 256) - dev->mem_start], dev->tx_bytes); } } else if (val & 0x04) { @@ -270,8 +271,8 @@ dp8390_tx(dp8390_t *dev, uint32_t val) * if it should be accepted, and if the RX ring has enough room, * it is copied into it and the receive process is updated. */ -void -dp8390_rx(void *priv, uint8_t *buf, int io_len) +static int +dp8390_rx_common(void *priv, uint8_t *buf, int io_len) { dp8390_t *dev = (dp8390_t *)priv; static uint8_t bcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; @@ -284,7 +285,8 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) if (io_len != 60) dp8390_log("%s: rx_frame with length %d\n", dev->name, io_len); - if ((dev->CR.stop != 0) || (dev->page_start == 0)) return; + if ((dev->CR.stop != 0) || (dev->page_start == 0)) + return 0; /* * Add the pkt header + CRC to the length, and work @@ -312,7 +314,7 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) dp8390_log("DP8390: no space\n"); #endif - return; + return 0; } if ((io_len < 40/*60*/) && !dev->RCR.runts_ok) { @@ -320,7 +322,7 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) dp8390_log("DP8390: rejected small packet, length %d\n", io_len); #endif - return; + return 1; } /* Some computers don't care... */ @@ -341,7 +343,7 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) #ifdef ENABLE_DP8390_LOG dp8390_log("DP8390: RX BC disabled\n"); #endif - return; + return 1; } } @@ -352,7 +354,7 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) #ifdef ENABLE_DP8390_LOG dp8390_log("DP8390: RX MC disabled\n"); #endif - return; + return 1; } /* Are we listening to this multicast address? */ @@ -361,12 +363,13 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) #ifdef ENABLE_DP8390_LOG dp8390_log("DP8390: RX MC not listed\n"); #endif - return; + return 1; } } /* Unicast, must be for us.. */ - else if (memcmp(buf, dev->physaddr, 6)) return; + else if (memcmp(buf, dev->physaddr, 6)) + return 1; } else { #ifdef ENABLE_DP8390_LOG dp8390_log("DP8390: RX promiscuous receive\n"); @@ -407,6 +410,20 @@ dp8390_rx(void *priv, uint8_t *buf, int io_len) if (dev->IMR.rx_inte && dev->interrupt) dev->interrupt(dev->priv, 1); + + return 1; +} + + +int +dp8390_rx(void *priv, uint8_t *buf, int io_len) +{ + dp8390_t *dev = (dp8390_t *)priv; + + if ((dev->DCR.loop == 0) || (dev->TCR.loop_cntl != 0)) + return 0; + + return dp8390_rx_common(priv, buf, io_len); } @@ -1099,5 +1116,5 @@ const device_t dp8390_device = "DP8390 Network Interface Controller", 0, 0, dp8390_init, dp8390_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index c4f0ccf8b..b46ac2aaf 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -1492,7 +1492,7 @@ nic_close(void *priv) static const device_config_t ne1000_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x300, + "base", "Address", CONFIG_HEX16, "", 0x300, "", { 0 }, { { "0x280", 0x280 @@ -1518,7 +1518,7 @@ static const device_config_t ne1000_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 2", 2 @@ -1554,7 +1554,7 @@ static const device_config_t ne1000_config[] = static const device_config_t ne2000_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x300, + "base", "Address", CONFIG_HEX16, "", 0x300, "", { 0 }, { { "0x280", 0x280 @@ -1580,7 +1580,7 @@ static const device_config_t ne2000_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 10, + "irq", "IRQ", CONFIG_SELECTION, "", 10, "", { 0 }, { { "IRQ 2", 2 @@ -1609,7 +1609,7 @@ static const device_config_t ne2000_config[] = "mac", "MAC Address", CONFIG_MAC, "", -1 }, { - "bios_addr", "BIOS address", CONFIG_HEX20, "", 0, + "bios_addr", "BIOS address", CONFIG_HEX20, "", 0, "", { 0 }, { { "Disabled", 0x00000 @@ -1673,7 +1673,7 @@ const device_t ne1000_device = { DEVICE_ISA, NE2K_NE1000, nic_init, nic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ne1000_config }; @@ -1682,7 +1682,7 @@ const device_t ne2000_device = { DEVICE_ISA | DEVICE_AT, NE2K_NE2000, nic_init, nic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ne2000_config }; @@ -1691,7 +1691,7 @@ const device_t ethernext_mc_device = { DEVICE_MCA, NE2K_ETHERNEXT_MC, nic_init, nic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, mca_mac_config }; @@ -1700,7 +1700,7 @@ const device_t rtl8019as_device = { DEVICE_ISA | DEVICE_AT, NE2K_RTL8019AS, nic_init, nic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, rtl8019as_config }; @@ -1709,6 +1709,6 @@ const device_t rtl8029as_device = { DEVICE_PCI, NE2K_RTL8029AS, nic_init, nic_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, rtl8029as_config }; diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index c91d3e80a..83823cf5d 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -200,10 +200,9 @@ poll_thread(void *arg) mac_cmp32[1] = *(uint32_t *)mac; mac_cmp16[1] = *(uint16_t *)(mac+4); if ((mac_cmp32[0] != mac_cmp32[1]) || - (mac_cmp16[0] != mac_cmp16[1])) { - + (mac_cmp16[0] != mac_cmp16[1])) network_queue_put(0, poll_card->priv, data, h.caplen); - } else { + else { /* Mark as invalid packet. */ data = NULL; } diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index c04a2d5eb..73f1c01b0 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -1238,7 +1238,7 @@ pcnetCalcPacketLen(nic_t *dev, int cb) /** * Write data into guest receive buffers. */ -static void +static int pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) { nic_t *dev = (nic_t *)priv; @@ -1248,7 +1248,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) uint8_t buf1[60]; if (CSR_DRX(dev) || CSR_STOP(dev) || CSR_SPND(dev) || !size) - return; + return 0; /* if too small buffer, then expand it */ if (size < 60) { @@ -1262,7 +1262,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) * Drop packets if the cable is not connected */ if (!pcnetIsLinkUp(dev)) - return; + return 0; pcnetlog(1, "%s: pcnetReceiveNoSync: RX %x:%x:%x:%x:%x:%x > %x:%x:%x:%x:%x:%x len %d\n", dev->name, buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], @@ -1370,7 +1370,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) /* RX disabled in the meantime? If so, abort RX. */ if (CSR_DRX(dev) || CSR_STOP(dev) || CSR_SPND(dev)) { pcnetlog(3, "%s: RX disabled 1\n", dev->name); - return; + return 0; } /* Was the register modified in the meantime? If so, don't touch the @@ -1415,7 +1415,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) /* RX disabled in the meantime? If so, abort RX. */ if (CSR_DRX(dev) || CSR_STOP(dev) || CSR_SPND(dev)) { pcnetlog(3, "%s: RX disabled 2\n", dev->name); - return; + return 0; } /* Was the register modified in the meantime? If so, don't touch the @@ -1459,6 +1459,8 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) } pcnetUpdateIrq(dev); + + return 1; } /** @@ -3027,7 +3029,7 @@ static const device_config_t pcnet_pci_config[] = static const device_config_t pcnet_isa_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x300, + "base", "Address", CONFIG_HEX16, "", 0x300, "", { 0 }, { { "0x300", 0x300 @@ -3047,7 +3049,7 @@ static const device_config_t pcnet_isa_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 3", 3 @@ -3067,7 +3069,7 @@ static const device_config_t pcnet_isa_config[] = }, }, { - "dma", "DMA channel", CONFIG_SELECTION, "", 5, + "dma", "DMA channel", CONFIG_SELECTION, "", 5, "", { 0 }, { { "DMA 3", 3 @@ -3097,7 +3099,7 @@ static const device_config_t pcnet_isa_config[] = static const device_config_t pcnet_vlb_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x300, + "base", "Address", CONFIG_HEX16, "", 0x300, "", { 0 }, { { "0x300", 0x300 @@ -3117,7 +3119,7 @@ static const device_config_t pcnet_vlb_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 3", 3 @@ -3149,7 +3151,7 @@ const device_t pcnet_am79c960_device = { DEVICE_AT | DEVICE_ISA, DEV_AM79C960, pcnet_init, pcnet_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, pcnet_isa_config }; @@ -3158,7 +3160,7 @@ const device_t pcnet_am79c960_eb_device = { DEVICE_AT | DEVICE_ISA, DEV_AM79C960_EB, pcnet_init, pcnet_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, pcnet_isa_config }; @@ -3167,7 +3169,7 @@ const device_t pcnet_am79c960_vlb_device = { DEVICE_VLB, DEV_AM79C960_VLB, pcnet_init, pcnet_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, pcnet_vlb_config }; @@ -3176,7 +3178,7 @@ const device_t pcnet_am79c970a_device = { DEVICE_PCI, DEV_AM79C970A, pcnet_init, pcnet_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, pcnet_pci_config }; @@ -3185,6 +3187,6 @@ const device_t pcnet_am79c973_device = { DEVICE_PCI, DEV_AM79C973, pcnet_init, pcnet_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, pcnet_pci_config }; diff --git a/src/network/net_plip.c b/src/network/net_plip.c index 25bf60bce..25610ef78 100644 --- a/src/network/net_plip.c +++ b/src/network/net_plip.c @@ -417,7 +417,7 @@ rx_timer(void *priv) } -static void +static int plip_rx(void *priv, uint8_t *buf, int io_len) { plip_t *dev = (plip_t *) priv; @@ -426,7 +426,7 @@ plip_rx(void *priv, uint8_t *buf, int io_len) if (dev->rx_pkt) { /* shouldn't really happen with the RX queue paused */ plip_log(3, "PLIP: already have a packet to receive"); - return; + return 0; } if (!(dev->rx_pkt = malloc(io_len))) /* unlikely */ @@ -440,6 +440,8 @@ plip_rx(void *priv, uint8_t *buf, int io_len) /* Dispatch this packet immediately if we're doing nothing. */ plip_receive_packet(dev); + + return 1; } @@ -502,8 +504,8 @@ const lpt_device_t lpt_plip_device = { const device_t plip_device = { - "Parallel Line Internet Protocol (Network)", - 0, 0, + "Parallel Line Internet Protocol", + DEVICE_LPT, 0, plip_net_init, NULL, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/network/net_wd8003.c b/src/network/net_wd8003.c index 7eeb4d136..253b83ffe 100644 --- a/src/network/net_wd8003.c +++ b/src/network/net_wd8003.c @@ -743,7 +743,7 @@ wd_close(void *priv) static const device_config_t wd8003_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x300, + "base", "Address", CONFIG_HEX16, "", 0x300, "", { 0 }, { { "0x240", 0x240 @@ -763,7 +763,7 @@ static const device_config_t wd8003_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 2", 2 @@ -783,7 +783,7 @@ static const device_config_t wd8003_config[] = }, }, { - "ram_addr", "RAM address", CONFIG_HEX20, "", 0xD0000, + "ram_addr", "RAM address", CONFIG_HEX20, "", 0xD0000, "", { 0 }, { { "C800", 0xC8000 @@ -819,7 +819,7 @@ static const device_config_t wd8003_config[] = static const device_config_t wd8003eb_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x280, + "base", "Address", CONFIG_HEX16, "", 0x280, "", { 0 }, { { "0x200", 0x200 @@ -857,7 +857,7 @@ static const device_config_t wd8003eb_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 2/9", 9 @@ -877,7 +877,7 @@ static const device_config_t wd8003eb_config[] = }, }, { - "ram_addr", "RAM address", CONFIG_HEX20, "", 0xD0000, + "ram_addr", "RAM address", CONFIG_HEX20, "", 0xD0000, "", { 0 }, { { "C000", 0xC0000 @@ -909,7 +909,7 @@ static const device_config_t wd8003eb_config[] = }, }, { - "ram_size", "RAM size", CONFIG_SELECTION, "", 8192, + "ram_size", "RAM size", CONFIG_SELECTION, "", 8192, "", { 0 }, { { "8 kB", 8192 @@ -935,7 +935,7 @@ static const device_config_t wd8003eb_config[] = static const device_config_t wd8013_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x280, + "base", "Address", CONFIG_HEX16, "", 0x280, "", { 0 }, { { "0x200", 0x200 @@ -973,7 +973,7 @@ static const device_config_t wd8013_config[] = }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 3, + "irq", "IRQ", CONFIG_SELECTION, "", 3, "", { 0 }, { { "IRQ 2/9", 9 @@ -1005,7 +1005,7 @@ static const device_config_t wd8013_config[] = }, }, { - "ram_addr", "RAM address", CONFIG_HEX20, "", 0xD0000, + "ram_addr", "RAM address", CONFIG_HEX20, "", 0xD0000, "", { 0 }, { { "C000", 0xC0000 @@ -1037,7 +1037,7 @@ static const device_config_t wd8013_config[] = }, }, { - "ram_size", "RAM size", CONFIG_SELECTION, "", 16384, + "ram_size", "RAM size", CONFIG_SELECTION, "", 16384, "", { 0 }, { { "16 kB", 16384 @@ -1074,7 +1074,7 @@ const device_t wd8003e_device = { DEVICE_ISA, WD8003E, wd_init, wd_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, wd8003_config }; @@ -1083,7 +1083,7 @@ const device_t wd8003eb_device = { DEVICE_ISA, WD8003EB, wd_init, wd_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, wd8003eb_config }; @@ -1092,7 +1092,7 @@ const device_t wd8013ebt_device = { DEVICE_ISA, WD8013EBT, wd_init, wd_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, wd8013_config }; @@ -1101,7 +1101,7 @@ const device_t wd8003eta_device = { DEVICE_MCA, WD8003ETA, wd_init, wd_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, mca_mac_config }; @@ -1110,6 +1110,6 @@ const device_t wd8003ea_device = { DEVICE_MCA, WD8003EA, wd_init, wd_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, mca_mac_config }; diff --git a/src/network/network.c b/src/network/network.c index fe3507e13..cc73b5ac7 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -70,44 +70,25 @@ static netcard_t net_cards[] = { - { "None", "none", NULL, - NULL }, - { "[ISA] 3Com EtherLink II (3C503)","3c503", &threec503_device, - NULL }, - { "[ISA] AMD PCnet-ISA", "pcnetisa", &pcnet_am79c960_device, - NULL }, - { "[ISA] Novell NE1000", "ne1k", &ne1000_device, - NULL }, - { "[ISA] Novell NE2000", "ne2k", &ne2000_device, - NULL }, - { "[ISA] Racal Interlan EtherBlaster", "pcnetracal", &pcnet_am79c960_eb_device, - NULL }, - { "[ISA] Realtek RTL8019AS", "ne2kpnp", &rtl8019as_device, - NULL }, - { "[ISA] Western Digital WD8003E", "wd8003e", &wd8003e_device, - NULL }, - { "[ISA] Western Digital WD8003EB", "wd8003eb", &wd8003eb_device, - NULL }, - { "[ISA] Western Digital WD8013EBT","wd8013ebt", &wd8013ebt_device, - NULL }, - { "[LPT] PLIP", "plip", &plip_device, - NULL }, - { "[MCA] NetWorth Ethernet/MC", "ethernextmc", ðernext_mc_device, - NULL }, - { "[MCA] Western Digital WD8003ET/A","wd8003eta", &wd8003eta_device, - NULL }, - { "[MCA] Western Digital WD8003E/A", "wd8003ea", &wd8003ea_device, - NULL }, - { "[PCI] AMD PCnet-FAST III", "pcnetfast", &pcnet_am79c973_device, - NULL }, - { "[PCI] AMD PCnet-PCI II", "pcnetpci", &pcnet_am79c970a_device, - NULL }, - { "[PCI] Realtek RTL8029AS", "ne2kpci", &rtl8029as_device, - NULL }, - { "[VLB] AMD PCnet-VL", "pcnetvlb", &pcnet_am79c960_vlb_device, - NULL }, - { "", "", NULL, - NULL } + { "none", NULL, NULL }, + { "3c503", &threec503_device, NULL }, + { "pcnetisa", &pcnet_am79c960_device, NULL }, + { "ne1k", &ne1000_device, NULL }, + { "ne2k", &ne2000_device, NULL }, + { "pcnetracal", &pcnet_am79c960_eb_device, NULL }, + { "ne2kpnp", &rtl8019as_device, NULL }, + { "wd8003e", &wd8003e_device, NULL }, + { "wd8003eb", &wd8003eb_device, NULL }, + { "wd8013ebt", &wd8013ebt_device, NULL }, + { "plip", &plip_device, NULL }, + { "ethernextmc", ðernext_mc_device, NULL }, + { "wd8003eta", &wd8003eta_device, NULL }, + { "wd8003ea", &wd8003ea_device, NULL }, + { "pcnetfast", &pcnet_am79c973_device, NULL }, + { "pcnetpci", &pcnet_am79c970a_device, NULL }, + { "ne2kpci", &rtl8029as_device, NULL }, + { "pcnetvlb", &pcnet_am79c960_vlb_device, NULL }, + { "", NULL, NULL } }; @@ -117,7 +98,8 @@ int network_ndev; int network_card; char network_host[522]; netdev_t network_devs[32]; -int network_rx_pause = 0; +int network_rx_pause = 0, + network_tx_pause = 0; #ifdef ENABLE_NIC_LOG int nic_do_log = ENABLE_NIC_LOG; #endif @@ -355,6 +337,8 @@ network_queue_clear(int tx) static void network_rx_queue(void *priv) { + int ret = 1; + if (network_rx_pause) { timer_on_auto(&network_rx_queue_timer, 0.762939453125 * 2.0 * 128.0); return; @@ -367,14 +351,15 @@ network_rx_queue(void *priv) network_queue_get(0, &pkt); if ((pkt != NULL) && (pkt->len > 0)) { network_dump_packet(pkt); - net_cards[network_card].rx(pkt->priv, pkt->data, pkt->len); + ret = net_cards[network_card].rx(pkt->priv, pkt->data, pkt->len); if (pkt->len >= 128) timer_on_auto(&network_rx_queue_timer, 0.762939453125 * 2.0 * ((double) pkt->len)); else timer_on_auto(&network_rx_queue_timer, 0.762939453125 * 2.0 * 128.0); } else timer_on_auto(&network_rx_queue_timer, 0.762939453125 * 2.0 * 128.0); - network_queue_advance(0); + if (ret) + network_queue_advance(0); network_busy(0); } @@ -475,7 +460,6 @@ network_close(void) /* Here is where we clear the queues. */ network_queue_clear(0); network_queue_clear(1); - network_rx_pause = 0; network_log("NETWORK: closed.\n"); } @@ -574,6 +558,9 @@ network_do_tx(void) { netpkt_t *pkt = NULL; + if (network_tx_pause) + return; + network_queue_get(1, &pkt); if ((pkt != NULL) && (pkt->len > 0)) { network_dump_packet(pkt); @@ -638,14 +625,6 @@ network_card_available(int card) } -/* UI */ -char * -network_card_getname(int card) -{ - return((char *)net_cards[card].name); -} - - /* UI */ const device_t * network_card_getdevice(int card) diff --git a/src/nvr_at.c b/src/nvr_at.c index 039d32eb0..1b5612593 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -640,9 +640,12 @@ nvr_write(uint16_t addr, uint8_t val, void *priv) sub_cycles(ISA_CYCLES(8)); + if (local->bank[addr_id] == 0xff) + return; + if (addr & 1) { - if (local->bank[addr_id] == 0xff) - return; + // if (local->bank[addr_id] == 0xff) + // return; nvr_reg_write(local->addr[addr_id], val, priv); } else { local->addr[addr_id] = (val & (nvr->size - 1)); @@ -672,7 +675,7 @@ nvr_read(uint16_t addr, void *priv) sub_cycles(ISA_CYCLES(8)); - if ((addr & 1) && (local->bank[addr_id] == 0xff)) + if (/* (addr & 1) && */(local->bank[addr_id] == 0xff)) return 0xff; if (addr & 1) switch(local->addr[addr_id]) { @@ -749,6 +752,8 @@ nvr_read(uint16_t addr, void *priv) ret = local->addr[addr_id]; if (!local->read_addr) ret &= 0x80; + if (alt_access) + ret = (ret & 0x7f) | (nmi_mask ? 0x00 : 0x80); } return(ret); @@ -845,7 +850,7 @@ void nvr_at_handler(int set, uint16_t base, nvr_t *nvr) { io_handler(set, base, 2, - nvr_read,NULL,NULL, nvr_write,NULL,NULL, nvr); + nvr_read,NULL,NULL, nvr_write,NULL,NULL, nvr); } @@ -853,7 +858,7 @@ void nvr_at_sec_handler(int set, uint16_t base, nvr_t *nvr) { io_handler(set, base, 2, - nvr_sec_read,NULL,NULL, nvr_sec_write,NULL,NULL, nvr); + nvr_sec_read,NULL,NULL, nvr_sec_write,NULL,NULL, nvr); } @@ -1023,7 +1028,7 @@ const device_t at_nvr_old_device = { DEVICE_ISA | DEVICE_AT, 0, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1032,7 +1037,7 @@ const device_t at_nvr_device = { DEVICE_ISA | DEVICE_AT, 1, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1041,7 +1046,7 @@ const device_t ps_nvr_device = { DEVICE_PS2, 2, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1050,7 +1055,7 @@ const device_t amstrad_nvr_device = { DEVICE_ISA | DEVICE_AT, 3, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1059,7 +1064,7 @@ const device_t ibmat_nvr_device = { DEVICE_ISA | DEVICE_AT, 4, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1068,7 +1073,7 @@ const device_t piix4_nvr_device = { DEVICE_ISA | DEVICE_AT, 9, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1077,7 +1082,7 @@ const device_t ls486e_nvr_device = { DEVICE_ISA | DEVICE_AT, 13, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1086,7 +1091,7 @@ const device_t ami_apollo_nvr_device = { DEVICE_ISA | DEVICE_AT, 14, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; @@ -1095,6 +1100,6 @@ const device_t via_nvr_device = { DEVICE_ISA | DEVICE_AT, 15, nvr_at_init, nvr_at_close, NULL, - NULL, nvr_at_speed_changed, + { NULL }, nvr_at_speed_changed, NULL }; diff --git a/src/nvr_ps2.c b/src/nvr_ps2.c index f0203c90a..3048fb94f 100644 --- a/src/nvr_ps2.c +++ b/src/nvr_ps2.c @@ -158,6 +158,6 @@ const device_t ps2_nvr_device = { "PS/2 Secondary NVRAM", 0, 0, ps2_nvr_init, ps2_nvr_close, NULL, - NULL, NULL, + { NULL }, NULL, NULL }; diff --git a/src/pc.c b/src/pc.c index b6d60249f..75ea565af 100644 --- a/src/pc.c +++ b/src/pc.c @@ -562,6 +562,7 @@ pc_init_modules(void) { int c, m; wchar_t temp[512]; + char tempc[512]; pc_log("Scanning for ROM images:\n"); c = m = 0; @@ -598,7 +599,9 @@ pc_init_modules(void) /* Make sure we have a usable video card. */ if (! video_card_available(gfxcard)) { - swprintf(temp, sizeof(temp), plat_get_string(IDS_2064), video_card_getname(gfxcard)); + memset(tempc, 0, sizeof(tempc)); + device_get_name(video_card_getdevice(gfxcard), 0, tempc); + swprintf(temp, sizeof(temp), plat_get_string(IDS_2064), tempc); c = 0; while (video_get_internal_name(c) != NULL) { gfxcard = -1; diff --git a/src/pci.c b/src/pci.c index d7d2f70e2..b7420c953 100644 --- a/src/pci.c +++ b/src/pci.c @@ -516,20 +516,20 @@ pci_clear_irq(uint8_t card, uint8_t pci_int) uint8_t level = 0; if (! last_pci_card) { - pci_log("pci_clear_irq(%02X, %02X): No PCI slots (how are we even here?!)\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): No PCI slots (how are we even here?!)\n", card, pci_int); return; } - pci_log("pci_clear_irq(%02X, %02X): %i PCI slots\n", card, pci_int, last_pci_card); + // pci_log("pci_clear_irq(%02X, %02X): %i PCI slots\n", card, pci_int, last_pci_card); slot = card; if (slot == 0xff) { - pci_log("pci_clear_irq(%02X, %02X): Card is not on a PCI slot (how are we even here?!)\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): Card is not on a PCI slot (how are we even here?!)\n", card, pci_int); return; } - pci_log("pci_clear_irq(%02X, %02X): Card is on PCI slot %02X\n", card, pci_int, slot); + // pci_log("pci_clear_irq(%02X, %02X): Card is on PCI slot %02X\n", card, pci_int, slot); if (! pci_cards[slot].irq_routing[pci_int_index]) { - pci_log("pci_clear_irq(%02X, %02X): No IRQ routing for this slot and INT pin combination\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): No IRQ routing for this slot and INT pin combination\n", card, pci_int); return; } @@ -537,37 +537,37 @@ pci_clear_irq(uint8_t card, uint8_t pci_int) irq_line = pci_cards[slot].read(0, 0x3c, pci_cards[slot].priv); else { irq_routing = (pci_cards[slot].irq_routing[pci_int_index] - PCI_INTA) & 3; - pci_log("pci_clear_irq(%02X, %02X): IRQ routing for this slot and INT pin combination: %02X\n", card, pci_int, irq_routing); + // pci_log("pci_clear_irq(%02X, %02X): IRQ routing for this slot and INT pin combination: %02X\n", card, pci_int, irq_routing); irq_line = pci_irqs[irq_routing]; level = pci_irq_level[irq_routing]; } if (irq_line > 0x0f) { - pci_log("pci_clear_irq(%02X, %02X): IRQ line is disabled\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): IRQ line is disabled\n", card, pci_int); return; } - pci_log("pci_clear_irq(%02X, %02X): Using IRQ %i\n", card, pci_int, irq_line); + // pci_log("pci_clear_irq(%02X, %02X): Using IRQ %i\n", card, pci_int, irq_line); if (level && !(pci_irq_hold[irq_line] & (1ULL << slot))) { /* IRQ not held, do nothing. */ - pci_log("pci_clear_irq(%02X, %02X): Card is not holding the IRQ\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): Card is not holding the IRQ\n", card, pci_int); return; } if (level) { - pci_log("pci_clear_irq(%02X, %02X): Releasing this card's hold on the IRQ\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): Releasing this card's hold on the IRQ\n", card, pci_int); pci_irq_hold[irq_line] &= ~(1 << slot); if (! pci_irq_hold[irq_line]) { - pci_log("pci_clear_irq(%02X, %02X): IRQ no longer held by any card, clearing it\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): IRQ no longer held by any card, clearing it\n", card, pci_int); picintc(1 << irq_line); - } else { - pci_log("pci_clear_irq(%02X, %02X): IRQ is still being held\n", card, pci_int); - } + } // else { + // pci_log("pci_clear_irq(%02X, %02X): IRQ is still being held\n", card, pci_int); + // } } else { - pci_log("pci_clear_irq(%02X, %02X): Clearing edge-triggered interrupt\n", card, pci_int); + // pci_log("pci_clear_irq(%02X, %02X): Clearing edge-triggered interrupt\n", card, pci_int); picintc(1 << irq_line); } } @@ -849,11 +849,34 @@ pci_register_bus_slot(int bus, int card, int type, int inta, int intb, int intc, } +uint8_t +pci_find_slot(uint8_t add_type, uint8_t ignore_slot) +{ + pci_card_t *dev; + uint8_t i, ret = 0xff; + + for (i = 0; i < last_pci_card; i++) { + dev = &pci_cards[i]; + + if (!dev->read && !dev->write && ((ignore_slot == 0xff) || (i != ignore_slot))) { + if (((dev->type == PCI_CARD_NORMAL) && (add_type >= PCI_ADD_NORMAL)) || + (dev->type == add_type) || + ((dev->type == PCI_CARD_NORMAL_NOBRIDGE) && (add_type >= PCI_ADD_NORMAL) && (add_type != PCI_ADD_BRIDGE))) { + ret = i; + break; + } + } + } + + return ret; +} + + uint8_t pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv) { pci_card_t *dev; - uint8_t i; + uint8_t i, j; if (add_type < PCI_ADD_NORMAL) pci_log("pci_add_card(): Adding PCI CARD at specific slot %02X [SPECIFIC]\n", add_type); @@ -868,37 +891,26 @@ pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv), return 0xff; } - for (i = 0; i < last_pci_card; i++) { + /* First, find the next available slot. */ + i = pci_find_slot(add_type, 0xff); + + if (i != 0xff) { dev = &pci_cards[i]; + j = pci_find_slot(add_type, i); - if (!dev->read && !dev->write) { - if (((dev->type == PCI_CARD_NORMAL) && (add_type >= PCI_ADD_NORMAL)) || - ((dev->type == PCI_CARD_NORMAL_NOBRIDGE) && (add_type >= PCI_ADD_NORMAL) && (add_type != PCI_ADD_BRIDGE)) || - ((dev->type == PCI_CARD_ONBOARD) && (add_type == PCI_ADD_VIDEO)) || - ((dev->type == PCI_CARD_SCSI) && (add_type == PCI_ADD_SCSI)) || - ((dev->type == PCI_CARD_SOUND) && (add_type == PCI_ADD_SOUND)) || - ((dev->type == PCI_CARD_IDE) && (add_type == PCI_ADD_IDE)) || - ((dev->type == PCI_CARD_NORTHBRIDGE) && (add_type == PCI_ADD_NORTHBRIDGE)) || - ((dev->type == PCI_CARD_SOUTHBRIDGE) && (add_type == PCI_ADD_SOUTHBRIDGE)) || - ((dev->bus == 0) && (dev->id == add_type) && (add_type < PCI_ADD_NORTHBRIDGE))) { - /* Add DEC 21150 PCI bridge if this is the last available NORMAL - slot, unless PCI bridges are blocked for this machine. */ - if (!(pci_type & PCI_NO_BRIDGES) && (dev->type == PCI_CARD_NORMAL) && (add_type != PCI_ADD_BRIDGE) && (i == last_normal_pci_card)) { - pci_log("pci_add_card(): Reached last NORMAL slot, adding bridge to pci_cards[%i]\n", i); - device_add_inst(&dec21150_device, last_pci_bus); - continue; - } - - dev->read = read; - dev->write = write; - dev->priv = priv; - pci_log("pci_add_card(): Adding PCI CARD to pci_cards[%i] (bus %02X slot %02X) [%s]\n", i, dev->bus, dev->id, (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC")))); - return i; - } + if (!(pci_type & PCI_NO_BRIDGES) && (dev->type == PCI_CARD_NORMAL) && (add_type != PCI_ADD_BRIDGE) && (j == 0xff)) { + pci_log("pci_add_card(): Reached last NORMAL slot, adding bridge to pci_cards[%i]\n", i); + device_add_inst(&dec21150_device, last_pci_bus); + i = pci_find_slot(add_type, 0xff); + dev = &pci_cards[i]; } - } - pci_log("pci_add_card(): Adding PCI CARD failed (unable to find a suitable PCI slot) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC")))); + dev->read = read; + dev->write = write; + dev->priv = priv; + pci_log("pci_add_card(): Adding PCI CARD to pci_cards[%i] (bus %02X slot %02X) [%s]\n", i, dev->bus, dev->id, (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC")))); + return i; + } return 0xff; } diff --git a/src/pit.c b/src/pit.c index 9311dbe6e..63d6a9275 100644 --- a/src/pit.c +++ b/src/pit.c @@ -865,7 +865,7 @@ const device_t i8253_device = DEVICE_ISA, PIT_8253, pit_init, pit_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -876,7 +876,7 @@ const device_t i8254_device = DEVICE_ISA, PIT_8254, pit_init, pit_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -887,7 +887,7 @@ const device_t i8254_ext_io_device = DEVICE_ISA, PIT_8254 | PIT_EXT_IO, pit_init, pit_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -898,7 +898,7 @@ const device_t i8254_ps2_device = DEVICE_ISA, PIT_8254 | PIT_PS2 | PIT_EXT_IO, pit_init, pit_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/port_92.c b/src/port_92.c index a575ddf26..83efb3213 100644 --- a/src/port_92.c +++ b/src/port_92.c @@ -213,7 +213,7 @@ const device_t port_92_device = { 0, 0, port_92_init, port_92_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -223,7 +223,7 @@ const device_t port_92_inv_device = { 0, PORT_92_INV, port_92_init, port_92_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -233,7 +233,7 @@ const device_t port_92_word_device = { 0, PORT_92_WORD, port_92_init, port_92_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -243,6 +243,6 @@ const device_t port_92_pci_device = { 0, PORT_92_PCI, port_92_init, port_92_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/scsi/scsi.c b/src/scsi/scsi.c index 9a3fabcfd..06439cfdd 100644 --- a/src/scsi/scsi.c +++ b/src/scsi/scsi.c @@ -50,39 +50,38 @@ int scsi_card_last = 0; typedef const struct { - const char *name; const char *internal_name; const device_t *device; } SCSI_CARD; static SCSI_CARD scsi_cards[] = { - { "None", "none", NULL, }, - { "[ISA] Adaptec AHA-154xA", "aha154xa", &aha154xa_device, }, - { "[ISA] Adaptec AHA-154xB", "aha154xb", &aha154xb_device, }, - { "[ISA] Adaptec AHA-154xC", "aha154xc", &aha154xc_device, }, - { "[ISA] Adaptec AHA-154xCF", "aha154xcf", &aha154xcf_device, }, - { "[ISA] BusLogic BT-542B", "bt542b", &buslogic_542b_1991_device, }, - { "[ISA] BusLogic BT-542BH", "bt542bh", &buslogic_device, }, - { "[ISA] BusLogic BT-545S", "bt545s", &buslogic_545s_device, }, - { "[ISA] Longshine LCS-6821N", "lcs6821n", &scsi_lcs6821n_device, }, - { "[ISA] Rancho RT1000B", "rt1000b", &scsi_rt1000b_device, }, - { "[ISA] Trantor T130B", "t130b", &scsi_t130b_device, }, + { "none", NULL, }, + { "aha154xa", &aha154xa_device, }, + { "aha154xb", &aha154xb_device, }, + { "aha154xc", &aha154xc_device, }, + { "aha154xcf", &aha154xcf_device, }, + { "bt542b", &buslogic_542b_1991_device, }, + { "bt542bh", &buslogic_device, }, + { "bt545s", &buslogic_545s_device, }, + { "lcs6821n", &scsi_lcs6821n_device, }, + { "rt1000b", &scsi_rt1000b_device, }, + { "t130b", &scsi_t130b_device, }, #ifdef WALTJE - { "[ISA] Sumo SCSI-AT", "scsiat", &scsi_scsiat_device, }, - { "[ISA] Generic WDC33C93", "wd33c93", &scsi_wd33c93_device, }, + { "scsiat", &scsi_scsiat_device, }, + { "wd33c93", &scsi_wd33c93_device, }, #endif - { "[MCA] Adaptec AHA-1640", "aha1640", &aha1640_device, }, - { "[MCA] BusLogic BT-640A", "bt640a", &buslogic_640a_device, }, - { "[MCA] IBM PS/2 SCSI", "spock", &spock_device, }, - { "[PCI] BusLogic BT-958D", "bt958d", &buslogic_pci_device, }, - { "[PCI] NCR 53C810", "ncr53c810", &ncr53c810_pci_device, }, - { "[PCI] NCR 53C825A", "ncr53c825a", &ncr53c825a_pci_device, }, - { "[PCI] NCR 53C860", "ncr53c860", &ncr53c860_pci_device, }, - { "[PCI] NCR 53C875", "ncr53c875", &ncr53c875_pci_device, }, - { "[PCI] Tekram DC-390", "dc390", &dc390_pci_device, }, - { "[VLB] BusLogic BT-445S", "bt445s", &buslogic_445s_device, }, - { "", "", NULL, }, + { "aha1640", &aha1640_device, }, + { "bt640a", &buslogic_640a_device, }, + { "spock", &spock_device, }, + { "bt958d", &buslogic_pci_device, }, + { "ncr53c810", &ncr53c810_pci_device, }, + { "ncr53c825a", &ncr53c825a_pci_device, }, + { "ncr53c860", &ncr53c860_pci_device, }, + { "ncr53c875", &ncr53c875_pci_device, }, + { "dc390", &dc390_pci_device, }, + { "bt445s", &buslogic_445s_device, }, + { "", NULL, }, }; @@ -96,13 +95,6 @@ scsi_card_available(int card) } -char * -scsi_card_getname(int card) -{ - return((char *) scsi_cards[card].name); -} - - const device_t * scsi_card_getdevice(int card) { diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index cfaf1f822..e374de25e 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -911,7 +911,7 @@ aha_init(const device_t *info) static const device_config_t aha_154xb_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x334, + "base", "Address", CONFIG_HEX16, "", 0x334, "", { 0 }, { { "None", 0 @@ -940,7 +940,7 @@ static const device_config_t aha_154xb_config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 11, + "irq", "IRQ", CONFIG_SELECTION, "", 11, "", { 0 }, { { "IRQ 9", 9 @@ -966,7 +966,7 @@ static const device_config_t aha_154xb_config[] = { }, }, { - "dma", "DMA channel", CONFIG_SELECTION, "", 6, + "dma", "DMA channel", CONFIG_SELECTION, "", 6, "", { 0 }, { { "DMA 5", 5 @@ -983,7 +983,7 @@ static const device_config_t aha_154xb_config[] = { }, }, { - "hostid", "Host ID", CONFIG_SELECTION, "", 7, + "hostid", "Host ID", CONFIG_SELECTION, "", 7, "", { 0 }, { { "0", 0 @@ -1015,7 +1015,7 @@ static const device_config_t aha_154xb_config[] = { }, }, { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, "", { 0 }, { { "Disabled", 0 @@ -1041,7 +1041,7 @@ static const device_config_t aha_154xb_config[] = { static const device_config_t aha_154x_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x334, + "base", "Address", CONFIG_HEX16, "", 0x334, "", { 0 }, { { "None", 0 @@ -1070,7 +1070,7 @@ static const device_config_t aha_154x_config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 11, + "irq", "IRQ", CONFIG_SELECTION, "", 11, "", { 0 }, { { "IRQ 9", 9 @@ -1096,7 +1096,7 @@ static const device_config_t aha_154x_config[] = { }, }, { - "dma", "DMA channel", CONFIG_SELECTION, "", 6, + "dma", "DMA channel", CONFIG_SELECTION, "", 6, "", { 0 }, { { "DMA 5", 5 @@ -1113,7 +1113,7 @@ static const device_config_t aha_154x_config[] = { }, }, { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, "", { 0 }, { { "Disabled", 0 @@ -1140,7 +1140,7 @@ static const device_config_t aha_154x_config[] = { static const device_config_t aha_154xcf_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x334, + "base", "Address", CONFIG_HEX16, "", 0x334, "", { 0 }, { { "None", 0 @@ -1169,7 +1169,7 @@ static const device_config_t aha_154xcf_config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 11, + "irq", "IRQ", CONFIG_SELECTION, "", 11, "", { 0 }, { { "IRQ 9", 9 @@ -1195,7 +1195,7 @@ static const device_config_t aha_154xcf_config[] = { }, }, { - "dma", "DMA channel", CONFIG_SELECTION, "", 6, + "dma", "DMA channel", CONFIG_SELECTION, "", 6, "", { 0 }, { { "DMA 5", 5 @@ -1212,7 +1212,7 @@ static const device_config_t aha_154xcf_config[] = { }, }, { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, "", { 0 }, { { "Disabled", 0 @@ -1232,7 +1232,7 @@ static const device_config_t aha_154xcf_config[] = { }, }, { - "fdc_addr", "FDC address", CONFIG_HEX16, "", 0, + "fdc_addr", "FDC address", CONFIG_HEX16, "", 0, "", { 0 }, { { "None", 0 @@ -1259,7 +1259,7 @@ const device_t aha154xa_device = { DEVICE_ISA | DEVICE_AT, AHA_154xA, aha_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, aha_154xb_config }; @@ -1268,7 +1268,7 @@ const device_t aha154xb_device = { DEVICE_ISA | DEVICE_AT, AHA_154xB, aha_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, aha_154xb_config }; @@ -1277,7 +1277,7 @@ const device_t aha154xc_device = { DEVICE_ISA | DEVICE_AT, AHA_154xC, aha_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, aha_154x_config }; @@ -1286,7 +1286,7 @@ const device_t aha154xcf_device = { DEVICE_ISA | DEVICE_AT, AHA_154xCF, aha_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, aha_154xcf_config }; @@ -1295,6 +1295,6 @@ const device_t aha1640_device = { DEVICE_MCA, AHA_1640, aha_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index ca98253d9..c023fb2f2 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -1742,7 +1742,7 @@ buslogic_init(const device_t *info) static const device_config_t BT_ISA_Config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x334, + "base", "Address", CONFIG_HEX16, "", 0x334, "", { 0 }, { { "0x330", 0x330 @@ -1768,7 +1768,7 @@ static const device_config_t BT_ISA_Config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 11, + "irq", "IRQ", CONFIG_SELECTION, "", 11, "", { 0 }, { { "IRQ 9", 9 @@ -1794,7 +1794,7 @@ static const device_config_t BT_ISA_Config[] = { }, }, { - "dma", "DMA channel", CONFIG_SELECTION, "", 6, + "dma", "DMA channel", CONFIG_SELECTION, "", 6, "", { 0 }, { { "DMA 5", 5 @@ -1811,7 +1811,7 @@ static const device_config_t BT_ISA_Config[] = { }, }, { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0, "", { 0 }, { { "Disabled", 0 @@ -1850,7 +1850,7 @@ const device_t buslogic_542b_1991_device = { DEVICE_ISA | DEVICE_AT, CHIP_BUSLOGIC_ISA_542_1991, buslogic_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, BT_ISA_Config }; @@ -1859,7 +1859,7 @@ const device_t buslogic_device = { DEVICE_ISA | DEVICE_AT, CHIP_BUSLOGIC_ISA_542, buslogic_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, BT_ISA_Config }; @@ -1868,7 +1868,7 @@ const device_t buslogic_545s_device = { DEVICE_ISA | DEVICE_AT, CHIP_BUSLOGIC_ISA, buslogic_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, BT_ISA_Config }; @@ -1877,7 +1877,7 @@ const device_t buslogic_640a_device = { DEVICE_MCA, CHIP_BUSLOGIC_MCA, buslogic_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -1886,7 +1886,7 @@ const device_t buslogic_445s_device = { DEVICE_VLB, CHIP_BUSLOGIC_VLB, buslogic_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, BT_ISA_Config }; @@ -1895,6 +1895,6 @@ const device_t buslogic_pci_device = { DEVICE_PCI, CHIP_BUSLOGIC_PCI, buslogic_init, x54x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, BT958D_Config }; diff --git a/src/scsi/scsi_ncr5380.c b/src/scsi/scsi_ncr5380.c index 659f6cf5e..29cfe7f35 100644 --- a/src/scsi/scsi_ncr5380.c +++ b/src/scsi/scsi_ncr5380.c @@ -1238,7 +1238,7 @@ t130b_available(void) static const device_config_t ncr5380_mmio_config[] = { { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xD8000, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xD8000, "", { 0 }, { { "C800H", 0xc8000 @@ -1259,7 +1259,7 @@ static const device_config_t ncr5380_mmio_config[] = { }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 3", 3 @@ -1279,7 +1279,7 @@ static const device_config_t ncr5380_mmio_config[] = { static const device_config_t rancho_config[] = { { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xD8000, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xD8000, "", { 0 }, { { "C800H", 0xc8000 @@ -1300,7 +1300,7 @@ static const device_config_t rancho_config[] = { }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 3", 3 @@ -1314,7 +1314,7 @@ static const device_config_t rancho_config[] = { }, }, { - "bios_ver", "BIOS Version", CONFIG_SELECTION, "", 1, + "bios_ver", "BIOS Version", CONFIG_SELECTION, "", 1, "", { 0 }, { { "8.20R", 1 @@ -1334,7 +1334,7 @@ static const device_config_t rancho_config[] = { static const device_config_t t130b_config[] = { { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xD8000, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xD8000, "", { 0 }, { { "Disabled", 0 @@ -1357,7 +1357,7 @@ static const device_config_t t130b_config[] = { }, }, { - "base", "Address", CONFIG_HEX16, "", 0x0350, + "base", "Address", CONFIG_HEX16, "", 0x0350, "", { 0 }, { { "240H", 0x0240 @@ -1377,7 +1377,7 @@ static const device_config_t t130b_config[] = { }, }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 3", 3 @@ -1405,7 +1405,7 @@ const device_t scsi_lcs6821n_device = DEVICE_ISA, 0, ncr_init, ncr_close, NULL, - lcs6821n_available, + { lcs6821n_available }, NULL, NULL, ncr5380_mmio_config }; @@ -1416,7 +1416,7 @@ const device_t scsi_rt1000b_device = DEVICE_ISA, 1, ncr_init, ncr_close, NULL, - rt1000b_available, + { rt1000b_available }, NULL, NULL, rancho_config }; @@ -1427,7 +1427,7 @@ const device_t scsi_t130b_device = DEVICE_ISA, 2, ncr_init, ncr_close, NULL, - t130b_available, + { t130b_available }, NULL, NULL, t130b_config }; diff --git a/src/scsi/scsi_ncr53c8xx.c b/src/scsi/scsi_ncr53c8xx.c index ff12773d3..bb467781f 100644 --- a/src/scsi/scsi_ncr53c8xx.c +++ b/src/scsi/scsi_ncr53c8xx.c @@ -2732,50 +2732,50 @@ static const device_config_t ncr53c8xx_pci_config[] = { const device_t ncr53c810_pci_device = { - "NCR 53c810 (SCSI)", + "NCR 53c810", DEVICE_PCI, 0x01, ncr53c8xx_init, ncr53c8xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ncr53c8xx_pci_config }; const device_t ncr53c810_onboard_pci_device = { - "NCR 53c810 (SCSI) On-Board", + "NCR 53c810 On-Board", DEVICE_PCI, 0x8001, ncr53c8xx_init, ncr53c8xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; const device_t ncr53c825a_pci_device = { - "NCR 53c825A (SCSI)", + "NCR 53c825A", DEVICE_PCI, CHIP_825, ncr53c8xx_init, ncr53c8xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ncr53c8xx_pci_config }; const device_t ncr53c860_pci_device = { - "NCR 53c860 (SCSI)", + "NCR 53c860", DEVICE_PCI, CHIP_860, ncr53c8xx_init, ncr53c8xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ncr53c8xx_pci_config }; const device_t ncr53c875_pci_device = { - "NCR 53c875 (SCSI)", + "NCR 53c875", DEVICE_PCI, CHIP_875, ncr53c8xx_init, ncr53c8xx_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, ncr53c8xx_pci_config }; diff --git a/src/scsi/scsi_pcscsi.c b/src/scsi/scsi_pcscsi.c index ff4900702..22c78818b 100644 --- a/src/scsi/scsi_pcscsi.c +++ b/src/scsi/scsi_pcscsi.c @@ -1485,10 +1485,10 @@ static const device_config_t dc390_pci_config[] = { const device_t dc390_pci_device = { - "Tekram DC-390 PCI (SCSI)", + "Tekram DC-390 PCI", DEVICE_PCI, 0, dc390_init, esp_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, dc390_pci_config }; diff --git a/src/scsi/scsi_spock.c b/src/scsi/scsi_spock.c index 247a04c0b..d96ac3cf0 100644 --- a/src/scsi/scsi_spock.c +++ b/src/scsi/scsi_spock.c @@ -1151,7 +1151,7 @@ spock_available(void) static const device_config_t spock_rom_config[] = { { - "bios_ver", "BIOS Version", CONFIG_SELECTION, "", 1, + "bios_ver", "BIOS Version", CONFIG_SELECTION, "", 1, "", { 0 }, { { "1991 BIOS (>1GB)", 1 @@ -1175,7 +1175,7 @@ const device_t spock_device = DEVICE_MCA, 0, spock_init, spock_close, NULL, - spock_available, + { spock_available }, NULL, NULL, spock_rom_config }; diff --git a/src/sio/sio_82091aa.c b/src/sio/sio_82091aa.c index bf69d2f7d..0fbb96d11 100644 --- a/src/sio/sio_82091aa.c +++ b/src/sio/sio_82091aa.c @@ -223,6 +223,8 @@ i82091aa_reset(i82091aa_t *dev) dev->regs[0x31] = dev->regs[0x41] = 0x02; dev->regs[0x50] = 0x01; + fdc_reset(dev->fdc); + fdc_handler(dev); lpt1_handler(dev); serial_handler(dev, 0); @@ -232,8 +234,6 @@ i82091aa_reset(i82091aa_t *dev) if (dev->has_ide) ide_handler(dev); - - fdc_reset(dev->fdc); } @@ -280,7 +280,7 @@ const device_t i82091aa_device = { 0, 0x40, i82091aa_init, i82091aa_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -290,7 +290,7 @@ const device_t i82091aa_398_device = { 0, 0x148, i82091aa_init, i82091aa_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -300,6 +300,6 @@ const device_t i82091aa_ide_device = { 0, 0x240, i82091aa_init, i82091aa_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_acc3221.c b/src/sio/sio_acc3221.c index 81af15036..96a5005c4 100644 --- a/src/sio/sio_acc3221.c +++ b/src/sio/sio_acc3221.c @@ -480,6 +480,6 @@ const device_t acc3221_device = { 0, 0, acc3221_init, acc3221_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_detect.c b/src/sio/sio_detect.c index b28aa76b1..7a0f8821e 100644 --- a/src/sio/sio_detect.c +++ b/src/sio/sio_detect.c @@ -112,6 +112,6 @@ const device_t sio_detect_device = { 0, 0, sio_detect_init, sio_detect_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_f82c710.c b/src/sio/sio_f82c710.c index 46cca26b8..16b1fb4b2 100644 --- a/src/sio/sio_f82c710.c +++ b/src/sio/sio_f82c710.c @@ -232,6 +232,6 @@ const device_t f82c710_device = { 0, 0, f82c710_init, f82c710_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_fdc37c661.c b/src/sio/sio_fdc37c661.c index c742b71d0..159a68d47 100644 --- a/src/sio/sio_fdc37c661.c +++ b/src/sio/sio_fdc37c661.c @@ -271,7 +271,7 @@ const device_t fdc37c661_device = { 0, 0, fdc37c661_init, fdc37c661_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_fdc37c669.c b/src/sio/sio_fdc37c669.c index 4f6823f8f..d9797d38d 100644 --- a/src/sio/sio_fdc37c669.c +++ b/src/sio/sio_fdc37c669.c @@ -295,6 +295,6 @@ const device_t fdc37c669_device = { 0, 0, fdc37c669_init, fdc37c669_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_fdc37c66x.c b/src/sio/sio_fdc37c66x.c index eefafe083..13351bdbd 100644 --- a/src/sio/sio_fdc37c66x.c +++ b/src/sio/sio_fdc37c66x.c @@ -37,8 +37,7 @@ typedef struct { - uint8_t chip_id, - lock[2], + uint8_t chip_id, tries, regs[16]; int cur_reg, com3_addr, com4_addr; @@ -47,19 +46,6 @@ typedef struct { } fdc37c66x_t; -static void -write_lock(fdc37c66x_t *dev, uint8_t val) -{ - if (val == 0x55 && dev->lock[1] == 0x55) - fdc_3f1_enable(dev->fdc, 0); - if ((dev->lock[0] == 0x55) && (dev->lock[1] == 0x55) && (val != 0x55)) - fdc_3f1_enable(dev->fdc, 1); - - dev->lock[0] = dev->lock[1]; - dev->lock[1] = val; -} - - static void set_com34_addr(fdc37c66x_t *dev) { @@ -88,7 +74,12 @@ static void set_serial_addr(fdc37c66x_t *dev, int port) { uint8_t shift = (port << 4); + double clock_src = 24000000.0 / 13.0; + if (dev->regs[4] & (1 << (4 + port))) + clock_src = 24000000.0 / 12.0; + + serial_remove(dev->uart[port]); if (dev->regs[2] & (4 << shift)) { switch (dev->regs[2] & (3 << shift)) { case 0: @@ -105,6 +96,8 @@ set_serial_addr(fdc37c66x_t *dev, int port) break; } } + + serial_set_clock_src(dev->uart[port], clock_src); } @@ -144,10 +137,10 @@ fdc37c66x_write(uint16_t port, uint8_t val, void *priv) fdc37c66x_t *dev = (fdc37c66x_t *) priv; uint8_t valxor = 0; - if ((dev->lock[0] == 0x55) && (dev->lock[1] == 0x55)) { + if (dev->tries == 2) { if (port == 0x3f0) { if (val == 0xaa) - write_lock(dev, val); + dev->tries = 0; else dev->cur_reg = val; } else { @@ -166,27 +159,27 @@ fdc37c66x_write(uint16_t port, uint8_t val, void *priv) if (valxor & 3) lpt1_handler(dev); if (valxor & 0x60) { - serial_remove(dev->uart[0]); - serial_remove(dev->uart[1]); set_com34_addr(dev); set_serial_addr(dev, 0); set_serial_addr(dev, 1); } break; case 2: - if (valxor & 7) { - serial_remove(dev->uart[0]); + if (valxor & 7) set_serial_addr(dev, 0); - } - if (valxor & 0x70) { - serial_remove(dev->uart[1]); + if (valxor & 0x70) set_serial_addr(dev, 1); - } break; case 3: if (valxor & 2) fdc_update_enh_mode(dev->fdc, (dev->regs[3] & 2) ? 1 : 0); break; + case 4: + if (valxor & 0x10) + set_serial_addr(dev, 0); + if (valxor & 0x20) + set_serial_addr(dev, 1); + break; case 5: if (valxor & 0x01) fdc_handler(dev); @@ -197,10 +190,8 @@ fdc37c66x_write(uint16_t port, uint8_t val, void *priv) break; } } - } else { - if (port == 0x3f0) - write_lock(dev, val); - } + } else if ((port == 0x3f0) && (val == 0x55)) + dev->tries++; } @@ -208,9 +199,9 @@ static uint8_t fdc37c66x_read(uint16_t port, void *priv) { fdc37c66x_t *dev = (fdc37c66x_t *) priv; - uint8_t ret = 0xff; + uint8_t ret = 0x00; - if ((dev->lock[0] == 0x55) && (dev->lock[1] == 0x55)) { + if (dev->tries == 2) { if (port == 0x3f1) ret = dev->regs[dev->cur_reg]; } @@ -236,7 +227,7 @@ fdc37c66x_reset(fdc37c66x_t *dev) fdc_reset(dev->fdc); - memset(dev->lock, 0, 2); + dev->tries = 0; memset(dev->regs, 0, 16); dev->regs[0x0] = 0x3a; @@ -287,7 +278,7 @@ const device_t fdc37c663_device = { 0, 0x63, fdc37c66x_init, fdc37c66x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -296,7 +287,7 @@ const device_t fdc37c665_device = { 0, 0x65, fdc37c66x_init, fdc37c66x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -305,6 +296,6 @@ const device_t fdc37c666_device = { 0, 0x66, fdc37c66x_init, fdc37c66x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_fdc37c93x.c b/src/sio/sio_fdc37c93x.c index 9ed1137ba..a0f0a2135 100644 --- a/src/sio/sio_fdc37c93x.c +++ b/src/sio/sio_fdc37c93x.c @@ -204,8 +204,10 @@ fdc37c93x_nvr_sec_handler(fdc37c93x_t *dev) nvr_at_sec_handler(0, dev->nvr_sec_base, dev->nvr); if (local_enable) { dev->nvr_sec_base = ld_port = make_port_sec(dev, 6) & 0xFFFE; - if ((ld_port >= 0x0100) && (ld_port <= 0x0FFE)) - nvr_at_sec_handler(1, ld_port, dev->nvr); + /* Datasheet erratum: First it says minimum address is 0x0100, but later implies that it's 0x0000 + and that default is 0x0070, same as (unrelocatable) primary NVR. */ + if ((ld_port >= 0x0000) && (ld_port <= 0x0FFE)) + nvr_at_sec_handler(1, dev->nvr_sec_base, dev->nvr); } } @@ -356,7 +358,13 @@ fdc37c93x_write(uint16_t port, uint8_t val, void *priv) { fdc37c93x_t *dev = (fdc37c93x_t *) priv; uint8_t index = (port & 1) ? 0 : 1; - uint8_t valxor = 0; + uint8_t valxor = 0x00, keep = 0x00; + + /* Compaq Presario 4500: Unlock at FB, Register at EA, Data at EB, Lock at F9. */ + if ((port == 0xea) || (port == 0xf9) || (port == 0xfb)) + index = 1; + else if (port == 0xeb) + index = 0; if (index) { if ((val == 0x55) && !dev->locked) { @@ -399,6 +407,14 @@ fdc37c93x_write(uint16_t port, uint8_t val, void *priv) case 0x02: case 0x07: return; + case 0x06: + if (dev->chip_id != 0x30) + return; + /* Bits 0 to 3 of logical device 6 (RTC) register F0h must stay set + once they are set. */ + else if (dev->cur_reg == 0xf0) + keep = dev->ld_regs[dev->regs[7]][dev->cur_reg] & 0x0f; + break; case 0x09: /* If we're on the FDC37C935, return as this is not a valid logical device there. */ @@ -412,7 +428,7 @@ fdc37c93x_write(uint16_t port, uint8_t val, void *priv) return; break; } - dev->ld_regs[dev->regs[7]][dev->cur_reg] = val; + dev->ld_regs[dev->regs[7]][dev->cur_reg] = val | keep; } } else return; @@ -542,9 +558,8 @@ fdc37c93x_write(uint16_t port, uint8_t val, void *priv) case 0x30: if (valxor) fdc37c93x_nvr_pri_handler(dev); - /* FALLTHROUGH */ - case 0x60: - case 0x61: + case 0x62: + case 0x63: if (valxor) fdc37c93x_nvr_sec_handler(dev); break; @@ -639,6 +654,12 @@ fdc37c93x_read(uint16_t port, void *priv) uint8_t index = (port & 1) ? 0 : 1; uint8_t ret = 0xff; + /* Compaq Presario 4500: Unlock at FB, Register at EA, Data at EB, Lock at F9. */ + if ((port == 0xea) || (port == 0xf9) || (port == 0xfb)) + index = 1; + else if (port == 0xeb) + index = 0; + if (dev->locked) { if (index) ret = dev->cur_reg; @@ -733,8 +754,8 @@ fdc37c93x_reset(fdc37c93x_t *dev) serial_setup(dev->uart[1], 0x2f8, dev->ld_regs[5][0x70]); /* Logical device 6: RTC */ - dev->ld_regs[5][0x30] = 1; - dev->ld_regs[6][0x63] = 0x00; + dev->ld_regs[6][0x30] = 1; + dev->ld_regs[6][0x63] = (dev->chip_id == 0x30) ? 0x70 : 0x00; dev->ld_regs[6][0xF4] = 3; /* Logical device 7: Keyboard */ @@ -761,6 +782,13 @@ fdc37c93x_reset(fdc37c93x_t *dev) fdc_reset(dev->fdc); fdc37c93x_fdc_handler(dev); + if (dev->chip_id == 0x30) { + fdc37c93x_nvr_pri_handler(dev); + fdc37c93x_nvr_sec_handler(dev); + nvr_bank_set(0, 0, dev->nvr); + nvr_bank_set(1, 0xff, dev->nvr); + } + dev->locked = 0; } @@ -789,7 +817,7 @@ static const device_t access_bus_device = { 0, 0x03, access_bus_init, access_bus_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -806,6 +834,7 @@ fdc37c93x_close(void *priv) static void * fdc37c93x_init(const device_t *info) { + int is_compaq; fdc37c93x_t *dev = (fdc37c93x_t *) malloc(sizeof(fdc37c93x_t)); memset(dev, 0, sizeof(fdc37c93x_t)); @@ -815,10 +844,12 @@ fdc37c93x_init(const device_t *info) dev->uart[1] = device_add_inst(&ns16550_device, 2); dev->chip_id = info->local & 0xff; - dev->is_apm = info->local >> 8; + dev->is_apm = (info->local >> 8) & 0x01; + is_compaq = (info->local >> 8) & 0x02; dev->gpio_regs[0] = 0xff; - dev->gpio_regs[1] = 0xfd; + // dev->gpio_regs[1] = (info->local == 0x0030) ? 0xff : 0xfd; + dev->gpio_regs[1] = (dev->chip_id == 0x30) ? 0xff : 0xfd; if (dev->chip_id == 0x30) { dev->nvr = device_add(&at_nvr_device); @@ -833,10 +864,19 @@ fdc37c93x_init(const device_t *info) if (dev->is_apm) dev->acpi = device_add(&acpi_smc_device); - io_sethandler(0x370, 0x0002, - fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); - io_sethandler(0x3f0, 0x0002, - fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); + if (is_compaq) { + io_sethandler(0x0ea, 0x0002, + fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); + io_sethandler(0x0f9, 0x0001, + fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); + io_sethandler(0x0fb, 0x0001, + fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); + } else { + io_sethandler(0x370, 0x0002, + fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); + io_sethandler(0x3f0, 0x0002, + fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); + } fdc37c93x_reset(dev); @@ -849,7 +889,16 @@ const device_t fdc37c931apm_device = { 0, 0x130, /* Share the same ID with the 932QF. */ fdc37c93x_init, fdc37c93x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, + NULL +}; + +const device_t fdc37c931apm_compaq_device = { + "SMC FDC37C932QF Super I/O (Compaq Presario 4500)", + 0, + 0x330, /* Share the same ID with the 932QF. */ + fdc37c93x_init, fdc37c93x_close, NULL, + { NULL }, NULL, NULL, NULL }; @@ -858,7 +907,7 @@ const device_t fdc37c932fr_device = { 0, 0x03, fdc37c93x_init, fdc37c93x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -867,7 +916,7 @@ const device_t fdc37c932qf_device = { 0, 0x30, fdc37c93x_init, fdc37c93x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -876,6 +925,6 @@ const device_t fdc37c935_device = { 0, 0x02, fdc37c93x_init, fdc37c93x_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_pc87306.c b/src/sio/sio_pc87306.c index 604567395..78883169f 100644 --- a/src/sio/sio_pc87306.c +++ b/src/sio/sio_pc87306.c @@ -424,6 +424,6 @@ const device_t pc87306_device = { 0, 0, pc87306_init, pc87306_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_pc87307.c b/src/sio/sio_pc87307.c index 787a540f2..08cfe0364 100644 --- a/src/sio/sio_pc87307.c +++ b/src/sio/sio_pc87307.c @@ -38,9 +38,10 @@ typedef struct { uint8_t id, pm_idx, regs[48], ld_regs[256][208], - pcregs[16], gpio[8], + pcregs[16], gpio[2][4], pm[8]; - uint16_t gpio_base, pm_base; + uint16_t gpio_base, gpio_base2, + pm_base; int cur_reg; fdc_t *fdc; serial_t *uart[2]; @@ -56,8 +57,9 @@ static void pc87307_gpio_write(uint16_t port, uint8_t val, void *priv) { pc87307_t *dev = (pc87307_t *) priv; + uint8_t bank = ((port & 0xfffc) == dev->gpio_base2); - dev->gpio[port & 7] = val; + dev->gpio[bank][port & 3] = val; } @@ -65,8 +67,17 @@ uint8_t pc87307_gpio_read(uint16_t port, void *priv) { pc87307_t *dev = (pc87307_t *) priv; + uint8_t pins = 0xff, bank = ((port & 0xfffc) == dev->gpio_base2); + uint8_t mask, ret = dev->gpio[bank][port & 0x0003]; - return dev->gpio[port & 7]; + switch (port & 0x0003) { + case 0x0000: + mask = dev->gpio[bank][0x0001]; + ret = (ret & mask) | (pins & ~mask); + break; + } + + return ret; } @@ -74,19 +85,27 @@ static void pc87307_gpio_remove(pc87307_t *dev) { if (dev->gpio_base != 0xffff) { - io_removehandler(dev->gpio_base, 0x0008, + io_removehandler(dev->gpio_base, 0x0002, pc87307_gpio_read, NULL, NULL, pc87307_gpio_write, NULL, NULL, dev); dev->gpio_base = 0xffff; } + + if (dev->gpio_base2 != 0xffff) { + io_removehandler(dev->gpio_base2, 0x0002, + pc87307_gpio_read, NULL, NULL, pc87307_gpio_write, NULL, NULL, dev); + dev->gpio_base2 = 0xffff; + } } static void -pc87307_gpio_init(pc87307_t *dev, uint16_t addr) +pc87307_gpio_init(pc87307_t *dev, int bank, uint16_t addr) { - dev->gpio_base = addr; + uint16_t *bank_base = bank ? &(dev->gpio_base2) : &(dev->gpio_base); - io_sethandler(dev->gpio_base, 0x0008, + *bank_base = addr; + + io_sethandler(*bank_base, 0x0002, pc87307_gpio_read, NULL, NULL, pc87307_gpio_write, NULL, NULL, dev); } @@ -212,7 +231,12 @@ gpio_handler(pc87307_t *dev) addr = (dev->ld_regs[0x07][0x30] << 8) | dev->ld_regs[0x07][0x31]; if (active) - pc87307_gpio_init(dev, addr); + pc87307_gpio_init(dev, 0, addr); + + addr = (dev->ld_regs[0x07][0x32] << 8) | dev->ld_regs[0x07][0x33]; + + if (active) + pc87307_gpio_init(dev, 1, addr); } @@ -293,7 +317,7 @@ pc87307_write(uint16_t port, uint8_t val, void *priv) break; case 0x60: case 0x62: dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0x07; - if (dev->cur_reg == 0x62) + if ((dev->cur_reg == 0x62) && (dev->regs[0x07] != 0x07)) break; switch (dev->regs[0x07]) { case 0x03: @@ -350,6 +374,10 @@ pc87307_write(uint16_t port, uint8_t val, void *priv) case 0x63: if (dev->regs[0x07] == 0x00) dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = (val & 0xfb) | 0x04; + else if (dev->regs[0x07] == 0x07) { + dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfe; + gpio_handler(dev); + } break; case 0x70: case 0x74: case 0x75: @@ -497,8 +525,16 @@ pc87307_reset(pc87307_t *dev) dev->ld_regs[0x08][0x44] = 0x04; dev->ld_regs[0x08][0x45] = 0x04; - dev->gpio[0] = 0xff; - dev->gpio[1] = 0xfb; + // dev->gpio[0] = 0xff; + // dev->gpio[1] = 0xfb; + dev->gpio[0][0] = 0xff; + dev->gpio[0][1] = 0x00; + dev->gpio[0][2] = 0x00; + dev->gpio[0][3] = 0xff; + dev->gpio[1][0] = 0xff; + dev->gpio[1][1] = 0x00; + dev->gpio[1][2] = 0x00; + dev->gpio[1][3] = 0xff; dev->pm[0] = 0xff; dev->pm[1] = 0xff; @@ -543,12 +579,13 @@ pc87307_init(const device_t *info) pc87307_reset(dev); if (info->local & 0x100) { - io_sethandler(0x15c, 0x0002, - pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev); - } else { io_sethandler(0x02e, 0x0002, pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev); } + if (info->local & 0x200) { + io_sethandler(0x15c, 0x0002, + pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev); + } return dev; } @@ -557,9 +594,9 @@ pc87307_init(const device_t *info) const device_t pc87307_device = { "National Semiconductor PC87307 Super I/O", 0, - 0xc0, + 0x1c0, pc87307_init, pc87307_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -567,9 +604,19 @@ const device_t pc87307_device = { const device_t pc87307_15c_device = { "National Semiconductor PC87307 Super I/O (Port 15Ch)", 0, - 0x1c0, + 0x2c0, pc87307_init, pc87307_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, + NULL +}; + + +const device_t pc87307_both_device = { + "National Semiconductor PC87307 Super I/O (Ports 2Eh and 15Ch)", + 0, + 0x3c0, + pc87307_init, pc87307_close, NULL, + { NULL }, NULL, NULL, NULL }; @@ -577,8 +624,8 @@ const device_t pc87307_15c_device = { const device_t pc97307_device = { "National Semiconductor PC97307 Super I/O", 0, - 0xcf, + 0x1cf, pc87307_init, pc87307_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_pc87309.c b/src/sio/sio_pc87309.c index 586b31d15..5179dbb6a 100644 --- a/src/sio/sio_pc87309.c +++ b/src/sio/sio_pc87309.c @@ -477,7 +477,7 @@ const device_t pc87309_device = { 0, 0xe0, pc87309_init, pc87309_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -487,6 +487,6 @@ const device_t pc87309_15c_device = { 0, 0x1e0, pc87309_init, pc87309_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_pc87332.c b/src/sio/sio_pc87332.c index 03cbcf823..e09c024d5 100644 --- a/src/sio/sio_pc87332.c +++ b/src/sio/sio_pc87332.c @@ -310,7 +310,7 @@ const device_t pc87332_device = { 0, 0, pc87332_init, pc87332_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -320,6 +320,6 @@ const device_t pc87332_ps1_device = { 0, 1, pc87332_init, pc87332_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_um8669f.c b/src/sio/sio_um8669f.c index cdaf8cf72..54e531ab5 100644 --- a/src/sio/sio_um8669f.c +++ b/src/sio/sio_um8669f.c @@ -318,6 +318,6 @@ const device_t um8669f_device = { 0, 0, um8669f_init, um8669f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_vt82c686.c b/src/sio/sio_vt82c686.c index 92d4eef12..703289f5f 100644 --- a/src/sio/sio_vt82c686.c +++ b/src/sio/sio_vt82c686.c @@ -268,6 +268,6 @@ const device_t via_vt82c686_sio_device = { 0, 0, vt82c686_init, vt82c686_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_w83787f.c b/src/sio/sio_w83787f.c index 8fe4f4bf7..ed0f60a75 100644 --- a/src/sio/sio_w83787f.c +++ b/src/sio/sio_w83787f.c @@ -376,6 +376,6 @@ const device_t w83787f_device = { 0, 0x09, w83787f_init, w83787f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_w83877f.c b/src/sio/sio_w83877f.c index 7f562b6be..a808a0d59 100644 --- a/src/sio/sio_w83877f.c +++ b/src/sio/sio_w83877f.c @@ -473,7 +473,7 @@ const device_t w83877f_device = { 0, 0x0a05, w83877f_init, w83877f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -483,7 +483,7 @@ const device_t w83877f_president_device = { 0, 0x0a04, w83877f_init, w83877f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -493,7 +493,7 @@ const device_t w83877tf_device = { 0, 0x0c04, w83877f_init, w83877f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -503,6 +503,6 @@ const device_t w83877tf_acorp_device = { 0, 0x0c05, w83877f_init, w83877f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sio/sio_w83977f.c b/src/sio/sio_w83977f.c index 6796acb2d..dc3f1c012 100644 --- a/src/sio/sio_w83977f.c +++ b/src/sio/sio_w83977f.c @@ -572,7 +572,7 @@ const device_t w83977f_device = { 0, 0, w83977f_init, w83977f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -582,7 +582,7 @@ const device_t w83977f_370_device = { 0, 0x40, w83977f_init, w83977f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -592,7 +592,7 @@ const device_t w83977tf_device = { 0, 1, w83977f_init, w83977f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -602,7 +602,7 @@ const device_t w83977ef_device = { 0, 2, w83977f_init, w83977f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -612,6 +612,6 @@ const device_t w83977ef_370_device = { 0, 0x42, w83977f_init, w83977f_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sound/midi.c b/src/sound/midi.c index 19f1ce0a8..e985f277f 100644 --- a/src/sound/midi.c +++ b/src/sound/midi.c @@ -70,31 +70,32 @@ uint8_t MIDI_evt_len[256] = { typedef struct { - const char *name, *internal_name; + const char *internal_name; const device_t *device; } MIDI_DEVICE, MIDI_IN_DEVICE; static const MIDI_DEVICE devices[] = { - {"None", "none", NULL}, + { "none", NULL }, #ifdef USE_FLUIDSYNTH - {"FluidSynth", "fluidsynth", &fluidsynth_device}, + { "fluidsynth", &fluidsynth_device }, #endif #ifdef USE_MUNT - {"Roland MT-32 Emulation", "mt32", &mt32_device}, - {"Roland CM-32L Emulation", "cm32l", &cm32l_device}, + { "mt32", &mt32_device }, + { "cm32l", &cm32l_device }, #endif - {SYSTEM_MIDI_NAME, SYSTEM_MIDI_INTERNAL_NAME, &system_midi_device}, - {"", "", NULL} + { SYSTEM_MIDI_INTERNAL_NAME, &system_midi_device }, + { "", NULL } }; static const MIDI_IN_DEVICE midi_in_devices[] = { - {"None", "none", NULL}, - {MIDI_INPUT_NAME, MIDI_INPUT_INTERNAL_NAME, &midi_input_device}, - {"", "", NULL} + { "none", NULL }, + { MIDI_INPUT_INTERNAL_NAME, &midi_input_device }, + { "", NULL } }; + int midi_device_available(int card) { @@ -105,13 +106,6 @@ midi_device_available(int card) } -char * -midi_device_getname(int card) -{ - return (char *) devices[card].name; -} - - const device_t * midi_device_getdevice(int card) { @@ -240,11 +234,6 @@ midi_in_device_available(int card) return 1; } -char * -midi_in_device_getname(int card) -{ - return (char *) midi_in_devices[card].name; -} const device_t * midi_in_device_getdevice(int card) @@ -252,6 +241,7 @@ midi_in_device_getdevice(int card) return midi_in_devices[card].device; } + int midi_in_device_has_config(int card) { diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 20f64b55a..b91597309 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -379,16 +379,7 @@ static const device_config_t fluidsynth_config[] = .description = "Sound Font", .type = CONFIG_FNAME, .default_string = "", - .file_filter = - { - { - .description = "SF2 Sound Fonts", - .extensions = - { - "sf2" - } - } - } + .file_filter = "SF2 Sound Fonts (*.sf2)|*.sf2" }, { .name = "output_gain", @@ -556,7 +547,7 @@ const device_t fluidsynth_device = fluidsynth_init, fluidsynth_close, NULL, - fluidsynth_available, + { fluidsynth_available }, NULL, NULL, fluidsynth_config diff --git a/src/sound/midi_mt32.c b/src/sound/midi_mt32.c index 987d615a1..839261492 100644 --- a/src/sound/midi_mt32.c +++ b/src/sound/midi_mt32.c @@ -319,7 +319,7 @@ const device_t mt32_device = mt32_init, mt32_close, NULL, - mt32_available, + { mt32_available }, NULL, NULL, mt32_config @@ -333,7 +333,7 @@ const device_t cm32l_device = cm32l_init, mt32_close, NULL, - cm32l_available, + { cm32l_available }, NULL, NULL, mt32_config diff --git a/src/sound/midi_system.c b/src/sound/midi_system.c index 071e30883..1a577d932 100644 --- a/src/sound/midi_system.c +++ b/src/sound/midi_system.c @@ -118,7 +118,7 @@ const device_t system_midi_device = system_midi_init, system_midi_close, NULL, - system_midi_available, + { system_midi_available }, NULL, NULL, system_midi_config @@ -132,7 +132,7 @@ const device_t midi_input_device = midi_input_init, midi_input_close, NULL, - midi_input_available, + { midi_input_available }, NULL, NULL, midi_input_config diff --git a/src/sound/snd_adlib.c b/src/sound/snd_adlib.c index ef1b15f24..ff55cad84 100644 --- a/src/sound/snd_adlib.c +++ b/src/sound/snd_adlib.c @@ -130,7 +130,7 @@ const device_t adlib_device = DEVICE_ISA, 0, adlib_init, adlib_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; @@ -140,6 +140,6 @@ const device_t adlib_mca_device = DEVICE_MCA, 0, adlib_init, adlib_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sound/snd_adlibgold.c b/src/sound/snd_adlibgold.c index 1cd5bc188..7c6682e6d 100644 --- a/src/sound/snd_adlibgold.c +++ b/src/sound/snd_adlibgold.c @@ -844,7 +844,7 @@ const device_t adgold_device = adgold_init, adgold_close, NULL, - NULL, + { NULL }, NULL, NULL, adgold_config diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index a73d34ba5..bfa4d7eb0 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -153,7 +153,7 @@ const int32_t codec_attn[]= { }; static void es1371_fetch(es1371_t *es1371, int dac_nr); -static void update_legacy(es1371_t *es1371); +static void update_legacy(es1371_t *es1371, uint32_t old_legacy_ctrl); #ifdef ENABLE_AUDIOPCI_LOG int audiopci_do_log = ENABLE_AUDIOPCI_LOG; @@ -425,6 +425,7 @@ static uint32_t es1371_inl(uint16_t port, void *p) static void es1371_outb(uint16_t port, uint8_t val, void *p) { es1371_t *es1371 = (es1371_t *)p; + uint32_t old_legacy_ctrl; audiopci_log("es1371_outb: port=%04x val=%02x\n", port, val); switch (port & 0x3f) @@ -474,14 +475,16 @@ static void es1371_outb(uint16_t port, uint8_t val, void *p) nmi = 0; break; case 0x1a: + old_legacy_ctrl = es1371->legacy_ctrl; es1371->legacy_ctrl = (es1371->legacy_ctrl & 0xff00ffff) | (val << 16); - update_legacy(es1371); + update_legacy(es1371, old_legacy_ctrl); break; case 0x1b: + old_legacy_ctrl = es1371->legacy_ctrl; es1371->legacy_ctrl = (es1371->legacy_ctrl & 0x00ffffff) | (val << 24); es1371_update_irqs(es1371); // output = 3; - update_legacy(es1371); + update_legacy(es1371, old_legacy_ctrl); break; case 0x20: @@ -818,63 +821,81 @@ static uint8_t capture_read_slave_dma(uint16_t port, void *p) return 0xff; } -static void update_legacy(es1371_t *es1371) +static void update_legacy(es1371_t *es1371, uint32_t old_legacy_ctrl) { - io_removehandler(0x0320, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); - io_removehandler(0x0330, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); - io_removehandler(0x0340, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); - io_removehandler(0x0350, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); + if (old_legacy_ctrl & LEGACY_CAPTURE_SSCAPE) + { + switch ((old_legacy_ctrl >> LEGACY_SSCAPE_ADDR_SHIFT) & 3) + { + case 0: io_removehandler(0x0320, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + case 1: io_removehandler(0x0330, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + case 2: io_removehandler(0x0340, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + case 3: io_removehandler(0x0350, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + } + } + if (old_legacy_ctrl & LEGACY_CAPTURE_CODEC) + { + switch ((old_legacy_ctrl >> LEGACY_CODEC_ADDR_SHIFT) & 3) + { + case 0: io_removehandler(0x5300, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; + case 2: io_removehandler(0xe800, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; + case 3: io_removehandler(0xf400, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; + } + } + if (old_legacy_ctrl & LEGACY_CAPTURE_SB) + { + if (!(old_legacy_ctrl & LEGACY_SB_ADDR)) + io_removehandler(0x0220, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); + else + io_removehandler(0x0240, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); + } + if (old_legacy_ctrl & LEGACY_CAPTURE_ADLIB) + io_removehandler(0x0388, 0x0004, capture_read_adlib,NULL,NULL, capture_write_adlib,NULL,NULL, es1371); + if (old_legacy_ctrl & LEGACY_CAPTURE_MASTER_PIC) + io_removehandler(0x0020, 0x0002, capture_read_master_pic,NULL,NULL, capture_write_master_pic,NULL,NULL, es1371); + if (old_legacy_ctrl & LEGACY_CAPTURE_MASTER_DMA) + io_removehandler(0x0000, 0x0010, capture_read_master_dma,NULL,NULL, capture_write_master_dma,NULL,NULL, es1371); + if (old_legacy_ctrl & LEGACY_CAPTURE_SLAVE_PIC) + io_removehandler(0x00a0, 0x0002, capture_read_slave_pic,NULL,NULL, capture_write_slave_pic,NULL,NULL, es1371); + if (old_legacy_ctrl & LEGACY_CAPTURE_SLAVE_DMA) + io_removehandler(0x00c0, 0x0020, capture_read_slave_dma,NULL,NULL, capture_write_slave_dma,NULL,NULL, es1371); - io_removehandler(0x5300, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); - io_removehandler(0xe800, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); - io_removehandler(0xf400, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); - - io_removehandler(0x0220, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); - io_removehandler(0x0240, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); - - io_removehandler(0x0388, 0x0004, capture_read_adlib,NULL,NULL, capture_write_adlib,NULL,NULL, es1371); - - io_removehandler(0x0020, 0x0002, capture_read_master_pic,NULL,NULL, capture_write_master_pic,NULL,NULL, es1371); - io_removehandler(0x0000, 0x0010, capture_read_master_dma,NULL,NULL, capture_write_master_dma,NULL,NULL, es1371); - io_removehandler(0x00a0, 0x0002, capture_read_slave_pic,NULL,NULL, capture_write_slave_pic,NULL,NULL, es1371); - io_removehandler(0x00c0, 0x0020, capture_read_slave_dma,NULL,NULL, capture_write_slave_dma,NULL,NULL, es1371); - - if (es1371->legacy_ctrl & LEGACY_CAPTURE_SSCAPE) - { - switch ((es1371->legacy_ctrl >> LEGACY_SSCAPE_ADDR_SHIFT) & 3) - { - case 0: io_sethandler(0x0320, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; - case 1: io_sethandler(0x0330, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; - case 2: io_sethandler(0x0340, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; - case 3: io_sethandler(0x0350, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; - } - } - if (es1371->legacy_ctrl & LEGACY_CAPTURE_CODEC) - { - switch ((es1371->legacy_ctrl >> LEGACY_CODEC_ADDR_SHIFT) & 3) - { - case 0: io_sethandler(0x5300, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; - case 2: io_sethandler(0xe800, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; - case 3: io_sethandler(0xf400, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; - } - } - if (es1371->legacy_ctrl & LEGACY_CAPTURE_SB) - { - if (!(es1371->legacy_ctrl & LEGACY_SB_ADDR)) - io_sethandler(0x0220, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); - else - io_sethandler(0x0240, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); - } - if (es1371->legacy_ctrl & LEGACY_CAPTURE_ADLIB) - io_sethandler(0x0388, 0x0004, capture_read_adlib,NULL,NULL, capture_write_adlib,NULL,NULL, es1371); - if (es1371->legacy_ctrl & LEGACY_CAPTURE_MASTER_PIC) - io_sethandler(0x0020, 0x0002, capture_read_master_pic,NULL,NULL, capture_write_master_pic,NULL,NULL, es1371); - if (es1371->legacy_ctrl & LEGACY_CAPTURE_MASTER_DMA) - io_sethandler(0x0000, 0x0010, capture_read_master_dma,NULL,NULL, capture_write_master_dma,NULL,NULL, es1371); - if (es1371->legacy_ctrl & LEGACY_CAPTURE_SLAVE_PIC) - io_sethandler(0x00a0, 0x0002, capture_read_slave_pic,NULL,NULL, capture_write_slave_pic,NULL,NULL, es1371); - if (es1371->legacy_ctrl & LEGACY_CAPTURE_SLAVE_DMA) - io_sethandler(0x00c0, 0x0020, capture_read_slave_dma,NULL,NULL, capture_write_slave_dma,NULL,NULL, es1371); + if (es1371->legacy_ctrl & LEGACY_CAPTURE_SSCAPE) + { + switch ((es1371->legacy_ctrl >> LEGACY_SSCAPE_ADDR_SHIFT) & 3) + { + case 0: io_sethandler(0x0320, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + case 1: io_sethandler(0x0330, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + case 2: io_sethandler(0x0340, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + case 3: io_sethandler(0x0350, 0x0008, capture_read_sscape,NULL,NULL, capture_write_sscape,NULL,NULL, es1371); break; + } + } + if (es1371->legacy_ctrl & LEGACY_CAPTURE_CODEC) + { + switch ((es1371->legacy_ctrl >> LEGACY_CODEC_ADDR_SHIFT) & 3) + { + case 0: io_sethandler(0x5300, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; + case 2: io_sethandler(0xe800, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; + case 3: io_sethandler(0xf400, 0x0080, capture_read_codec,NULL,NULL, capture_write_codec,NULL,NULL, es1371); break; + } + } + if (es1371->legacy_ctrl & LEGACY_CAPTURE_SB) + { + if (!(es1371->legacy_ctrl & LEGACY_SB_ADDR)) + io_sethandler(0x0220, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); + else + io_sethandler(0x0240, 0x0010, capture_read_sb,NULL,NULL, capture_write_sb,NULL,NULL, es1371); + } + if (es1371->legacy_ctrl & LEGACY_CAPTURE_ADLIB) + io_sethandler(0x0388, 0x0004, capture_read_adlib,NULL,NULL, capture_write_adlib,NULL,NULL, es1371); + if (es1371->legacy_ctrl & LEGACY_CAPTURE_MASTER_PIC) + io_sethandler(0x0020, 0x0002, capture_read_master_pic,NULL,NULL, capture_write_master_pic,NULL,NULL, es1371); + if (es1371->legacy_ctrl & LEGACY_CAPTURE_MASTER_DMA) + io_sethandler(0x0000, 0x0010, capture_read_master_dma,NULL,NULL, capture_write_master_dma,NULL,NULL, es1371); + if (es1371->legacy_ctrl & LEGACY_CAPTURE_SLAVE_PIC) + io_sethandler(0x00a0, 0x0002, capture_read_slave_pic,NULL,NULL, capture_write_slave_pic,NULL,NULL, es1371); + if (es1371->legacy_ctrl & LEGACY_CAPTURE_SLAVE_DMA) + io_sethandler(0x00c0, 0x0020, capture_read_slave_dma,NULL,NULL, capture_write_slave_dma,NULL,NULL, es1371); } @@ -1406,7 +1427,7 @@ const device_t es1371_device = es1371_init, es1371_close, NULL, - NULL, + { NULL }, es1371_speed_changed, NULL, NULL @@ -1420,7 +1441,7 @@ const device_t es1371_onboard_device = es1371_init, es1371_close, NULL, - NULL, + { NULL }, es1371_speed_changed, NULL, NULL diff --git a/src/sound/snd_azt2316a.c b/src/sound/snd_azt2316a.c index f129e2e60..ec9a452a1 100644 --- a/src/sound/snd_azt2316a.c +++ b/src/sound/snd_azt2316a.c @@ -1257,7 +1257,7 @@ static const device_config_t azt1605_config[] = .default_int = 0 }, { - "addr", "SB Address", CONFIG_HEX16, "", 0, + "addr", "SB Address", CONFIG_HEX16, "", 0, "", { 0 }, { { "0x220", 0x220 @@ -1385,7 +1385,7 @@ static const device_config_t azt2316a_config[] = .default_int = 0 }, { - "addr", "SB Address", CONFIG_HEX16, "", 0, + "addr", "SB Address", CONFIG_HEX16, "", 0, "", { 0 }, { { "0x220", 0x220 @@ -1468,7 +1468,7 @@ const device_t azt2316a_device = "Aztech Sound Galaxy Pro 16 AB (Washington)", DEVICE_ISA | DEVICE_AT, SB_SUBTYPE_CLONE_AZT2316A_0X11, - azt_init, azt_close, NULL, NULL, + azt_init, azt_close, NULL, { NULL }, azt_speed_changed, NULL, azt2316a_config @@ -1479,7 +1479,7 @@ const device_t azt1605_device = "Aztech Sound Galaxy Nova 16 Extra (Clinton)", DEVICE_ISA | DEVICE_AT, SB_SUBTYPE_CLONE_AZT1605_0X0C, - azt_init, azt_close, NULL, NULL, + azt_init, azt_close, NULL, { NULL }, azt_speed_changed, NULL, azt1605_config diff --git a/src/sound/snd_cms.c b/src/sound/snd_cms.c index 9a635b50e..61278fa88 100644 --- a/src/sound/snd_cms.c +++ b/src/sound/snd_cms.c @@ -198,6 +198,6 @@ const device_t cms_device = "Creative Music System / Game Blaster", 0, 0, cms_init, cms_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sound/snd_emu8k.c b/src/sound/snd_emu8k.c index 70465f121..9fdbff67e 100644 --- a/src/sound/snd_emu8k.c +++ b/src/sound/snd_emu8k.c @@ -1751,106 +1751,109 @@ void emu8k_update(emu8k_t *emu8k) { int32_t dat; - /* Waveform oscillator */ -#ifdef RESAMPLER_LINEAR - dat = EMU8K_READ_INTERP_LINEAR(emu8k, emu_voice->addr.int_address, - emu_voice->addr.fract_address); - -#elif defined RESAMPLER_CUBIC - dat = EMU8K_READ_INTERP_CUBIC(emu8k, emu_voice->addr.int_address, - emu_voice->addr.fract_address); -#endif - - /* Filter section */ - if (emu_voice->filterq_idx || emu_voice->cvcf_curr_filt_ctoff != 0xFFFF ) + if (emu_voice->cvcf_curr_volume) { - int cutoff = emu_voice->cvcf_curr_filt_ctoff >> 8; - const int64_t coef0 = filt_coeffs[emu_voice->filterq_idx][cutoff][0]; - const int64_t coef1 = filt_coeffs[emu_voice->filterq_idx][cutoff][1]; - const int64_t coef2 = filt_coeffs[emu_voice->filterq_idx][cutoff][2]; - /* clip at twice the range */ - #define ClipBuffer(buf) (buf < -16777216) ? -16777216 : (buf > 16777216) ? 16777216 : buf + /* Waveform oscillator */ + #ifdef RESAMPLER_LINEAR + dat = EMU8K_READ_INTERP_LINEAR(emu8k, emu_voice->addr.int_address, + emu_voice->addr.fract_address); - #ifdef FILTER_INITIAL - #define NOOP(x) (void)x; - NOOP(coef1) - /* Apply expected attenuation. (FILTER_MOOG does it implicitly, but this one doesn't). - * Work in 24bits. */ - dat = (dat * emu_voice->filt_att) >> 8; - - int64_t vhp = ((-emu_voice->filt_buffer[0] * coef2) >> 24) - emu_voice->filt_buffer[1] - dat; - emu_voice->filt_buffer[1] += (emu_voice->filt_buffer[0] * coef0) >> 24; - emu_voice->filt_buffer[0] += (vhp * coef0) >> 24; - dat = (int32_t)(emu_voice->filt_buffer[1] >> 8); - if (dat > 32767) { dat = 32767; } - else if (dat < -32768) { dat = -32768; } + #elif defined RESAMPLER_CUBIC + dat = EMU8K_READ_INTERP_CUBIC(emu8k, emu_voice->addr.int_address, + emu_voice->addr.fract_address); + #endif - #elif defined FILTER_MOOG - - /*move to 24bits*/ - dat <<= 8; - - dat -= (coef2 * emu_voice->filt_buffer[4]) >> 24; /*feedback*/ - int64_t t1 = emu_voice->filt_buffer[1]; - emu_voice->filt_buffer[1] = ((dat + emu_voice->filt_buffer[0]) * coef0 - emu_voice->filt_buffer[1] * coef1) >> 24; - emu_voice->filt_buffer[1] = ClipBuffer(emu_voice->filt_buffer[1]); - - int64_t t2 = emu_voice->filt_buffer[2]; - emu_voice->filt_buffer[2] = ((emu_voice->filt_buffer[1] + t1) * coef0 - emu_voice->filt_buffer[2] * coef1) >> 24; - emu_voice->filt_buffer[2] = ClipBuffer(emu_voice->filt_buffer[2]); - - int64_t t3 = emu_voice->filt_buffer[3]; - emu_voice->filt_buffer[3] = ((emu_voice->filt_buffer[2] + t2) * coef0 - emu_voice->filt_buffer[3] * coef1) >> 24; - emu_voice->filt_buffer[3] = ClipBuffer(emu_voice->filt_buffer[3]); - - emu_voice->filt_buffer[4] = ((emu_voice->filt_buffer[3] + t3) * coef0 - emu_voice->filt_buffer[4] * coef1) >> 24; - emu_voice->filt_buffer[4] = ClipBuffer(emu_voice->filt_buffer[4]); - - emu_voice->filt_buffer[0] = ClipBuffer(dat); - - dat = (int32_t)(emu_voice->filt_buffer[4] >> 8); - if (dat > 32767) { dat = 32767; } - else if (dat < -32768) { dat = -32768; } - - #elif defined FILTER_CONSTANT - - /* Apply expected attenuation. (FILTER_MOOG does it implicitly, but this one is constant gain). - * Also stay at 24bits.*/ - dat = (dat * emu_voice->filt_att) >> 8; - - emu_voice->filt_buffer[0] = (coef1 * emu_voice->filt_buffer[0] - + coef0 * (dat + - ((coef2 * (emu_voice->filt_buffer[0] - emu_voice->filt_buffer[1]))>>24)) - ) >> 24; - emu_voice->filt_buffer[1] = (coef1 * emu_voice->filt_buffer[1] - + coef0 * emu_voice->filt_buffer[0]) >> 24; - - emu_voice->filt_buffer[0] = ClipBuffer(emu_voice->filt_buffer[0]); - emu_voice->filt_buffer[1] = ClipBuffer(emu_voice->filt_buffer[1]); - - dat = (int32_t)(emu_voice->filt_buffer[1] >> 8); - if (dat > 32767) { dat = 32767; } - else if (dat < -32768) { dat = -32768; } - - #endif - - } - if (( emu8k->hwcf3 & 0x04) && !CCCA_DMA_ACTIVE(emu_voice->ccca)) - { - /*volume and pan*/ - dat = (dat * emu_voice->cvcf_curr_volume) >> 16; - - (*buf++) += (dat * emu_voice->vol_l) >> 8; - (*buf++) += (dat * emu_voice->vol_r) >> 8; - - /* Effects section */ - if (emu_voice->ptrx_revb_send > 0) + /* Filter section */ + if (emu_voice->filterq_idx || emu_voice->cvcf_curr_filt_ctoff != 0xFFFF ) { - emu8k->reverb_in_buffer[pos]+=(dat*emu_voice->ptrx_revb_send) >> 8; + int cutoff = emu_voice->cvcf_curr_filt_ctoff >> 8; + const int64_t coef0 = filt_coeffs[emu_voice->filterq_idx][cutoff][0]; + const int64_t coef1 = filt_coeffs[emu_voice->filterq_idx][cutoff][1]; + const int64_t coef2 = filt_coeffs[emu_voice->filterq_idx][cutoff][2]; + /* clip at twice the range */ + #define ClipBuffer(buf) (buf < -16777216) ? -16777216 : (buf > 16777216) ? 16777216 : buf + + #ifdef FILTER_INITIAL + #define NOOP(x) (void)x; + NOOP(coef1) + /* Apply expected attenuation. (FILTER_MOOG does it implicitly, but this one doesn't). + * Work in 24bits. */ + dat = (dat * emu_voice->filt_att) >> 8; + + int64_t vhp = ((-emu_voice->filt_buffer[0] * coef2) >> 24) - emu_voice->filt_buffer[1] - dat; + emu_voice->filt_buffer[1] += (emu_voice->filt_buffer[0] * coef0) >> 24; + emu_voice->filt_buffer[0] += (vhp * coef0) >> 24; + dat = (int32_t)(emu_voice->filt_buffer[1] >> 8); + if (dat > 32767) { dat = 32767; } + else if (dat < -32768) { dat = -32768; } + + #elif defined FILTER_MOOG + + /*move to 24bits*/ + dat <<= 8; + + dat -= (coef2 * emu_voice->filt_buffer[4]) >> 24; /*feedback*/ + int64_t t1 = emu_voice->filt_buffer[1]; + emu_voice->filt_buffer[1] = ((dat + emu_voice->filt_buffer[0]) * coef0 - emu_voice->filt_buffer[1] * coef1) >> 24; + emu_voice->filt_buffer[1] = ClipBuffer(emu_voice->filt_buffer[1]); + + int64_t t2 = emu_voice->filt_buffer[2]; + emu_voice->filt_buffer[2] = ((emu_voice->filt_buffer[1] + t1) * coef0 - emu_voice->filt_buffer[2] * coef1) >> 24; + emu_voice->filt_buffer[2] = ClipBuffer(emu_voice->filt_buffer[2]); + + int64_t t3 = emu_voice->filt_buffer[3]; + emu_voice->filt_buffer[3] = ((emu_voice->filt_buffer[2] + t2) * coef0 - emu_voice->filt_buffer[3] * coef1) >> 24; + emu_voice->filt_buffer[3] = ClipBuffer(emu_voice->filt_buffer[3]); + + emu_voice->filt_buffer[4] = ((emu_voice->filt_buffer[3] + t3) * coef0 - emu_voice->filt_buffer[4] * coef1) >> 24; + emu_voice->filt_buffer[4] = ClipBuffer(emu_voice->filt_buffer[4]); + + emu_voice->filt_buffer[0] = ClipBuffer(dat); + + dat = (int32_t)(emu_voice->filt_buffer[4] >> 8); + if (dat > 32767) { dat = 32767; } + else if (dat < -32768) { dat = -32768; } + + #elif defined FILTER_CONSTANT + + /* Apply expected attenuation. (FILTER_MOOG does it implicitly, but this one is constant gain). + * Also stay at 24bits.*/ + dat = (dat * emu_voice->filt_att) >> 8; + + emu_voice->filt_buffer[0] = (coef1 * emu_voice->filt_buffer[0] + + coef0 * (dat + + ((coef2 * (emu_voice->filt_buffer[0] - emu_voice->filt_buffer[1]))>>24)) + ) >> 24; + emu_voice->filt_buffer[1] = (coef1 * emu_voice->filt_buffer[1] + + coef0 * emu_voice->filt_buffer[0]) >> 24; + + emu_voice->filt_buffer[0] = ClipBuffer(emu_voice->filt_buffer[0]); + emu_voice->filt_buffer[1] = ClipBuffer(emu_voice->filt_buffer[1]); + + dat = (int32_t)(emu_voice->filt_buffer[1] >> 8); + if (dat > 32767) { dat = 32767; } + else if (dat < -32768) { dat = -32768; } + + #endif + } - if (emu_voice->csl_chor_send > 0) + if (( emu8k->hwcf3 & 0x04) && !CCCA_DMA_ACTIVE(emu_voice->ccca)) { - emu8k->chorus_in_buffer[pos]+=(dat*emu_voice->csl_chor_send) >> 8; + /*volume and pan*/ + dat = (dat * emu_voice->cvcf_curr_volume) >> 16; + + (*buf++) += (dat * emu_voice->vol_l) >> 8; + (*buf++) += (dat * emu_voice->vol_r) >> 8; + + /* Effects section */ + if (emu_voice->ptrx_revb_send > 0) + { + emu8k->reverb_in_buffer[pos]+=(dat*emu_voice->ptrx_revb_send) >> 8; + } + if (emu_voice->csl_chor_send > 0) + { + emu8k->chorus_in_buffer[pos]+=(dat*emu_voice->csl_chor_send) >> 8; + } } } @@ -2098,10 +2101,10 @@ I've recopilated these sentences to get an idea of how to loop emu_voice->cpf_curr_frac_addr = emu_voice->addr.fract_address; //if ( emu_voice->cvcf_curr_volume != old_vol[c]) { - // emu8k_log("EMUVOL (%d):%d\n", c, emu_voice->cvcf_curr_volume); + // pclog("EMUVOL (%d):%d\n", c, emu_voice->cvcf_curr_volume); // old_vol[c]=emu_voice->cvcf_curr_volume; //} - //emu8k_log("EMUFILT :%d\n", emu_voice->cvcf_curr_filt_ctoff); + //pclog("EMUFILT :%d\n", emu_voice->cvcf_curr_filt_ctoff); } diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 966044b77..40a0a405b 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -1223,7 +1223,7 @@ void gus_speed_changed(void *p) static const device_config_t gus_config[] = { { - "type", "GUS type", CONFIG_SELECTION, "", 0, + "type", "GUS type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Classic", GUS_CLASSIC @@ -1239,7 +1239,7 @@ static const device_config_t gus_config[] = { }, }, { - "base", "Address", CONFIG_HEX16, "", 0x220, + "base", "Address", CONFIG_HEX16, "", 0x220, "", { 0 }, { { "210H", 0x210 @@ -1262,7 +1262,7 @@ static const device_config_t gus_config[] = { }, }, { - "gus_ram", "Onboard RAM", CONFIG_SELECTION, "", 0, + "gus_ram", "Onboard RAM", CONFIG_SELECTION, "", 0, "", { 0 }, { { "256 KB", 0 @@ -1292,7 +1292,7 @@ const device_t gus_device = DEVICE_ISA, 0, gus_init, gus_close, NULL, - NULL, + { NULL }, gus_speed_changed, NULL, gus_config diff --git a/src/sound/snd_mpu401.c b/src/sound/snd_mpu401.c index c9523c026..b407ceea9 100644 --- a/src/sound/snd_mpu401.c +++ b/src/sound/snd_mpu401.c @@ -1803,7 +1803,7 @@ mpu401_standalone_close(void *priv) static const device_config_t mpu401_standalone_config[] = { { - "base", "MPU-401 Address", CONFIG_HEX16, "", 0x330, + "base", "MPU-401 Address", CONFIG_HEX16, "", 0x330, "", { 0 }, { { "0x300", 0x300 @@ -1817,7 +1817,7 @@ static const device_config_t mpu401_standalone_config[] = } }, { - "irq", "MPU-401 IRQ", CONFIG_SELECTION, "", 9, + "irq", "MPU-401 IRQ", CONFIG_SELECTION, "", 9, "", { 0 }, { { "IRQ 9", 9 @@ -1872,7 +1872,7 @@ const device_t mpu401_device = { "Roland MPU-IPC-T", DEVICE_ISA, 0, mpu401_standalone_init, mpu401_standalone_close, NULL, - NULL, + { NULL }, NULL, NULL, mpu401_standalone_config @@ -1882,7 +1882,7 @@ const device_t mpu401_mca_device = { "Roland MPU-IMC", DEVICE_MCA, 0, mpu401_standalone_init, mpu401_standalone_close, NULL, - NULL, + { NULL }, NULL, NULL, mpu401_standalone_mca_config diff --git a/src/sound/snd_pas16.c b/src/sound/snd_pas16.c index 3dc2c1f0a..3a085241c 100644 --- a/src/sound/snd_pas16.c +++ b/src/sound/snd_pas16.c @@ -761,6 +761,6 @@ const device_t pas16_device = DEVICE_ISA | DEVICE_NOT_WORKING, 0, pas16_init, pas16_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sound/snd_pssj.c b/src/sound/snd_pssj.c index 9585ff662..bdf013e2e 100644 --- a/src/sound/snd_pssj.c +++ b/src/sound/snd_pssj.c @@ -215,7 +215,7 @@ const device_t pssj_device = pssj_init, pssj_close, NULL, - NULL, + { NULL }, NULL, NULL }; diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index b1b71d926..1565bb8f2 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -1497,7 +1497,7 @@ sb_speed_changed(void *p) static const device_config_t sb_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x220, + "base", "Address", CONFIG_HEX16, "", 0x220, "", { 0 }, { { "0x220", 0x220 @@ -1511,7 +1511,7 @@ static const device_config_t sb_config[] = } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 7, + "irq", "IRQ", CONFIG_SELECTION, "", 7, "", { 0 }, { { "IRQ 2", 2 @@ -1531,7 +1531,7 @@ static const device_config_t sb_config[] = } }, { - "dma", "DMA", CONFIG_SELECTION, "", 1, + "dma", "DMA", CONFIG_SELECTION, "", 1, "", { 0 }, { { "DMA 1", 1 @@ -1558,7 +1558,7 @@ static const device_config_t sb_config[] = static const device_config_t sb_mcv_config[] = { { - "irq", "IRQ", CONFIG_SELECTION, "", 7, + "irq", "IRQ", CONFIG_SELECTION, "", 7, "", { 0 }, { { "IRQ 3", 3 @@ -1575,7 +1575,7 @@ static const device_config_t sb_mcv_config[] = } }, { - "dma", "DMA", CONFIG_SELECTION, "", 1, + "dma", "DMA", CONFIG_SELECTION, "", 1, "", { 0 }, { { "DMA 1", 1 @@ -1602,7 +1602,7 @@ static const device_config_t sb_mcv_config[] = static const device_config_t sb_pro_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x220, + "base", "Address", CONFIG_HEX16, "", 0x220, "", { 0 }, { { "0x220", 0x220 @@ -1616,7 +1616,7 @@ static const device_config_t sb_pro_config[] = } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 7, + "irq", "IRQ", CONFIG_SELECTION, "", 7, "", { 0 }, { { "IRQ 2", 2 @@ -1636,7 +1636,7 @@ static const device_config_t sb_pro_config[] = } }, { - "dma", "DMA", CONFIG_SELECTION, "", 1, + "dma", "DMA", CONFIG_SELECTION, "", 1, "", { 0 }, { { "DMA 1", 1 @@ -1663,7 +1663,7 @@ static const device_config_t sb_pro_config[] = static const device_config_t sb_16_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x220, + "base", "Address", CONFIG_HEX16, "", 0x220, "", { 0 }, { { "0x220", 0x220 @@ -1683,7 +1683,7 @@ static const device_config_t sb_16_config[] = } }, { - "base401", "MPU-401 Address", CONFIG_HEX16, "", 0x330, + "base401", "MPU-401 Address", CONFIG_HEX16, "", 0x330, "", { 0 }, { { "Disabled", 0 @@ -1700,7 +1700,7 @@ static const device_config_t sb_16_config[] = } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 @@ -1720,7 +1720,7 @@ static const device_config_t sb_16_config[] = } }, { - "dma", "Low DMA channel", CONFIG_SELECTION, "", 1, + "dma", "Low DMA channel", CONFIG_SELECTION, "", 1, "", { 0 }, { { "DMA 0", 0 @@ -1737,7 +1737,7 @@ static const device_config_t sb_16_config[] = } }, { - "dma16", "High DMA channel", CONFIG_SELECTION, "", 5, + "dma16", "High DMA channel", CONFIG_SELECTION, "", 5, "", { 0 }, { { "DMA 5", 5 @@ -1770,7 +1770,7 @@ static const device_config_t sb_16_config[] = static const device_config_t sb_awe32_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x220, + "base", "Address", CONFIG_HEX16, "", 0x220, "", { 0 }, { { "0x220", 0x220 @@ -1790,7 +1790,7 @@ static const device_config_t sb_awe32_config[] = } }, { - "emu_base", "EMU8000 Address", CONFIG_HEX16, "", 0x620, + "emu_base", "EMU8000 Address", CONFIG_HEX16, "", 0x620, "", { 0 }, { { "0x620", 0x620 @@ -1810,7 +1810,7 @@ static const device_config_t sb_awe32_config[] = } }, { - "base401", "MPU-401 Address", CONFIG_HEX16, "", 0x330, + "base401", "MPU-401 Address", CONFIG_HEX16, "", 0x330, "", { 0 }, { { "Disabled", 0 @@ -1827,7 +1827,7 @@ static const device_config_t sb_awe32_config[] = } }, { - "irq", "IRQ", CONFIG_SELECTION, "", 5, + "irq", "IRQ", CONFIG_SELECTION, "", 5, "", { 0 }, { { "IRQ 2", 2 @@ -1847,7 +1847,7 @@ static const device_config_t sb_awe32_config[] = } }, { - "dma", "Low DMA channel", CONFIG_SELECTION, "", 1, + "dma", "Low DMA channel", CONFIG_SELECTION, "", 1, "", { 0 }, { { "DMA 0", 0 @@ -1864,7 +1864,7 @@ static const device_config_t sb_awe32_config[] = } }, { - "dma16", "High DMA channel", CONFIG_SELECTION, "", 5, + "dma16", "High DMA channel", CONFIG_SELECTION, "", 5, "", { 0 }, { { "DMA 5", 5 @@ -1881,7 +1881,7 @@ static const device_config_t sb_awe32_config[] = } }, { - "onboard_ram", "Onboard RAM", CONFIG_SELECTION, "", 512, + "onboard_ram", "Onboard RAM", CONFIG_SELECTION, "", 512, "", { 0 }, { { "None", 0 @@ -1922,88 +1922,96 @@ const device_t sb_1_device = "Sound Blaster v1.0", DEVICE_ISA, 0, - sb_1_init, sb_close, NULL, NULL, + sb_1_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_config }; + const device_t sb_15_device = { "Sound Blaster v1.5", DEVICE_ISA, 0, - sb_15_init, sb_close, NULL, NULL, + sb_15_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_config }; + const device_t sb_mcv_device = { "Sound Blaster MCV", DEVICE_MCA, 0, - sb_mcv_init, sb_close, NULL, NULL, + sb_mcv_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_mcv_config }; + const device_t sb_2_device = { "Sound Blaster v2.0", DEVICE_ISA, 0, - sb_2_init, sb_close, NULL, NULL, + sb_2_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_config }; + const device_t sb_pro_v1_device = { "Sound Blaster Pro v1", DEVICE_ISA, 0, - sb_pro_v1_init, sb_close, NULL, NULL, + sb_pro_v1_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_pro_config }; + const device_t sb_pro_v2_device = { "Sound Blaster Pro v2", DEVICE_ISA, 0, - sb_pro_v2_init, sb_close, NULL, NULL, + sb_pro_v2_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_pro_config }; + const device_t sb_pro_mcv_device = { "Sound Blaster Pro MCV", DEVICE_MCA, 0, - sb_pro_mcv_init, sb_close, NULL, NULL, + sb_pro_mcv_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, NULL }; + const device_t sb_16_device = { "Sound Blaster 16", - DEVICE_ISA, + DEVICE_ISA | DEVICE_AT, 0, - sb_16_init, sb_close, NULL, NULL, + sb_16_init, sb_close, NULL, { NULL }, sb_speed_changed, NULL, sb_16_config }; + const device_t sb_awe32_device = { "Sound Blaster AWE32", - DEVICE_ISA, + DEVICE_ISA | DEVICE_AT, 0, sb_awe32_init, sb_awe32_close, NULL, - sb_awe32_available, + { sb_awe32_available }, sb_speed_changed, NULL, sb_awe32_config diff --git a/src/sound/snd_sn76489.c b/src/sound/snd_sn76489.c index 215cea02a..b31bc0734 100644 --- a/src/sound/snd_sn76489.c +++ b/src/sound/snd_sn76489.c @@ -238,7 +238,7 @@ const device_t sn76489_device = 0, sn76489_device_init, sn76489_device_close, - NULL, NULL, NULL, + NULL, { NULL }, NULL, NULL }; const device_t ncr8496_device = @@ -248,6 +248,6 @@ const device_t ncr8496_device = 0, ncr8496_device_init, sn76489_device_close, - NULL, NULL, NULL, + NULL, { NULL }, NULL, NULL }; diff --git a/src/sound/snd_ssi2001.c b/src/sound/snd_ssi2001.c index ee994389e..ad65a9010 100644 --- a/src/sound/snd_ssi2001.c +++ b/src/sound/snd_ssi2001.c @@ -84,6 +84,6 @@ const device_t ssi2001_device = "Innovation SSI-2001", 0, 0, ssi2001_init, ssi2001_close, NULL, - NULL, NULL, NULL, + { NULL }, NULL, NULL, NULL }; diff --git a/src/sound/snd_wss.c b/src/sound/snd_wss.c index e7fc1387c..f7f813098 100644 --- a/src/sound/snd_wss.c +++ b/src/sound/snd_wss.c @@ -200,7 +200,7 @@ void wss_speed_changed(void *p) static const device_config_t wss_config[] = { { - "base", "Address", CONFIG_HEX16, "", 0x530, + "base", "Address", CONFIG_HEX16, "", 0x530, "", { 0 }, { { "0x530", 0x530 @@ -232,7 +232,7 @@ const device_t wss_device = "Windows Sound System", DEVICE_ISA | DEVICE_AT, 0, wss_init, wss_close, NULL, - NULL, + { NULL }, wss_speed_changed, NULL, wss_config @@ -243,7 +243,7 @@ const device_t ncr_business_audio_device = "NCR Business Audio", DEVICE_MCA, 0, ncr_audio_init, wss_close, NULL, - NULL, + { NULL }, wss_speed_changed, NULL, NULL diff --git a/src/sound/sound.c b/src/sound/sound.c index 310a38ca2..3751cb15a 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -41,7 +41,6 @@ typedef struct { - const char *name; const char *internal_name; const device_t *device; } SOUND_CARD; @@ -83,30 +82,29 @@ static void *filter_cd_audio_p = NULL; static const SOUND_CARD sound_cards[] = { - { "None", "none", NULL }, - { "Internal", "internal", NULL }, - { "[ISA] Adlib", "adlib", &adlib_device }, - { "[ISA] Adlib Gold", "adlibgold", &adgold_device }, - { "[ISA] Aztech Sound Galaxy Pro 16 AB (Washington)", "azt2316a", &azt2316a_device }, - { "[ISA] Aztech Sound Galaxy Nova 16 Extra (Clinton)", "azt1605", &azt1605_device }, - { "[ISA] Sound Blaster 1.0", "sb", &sb_1_device }, - { "[ISA] Sound Blaster 1.5", "sb1.5", &sb_15_device }, - { "[ISA] Sound Blaster 2.0", "sb2.0", &sb_2_device }, - { "[ISA] Sound Blaster Pro v1", "sbprov1", &sb_pro_v1_device }, - { "[ISA] Sound Blaster Pro v2", "sbprov2", &sb_pro_v2_device }, - { "[ISA] Sound Blaster 16", "sb16", &sb_16_device }, - { "[ISA] Sound Blaster AWE32", "sbawe32", &sb_awe32_device }, + { "none", NULL }, + { "internal", NULL }, + { "adlib", &adlib_device }, + { "adlibgold", &adgold_device }, + { "azt2316a", &azt2316a_device }, + { "azt1605", &azt1605_device }, + { "sb", &sb_1_device }, + { "sb1.5", &sb_15_device }, + { "sb2.0", &sb_2_device }, + { "sbprov1", &sb_pro_v1_device }, + { "sbprov2", &sb_pro_v2_device }, + { "sb16", &sb_16_device }, + { "sbawe32", &sb_awe32_device }, #if defined(DEV_BRANCH) && defined(USE_PAS16) - { "[ISA] Pro Audio Spectrum 16", "pas16", &pas16_device }, + { "pas16", &pas16_device }, #endif - { "[ISA] Windows Sound System", "wss", &wss_device }, - { "[MCA] Adlib", "adlib_mca", &adlib_mca_device }, - { "[MCA] NCR Business Audio", "ncraudio", &ncr_business_audio_device }, - { "[MCA] Sound Blaster MCV", "sbmcv", &sb_mcv_device }, - { "[MCA] Sound Blaster Pro MCV", "sbpromcv", &sb_pro_mcv_device }, - { "[PCI] Ensoniq AudioPCI (ES1371)", "es1371", &es1371_device }, - { "[PCI] Sound Blaster PCI 128", "sbpci128", &es1371_device }, - { "", "", NULL } + { "wss", &wss_device }, + { "adlib_mca", &adlib_mca_device }, + { "ncraudio", &ncr_business_audio_device }, + { "sbmcv", &sb_mcv_device }, + { "sbpromcv", &sb_pro_mcv_device }, + { "es1371", &es1371_device }, + { "", NULL } }; @@ -140,13 +138,6 @@ sound_card_available(int card) } -char * -sound_card_getname(int card) -{ - return (char *) sound_cards[card].name; -} - - const device_t * sound_card_getdevice(int card) { diff --git a/src/usb.c b/src/usb.c index 570c36962..fec6797ae 100644 --- a/src/usb.c +++ b/src/usb.c @@ -53,19 +53,12 @@ usb_log(const char *fmt, ...) static uint8_t uhci_reg_read(uint16_t addr, void *p) { - uint8_t ret = 0xff; + usb_t *dev = (usb_t *) p; + uint8_t ret, *regs = dev->uhci_io; - switch (addr & 0x1f) { - case 0x02: - /* Status */ - ret = 0x00; - break; + addr &= 0x0000001f; - case 0x10: case 0x11: case 0x12: case 0x13: - /* Port status */ - ret = 0x00; - break; - } + ret = regs[addr]; return ret; } @@ -74,6 +67,56 @@ uhci_reg_read(uint16_t addr, void *p) static void uhci_reg_write(uint16_t addr, uint8_t val, void *p) { + usb_t *dev = (usb_t *) p; + uint8_t *regs = dev->uhci_io; + + addr &= 0x0000001f; + + switch (addr) { + case 0x02: + regs[0x02] &= ~(val & 0x3f); + break; + case 0x04: + regs[0x04] = (val & 0x0f); + break; + case 0x09: + regs[0x09] = (val & 0xf0); + break; + case 0x0a: case 0x0b: + regs[addr] = val; + break; + case 0x0c: + regs[0x0c] = (val & 0x7f); + break; + } +} + + +static void +uhci_reg_writew(uint16_t addr, uint16_t val, void *p) +{ + usb_t *dev = (usb_t *) p; + uint16_t *regs = (uint16_t *) dev->uhci_io; + + addr &= 0x0000001f; + + switch (addr) { + case 0x00: + if ((regs[0x00] & 0x0001) && !(val & 0x0001)) + regs[0x02] |= 0x20; + regs[0x00] = (val & 0x00ff); + break; + case 0x06: + regs[0x03] = (val & 0x07ff); + break; + case 0x10: case 0x12: + regs[addr >> 1] = ((regs[addr >> 1] & 0xedbb) | (val & 0x1244)) & ~(val & 0x080a); + break; + default: + uhci_reg_write(addr, val & 0xff, p); + uhci_reg_write(addr + 1, (val >> 8) & 0xff, p); + break; + } } @@ -81,13 +124,13 @@ void uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable) { if (dev->uhci_enable && (dev->uhci_io_base != 0x0000)) - io_removehandler(dev->uhci_io_base, 0x20, uhci_reg_read, NULL, NULL, uhci_reg_write, NULL, NULL, dev); + io_removehandler(dev->uhci_io_base, 0x20, uhci_reg_read, NULL, NULL, uhci_reg_write, uhci_reg_writew, NULL, dev); dev->uhci_io_base = base_l | (base_h << 8); dev->uhci_enable = enable; if (dev->uhci_enable && (dev->uhci_io_base != 0x0000)) - io_sethandler(dev->uhci_io_base, 0x20, uhci_reg_read, NULL, NULL, uhci_reg_write, NULL, NULL, dev); + io_sethandler(dev->uhci_io_base, 0x20, uhci_reg_read, NULL, NULL, uhci_reg_write, uhci_reg_writew, NULL, dev); } @@ -303,6 +346,28 @@ ohci_update_mem_mapping(usb_t *dev, uint8_t base1, uint8_t base2, uint8_t base3, } +static void +usb_reset(void *priv) +{ + usb_t *dev = (usb_t *) priv; + + memset(dev->uhci_io, 0x00, 128); + dev->uhci_io[0x0c] = 0x40; + dev->uhci_io[0x10] = dev->uhci_io[0x12] = 0x80; + + memset(dev->ohci_mmio, 0x00, 4096); + dev->ohci_mmio[0x00] = 0x10; + dev->ohci_mmio[0x01] = 0x01; + dev->ohci_mmio[0x48] = 0x02; + + io_removehandler(dev->uhci_io_base, 0x20, uhci_reg_read, NULL, NULL, uhci_reg_write, uhci_reg_writew, NULL, dev); + dev->uhci_enable = 0; + + mem_mapping_disable(&dev->ohci_mmio_mapping); + dev->ohci_enable = 0; +} + + static void usb_close(void *priv) { @@ -321,6 +386,10 @@ usb_init(const device_t *info) if (dev == NULL) return(NULL); memset(dev, 0x00, sizeof(usb_t)); + memset(dev->uhci_io, 0x00, 128); + dev->uhci_io[0x0c] = 0x40; + dev->uhci_io[0x10] = dev->uhci_io[0x12] = 0x80; + memset(dev->ohci_mmio, 0x00, 4096); dev->ohci_mmio[0x00] = 0x10; dev->ohci_mmio[0x01] = 0x01; @@ -330,7 +399,7 @@ usb_init(const device_t *info) ohci_mmio_read, NULL, NULL, ohci_mmio_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, dev); - mem_mapping_disable(&dev->ohci_mmio_mapping); + usb_reset(dev); return dev; } @@ -343,8 +412,8 @@ const device_t usb_device = 0, usb_init, usb_close, - NULL, - NULL, + usb_reset, + { NULL }, NULL, NULL, NULL diff --git a/src/video/vid_ati18800.c b/src/video/vid_ati18800.c index f9b2a3a8b..b2f1dba16 100644 --- a/src/video/vid_ati18800.c +++ b/src/video/vid_ati18800.c @@ -283,7 +283,7 @@ const device_t ati18800_wonder_device = ati18800_init, ati18800_close, NULL, - ati18800_wonder_available, + { ati18800_wonder_available }, ati18800_speed_changed, ati18800_force_redraw, NULL @@ -297,7 +297,7 @@ const device_t ati18800_vga88_device = ati18800_init, ati18800_close, NULL, - ati18800_vga88_available, + { ati18800_vga88_available }, ati18800_speed_changed, ati18800_force_redraw, NULL @@ -310,7 +310,7 @@ const device_t ati18800_device = ati18800_init, ati18800_close, NULL, - ati18800_available, + { ati18800_available }, ati18800_speed_changed, ati18800_force_redraw, NULL diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index 3545cb69d..b1a1c8222 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -646,7 +646,7 @@ ati28800_force_redraw(void *priv) static const device_config_t ati28800_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 512, + "memory", "Memory size", CONFIG_SELECTION, "", 512, "", { 0 }, { { "256 kB", 256 @@ -671,7 +671,7 @@ static const device_config_t ati28800_config[] = static const device_config_t ati28800_wonderxl_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 512, + "memory", "Memory size", CONFIG_SELECTION, "", 512, "", { 0 }, { { "256 kB", 256 @@ -699,7 +699,7 @@ const device_t ati28800_device = DEVICE_ISA, 0, ati28800_init, ati28800_close, NULL, - ati28800_available, + { ati28800_available }, ati28800_speed_changed, ati28800_force_redraw, ati28800_config @@ -711,7 +711,7 @@ const device_t ati28800k_device = DEVICE_ISA, 0, ati28800k_init, ati28800_close, NULL, - ati28800k_available, + { ati28800k_available }, ati28800_speed_changed, ati28800_force_redraw, ati28800_config @@ -723,7 +723,7 @@ const device_t compaq_ati28800_device = DEVICE_ISA, VGAWONDERXL, ati28800_init, ati28800_close, NULL, - compaq_ati28800_available, + { compaq_ati28800_available }, ati28800_speed_changed, ati28800_force_redraw, ati28800_config @@ -736,7 +736,7 @@ const device_t ati28800_wonderxl24_device = DEVICE_ISA, VGAWONDERXL24, ati28800_init, ati28800_close, NULL, - ati28800_wonderxl24_available, + { ati28800_wonderxl24_available }, ati28800_speed_changed, ati28800_force_redraw, ati28800_wonderxl_config diff --git a/src/video/vid_ati68860_ramdac.c b/src/video/vid_ati68860_ramdac.c index b6703a310..b5165dcc6 100644 --- a/src/video/vid_ati68860_ramdac.c +++ b/src/video/vid_ati68860_ramdac.c @@ -292,5 +292,5 @@ const device_t ati68860_ramdac_device = "ATI-68860 RAMDAC", 0, 0, ati68860_ramdac_init, ati68860_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index e01417cc4..05859cad0 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -3456,7 +3456,7 @@ void mach64_force_redraw(void *p) static const device_config_t mach64gx_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 4, + "memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 }, { { "1 MB", 1 @@ -3480,7 +3480,7 @@ static const device_config_t mach64gx_config[] = static const device_config_t mach64vt2_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 4, + "memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 }, { { "2 MB", 2 @@ -3504,7 +3504,7 @@ const device_t mach64gx_isa_device = DEVICE_AT | DEVICE_ISA, 0, mach64gx_init, mach64_close, NULL, - mach64gx_isa_available, + { mach64gx_isa_available }, mach64_speed_changed, mach64_force_redraw, mach64gx_config @@ -3516,7 +3516,7 @@ const device_t mach64gx_vlb_device = DEVICE_VLB, 0, mach64gx_init, mach64_close, NULL, - mach64gx_vlb_available, + { mach64gx_vlb_available }, mach64_speed_changed, mach64_force_redraw, mach64gx_config @@ -3528,7 +3528,7 @@ const device_t mach64gx_pci_device = DEVICE_PCI, 0, mach64gx_init, mach64_close, NULL, - mach64gx_available, + { mach64gx_available }, mach64_speed_changed, mach64_force_redraw, mach64gx_config @@ -3540,7 +3540,7 @@ const device_t mach64vt2_device = DEVICE_PCI, 0, mach64vt2_init, mach64_close, NULL, - mach64vt2_available, + { mach64vt2_available }, mach64_speed_changed, mach64_force_redraw, mach64vt2_config diff --git a/src/video/vid_att20c49x_ramdac.c b/src/video/vid_att20c49x_ramdac.c index 0709fd0e1..7318fffb2 100644 --- a/src/video/vid_att20c49x_ramdac.c +++ b/src/video/vid_att20c49x_ramdac.c @@ -156,7 +156,7 @@ const device_t att490_ramdac_device = "AT&T 20c490/20c491 RAMDAC", 0, ATT_490_1, att49x_ramdac_init, att49x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; const device_t att492_ramdac_device = @@ -164,5 +164,5 @@ const device_t att492_ramdac_device = "AT&T 20c492/20c493 RAMDAC", 0, ATT_492_3, att49x_ramdac_init, att49x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_av9194.c b/src/video/vid_av9194.c index 0d89b2086..a01946e26 100644 --- a/src/video/vid_av9194.c +++ b/src/video/vid_av9194.c @@ -100,6 +100,6 @@ const device_t av9194_device = "AV9194 Clock Generator", 0, 0, av9194_init, NULL, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_bt48x_ramdac.c b/src/video/vid_bt48x_ramdac.c index 6f27d9721..20479ba47 100644 --- a/src/video/vid_bt48x_ramdac.c +++ b/src/video/vid_bt48x_ramdac.c @@ -505,7 +505,7 @@ const device_t bt484_ramdac_device = "Brooktree Bt484 RAMDAC", 0, BT484, bt48x_ramdac_init, bt48x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; const device_t att20c504_ramdac_device = @@ -513,7 +513,7 @@ const device_t att20c504_ramdac_device = "AT&T 20c504 RAMDAC", 0, ATT20C504, bt48x_ramdac_init, bt48x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; const device_t bt485_ramdac_device = @@ -521,7 +521,7 @@ const device_t bt485_ramdac_device = "Brooktree Bt485 RAMDAC", 0, BT485, bt48x_ramdac_init, bt48x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; const device_t att20c505_ramdac_device = @@ -529,7 +529,7 @@ const device_t att20c505_ramdac_device = "AT&T 20c505 RAMDAC", 0, ATT20C505, bt48x_ramdac_init, bt48x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; const device_t bt485a_ramdac_device = @@ -537,5 +537,5 @@ const device_t bt485a_ramdac_device = "Brooktree Bt485A RAMDAC", 0, BT485A, bt48x_ramdac_init, bt48x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index c62e12582..e7a5ffd61 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -575,7 +575,7 @@ cga_speed_changed(void *p) const device_config_t cga_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, + "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, "", { 0 }, { { "RGB", CGA_RGB @@ -589,7 +589,7 @@ const device_config_t cga_config[] = } }, { - "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, + "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, "", { 0 }, { { "Old", COMPOSITE_OLD @@ -603,7 +603,7 @@ const device_config_t cga_config[] = } }, { - "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, + "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Color", 0 @@ -641,7 +641,7 @@ const device_t cga_device = cga_standalone_init, cga_close, NULL, - NULL, + { NULL }, cga_speed_changed, NULL, cga_config diff --git a/src/video/vid_cl54xx.c b/src/video/vid_cl54xx.c index eb6a91f00..6b2fd4aaa 100644 --- a/src/video/vid_cl54xx.c +++ b/src/video/vid_cl54xx.c @@ -3384,13 +3384,13 @@ gd54xx_force_redraw(void *p) static const device_config_t gd5422_config[] = { { - "memory","Memory size",CONFIG_SELECTION,"",1, + "memory","Memory size",CONFIG_SELECTION,"", 1, "", { 0 }, { { - "512 KB",0 + "512 KB", 0 }, { - "1 MB",1 + "1 MB", 1 }, { "" @@ -3398,7 +3398,7 @@ static const device_config_t gd5422_config[] = }, }, { - "","",-1 + "", "", -1 } }; @@ -3517,7 +3517,7 @@ const device_t gd5401_isa_device = CIRRUS_ID_CLGD5401, gd54xx_init, gd54xx_close, NULL, - gd5401_available, + { gd5401_available }, gd54xx_speed_changed, gd54xx_force_redraw, NULL, @@ -3530,7 +3530,7 @@ const device_t gd5402_isa_device = CIRRUS_ID_CLGD5402, gd54xx_init, gd54xx_close, NULL, - gd5402_available, + { gd5402_available }, gd54xx_speed_changed, gd54xx_force_redraw, NULL, @@ -3543,7 +3543,7 @@ const device_t gd5402_onboard_device = CIRRUS_ID_CLGD5402 | 0x200, gd54xx_init, gd54xx_close, NULL, - NULL, + { NULL }, gd54xx_speed_changed, gd54xx_force_redraw, NULL, @@ -3556,7 +3556,7 @@ const device_t gd5420_isa_device = CIRRUS_ID_CLGD5420, gd54xx_init, gd54xx_close, NULL, - gd5420_available, + { gd5420_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5422_config, @@ -3569,7 +3569,7 @@ const device_t gd5422_isa_device = { CIRRUS_ID_CLGD5422, gd54xx_init, gd54xx_close, NULL, - gd5422_available, /* Common BIOS between 5422 and 5424 */ + { gd5422_available }, /* Common BIOS between 5422 and 5424 */ gd54xx_speed_changed, gd54xx_force_redraw, gd5422_config, @@ -3581,7 +3581,7 @@ const device_t gd5424_vlb_device = { CIRRUS_ID_CLGD5424, gd54xx_init, gd54xx_close, NULL, - gd5422_available, /* Common BIOS between 5422 and 5424 */ + { gd5422_available }, /* Common BIOS between 5422 and 5424 */ gd54xx_speed_changed, gd54xx_force_redraw, gd5422_config, @@ -3596,7 +3596,7 @@ const device_t gd5426_vlb_device = gd54xx_init, gd54xx_close, NULL, - gd5426_available, + { gd5426_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3610,7 +3610,7 @@ const device_t gd5426_onboard_device = gd54xx_init, gd54xx_close, NULL, - NULL, + { NULL }, gd54xx_speed_changed, gd54xx_force_redraw, NULL @@ -3624,7 +3624,7 @@ const device_t gd5428_isa_device = gd54xx_init, gd54xx_close, NULL, - gd5428_isa_available, + { gd5428_isa_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3638,7 +3638,7 @@ const device_t gd5428_vlb_device = gd54xx_init, gd54xx_close, NULL, - gd5428_available, + { gd5428_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3652,7 +3652,7 @@ const device_t gd5428_mca_device = gd54xx_init, gd54xx_close, NULL, - gd5428_available, + { gd5428_available }, gd54xx_speed_changed, gd54xx_force_redraw, NULL @@ -3666,7 +3666,7 @@ const device_t gd5428_onboard_device = gd54xx_init, gd54xx_close, NULL, - gd5428_isa_available, + { gd5428_isa_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_onboard_config @@ -3680,7 +3680,7 @@ const device_t gd5429_isa_device = gd54xx_init, gd54xx_close, NULL, - gd5429_available, + { gd5429_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3694,7 +3694,7 @@ const device_t gd5429_vlb_device = gd54xx_init, gd54xx_close, NULL, - gd5429_available, + { gd5429_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3708,7 +3708,7 @@ const device_t gd5430_vlb_device = gd54xx_init, gd54xx_close, NULL, - gd5430_vlb_available, + { gd5430_vlb_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3722,7 +3722,7 @@ const device_t gd5430_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5430_pci_available, + { gd5430_pci_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3736,7 +3736,7 @@ const device_t gd5434_isa_device = gd54xx_init, gd54xx_close, NULL, - gd5434_available, + { gd5434_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3750,7 +3750,7 @@ const device_t gd5434_onboard_pci_device = gd54xx_init, gd54xx_close, NULL, - NULL, + { NULL }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3764,7 +3764,7 @@ const device_t gd5434_vlb_device = gd54xx_init, gd54xx_close, NULL, - gd5434_available, + { gd5434_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3778,7 +3778,7 @@ const device_t gd5434_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5434_available, + { gd5434_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3792,7 +3792,7 @@ const device_t gd5436_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5436_available, + { gd5436_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3806,7 +3806,7 @@ const device_t gd5440_onboard_pci_device = gd54xx_init, gd54xx_close, NULL, - NULL, + { NULL }, gd54xx_speed_changed, gd54xx_force_redraw, gd5440_onboard_config @@ -3820,7 +3820,7 @@ const device_t gd5440_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5440_available, + { gd5440_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5428_config @@ -3834,7 +3834,7 @@ const device_t gd5446_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5446_available, + { gd5446_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3848,7 +3848,7 @@ const device_t gd5446_stb_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5446_stb_available, + { gd5446_stb_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config @@ -3862,7 +3862,7 @@ const device_t gd5480_pci_device = gd54xx_init, gd54xx_close, NULL, - gd5480_available, + { gd5480_available }, gd54xx_speed_changed, gd54xx_force_redraw, gd5434_config diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index 934fec827..371d23e5e 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -432,7 +432,7 @@ void colorplus_speed_changed(void *p) static const device_config_t colorplus_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, + "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, "", { 0 }, { { "RGB", CGA_RGB @@ -446,7 +446,7 @@ static const device_config_t colorplus_config[] = } }, { - "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, + "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, "", { 0 }, { { "Old", COMPOSITE_OLD @@ -473,7 +473,7 @@ const device_t colorplus_device = DEVICE_ISA, 0, colorplus_standalone_init, colorplus_close, - NULL, NULL, + NULL, { NULL }, colorplus_speed_changed, NULL, colorplus_config diff --git a/src/video/vid_compaq_cga.c b/src/video/vid_compaq_cga.c index 007bbca09..95adeb81c 100644 --- a/src/video/vid_compaq_cga.c +++ b/src/video/vid_compaq_cga.c @@ -483,7 +483,7 @@ const device_t compaq_cga_device = compaq_cga_init, compaq_cga_close, NULL, - NULL, + { NULL }, compaq_cga_speed_changed, NULL, cga_config @@ -496,7 +496,7 @@ const device_t compaq_cga_2_device = compaq_cga_init, compaq_cga_close, NULL, - NULL, + { NULL }, compaq_cga_speed_changed, NULL, cga_config diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 780d1559d..e47aed584 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -1134,7 +1134,7 @@ ega_speed_changed(void *p) static const device_config_t ega_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 256, + "memory", "Memory size", CONFIG_SELECTION, "", 256, "", { 0 }, { { "64 kB", 64 @@ -1202,7 +1202,7 @@ const device_t ega_device = DEVICE_ISA, EGA_IBM, ega_standalone_init, ega_close, NULL, - ega_standalone_available, + { ega_standalone_available }, ega_speed_changed, NULL, ega_config @@ -1214,7 +1214,7 @@ const device_t cpqega_device = DEVICE_ISA, EGA_COMPAQ, ega_standalone_init, ega_close, NULL, - cpqega_standalone_available, + { cpqega_standalone_available }, ega_speed_changed, NULL, ega_config @@ -1226,7 +1226,7 @@ const device_t sega_device = DEVICE_ISA, EGA_SUPEREGA, ega_standalone_init, ega_close, NULL, - sega_standalone_available, + { sega_standalone_available }, ega_speed_changed, NULL, ega_config @@ -1238,7 +1238,7 @@ const device_t atiega_device = DEVICE_ISA, EGA_ATI, ega_standalone_init, ega_close, NULL, - atiega_standalone_available, + { atiega_standalone_available }, ega_speed_changed, NULL, ega_config @@ -1250,7 +1250,7 @@ const device_t iskra_ega_device = DEVICE_ISA, EGA_ISKRA, ega_standalone_init, ega_close, NULL, - ega_standalone_available, + { ega_standalone_available }, ega_speed_changed, NULL, ega_config diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index a86632094..aa1ccf52c 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -790,7 +790,7 @@ et4000_kasan_available(void) static const device_config_t et4000_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 1024, + "memory", "Memory size", CONFIG_SELECTION, "", 1024, "", { 0 }, { { "256 KB", 256 @@ -816,7 +816,7 @@ const device_t et4000_isa_device = { DEVICE_ISA, 0, et4000_init, et4000_close, NULL, - et4000_available, + { et4000_available }, et4000_speed_changed, et4000_force_redraw, et4000_config @@ -827,7 +827,7 @@ const device_t et4000_mca_device = { DEVICE_MCA, 1, et4000_init, et4000_close, NULL, - et4000_available, + { et4000_available }, et4000_speed_changed, et4000_force_redraw, et4000_config @@ -838,7 +838,7 @@ const device_t et4000k_isa_device = { DEVICE_ISA, 2, et4000_init, et4000_close, NULL, - et4000k_available, + { et4000k_available }, et4000_speed_changed, et4000_force_redraw, et4000_config @@ -849,7 +849,7 @@ const device_t et4000k_tg286_isa_device = { DEVICE_ISA, 3, et4000_init, et4000_close, NULL, - et4000k_available, + { et4000k_available }, et4000_speed_changed, et4000_force_redraw, et4000_config @@ -860,7 +860,7 @@ const device_t et4000_kasan_isa_device = { DEVICE_ISA, 4, et4000_init, et4000_close, NULL, - et4000_kasan_available, + { et4000_kasan_available }, et4000_speed_changed, et4000_force_redraw, et4000_config diff --git a/src/video/vid_et4000w32.c b/src/video/vid_et4000w32.c index 89da9b489..9fb13de5b 100644 --- a/src/video/vid_et4000w32.c +++ b/src/video/vid_et4000w32.c @@ -1396,7 +1396,7 @@ void et4000w32p_force_redraw(void *p) static const device_config_t et4000w32p_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 2, + "memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 }, { { "1 MB", 1 @@ -1419,7 +1419,7 @@ const device_t et4000w32p_cardex_vlb_device = "Tseng Labs ET4000/w32p VLB (Cardex)", DEVICE_VLB, ET4000W32_CARDEX, et4000w32p_init, et4000w32p_close, NULL, - et4000w32p_cardex_available, + { et4000w32p_cardex_available }, et4000w32p_speed_changed, et4000w32p_force_redraw, et4000w32p_config @@ -1430,7 +1430,7 @@ const device_t et4000w32p_cardex_pci_device = "Tseng Labs ET4000/w32p PCI (Cardex)", DEVICE_PCI, ET4000W32_CARDEX, et4000w32p_init, et4000w32p_close, NULL, - et4000w32p_cardex_available, + { et4000w32p_cardex_available }, et4000w32p_speed_changed, et4000w32p_force_redraw, et4000w32p_config @@ -1441,7 +1441,7 @@ const device_t et4000w32p_vlb_device = "Tseng Labs ET4000/w32p VLB (Diamond)", DEVICE_VLB, ET4000W32_DIAMOND, et4000w32p_init, et4000w32p_close, NULL, - et4000w32p_available, + { et4000w32p_available }, et4000w32p_speed_changed, et4000w32p_force_redraw, et4000w32p_config @@ -1452,7 +1452,7 @@ const device_t et4000w32p_pci_device = "Tseng Labs ET4000/w32p PCI (Diamond)", DEVICE_PCI, ET4000W32_DIAMOND, et4000w32p_init, et4000w32p_close, NULL, - et4000w32p_available, + { et4000w32p_available }, et4000w32p_speed_changed, et4000w32p_force_redraw, et4000w32p_config diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index befc61f71..6fbe02b94 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -796,7 +796,7 @@ const device_t genius_device = "Genius VHR", DEVICE_ISA, 0, genius_init, genius_close, NULL, - genius_available, + { genius_available }, genius_speed_changed, NULL, NULL diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index 5a836109f..760774fe3 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -523,7 +523,7 @@ speed_changed(void *priv) static const device_config_t hercules_config[] = { { - "rgb_type", "Display type", CONFIG_SELECTION, "", 0, + "rgb_type", "Display type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Default", 0 @@ -555,7 +555,7 @@ const device_t hercules_device = { DEVICE_ISA, 0, hercules_init, hercules_close, NULL, - NULL, + { NULL }, speed_changed, NULL, hercules_config diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index 14c229d47..df5b01da0 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -696,7 +696,7 @@ speed_changed(void *priv) static const device_config_t herculesplus_config[] = { { - "rgb_type", "Display type", CONFIG_SELECTION, "", 0, + "rgb_type", "Display type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Default", 0 @@ -728,7 +728,7 @@ const device_t herculesplus_device = { DEVICE_ISA, 0, herculesplus_init, herculesplus_close, NULL, - NULL, + { NULL }, speed_changed, NULL, herculesplus_config diff --git a/src/video/vid_ht216.c b/src/video/vid_ht216.c index 5f271e0ea..79cfb6bdf 100644 --- a/src/video/vid_ht216.c +++ b/src/video/vid_ht216.c @@ -1141,7 +1141,7 @@ ht216_force_redraw(void *p) static const device_config_t v7_vga_1024i_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 512, + "memory", "Memory size", CONFIG_SELECTION, "", 512, "", { 0 }, { { "256 kB", 256 @@ -1167,7 +1167,7 @@ const device_t g2_gc205_device = g2_gc205_init, ht216_close, NULL, - g2_gc205_available, + { g2_gc205_available }, ht216_speed_changed, ht216_force_redraw }; @@ -1180,7 +1180,7 @@ const device_t v7_vga_1024i_device = v7_vga_1024i_init, ht216_close, NULL, - v7_vga_1024i_available, + { v7_vga_1024i_available }, ht216_speed_changed, ht216_force_redraw, v7_vga_1024i_config @@ -1194,7 +1194,7 @@ const device_t ht216_32_pb410a_device = ht216_pb410a_init, ht216_close, NULL, - NULL, + { NULL }, ht216_speed_changed, ht216_force_redraw }; diff --git a/src/video/vid_icd2061.c b/src/video/vid_icd2061.c index 460ee6242..0ba5aedc0 100644 --- a/src/video/vid_icd2061.c +++ b/src/video/vid_icd2061.c @@ -171,7 +171,7 @@ const device_t icd2061_device = "ICD2061 Clock Generator", 0, 0, icd2061_init, icd2061_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; @@ -180,5 +180,5 @@ const device_t ics9161_device = "ICS9161 Clock Generator", 0, 0, icd2061_init, icd2061_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_ics2494.c b/src/video/vid_ics2494.c index f6f72cf05..0e6cdddb0 100644 --- a/src/video/vid_ics2494.c +++ b/src/video/vid_ics2494.c @@ -110,5 +110,5 @@ const device_t ics2494an_305_device = "ICS2494AN-305 Clock Generator", 0, 305, ics2494_init, ics2494_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_ics2595.c b/src/video/vid_ics2595.c index 0aaef288f..900b9539e 100644 --- a/src/video/vid_ics2595.c +++ b/src/video/vid_ics2595.c @@ -129,5 +129,5 @@ const device_t ics2595_device = "ICS2595 clock chip", 0, 0, ics2595_init, ics2595_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_im1024.c b/src/video/vid_im1024.c index 33c3d491d..aa2cfe66e 100644 --- a/src/video/vid_im1024.c +++ b/src/video/vid_im1024.c @@ -1033,7 +1033,7 @@ const device_t im1024_device = { "ImageManager 1024", DEVICE_ISA, 0, im1024_init, im1024_close, NULL, - im1024_available, + { im1024_available }, im1024_speed_changed, NULL, NULL diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index 763b62a4e..8b644077e 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -1097,7 +1097,7 @@ const device_t incolor_device = { DEVICE_ISA, 0, incolor_init, incolor_close, NULL, - NULL, + { NULL }, speed_changed, NULL, NULL diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index 002f082e5..7220346bd 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -332,7 +332,7 @@ void mda_speed_changed(void *p) static const device_config_t mda_config[] = { { - "rgb_type", "Display type", CONFIG_SELECTION, "", 0, + "rgb_type", "Display type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Default", 0 @@ -362,7 +362,7 @@ const device_t mda_device = "MDA", DEVICE_ISA, 0, mda_standalone_init, mda_close, NULL, - NULL, + { NULL }, mda_speed_changed, NULL, mda_config diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index 4cc3885d1..ef3a0dbe5 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -5101,7 +5101,7 @@ const device_t mystique_device = mystique_init, mystique_close, NULL, - mystique_available, + { mystique_available }, mystique_speed_changed, mystique_force_redraw, mystique_config @@ -5116,7 +5116,7 @@ const device_t mystique_220_device = mystique_init, mystique_close, NULL, - mystique_220_available, + { mystique_220_available }, mystique_speed_changed, mystique_force_redraw, mystique_config diff --git a/src/video/vid_oak_oti.c b/src/video/vid_oak_oti.c index c3e5b11af..08df31144 100644 --- a/src/video/vid_oak_oti.c +++ b/src/video/vid_oak_oti.c @@ -443,7 +443,7 @@ oti067_077_available(void) static const device_config_t oti067_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 512, + "memory", "Memory size", CONFIG_SELECTION, "", 512, "", { 0 }, { { "256 kB", 256 @@ -465,7 +465,7 @@ static const device_config_t oti067_config[] = static const device_config_t oti067_ama932j_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 256, + "memory", "Memory size", CONFIG_SELECTION, "", 256, "", { 0 }, { { "256 kB", 256 @@ -487,7 +487,7 @@ static const device_config_t oti067_ama932j_config[] = static const device_config_t oti077_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 1024, + "memory", "Memory size", CONFIG_SELECTION, "", 1024, "", { 0 }, { { "256 kB", 256 @@ -514,7 +514,7 @@ const device_t oti037c_device = DEVICE_ISA, 0, oti_init, oti_close, NULL, - oti037c_available, + { oti037c_available }, oti_speed_changed, oti_force_redraw }; @@ -525,7 +525,7 @@ const device_t oti067_device = DEVICE_ISA, 2, oti_init, oti_close, NULL, - oti067_077_available, + { oti067_077_available }, oti_speed_changed, oti_force_redraw, oti067_config @@ -537,7 +537,7 @@ const device_t oti067_ama932j_device = DEVICE_ISA, 3, oti_init, oti_close, NULL, - oti067_ama932j_available, + { oti067_ama932j_available }, oti_speed_changed, oti_force_redraw, oti067_ama932j_config @@ -549,7 +549,7 @@ const device_t oti077_device = DEVICE_ISA, 5, oti_init, oti_close, NULL, - oti067_077_available, + { oti067_077_available }, oti_speed_changed, oti_force_redraw, oti077_config diff --git a/src/video/vid_paradise.c b/src/video/vid_paradise.c index 48e86544a..3f025fd3b 100644 --- a/src/video/vid_paradise.c +++ b/src/video/vid_paradise.c @@ -473,7 +473,7 @@ const device_t paradise_pvga1a_pc2086_device = paradise_pvga1a_pc2086_init, paradise_close, NULL, - NULL, + { NULL }, paradise_speed_changed, paradise_force_redraw, NULL @@ -486,7 +486,7 @@ const device_t paradise_pvga1a_pc3086_device = paradise_pvga1a_pc3086_init, paradise_close, NULL, - NULL, + { NULL }, paradise_speed_changed, paradise_force_redraw, NULL @@ -495,7 +495,7 @@ const device_t paradise_pvga1a_pc3086_device = static const device_config_t paradise_pvga1a_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 512, + "memory", "Memory size", CONFIG_SELECTION, "", 512, "", { 0 }, { { "256 kB", 256 @@ -524,7 +524,7 @@ const device_t paradise_pvga1a_device = paradise_pvga1a_standalone_init, paradise_close, NULL, - paradise_pvga1a_standalone_available, + { paradise_pvga1a_standalone_available }, paradise_speed_changed, paradise_force_redraw, paradise_pvga1a_config @@ -537,7 +537,7 @@ const device_t paradise_wd90c11_megapc_device = paradise_wd90c11_megapc_init, paradise_close, NULL, - NULL, + { NULL }, paradise_speed_changed, paradise_force_redraw, NULL @@ -550,7 +550,7 @@ const device_t paradise_wd90c11_device = paradise_wd90c11_standalone_init, paradise_close, NULL, - paradise_wd90c11_standalone_available, + { paradise_wd90c11_standalone_available }, paradise_speed_changed, paradise_force_redraw, NULL @@ -559,7 +559,7 @@ const device_t paradise_wd90c11_device = static const device_config_t paradise_wd90c30_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 1024, + "memory", "Memory size", CONFIG_SELECTION, "", 1024, "", { 0 }, { { "512 kB", 512 @@ -585,7 +585,7 @@ const device_t paradise_wd90c30_device = paradise_wd90c30_standalone_init, paradise_close, NULL, - paradise_wd90c30_standalone_available, + { paradise_wd90c30_standalone_available }, paradise_speed_changed, paradise_force_redraw, paradise_wd90c30_config diff --git a/src/video/vid_pgc.c b/src/video/vid_pgc.c index 8f92bbd0d..213d85f6a 100644 --- a/src/video/vid_pgc.c +++ b/src/video/vid_pgc.c @@ -2725,7 +2725,7 @@ const device_t pgc_device = { pgc_standalone_init, pgc_close, NULL, - NULL, + { NULL }, pgc_speed_changed, NULL, NULL diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 741dd164f..85aaf22d9 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -4775,7 +4775,7 @@ static void s3_force_redraw(void *p) static const device_config_t s3_orchid_86c911_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 1, + "memory", "Memory size", CONFIG_SELECTION, "", 1, "", { 0 }, { { "512 KB", 0 @@ -4796,7 +4796,7 @@ static const device_config_t s3_orchid_86c911_config[] = static const device_config_t s3_9fx_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 2, + "memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 }, { { "1 MB", 1 @@ -4818,7 +4818,7 @@ static const device_config_t s3_9fx_config[] = static const device_config_t s3_phoenix_trio32_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 2, + "memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 }, { { "512 KB", 0 @@ -4842,7 +4842,7 @@ static const device_config_t s3_phoenix_trio32_config[] = static const device_config_t s3_phoenix_trio64_onboard_config[] = { { - "memory", "Video memory size", CONFIG_SELECTION, "", 4, + "memory", "Video memory size", CONFIG_SELECTION, "", 4, "", { 0 }, { { "1 MB", 1 @@ -4866,7 +4866,7 @@ static const device_config_t s3_phoenix_trio64_onboard_config[] = static const device_config_t s3_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 4, + "memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 }, { { "1 MB", 1 @@ -4877,6 +4877,9 @@ static const device_config_t s3_config[] = { "4 MB", 4 }, + { + "8 MB", 8 + }, { "" } @@ -4895,7 +4898,7 @@ const device_t s3_orchid_86c911_isa_device = s3_init, s3_close, NULL, - s3_orchid_86c911_available, + { s3_orchid_86c911_available }, s3_speed_changed, s3_force_redraw, s3_orchid_86c911_config @@ -4909,7 +4912,7 @@ const device_t s3_diamond_stealth_vram_isa_device = s3_init, s3_close, NULL, - s3_diamond_stealth_vram_available, + { s3_diamond_stealth_vram_available }, s3_speed_changed, s3_force_redraw, s3_orchid_86c911_config @@ -4923,7 +4926,7 @@ const device_t s3_ami_86c924_isa_device = s3_init, s3_close, NULL, - s3_ami_86c924_available, + { s3_ami_86c924_available }, s3_speed_changed, s3_force_redraw, s3_orchid_86c911_config @@ -4937,7 +4940,7 @@ const device_t s3_v7mirage_86c801_isa_device = s3_init, s3_close, NULL, - s3_v7mirage_86c801_available, + { s3_v7mirage_86c801_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -4951,7 +4954,7 @@ const device_t s3_phoenix_86c805_vlb_device = s3_init, s3_close, NULL, - s3_phoenix_86c805_available, + { s3_phoenix_86c805_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -4965,7 +4968,7 @@ const device_t s3_metheus_86c928_isa_device = s3_init, s3_close, NULL, - s3_metheus_86c928_available, + { s3_metheus_86c928_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -4979,7 +4982,7 @@ const device_t s3_metheus_86c928_vlb_device = s3_init, s3_close, NULL, - s3_metheus_86c928_available, + { s3_metheus_86c928_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -4993,7 +4996,7 @@ const device_t s3_metheus_86c928_pci_device = s3_init, s3_close, NULL, - s3_metheus_86c928_available, + { s3_metheus_86c928_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5007,7 +5010,7 @@ const device_t s3_bahamas64_vlb_device = s3_init, s3_close, NULL, - s3_bahamas64_available, + { s3_bahamas64_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -5021,7 +5024,7 @@ const device_t s3_bahamas64_pci_device = s3_init, s3_close, NULL, - s3_bahamas64_available, + { s3_bahamas64_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -5035,7 +5038,7 @@ const device_t s3_diamond_stealth64_964_vlb_device = s3_init, s3_close, NULL, - s3_diamond_stealth64_964_available, + { s3_diamond_stealth64_964_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5049,7 +5052,7 @@ const device_t s3_diamond_stealth64_964_pci_device = s3_init, s3_close, NULL, - s3_diamond_stealth64_964_available, + { s3_diamond_stealth64_964_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5063,7 +5066,7 @@ const device_t s3_9fx_vlb_device = s3_init, s3_close, NULL, - s3_9fx_available, + { s3_9fx_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -5077,7 +5080,7 @@ const device_t s3_9fx_pci_device = s3_init, s3_close, NULL, - s3_9fx_available, + { s3_9fx_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -5091,7 +5094,7 @@ const device_t s3_phoenix_trio32_vlb_device = s3_init, s3_close, NULL, - s3_phoenix_trio32_available, + { s3_phoenix_trio32_available }, s3_speed_changed, s3_force_redraw, s3_phoenix_trio32_config @@ -5105,7 +5108,7 @@ const device_t s3_phoenix_trio32_pci_device = s3_init, s3_close, NULL, - s3_phoenix_trio32_available, + { s3_phoenix_trio32_available }, s3_speed_changed, s3_force_redraw, s3_phoenix_trio32_config @@ -5119,7 +5122,7 @@ const device_t s3_diamond_stealth_se_vlb_device = s3_init, s3_close, NULL, - s3_diamond_stealth_se_available, + { s3_diamond_stealth_se_available }, s3_speed_changed, s3_force_redraw, s3_phoenix_trio32_config @@ -5133,7 +5136,7 @@ const device_t s3_diamond_stealth_se_pci_device = s3_init, s3_close, NULL, - s3_diamond_stealth_se_available, + { s3_diamond_stealth_se_available }, s3_speed_changed, s3_force_redraw, s3_phoenix_trio32_config @@ -5148,7 +5151,7 @@ const device_t s3_phoenix_trio64_vlb_device = s3_init, s3_close, NULL, - s3_phoenix_trio64_available, + { s3_phoenix_trio64_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5162,7 +5165,7 @@ const device_t s3_phoenix_trio64_onboard_pci_device = s3_init, s3_close, NULL, - NULL, + { NULL }, s3_speed_changed, s3_force_redraw, s3_phoenix_trio64_onboard_config @@ -5176,7 +5179,7 @@ const device_t s3_phoenix_trio64_pci_device = s3_init, s3_close, NULL, - s3_phoenix_trio64_available, + { s3_phoenix_trio64_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5190,7 +5193,7 @@ const device_t s3_phoenix_trio64vplus_vlb_device = s3_init, s3_close, NULL, - s3_phoenix_trio64vplus_available, + { s3_phoenix_trio64vplus_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5204,7 +5207,7 @@ const device_t s3_phoenix_trio64vplus_onboard_pci_device = s3_init, s3_close, NULL, - NULL, + { NULL }, s3_speed_changed, s3_force_redraw, s3_phoenix_trio64_onboard_config @@ -5218,7 +5221,7 @@ const device_t s3_phoenix_trio64vplus_pci_device = s3_init, s3_close, NULL, - s3_phoenix_trio64vplus_available, + { s3_phoenix_trio64vplus_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5232,7 +5235,7 @@ const device_t s3_phoenix_vision864_vlb_device = s3_init, s3_close, NULL, - s3_phoenix_vision864_available, + { s3_phoenix_vision864_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5246,7 +5249,7 @@ const device_t s3_phoenix_vision864_pci_device = s3_init, s3_close, NULL, - s3_phoenix_vision864_available, + { s3_phoenix_vision864_available }, s3_speed_changed, s3_force_redraw, s3_config @@ -5260,7 +5263,7 @@ const device_t s3_diamond_stealth64_vlb_device = s3_init, s3_close, NULL, - s3_diamond_stealth64_764_available, + { s3_diamond_stealth64_764_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -5274,7 +5277,7 @@ const device_t s3_diamond_stealth64_pci_device = s3_init, s3_close, NULL, - s3_diamond_stealth64_764_available, + { s3_diamond_stealth64_764_available }, s3_speed_changed, s3_force_redraw, s3_9fx_config @@ -5288,7 +5291,7 @@ const device_t s3_trio64v2_dx_pci_device = s3_init, s3_close, NULL, - s3_trio64v2_dx_available, + { s3_trio64v2_dx_available }, s3_speed_changed, s3_force_redraw, s3_config diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index fdb850488..bc3fc038a 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -3889,7 +3889,7 @@ static void s3_virge_force_redraw(void *p) static const device_config_t s3_virge_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 4, + "memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 }, { { "2 MB", 2 @@ -3917,7 +3917,7 @@ static const device_config_t s3_virge_config[] = static const device_config_t s3_trio3d_2x_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 4, + "memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 }, { { "4 MB", 4 @@ -3950,7 +3950,7 @@ const device_t s3_virge_325_vlb_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_325_available, + { s3_virge_325_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -3964,7 +3964,7 @@ const device_t s3_virge_325_pci_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_325_available, + { s3_virge_325_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -3978,7 +3978,7 @@ const device_t s3_virge_vlb_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_available, + { s3_virge_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -3992,7 +3992,7 @@ const device_t s3_virge_pci_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_available, + { s3_virge_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4006,7 +4006,7 @@ const device_t s3_virge_988_vlb_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_988_available, + { s3_virge_988_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4020,7 +4020,7 @@ const device_t s3_virge_988_pci_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_988_available, + { s3_virge_988_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4034,7 +4034,7 @@ const device_t s3_virge_375_vlb_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_375_1_available, + { s3_virge_375_1_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4048,7 +4048,7 @@ const device_t s3_virge_375_pci_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_375_1_available, + { s3_virge_375_1_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4062,7 +4062,7 @@ const device_t s3_virge_375_4_vlb_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_375_4_available, + { s3_virge_375_4_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4076,7 +4076,7 @@ const device_t s3_virge_375_4_pci_device = s3_virge_init, s3_virge_close, NULL, - s3_virge_375_4_available, + { s3_virge_375_4_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_virge_config @@ -4091,7 +4091,7 @@ const device_t s3_trio3d_2x_pci_device = s3_virge_init, s3_virge_close, NULL, - s3_trio3d_2x_available, + { s3_trio3d_2x_available }, s3_virge_speed_changed, s3_virge_force_redraw, s3_trio3d_2x_config diff --git a/src/video/vid_sc1148x_ramdac.c b/src/video/vid_sc1148x_ramdac.c index b786629ab..dd35451f8 100644 --- a/src/video/vid_sc1148x_ramdac.c +++ b/src/video/vid_sc1148x_ramdac.c @@ -131,7 +131,7 @@ const device_t sc11483_ramdac_device = "Sierra SC11483 RAMDAC", 0, 0, sc1148x_ramdac_init, sc1148x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; const device_t sc11487_ramdac_device = @@ -139,5 +139,5 @@ const device_t sc11487_ramdac_device = "Sierra SC11487 RAMDAC", 0, 1, sc1148x_ramdac_init, sc1148x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_sc1502x_ramdac.c b/src/video/vid_sc1502x_ramdac.c index ea4725c9c..6dd4ad267 100644 --- a/src/video/vid_sc1502x_ramdac.c +++ b/src/video/vid_sc1502x_ramdac.c @@ -159,5 +159,5 @@ const device_t sc1502x_ramdac_device = "Sierra SC1502x RAMDAC", 0, 0, sc1502x_ramdac_init, sc1502x_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_sdac_ramdac.c b/src/video/vid_sdac_ramdac.c index 37bfa7104..5eb2d98dd 100644 --- a/src/video/vid_sdac_ramdac.c +++ b/src/video/vid_sdac_ramdac.c @@ -244,7 +244,7 @@ const device_t gendac_ramdac_device = "S3 GENDAC 86c708 RAMDAC", 0, 0, sdac_ramdac_init, sdac_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; @@ -253,5 +253,5 @@ const device_t sdac_ramdac_device = "S3 SDAC 86c716 RAMDAC", 0, 7, sdac_ramdac_init, sdac_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_sigma.c b/src/video/vid_sigma.c index 6bd475c4b..e8862a68b 100644 --- a/src/video/vid_sigma.c +++ b/src/video/vid_sigma.c @@ -886,7 +886,7 @@ sigma_speed_changed(void *p) device_config_t sigma_config[] = { { - "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, + "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, "", { 0 }, { { "Color", 0 @@ -912,7 +912,7 @@ device_config_t sigma_config[] = "enable_nmi", "Enable NMI for CGA emulation", CONFIG_BINARY, "", 1 }, { - "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xc0000, + "bios_addr", "BIOS Address", CONFIG_HEX20, "", 0xc0000, "", { 0 }, { { "C000H", 0xc0000 @@ -964,7 +964,7 @@ const device_t sigma_device = sigma_init, sigma_close, NULL, - sigma_available, + { sigma_available }, sigma_speed_changed, NULL, sigma_config diff --git a/src/video/vid_stg_ramdac.c b/src/video/vid_stg_ramdac.c index b61ee886c..828fc29b6 100644 --- a/src/video/vid_stg_ramdac.c +++ b/src/video/vid_stg_ramdac.c @@ -252,5 +252,5 @@ const device_t stg_ramdac_device = "SGS-Thompson STG170x RAMDAC", 0, 0, stg_ramdac_init, stg_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_table.c b/src/video/vid_table.c index fe66edc1e..8fa0e870f 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -39,7 +39,6 @@ typedef struct { - const char *name; const char *internal_name; const device_t *device; } VIDEO_CARD; @@ -52,133 +51,133 @@ static int was_reset = 0; static const VIDEO_CARD video_cards[] = { - { "None", "none", NULL }, - { "Internal", "internal", NULL }, - { "[ISA] AMI S3 86c924", "ami_s3_924", &s3_ami_86c924_isa_device }, - { "[ISA] ATI EGA Wonder 800+", "egawonder800", &atiega_device }, - { "[ISA] ATI Graphics Pro Turbo (Mach64 GX)", "mach64gx_isa", &mach64gx_isa_device }, - { "[ISA] ATI Korean VGA (ATI-28800-5)", "ati28800k", &ati28800k_device }, - { "[ISA] ATI VGA-88 (ATI-18800-1)", "ati18800v", &ati18800_vga88_device }, - { "[ISA] ATI VGA Charger (ATI-28800-5)", "ati28800", &ati28800_device }, - { "[ISA] ATI VGA Edge-16 (ATI-18800-5)", "ati18800", &ati18800_device }, + { "none", NULL }, + { "internal", NULL }, + { "ami_s3_924", &s3_ami_86c924_isa_device }, + { "egawonder800", &atiega_device }, + { "mach64gx_isa", &mach64gx_isa_device }, + { "ati28800k", &ati28800k_device }, + { "ati18800v", &ati18800_vga88_device }, + { "ati28800", &ati28800_device }, + { "ati18800", &ati18800_device }, #if defined(DEV_BRANCH) && defined(USE_VGAWONDER) - { "[ISA] ATI VGA Wonder (ATI-18800)", "ati18800w", &ati18800_wonder_device }, + { "ati18800w", &ati18800_wonder_device }, #endif #if defined(DEV_BRANCH) && defined(USE_XL24) - { "[ISA] ATI VGA Wonder XL24 (ATI-28800-6)", "ati28800w", &ati28800_wonderxl24_device }, + { "ati28800w", &ati28800_wonderxl24_device }, #endif - { "[ISA] CGA", "cga", &cga_device }, - { "[ISA] Chips & Technologies SuperEGA", "superega", &sega_device }, - { "[ISA] Cirrus Logic CL-GD 5401", "cl_gd5401_isa", &gd5401_isa_device }, - { "[ISA] Cirrus Logic CL-GD 5402", "cl_gd5402_isa", &gd5402_isa_device }, - { "[ISA] Cirrus Logic CL-GD 5420", "cl_gd5420_isa", &gd5420_isa_device }, + { "cga", &cga_device }, + { "superega", &sega_device }, + { "cl_gd5401_isa", &gd5401_isa_device }, + { "cl_gd5402_isa", &gd5402_isa_device }, + { "cl_gd5420_isa", &gd5420_isa_device }, #if defined(DEV_BRANCH) && defined(USE_CL5422) - { "[ISA] Cirrus Logic CL-GD 5422", "cl_gd5422_isa", &gd5422_isa_device }, + { "cl_gd5422_isa", &gd5422_isa_device }, #endif - { "[ISA] Cirrus Logic CL-GD 5428", "cl_gd5428_isa", &gd5428_isa_device }, - { "[ISA] Cirrus Logic CL-GD 5429", "cl_gd5429_isa", &gd5429_isa_device }, - { "[ISA] Cirrus Logic CL-GD 5434", "cl_gd5434_isa", &gd5434_isa_device }, - { "[ISA] Compaq ATI VGA Wonder XL (ATI-28800-5)", "compaq_ati28800", &compaq_ati28800_device }, - { "[ISA] Compaq CGA", "compaq_cga", &compaq_cga_device }, - { "[ISA] Compaq CGA 2", "compaq_cga_2", &compaq_cga_2_device }, - { "[ISA] Compaq EGA", "compaq_ega", &cpqega_device }, - { "[ISA] Diamond Stealth VRAM (S3 86c911)", "stealthvram_isa", &s3_diamond_stealth_vram_isa_device }, - { "[ISA] EGA", "ega", &ega_device }, - { "[ISA] G2 GC205", "g2_gc205", &g2_gc205_device }, - { "[ISA] Hercules", "hercules", &hercules_device }, - { "[ISA] Hercules Plus", "hercules_plus", &herculesplus_device }, - { "[ISA] Hercules InColor", "incolor", &incolor_device }, - { "[ISA] Image Manager 1024", "im1024", &im1024_device }, - { "[ISA] Schetmash Iskra EGA (Cyrillic ROM)", "iskra_ega", &iskra_ega_device }, - { "[ISA] Kasan Hangulmadang-16 VGA (ET4000AX)", "kasan16vga", &et4000_kasan_isa_device }, - { "[ISA] MDA", "mda", &mda_device }, - { "[ISA] MDSI Genius", "genius", &genius_device }, - { "[ISA] Metheus Premier 928 (S3 86c928)", "metheus928_isa", &s3_metheus_86c928_isa_device }, - { "[ISA] OAK OTI-037C", "oti037c", &oti037c_device }, - { "[ISA] OAK OTI-067", "oti067", &oti067_device }, - { "[ISA] OAK OTI-077", "oti077", &oti077_device }, - { "[ISA] Orchid Fahrenheit 1280 (S3 86c911)", "orchid_s3_911", &s3_orchid_86c911_isa_device }, - { "[ISA] Paradise PVGA1A", "pvga1a", ¶dise_pvga1a_device }, - { "[ISA] Paradise WD90C11-LR", "wd90c11", ¶dise_wd90c11_device }, - { "[ISA] Paradise WD90C30-LR", "wd90c30", ¶dise_wd90c30_device }, - { "[ISA] Plantronics ColorPlus", "plantronics", &colorplus_device }, - { "[ISA] Professional Graphics Controller", "pgc", &pgc_device }, - { "[ISA] Sigma Color 400", "sigma400", &sigma_device }, - { "[ISA] SPEA V7 Mirage (S3 86c801)", "px_s3_v7_801_isa", &s3_v7mirage_86c801_isa_device }, - { "[ISA] Trident TVGA8900B", "tvga8900b", &tvga8900b_device }, - { "[ISA] Trident TVGA8900D", "tvga8900d", &tvga8900d_device }, - { "[ISA] Trident TVGA9000B", "tvga9000b", &tvga9000b_device }, - { "[ISA] Trigem Korean VGA (ET4000AX)", "tgkorvga", &et4000k_isa_device }, - { "[ISA] Tseng ET4000AX", "et4000ax", &et4000_isa_device }, - { "[ISA] VGA", "vga", &vga_device }, - { "[ISA] Video 7 VGA 1024i", "v7_vga_1024i", &v7_vga_1024i_device }, - { "[ISA] Wyse 700", "wy700", &wy700_device }, - { "[MCA] IBM 1MB SVGA Adapter/A (CL-GD 5428)", "ibm1mbsvga", &gd5428_mca_device }, - { "[MCA] Tseng ET4000AX", "et4000mca", &et4000_mca_device }, - { "[PCI] ATI Graphics Pro Turbo (Mach64 GX)", "mach64gx_pci", &mach64gx_pci_device }, - { "[PCI] ATI Video Xpression (Mach64 VT2)", "mach64vt2", &mach64vt2_device }, - { "[PCI] Cardex Tseng ET4000/w32p", "et4000w32p_pci", &et4000w32p_cardex_pci_device }, - { "[PCI] Cirrus Logic CL-GD 5430", "cl_gd5430_pci", &gd5430_pci_device, }, - { "[PCI] Cirrus Logic CL-GD 5434", "cl_gd5434_pci", &gd5434_pci_device }, - { "[PCI] Cirrus Logic CL-GD 5436", "cl_gd5436_pci", &gd5436_pci_device }, - { "[PCI] Cirrus Logic CL-GD 5440", "cl_gd5440_pci", &gd5440_pci_device }, - { "[PCI] Cirrus Logic CL-GD 5446", "cl_gd5446_pci", &gd5446_pci_device }, - { "[PCI] Cirrus Logic CL-GD 5480", "cl_gd5480_pci", &gd5480_pci_device }, - { "[PCI] Diamond Stealth 32 (Tseng ET4000/w32p)", "stealth32_pci", &et4000w32p_pci_device }, - { "[PCI] Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000_pci", &s3_virge_pci_device }, - { "[PCI] Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000_pci", &s3_virge_988_pci_device }, - { "[PCI] Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d_pci", &s3_diamond_stealth64_pci_device }, - { "[PCI] Diamond Stealth 64 VRAM (S3 Vision964)", "stealth64v_pci", &s3_diamond_stealth64_964_pci_device }, - { "[PCI] Diamond Stealth SE (S3 Trio32)", "stealthse_pci", &s3_diamond_stealth_se_pci_device }, + { "cl_gd5428_isa", &gd5428_isa_device }, + { "cl_gd5429_isa", &gd5429_isa_device }, + { "cl_gd5434_isa", &gd5434_isa_device }, + { "compaq_ati28800", &compaq_ati28800_device }, + { "compaq_cga", &compaq_cga_device }, + { "compaq_cga_2", &compaq_cga_2_device }, + { "compaq_ega", &cpqega_device }, + { "stealthvram_isa", &s3_diamond_stealth_vram_isa_device }, + { "ega", &ega_device }, + { "g2_gc205", &g2_gc205_device }, + { "hercules", &hercules_device }, + { "hercules_plus", &herculesplus_device }, + { "incolor", &incolor_device }, + { "im1024", &im1024_device }, + { "iskra_ega", &iskra_ega_device }, + { "kasan16vga", &et4000_kasan_isa_device }, + { "mda", &mda_device }, + { "genius", &genius_device }, + { "metheus928_isa", &s3_metheus_86c928_isa_device }, + { "oti037c", &oti037c_device }, + { "oti067", &oti067_device }, + { "oti077", &oti077_device }, + { "orchid_s3_911", &s3_orchid_86c911_isa_device }, + { "pvga1a", ¶dise_pvga1a_device }, + { "wd90c11", ¶dise_wd90c11_device }, + { "wd90c30", ¶dise_wd90c30_device }, + { "plantronics", &colorplus_device }, + { "pgc", &pgc_device }, + { "sigma400", &sigma_device }, + { "px_s3_v7_801_isa", &s3_v7mirage_86c801_isa_device }, + { "tvga8900b", &tvga8900b_device }, + { "tvga8900d", &tvga8900d_device }, + { "tvga9000b", &tvga9000b_device }, + { "tgkorvga", &et4000k_isa_device }, + { "et4000ax", &et4000_isa_device }, + { "vga", &vga_device }, + { "v7_vga_1024i", &v7_vga_1024i_device }, + { "wy700", &wy700_device }, + { "ibm1mbsvga", &gd5428_mca_device }, + { "et4000mca", &et4000_mca_device }, + { "mach64gx_pci", &mach64gx_pci_device }, + { "mach64vt2", &mach64vt2_device }, + { "et4000w32p_pci", &et4000w32p_cardex_pci_device }, + { "cl_gd5430_pci", &gd5430_pci_device, }, + { "cl_gd5434_pci", &gd5434_pci_device }, + { "cl_gd5436_pci", &gd5436_pci_device }, + { "cl_gd5440_pci", &gd5440_pci_device }, + { "cl_gd5446_pci", &gd5446_pci_device }, + { "cl_gd5480_pci", &gd5480_pci_device }, + { "stealth32_pci", &et4000w32p_pci_device }, + { "stealth3d_2000_pci", &s3_virge_pci_device }, + { "stealth3d_3000_pci", &s3_virge_988_pci_device }, + { "stealth64d_pci", &s3_diamond_stealth64_pci_device }, + { "stealth64v_pci", &s3_diamond_stealth64_964_pci_device }, + { "stealthse_pci", &s3_diamond_stealth_se_pci_device }, #if defined(DEV_BRANCH) && defined(USE_MGA) - { "[PCI] Matrox Mystique", "mystique", &mystique_device }, - { "[PCI] Matrox Mystique 220", "mystique_220", &mystique_220_device }, + { "mystique", &mystique_device }, + { "mystique_220", &mystique_220_device }, #endif - { "[PCI] Number Nine 9FX (S3 Trio64)", "n9_9fx_pci", &s3_9fx_pci_device }, - { "[PCI] Paradise Bahamas 64 (S3 Vision864)", "bahamas64_pci", &s3_bahamas64_pci_device }, - { "[PCI] Phoenix S3 Vision864", "px_vision864_pci", &s3_phoenix_vision864_pci_device }, - { "[PCI] Phoenix S3 Trio32", "px_trio32_pci", &s3_phoenix_trio32_pci_device }, - { "[PCI] Phoenix S3 Trio64", "px_trio64_pci", &s3_phoenix_trio64_pci_device }, - { "[PCI] Phoenix S3 Trio64V+", "px_trio64vplus_pci", &s3_phoenix_trio64vplus_pci_device }, + { "n9_9fx_pci", &s3_9fx_pci_device }, + { "bahamas64_pci", &s3_bahamas64_pci_device }, + { "px_vision864_pci", &s3_phoenix_vision864_pci_device }, + { "px_trio32_pci", &s3_phoenix_trio32_pci_device }, + { "px_trio64_pci", &s3_phoenix_trio64_pci_device }, + { "px_trio64vplus_pci", &s3_phoenix_trio64vplus_pci_device }, #if defined(DEV_BRANCH) && defined(USE_S3TRIO3D2X) - { "[PCI] S3 Trio3D/2X", "trio3d2x", &s3_trio3d_2x_pci_device }, + { "trio3d2x", &s3_trio3d_2x_pci_device }, #endif - { "[PCI] S3 Trio64V2/DX", "trio64v2dx_pci", &s3_trio64v2_dx_pci_device }, - { "[PCI] S3 ViRGE (325)", "virge325_pci", &s3_virge_325_pci_device }, - { "[PCI] S3 ViRGE/DX", "virge375_pci", &s3_virge_375_pci_device }, - { "[PCI] S3 ViRGE/DX (VBE 2.0)", "virge375_vbe20_pci", &s3_virge_375_4_pci_device }, - { "[PCI] STB Nitro 64V (CL-GD 5446)", "cl_gd5446_stb_pci", &gd5446_stb_pci_device }, - { "[PCI] Trident TGUI9440", "tgui9440_pci", &tgui9440_pci_device }, - { "[VLB] ATI Graphics Pro Turbo (Mach64 GX)", "mach64gx_vlb", &mach64gx_vlb_device }, - { "[VLB] Cardex Tseng ET4000/w32p", "et4000w32p_vlb", &et4000w32p_cardex_vlb_device }, + { "trio64v2dx_pci", &s3_trio64v2_dx_pci_device }, + { "virge325_pci", &s3_virge_325_pci_device }, + { "virge375_pci", &s3_virge_375_pci_device }, + { "virge375_vbe20_pci", &s3_virge_375_4_pci_device }, + { "cl_gd5446_stb_pci", &gd5446_stb_pci_device }, + { "tgui9440_pci", &tgui9440_pci_device }, + { "mach64gx_vlb", &mach64gx_vlb_device }, + { "et4000w32p_vlb", &et4000w32p_cardex_vlb_device }, #if defined(DEV_BRANCH) && defined(USE_CL5422) - { "[VLB] Cirrus Logic CL-GD 5424", "cl_gd5424_vlb", &gd5424_vlb_device }, + { "cl_gd5424_vlb", &gd5424_vlb_device }, #endif - { "[VLB] Cirrus Logic CL-GD 5428", "cl_gd5428_vlb", &gd5428_vlb_device }, - { "[VLB] Cirrus Logic CL-GD 5429", "cl_gd5429_vlb", &gd5429_vlb_device }, - { "[VLB] Cirrus Logic CL-GD 5434", "cl_gd5434_vlb", &gd5434_vlb_device }, - { "[VLB] Diamond Stealth 32 (Tseng ET4000/w32p)", "stealth32_vlb", &et4000w32p_vlb_device }, - { "[VLB] Diamond SpeedStar PRO (CL-GD 5426)", "cl_gd5426_vlb", &gd5426_vlb_device }, - { "[VLB] Diamond SpeedStar PRO SE (CL-GD 5430)", "cl_gd5430_vlb", &gd5430_vlb_device }, - { "[VLB] Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000_vlb", &s3_virge_vlb_device }, - { "[VLB] Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000_vlb", &s3_virge_988_vlb_device }, - { "[VLB] Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d_vlb", &s3_diamond_stealth64_vlb_device }, - { "[VLB] Diamond Stealth 64 VRAM (S3 Vision964)", "stealth64v_vlb", &s3_diamond_stealth64_964_vlb_device }, - { "[VLB] Diamond Stealth SE (S3 Trio32)", "stealthse_vlb", &s3_diamond_stealth_se_vlb_device }, - { "[VLB] Metheus Premier 928 (S3 86c928)", "metheus928_vlb", &s3_metheus_86c928_vlb_device }, - { "[VLB] Number Nine 9FX (S3 Trio64)", "n9_9fx_vlb", &s3_9fx_vlb_device }, - { "[VLB] Paradise Bahamas 64 (S3 Vision864)", "bahamas64_vlb", &s3_bahamas64_vlb_device }, - { "[VLB] Phoenix S3 86c805", "px_86c805_vlb", &s3_phoenix_86c805_vlb_device }, - { "[VLB] Phoenix S3 Vision864", "px_vision864_vlb", &s3_phoenix_vision864_vlb_device }, - { "[VLB] Phoenix S3 Trio32", "px_trio32_vlb", &s3_phoenix_trio32_vlb_device }, - { "[VLB] Phoenix S3 Trio64", "px_trio64_vlb", &s3_phoenix_trio64_vlb_device }, - { "[VLB] Phoenix S3 Trio64V+", "px_trio64vplus_vlb", &s3_phoenix_trio64vplus_vlb_device }, - { "[VLB] S3 ViRGE (325)", "virge325_vlb", &s3_virge_325_vlb_device }, - { "[VLB] S3 ViRGE/DX", "virge375_vlb", &s3_virge_375_vlb_device }, - { "[VLB] S3 ViRGE/DX (VBE 2.0)", "virge375_vbe20_vlb", &s3_virge_375_4_vlb_device }, - { "[VLB] Trident TGUI9400CXi", "tgui9400cxi_vlb", &tgui9400cxi_device }, - { "[VLB] Trident TGUI9440", "tgui9440_vlb", &tgui9440_vlb_device }, - { "", "", NULL } + { "cl_gd5428_vlb", &gd5428_vlb_device }, + { "cl_gd5429_vlb", &gd5429_vlb_device }, + { "cl_gd5434_vlb", &gd5434_vlb_device }, + { "stealth32_vlb", &et4000w32p_vlb_device }, + { "cl_gd5426_vlb", &gd5426_vlb_device }, + { "cl_gd5430_vlb", &gd5430_vlb_device }, + { "stealth3d_2000_vlb", &s3_virge_vlb_device }, + { "stealth3d_3000_vlb", &s3_virge_988_vlb_device }, + { "stealth64d_vlb", &s3_diamond_stealth64_vlb_device }, + { "stealth64v_vlb", &s3_diamond_stealth64_964_vlb_device }, + { "stealthse_vlb", &s3_diamond_stealth_se_vlb_device }, + { "metheus928_vlb", &s3_metheus_86c928_vlb_device }, + { "n9_9fx_vlb", &s3_9fx_vlb_device }, + { "bahamas64_vlb", &s3_bahamas64_vlb_device }, + { "px_86c805_vlb", &s3_phoenix_86c805_vlb_device }, + { "px_vision864_vlb", &s3_phoenix_vision864_vlb_device }, + { "px_trio32_vlb", &s3_phoenix_trio32_vlb_device }, + { "px_trio64_vlb", &s3_phoenix_trio64_vlb_device }, + { "px_trio64vplus_vlb", &s3_phoenix_trio64vplus_vlb_device }, + { "virge325_vlb", &s3_virge_325_vlb_device }, + { "virge375_vlb", &s3_virge_375_vlb_device }, + { "virge375_vbe20_vlb", &s3_virge_375_4_vlb_device }, + { "tgui9400cxi_vlb", &tgui9400cxi_device }, + { "tgui9440_vlb", &tgui9440_vlb_device }, + { "", NULL } }; @@ -266,13 +265,6 @@ video_card_available(int card) } -char * -video_card_getname(int card) -{ - return((char *) video_cards[card].name); -} - - const device_t * video_card_getdevice(int card) { @@ -289,21 +281,6 @@ video_card_has_config(int card) } -int -video_card_getid(char *s) -{ - int c = 0; - - while (video_cards[c].name != NULL) { - if (!strcmp((char *) video_cards[c].name, s)) - return(c); - c++; - } - - return(0); -} - - char * video_get_internal_name(int card) { @@ -316,7 +293,7 @@ video_get_video_from_internal_name(char *s) { int c = 0; - while (video_cards[c].name != NULL) { + while (strcmp(video_cards[c].internal_name, "") != 0) { if (!strcmp((char *) video_cards[c].internal_name, s)) return(c); c++; diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index 813020772..d5f28fefc 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -1795,7 +1795,7 @@ const device_t tgui9400cxi_device = tgui_init, tgui_close, NULL, - tgui9400cxi_available, + { tgui9400cxi_available }, tgui_speed_changed, tgui_force_redraw, tgui9440_config @@ -1809,7 +1809,7 @@ const device_t tgui9440_vlb_device = tgui_init, tgui_close, NULL, - tgui9440_available, + { tgui9440_available }, tgui_speed_changed, tgui_force_redraw, tgui9440_config @@ -1823,7 +1823,7 @@ const device_t tgui9440_pci_device = tgui_init, tgui_close, NULL, - tgui9440_available, + { tgui9440_available }, tgui_speed_changed, tgui_force_redraw, tgui9440_config diff --git a/src/video/vid_ti_cf62011.c b/src/video/vid_ti_cf62011.c index 964b0ed9b..85fc22305 100644 --- a/src/video/vid_ti_cf62011.c +++ b/src/video/vid_ti_cf62011.c @@ -268,7 +268,7 @@ const device_t ibm_ps1_2121_device = { DEVICE_ISA, 512, vid_init, vid_close, NULL, - NULL, + { NULL }, vid_speed_changed, vid_force_redraw, NULL diff --git a/src/video/vid_tkd8001_ramdac.c b/src/video/vid_tkd8001_ramdac.c index c02403512..6dc4cd1a9 100644 --- a/src/video/vid_tkd8001_ramdac.c +++ b/src/video/vid_tkd8001_ramdac.c @@ -123,5 +123,5 @@ const device_t tkd8001_ramdac_device = "Trident TKD8001 RAMDAC", 0, 0, tkd8001_ramdac_init, tkd8001_ramdac_close, - NULL, NULL, NULL, NULL + NULL, { NULL }, NULL, NULL }; diff --git a/src/video/vid_tvga.c b/src/video/vid_tvga.c index 2bcab6696..750144159 100644 --- a/src/video/vid_tvga.c +++ b/src/video/vid_tvga.c @@ -431,7 +431,7 @@ void tvga_force_redraw(void *p) static const device_config_t tvga_config[] = { { - "memory", "Memory size", CONFIG_SELECTION, "", 1024, + "memory", "Memory size", CONFIG_SELECTION, "", 1024, "", { 0 }, { { "256 kB", 256 @@ -461,7 +461,7 @@ const device_t tvga8900b_device = tvga_init, tvga_close, NULL, - tvga8900b_available, + { tvga8900b_available }, tvga_speed_changed, tvga_force_redraw, tvga_config @@ -475,7 +475,7 @@ const device_t tvga8900d_device = tvga_init, tvga_close, NULL, - tvga8900d_available, + { tvga8900d_available }, tvga_speed_changed, tvga_force_redraw, tvga_config @@ -489,7 +489,7 @@ const device_t tvga9000b_device = tvga_init, tvga_close, NULL, - tvga9000b_available, + { tvga9000b_available }, tvga_speed_changed, tvga_force_redraw, NULL diff --git a/src/video/vid_vga.c b/src/video/vid_vga.c index 4411be1b6..f4e38e7fd 100644 --- a/src/video/vid_vga.c +++ b/src/video/vid_vga.c @@ -191,7 +191,7 @@ const device_t vga_device = vga_init, vga_close, NULL, - vga_available, + { vga_available }, vga_speed_changed, vga_force_redraw, NULL @@ -205,7 +205,7 @@ const device_t ps1vga_device = ps1vga_init, vga_close, NULL, - vga_available, + { vga_available }, vga_speed_changed, vga_force_redraw, NULL @@ -219,7 +219,7 @@ const device_t ps1vga_mca_device = ps1vga_init, vga_close, NULL, - vga_available, + { vga_available }, vga_speed_changed, vga_force_redraw, NULL diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index d84f7a8a4..2ba96fcf4 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -7912,7 +7912,7 @@ const device_t voodoo_device = voodoo_init, voodoo_close, NULL, - NULL, + { NULL }, voodoo_speed_changed, NULL, voodoo_config diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index b8543a6ab..44aacc277 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -1016,7 +1016,7 @@ const device_t wy700_device = wy700_init, wy700_close, NULL, - NULL, + { NULL }, wy700_speed_changed, NULL, NULL diff --git a/src/win/86Box.rc b/src/win/86Box.rc index b74f7bf9c..7216bc391 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -537,18 +537,18 @@ BEGIN COMBOBOX IDC_COMBO_ISAMEM_1,25,147,190,120, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_1,217,147,38,12 - LTEXT "#2:",IDT_1764,12,163,21,10 - COMBOBOX IDC_COMBO_ISAMEM_2,25,162,190,120, + LTEXT "#2:",IDT_1764,12,162,21,10 + COMBOBOX IDC_COMBO_ISAMEM_2,25,161,190,120, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_2,217,162,38,12 - LTEXT "#3:",IDT_1765,12,177,21,10 - COMBOBOX IDC_COMBO_ISAMEM_3,25,176,190,120, + PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_2,217,161,38,12 + LTEXT "#3:",IDT_1765,12,176,21,10 + COMBOBOX IDC_COMBO_ISAMEM_3,25,175,190,120, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_3,217,176,38,12 - LTEXT "#4:",IDT_1766,12,191,21,10 - COMBOBOX IDC_COMBO_ISAMEM_4,25,190,190,120, + PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_3,217,175,38,12 + LTEXT "#4:",IDT_1766,12,190,21,10 + COMBOBOX IDC_COMBO_ISAMEM_4,25,189,190,120, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,190,38,12 + PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,189,38,12 END DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 107, 0, 267, 154 diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 921666ed0..ffe6b66bf 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -72,18 +72,9 @@ ifeq ($(DEV_BUILD), y) ifndef PS2M70T4 PS2M70T4 := y endif - ifndef VECTRA54 - VECTRA54 := y - endif ifndef S3TRIO3D2X S3TRIO3D2X := y endif - ifndef SEP - SEP := n - endif - ifndef SIEMENS - SIEMENS := y - endif ifndef SIO_DETECT SIO_DETECT := y endif @@ -163,18 +154,9 @@ else ifndef PS2M70T4 PS2M70T4 := n endif - ifndef VECTRA54 - VECTRA54 := n - endif ifndef S3TRIO3D2X S3TRIO3D2X := n endif - ifndef SEP - SEP := n - endif - ifndef SIEMENS - SIEMENS := n - endif ifndef SIO_DETECT SIO_DETECT := n endif @@ -566,22 +548,10 @@ ifeq ($(PS2M70T4), y) OPTS += -DUSE_PS2M70T4 endif -ifeq ($(VECTRA54), y) -OPTS += -DUSE_VECTRA54 -endif - ifeq ($(S3TRIO3D2X), y) OPTS += -DUSE_S3TRIO3D2X endif -ifeq ($(SEP), y) -OPTS += -DUSE_SEP -endif - -ifeq ($(SIEMENS), y) -OPTS += -DUSE_SIEMENS -endif - ifeq ($(SIO_DETECT), y) OPTS += -DUSE_SIO_DETECT DEVBROBJ += sio_detect.o diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index d07482f46..280dce484 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -401,31 +401,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) SendMessage(h, WM_GETTEXT, 511, (LPARAM)s); file_filter[0] = 0; - c = 0; - while (config->file_filter[c].description && config->file_filter[c].description[0]) { - if (c > 0) - strcat(file_filter, "|"); - strcat(file_filter, config->file_filter[c].description); - strcat(file_filter, " ("); - d = 0; - while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0]) { - if (d > 0) - strcat(file_filter, ";"); - strcat(file_filter, "*."); - strcat(file_filter, config->file_filter[c].extensions[d]); - d++; - } - strcat(file_filter, ")|"); - d = 0; - while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0]) { - if (d > 0) - strcat(file_filter, ";"); - strcat(file_filter, "*."); - strcat(file_filter, config->file_filter[c].extensions[d]); - d++; - } - c++; - } + strcat(file_filter, config->file_filter); strcat(file_filter, "|All files (*.*)|*.*|"); mbstowcs(ws, file_filter, strlen(file_filter) + 1); d = strlen(file_filter); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index d19fb82cf..491ae7970 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -125,12 +125,10 @@ static HWND hwndParentDialog, hwndChildDialog; static uint32_t displayed_category = 0; extern int is486; -static int listtomachinetype[256], machinetypetolist[256]; -static int listtomachine[256], machinetolist[256]; -static int settings_device_to_list[2][20], settings_list_to_device[2][20]; -static int settings_fdc_to_list[2][20], settings_list_to_fdc[2][20]; -static int settings_midi_to_list[20], settings_list_to_midi[20]; -static int settings_midi_in_to_list[20], settings_list_to_midi_in[20]; +static int listtomachinetype[256], listtomachine[256]; +static int settings_list_to_device[2][20], settings_list_to_fdc[20]; +static int settings_list_to_midi[20], settings_list_to_midi_in[20]; +static int settings_list_to_hdc[20]; static int max_spt = 63, max_hpc = 255, max_tracks = 266305; static uint64_t mfm_tracking, esdi_tracking, xta_tracking, ide_tracking, scsi_tracking[2]; @@ -144,18 +142,90 @@ static int spt, hpc, tracks, ignore_change = 0; static hard_disk_t new_hdd, *hdd_ptr; static wchar_t hd_file_name[512]; +static WCHAR device_name[512]; + + +static int +settings_get_check(HWND hdlg, int id) +{ + return SendMessage(GetDlgItem(hdlg, id), BM_GETCHECK, 0, 0); +} + + +static int +settings_get_cur_sel(HWND hdlg, int id) +{ + return SendMessage(GetDlgItem(hdlg, id), CB_GETCURSEL, 0, 0); +} + + +static void +settings_set_check(HWND hdlg, int id, int val) +{ + SendMessage(GetDlgItem(hdlg, id), BM_SETCHECK, val, 0); +} + + +static void +settings_set_cur_sel(HWND hdlg, int id, int val) +{ + SendMessage(GetDlgItem(hdlg, id), CB_SETCURSEL, val, 0); +} + + +static void +settings_reset_content(HWND hdlg, int id) +{ + SendMessage(GetDlgItem(hdlg, id), CB_RESETCONTENT, 0, 0); +} + + +static void +settings_add_string(HWND hdlg, int id, LPARAM string) +{ + SendMessage(GetDlgItem(hdlg, id), CB_ADDSTRING, 0, string); +} + + +static void +settings_enable_window(HWND hdlg, int id, int condition) +{ + EnableWindow(GetDlgItem(hdlg, id), condition ? TRUE : FALSE); +} + + +static void +settings_show_window(HWND hdlg, int id, int condition) +{ + HWND h; + + h = GetDlgItem(hdlg, id); + EnableWindow(h, condition ? TRUE : FALSE); + ShowWindow(h, condition ? SW_SHOW : SW_HIDE); +} + + +static void +settings_listview_select(HWND hdlg, int id, int selection) +{ + HWND h; + + h = GetDlgItem(hdlg, id); + ListView_SetItemState(h, selection, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); +} static BOOL -image_list_init(HWND hwndList, const uint8_t *icon_ids) +image_list_init(HWND hdlg, int id, const uint8_t *icon_ids) { HICON hiconItem; HIMAGELIST hSmall; + HWND hwndList = GetDlgItem(hdlg, id); int i = 0; - hSmall = ListView_GetImageList(hwndList, LVSIL_SMALL); - if (hSmall != 0) ImageList_Destroy(hSmall); + hSmall = ListView_GetImageList(hwndList, LVSIL_SMALL); + if (hSmall != 0) ImageList_Destroy(hSmall); hSmall = ImageList_Create(win_get_system_metrics(SM_CXSMICON, dpi), win_get_system_metrics(SM_CYSMICON, dpi), @@ -247,7 +317,7 @@ win_settings_init(void) /* Sound category */ temp_sound_card = sound_card_current; temp_midi_device = midi_device_current; - temp_midi_input_device = midi_input_device_current; + temp_midi_input_device = midi_input_device_current; temp_mpu401 = mpu401_standalone_enable; temp_SSI2001 = SSI2001; temp_GAMEBLASTER = GAMEBLASTER; @@ -280,11 +350,11 @@ win_settings_init(void) temp_bugger = bugger_enabled; temp_postcard = postcard_enabled; temp_isartc = isartc_type; - + /* ISA memory boards. */ for (i = 0; i < ISAMEM_MAX; i++) - temp_isamem[i] = isamem_type[i]; - + temp_isamem[i] = isamem_type[i]; + mfm_tracking = xta_tracking = esdi_tracking = ide_tracking = 0; for (i = 0; i < 2; i++) scsi_tracking[i] = 0; @@ -298,12 +368,12 @@ win_settings_init(void) xta_tracking |= (1 << (hdd[i].xta_channel << 3)); else if (hdd[i].bus == HDD_BUS_ESDI) esdi_tracking |= (1 << (hdd[i].esdi_channel << 3)); - else if (hdd[i].bus == HDD_BUS_IDE) + else if ((hdd[i].bus == HDD_BUS_IDE) || (hdd[i].bus == HDD_BUS_ATAPI)) ide_tracking |= (1 << (hdd[i].ide_channel << 3)); else if (hdd[i].bus == HDD_BUS_SCSI) scsi_tracking[hdd[i].scsi_id >> 3] |= (1 << ((hdd[i].scsi_id & 0x07) << 3)); - } - + } + /* Floppy drives category */ for (i = 0; i < FDD_NUM; i++) { temp_fdd_types[i] = fdd_get_type(i); @@ -342,8 +412,7 @@ win_settings_init(void) static int win_settings_changed(void) { - int i = 0; - int j = 0; + int i = 0, j = 0; /* Machine category */ i = i || (machine != temp_machine); @@ -368,7 +437,7 @@ win_settings_changed(void) /* Sound category */ i = i || (sound_card_current != temp_sound_card); i = i || (midi_device_current != temp_midi_device); - i = i || (midi_input_device_current != temp_midi_input_device); + i = i || (midi_input_device_current != temp_midi_input_device); i = i || (mpu401_standalone_enable != temp_mpu401); i = i || (SSI2001 != temp_SSI2001); i = i || (GAMEBLASTER != temp_GAMEBLASTER); @@ -400,8 +469,8 @@ win_settings_changed(void) /* ISA memory boards. */ for (j = 0; j < ISAMEM_MAX; j++) - i = i || (temp_isamem[j] != isamem_type[j]); - + i = i || (temp_isamem[j] != isamem_type[j]); + /* Hard disks category */ i = i || memcmp(hdd, temp_hdd, HDD_NUM * sizeof(hard_disk_t)); @@ -480,7 +549,7 @@ win_settings_save(void) /* Sound category */ sound_card_current = temp_sound_card; midi_device_current = temp_midi_device; - midi_input_device_current = temp_midi_input_device; + midi_input_device_current = temp_midi_input_device; mpu401_standalone_enable = temp_mpu401; SSI2001 = temp_SSI2001; GAMEBLASTER = temp_GAMEBLASTER; @@ -513,8 +582,8 @@ win_settings_save(void) /* ISA memory boards. */ for (i = 0; i < ISAMEM_MAX; i++) - isamem_type[i] = temp_isamem[i]; - + isamem_type[i] = temp_isamem[i]; + /* Hard disks category */ memcpy(hdd, temp_hdd, HDD_NUM * sizeof(hard_disk_t)); for (i = 0; i < HDD_NUM; i++) @@ -560,15 +629,13 @@ win_settings_save(void) static void win_settings_machine_recalc_fpu(HWND hdlg) { - HWND h; int c, type; LPTSTR lptsTemp; const char *stransi; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_FPU); - SendMessage(h, CB_RESETCONTENT, 0, 0); + settings_reset_content(hdlg, IDC_COMBO_FPU); c = 0; while (1) { stransi = (char *) fpu_get_name_from_index(temp_machine, temp_cpu_m, temp_cpu, c); @@ -577,19 +644,16 @@ win_settings_machine_recalc_fpu(HWND hdlg) break; mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); + settings_add_string(hdlg, IDC_COMBO_FPU, (LPARAM)(LPCSTR)lptsTemp); if (!c || (type == temp_fpu)) - SendMessage(h, CB_SETCURSEL, c, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_FPU, c); c++; } - if (c > 1) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + settings_enable_window(hdlg, IDC_COMBO_FPU, c > 1); - temp_fpu = fpu_get_type_from_index(temp_machine, temp_cpu_m, temp_cpu, SendMessage(h, CB_GETCURSEL, 0, 0)); + temp_fpu = fpu_get_type_from_index(temp_machine, temp_cpu_m, temp_cpu, settings_get_cur_sel(hdlg, IDC_COMBO_FPU)); } @@ -602,15 +666,11 @@ win_settings_machine_recalc_cpu(HWND hdlg) int cpu_flags; #endif - h = GetDlgItem(hdlg, IDC_COMBO_WS); cpu_type = machines[temp_machine].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; - if ((cpu_type >= CPU_286) && (cpu_type <= CPU_386DX)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + settings_enable_window(hdlg, IDC_COMBO_WS, (cpu_type >= CPU_286) && (cpu_type <= CPU_386DX)); #ifdef USE_DYNAREC - h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC); + h = GetDlgItem(hdlg, IDC_CHECK_DYNAREC); cpu_flags = machines[temp_machine].cpu[temp_cpu_m].cpus[temp_cpu].cpu_flags; if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) && (cpu_flags & CPU_REQUIRES_DYNAREC)) fatal("Attempting to select a CPU that requires the recompiler and does not support it at the same time\n"); @@ -632,26 +692,24 @@ win_settings_machine_recalc_cpu(HWND hdlg) static void win_settings_machine_recalc_cpu_m(HWND hdlg) { - HWND h; int c; LPTSTR lptsTemp; char *stransi; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_CPU); - SendMessage(h, CB_RESETCONTENT, 0, 0); + settings_reset_content(hdlg, IDC_COMBO_CPU); c = 0; while (machines[temp_machine].cpu[temp_cpu_m].cpus[c].cpu_type != -1) { stransi = (char *) machines[temp_machine].cpu[temp_cpu_m].cpus[c].name; mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); + settings_add_string(hdlg, IDC_COMBO_CPU, (LPARAM)(LPCSTR)lptsTemp); c++; } - EnableWindow(h, (c == 1) ? FALSE : TRUE); + settings_enable_window(hdlg, IDC_COMBO_CPU, c != 1); if (temp_cpu >= c) temp_cpu = (c - 1); - SendMessage(h, CB_SETCURSEL, temp_cpu, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_CPU, temp_cpu); win_settings_machine_recalc_cpu(hdlg); @@ -671,27 +729,22 @@ win_settings_machine_recalc_machine(HWND hdlg) lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_CONFIGURE_MACHINE); d = (device_t *) machine_getdevice(temp_machine); - if (d && d->config) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + settings_enable_window(hdlg, IDC_CONFIGURE_MACHINE, d && d->config); - h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE); - SendMessage(h, CB_RESETCONTENT, 0, 0); + settings_reset_content(hdlg, IDC_COMBO_CPU_TYPE); c = 0; while (machines[temp_machine].cpu[c].cpus != NULL && c < 4) { stransi = machines[temp_machine].cpu[c].name; mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); + settings_add_string(hdlg, IDC_COMBO_CPU_TYPE, (LPARAM)(LPCSTR)lptsTemp); c++; } - EnableWindow(h, TRUE); + settings_enable_window(hdlg, IDC_COMBO_CPU_TYPE, TRUE); if (temp_cpu_m >= c) temp_cpu_m = (c - 1); - SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0); - EnableWindow(h, (c == 1) ? FALSE : TRUE); + settings_set_cur_sel(hdlg, IDC_COMBO_CPU_TYPE, temp_cpu_m); + settings_enable_window(hdlg, IDC_COMBO_CPU_TYPE, c != 1); win_settings_machine_recalc_cpu_m(hdlg); @@ -715,6 +768,26 @@ win_settings_machine_recalc_machine(HWND hdlg) } +static char * +machine_type_get_internal_name(int id) +{ + if (id < MACHINE_TYPE_MAX) + return ""; + else + return NULL; +} + + +int +machine_type_available(int id) +{ + if ((id > 0) && (id < MACHINE_TYPE_MAX)) + return 1; + else + return 0; +} + + #if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else @@ -723,7 +796,7 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h, h2; - int c, d, e, f; + int c, d; int old_machine_type, is_at; LPTSTR lptsTemp; char *stransi; @@ -732,83 +805,61 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_MACHINE_TYPE); - f = 0; - memset(machinetypetolist, 0x00, sizeof(machinetypetolist)); + c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_MACHINE_TYPE); memset(listtomachinetype, 0x00, sizeof(listtomachinetype)); - for (c = 1; c < MACHINE_TYPE_MAX; c++) { - d = e = 0; - while (machine_get_internal_name_ex(d) != NULL) { - if (machine_available(d) && (machines[d].type == c)) - e++; - d++; - } - - if (e > 0) { + while (machine_type_get_internal_name(c) != NULL) { + if (machine_type_available(c)) { stransi = (char *)machine_types[c].name; mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - machinetypetolist[c] = f; - listtomachinetype[f] = c; - f++; + settings_add_string(hdlg, IDC_COMBO_MACHINE_TYPE, (LPARAM) lptsTemp); + listtomachinetype[d] = c; + if (c == temp_machine_type) + settings_set_cur_sel(hdlg, IDC_COMBO_MACHINE_TYPE, d); + d++; } + c++; } - SendMessage(h, CB_SETCURSEL, machinetypetolist[temp_machine_type], 0); - h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); c = d = 0; - memset(machinetolist, 0x00, sizeof(machinetolist)); + settings_reset_content(hdlg, IDC_COMBO_MACHINE); memset(listtomachine, 0x00, sizeof(listtomachine)); while (machine_get_internal_name_ex(c) != NULL) { if (machine_available(c) && (machines[c].type == temp_machine_type)) { stransi = (char *)machines[c].name; mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - machinetolist[c] = d; + settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp); listtomachine[d] = c; + if (c == temp_machine) + settings_set_cur_sel(hdlg, IDC_COMBO_MACHINE, d); d++; } c++; } - SendMessage(h, CB_SETCURSEL, machinetolist[temp_machine], 0); - - h = GetDlgItem(hdlg, IDC_COMBO_WS); - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2090)); + settings_add_string(hdlg, IDC_COMBO_WS, win_get_string(IDS_2090)); for (c = 0; c < 8; c++) { wsprintf(lptsTemp, plat_get_string(IDS_2091), c); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_WS, (LPARAM) lptsTemp); } - SendMessage(h, CB_SETCURSEL, temp_wait_states, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_WS, temp_wait_states); #ifdef USE_DYNAREC - h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC); - SendMessage(h, BM_SETCHECK, temp_dynarec, 0); + settings_set_check(hdlg, IDC_CHECK_DYNAREC, 0); #endif h = GetDlgItem(hdlg, IDC_MEMSPIN); h2 = GetDlgItem(hdlg, IDC_MEMTEXT); SendMessage(h, UDM_SETBUDDY, (WPARAM)h2, 0); - if (temp_sync & TIME_SYNC_ENABLED) - { + if (temp_sync & TIME_SYNC_ENABLED) { if (temp_sync & TIME_SYNC_UTC) - { - h=GetDlgItem(hdlg, IDC_RADIO_TS_UTC); - SendMessage(h, BM_SETCHECK, BST_CHECKED, 0); - } + settings_set_check(hdlg, IDC_RADIO_TS_UTC, BST_CHECKED); else - { - h=GetDlgItem(hdlg, IDC_RADIO_TS_LOCAL); - SendMessage(h, BM_SETCHECK, BST_CHECKED, 0); - } - } - else - { - h=GetDlgItem(hdlg, IDC_RADIO_TS_DISABLED); - SendMessage(h, BM_SETCHECK, BST_CHECKED, 0); - } + settings_set_check(hdlg, IDC_RADIO_TS_LOCAL, BST_CHECKED); + } else + settings_set_check(hdlg, IDC_RADIO_TS_DISABLED, BST_CHECKED); win_settings_machine_recalc_machine(hdlg); @@ -817,76 +868,64 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_COMBO_MACHINE_TYPE: - if (HIWORD(wParam) == CBN_SELCHANGE) { - h = GetDlgItem(hdlg, IDC_COMBO_MACHINE_TYPE); + switch (LOWORD(wParam)) { + case IDC_COMBO_MACHINE_TYPE: + if (HIWORD(wParam) == CBN_SELCHANGE) { old_machine_type = temp_machine_type; - temp_machine_type = listtomachinetype[SendMessage(h,CB_GETCURSEL,0,0)]; + temp_machine_type = listtomachinetype[settings_get_cur_sel(hdlg, IDC_COMBO_MACHINE_TYPE)]; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); - SendMessage(h, CB_RESETCONTENT, 0, 0); + settings_reset_content(hdlg, IDC_COMBO_MACHINE); c = d = 0; - memset(machinetolist, 0x00, sizeof(machinetolist)); memset(listtomachine, 0x00, sizeof(listtomachine)); while (machine_get_internal_name_ex(c) != NULL) { if (machine_available(c) && (machines[c].type == temp_machine_type)) { stransi = (char *)machines[c].name; mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - machinetolist[c] = d; + settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp); listtomachine[d] = c; + if (c == temp_machine) + settings_set_cur_sel(hdlg, IDC_COMBO_MACHINE, d); d++; } c++; } - if (old_machine_type == temp_machine_type) - SendMessage(h, CB_SETCURSEL, machinetolist[temp_machine], 0); - else { - SendMessage(h, CB_SETCURSEL, 0, 0); + if (old_machine_type != temp_machine_type) { + settings_set_cur_sel(hdlg, IDC_COMBO_MACHINE, 0); temp_machine = listtomachine[0]; win_settings_machine_recalc_machine(hdlg); } } break; - case IDC_COMBO_MACHINE: - if (HIWORD(wParam) == CBN_SELCHANGE) { - h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); - temp_machine = listtomachine[SendMessage(h,CB_GETCURSEL,0,0)]; - + case IDC_COMBO_MACHINE: + if (HIWORD(wParam) == CBN_SELCHANGE) { + temp_machine = listtomachine[settings_get_cur_sel(hdlg, IDC_COMBO_MACHINE)]; win_settings_machine_recalc_machine(hdlg); } break; case IDC_COMBO_CPU_TYPE: - if (HIWORD(wParam) == CBN_SELCHANGE) { - h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE); - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); - + if (HIWORD(wParam) == CBN_SELCHANGE) { + temp_cpu_m = settings_get_cur_sel(hdlg, IDC_COMBO_CPU_TYPE); temp_cpu = 0; win_settings_machine_recalc_cpu_m(hdlg); } break; case IDC_COMBO_CPU: - if (HIWORD(wParam) == CBN_SELCHANGE) { - h = GetDlgItem(hdlg, IDC_COMBO_CPU); - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); - + if (HIWORD(wParam) == CBN_SELCHANGE) { + temp_cpu = settings_get_cur_sel(hdlg, IDC_COMBO_CPU); win_settings_machine_recalc_cpu(hdlg); } break; case IDC_COMBO_FPU: - if (HIWORD(wParam) == CBN_SELCHANGE) { - h = GetDlgItem(hdlg, IDC_COMBO_FPU); - temp_fpu = fpu_get_type_from_index(temp_machine, temp_cpu_m, temp_cpu, SendMessage(h, CB_GETCURSEL, 0, 0)); + if (HIWORD(wParam) == CBN_SELCHANGE) { + temp_fpu = fpu_get_type_from_index(temp_machine, temp_cpu_m, temp_cpu, + settings_get_cur_sel(hdlg, IDC_COMBO_FPU)); } break; case IDC_CONFIGURE_MACHINE: - h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); - temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_machine = listtomachine[settings_get_cur_sel(hdlg, IDC_COMBO_MACHINE)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)machine_getdevice(temp_machine)); break; } @@ -898,24 +937,19 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) stransi = (char *)malloc(512); #ifdef USE_DYNAREC - h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC); - temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); + temp_dynarec = settings_get_check(hdlg, IDC_CHECK_DYNAREC); #endif - h=GetDlgItem(hdlg, IDC_RADIO_TS_DISABLED); - if(SendMessage(h, BM_GETCHECK, 0, 0)) + if (settings_get_check(hdlg, IDC_RADIO_TS_DISABLED)) temp_sync = TIME_SYNC_DISABLED; - h=GetDlgItem(hdlg, IDC_RADIO_TS_LOCAL); - if(SendMessage(h, BM_GETCHECK, 0, 0)) + if (settings_get_check(hdlg, IDC_RADIO_TS_LOCAL)) temp_sync = TIME_SYNC_ENABLED; - h=GetDlgItem(hdlg, IDC_RADIO_TS_UTC); - if(SendMessage(h, BM_GETCHECK, 0, 0)) + if (settings_get_check(hdlg, IDC_RADIO_TS_UTC)) temp_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC; - h = GetDlgItem(hdlg, IDC_COMBO_WS); - temp_wait_states = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_wait_states = settings_get_cur_sel(hdlg, IDC_COMBO_WS); h = GetDlgItem(hdlg, IDC_MEMTEXT); SendMessage(h, WM_GETTEXT, 255, (LPARAM) lptsTemp); @@ -941,51 +975,25 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) static void -recalc_vid_list(HWND hdlg) +generate_device_name(const device_t *device, char *internal_name, int bus) { - HWND h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - int c = 0, d = 0; - int found_card = 0; - WCHAR szText[512]; + char temp[512]; + WCHAR *wtemp; - SendMessage(h, CB_RESETCONTENT, 0, 0); - SendMessage(h, CB_SETCURSEL, 0, 0); + memset(device_name, 0x00, 512 * sizeof(WCHAR)); + memset(temp, 0x00, 512); - while (1) { - /* Skip "internal" if machine doesn't have it. */ - if ((c == 1) && !(machines[temp_machine].flags&MACHINE_VIDEO)) { - c++; - continue; - } + if (!strcmp(internal_name, "none")) { + /* Translate "None". */ + wtemp = (WCHAR *) win_get_string(IDS_2103); + memcpy(device_name, wtemp, (wcslen(wtemp) + 1) * sizeof(WCHAR)); + return; + } else if (!strcmp(internal_name, "internal")) + memcpy(temp, "Internal", 9); + else + device_get_name(device, bus, temp); - char *s = video_card_getname(c); - - if (!s[0]) - break; - - if (video_card_available(c) && - device_is_valid(video_card_getdevice(c), machines[temp_machine].flags)) { - mbstowcs(szText, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); - if (c == temp_gfxcard) { - SendMessage(h, CB_SETCURSEL, d, 0); - found_card = 1; - } - - d++; - } - - c++; - } - if (!found_card) - SendMessage(h, CB_SETCURSEL, 0, 0); - EnableWindow(h, (machines[temp_machine].flags & MACHINE_VIDEO_ONLY) ? FALSE : TRUE); - - h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); - EnableWindow(h, (machines[temp_machine].flags & MACHINE_BUS_PCI) ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_BUTTON_VOODOO); - EnableWindow(h, ((machines[temp_machine].flags & MACHINE_BUS_PCI) && temp_voodoo) ? TRUE : FALSE); + mbstowcs(device_name, temp, strlen(temp) + 1); } @@ -996,62 +1004,58 @@ static BOOL CALLBACK #endif win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; - LPTSTR lptsTemp; - char *stransi; + int c = 0, d = 0; switch (message) { case WM_INITDIALOG: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); + settings_reset_content(hdlg, IDC_COMBO_VIDEO); - recalc_vid_list(hdlg); + while (1) { + /* Skip "internal" if machine doesn't have it. */ + if ((c == 1) && !(machines[temp_machine].flags & MACHINE_VIDEO)) { + c++; + continue; + } - h=GetDlgItem(hdlg, IDC_CHECK_VOODOO); - SendMessage(h, BM_SETCHECK, temp_voodoo, 0); + generate_device_name(video_card_getdevice(c), video_get_internal_name(c), 1); - h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); + if (!device_name[0]) + break; - h = GetDlgItem(hdlg, IDC_CONFIGURE_VID); - if (video_card_has_config(temp_gfxcard)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + if (video_card_available(c) && + device_is_valid(video_card_getdevice(c), machines[temp_machine].flags)) { + if (c == 0) + settings_add_string(hdlg, IDC_COMBO_VIDEO, win_get_string(IDS_2103)); + else if (c == 1) + settings_add_string(hdlg, IDC_COMBO_VIDEO, win_get_string(IDS_2118)); + else + settings_add_string(hdlg, IDC_COMBO_VIDEO, (LPARAM) device_name); + settings_list_to_device[0][d] = c; + if ((c == 0) || (c == temp_gfxcard)) + settings_set_cur_sel(hdlg, IDC_COMBO_VIDEO, d); + d++; + } - free(stransi); - free(lptsTemp); + c++; + } + settings_enable_window(hdlg, IDC_COMBO_VIDEO, !(machines[temp_machine].flags & MACHINE_VIDEO_ONLY)); + settings_enable_window(hdlg, IDC_CONFIGURE_VID, video_card_has_config(temp_gfxcard)); + settings_enable_window(hdlg, IDC_CHECK_VOODOO, (machines[temp_machine].flags & MACHINE_BUS_PCI)); + settings_set_check(hdlg, IDC_CHECK_VOODOO, temp_voodoo); + settings_enable_window(hdlg, IDC_BUTTON_VOODOO, (machines[temp_machine].flags & MACHINE_BUS_PCI) && temp_voodoo); return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_COMBO_VIDEO: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); - - h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); - temp_gfxcard = video_card_getid(stransi); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_VID); - if (video_card_has_config(temp_gfxcard)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - free(stransi); - free(lptsTemp); + temp_gfxcard = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; + settings_enable_window(hdlg, IDC_CONFIGURE_VID, video_card_has_config(temp_gfxcard)); break; case IDC_CHECK_VOODOO: - h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); - temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_BUTTON_VOODOO); - EnableWindow(h, temp_voodoo ? TRUE : FALSE); + temp_voodoo = settings_get_check(hdlg, IDC_CHECK_VOODOO); + settings_enable_window(hdlg, IDC_BUTTON_VOODOO, temp_voodoo); break; case IDC_BUTTON_VOODOO: @@ -1059,34 +1063,15 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_CONFIGURE_VID: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); - - h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)video_card_getdevice(video_card_getid(stransi))); - - free(stransi); - free(lptsTemp); + temp_gfxcard = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *)video_card_getdevice(temp_gfxcard)); break; } return FALSE; case WM_SAVESETTINGS: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); - - h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); - temp_gfxcard = video_card_getid(stransi); - - h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); - temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); - - free(stransi); - free(lptsTemp); + temp_gfxcard = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; + temp_voodoo = settings_get_check(hdlg, IDC_CHECK_VOODOO); default: return FALSE; @@ -1116,125 +1101,78 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { wchar_t str[128]; - char *joy_name; - HWND h; + char *joy_name; int c, d; switch (message) { case WM_INITDIALOG: - h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_MOUSE); for (c = 0; c < mouse_get_ndev(); c++) { - settings_device_to_list[0][c] = d; - if (mouse_valid(c, temp_machine)) { - mbstowcs(str, mouse_get_name(c), sizeof_w(str)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)str); - + generate_device_name(mouse_get_device(c), mouse_get_internal_name(c), 0); + if (c == 0) + settings_add_string(hdlg, IDC_COMBO_MOUSE, win_get_string(IDS_2103)); + else if (c == 1) + settings_add_string(hdlg, IDC_COMBO_MOUSE, win_get_string(IDS_2118)); + else + settings_add_string(hdlg, IDC_COMBO_MOUSE, (LPARAM) device_name); settings_list_to_device[0][d] = c; + if ((c == 0) || (c == temp_mouse)) + settings_set_cur_sel(hdlg, IDC_COMBO_MOUSE, d); d++; } } - SendMessage(h, CB_SETCURSEL, settings_device_to_list[0][temp_mouse], 0); + settings_enable_window(hdlg, IDC_CONFIGURE_MOUSE, mouse_has_config(temp_mouse)); - h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE); - if (mouse_has_config(temp_mouse)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); c = 0; joy_name = joystick_get_name(c); while (joy_name) { mbstowcs(str, joy_name, strlen(joy_name) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)str); + settings_add_string(hdlg, IDC_COMBO_JOYSTICK, (LPARAM) str); - // SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2096 + c)); c++; joy_name = joystick_get_name(c); } - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_joystick, 0); + settings_enable_window(hdlg, IDC_COMBO_JOYSTICK, TRUE); + settings_set_cur_sel(hdlg, IDC_COMBO_JOYSTICK, temp_joystick); - h = GetDlgItem(hdlg, IDC_JOY1); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY2); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY3); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY4); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE); + for (c = 0; c < 4; c++) + settings_enable_window(hdlg, IDC_JOY1 + c, joystick_get_max_joysticks(temp_joystick) > c); return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_COMBO_MOUSE: - h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); - temp_mouse = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE); - if (mouse_has_config(temp_mouse)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + temp_mouse = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_MOUSE)]; + settings_enable_window(hdlg, IDC_CONFIGURE_MOUSE, mouse_has_config(temp_mouse)); break; case IDC_CONFIGURE_MOUSE: - h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); - temp_mouse = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; + temp_mouse = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_MOUSE)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)mouse_get_device(temp_mouse)); break; case IDC_COMBO_JOYSTICK: - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = settings_get_cur_sel(hdlg, IDC_COMBO_JOYSTICK); - h = GetDlgItem(hdlg, IDC_JOY1); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY2); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY3); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY4); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE); + for (c = 0; c < 4; c++) + settings_enable_window(hdlg, IDC_JOY1 + c, joystick_get_max_joysticks(temp_joystick) > c); break; - case IDC_JOY1: - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); - temp_deviceconfig |= joystickconfig_open(hdlg, 0, temp_joystick); - break; - - case IDC_JOY2: - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); - temp_deviceconfig |= joystickconfig_open(hdlg, 1, temp_joystick); - break; - - case IDC_JOY3: - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); - temp_deviceconfig |= joystickconfig_open(hdlg, 2, temp_joystick); - break; - - case IDC_JOY4: - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); - temp_deviceconfig |= joystickconfig_open(hdlg, 3, temp_joystick); + case IDC_JOY1: case IDC_JOY2: case IDC_JOY3: case IDC_JOY4: + temp_joystick = settings_get_cur_sel(hdlg, IDC_COMBO_JOYSTICK); + temp_deviceconfig |= joystickconfig_open(hdlg, LOWORD(wParam) - IDC_JOY1, temp_joystick); break; } return FALSE; case WM_SAVESETTINGS: - h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); - temp_mouse = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_mouse = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_MOUSE)]; + temp_joystick = settings_get_cur_sel(hdlg, IDC_COMBO_JOYSTICK); default: return FALSE; @@ -1256,7 +1194,7 @@ mpu401_standalone_allow(void) char *md, *mdin; md = midi_device_get_internal_name(temp_midi_device); - mdin = midi_in_device_get_internal_name(temp_midi_input_device); + mdin = midi_in_device_get_internal_name(temp_midi_input_device); if (md != NULL) { if (!strcmp(md, "none") && !strcmp(mdin, "none")) @@ -1273,18 +1211,16 @@ static BOOL CALLBACK #endif win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; int c, d; LPTSTR lptsTemp; const device_t *sound_dev; - char *s; switch (message) { case WM_INITDIALOG: lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_SOUND); c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_SOUND); while (1) { /* Skip "internal" if machine doesn't have it. */ if ((c == 1) && !(machines[temp_machine].flags & MACHINE_SOUND)) { @@ -1292,223 +1228,149 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) continue; } - s = sound_card_getname(c); + generate_device_name(sound_card_getdevice(c), sound_card_get_internal_name(c), 1); - if (!s[0]) + if (!device_name[0]) break; - settings_device_to_list[0][c] = d; - if (sound_card_available(c)) { sound_dev = sound_card_getdevice(c); if (device_is_valid(sound_dev, machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); - else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } + settings_add_string(hdlg, IDC_COMBO_SOUND, win_get_string(IDS_2103)); + else if (c == 1) + settings_add_string(hdlg, IDC_COMBO_SOUND, win_get_string(IDS_2118)); + else + settings_add_string(hdlg, IDC_COMBO_SOUND, (LPARAM) device_name); settings_list_to_device[0][d] = c; + if ((c == 0) || (c == temp_sound_card)) + settings_set_cur_sel(hdlg, IDC_COMBO_SOUND, d); d++; } } c++; } - SendMessage(h, CB_SETCURSEL, settings_device_to_list[0][temp_sound_card], 0); - EnableWindow(h, d ? TRUE : FALSE); + settings_enable_window(hdlg, IDC_COMBO_SOUND, d); + settings_enable_window(hdlg, IDC_CONFIGURE_SND, sound_card_has_config(temp_sound_card)); - h = GetDlgItem(hdlg, IDC_CONFIGURE_SND); - EnableWindow(h, sound_card_has_config(temp_sound_card) ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_COMBO_MIDI); c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_MIDI); while (1) { - s = midi_device_getname(c); + generate_device_name(midi_device_getdevice(c), midi_device_get_internal_name(c), 0); - if (!s[0]) + if (!device_name[0]) break; - settings_midi_to_list[c] = d; - if (midi_device_available(c)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); - else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } + settings_add_string(hdlg, IDC_COMBO_MIDI, win_get_string(IDS_2103)); + else + settings_add_string(hdlg, IDC_COMBO_MIDI, (LPARAM) device_name); settings_list_to_midi[d] = c; + if ((c == 0) || (c == temp_midi_device)) + settings_set_cur_sel(hdlg, IDC_COMBO_MIDI, d); d++; } c++; } - SendMessage(h, CB_SETCURSEL, settings_midi_to_list[temp_midi_device], 0); - h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI); - if (midi_device_has_config(temp_midi_device)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI, midi_device_has_config(temp_midi_device)); - h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN); c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_MIDI_IN); while (1) { - s = midi_in_device_getname(c); + generate_device_name(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0); - if (!s[0]) + if (!device_name[0]) break; - settings_midi_in_to_list[c] = d; - if (midi_in_device_available(c)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); - else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } + settings_add_string(hdlg, IDC_COMBO_MIDI_IN, win_get_string(IDS_2103)); + else + settings_add_string(hdlg, IDC_COMBO_MIDI_IN, (LPARAM) device_name); settings_list_to_midi_in[d] = c; + if ((c == 0) || (c == temp_midi_input_device)) + settings_set_cur_sel(hdlg, IDC_COMBO_MIDI_IN, d); d++; } c++; } - SendMessage(h, CB_SETCURSEL, settings_midi_in_to_list[temp_midi_input_device], 0); - h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI_IN); - if (midi_in_device_has_config(temp_midi_input_device)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - - h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - SendMessage(h, BM_SETCHECK, temp_mpu401, 0); - EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401); - EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE); - - - h=GetDlgItem(hdlg, IDC_CHECK_CMS); - SendMessage(h, BM_SETCHECK, temp_GAMEBLASTER, 0); - - h=GetDlgItem(hdlg, IDC_CHECK_GUS); - SendMessage(h, BM_SETCHECK, temp_GUS, 0); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_GUS); - EnableWindow(h, (temp_GUS) ? TRUE : FALSE); - - h=GetDlgItem(hdlg, IDC_CHECK_SSI); - SendMessage(h, BM_SETCHECK, temp_SSI2001, 0); - - h=GetDlgItem(hdlg, IDC_CHECK_FLOAT); - SendMessage(h, BM_SETCHECK, temp_float, 0); + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_IN, midi_in_device_has_config(temp_midi_input_device)); + settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401); + settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow()); + settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401); + settings_set_check(hdlg, IDC_CHECK_CMS, temp_GAMEBLASTER); + settings_set_check(hdlg, IDC_CHECK_GUS, temp_GUS); + settings_enable_window(hdlg, IDC_CONFIGURE_GUS, temp_GUS); + settings_set_check(hdlg, IDC_CHECK_SSI, temp_SSI2001); + settings_set_check(hdlg, IDC_CHECK_FLOAT, temp_float); free(lptsTemp); return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_COMBO_SOUND: - h = GetDlgItem(hdlg, IDC_COMBO_SOUND); - temp_sound_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_SND); - if (sound_card_has_config(temp_sound_card)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - SendMessage(h, BM_SETCHECK, temp_mpu401, 0); - EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401); - EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE); + temp_sound_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SOUND)]; + settings_enable_window(hdlg, IDC_CONFIGURE_SND, sound_card_has_config(temp_sound_card)); + settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401); + settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow()); + settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401); break; case IDC_CONFIGURE_SND: - h = GetDlgItem(hdlg, IDC_COMBO_SOUND); - temp_sound_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_sound_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SOUND)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)sound_card_getdevice(temp_sound_card)); break; case IDC_COMBO_MIDI: - h = GetDlgItem(hdlg, IDC_COMBO_MIDI); - temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI); - if (midi_device_has_config(temp_midi_device)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - SendMessage(h, BM_SETCHECK, temp_mpu401, 0); - EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401); - EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE); + temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI)]; + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI, midi_device_has_config(temp_midi_device)); + settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401); + settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow()); + settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401); break; case IDC_CONFIGURE_MIDI: - h = GetDlgItem(hdlg, IDC_COMBO_MIDI); - temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_device_getdevice(temp_midi_device)); break; case IDC_COMBO_MIDI_IN: - h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN); - temp_midi_input_device = settings_list_to_midi_in[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI_IN); - if (midi_in_device_has_config(temp_midi_input_device)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - SendMessage(h, BM_SETCHECK, temp_mpu401, 0); - EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401); - EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE); + temp_midi_input_device = settings_list_to_midi_in[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_IN)]; + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_IN, midi_in_device_has_config(temp_midi_input_device)); + settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401); + settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow()); + settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401); break; case IDC_CONFIGURE_MIDI_IN: - h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN); - temp_midi_input_device = settings_list_to_midi_in[SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_midi_input_device = settings_list_to_midi_in[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_IN)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_in_device_getdevice(temp_midi_input_device)); break; case IDC_CHECK_MPU401: - h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0); + temp_mpu401 = settings_get_check(hdlg, IDC_CHECK_MPU401); - h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401); - EnableWindow(h, mpu401_present() ? TRUE : FALSE); + settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_present()); break; case IDC_CONFIGURE_MPU401: temp_deviceconfig |= deviceconfig_open(hdlg, (machines[temp_machine].flags & MACHINE_MCA) ? (void *)&mpu401_mca_device : (void *)&mpu401_device); break; - - case IDC_CHECK_GUS: - h = GetDlgItem(hdlg, IDC_CHECK_GUS); - temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); - h = GetDlgItem(hdlg, IDC_CONFIGURE_GUS); - EnableWindow(h, temp_GUS ? TRUE : FALSE); + case IDC_CHECK_GUS: + temp_GUS = settings_get_check(hdlg, IDC_CHECK_GUS); + settings_enable_window(hdlg, IDC_CONFIGURE_GUS, temp_GUS); break; case IDC_CONFIGURE_GUS: @@ -1518,29 +1380,14 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) return FALSE; case WM_SAVESETTINGS: - h = GetDlgItem(hdlg, IDC_COMBO_SOUND); - temp_sound_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBO_MIDI); - temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN); - temp_midi_input_device = settings_list_to_midi_in[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_CMS); - temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_GUS); - temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_SSI); - temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_FLOAT); - temp_float = SendMessage(h, BM_GETCHECK, 0, 0); + temp_sound_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SOUND)]; + temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI)]; + temp_midi_input_device = settings_list_to_midi_in[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_IN)]; + temp_mpu401 = settings_get_check(hdlg, IDC_CHECK_MPU401); + temp_GAMEBLASTER = settings_get_check(hdlg, IDC_CHECK_CMS); + temp_GUS = settings_get_check(hdlg, IDC_CHECK_GUS); + temp_SSI2001 = settings_get_check(hdlg, IDC_CHECK_SSI); + temp_float = settings_get_check(hdlg, IDC_CHECK_FLOAT); default: return FALSE; @@ -1556,7 +1403,6 @@ static BOOL CALLBACK #endif win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; int c, i; char *s; LPTSTR lptsTemp; @@ -1566,7 +1412,6 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); for (i = 0; i < 3; i++) { - h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i); c = 0; while (1) { s = lpt_device_get_name(c); @@ -1575,27 +1420,22 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); + settings_add_string(hdlg, IDC_COMBO_LPT1 + i, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_LPT1 + i, (LPARAM) lptsTemp); } c++; } - SendMessage(h, CB_SETCURSEL, temp_lpt_devices[i], 0); + settings_set_cur_sel(hdlg, IDC_COMBO_LPT1 + i, temp_lpt_devices[i]); - h=GetDlgItem(hdlg, IDC_CHECK_PARALLEL1 + i); - SendMessage(h, BM_SETCHECK, temp_lpt[i], 0); - - h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i); - EnableWindow(h, temp_lpt[i] ? TRUE : FALSE); + settings_set_check(hdlg, IDC_CHECK_PARALLEL1 + i, temp_lpt[i]); + settings_enable_window(hdlg, IDC_COMBO_LPT1 + i, temp_lpt[i]); } - for (i = 0; i < 4; i++) { - h=GetDlgItem(hdlg, IDC_CHECK_SERIAL1 + i); - SendMessage(h, BM_SETCHECK, temp_serial[i], 0); - } + for (i = 0; i < 4; i++) + settings_set_check(hdlg, IDC_CHECK_SERIAL1 + i, temp_serial[i]); free(lptsTemp); @@ -1607,34 +1447,20 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CHECK_PARALLEL2: case IDC_CHECK_PARALLEL3: i = LOWORD(wParam) - IDC_CHECK_PARALLEL1; - h = GetDlgItem(hdlg, IDC_CHECK_PARALLEL1 + i); - if (SendMessage(h, BM_GETCHECK, 0, 0) == BST_CHECKED) - { - h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i); - EnableWindow(h, TRUE); - } - else - { - h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i); - EnableWindow(h, FALSE); - } + settings_enable_window(hdlg, IDC_COMBO_LPT1 + i, + settings_get_check(hdlg, IDC_CHECK_PARALLEL1 + i) == BST_CHECKED); break; } break; case WM_SAVESETTINGS: for (i = 0; i < 3; i++) { - h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i); - temp_lpt_devices[i] = SendMessage(h, CB_GETCURSEL, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_PARALLEL1 + i); - temp_lpt[i] = SendMessage(h, BM_GETCHECK, 0, 0); + temp_lpt_devices[i] = settings_get_cur_sel(hdlg, IDC_COMBO_LPT1 + i); + temp_lpt[i] = settings_get_check(hdlg, IDC_CHECK_PARALLEL1 + i); } - for (i = 0; i < 4; i++) { - h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1 + i); - temp_serial[i] = SendMessage(h, BM_GETCHECK, 0, 0); - } + for (i = 0; i < 4; i++) + temp_serial[i] = settings_get_check(hdlg, IDC_CHECK_SERIAL1 + i); default: return FALSE; @@ -1642,47 +1468,6 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) return FALSE; } -static void -recalc_hdc_list(HWND hdlg) -{ - HWND h = GetDlgItem(hdlg, IDC_COMBO_HDC); - int c = 0, d = 0; - int found_card = 0; - WCHAR szText[512]; - - SendMessage(h, CB_RESETCONTENT, 0, 0); - SendMessage(h, CB_SETCURSEL, 0, 0); - - while (1) { - /* Skip "internal" if machine doesn't have it. */ - if ((c == 1) && !(machines[temp_machine].flags & MACHINE_HDC)) { - c++; - continue; - } - - char *s = hdc_get_name(c); - - if (!s[0]) - break; - - if (hdc_available(c) && - device_is_valid(hdc_get_device(c), machines[temp_machine].flags)) { - mbstowcs(szText, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); - if (c == temp_hdc) { - SendMessage(h, CB_SETCURSEL, d, 0); - found_card = 1; - } - - d++; - } - - c++; - } - if (!found_card) - SendMessage(h, CB_SETCURSEL, 0, 0); -} - #if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK @@ -1691,15 +1476,12 @@ static BOOL CALLBACK #endif win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; int c, d; int e, is_at; LPTSTR lptsTemp; char *stransi; - const device_t *scsi_dev; - const device_t *dev; - const device_t *fdc_dev; - char *s; + const device_t *scsi_dev, *dev; + const device_t *fdc_dev, *hdc_dev; switch (message) { case WM_INITDIALOG: @@ -1707,162 +1489,144 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa stransi = (char *) malloc(512); /*HD controller config*/ - recalc_hdc_list(hdlg); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC); - if (hdc_has_config(temp_hdc)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - - /*FD controller config*/ - h = GetDlgItem(hdlg, IDC_COMBO_FDC); c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_HDC); while (1) { - char *s = fdc_card_getname(c); + generate_device_name(hdc_get_device(c), hdc_get_internal_name(c), 1); - if (!s[0]) + if (!device_name[0]) break; - settings_fdc_to_list[0][c] = d; + if (hdc_available(c)) { + hdc_dev = hdc_get_device(c); + + if (device_is_valid(hdc_dev, machines[temp_machine].flags)) { + if (c == 0) + settings_add_string(hdlg, IDC_COMBO_HDC, win_get_string(IDS_2103)); + else if (c == 1) + settings_add_string(hdlg, IDC_COMBO_HDC, win_get_string(IDS_2118)); + else + settings_add_string(hdlg, IDC_COMBO_HDC, (LPARAM) device_name); + settings_list_to_hdc[d] = c; + if ((c == 0) || (c == temp_hdc)) + settings_set_cur_sel(hdlg, IDC_COMBO_HDC, d); + d++; + } + } + + c++; + } + + settings_enable_window(hdlg, IDC_COMBO_HDC, d); + settings_enable_window(hdlg, IDC_CONFIGURE_HDC, hdc_has_config(temp_hdc)); + + /*FD controller config*/ + c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_FDC); + while (1) { + generate_device_name(fdc_card_getdevice(c), fdc_card_get_internal_name(c), 1); + + if (!device_name[0]) + break; if (fdc_card_available(c)) { fdc_dev = fdc_card_getdevice(c); if (device_is_valid(fdc_dev, machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2118)); - else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } - settings_list_to_fdc[0][d] = c; + settings_add_string(hdlg, IDC_COMBO_FDC, win_get_string(IDS_2118)); + else + settings_add_string(hdlg, IDC_COMBO_FDC, (LPARAM) device_name); + settings_list_to_fdc[d] = c; + if ((c == 0) || (c == temp_fdc_card)) + settings_set_cur_sel(hdlg, IDC_COMBO_FDC, d); d++; } } c++; } - SendMessage(h, CB_SETCURSEL, settings_fdc_to_list[0][temp_fdc_card], 0); - - EnableWindow(h, d ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC); - EnableWindow(h, fdc_card_has_config(temp_fdc_card) ? TRUE : FALSE); + settings_enable_window(hdlg, IDC_COMBO_FDC, d); + settings_enable_window(hdlg, IDC_CONFIGURE_FDC, fdc_card_has_config(temp_fdc_card)); /*SCSI config*/ - h = GetDlgItem(hdlg, IDC_COMBO_SCSI); c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_SCSI); while (1) { - char *s = scsi_card_getname(c); + generate_device_name(scsi_card_getdevice(c), scsi_card_get_internal_name(c), 1); - if (!s[0]) + if (!device_name[0]) break; - settings_device_to_list[0][c] = d; - if (scsi_card_available(c)) { scsi_dev = scsi_card_getdevice(c); if (device_is_valid(scsi_dev, machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); - else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } + settings_add_string(hdlg, IDC_COMBO_SCSI, win_get_string(IDS_2103)); + else + settings_add_string(hdlg, IDC_COMBO_SCSI, (LPARAM) device_name); settings_list_to_device[0][d] = c; + if ((c == 0) || (c == temp_scsi_card)) + settings_set_cur_sel(hdlg, IDC_COMBO_SCSI, d); d++; } } c++; } - SendMessage(h, CB_SETCURSEL, settings_device_to_list[0][temp_scsi_card], 0); - EnableWindow(h, d ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI); - EnableWindow(h, scsi_card_has_config(temp_scsi_card) ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER); + settings_enable_window(hdlg, IDC_COMBO_SCSI, d); + settings_enable_window(hdlg, IDC_CONFIGURE_SCSI, scsi_card_has_config(temp_scsi_card)); is_at = IS_ARCH(temp_machine, (MACHINE_BUS_ISA16 | MACHINE_BUS_MCA | MACHINE_BUS_PCMCIA)); - EnableWindow(h, is_at ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_BUTTON_IDE_TER); - EnableWindow(h, (is_at && temp_ide_ter) ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_CHECK_IDE_QUA); - EnableWindow(h, is_at ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_BUTTON_IDE_QUA); - EnableWindow(h, (is_at && temp_ide_qua) ? TRUE : FALSE); - - h=GetDlgItem(hdlg, IDC_CHECK_IDE_TER); - SendMessage(h, BM_SETCHECK, temp_ide_ter, 0); - - h=GetDlgItem(hdlg, IDC_CHECK_IDE_QUA); - SendMessage(h, BM_SETCHECK, temp_ide_qua, 0); - - h=GetDlgItem(hdlg, IDC_CHECK_BUGGER); - SendMessage(h, BM_SETCHECK, temp_bugger, 0); - - h=GetDlgItem(hdlg, IDC_CHECK_POSTCARD); - SendMessage(h, BM_SETCHECK, temp_postcard, 0); + settings_enable_window(hdlg, IDC_CHECK_IDE_TER, is_at); + settings_enable_window(hdlg, IDC_BUTTON_IDE_TER, is_at && temp_ide_ter); + settings_enable_window(hdlg, IDC_CHECK_IDE_QUA, is_at); + settings_enable_window(hdlg, IDC_BUTTON_IDE_QUA, is_at && temp_ide_qua); + settings_set_check(hdlg, IDC_CHECK_IDE_TER, temp_ide_ter); + settings_set_check(hdlg, IDC_CHECK_IDE_QUA, temp_ide_qua); + settings_set_check(hdlg, IDC_CHECK_BUGGER, temp_bugger); + settings_set_check(hdlg, IDC_CHECK_POSTCARD, temp_postcard); /* Populate the ISA RTC card dropdown. */ e = 0; - h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); + settings_reset_content(hdlg, IDC_COMBO_ISARTC); for (d = 0; ; d++) { - s = isartc_get_name(d); - if (!s[0]) + generate_device_name(isartc_get_device(d), isartc_get_internal_name(d), 0); + + if (!device_name[0]) break; - settings_device_to_list[1][d] = e; - if (d == 0) { - /* Translate "None". */ - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); - } else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } - + settings_add_string(hdlg, IDC_COMBO_ISARTC, win_get_string(IDS_2103)); + settings_set_cur_sel(hdlg, IDC_COMBO_ISARTC, 0); + } else + settings_add_string(hdlg, IDC_COMBO_ISARTC, (LPARAM) device_name); settings_list_to_device[1][e] = d; + if (d == temp_isartc) + settings_set_cur_sel(hdlg, IDC_COMBO_ISARTC, e); e++; } - SendMessage(h, CB_SETCURSEL, temp_isartc, 0); - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISARTC); - if (temp_isartc != 0) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - + settings_enable_window(hdlg, IDC_CONFIGURE_ISARTC, temp_isartc != 0); + /* Populate the ISA memory card dropdowns. */ + settings_reset_content(hdlg, IDC_COMBO_ISAMEM_1 + c); for (c = 0; c < ISAMEM_MAX; c++) { - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1 + c); for (d = 0; ; d++) { - s = (char *) isamem_get_internal_name(d); - if (s == NULL) + generate_device_name(isamem_get_device(d), (char *) isamem_get_internal_name(d), 0); + + if (!device_name[0]) break; if (d == 0) { - /* Translate "None". */ - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2103)); - } else { - s = (char *) isamem_get_name(d); - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)lptsTemp); - } + settings_add_string(hdlg, IDC_COMBO_ISAMEM_1 + c, win_get_string(IDS_2103)); + settings_set_cur_sel(hdlg, IDC_COMBO_ISAMEM_1 + c, 0); + } else + settings_add_string(hdlg, IDC_COMBO_ISAMEM_1 + c, (LPARAM) device_name); } - SendMessage(h, CB_SETCURSEL, temp_isamem[c], 0); - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c); - if (temp_isamem[c] != 0) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + settings_set_cur_sel(hdlg, IDC_COMBO_ISAMEM_1 + c, temp_isamem[c]); + settings_enable_window(hdlg, IDC_CONFIGURE_ISAMEM_1 + c, temp_isamem[c] != 0); } free(stransi); @@ -1871,123 +1635,64 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_CONFIGURE_FDC: - h = GetDlgItem(hdlg, IDC_COMBO_FDC); - temp_fdc_card = settings_list_to_fdc[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_fdc_card = settings_list_to_fdc[settings_get_cur_sel(hdlg, IDC_COMBO_FDC)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)fdc_card_getdevice(temp_fdc_card)); break; case IDC_COMBO_FDC: - h = GetDlgItem(hdlg, IDC_COMBO_FDC); - temp_fdc_card = settings_list_to_fdc[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC); - if (fdc_card_has_config(temp_fdc_card)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + temp_fdc_card = settings_list_to_fdc[settings_get_cur_sel(hdlg, IDC_COMBO_FDC)]; + settings_enable_window(hdlg, IDC_CONFIGURE_FDC, fdc_card_has_config(temp_fdc_card)); break; case IDC_CONFIGURE_HDC: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); - - h = GetDlgItem(hdlg, IDC_COMBO_HDC); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)hdc_get_device(hdc_get_id(stransi))); - - free(stransi); - free(lptsTemp); + temp_hdc = settings_list_to_hdc[settings_get_cur_sel(hdlg, IDC_COMBO_HDC)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *)hdc_get_device(temp_hdc)); break; case IDC_COMBO_HDC: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); - - h = GetDlgItem(hdlg, IDC_COMBO_HDC); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); - temp_hdc = hdc_get_id(stransi); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC); - if (hdc_has_config(temp_hdc)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - free(stransi); - free(lptsTemp); + temp_hdc = settings_list_to_hdc[settings_get_cur_sel(hdlg, IDC_COMBO_HDC)]; + settings_enable_window(hdlg, IDC_CONFIGURE_HDC, hdc_has_config(temp_hdc)); break; case IDC_CONFIGURE_SCSI: - h = GetDlgItem(hdlg, IDC_COMBO_SCSI); - temp_scsi_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_scsi_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SCSI)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)scsi_card_getdevice(temp_scsi_card)); break; case IDC_COMBO_SCSI: - h = GetDlgItem(hdlg, IDC_COMBO_SCSI); - temp_scsi_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI); - if (scsi_card_has_config(temp_scsi_card)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + temp_scsi_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SCSI)]; + settings_enable_window(hdlg, IDC_CONFIGURE_SCSI, scsi_card_has_config(temp_scsi_card)); break; case IDC_CONFIGURE_ISARTC: - h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); - temp_isartc = settings_list_to_device[1][SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_isartc = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_ISARTC)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isartc_get_device(temp_isartc)); - break; - - case IDC_COMBO_ISARTC: - h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); - temp_isartc = settings_list_to_device[1][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISARTC); - if (temp_isartc != 0) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - break; - - case IDC_COMBO_ISAMEM_1: - case IDC_COMBO_ISAMEM_2: - case IDC_COMBO_ISAMEM_3: - case IDC_COMBO_ISAMEM_4: - c = LOWORD(wParam) - IDC_COMBO_ISAMEM_1; - h = GetDlgItem(hdlg, LOWORD(wParam)); - temp_isamem[c] = SendMessage(h, CB_GETCURSEL, 0, 0); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c); - if (temp_isamem[c] != 0) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); break; - case IDC_CONFIGURE_ISAMEM_1: - case IDC_CONFIGURE_ISAMEM_2: - case IDC_CONFIGURE_ISAMEM_3: - case IDC_CONFIGURE_ISAMEM_4: + case IDC_COMBO_ISARTC: + temp_isartc = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_ISARTC)]; + settings_enable_window(hdlg, IDC_CONFIGURE_ISARTC, temp_isartc != 0); + break; + + case IDC_COMBO_ISAMEM_1: case IDC_COMBO_ISAMEM_2: + case IDC_COMBO_ISAMEM_3: case IDC_COMBO_ISAMEM_4: + c = LOWORD(wParam) - IDC_COMBO_ISAMEM_1; + temp_isamem[c] = settings_get_cur_sel(hdlg, LOWORD(wParam)); + settings_enable_window(hdlg, IDC_CONFIGURE_ISAMEM_1 + c, temp_isamem[c] != 0); + break; + + case IDC_CONFIGURE_ISAMEM_1: case IDC_CONFIGURE_ISAMEM_2: + case IDC_CONFIGURE_ISAMEM_3: case IDC_CONFIGURE_ISAMEM_4: c = LOWORD(wParam) - IDC_CONFIGURE_ISAMEM_1; dev = isamem_get_device(temp_isamem[c]); temp_deviceconfig |= deviceconfig_inst_open(hdlg, (void *)dev, c + 1); break; case IDC_CHECK_IDE_TER: - h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER); - temp_ide_ter = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_BUTTON_IDE_TER); - EnableWindow(h, temp_ide_ter ? TRUE : FALSE); + temp_ide_ter = settings_get_check(hdlg, IDC_CHECK_IDE_TER); + settings_enable_window(hdlg, IDC_BUTTON_IDE_TER, temp_ide_ter); break; case IDC_BUTTON_IDE_TER: @@ -1995,11 +1700,8 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa break; case IDC_CHECK_IDE_QUA: - h = GetDlgItem(hdlg, IDC_CHECK_IDE_QUA); - temp_ide_qua = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_BUTTON_IDE_QUA); - EnableWindow(h, temp_ide_qua ? TRUE : FALSE); + temp_ide_qua = settings_get_check(hdlg, IDC_CHECK_IDE_QUA); + settings_enable_window(hdlg, IDC_BUTTON_IDE_QUA, temp_ide_qua); break; case IDC_BUTTON_IDE_QUA: @@ -2009,37 +1711,14 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa return FALSE; case WM_SAVESETTINGS: - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - stransi = (char *) malloc(512); - - h = GetDlgItem(hdlg, IDC_COMBO_HDC); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); - wcstombs(stransi, lptsTemp, 512); - temp_hdc = hdc_get_id(stransi); - - h = GetDlgItem(hdlg, IDC_COMBO_FDC); - temp_fdc_card = settings_list_to_fdc[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBO_SCSI); - temp_scsi_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); - temp_isartc = settings_list_to_device[1][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER); - temp_ide_ter = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_IDE_QUA); - temp_ide_qua = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_BUGGER); - temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECK_POSTCARD); - temp_postcard = SendMessage(h, BM_GETCHECK, 0, 0); - - free(stransi); - free(lptsTemp); + temp_hdc = settings_list_to_hdc[settings_get_cur_sel(hdlg, IDC_COMBO_HDC)]; + temp_fdc_card = settings_list_to_fdc[settings_get_cur_sel(hdlg, IDC_COMBO_FDC)]; + temp_scsi_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SCSI)]; + temp_isartc = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_ISARTC)]; + temp_ide_ter = settings_get_check(hdlg, IDC_CHECK_IDE_TER); + temp_ide_qua = settings_get_check(hdlg, IDC_CHECK_IDE_QUA); + temp_bugger = settings_get_check(hdlg, IDC_CHECK_BUGGER); + temp_postcard = settings_get_check(hdlg, IDC_CHECK_POSTCARD); default: return FALSE; @@ -2050,32 +1729,15 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa static void network_recalc_combos(HWND hdlg) { - HWND h; - ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_PCAP); - EnableWindow(h, (temp_net_type == NET_TYPE_PCAP) ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_COMBO_NET); - if (temp_net_type == NET_TYPE_SLIRP) - EnableWindow(h, TRUE); - else if ((temp_net_type == NET_TYPE_PCAP) && - (network_dev_to_id(temp_pcap_dev) > 0)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURE_NET); - if (network_card_has_config(temp_net_card) && - (temp_net_type == NET_TYPE_SLIRP)) - EnableWindow(h, TRUE); - else if (network_card_has_config(temp_net_card) && - (temp_net_type == NET_TYPE_PCAP) && - (network_dev_to_id(temp_pcap_dev) > 0)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); + settings_enable_window(hdlg, IDC_COMBO_PCAP, temp_net_type == NET_TYPE_PCAP); + settings_enable_window(hdlg, IDC_COMBO_NET, + (temp_net_type == NET_TYPE_SLIRP) || + ((temp_net_type == NET_TYPE_PCAP) && (network_dev_to_id(temp_pcap_dev) > 0))); + settings_enable_window(hdlg, IDC_CONFIGURE_NET, network_card_has_config(temp_net_card) && + ((temp_net_type == NET_TYPE_SLIRP) || + ((temp_net_type == NET_TYPE_PCAP) && (network_dev_to_id(temp_pcap_dev) > 0)))); ignore_change = 0; } @@ -2088,75 +1750,61 @@ static BOOL CALLBACK #endif win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; int c, d; LPTSTR lptsTemp; - char *s; switch (message) { case WM_INITDIALOG: lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"None"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"PCap"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"SLiRP"); - SendMessage(h, CB_SETCURSEL, temp_net_type, 0); + settings_add_string(hdlg, IDC_COMBO_NET_TYPE, (LPARAM) L"None"); + settings_add_string(hdlg, IDC_COMBO_NET_TYPE, (LPARAM) L"PCap"); + settings_add_string(hdlg, IDC_COMBO_NET_TYPE, (LPARAM) L"SLiRP"); + settings_set_cur_sel(hdlg, IDC_COMBO_NET_TYPE, temp_net_type); + settings_enable_window(hdlg, IDC_COMBO_PCAP, temp_net_type == NET_TYPE_PCAP); - h = GetDlgItem(hdlg, IDC_COMBO_PCAP); - if (temp_net_type == NET_TYPE_PCAP) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_COMBO_PCAP); for (c = 0; c < network_ndev; c++) { mbstowcs(lptsTemp, network_devs[c].description, strlen(network_devs[c].description) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_PCAP, (LPARAM) lptsTemp); } - SendMessage(h, CB_SETCURSEL, network_dev_to_id(temp_pcap_dev), 0); + settings_set_cur_sel(hdlg, IDC_COMBO_PCAP, network_dev_to_id(temp_pcap_dev)); - /*NIC config*/ - h = GetDlgItem(hdlg, IDC_COMBO_NET); + /* NIC config */ c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_NET); while (1) { - s = network_card_getname(c); + generate_device_name(network_card_getdevice(c), network_card_get_internal_name(c), 1); - if (s[0] == '\0') + if (device_name[0] == L'\0') break; - settings_device_to_list[0][c] = d; - if (network_card_available(c) && device_is_valid(network_card_getdevice(c), machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); - else { - mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } + settings_add_string(hdlg, IDC_COMBO_NET, win_get_string(IDS_2103)); + else + settings_add_string(hdlg, IDC_COMBO_NET, (LPARAM) device_name); settings_list_to_device[0][d] = c; + if ((c == 0) || (c == temp_net_card)) + settings_set_cur_sel(hdlg, IDC_COMBO_NET, d); d++; } c++; } - SendMessage(h, CB_SETCURSEL, settings_device_to_list[0][temp_net_card], 0); - EnableWindow(h, d ? TRUE : FALSE); + settings_enable_window(hdlg, IDC_COMBO_NET, d); network_recalc_combos(hdlg); free(lptsTemp); return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_COMBO_NET_TYPE: if (ignore_change) return FALSE; - h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE); - temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0); - + temp_net_type = settings_get_cur_sel(hdlg, IDC_COMBO_NET_TYPE); network_recalc_combos(hdlg); break; @@ -2164,10 +1812,8 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (ignore_change) return FALSE; - h = GetDlgItem(hdlg, IDC_COMBO_PCAP); memset(temp_pcap_dev, '\0', sizeof(temp_pcap_dev)); - strcpy(temp_pcap_dev, network_devs[SendMessage(h, CB_GETCURSEL, 0, 0)].device); - + strcpy(temp_pcap_dev, network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP)].device); network_recalc_combos(hdlg); break; @@ -2175,9 +1821,7 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (ignore_change) return FALSE; - h = GetDlgItem(hdlg, IDC_COMBO_NET); - temp_net_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_net_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET)]; network_recalc_combos(hdlg); break; @@ -2185,24 +1829,17 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (ignore_change) return FALSE; - h = GetDlgItem(hdlg, IDC_COMBO_NET); - temp_net_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; - + temp_net_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_net_card)); break; } return FALSE; case WM_SAVESETTINGS: - h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE); - temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0); - - h = GetDlgItem(hdlg, IDC_COMBO_PCAP); + temp_net_type = settings_get_cur_sel(hdlg, IDC_COMBO_NET_TYPE); memset(temp_pcap_dev, '\0', sizeof(temp_pcap_dev)); - strcpy(temp_pcap_dev, network_devs[SendMessage(h, CB_GETCURSEL, 0, 0)].device); - - h = GetDlgItem(hdlg, IDC_COMBO_NET); - temp_net_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)]; + strcpy(temp_pcap_dev, network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP)].device); + temp_net_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET)]; default: return FALSE; @@ -2257,31 +1894,26 @@ static void add_locations(HWND hdlg) { LPTSTR lptsTemp; - HWND h; int i = 0; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); for (i = 0; i < 6; i++) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_4352 + i)); + settings_add_string(hdlg, IDC_COMBO_HD_BUS, win_get_string(IDS_4352 + i)); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); for (i = 0; i < 2; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_HD_CHANNEL, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); for (i = 0; i < 16; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4098), i); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_HD_ID, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); for (i = 0; i < 8; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_HD_CHANNEL_IDE, (LPARAM) lptsTemp); } free(lptsTemp); @@ -2335,117 +1967,64 @@ next_free_scsi_id(uint8_t *id) static void recalc_location_controls(HWND hdlg, int is_add_dlg, int assign_id) { - int i = 0; - HWND h; + int i = 0, bus = 0; - int bus = 0; - - for (i = IDT_1722; i <= IDT_1723; i++) { - h = GetDlgItem(hdlg, i); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } - - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); + for (i = IDT_1722; i <= IDT_1723; i++) + settings_show_window(hdlg, i, FALSE); + settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL, FALSE); + settings_show_window(hdlg, IDC_COMBO_HD_ID, FALSE); + settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL_IDE, FALSE); if ((hd_listview_items > 0) || is_add_dlg) { - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - bus = SendMessage(h, CB_GETCURSEL, 0, 0); - bus++; + bus = settings_get_cur_sel(hdlg, IDC_COMBO_HD_BUS) + 1; switch(bus) { case HDD_BUS_MFM: /* MFM */ - h = GetDlgItem(hdlg, IDT_1722); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1722, TRUE); + settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL, TRUE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); if (assign_id) temp_hdd[lv1_current_sel].mfm_channel = next_free_binary_channel(&mfm_tracking); - SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdd.mfm_channel : temp_hdd[lv1_current_sel].mfm_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL, is_add_dlg ? new_hdd.mfm_channel : temp_hdd[lv1_current_sel].mfm_channel); break; case HDD_BUS_XTA: /* XTA */ - h = GetDlgItem(hdlg, IDT_1722); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1722, TRUE); + settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL, TRUE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); if (assign_id) temp_hdd[lv1_current_sel].xta_channel = next_free_binary_channel(&xta_tracking); - SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdd.xta_channel : temp_hdd[lv1_current_sel].xta_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL, is_add_dlg ? new_hdd.xta_channel : temp_hdd[lv1_current_sel].xta_channel); break; case HDD_BUS_ESDI: /* ESDI */ - h = GetDlgItem(hdlg, IDT_1722); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1722, TRUE); + settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL, TRUE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); if (assign_id) temp_hdd[lv1_current_sel].esdi_channel = next_free_binary_channel(&esdi_tracking); - SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdd.esdi_channel : temp_hdd[lv1_current_sel].esdi_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL, is_add_dlg ? new_hdd.esdi_channel : temp_hdd[lv1_current_sel].esdi_channel); break; case HDD_BUS_IDE: /* IDE */ - h = GetDlgItem(hdlg, IDT_1722); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + case HDD_BUS_ATAPI: /* ATAPI */ + settings_show_window(hdlg, IDT_1722, TRUE); + settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL_IDE, TRUE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); if (assign_id) temp_hdd[lv1_current_sel].ide_channel = next_free_ide_channel(); - SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdd.ide_channel : temp_hdd[lv1_current_sel].ide_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL_IDE, is_add_dlg ? new_hdd.ide_channel : temp_hdd[lv1_current_sel].ide_channel); break; case HDD_BUS_SCSI: /* SCSI */ - h = GetDlgItem(hdlg, IDT_1723); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - h = GetDlgItem(hdlg, IDT_1724); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1723, TRUE); + settings_show_window(hdlg, IDT_1724, TRUE); + settings_show_window(hdlg, IDC_COMBO_HD_ID, TRUE); if (assign_id) next_free_scsi_id((uint8_t *) (is_add_dlg ? &(new_hdd.scsi_id) : &(temp_hdd[lv1_current_sel].scsi_id))); - - h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdd.scsi_id : temp_hdd[lv1_current_sel].scsi_id, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_ID, is_add_dlg ? new_hdd.scsi_id : temp_hdd[lv1_current_sel].scsi_id); } } - if ((hd_listview_items == 0) && !is_add_dlg) { - h = GetDlgItem(hdlg, IDT_1721); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - EnableWindow(h, FALSE); ShowWindow(h, SW_HIDE); - } else { - h = GetDlgItem(hdlg, IDT_1721); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - } + settings_show_window(hdlg, IDT_1721, (hd_listview_items != 0) || is_add_dlg); + settings_show_window(hdlg, IDC_COMBO_HD_BUS, (hd_listview_items != 0) || is_add_dlg); } @@ -2453,12 +2032,13 @@ static int bus_full(uint64_t *tracking, int count) { int full = 0; + switch(count) { case 2: default: full = (*tracking & 0xFF00LL); full = full && (*tracking & 0x00FFLL); - return full; + break; case 8: full = (*tracking & 0xFF00000000000000LL); full = full && (*tracking & 0x00FF000000000000LL); @@ -2468,19 +2048,20 @@ bus_full(uint64_t *tracking, int count) full = full && (*tracking & 0x0000000000FF0000LL); full = full && (*tracking & 0x000000000000FF00LL); full = full && (*tracking & 0x00000000000000FFLL); - return full; + break; } + + return full; } static void recalc_next_free_id(HWND hdlg) { - HWND h; int i, enable_add = 0; int c_mfm = 0, c_esdi = 0; int c_xta = 0, c_ide = 0; - int c_scsi = 0; + int c_atapi = 0, c_scsi = 0; next_free_id = -1; @@ -2493,6 +2074,8 @@ recalc_next_free_id(HWND hdlg) c_xta++; else if (temp_hdd[i].bus == HDD_BUS_IDE) c_ide++; + else if (temp_hdd[i].bus == HDD_BUS_ATAPI) + c_atapi++; else if (temp_hdd[i].bus == HDD_BUS_SCSI) c_scsi++; } @@ -2506,7 +2089,7 @@ recalc_next_free_id(HWND hdlg) enable_add = enable_add || (next_free_id >= 0); enable_add = enable_add && ((c_mfm < MFM_NUM) || (c_esdi < ESDI_NUM) || (c_xta < XTA_NUM) || - (c_ide < IDE_NUM) || (c_scsi < SCSI_NUM)); + (c_ide < IDE_NUM) || (c_ide < ATAPI_NUM) || (c_scsi < SCSI_NUM)); enable_add = enable_add && !bus_full(&mfm_tracking, 2); enable_add = enable_add && !bus_full(&esdi_tracking, 2); enable_add = enable_add && !bus_full(&xta_tracking, 2); @@ -2514,21 +2097,18 @@ recalc_next_free_id(HWND hdlg) for (i = 0; i < 2; i++) enable_add = enable_add && !bus_full(&(scsi_tracking[i]), 8); - h = GetDlgItem(hdlg, IDC_BUTTON_HDD_ADD_NEW); - EnableWindow(h, enable_add ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_BUTTON_HDD_ADD); - EnableWindow(h, enable_add ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_BUTTON_HDD_REMOVE); - EnableWindow(h, ((c_mfm == 0) && (c_esdi == 0) && (c_xta == 0) && (c_ide == 0) && (c_scsi == 0)) ? - FALSE : TRUE); + settings_enable_window(hdlg, IDC_BUTTON_HDD_ADD_NEW, enable_add); + settings_enable_window(hdlg, IDC_BUTTON_HDD_ADD, enable_add); + settings_enable_window(hdlg, IDC_BUTTON_HDD_REMOVE, + (c_mfm != 0) || (c_esdi != 0) || (c_xta != 0) || (c_ide != 0) || + (c_atapi != 0) || (c_scsi != 0)); } static void -win_settings_hard_disks_update_item(HWND hwndList, int i, int column) +win_settings_hard_disks_update_item(HWND hdlg, int i, int column) { + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); LVITEM lvI; WCHAR szText[256]; @@ -2550,6 +2130,7 @@ win_settings_hard_disks_update_item(HWND hwndList, int i, int column) wsprintf(szText, plat_get_string(IDS_4610), temp_hdd[i].esdi_channel >> 1, temp_hdd[i].esdi_channel & 1); break; case HDD_BUS_IDE: + case HDD_BUS_ATAPI: wsprintf(szText, plat_get_string(IDS_4611), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); break; case HDD_BUS_SCSI: @@ -2588,11 +2169,12 @@ win_settings_hard_disks_update_item(HWND hwndList, int i, int column) static BOOL -win_settings_hard_disks_recalc_list(HWND hwndList) +win_settings_hard_disks_recalc_list(HWND hdlg) { LVITEM lvI; int i, j = 0; WCHAR szText[256]; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); hd_listview_items = 0; lv1_current_sel = -1; @@ -2617,6 +2199,7 @@ win_settings_hard_disks_recalc_list(HWND hwndList) wsprintf(szText, plat_get_string(IDS_4610), temp_hdd[i].esdi_channel >> 1, temp_hdd[i].esdi_channel & 1); break; case HDD_BUS_IDE: + case HDD_BUS_ATAPI: wsprintf(szText, plat_get_string(IDS_4611), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); break; case HDD_BUS_SCSI: @@ -2635,8 +2218,6 @@ win_settings_hard_disks_recalc_list(HWND hwndList) lvI.pszText = temp_hdd[i].fn + wcslen(usr_path); else lvI.pszText = temp_hdd[i].fn; - lvI.iItem = j; - lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) return FALSE; @@ -2644,8 +2225,6 @@ win_settings_hard_disks_recalc_list(HWND hwndList) lvI.iSubItem = 2; wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].tracks); lvI.pszText = szText; - lvI.iItem = j; - lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) return FALSE; @@ -2653,8 +2232,6 @@ win_settings_hard_disks_recalc_list(HWND hwndList) lvI.iSubItem = 3; wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].hpc); lvI.pszText = szText; - lvI.iItem = j; - lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) return FALSE; @@ -2662,8 +2239,6 @@ win_settings_hard_disks_recalc_list(HWND hwndList) lvI.iSubItem = 4; wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].spt); lvI.pszText = szText; - lvI.iItem = j; - lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) return FALSE; @@ -2671,8 +2246,6 @@ win_settings_hard_disks_recalc_list(HWND hwndList) lvI.iSubItem = 5; wsprintf(szText, plat_get_string(IDS_4098), (temp_hdd[i].tracks * temp_hdd[i].hpc * temp_hdd[i].spt) >> 11); lvI.pszText = szText; - lvI.iItem = j; - lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) return FALSE; @@ -2687,22 +2260,25 @@ win_settings_hard_disks_recalc_list(HWND hwndList) return TRUE; } + static void -win_settings_hard_disks_resize_columns(HWND hwndList) +win_settings_hard_disks_resize_columns(HWND hdlg) { - int iCol; - /* Bus, File, Cylinders, Heads, Sectors, Size */ - int width[C_COLUMNS_HARD_DISKS] = {130, 130, 41, 25, 25, 41}; - for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) { - ListView_SetColumnWidth(hwndList, iCol, MulDiv(width[iCol], dpi, 96)); - } + /* Bus, File, Cylinders, Heads, Sectors, Size */ + int iCol, width[C_COLUMNS_HARD_DISKS] = {130, 130, 41, 25, 25, 41}; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + + for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) + ListView_SetColumnWidth(hwndList, iCol, MulDiv(width[iCol], dpi, 96)); } + static BOOL -win_settings_hard_disks_init_columns(HWND hwndList) +win_settings_hard_disks_init_columns(HWND hdlg) { LVCOLUMN lvc; int iCol; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -2738,7 +2314,7 @@ win_settings_hard_disks_init_columns(HWND hwndList) return FALSE; } - win_settings_hard_disks_resize_columns(hwndList); + win_settings_hard_disks_resize_columns(hdlg); return TRUE; } @@ -2757,16 +2333,6 @@ get_edit_box_contents(HWND hdlg, int id, uint32_t *val) } -static void -get_combo_box_selection(HWND hdlg, int id, uint32_t *val) -{ - HWND h; - - h = GetDlgItem(hdlg, id); - *val = SendMessage(h, CB_GETCURSEL, 0, 0); -} - - static void set_edit_box_contents(HWND hdlg, int id, uint32_t val) { @@ -2781,7 +2347,6 @@ set_edit_box_contents(HWND hdlg, int id, uint32_t val) static int hdconf_initialize_hdt_combo(HWND hdlg) { - HWND h; int i = 0; uint64_t temp_size = 0; uint32_t size_mb = 0; @@ -2789,19 +2354,18 @@ static int hdconf_initialize_hdt_combo(HWND hdlg) selection = 127; - h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); for (i = 0; i < 127; i++) { temp_size = ((uint64_t) hdd_table[i][0]) * hdd_table[i][1] * hdd_table[i][2]; size_mb = (uint32_t) (temp_size >> 11LL); wsprintf(szText, plat_get_string(IDS_2107), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); + settings_add_string(hdlg, IDC_COMBO_HD_TYPE, (LPARAM) szText); if ((tracks == (int) hdd_table[i][0]) && (hpc == (int) hdd_table[i][1]) && (spt == (int) hdd_table[i][2])) selection = i; } - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_4100)); - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_4101)); - SendMessage(h, CB_SETCURSEL, selection, 0); + settings_add_string(hdlg, IDC_COMBO_HD_TYPE, win_get_string(IDS_4100)); + settings_add_string(hdlg, IDC_COMBO_HD_TYPE, win_get_string(IDS_4101)); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_TYPE, selection); return selection; } @@ -2809,11 +2373,9 @@ static int hdconf_initialize_hdt_combo(HWND hdlg) static void recalc_selection(HWND hdlg) { - HWND h; int i = 0; selection = 127; - h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); for (i = 0; i < 127; i++) { if ((tracks == (int) hdd_table[i][0]) && (hpc == (int) hdd_table[i][1]) && @@ -2822,7 +2384,7 @@ recalc_selection(HWND hdlg) } if ((selection == 127) && (hpc == 16) && (spt == 63)) selection = 128; - SendMessage(h, CB_SETCURSEL, selection, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_TYPE, selection); } @@ -2866,36 +2428,27 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20LL)); hdconf_initialize_hdt_combo(hdlg); if (existing & 1) { - h = GetDlgItem(hdlg, IDC_EDIT_HD_SPT); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_HPC); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_CYL); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_SIZE); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); - EnableWindow(h, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_SPT, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_HPC, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_CYL, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_SIZE, FALSE); + settings_enable_window(hdlg, IDC_COMBO_HD_TYPE, FALSE); chs_enabled = 0; } else chs_enabled = 1; add_locations(hdlg); - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); hdd_ptr->bus = HDD_BUS_IDE; max_spt = 63; max_hpc = 255; - SendMessage(h, CB_SETCURSEL, hdd_ptr->bus, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_BUS, hdd_ptr->bus - 1); max_tracks = 266305; recalc_location_controls(hdlg, 1, 0); channel = next_free_ide_channel(); next_free_scsi_id(&id); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - SendMessage(h, CB_SETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); - SendMessage(h, CB_SETCURSEL, id, 0); - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); - SendMessage(h, CB_SETCURSEL, channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_ID, id); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL_IDE, channel); new_hdd.mfm_channel = next_free_binary_channel(&mfm_tracking); new_hdd.esdi_channel = next_free_binary_channel(&esdi_tracking); @@ -2903,25 +2456,17 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM new_hdd.ide_channel = channel; new_hdd.scsi_id = id; - h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME); - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDT_1752); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); + settings_enable_window(hdlg, IDC_EDIT_HD_FILE_NAME, FALSE); + settings_show_window(hdlg, IDT_1752, FALSE); + settings_show_window(hdlg, IDC_PBAR_IMG_CREATE, FALSE); no_update = 0; return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDOK: - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - hdd_ptr->bus = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; + hdd_ptr->bus = settings_get_cur_sel(hdlg, IDC_COMBO_HD_BUS) + 1; /* Make sure no file name is allowed with removable SCSI hard disks. */ if (wcslen(hd_file_name) == 0) { @@ -2939,24 +2484,20 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM switch(hdd_ptr->bus) { case HDD_BUS_MFM: - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - hdd_ptr->mfm_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + hdd_ptr->mfm_channel = settings_get_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL); break; case HDD_BUS_ESDI: - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - hdd_ptr->esdi_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + hdd_ptr->esdi_channel = settings_get_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL); break; case HDD_BUS_XTA: - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - hdd_ptr->xta_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + hdd_ptr->xta_channel = settings_get_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL); break; case HDD_BUS_IDE: - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); - hdd_ptr->ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + case HDD_BUS_ATAPI: + hdd_ptr->ide_channel = settings_get_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL_IDE); break; case HDD_BUS_SCSI: - h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); - hdd_ptr->scsi_id = SendMessage(h, CB_GETCURSEL, 0, 0); + hdd_ptr->scsi_id = settings_get_cur_sel(hdlg, IDC_COMBO_HD_ID); break; } @@ -3012,27 +2553,15 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM size &= 0xfffff; if (size || r) { - h = GetDlgItem(hdlg, IDT_1731); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_CFILE); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); + settings_show_window(hdlg, IDT_1731, FALSE); + settings_show_window(hdlg, IDC_EDIT_HD_FILE_NAME, FALSE); + settings_show_window(hdlg, IDC_CFILE, FALSE); + settings_show_window(hdlg, IDC_PBAR_IMG_CREATE, TRUE); + settings_enable_window(hdlg, IDT_1752, TRUE); h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE); - EnableWindow(h, TRUE); - ShowWindow(h, SW_SHOW); SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) r); SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0); - - h = GetDlgItem(hdlg, IDT_1752); - EnableWindow(h, TRUE); - ShowWindow(h, SW_SHOW); } h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE); @@ -3086,7 +2615,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM return TRUE; case IDC_CFILE: - if (!file_dlg_w(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1))) { + if (!file_dlg_w(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1))) { if (!wcschr(wopenfilestring, L'.')) { if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) { twcs = &wopenfilestring[wcslen(wopenfilestring)]; @@ -3173,16 +2702,11 @@ hdd_add_file_open_error: set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); recalc_selection(hdlg); - h = GetDlgItem(hdlg, IDC_EDIT_HD_SPT); - EnableWindow(h, TRUE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_HPC); - EnableWindow(h, TRUE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_CYL); - EnableWindow(h, TRUE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_SIZE); - EnableWindow(h, TRUE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); - EnableWindow(h, TRUE); + settings_enable_window(hdlg, IDC_EDIT_HD_SPT, TRUE); + settings_enable_window(hdlg, IDC_EDIT_HD_HPC, TRUE); + settings_enable_window(hdlg, IDC_EDIT_HD_CYL, TRUE); + settings_enable_window(hdlg, IDC_EDIT_HD_SIZE, TRUE); + settings_enable_window(hdlg, IDC_COMBO_HD_TYPE, TRUE); chs_enabled = 1; @@ -3319,7 +2843,7 @@ hdd_add_file_open_error: return FALSE; no_update = 1; - get_combo_box_selection(hdlg, IDC_COMBO_HD_TYPE, &temp); + temp = settings_get_cur_sel(hdlg, IDC_COMBO_HD_TYPE); if ((temp != selection) && (temp != 127) && (temp != 128)) { selection = temp; tracks = hdd_table[selection][0]; @@ -3375,83 +2899,76 @@ hdd_add_file_open_error: no_update = 1; recalc_location_controls(hdlg, 1, 0); - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - b = SendMessage(h,CB_GETCURSEL,0,0) + 1; - if (b == hdd_ptr->bus) - goto hd_add_bus_skip; + b = settings_get_cur_sel(hdlg, IDC_COMBO_HD_BUS) + 1; + if (b != hdd_ptr->bus) { + hdd_ptr->bus = b; - hdd_ptr->bus = b; + switch(hdd_ptr->bus) { + case HDD_BUS_DISABLED: + default: + max_spt = max_hpc = max_tracks = 0; + break; + case HDD_BUS_MFM: + max_spt = 26; /* 17 for MFM, 26 for RLL. */ + max_hpc = 15; + max_tracks = 2047; + break; + case HDD_BUS_XTA: + max_spt = 63; + max_hpc = 16; + max_tracks = 1023; + break; + case HDD_BUS_ESDI: + max_spt = 99; /* ESDI drives usually had 32 to 43 sectors per track. */ + max_hpc = 16; + max_tracks = 266305; + break; + case HDD_BUS_IDE: + max_spt = 63; + max_hpc = 255; + max_tracks = 266305; + break; + case HDD_BUS_ATAPI: + case HDD_BUS_SCSI: + max_spt = 99; + max_hpc = 255; + max_tracks = 266305; + break; + } - switch(hdd_ptr->bus) { - case HDD_BUS_DISABLED: - default: - max_spt = max_hpc = max_tracks = 0; - break; - case HDD_BUS_MFM: - max_spt = 26; /* 17 for MFM, 26 for RLL. */ - max_hpc = 15; - max_tracks = 2047; - break; - case HDD_BUS_XTA: - max_spt = 63; - max_hpc = 16; - max_tracks = 1023; - break; - case HDD_BUS_ESDI: - max_spt = 99; /* ESDI drives usually had 32 to 43 sectors per track. */ - max_hpc = 16; - max_tracks = 266305; - break; - case HDD_BUS_IDE: - max_spt = 63; - max_hpc = 255; - max_tracks = 266305; - break; - case HDD_BUS_SCSI: - max_spt = 99; - max_hpc = 255; - max_tracks = 266305; - break; + if (!chs_enabled) { + settings_enable_window(hdlg, IDC_EDIT_HD_SPT, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_HPC, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_CYL, FALSE); + settings_enable_window(hdlg, IDC_EDIT_HD_SIZE, FALSE); + settings_enable_window(hdlg, IDC_COMBO_HD_TYPE, FALSE); + } + + if (spt > max_spt) { + spt = max_spt; + size = ((uint64_t) tracks * (uint64_t) hpc * (uint64_t) spt) << 9LL; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, (uint32_t) spt); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20)); + recalc_selection(hdlg); + } + + if (hpc > max_hpc) { + hpc = max_hpc; + size = ((uint64_t) tracks * (uint64_t) hpc * (uint64_t) spt) << 9LL; + set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, (uint32_t) hpc); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20)); + recalc_selection(hdlg); + } + + if (tracks > max_tracks) { + tracks = max_tracks; + size = ((uint64_t) tracks * (uint64_t) hpc * (uint64_t) spt) << 9LL; + set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, (uint32_t) tracks); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20)); + recalc_selection(hdlg); + } } - if (!chs_enabled) { - h = GetDlgItem(hdlg, IDC_EDIT_HD_SPT); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_HPC); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_CYL); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_EDIT_HD_SIZE); - EnableWindow(h, FALSE); - h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); - EnableWindow(h, FALSE); - } - - if (spt > max_spt) { - spt = max_spt; - size = ((uint64_t) tracks * (uint64_t) hpc * (uint64_t) spt) << 9LL; - set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, (uint32_t) spt); - set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20)); - recalc_selection(hdlg); - } - - if (hpc > max_hpc) { - hpc = max_hpc; - size = ((uint64_t) tracks * (uint64_t) hpc * (uint64_t) spt) << 9LL; - set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, (uint32_t) hpc); - set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20)); - recalc_selection(hdlg); - } - - if (tracks > max_tracks) { - tracks = max_tracks; - size = ((uint64_t) tracks * (uint64_t) hpc * (uint64_t) spt) << 9LL; - set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, (uint32_t) tracks); - set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (uint32_t) (size >> 20)); - recalc_selection(hdlg); - } - -hd_add_bus_skip: no_update = 0; break; } @@ -3493,6 +3010,7 @@ hard_disk_track(uint8_t id) xta_tracking |= (1 << (temp_hdd[id].xta_channel << 3)); break; case HDD_BUS_IDE: + case HDD_BUS_ATAPI: ide_tracking |= (1 << (temp_hdd[id].ide_channel << 3)); break; case HDD_BUS_SCSI: @@ -3516,6 +3034,7 @@ hard_disk_untrack(uint8_t id) xta_tracking &= ~(1 << (temp_hdd[id].xta_channel << 3)); break; case HDD_BUS_IDE: + case HDD_BUS_ATAPI: ide_tracking &= ~(1 << (temp_hdd[id].ide_channel << 3)); break; case HDD_BUS_SCSI: @@ -3542,7 +3061,6 @@ static BOOL CALLBACK #endif win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h = NULL; int old_sel = 0, b = 0, assign = 0; const uint8_t hd_icons[2] = { 80, 0 }; @@ -3553,17 +3071,15 @@ win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar normalize_hd_list(); /* Normalize the hard disks so that non-disabled hard disks start from index 0, and so they are contiguous. This will cause an emulator reset prompt on the first opening of this category with a messy hard disk list (which can only happen by manually editing the configuration file). */ - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_init_columns(h); - image_list_init(h, (const uint8_t *) hd_icons); - win_settings_hard_disks_recalc_list(h); + win_settings_hard_disks_init_columns(hdlg); + image_list_init(hdlg, IDC_LIST_HARD_DISKS, (const uint8_t *) hd_icons); + win_settings_hard_disks_recalc_list(hdlg); recalc_next_free_id(hdlg); add_locations(hdlg); if (hd_listview_items > 0) { - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_HARD_DISKS, 0); lv1_current_sel = 0; - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - SendMessage(h, CB_SETCURSEL, temp_hdd[0].bus - 1, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_BUS, temp_hdd[0].bus - 1); } else lv1_current_sel = -1; recalc_location_controls(hdlg, 0, 0); @@ -3583,13 +3099,12 @@ win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar else if (lv1_current_sel == -1) { ignore_change = 1; lv1_current_sel = old_sel; - ListView_SetItemState(h, lv1_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_HARD_DISKS, lv1_current_sel); ignore_change = 0; return FALSE; } ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - SendMessage(h, CB_SETCURSEL, temp_hdd[lv1_current_sel].bus - 1, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_BUS, temp_hdd[lv1_current_sel].bus - 1); recalc_location_controls(hdlg, 0, 0); ignore_change = 0; } @@ -3599,80 +3114,54 @@ win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar if (ignore_change && (LOWORD(wParam) != IDC_BUTTON_HDD_ADD) && (LOWORD(wParam) != IDC_BUTTON_HDD_ADD_NEW) && (LOWORD(wParam) != IDC_BUTTON_HDD_REMOVE)) return FALSE; - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_COMBO_HD_BUS: ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; - if (b == temp_hdd[lv1_current_sel].bus) - goto hd_bus_skip; - hard_disk_untrack(lv1_current_sel); - assign = (temp_hdd[lv1_current_sel].bus == b) ? 0 : 1; - temp_hdd[lv1_current_sel].bus = b; - recalc_location_controls(hdlg, 0, assign); - hard_disk_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_update_item(h, lv1_current_sel, 0); -hd_bus_skip: + b = settings_get_cur_sel(hdlg, IDC_COMBO_HD_BUS) + 1; + if (b != temp_hdd[lv1_current_sel].bus) { + hard_disk_untrack(lv1_current_sel); + assign = (temp_hdd[lv1_current_sel].bus == b) ? 0 : 1; + temp_hdd[lv1_current_sel].bus = b; + recalc_location_controls(hdlg, 0, assign); + hard_disk_track(lv1_current_sel); + win_settings_hard_disks_update_item(hdlg, lv1_current_sel, 0); + } ignore_change = 0; return FALSE; case IDC_COMBO_HD_CHANNEL: ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); hard_disk_untrack(lv1_current_sel); - if (temp_hdd[lv1_current_sel].bus == HDD_BUS_MFM) - temp_hdd[lv1_current_sel].mfm_channel = SendMessage(h, CB_GETCURSEL, 0, 0); - else if (temp_hdd[lv1_current_sel].bus == HDD_BUS_ESDI) - temp_hdd[lv1_current_sel].esdi_channel = SendMessage(h, CB_GETCURSEL, 0, 0); - else if (temp_hdd[lv1_current_sel].bus == HDD_BUS_XTA) - temp_hdd[lv1_current_sel].xta_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_hdd[lv1_current_sel].channel = settings_get_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL); hard_disk_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_update_item(h, lv1_current_sel, 0); + win_settings_hard_disks_update_item(hdlg, lv1_current_sel, 0); ignore_change = 0; return FALSE; case IDC_COMBO_HD_CHANNEL_IDE: ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); hard_disk_untrack(lv1_current_sel); - temp_hdd[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_hdd[lv1_current_sel].ide_channel = settings_get_cur_sel(hdlg, IDC_COMBO_HD_CHANNEL_IDE); hard_disk_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_update_item(h, lv1_current_sel, 0); + win_settings_hard_disks_update_item(hdlg, lv1_current_sel, 0); ignore_change = 0; return FALSE; case IDC_COMBO_HD_ID: ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); hard_disk_untrack(lv1_current_sel); - temp_hdd[lv1_current_sel].scsi_id = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_hdd[lv1_current_sel].scsi_id = settings_get_cur_sel(hdlg, IDC_COMBO_HD_ID); hard_disk_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_update_item(h, lv1_current_sel, 0); + win_settings_hard_disks_update_item(hdlg, lv1_current_sel, 0); ignore_change = 0; return FALSE; case IDC_BUTTON_HDD_ADD: - hard_disk_add_open(hdlg, 1); - if (hard_disk_added) { - ignore_change = 1; - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_recalc_list(h); - recalc_next_free_id(hdlg); - hard_disk_track_all(); - ignore_change = 0; - } - return FALSE; - case IDC_BUTTON_HDD_ADD_NEW: - hard_disk_add_open(hdlg, 0); + hard_disk_add_open(hdlg, (LOWORD(wParam) == IDC_BUTTON_HDD_ADD)); if (hard_disk_added) { ignore_change = 1; - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_recalc_list(h); + win_settings_hard_disks_recalc_list(hdlg); recalc_next_free_id(hdlg); hard_disk_track_all(); ignore_change = 0; @@ -3685,14 +3174,12 @@ hd_bus_skip: temp_hdd[lv1_current_sel].bus = HDD_BUS_DISABLED; /* Only set the bus to zero, the list normalize code below will take care of turning this entire entry to a complete zero. */ normalize_hd_list(); /* Normalize the hard disks so that non-disabled hard disks start from index 0, and so they are contiguous. */ ignore_change = 1; - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_recalc_list(h); + win_settings_hard_disks_recalc_list(hdlg); recalc_next_free_id(hdlg); if (hd_listview_items > 0) { - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_HARD_DISKS, 0); lv1_current_sel = 0; - h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - SendMessage(h, CB_SETCURSEL, temp_hdd[0].bus - 1, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_HD_BUS, temp_hdd[0].bus - 1); } else lv1_current_sel = -1; recalc_location_controls(hdlg, 0, 0); @@ -3701,9 +3188,8 @@ hd_bus_skip: } case WM_DPICHANGED_AFTERPARENT: - h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); - win_settings_hard_disks_resize_columns(h); - image_list_init(h, (const uint8_t *) hd_icons); + win_settings_hard_disks_resize_columns(hdlg); + image_list_init(hdlg, IDC_LIST_HARD_DISKS, (const uint8_t *) hd_icons); break; default: return FALSE; @@ -3728,12 +3214,13 @@ combo_id_to_format_string_id(int combo_id) static BOOL -win_settings_floppy_drives_recalc_list(HWND hwndList) +win_settings_floppy_drives_recalc_list(HWND hdlg) { LVITEM lvI; int i = 0; char s[256], *t; WCHAR szText[256]; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.state = 0; @@ -3758,7 +3245,6 @@ win_settings_floppy_drives_recalc_list(HWND hwndList) lvI.iSubItem = 1; lvI.pszText = plat_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061); - lvI.iItem = i; lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) @@ -3766,8 +3252,6 @@ win_settings_floppy_drives_recalc_list(HWND hwndList) lvI.iSubItem = 2; lvI.pszText = plat_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061); - lvI.iItem = i; - lvI.iImage = 0; if (ListView_SetItem(hwndList, &lvI) == -1) return FALSE; @@ -3778,11 +3262,12 @@ win_settings_floppy_drives_recalc_list(HWND hwndList) static BOOL -win_settings_cdrom_drives_recalc_list(HWND hwndList) +win_settings_cdrom_drives_recalc_list(HWND hdlg) { LVITEM lvI; int i = 0, fsid = 0; WCHAR szText[256]; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -3831,13 +3316,15 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList) return TRUE; } + static BOOL -win_settings_mo_drives_recalc_list(HWND hwndList) +win_settings_mo_drives_recalc_list(HWND hdlg) { LVITEM lvI; int i = 0, fsid = 0; WCHAR szText[256]; - char szType[30]; + char szType[30]; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -3893,12 +3380,14 @@ win_settings_mo_drives_recalc_list(HWND hwndList) return TRUE; } + static BOOL -win_settings_zip_drives_recalc_list(HWND hwndList) +win_settings_zip_drives_recalc_list(HWND hdlg) { LVITEM lvI; int i = 0, fsid = 0; WCHAR szText[256]; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -3944,17 +3433,21 @@ win_settings_zip_drives_recalc_list(HWND hwndList) static void -win_settings_floppy_drives_resize_columns(HWND hwndList) +win_settings_floppy_drives_resize_columns(HWND hdlg) { - ListView_SetColumnWidth(hwndList, 0, MulDiv(250, dpi, 96)); - ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96)); - ListView_SetColumnWidth(hwndList, 2, MulDiv(75, dpi, 96)); + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); + + ListView_SetColumnWidth(hwndList, 0, MulDiv(250, dpi, 96)); + ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96)); + ListView_SetColumnWidth(hwndList, 2, MulDiv(75, dpi, 96)); } + static BOOL -win_settings_floppy_drives_init_columns(HWND hwndList) +win_settings_floppy_drives_init_columns(HWND hdlg) { LVCOLUMN lvc; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -3985,22 +3478,26 @@ win_settings_floppy_drives_init_columns(HWND hwndList) if (ListView_InsertColumn(hwndList, 2, &lvc) == -1) return FALSE; - win_settings_floppy_drives_resize_columns(hwndList); + win_settings_floppy_drives_resize_columns(hdlg); return TRUE; } static void -win_settings_cdrom_drives_resize_columns(HWND hwndList) +win_settings_cdrom_drives_resize_columns(HWND hdlg) { - ListView_SetColumnWidth(hwndList, 0, MulDiv(342, dpi, 96)); - ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96)); + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + + ListView_SetColumnWidth(hwndList, 0, MulDiv(342, dpi, 96)); + ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96)); } + static BOOL -win_settings_cdrom_drives_init_columns(HWND hwndList) +win_settings_cdrom_drives_init_columns(HWND hdlg) { LVCOLUMN lvc; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -4022,21 +3519,26 @@ win_settings_cdrom_drives_init_columns(HWND hwndList) if (ListView_InsertColumn(hwndList, 1, &lvc) == -1) return FALSE; - win_settings_cdrom_drives_resize_columns(hwndList); + win_settings_cdrom_drives_resize_columns(hdlg); return TRUE; } + static void -win_settings_mo_drives_resize_columns(HWND hwndList) +win_settings_mo_drives_resize_columns(HWND hdlg) { - ListView_SetColumnWidth(hwndList, 0, MulDiv(120, dpi, 96)); - ListView_SetColumnWidth(hwndList, 1, MulDiv(260, dpi, 96)); + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); + + ListView_SetColumnWidth(hwndList, 0, MulDiv(120, dpi, 96)); + ListView_SetColumnWidth(hwndList, 1, MulDiv(260, dpi, 96)); } + static BOOL -win_settings_mo_drives_init_columns(HWND hwndList) +win_settings_mo_drives_init_columns(HWND hdlg) { LVCOLUMN lvc; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -4058,21 +3560,26 @@ win_settings_mo_drives_init_columns(HWND hwndList) if (ListView_InsertColumn(hwndList, 1, &lvc) == -1) return FALSE; - win_settings_mo_drives_resize_columns(hwndList); + win_settings_mo_drives_resize_columns(hdlg); return TRUE; } + static void -win_settings_zip_drives_resize_columns(HWND hwndList) +win_settings_zip_drives_resize_columns(HWND hdlg) { - ListView_SetColumnWidth(hwndList, 0, MulDiv(342, dpi, 96)); - ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96)); + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); + + ListView_SetColumnWidth(hwndList, 0, MulDiv(342, dpi, 96)); + ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96)); } + static BOOL -win_settings_zip_drives_init_columns(HWND hwndList) +win_settings_zip_drives_init_columns(HWND hdlg) { LVCOLUMN lvc; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -4094,7 +3601,7 @@ win_settings_zip_drives_init_columns(HWND hwndList) if (ListView_InsertColumn(hwndList, 1, &lvc) == -1) return FALSE; - win_settings_zip_drives_resize_columns(hwndList); + win_settings_zip_drives_resize_columns(hdlg); return TRUE; } @@ -4118,11 +3625,12 @@ get_selected_drive(HWND hdlg, int id) static void -win_settings_floppy_drives_update_item(HWND hwndList, int i) +win_settings_floppy_drives_update_item(HWND hdlg, int i) { LVITEM lvI; char s[256], *t; WCHAR szText[256]; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -4164,11 +3672,12 @@ win_settings_floppy_drives_update_item(HWND hwndList, int i) static void -win_settings_cdrom_drives_update_item(HWND hwndList, int i) +win_settings_cdrom_drives_update_item(HWND hdlg, int i) { LVITEM lvI; WCHAR szText[256]; int fsid; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -4215,12 +3724,13 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i) static void -win_settings_mo_drives_update_item(HWND hwndList, int i) +win_settings_mo_drives_update_item(HWND hdlg, int i) { LVITEM lvI; WCHAR szText[256]; - char szType[30]; + char szType[30]; int fsid; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -4273,11 +3783,12 @@ win_settings_mo_drives_update_item(HWND hwndList, int i) static void -win_settings_zip_drives_update_item(HWND hwndList, int i) +win_settings_zip_drives_update_item(HWND hdlg, int i) { LVITEM lvI; WCHAR szText[256]; int fsid; + HWND hwndList = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; @@ -4322,140 +3833,99 @@ static void cdrom_add_locations(HWND hdlg) { LPTSTR lptsTemp; - HWND h; int i = 0; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); for (i = CDROM_BUS_DISABLED; i <= CDROM_BUS_SCSI; i++) { if ((i == CDROM_BUS_DISABLED) || (i >= CDROM_BUS_ATAPI)) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(combo_id_to_string_id(i))); + settings_add_string(hdlg, IDC_COMBO_CD_BUS, win_get_string(combo_id_to_string_id(i))); } - h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED); for (i = 1; i <= 72; i++) { wsprintf(lptsTemp, L"%ix", i); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_CD_SPEED, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); for (i = 0; i < 16; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4098), i); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_CD_ID, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); for (i = 0; i < 8; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_CD_CHANNEL_IDE, (LPARAM) lptsTemp); } free(lptsTemp); } -static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) +static void +cdrom_recalc_location_controls(HWND hdlg, int assign_id) { int i = 0; - HWND h; - int bus = temp_cdrom[lv2_current_sel].bus_type; - for (i = IDT_1741; i < (IDT_1742 + 1); i++) { - h = GetDlgItem(hdlg, i); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } + for (i = IDT_1741; i < (IDT_1742 + 1); i++) + settings_show_window(hdlg, i, FALSE); + settings_show_window(hdlg, IDC_COMBO_CD_ID, FALSE); + settings_show_window(hdlg, IDC_COMBO_CD_CHANNEL_IDE, FALSE); + settings_show_window(hdlg, IDC_COMBO_CD_SPEED, bus != CDROM_BUS_DISABLED); + settings_show_window(hdlg, IDT_1758, bus != CDROM_BUS_DISABLED); - h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED); - if (bus == CDROM_BUS_DISABLED) { - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } else { - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].speed - 1, 0); - } - - h = GetDlgItem(hdlg, IDT_1758); - if (bus == CDROM_BUS_DISABLED) { - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } else { - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - } + if (bus != CDROM_BUS_DISABLED) + settings_set_cur_sel(hdlg, IDC_COMBO_CD_SPEED, temp_cdrom[lv2_current_sel].speed - 1); switch(bus) { case CDROM_BUS_ATAPI: /* ATAPI */ - h = GetDlgItem(hdlg, IDT_1742); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1742, TRUE); + settings_show_window(hdlg, IDC_COMBO_CD_CHANNEL_IDE, TRUE); if (assign_id) temp_cdrom[lv2_current_sel].ide_channel = next_free_ide_channel(); - h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].ide_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_CD_CHANNEL_IDE, temp_cdrom[lv2_current_sel].ide_channel); break; case CDROM_BUS_SCSI: /* SCSI */ - h = GetDlgItem(hdlg, IDT_1741); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1741, TRUE); + settings_show_window(hdlg, IDC_COMBO_CD_ID, TRUE); if (assign_id) next_free_scsi_id((uint8_t *) &temp_cdrom[lv2_current_sel].scsi_device_id); - h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].scsi_device_id, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_CD_ID, temp_cdrom[lv2_current_sel].scsi_device_id); break; } } + static void mo_add_locations(HWND hdlg) { LPTSTR lptsTemp; char *temp; - HWND h; int i = 0; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); temp = (char*) malloc(30*sizeof(char)); - h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); for (i = MO_BUS_DISABLED; i <= MO_BUS_SCSI; i++) { if ((i == MO_BUS_DISABLED) || (i >= MO_BUS_ATAPI)) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(combo_id_to_string_id(i))); + settings_add_string(hdlg, IDC_COMBO_MO_BUS, win_get_string(combo_id_to_string_id(i))); } - h = GetDlgItem(hdlg, IDC_COMBO_MO_ID); for (i = 0; i < 16; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4098), i); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_MO_ID, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE); for (i = 0; i < 8; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_MO_CHANNEL_IDE, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE); - for (int i=0; i < KNOWN_MO_DRIVE_TYPES; i++) { + for (int i = 0; i < KNOWN_MO_DRIVE_TYPES; i++) { memset(temp, 0, 30); memcpy(temp, mo_drive_types[i].vendor, 8); temp[strlen(temp)] = ' '; @@ -4464,7 +3934,7 @@ mo_add_locations(HWND hdlg) memcpy(temp + strlen(temp), mo_drive_types[i].revision, 4); mbstowcs(lptsTemp, temp, strlen(temp)+1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_MO_TYPE, (LPARAM) lptsTemp); } free(temp); @@ -4476,69 +3946,36 @@ static void mo_recalc_location_controls(HWND hdlg, int assign_id) { int i = 0; - HWND h; - int bus = temp_mo_drives[lv1_current_sel].bus_type; - for (i = IDT_1771; i < (IDT_1772 + 1); i++) { - h = GetDlgItem(hdlg, i); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } + for (i = IDT_1771; i < (IDT_1772 + 1); i++) + settings_show_window(hdlg, i, FALSE); + settings_show_window(hdlg, IDC_COMBO_MO_ID, FALSE); + settings_show_window(hdlg, IDC_COMBO_MO_CHANNEL_IDE, FALSE); + settings_show_window(hdlg, IDC_COMBO_MO_TYPE, bus != MO_BUS_DISABLED); + settings_show_window(hdlg, IDT_1773, bus != MO_BUS_DISABLED); - h = GetDlgItem(hdlg, IDC_COMBO_MO_ID); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE); - if (bus == MO_BUS_DISABLED) { - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } else { - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_mo_drives[lv1_current_sel].type, 0); - } - - h = GetDlgItem(hdlg, IDT_1773); - if (bus == CDROM_BUS_DISABLED) { - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } else { - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - } + if (bus != MO_BUS_DISABLED) + settings_set_cur_sel(hdlg, IDC_COMBO_MO_TYPE, temp_mo_drives[lv1_current_sel].type); switch(bus) { case MO_BUS_ATAPI: /* ATAPI */ - h = GetDlgItem(hdlg, IDT_1772); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1772, TRUE); + settings_show_window(hdlg, IDC_COMBO_MO_CHANNEL_IDE, TRUE); if (assign_id) temp_mo_drives[lv1_current_sel].ide_channel = next_free_ide_channel(); - h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_mo_drives[lv1_current_sel].ide_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_MO_CHANNEL_IDE, temp_mo_drives[lv1_current_sel].ide_channel); break; case MO_BUS_SCSI: /* SCSI */ - h = GetDlgItem(hdlg, IDT_1771); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1771, TRUE); + settings_show_window(hdlg, IDC_COMBO_MO_ID, TRUE); if (assign_id) next_free_scsi_id((uint8_t *) &temp_mo_drives[lv1_current_sel].scsi_device_id); - h = GetDlgItem(hdlg, IDC_COMBO_MO_ID); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_mo_drives[lv1_current_sel].scsi_device_id, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_MO_ID, temp_mo_drives[lv1_current_sel].scsi_device_id); break; } } @@ -4548,27 +3985,23 @@ static void zip_add_locations(HWND hdlg) { LPTSTR lptsTemp; - HWND h; int i = 0; lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS); for (i = ZIP_BUS_DISABLED; i <= ZIP_BUS_SCSI; i++) { if ((i == ZIP_BUS_DISABLED) || (i >= ZIP_BUS_ATAPI)) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(combo_id_to_string_id(i))); + settings_add_string(hdlg, IDC_COMBO_ZIP_BUS, win_get_string(combo_id_to_string_id(i))); } - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_ID); for (i = 0; i < 16; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4098), i); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_ZIP_ID, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE); for (i = 0; i < 8; i++) { wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + settings_add_string(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE, (LPARAM) lptsTemp); } free(lptsTemp); @@ -4579,60 +4012,36 @@ static void zip_recalc_location_controls(HWND hdlg, int assign_id) { int i = 0; - HWND h; int bus = temp_zip_drives[lv2_current_sel].bus_type; - for (i = IDT_1754; i < (IDT_1755 + 1); i++) { - h = GetDlgItem(hdlg, i); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } + for (i = IDT_1754; i < (IDT_1755 + 1); i++) + settings_show_window(hdlg, i, FALSE); + settings_show_window(hdlg, IDC_COMBO_ZIP_ID, FALSE); + settings_show_window(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE, FALSE); + settings_show_window(hdlg, IDC_CHECK250, bus != ZIP_BUS_DISABLED); - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_ID); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE); - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - - h = GetDlgItem(hdlg, IDC_CHECK250); - if (bus == ZIP_BUS_DISABLED) { - EnableWindow(h, FALSE); - ShowWindow(h, SW_HIDE); - } else { - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, BM_SETCHECK, temp_zip_drives[lv2_current_sel].is_250, 0); - } + if (bus != ZIP_BUS_DISABLED) + settings_set_check(hdlg, IDC_CHECK250, temp_zip_drives[lv2_current_sel].is_250); switch(bus) { case ZIP_BUS_ATAPI: /* ATAPI */ - h = GetDlgItem(hdlg, IDT_1755); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1755, TRUE); + settings_show_window(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE, TRUE); if (assign_id) temp_zip_drives[lv2_current_sel].ide_channel = next_free_ide_channel(); - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_zip_drives[lv2_current_sel].ide_channel, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE, temp_zip_drives[lv2_current_sel].ide_channel); break; case ZIP_BUS_SCSI: /* SCSI */ - h = GetDlgItem(hdlg, IDT_1754); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); + settings_show_window(hdlg, IDT_1754, TRUE); + settings_show_window(hdlg, IDC_COMBO_ZIP_ID, TRUE); if (assign_id) next_free_scsi_id((uint8_t *) &temp_zip_drives[lv2_current_sel].scsi_device_id); - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_ID); - ShowWindow(h, SW_SHOW); - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_zip_drives[lv2_current_sel].scsi_device_id, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_ID, temp_zip_drives[lv2_current_sel].scsi_device_id); break; } } @@ -4705,7 +4114,6 @@ static BOOL CALLBACK #endif win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h = NULL; int i = 0, old_sel = 0, b = 0, assign = 0; uint32_t b2 = 0; WCHAR szText[256]; @@ -4717,38 +4125,30 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam ignore_change = 1; lv1_current_sel = 0; - h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); - win_settings_floppy_drives_init_columns(h); - image_list_init(h, (const uint8_t *) fd_icons); - win_settings_floppy_drives_recalc_list(h); - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); - h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); + win_settings_floppy_drives_init_columns(hdlg); + image_list_init(hdlg, IDC_LIST_FLOPPY_DRIVES, (const uint8_t *) fd_icons); + win_settings_floppy_drives_recalc_list(hdlg); + settings_listview_select(hdlg, IDC_LIST_FLOPPY_DRIVES, 0); for (i = 0; i < 14; i++) { if (i == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5376)); + settings_add_string(hdlg, IDC_COMBO_FD_TYPE, win_get_string(IDS_5376)); else { mbstowcs(szText, fdd_getname(i), strlen(fdd_getname(i)) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); + settings_add_string(hdlg, IDC_COMBO_FD_TYPE, (LPARAM) szText); } } - SendMessage(h, CB_SETCURSEL, temp_fdd_types[lv1_current_sel], 0); + settings_set_cur_sel(hdlg, IDC_COMBO_FD_TYPE, temp_fdd_types[lv1_current_sel]); - h = GetDlgItem(hdlg, IDC_CHECKTURBO); - SendMessage(h, BM_SETCHECK, temp_fdd_turbo[lv1_current_sel], 0); - - h = GetDlgItem(hdlg, IDC_CHECKBPB); - SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[lv1_current_sel], 0); + settings_set_check(hdlg, IDC_CHECKTURBO, temp_fdd_turbo[lv1_current_sel]); + settings_set_check(hdlg, IDC_CHECKBPB, temp_fdd_check_bpb[lv1_current_sel]); lv2_current_sel = 0; - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_init_columns(h); - image_list_init(h, (const uint8_t *) cd_icons); - win_settings_cdrom_drives_recalc_list(h); - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + win_settings_cdrom_drives_init_columns(hdlg); + image_list_init(hdlg, IDC_LIST_CDROM_DRIVES, (const uint8_t *) cd_icons); + win_settings_cdrom_drives_recalc_list(hdlg); + settings_listview_select(hdlg, IDC_LIST_CDROM_DRIVES, 0); cdrom_add_locations(hdlg); - h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); - switch (temp_cdrom[lv2_current_sel].bus_type) { case CDROM_BUS_DISABLED: default: @@ -4761,9 +4161,7 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam b = 2; break; } - - SendMessage(h, CB_SETCURSEL, b, 0); - + settings_set_cur_sel(hdlg, IDC_COMBO_CD_BUS, b); cdrom_recalc_location_controls(hdlg, 0); ignore_change = 0; @@ -4781,17 +4179,14 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam else if (lv1_current_sel == -1) { ignore_change = 1; lv1_current_sel = old_sel; - ListView_SetItemState(h, lv1_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_FLOPPY_DRIVES, lv1_current_sel); ignore_change = 0; return FALSE; } ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); - SendMessage(h, CB_SETCURSEL, temp_fdd_types[lv1_current_sel], 0); - h = GetDlgItem(hdlg, IDC_CHECKTURBO); - SendMessage(h, BM_SETCHECK, temp_fdd_turbo[lv1_current_sel], 0); - h = GetDlgItem(hdlg, IDC_CHECKBPB); - SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[lv1_current_sel], 0); + settings_set_cur_sel(hdlg, IDC_COMBO_FD_TYPE, temp_fdd_types[lv1_current_sel]); + settings_set_check(hdlg, IDC_CHECKTURBO, temp_fdd_turbo[lv1_current_sel]); + settings_set_check(hdlg, IDC_CHECKBPB, temp_fdd_check_bpb[lv1_current_sel]); ignore_change = 0; } else if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_CDROM_DRIVES)) { old_sel = lv2_current_sel; @@ -4801,14 +4196,12 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam else if (lv2_current_sel == -1) { ignore_change = 1; lv2_current_sel = old_sel; - ListView_SetItemState(h, lv2_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_CDROM_DRIVES, lv2_current_sel); ignore_change = 0; return FALSE; } ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); - switch (temp_cdrom[lv2_current_sel].bus_type) { case CDROM_BUS_DISABLED: default: @@ -4821,10 +4214,9 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam b = 2; break; } + settings_set_cur_sel(hdlg, IDC_COMBO_CD_BUS, b); - SendMessage(h, CB_SETCURSEL, b, 0); - - mo_recalc_location_controls(hdlg, 0); + cdrom_recalc_location_controls(hdlg, 0); ignore_change = 0; } break; @@ -4834,31 +4226,24 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam return FALSE; ignore_change = 1; - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_COMBO_FD_TYPE: - h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); - temp_fdd_types[lv1_current_sel] = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); - win_settings_floppy_drives_update_item(h, lv1_current_sel); + temp_fdd_types[lv1_current_sel] = settings_get_cur_sel(hdlg, IDC_COMBO_FD_TYPE); + win_settings_floppy_drives_update_item(hdlg, lv1_current_sel); break; case IDC_CHECKTURBO: - h = GetDlgItem(hdlg, IDC_CHECKTURBO); - temp_fdd_turbo[lv1_current_sel] = SendMessage(h, BM_GETCHECK, 0, 0); - h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); - win_settings_floppy_drives_update_item(h, lv1_current_sel); + temp_fdd_turbo[lv1_current_sel] = settings_get_check(hdlg, IDC_CHECKTURBO); + win_settings_floppy_drives_update_item(hdlg, lv1_current_sel); break; case IDC_CHECKBPB: - h = GetDlgItem(hdlg, IDC_CHECKBPB); - temp_fdd_check_bpb[lv1_current_sel] = SendMessage(h, BM_GETCHECK, 0, 0); - h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); - win_settings_floppy_drives_update_item(h, lv1_current_sel); + temp_fdd_check_bpb[lv1_current_sel] = settings_get_check(hdlg, IDC_CHECKBPB); + win_settings_floppy_drives_update_item(hdlg, lv1_current_sel); break; case IDC_COMBO_CD_BUS: - h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = settings_get_cur_sel(hdlg, IDC_COMBO_CD_BUS); switch (b) { case 0: b2 = CDROM_BUS_DISABLED; @@ -4879,44 +4264,35 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam temp_cdrom[lv2_current_sel].bus_type = b2; cdrom_recalc_location_controls(hdlg, assign); cdrom_track(lv2_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv2_current_sel); + win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel); break; case IDC_COMBO_CD_ID: - h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); cdrom_untrack(lv2_current_sel); - temp_cdrom[lv2_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_cdrom[lv2_current_sel].scsi_device_id = settings_get_cur_sel(hdlg, IDC_COMBO_CD_ID); cdrom_track(lv2_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv2_current_sel); + win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel); break; case IDC_COMBO_CD_CHANNEL_IDE: - h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); cdrom_untrack(lv2_current_sel); - temp_cdrom[lv2_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_cdrom[lv2_current_sel].ide_channel = settings_get_cur_sel(hdlg, IDC_COMBO_CD_CHANNEL_IDE); cdrom_track(lv2_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv2_current_sel); + win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel); break; case IDC_COMBO_CD_SPEED: - h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED); - temp_cdrom[lv2_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv2_current_sel); + temp_cdrom[lv2_current_sel].speed = settings_get_cur_sel(hdlg, IDC_COMBO_CD_SPEED) + 1; + win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel); break; } ignore_change = 0; case WM_DPICHANGED_AFTERPARENT: - h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); - win_settings_floppy_drives_resize_columns(h); - image_list_init(h, (const uint8_t *) fd_icons); - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_resize_columns(h); - image_list_init(h, (const uint8_t *) cd_icons); + win_settings_floppy_drives_resize_columns(hdlg); + image_list_init(hdlg, IDC_LIST_FLOPPY_DRIVES, (const uint8_t *) fd_icons); + win_settings_cdrom_drives_resize_columns(hdlg); + image_list_init(hdlg, IDC_LIST_CDROM_DRIVES, (const uint8_t *) cd_icons); break; default: return FALSE; @@ -4933,7 +4309,6 @@ static BOOL CALLBACK #endif win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h = NULL; int old_sel = 0, b = 0, assign = 0; uint32_t b2 = 0; const uint8_t mo_icons[3] = { 251, 56, 0 }; @@ -4944,15 +4319,12 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam ignore_change = 1; lv1_current_sel = 0; - h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); - win_settings_mo_drives_init_columns(h); - image_list_init(h, (const uint8_t *) mo_icons); - win_settings_mo_drives_recalc_list(h); - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + win_settings_mo_drives_init_columns(hdlg); + image_list_init(hdlg, IDC_LIST_MO_DRIVES, (const uint8_t *) mo_icons); + win_settings_mo_drives_recalc_list(hdlg); + settings_listview_select(hdlg, IDC_LIST_MO_DRIVES, 0); mo_add_locations(hdlg); - h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); - switch (temp_mo_drives[lv1_current_sel].bus_type) { case MO_BUS_DISABLED: default: @@ -4965,21 +4337,16 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam b = 2; break; } - - SendMessage(h, CB_SETCURSEL, b, 0); - + settings_set_cur_sel(hdlg, IDC_COMBO_MO_BUS, b); mo_recalc_location_controls(hdlg, 0); lv2_current_sel = 0; - h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); - win_settings_zip_drives_init_columns(h); - image_list_init(h, (const uint8_t *) zip_icons); - win_settings_zip_drives_recalc_list(h); - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + win_settings_zip_drives_init_columns(hdlg); + image_list_init(hdlg, IDC_LIST_ZIP_DRIVES, (const uint8_t *) zip_icons); + win_settings_zip_drives_recalc_list(hdlg); + settings_listview_select(hdlg, IDC_LIST_ZIP_DRIVES, 0); zip_add_locations(hdlg); - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS); - switch (temp_zip_drives[lv2_current_sel].bus_type) { case ZIP_BUS_DISABLED: default: @@ -4992,9 +4359,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam b = 2; break; } - - SendMessage(h, CB_SETCURSEL, b, 0); - + settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_BUS, b); zip_recalc_location_controls(hdlg, 0); ignore_change = 0; @@ -5012,14 +4377,12 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam else if (lv1_current_sel == -1) { ignore_change = 1; lv1_current_sel = old_sel; - ListView_SetItemState(h, lv1_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_MO_DRIVES, lv1_current_sel); ignore_change = 0; return FALSE; } ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); - switch (temp_mo_drives[lv1_current_sel].bus_type) { case MO_BUS_DISABLED: default: @@ -5032,8 +4395,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam b = 2; break; } - - SendMessage(h, CB_SETCURSEL, b, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_MO_BUS, b); mo_recalc_location_controls(hdlg, 0); ignore_change = 0; @@ -5045,14 +4407,12 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam else if (lv2_current_sel == -1) { ignore_change = 1; lv2_current_sel = old_sel; - ListView_SetItemState(h, lv2_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_LIST_ZIP_DRIVES, lv2_current_sel); ignore_change = 0; return FALSE; } ignore_change = 1; - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS); - switch (temp_zip_drives[lv2_current_sel].bus_type) { case ZIP_BUS_DISABLED: default: @@ -5065,11 +4425,9 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam b = 2; break; } - - SendMessage(h, CB_SETCURSEL, b, 0); + settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_BUS, b); zip_recalc_location_controls(hdlg, 0); - ignore_change = 0; } break; @@ -5081,8 +4439,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam ignore_change = 1; switch (LOWORD(wParam)) { case IDC_COMBO_MO_BUS: - h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = settings_get_cur_sel(hdlg, IDC_COMBO_MO_BUS); switch (b) { case 0: b2 = MO_BUS_DISABLED; @@ -5103,38 +4460,30 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam temp_mo_drives[lv1_current_sel].bus_type = b2; mo_recalc_location_controls(hdlg, assign); mo_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); - win_settings_mo_drives_update_item(h, lv1_current_sel); + win_settings_mo_drives_update_item(hdlg, lv1_current_sel); break; case IDC_COMBO_MO_ID: - h = GetDlgItem(hdlg, IDC_COMBO_MO_ID); mo_untrack(lv1_current_sel); - temp_mo_drives[lv1_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_mo_drives[lv1_current_sel].scsi_device_id = settings_get_cur_sel(hdlg, IDC_COMBO_MO_ID); mo_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); - win_settings_mo_drives_update_item(h, lv1_current_sel); + win_settings_mo_drives_update_item(hdlg, lv1_current_sel); break; case IDC_COMBO_MO_CHANNEL_IDE: - h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE); mo_untrack(lv1_current_sel); - temp_mo_drives[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_mo_drives[lv1_current_sel].ide_channel = settings_get_cur_sel(hdlg, IDC_COMBO_MO_CHANNEL_IDE); mo_track(lv1_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); - win_settings_mo_drives_update_item(h, lv1_current_sel); + win_settings_mo_drives_update_item(hdlg, lv1_current_sel); break; case IDC_COMBO_MO_TYPE: - h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE); - temp_mo_drives[lv1_current_sel].type = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); - win_settings_mo_drives_update_item(h, lv1_current_sel); + temp_mo_drives[lv1_current_sel].type = settings_get_cur_sel(hdlg, IDC_COMBO_MO_TYPE); + win_settings_mo_drives_update_item(hdlg, lv1_current_sel); break; case IDC_COMBO_ZIP_BUS: - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = settings_get_cur_sel(hdlg, IDC_COMBO_ZIP_BUS); switch (b) { case 0: b2 = ZIP_BUS_DISABLED; @@ -5153,44 +4502,35 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam temp_zip_drives[lv2_current_sel].bus_type = b2; zip_recalc_location_controls(hdlg, assign); zip_track(lv2_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); - win_settings_zip_drives_update_item(h, lv2_current_sel); + win_settings_zip_drives_update_item(hdlg, lv2_current_sel); break; case IDC_COMBO_ZIP_ID: - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_ID); zip_untrack(lv2_current_sel); - temp_zip_drives[lv2_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_zip_drives[lv2_current_sel].scsi_device_id = settings_get_cur_sel(hdlg, IDC_COMBO_ZIP_ID); zip_track(lv2_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); - win_settings_zip_drives_update_item(h, lv2_current_sel); + win_settings_zip_drives_update_item(hdlg, lv2_current_sel); break; case IDC_COMBO_ZIP_CHANNEL_IDE: - h = GetDlgItem(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE); zip_untrack(lv2_current_sel); - temp_zip_drives[lv2_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_zip_drives[lv2_current_sel].ide_channel = settings_get_cur_sel(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE); zip_track(lv2_current_sel); - h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); - win_settings_zip_drives_update_item(h, lv2_current_sel); + win_settings_zip_drives_update_item(hdlg, lv2_current_sel); break; case IDC_CHECK250: - h = GetDlgItem(hdlg, IDC_CHECK250); - temp_zip_drives[lv2_current_sel].is_250 = SendMessage(h, BM_GETCHECK, 0, 0); - h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); - win_settings_zip_drives_update_item(h, lv2_current_sel); + temp_zip_drives[lv2_current_sel].is_250 = settings_get_check(hdlg, IDC_CHECK250); + win_settings_zip_drives_update_item(hdlg, lv2_current_sel); break; } ignore_change = 0; case WM_DPICHANGED_AFTERPARENT: - h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES); - win_settings_mo_drives_resize_columns(h); - image_list_init(h, (const uint8_t *) mo_icons); - h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); - win_settings_zip_drives_resize_columns(h); - image_list_init(h, (const uint8_t *) zip_icons); + win_settings_mo_drives_resize_columns(hdlg); + image_list_init(hdlg, IDC_LIST_MO_DRIVES, (const uint8_t *) mo_icons); + win_settings_zip_drives_resize_columns(hdlg); + image_list_init(hdlg, IDC_LIST_ZIP_DRIVES, (const uint8_t *) zip_icons); break; default: return FALSE; @@ -5318,9 +4658,9 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_init(); displayed_category = -1; h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); - image_list_init(h, (const uint8_t *) cat_icons); + image_list_init(hdlg, IDC_SETTINGSCATLIST, (const uint8_t *) cat_icons); win_settings_main_insert_categories(h); - ListView_SetItemState(h, first_cat, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + settings_listview_select(hdlg, IDC_SETTINGSCATLIST, first_cat); return TRUE; case WM_NOTIFY: if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST)) { @@ -5338,20 +4678,19 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_CLOSE: return win_settings_confirm(hdlg, 0); case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDOK: return win_settings_confirm(hdlg, 1); case IDCANCEL: DestroyWindow(hwndChildDialog); - EndDialog(hdlg, 0); + EndDialog(hdlg, 0); win_notify_dlg_closed(); - return TRUE; + return TRUE; } break; case WM_DPICHANGED: dpi = HIWORD(wParam); - h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); - image_list_init(h, (const uint8_t *) cat_icons); + image_list_init(hdlg, IDC_SETTINGSCATLIST, (const uint8_t *) cat_icons); break; default: return FALSE; diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 51f9ab77a..79bfa0b27 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -30,6 +30,7 @@ #include #include <86box/86box.h> #include <86box/config.h> +#include "../cpu/cpu.h" #include <86box/device.h> #include <86box/keyboard.h> #include <86box/mouse.h> @@ -345,6 +346,23 @@ win_notify_dlg_closed(void) } +void +plat_power_off(void) +{ + confirm_exit = 0; + config_save(); + + /* Deduct a sufficiently large number of cycles that no instructions will + run before the main thread is terminated */ + cycles -= 99999999; + + UnhookWindowsHookEx(hKeyboardHook); + + KillTimer(hwndMain, TIMER_1SEC); + PostQuitMessage(0); +} + + static LRESULT CALLBACK MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -390,6 +408,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_ACTION_RESET_CAD: + pclog("-\n"); pc_send_cad(); break;