From ffa4d2243886bc6b992e6759208ca133c02d8afb Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Wed, 10 Sep 2014 02:54:07 +0000 Subject: [PATCH] mach32,mach64: fixed crash when reading vblank state. --- src/emu/bus/isa/mach32.c | 10 ++++++++++ src/emu/bus/isa/mach32.h | 2 ++ src/emu/video/pc_vga.c | 8 ++++---- src/emu/video/pc_vga.h | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/emu/bus/isa/mach32.c b/src/emu/bus/isa/mach32.c index 4f7496e7209..237e61c39aa 100644 --- a/src/emu/bus/isa/mach32.c +++ b/src/emu/bus/isa/mach32.c @@ -54,6 +54,11 @@ machine_config_constructor mach32_device::device_mconfig_additions() const return MACHINE_CONFIG_NAME( mach32_8514a ); } +void mach32_8514a_device::device_config_complete() +{ + m_vga = dynamic_cast(owner()); +} + void mach32_8514a_device::device_start() { mach8_device::device_start(); @@ -118,6 +123,11 @@ machine_config_constructor mach64_device::device_mconfig_additions() const return MACHINE_CONFIG_NAME( mach64_8514a ); } +void mach64_8514a_device::device_config_complete() +{ + m_vga = dynamic_cast(owner()); +} + void mach64_8514a_device::device_start() { mach32_8514a_device::device_start(); diff --git a/src/emu/bus/isa/mach32.h b/src/emu/bus/isa/mach32.h index 613acab07cf..d5b447d8c74 100644 --- a/src/emu/bus/isa/mach32.h +++ b/src/emu/bus/isa/mach32.h @@ -27,6 +27,7 @@ public: protected: virtual void device_start(); virtual void device_reset(); + virtual void device_config_complete(); UINT16 m_chip_ID; UINT16 m_membounds; @@ -142,6 +143,7 @@ public: protected: virtual void device_start(); virtual void device_reset(); + virtual void device_config_complete(); }; // main SVGA device diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c index c44f5ea8fe8..93e7e2a6354 100644 --- a/src/emu/video/pc_vga.c +++ b/src/emu/video/pc_vga.c @@ -5164,12 +5164,12 @@ READ8_MEMBER(ati_vga_device::mem_r) if(ati.ext_reg[0x3d] & 0x04) { offset &= 0x1ffff; - return vga.memory[(offset+svga.bank_r*0x20000)]; + return vga.memory[(offset+svga.bank_r*0x20000) % vga.svga_intf.vram_size]; } else { offset &= 0xffff; - return vga.memory[(offset+svga.bank_r*0x10000)]; + return vga.memory[(offset+svga.bank_r*0x10000) % vga.svga_intf.vram_size]; } } @@ -5183,12 +5183,12 @@ WRITE8_MEMBER(ati_vga_device::mem_w) if(ati.ext_reg[0x3d] & 0x04) { offset &= 0x1ffff; - vga.memory[(offset+svga.bank_w*0x20000)] = data; + vga.memory[(offset+svga.bank_w*0x20000) % vga.svga_intf.vram_size] = data; } else { offset &= 0xffff; - vga.memory[(offset+svga.bank_w*0x10000)] = data; + vga.memory[(offset+svga.bank_w*0x10000) % vga.svga_intf.vram_size] = data; } } else diff --git a/src/emu/video/pc_vga.h b/src/emu/video/pc_vga.h index f04ea03ae22..7869955ecde 100644 --- a/src/emu/video/pc_vga.h +++ b/src/emu/video/pc_vga.h @@ -340,6 +340,8 @@ public: protected: virtual void device_start(); virtual void device_config_complete(); + vga_device* m_vga; // for pass-through + astring m_vga_tag; // pass-through device tag private: void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw); void ibm8514_wait_draw_ssv(); @@ -349,8 +351,6 @@ private: void ibm8514_write_bg(UINT32 offset); void ibm8514_write(UINT32 offset, UINT32 src); - vga_device* m_vga; // for pass-through - astring m_vga_tag; // pass-through device tag //UINT8* m_vram; // the original 8514/A has it's own VRAM, but most VGA+8514 combination cards will have // only one set of VRAM, so this will only be needed in standalone 8514/A cards //UINT32 m_vramsize;