From 56f1d01eaaf0f517b686bbaecf8826a51e6ffe1a Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Wed, 21 Nov 2018 11:08:30 +0100 Subject: a2065: Fix DMA/memory accesses --- src/devices/bus/amiga/zorro/a2065.cpp | 34 ++++++++++++++++++++++++---------- src/devices/bus/amiga/zorro/a2065.h | 6 ++++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/devices/bus/amiga/zorro/a2065.cpp b/src/devices/bus/amiga/zorro/a2065.cpp index 2c6ddca8e47..cfe687817c1 100644 --- a/src/devices/bus/amiga/zorro/a2065.cpp +++ b/src/devices/bus/amiga/zorro/a2065.cpp @@ -33,8 +33,8 @@ void a2065_device::device_add_mconfig(machine_config &config) { AM7990(config, m_lance); m_lance->intr_out().set(FUNC(a2065_device::lance_irq_w)); - m_lance->dma_in().set(FUNC(a2065_device::ram_r)); - m_lance->dma_out().set(FUNC(a2065_device::ram_w)); + m_lance->dma_in().set(FUNC(a2065_device::lance_ram_r)); + m_lance->dma_out().set(FUNC(a2065_device::lance_ram_w)); } @@ -97,8 +97,8 @@ void a2065_device::autoconfig_base_address(offs_t address) // install access to onboard ram (32k) m_slot->m_space->install_readwrite_handler(address + 0x8000, address + 0x8000 + 0x7fff, - read16_delegate(FUNC(a2065_device::ram_r), this), - write16_delegate(FUNC(a2065_device::ram_w), this), 0xffff); + read16_delegate(FUNC(a2065_device::host_ram_r), this), + write16_delegate(FUNC(a2065_device::host_ram_w), this), 0xffff); // we're done m_slot->cfgout_w(0); @@ -117,7 +117,7 @@ WRITE_LINE_MEMBER( a2065_device::cfgin_w ) autoconfig_product(0x70); autoconfig_manufacturer(0x0202); - autoconfig_serial(0x00000000); // last 3 bytes = last 3 bytes of mac address + autoconfig_serial(0x00123456); // last 3 bytes = last 3 bytes of mac address autoconfig_link_into_memory(false); autoconfig_rom_vector_valid(false); @@ -132,16 +132,30 @@ WRITE_LINE_MEMBER( a2065_device::cfgin_w ) } } -READ16_MEMBER( a2065_device::ram_r ) +READ16_MEMBER( a2065_device::host_ram_r ) { - // logerror("read offset %04x\n", offset); + // logerror("host read offset %04x\n", offset); return m_ram[offset & 0x3fff]; } -WRITE16_MEMBER( a2065_device::ram_w ) +WRITE16_MEMBER( a2065_device::host_ram_w ) { - // logerror("write %04x = %04x\n", offset, data); - m_ram[offset & 0x3fff] = data; + // logerror("host write %04x = %04x\n", offset, data); + COMBINE_DATA(&m_ram[offset]); +} + +READ16_MEMBER( a2065_device::lance_ram_r ) +{ + offset = (offset >> 1) & 0x3fff; + // logerror("lance read offset %04x\n", offset); + return m_ram[offset]; +} + +WRITE16_MEMBER( a2065_device::lance_ram_w ) +{ + offset = (offset >> 1) & 0x3fff; + // logerror("lance write %04x = %04x\n", offset, data); + COMBINE_DATA(&m_ram[offset]); } WRITE_LINE_MEMBER( a2065_device::lance_irq_w ) diff --git a/src/devices/bus/amiga/zorro/a2065.h b/src/devices/bus/amiga/zorro/a2065.h index 6eb8c4599ed..bdc0db72475 100644 --- a/src/devices/bus/amiga/zorro/a2065.h +++ b/src/devices/bus/amiga/zorro/a2065.h @@ -30,9 +30,11 @@ public: // construction/destruction a2065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - DECLARE_READ16_MEMBER( ram_r ); - DECLARE_WRITE16_MEMBER( ram_w ); + DECLARE_READ16_MEMBER( host_ram_r ); + DECLARE_WRITE16_MEMBER( host_ram_w ); + DECLARE_READ16_MEMBER( lance_ram_r ); + DECLARE_WRITE16_MEMBER( lance_ram_w ); DECLARE_WRITE_LINE_MEMBER( lance_irq_w ); protected: -- cgit v1.2.3