diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index 8470b69258d..a38de1d475f 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -3672,7 +3672,7 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) * *************************************/ -WRITE32_MEMBER( voodoo_device::voodoo_w ) +void voodoo_device::voodoo_w(offs_t offset, u32 data, u32 mem_mask) { int stall = false; @@ -4137,7 +4137,7 @@ static uint32_t lfb_r(voodoo_device *vd, offs_t offset, bool lfb_3d) * *************************************/ -READ32_MEMBER( voodoo_device::voodoo_r ) +u32 voodoo_device::voodoo_r(offs_t offset) { /* if we have something pending, flush the FIFOs up to the current time */ if (pci.op_pending) @@ -4161,7 +4161,7 @@ READ32_MEMBER( voodoo_device::voodoo_r ) * *************************************/ -READ32_MEMBER( voodoo_banshee_device::banshee_agp_r ) +u32 voodoo_banshee_device::banshee_agp_r(offs_t offset) { uint32_t result; @@ -4221,7 +4221,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_agp_r ) } -READ32_MEMBER( voodoo_banshee_device::banshee_r ) +u32 voodoo_banshee_device::banshee_r(offs_t offset, u32 mem_mask) { uint32_t result = 0xffffffff; @@ -4230,9 +4230,9 @@ READ32_MEMBER( voodoo_banshee_device::banshee_r ) flush_fifos(this, machine().time()); if (offset < 0x80000/4) - result = banshee_io_r(space, offset, mem_mask); + result = banshee_io_r(offset, mem_mask); else if (offset < 0x100000/4) - result = banshee_agp_r(space, offset, mem_mask); + result = banshee_agp_r(offset); else if (offset < 0x200000/4) logerror("%s:banshee_r(2D:%X)\n", machine().describe_context(), (offset*4) & 0xfffff); else if (offset < 0x600000/4) @@ -4255,7 +4255,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_r ) } -READ32_MEMBER( voodoo_banshee_device::banshee_fb_r ) +u32 voodoo_banshee_device::banshee_fb_r(offs_t offset) { uint32_t result = 0xffffffff; @@ -4282,7 +4282,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_fb_r ) } -READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) +u8 voodoo_banshee_device::banshee_vga_r(offs_t offset) { uint8_t result = 0xff; @@ -4377,7 +4377,7 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) } -READ32_MEMBER( voodoo_banshee_device::banshee_io_r ) +u32 voodoo_banshee_device::banshee_io_r(offs_t offset, u32 mem_mask) { uint32_t result; @@ -4401,13 +4401,13 @@ READ32_MEMBER( voodoo_banshee_device::banshee_io_r ) case io_vgad0: case io_vgad4: case io_vgad8: case io_vgadc: result = 0; if (ACCESSING_BITS_0_7) - result |= banshee_vga_r(space, offset*4+0, mem_mask >> 0) << 0; + result |= banshee_vga_r(offset*4+0) << 0; if (ACCESSING_BITS_8_15) - result |= banshee_vga_r(space, offset*4+1, mem_mask >> 8) << 8; + result |= banshee_vga_r(offset*4+1) << 8; if (ACCESSING_BITS_16_23) - result |= banshee_vga_r(space, offset*4+2, mem_mask >> 16) << 16; + result |= banshee_vga_r(offset*4+2) << 16; if (ACCESSING_BITS_24_31) - result |= banshee_vga_r(space, offset*4+3, mem_mask >> 24) << 24; + result |= banshee_vga_r(offset*4+3) << 24; break; default: @@ -4421,7 +4421,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_io_r ) } -READ32_MEMBER( voodoo_banshee_device::banshee_rom_r ) +u32 voodoo_banshee_device::banshee_rom_r(offs_t offset) { logerror("%s:banshee_rom_r(%X)\n", machine().describe_context(), offset*4); return 0xffffffff; @@ -4693,7 +4693,7 @@ int32_t voodoo_device::banshee_2d_w(voodoo_device *vd, offs_t offset, uint32_t d -WRITE32_MEMBER( voodoo_banshee_device::banshee_agp_w ) +void voodoo_banshee_device::banshee_agp_w(offs_t offset, u32 data, u32 mem_mask) { offset &= 0x1ff/4; @@ -4782,16 +4782,16 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_agp_w ) } -WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) +void voodoo_banshee_device::banshee_w(offs_t offset, u32 data, u32 mem_mask) { /* if we have something pending, flush the FIFOs up to the current time */ if (pci.op_pending) flush_fifos(this, machine().time()); if (offset < 0x80000/4) - banshee_io_w(space, offset, data, mem_mask); + banshee_io_w(offset, data, mem_mask); else if (offset < 0x100000/4) - banshee_agp_w(space, offset, data, mem_mask); + banshee_agp_w(offset, data, mem_mask); else if (offset < 0x200000/4) logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", machine().describe_context(), (offset*4) & 0xfffff, data, mem_mask); else if (offset < 0x600000/4) @@ -4813,7 +4813,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) } -WRITE32_MEMBER( voodoo_banshee_device::banshee_fb_w ) +void voodoo_banshee_device::banshee_fb_w(offs_t offset, u32 data, u32 mem_mask) { uint32_t addr = offset*4; @@ -4843,7 +4843,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_fb_w ) } -WRITE8_MEMBER( voodoo_banshee_device::banshee_vga_w ) +void voodoo_banshee_device::banshee_vga_w(offs_t offset, u8 data) { offset &= 0x1f; @@ -4902,7 +4902,7 @@ WRITE8_MEMBER( voodoo_banshee_device::banshee_vga_w ) } -WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w ) +void voodoo_banshee_device::banshee_io_w(offs_t offset, u32 data, u32 mem_mask) { uint32_t old; @@ -5012,13 +5012,13 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w ) case io_vgac0: case io_vgac4: case io_vgac8: case io_vgacc: case io_vgad0: case io_vgad4: case io_vgad8: case io_vgadc: if (ACCESSING_BITS_0_7) - banshee_vga_w(space, offset*4+0, data >> 0, mem_mask >> 0); + banshee_vga_w(offset*4+0, data >> 0); if (ACCESSING_BITS_8_15) - banshee_vga_w(space, offset*4+1, data >> 8, mem_mask >> 8); + banshee_vga_w(offset*4+1, data >> 8); if (ACCESSING_BITS_16_23) - banshee_vga_w(space, offset*4+2, data >> 16, mem_mask >> 16); + banshee_vga_w(offset*4+2, data >> 16); if (ACCESSING_BITS_24_31) - banshee_vga_w(space, offset*4+3, data >> 24, mem_mask >> 24); + banshee_vga_w(offset*4+3, data >> 24); if (LOG_REGISTERS) logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h index 26475f527de..87720ccd38d 100644 --- a/src/devices/video/voodoo.h +++ b/src/devices/video/voodoo.h @@ -1451,8 +1451,8 @@ public: void set_screen(screen_device &screen) { assert(!m_screen); m_screen = &screen; } void set_cpu(cpu_device &cpu) { assert(!m_cpu); m_cpu = &cpu; } - DECLARE_READ32_MEMBER( voodoo_r ); - DECLARE_WRITE32_MEMBER( voodoo_w ); + u32 voodoo_r(offs_t offset); + void voodoo_w(offs_t offset, u32 data, u32 mem_mask = ~0); uint8_t m_fbmem; uint8_t m_tmumem0; @@ -1911,22 +1911,22 @@ class voodoo_banshee_device : public voodoo_device public: voodoo_banshee_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - DECLARE_READ32_MEMBER( banshee_r ); - DECLARE_WRITE32_MEMBER( banshee_w ); - DECLARE_READ32_MEMBER( banshee_fb_r ); - DECLARE_WRITE32_MEMBER( banshee_fb_w ); - DECLARE_READ32_MEMBER( banshee_io_r ); - DECLARE_WRITE32_MEMBER( banshee_io_w ); - DECLARE_READ32_MEMBER( banshee_rom_r ); - DECLARE_READ8_MEMBER(banshee_vga_r); - DECLARE_WRITE8_MEMBER(banshee_vga_w); + u32 banshee_r(offs_t offset, u32 mem_mask = ~0); + void banshee_w(offs_t offset, u32 data, u32 mem_mask = ~0); + u32 banshee_fb_r(offs_t offset); + void banshee_fb_w(offs_t offset, u32 data, u32 mem_mask = ~0); + u32 banshee_io_r(offs_t offset, u32 mem_mask = ~0); + void banshee_io_w(offs_t offset, u32 data, u32 mem_mask = ~0); + u32 banshee_rom_r(offs_t offset); + u8 banshee_vga_r(offs_t offset); + void banshee_vga_w(offs_t offset, u8 data); protected: voodoo_banshee_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t vdt); // device-level overrides - DECLARE_READ32_MEMBER( banshee_agp_r ); - DECLARE_WRITE32_MEMBER( banshee_agp_w ); + u32 banshee_agp_r(offs_t offset); + void banshee_agp_w(offs_t offset, u32 data, u32 mem_mask = ~0); }; diff --git a/src/devices/video/voodoo_pci.cpp b/src/devices/video/voodoo_pci.cpp index 5a78099e01a..191eaec4bf3 100644 --- a/src/devices/video/voodoo_pci.cpp +++ b/src/devices/video/voodoo_pci.cpp @@ -248,13 +248,13 @@ READ32_MEMBER(voodoo_pci_device::vga_r) { uint32_t result = 0; if (ACCESSING_BITS_0_7) - result |= downcast(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 0 + 0xb0, mem_mask >> 0) << 0; + result |= downcast(m_voodoo.target())->banshee_vga_r(offset * 4 + 0 + 0xb0) << 0; if (ACCESSING_BITS_8_15) - result |= downcast(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 1 + 0xb0, mem_mask >> 8) << 8; + result |= downcast(m_voodoo.target())->banshee_vga_r(offset * 4 + 1 + 0xb0) << 8; if (ACCESSING_BITS_16_23) - result |= downcast(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 2 + 0xb0, mem_mask >> 16) << 16; + result |= downcast(m_voodoo.target())->banshee_vga_r(offset * 4 + 2 + 0xb0) << 16; if (ACCESSING_BITS_24_31) - result |= downcast(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 3 + 0xb0, mem_mask >> 24) << 24; + result |= downcast(m_voodoo.target())->banshee_vga_r(offset * 4 + 3 + 0xb0) << 24; if (0) logerror("%s voodoo_pci_device vga_r from offset %02X = %08X & %08X\n", machine().describe_context(), offset * 4, result, mem_mask); return result; @@ -262,13 +262,13 @@ READ32_MEMBER(voodoo_pci_device::vga_r) WRITE32_MEMBER(voodoo_pci_device::vga_w) { if (ACCESSING_BITS_0_7) - downcast(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 0 + 0xb0, data >> 0, mem_mask >> 0); + downcast(m_voodoo.target())->banshee_vga_w(offset * 4 + 0 + 0xb0, data >> 0); if (ACCESSING_BITS_8_15) - downcast(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 1 + 0xb0, data >> 8, mem_mask >> 8); + downcast(m_voodoo.target())->banshee_vga_w(offset * 4 + 1 + 0xb0, data >> 8); if (ACCESSING_BITS_16_23) - downcast(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 2 + 0xb0, data >> 16, mem_mask >> 16); + downcast(m_voodoo.target())->banshee_vga_w(offset * 4 + 2 + 0xb0, data >> 16); if (ACCESSING_BITS_24_31) - downcast(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 3 + 0xb0, data >> 24, mem_mask >> 24); + downcast(m_voodoo.target())->banshee_vga_w(offset * 4 + 3 + 0xb0, data >> 24); if (0) logerror("%s voodoo_pci_device vga_w to offset %04X = %08X & %08X\n", machine().describe_context(), offset * 4, data, mem_mask); diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index 4b230f339d4..a8048e8cd89 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -577,46 +577,68 @@ uint32_t viper_state::screen_update_viper(screen_device &screen, bitmap_rgb32 &b } #ifdef UNUSED_FUNCTION -static inline uint64_t read64le_with_32le_device_handler(read32_delegate handler, address_space &space, offs_t offset, uint64_t mem_mask) +static inline uint64_t read64le_with_32smle_device_handler(read32sm_delegate handler, offs_t offset, uint64_t mem_mask) { uint64_t result = 0; if (ACCESSING_BITS_0_31) - result |= (uint64_t)(handler)(space, offset * 2 + 0, mem_mask >> 0) << 0; + result |= (uint64_t)(handler)(offset * 2 + 0) << 0; if (ACCESSING_BITS_32_63) - result |= (uint64_t)(handler)(space, offset * 2 + 1, mem_mask >> 32) << 32; + result |= (uint64_t)(handler)(offset * 2 + 1) << 32; return result; } -static inline void write64le_with_32le_device_handler(write32_delegate handler, address_space &space, offs_t offset, uint64_t data, uint64_t mem_mask) +static inline uint64_t read64le_with_32sle_device_handler(read32s_delegate handler, offs_t offset, uint64_t mem_mask) +{ + uint64_t result = 0; + if (ACCESSING_BITS_0_31) + result |= (uint64_t)(handler)(offset * 2 + 0, mem_mask >> 0) << 0; + if (ACCESSING_BITS_32_63) + result |= (uint64_t)(handler)(offset * 2 + 1, mem_mask >> 32) << 32; + return result; +} + + +static inline void write64le_with_32sle_device_handler(write32s_delegate handler, offs_t offset, uint64_t data, uint64_t mem_mask) { if (ACCESSING_BITS_0_31) - handler(space, offset * 2 + 0, data >> 0, mem_mask >> 0); + handler(offset * 2 + 0, data >> 0, mem_mask >> 0); if (ACCESSING_BITS_32_63) - handler(space, offset * 2 + 1, data >> 32, mem_mask >> 32); + handler(offset * 2 + 1, data >> 32, mem_mask >> 32); } #endif -static inline uint64_t read64be_with_32le_device_handler(read32_delegate handler, address_space &space, offs_t offset, uint64_t mem_mask) +static inline uint64_t read64be_with_32smle_device_handler(read32sm_delegate handler, offs_t offset, uint64_t mem_mask) { mem_mask = swapendian_int64(mem_mask); uint64_t result = 0; if (ACCESSING_BITS_0_31) - result = (uint64_t)(handler)(space, offset * 2, mem_mask & 0xffffffff); + result = (uint64_t)(handler)(offset * 2); if (ACCESSING_BITS_32_63) - result |= (uint64_t)(handler)(space, offset * 2 + 1, mem_mask >> 32) << 32; + result |= (uint64_t)(handler)(offset * 2 + 1) << 32; + return swapendian_int64(result); +} + +static inline uint64_t read64be_with_32sle_device_handler(read32s_delegate handler, offs_t offset, uint64_t mem_mask) +{ + mem_mask = swapendian_int64(mem_mask); + uint64_t result = 0; + if (ACCESSING_BITS_0_31) + result = (uint64_t)(handler)(offset * 2, mem_mask & 0xffffffff); + if (ACCESSING_BITS_32_63) + result |= (uint64_t)(handler)(offset * 2 + 1, mem_mask >> 32) << 32; return swapendian_int64(result); } -static inline void write64be_with_32le_device_handler(write32_delegate handler, address_space &space, offs_t offset, uint64_t data, uint64_t mem_mask) +static inline void write64be_with_32sle_device_handler(write32s_delegate handler, offs_t offset, uint64_t data, uint64_t mem_mask) { data = swapendian_int64(data); mem_mask = swapendian_int64(mem_mask); if (ACCESSING_BITS_0_31) - handler(space, offset * 2, data & 0xffffffff, mem_mask & 0xffffffff); + handler(offset * 2, data & 0xffffffff, mem_mask & 0xffffffff); if (ACCESSING_BITS_32_63) - handler(space, offset * 2 + 1, data >> 32, mem_mask >> 32); + handler(offset * 2 + 1, data >> 32, mem_mask >> 32); } /*****************************************************************************/ @@ -1723,35 +1745,35 @@ void viper_state::voodoo3_pci_w(int function, int reg, uint32_t data, uint32_t m READ64_MEMBER(viper_state::voodoo3_io_r) { - return read64be_with_32le_device_handler(read32_delegate(FUNC(voodoo_3_device::banshee_io_r), &(*m_voodoo)), space, offset, mem_mask); + return read64be_with_32sle_device_handler(read32s_delegate(FUNC(voodoo_3_device::banshee_io_r), &(*m_voodoo)), offset, mem_mask); } WRITE64_MEMBER(viper_state::voodoo3_io_w) { // printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (uint32_t)(data >> 32), (uint32_t)(data), offset, m_maincpu->pc()); - write64be_with_32le_device_handler(write32_delegate(FUNC(voodoo_3_device::banshee_io_w), &(*m_voodoo)), space, offset, data, mem_mask); + write64be_with_32sle_device_handler(write32s_delegate(FUNC(voodoo_3_device::banshee_io_w), &(*m_voodoo)), offset, data, mem_mask); } READ64_MEMBER(viper_state::voodoo3_r) { - return read64be_with_32le_device_handler(read32_delegate(FUNC(voodoo_3_device::banshee_r), &(*m_voodoo)), space, offset, mem_mask); + return read64be_with_32sle_device_handler(read32s_delegate(FUNC(voodoo_3_device::banshee_r), &(*m_voodoo)), offset, mem_mask); } WRITE64_MEMBER(viper_state::voodoo3_w) { // printf("voodoo3_w: %08X%08X, %08X at %08X\n", (uint32_t)(data >> 32), (uint32_t)(data), offset, m_maincpu->pc()); - write64be_with_32le_device_handler(write32_delegate(FUNC(voodoo_3_device::banshee_w), &(*m_voodoo)), space, offset, data, mem_mask); + write64be_with_32sle_device_handler(write32s_delegate(FUNC(voodoo_3_device::banshee_w), &(*m_voodoo)), offset, data, mem_mask); } READ64_MEMBER(viper_state::voodoo3_lfb_r) { - return read64be_with_32le_device_handler(read32_delegate(FUNC(voodoo_3_device::banshee_fb_r), &(*m_voodoo)), space, offset, mem_mask); + return read64be_with_32smle_device_handler(read32sm_delegate(FUNC(voodoo_3_device::banshee_fb_r), &(*m_voodoo)), offset, mem_mask); } WRITE64_MEMBER(viper_state::voodoo3_lfb_w) { // printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (uint32_t)(data >> 32), (uint32_t)(data), offset, m_maincpu->pc()); - write64be_with_32le_device_handler(write32_delegate(FUNC(voodoo_3_device::banshee_fb_w), &(*m_voodoo)), space, offset, data, mem_mask); + write64be_with_32sle_device_handler(write32s_delegate(FUNC(voodoo_3_device::banshee_fb_w), &(*m_voodoo)), offset, data, mem_mask); } diff --git a/src/mame/machine/konppc.cpp b/src/mame/machine/konppc.cpp index a80009a05d5..4737b68724f 100644 --- a/src/mame/machine/konppc.cpp +++ b/src/mame/machine/konppc.cpp @@ -420,7 +420,7 @@ WRITE32_MEMBER( konppc_device::nwk_fifo_0_w) } else { - m_voodoo[0]->voodoo_w(space, offset ^ 0x80000, data, mem_mask); + m_voodoo[0]->voodoo_w(offset ^ 0x80000, data, mem_mask); } } @@ -437,7 +437,7 @@ WRITE32_MEMBER( konppc_device::nwk_fifo_1_w) } else { - m_voodoo[1]->voodoo_w(space, offset ^ 0x80000, data, mem_mask); + m_voodoo[1]->voodoo_w(offset ^ 0x80000, data, mem_mask); } } @@ -449,7 +449,7 @@ READ32_MEMBER( konppc_device::nwk_voodoo_0_r) } else { - return m_voodoo[0]->voodoo_r(space, offset, mem_mask); + return m_voodoo[0]->voodoo_r(offset); } } @@ -461,7 +461,7 @@ READ32_MEMBER( konppc_device::nwk_voodoo_1_r) } else { - return m_voodoo[1]->voodoo_r(space, offset, mem_mask); + return m_voodoo[1]->voodoo_r(offset); } } @@ -478,7 +478,7 @@ WRITE32_MEMBER( konppc_device::nwk_voodoo_0_w) } else { - m_voodoo[0]->voodoo_w(space, offset, data, mem_mask); + m_voodoo[0]->voodoo_w(offset, data, mem_mask); } } @@ -495,7 +495,7 @@ WRITE32_MEMBER( konppc_device::nwk_voodoo_1_w) } else { - m_voodoo[1]->voodoo_w(space, offset, data, mem_mask); + m_voodoo[1]->voodoo_w(offset, data, mem_mask); } }