diff --git a/src/cpu/x86_ops_fpu.h b/src/cpu/x86_ops_fpu.h index 9ea04b447..11f603c19 100644 --- a/src/cpu/x86_ops_fpu.h +++ b/src/cpu/x86_ops_fpu.h @@ -4,7 +4,6 @@ static int opESCAPE_d8_a16(uint32_t fetchdat) { - //pclog("D8 A16: fetchdat=%02x.\n", (fetchdat >> 3) & 0x1f); return x86_opcodes_d8_a16[(fetchdat >> 3) & 0x1f](fetchdat); } static int @@ -16,7 +15,6 @@ opESCAPE_d8_a32(uint32_t fetchdat) static int opESCAPE_d9_a16(uint32_t fetchdat) { - //pclog("D9 A16: fetchdat=%02x.\n", fetchdat & 0xff); return x86_opcodes_d9_a16[fetchdat & 0xff](fetchdat); } static int @@ -28,7 +26,6 @@ opESCAPE_d9_a32(uint32_t fetchdat) static int opESCAPE_da_a16(uint32_t fetchdat) { - //pclog("DA A16: fetchdat=%02x.\n", fetchdat & 0xff); return x86_opcodes_da_a16[fetchdat & 0xff](fetchdat); } static int @@ -40,7 +37,6 @@ opESCAPE_da_a32(uint32_t fetchdat) static int opESCAPE_db_a16(uint32_t fetchdat) { - //pclog("DB A16: fetchdat=%02x.\n", fetchdat & 0xff); return x86_opcodes_db_a16[fetchdat & 0xff](fetchdat); } static int @@ -52,7 +48,6 @@ opESCAPE_db_a32(uint32_t fetchdat) static int opESCAPE_dc_a16(uint32_t fetchdat) { - //pclog("DC A16: fetchdat=%02x.\n", (fetchdat >> 3) & 0x1f); return x86_opcodes_dc_a16[(fetchdat >> 3) & 0x1f](fetchdat); } static int @@ -64,7 +59,6 @@ opESCAPE_dc_a32(uint32_t fetchdat) static int opESCAPE_dd_a16(uint32_t fetchdat) { - //pclog("DD A16: fetchdat=%02x.\n", fetchdat & 0xff); return x86_opcodes_dd_a16[fetchdat & 0xff](fetchdat); } static int @@ -76,7 +70,6 @@ opESCAPE_dd_a32(uint32_t fetchdat) static int opESCAPE_de_a16(uint32_t fetchdat) { - //pclog("DE A16: fetchdat=%02x.\n", fetchdat & 0xff); return x86_opcodes_de_a16[fetchdat & 0xff](fetchdat); } static int @@ -88,7 +81,6 @@ opESCAPE_de_a32(uint32_t fetchdat) static int opESCAPE_df_a16(uint32_t fetchdat) { - //pclog("DF A16: fetchdat=%02x.\n", fetchdat & 0xff); return x86_opcodes_df_a16[fetchdat & 0xff](fetchdat); } static int @@ -105,15 +97,13 @@ opWAIT(uint32_t fetchdat) return 1; } -#if 0 - if (!cpu_use_dynarec && fpu_softfloat) { -#endif if (fpu_softfloat) { if (fpu_state.swd & FPU_SW_Summary) { - if (cr0 & 0x20) { + if (is486 && (cr0 & 0x20)) x86_int(16); - return 1; - } + else + picint(1 << 13); + return 1; } } CLOCK_CYCLES(4); diff --git a/src/cpu/x86_ops_fpu_2386.h b/src/cpu/x86_ops_fpu_2386.h index 52c24d995..d8996d2e1 100644 --- a/src/cpu/x86_ops_fpu_2386.h +++ b/src/cpu/x86_ops_fpu_2386.h @@ -97,15 +97,10 @@ opWAIT(uint32_t fetchdat) return 1; } -#if 0 - if (!cpu_use_dynarec && fpu_softfloat) { -#endif if (fpu_softfloat) { if (fpu_state.swd & FPU_SW_Summary) { - if (cr0 & 0x20) { - x86_int(16); - return 1; - } + picint(1 << 13); + return 1; } } CLOCK_CYCLES(4); diff --git a/src/cpu/x87.c b/src/cpu/x87.c index 390c06dc2..577fa1a40 100644 --- a/src/cpu/x87.c +++ b/src/cpu/x87.c @@ -355,7 +355,10 @@ FPU_exception(uint32_t fetchdat, uint16_t exceptions, int store) nmi = 1; } #else - picint(1 << 13); + if (is486 && (cr0 & 0x20)) + x86_int(16); + else + picint(1 << 13); #endif // FPU_8087 } return unmasked; diff --git a/src/cpu/x87.h b/src/cpu/x87.h index 060f2fe27..2ad0c7b10 100644 --- a/src/cpu/x87.h +++ b/src/cpu/x87.h @@ -228,12 +228,10 @@ FPU_save_regi_tag(extFloat80_t reg, int tag, int stnr) #define FPU_check_pending_exceptions() \ do { \ if (fpu_state.swd & FPU_SW_Summary) { \ - if (cr0 & 0x20) { \ + if (is486 && (cr0 & 0x20)) \ x86_int(16); \ - return 1; \ - } else { \ + else \ picint(1 << 13); \ - return 1; \ - } \ + return 1; \ } \ } while (0) diff --git a/src/cpu/x87_ops.h b/src/cpu/x87_ops.h index 6be9d7648..e1bc5858a 100644 --- a/src/cpu/x87_ops.h +++ b/src/cpu/x87_ops.h @@ -99,7 +99,10 @@ typedef union { dst = src1 / (double) src2; \ else { \ fpu_log("FPU : divide by zero\n"); \ - picint(1 << 13); \ + if (is486 && (cr0 & 0x20)) \ + x86_int(16); \ + else \ + picint(1 << 13); \ return 1; \ } \ } else \ diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 2312d2920..b109c7731 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -722,7 +722,7 @@ extern int machine_at_pb680_init(const machine_t *); extern int machine_at_pb810_init(const machine_t *); extern int machine_at_mb520n_init(const machine_t *); extern int machine_at_i430vx_init(const machine_t *); -extern int machine_at_hitman_init(const machine_t *); +extern int machine_at_gw2kte_init(const machine_t *); extern int machine_at_ma23c_init(const machine_t *); extern int machine_at_nupro592_init(const machine_t *); diff --git a/src/include/86box/mem.h b/src/include/86box/mem.h index ad89e4b4f..87be14d5b 100644 --- a/src/include/86box/mem.h +++ b/src/include/86box/mem.h @@ -179,6 +179,7 @@ typedef struct _mem_mapping_ { uint32_t base; uint32_t size; + uint32_t base_ignore; uint32_t mask; uint8_t (*read_b)(uint32_t addr, void *priv); @@ -400,6 +401,7 @@ extern void mem_mapping_set_p(mem_mapping_t *, void *priv); extern void mem_mapping_set_addr(mem_mapping_t *, uint32_t base, uint32_t size); +extern void mem_mapping_set_base_ignore(mem_mapping_t *, uint32_t base_ignore); extern void mem_mapping_set_exec(mem_mapping_t *, uint8_t *exec); extern void mem_mapping_set_mask(mem_mapping_t *, uint32_t mask); extern void mem_mapping_disable(mem_mapping_t *); diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 31afb0f01..f80d2d421 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -825,15 +825,15 @@ machine_at_i430vx_init(const machine_t *model) } int -machine_at_hitman_init(const machine_t *model) +machine_at_gw2kte_init(const machine_t *model) { int ret; - ret = bios_load_linear_combined2("roms/machines/hitman/1008CY1T.BIO", - "roms/machines/hitman/1008CY1T.BI1", - "roms/machines/hitman/1008CY1T.BI2", - "roms/machines/hitman/1008CY1T.BI3", - "roms/machines/hitman/1008CY1T.RCV", + ret = bios_load_linear_combined2("roms/machines/gw2kte/1008CY1T.BIO", + "roms/machines/gw2kte/1008CY1T.BI1", + "roms/machines/gw2kte/1008CY1T.BI2", + "roms/machines/gw2kte/1008CY1T.BI3", + "roms/machines/gw2kte/1008CY1T.RCV", 0x3a000, 128); if (bios_only || !ret) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 59d1075bb..729f3dd37 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -11953,16 +11953,14 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, - -/* 430VX */ /* Has a SM(S)C FDC37C932FR Super I/O chip with on-chip KBC with AMI MegaKey (revision '5') KBC firmware. */ { .name = "[i430VX] Gateway 2000 Hitman", - .internal_name = "hitman", + .internal_name = "gw2kte", .type = MACHINE_TYPE_SOCKET7, .chipset = MACHINE_CHIPSET_INTEL_430VX, - .init = machine_at_hitman_init, + .init = machine_at_gw2kte_init, .p1_handler = NULL, .gpio_handler = NULL, .available_flag = MACHINE_AVAILABLE, @@ -11996,8 +11994,6 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, - - /* Has a SM(S)C FDC37C935 Super I/O chip with on-chip KBC with Phoenix MultiKey/42 (version 1.38) KBC firmware. */ { diff --git a/src/mem/mem.c b/src/mem/mem.c index 57dc31e33..70e33ca7e 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -2351,41 +2351,47 @@ mem_mapping_recalc(uint64_t base, uint64_t size) /* In range? */ if (map->enable && (uint64_t) map->base < ((uint64_t) base + (uint64_t) size) && ((uint64_t) map->base + (uint64_t) map->size) > (uint64_t) base) { + uint64_t i_a = (~map->base_ignore) + 0x00000001ULL; + uint64_t i_s = 0x00000000ULL; + uint64_t i_e = map->base_ignore; + uint64_t i_c = 0x00000000ULL; uint64_t start = (map->base < base) ? map->base : base; uint64_t end = (((uint64_t) map->base + (uint64_t) map->size) < (base + size)) ? ((uint64_t) map->base + (uint64_t) map->size) : (base + size); if (start < map->base) start = map->base; - for (c = start; c < end; c += MEM_GRANULARITY_SIZE) { - /* CPU */ - n = !!in_smm; - wp = _mem_wp[c >> MEM_GRANULARITY_BITS]; + for (i_c = i_s; i_c <= i_e; i_c += i_a) { + for (c = (start + i_c); c < (end + i_c); c += MEM_GRANULARITY_SIZE) { + /* CPU */ + n = !!in_smm; + wp = _mem_wp[c >> MEM_GRANULARITY_BITS]; - if (map->exec && mem_mapping_access_allowed(map->flags, - _mem_state[c >> MEM_GRANULARITY_BITS].states[n].x)) - _mem_exec[c >> MEM_GRANULARITY_BITS] = map->exec + (c - map->base); - if (!wp && (map->write_b || map->write_w || map->write_l) && - mem_mapping_access_allowed(map->flags, - _mem_state[c >> MEM_GRANULARITY_BITS].states[n].w)) - write_mapping[c >> MEM_GRANULARITY_BITS] = map; - if ((map->read_b || map->read_w || map->read_l) && - mem_mapping_access_allowed(map->flags, - _mem_state[c >> MEM_GRANULARITY_BITS].states[n].r)) - read_mapping[c >> MEM_GRANULARITY_BITS] = map; + if (map->exec && mem_mapping_access_allowed(map->flags, + _mem_state[c >> MEM_GRANULARITY_BITS].states[n].x)) + _mem_exec[c >> MEM_GRANULARITY_BITS] = map->exec + (c - map->base); + if (!wp && (map->write_b || map->write_w || map->write_l) && + mem_mapping_access_allowed(map->flags, + _mem_state[c >> MEM_GRANULARITY_BITS].states[n].w)) + write_mapping[c >> MEM_GRANULARITY_BITS] = map; + if ((map->read_b || map->read_w || map->read_l) && + mem_mapping_access_allowed(map->flags, + _mem_state[c >> MEM_GRANULARITY_BITS].states[n].r)) + read_mapping[c >> MEM_GRANULARITY_BITS] = map; - /* Bus */ - n |= STATE_BUS; - wp = _mem_wp_bus[c >> MEM_GRANULARITY_BITS]; + /* Bus */ + n |= STATE_BUS; + wp = _mem_wp_bus[c >> MEM_GRANULARITY_BITS]; - if (!wp && (map->write_b || map->write_w || map->write_l) && - mem_mapping_access_allowed(map->flags, - _mem_state[c >> MEM_GRANULARITY_BITS].states[n].w)) - write_mapping_bus[c >> MEM_GRANULARITY_BITS] = map; - if ((map->read_b || map->read_w || map->read_l) && - mem_mapping_access_allowed(map->flags, - _mem_state[c >> MEM_GRANULARITY_BITS].states[n].r)) - read_mapping_bus[c >> MEM_GRANULARITY_BITS] = map; + if (!wp && (map->write_b || map->write_w || map->write_l) && + mem_mapping_access_allowed(map->flags, + _mem_state[c >> MEM_GRANULARITY_BITS].states[n].w)) + write_mapping_bus[c >> MEM_GRANULARITY_BITS] = map; + if ((map->read_b || map->read_w || map->read_l) && + mem_mapping_access_allowed(map->flags, + _mem_state[c >> MEM_GRANULARITY_BITS].states[n].r)) + read_mapping_bus[c >> MEM_GRANULARITY_BITS] = map; + } } } map = map->next; @@ -2597,6 +2603,20 @@ mem_mapping_set_addr(mem_mapping_t *map, uint32_t base, uint32_t size) mem_mapping_recalc(map->base, map->size); } +void +mem_mapping_set_base_ignore(mem_mapping_t *map, uint32_t base_ignore) +{ + /* Remove old mapping. */ + map->enable = 0; + mem_mapping_recalc(map->base, map->size); + + /* Set new mapping. */ + map->enable = 1; + map->base_ignore = base_ignore; + + mem_mapping_recalc(map->base, map->size); +} + void mem_mapping_set_exec(mem_mapping_t *map, uint8_t *exec) { diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index b800c1129..b1fca8feb 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -2481,36 +2481,58 @@ pcnet_readl(uint16_t addr, void *priv) static void pcnet_mmio_writeb(uint32_t addr, uint8_t val, void *priv) { + if (!(addr & 0x10)) { + pcnet_aprom_writeb((nic_t *) priv, addr, val); + return; + } pcnet_write((nic_t *) priv, addr, val, 1); } static void pcnet_mmio_writew(uint32_t addr, uint16_t val, void *priv) { + if (!(addr & 0x10)) { + pcnet_aprom_writeb((nic_t *) priv, addr, val); + pcnet_aprom_writeb((nic_t *) priv, addr + 1, val >> 8); + return; + } pcnet_write((nic_t *) priv, addr, val, 2); } static void pcnet_mmio_writel(uint32_t addr, uint32_t val, void *priv) { + if (!(addr & 0x10)) { + pcnet_aprom_writeb((nic_t *) priv, addr, val); + pcnet_aprom_writeb((nic_t *) priv, addr + 1, val >> 8); + pcnet_aprom_writeb((nic_t *) priv, addr + 2, val >> 16); + pcnet_aprom_writeb((nic_t *) priv, addr + 3, val >> 24); + return; + } pcnet_write((nic_t *) priv, addr, val, 4); } static uint8_t pcnet_mmio_readb(uint32_t addr, void *priv) { + if (!(addr & 0x10)) + return pcnet_aprom_readb((nic_t *) priv, addr); return (pcnet_read((nic_t *) priv, addr, 1)); } static uint16_t pcnet_mmio_readw(uint32_t addr, void *priv) { + if (!(addr & 0x10)) + return pcnet_aprom_readb((nic_t *) priv, addr) | (pcnet_aprom_readb((nic_t *) priv, addr + 1) << 8); return (pcnet_read((nic_t *) priv, addr, 2)); } static uint32_t pcnet_mmio_readl(uint32_t addr, void *priv) { + if (!(addr & 0x10)) + return pcnet_aprom_readb((nic_t *) priv, addr) | (pcnet_aprom_readb((nic_t *) priv, addr + 1) << 8) | (pcnet_aprom_readb((nic_t *) priv, addr + 2) << 16) | (pcnet_aprom_readb((nic_t *) priv, addr + 3) << 24); return (pcnet_read((nic_t *) priv, addr, 4)); } @@ -2607,7 +2629,7 @@ pcnet_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) /* Then let's set the PCI regs. */ pcnet_pci_bar[0].addr_regs[addr & 3] = val; /* Then let's calculate the new I/O base. */ - pcnet_pci_bar[0].addr &= 0xff00; + pcnet_pci_bar[0].addr &= 0xffe0; dev->PCIBase = pcnet_pci_bar[0].addr; /* Log the new base. */ pcnet_log(4, "%s: New I/O base is %04X\n", dev->name, dev->PCIBase); @@ -2685,7 +2707,7 @@ pcnet_pci_read(UNUSED(int func), int addr, void *priv) case 0x0E: return 0; /*Header type */ case 0x10: - return 1; /*I/O space*/ + return pcnet_pci_bar[0].addr_regs[0] | 1; /*I/O space*/ case 0x11: return pcnet_pci_bar[0].addr_regs[1]; case 0x12: diff --git a/src/sound/ymfm/ymfm_fm.ipp b/src/sound/ymfm/ymfm_fm.ipp index 2aa0a216b..f2ec83945 100644 --- a/src/sound/ymfm/ymfm_fm.ipp +++ b/src/sound/ymfm/ymfm_fm.ipp @@ -1473,11 +1473,14 @@ void fm_engine_base::assign_operators() template void fm_engine_base::update_timer(uint32_t tnum, uint32_t enable, int32_t delta_clocks) { + uint32_t subtract = !!(tnum >> 15); + tnum &= 0x7fff; + // if the timer is live, but not currently enabled, set the timer if (enable && !m_timer_running[tnum]) { // period comes from the registers, and is different for each - uint32_t period = (tnum == 0) ? (1024 - m_regs.timer_a_value()) : 16 * (256 - m_regs.timer_b_value()); + uint32_t period = (tnum == 0) ? (1024 - subtract - m_regs.timer_a_value()) : 16 * (256 - subtract - m_regs.timer_b_value()); // caller can also specify a delta to account for other effects period += delta_clocks; @@ -1504,8 +1507,6 @@ void fm_engine_base::update_timer(uint32_t tnum, uint32_t enable, template void fm_engine_base::engine_timer_expired(uint32_t tnum) { - assert(tnum == 0 || tnum == 1); - // update status if (tnum == 0 && m_regs.enable_timer_a()) set_reset_status(STATUS_TIMERA, 0); @@ -1521,8 +1522,11 @@ void fm_engine_base::engine_timer_expired(uint32_t tnum) m_modified_channels |= 1 << chnum; } - // reset - m_timer_running[tnum] = false; + // Make sure the array does not go out of bounds to keep gcc happy + if ((tnum < 2) || (sizeof(m_timer_running) > (2 * sizeof(uint8_t)))) { + // reset + m_timer_running[tnum] = false; + } update_timer(tnum, 1, 0); } diff --git a/src/video/vid_cl54xx.c b/src/video/vid_cl54xx.c index 1adcc14ec..26184dd17 100644 --- a/src/video/vid_cl54xx.c +++ b/src/video/vid_cl54xx.c @@ -4306,6 +4306,9 @@ gd54xx_init(const device_t *info) mem_mapping_disable(&gd54xx->bios_rom.mapping); } + if ((svga->crtc[0x27] <= CIRRUS_ID_CLGD5429) || (!gd54xx->pci && !gd54xx->vlb)) + mem_mapping_set_base_ignore(&gd54xx->linear_mapping, 0xff000000); + mem_mapping_set_p(&svga->mapping, gd54xx); mem_mapping_disable(&gd54xx->mmio_mapping); mem_mapping_disable(&gd54xx->linear_mapping);