From ae66b3f124222806fe02a66e0453da5c12e297e8 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 4 Dec 2017 20:35:05 +0100 Subject: [PATCH] The Windows absolute path checker now considers the forward slash as well; Applied all applicable PCem commits; The PS/1 and PS/2 machines now have the correct graphics cards - fixes the reference diskettes; The open dialog code now changes directory to usr_path after the dialog is closed; Disabled excess logging in the TI SVGA code. --- src/machine/m_ps1.c | 5 +++- src/machine/m_ps2_isa.c | 4 +-- src/machine/m_ps2_mca.c | 8 ++--- src/pit.c | 8 ++--- src/sound/snd_sb_dsp.c | 3 +- src/video/vid_ati_mach64.c | 60 ++++++++++++++++++++++++++++---------- src/video/vid_ti_cf62011.c | 6 ++-- src/win/win.c | 2 +- src/win/win_dialog.c | 2 ++ 9 files changed, 66 insertions(+), 32 deletions(-) diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index 463bc49ad..3ba390f25 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -501,7 +501,10 @@ ps1_setup(int model) serial_remove(2); /* Enable the PS/1 VGA controller. */ - device_add(&ps1vga_device); + if (model == 2011) + device_add(&ps1vga_device); + else + device_add(&ti_cf62011_device); } if (model == 2121) { diff --git a/src/machine/m_ps2_isa.c b/src/machine/m_ps2_isa.c index 89c5c7665..f14106f1e 100644 --- a/src/machine/m_ps2_isa.c +++ b/src/machine/m_ps2_isa.c @@ -18,7 +18,7 @@ #include "../floppy/floppy.h" #include "../floppy/fdd.h" #include "../floppy/fdc.h" -#include "../video/vid_ti_cf62011.h" +#include "../video/vid_vga.h" #include "machine.h" @@ -166,5 +166,5 @@ machine_ps2_m30_286_init(machine_t *model) ps2board_init(); fdc_set_dskchg_activelow(); fdc_set_ps1(); - device_add(&ti_cf62011_device); + device_add(&ps1vga_device); } diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index c96601a0b..c04bc3f27 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -19,7 +19,7 @@ #include "../lpt.h" #include "../mouse.h" #include "../serial.h" -#include "../video/vid_ti_cf62011.h" +#include "../video/vid_vga.h" #include "machine.h" @@ -576,7 +576,7 @@ static void ps2_mca_board_model_50_init() ps2.planar_read = model_50_read; ps2.planar_write = model_50_write; - device_add(&ti_cf62011_device); + device_add(&ps1vga_device); } static void ps2_mca_board_model_55sx_init() @@ -640,7 +640,7 @@ static void ps2_mca_board_model_55sx_init() ps2.planar_read = model_55sx_read; ps2.planar_write = model_55sx_write; - device_add(&ti_cf62011_device); + device_add(&ps1vga_device); } static void mem_encoding_update() @@ -805,7 +805,7 @@ static void ps2_mca_board_model_80_type2_init() mem_mapping_disable(&ps2.expansion_mapping); } - device_add(&ti_cf62011_device); + device_add(&ps1vga_device); } diff --git a/src/pit.c b/src/pit.c index d89a07207..3e93253b6 100644 --- a/src/pit.c +++ b/src/pit.c @@ -101,7 +101,7 @@ static void pit_set_out(PIT *pit, int64_t t, int64_t out) static void pit_load(PIT *pit, int64_t t) { int64_t l = pit->l[t] ? pit->l[t] : 0x10000LL; - timer_process(); + timer_clock(); pit->newcount[t] = 0; pit->disabled[t] = 0; switch (pit->m[t]) @@ -346,11 +346,11 @@ void pit_write(uint16_t addr, uint8_t val, void *p) if (!(val&0x20)) { if (val & 2) - pit->rl[0] = pit->using_timer[0] ? ((int64_t)(pit->c[0] / PITCONST) >> TIMER_SHIFT) : pit->count[0]; + pit->rl[0] = pit_read_timer(pit, 0); if (val & 4) - pit->rl[1] = pit->using_timer[1] ? ((int64_t)(pit->c[1] / PITCONST) >> TIMER_SHIFT) : pit->count[1]; + pit->rl[1] = pit_read_timer(pit, 1); if (val & 8) - pit->rl[2] = pit->using_timer[2] ? ((int64_t)(pit->c[2] / PITCONST) >> TIMER_SHIFT) : pit->count[2]; + pit->rl[2] = pit_read_timer(pit, 2); } if (!(val & 0x10)) { diff --git a/src/sound/snd_sb_dsp.c b/src/sound/snd_sb_dsp.c index be92d4929..16a77675f 100644 --- a/src/sound/snd_sb_dsp.c +++ b/src/sound/snd_sb_dsp.c @@ -1149,8 +1149,7 @@ void sb_poll_i(void *p) void sb_dsp_update(sb_dsp_t *dsp) { - /*this "if" implements two things: speaker on/off and buffer cleanup after stopping audio. */ - if (!dsp->sbenable || dsp->muted) + if (dsp->muted) { dsp->sbdatl=0; dsp->sbdatr=0; diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index ae5cdd93b..ca73f3401 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -171,6 +171,7 @@ typedef struct mach64_t uint32_t linear_base, old_linear_base; + uint32_t io_base; struct { @@ -3119,15 +3120,33 @@ void mach64_overlay_draw(svga_t *svga, int displine) static void mach64_io_remove(mach64_t *mach64) { int c; + uint16_t io_base = 0x02ec; + + switch (mach64->io_base) + { + case 0: + default: + io_base = 0x02ec; + break; + case 1: + io_base = 0x01cc; + break; + case 2: + io_base = 0x01c8; + break; + case 3: + fatal("Attempting to use the reserved value for I/O Base\n"); + return; + } io_removehandler(0x03c0, 0x0020, mach64_in, NULL, NULL, mach64_out, NULL, NULL, mach64); for (c = 0; c < 8; c++) { - io_removehandler((c * 0x1000) + 0x2ec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); - io_removehandler((c * 0x1000) + 0x6ec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); - io_removehandler((c * 0x1000) + 0xaec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); - io_removehandler((c * 0x1000) + 0xeec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); + io_removehandler((c * 0x1000) + 0x0000 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); + io_removehandler((c * 0x1000) + 0x0400 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); + io_removehandler((c * 0x1000) + 0x0800 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); + io_removehandler((c * 0x1000) + 0x0c00 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64); } io_removehandler(0x01ce, 0x0002, mach64_in, NULL, NULL, mach64_out, NULL, NULL, mach64); @@ -3193,10 +3212,22 @@ uint8_t mach64_pci_read(int func, int addr, void *p) case 0x12: return mach64->linear_base >> 16; case 0x13: return mach64->linear_base >> 24; - case 0x14: return 0x01; /*Block decoded IO address*/ - case 0x15: return mach64->block_decoded_io >> 8; - case 0x16: return mach64->block_decoded_io >> 16; - case 0x17: return mach64->block_decoded_io >> 24; + case 0x14: + if (mach64->type == MACH64_VT2) + return 0x01; /*Block decoded IO address*/ + return 0x00; + case 0x15: + if (mach64->type == MACH64_VT2) + return mach64->block_decoded_io >> 8; + return 0x00; + case 0x16: + if (mach64->type == MACH64_VT2) + return mach64->block_decoded_io >> 16; + return 0x00; + case 0x17: + if (mach64->type == MACH64_VT2) + return mach64->block_decoded_io >> 24; + return 0x00; case 0x30: return mach64->pci_regs[0x30] & 0x01; /*BIOS ROM address*/ case 0x31: return 0x00; @@ -3206,7 +3237,7 @@ uint8_t mach64_pci_read(int func, int addr, void *p) case 0x3c: return mach64->int_line; case 0x3d: return PCI_INTA; - case 0x40: return mach64->use_block_decoded_io; + case 0x40: return mach64->use_block_decoded_io | mach64->io_base; } return 0; } @@ -3288,14 +3319,13 @@ void mach64_pci_write(int func, int addr, uint8_t val, void *p) break; case 0x40: + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_remove(mach64); + mach64->io_base = val & 0x03; if (mach64->type == MACH64_VT2) - { - if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) - mach64_io_remove(mach64); mach64->use_block_decoded_io = val & 0x04; - if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) - mach64_io_set(mach64); - } + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_set(mach64); break; } } diff --git a/src/video/vid_ti_cf62011.c b/src/video/vid_ti_cf62011.c index 2049d2dd4..cf65ce532 100644 --- a/src/video/vid_ti_cf62011.c +++ b/src/video/vid_ti_cf62011.c @@ -1,4 +1,4 @@ -/* +/* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent @@ -95,7 +95,7 @@ vid_out(uint16_t addr, uint8_t val, void *priv) if (((addr & 0xfff0) == 0x03d0 || (addr & 0xfff0) == 0x03b0) && !(svga->miscout & 1)) addr ^= 0x60; #endif - pclog("TISVGA_out(%04x, %02x)\n", addr, val); + // pclog("TISVGA_out(%04x, %02x)\n", addr, val); switch (addr) { case 0x0102: @@ -194,7 +194,7 @@ vid_in(uint16_t addr, void *priv) break; } - pclog("TISVGA_in(%04x) = %02x\n", addr, ret); + // pclog("TISVGA_in(%04x) = %02x\n", addr, ret); return(ret); } diff --git a/src/win/win.c b/src/win/win.c index 4f0e0daee..375b8fb4c 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -465,7 +465,7 @@ plat_path_slash(wchar_t *path) int plat_path_abs(wchar_t *path) { - if ((path[1] == L':') || (path[0] == L'\\')) + if ((path[1] == L':') || (path[0] == L'\\') || (path[0] == L'/')) return(1); return(0); diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index c47000f2b..89981f687 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -198,6 +198,8 @@ file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save) r = GetOpenFileName(&ofn); } + plat_chdir(usr_path); + if (r) { wcstombs(openfilestring, wopenfilestring, sizeof(openfilestring)); // pclog("File dialog return true\n");