diff options
| author | 2025-02-16 17:41:49 +0100 | |
|---|---|---|
| committer | 2025-02-16 17:42:31 +0100 | |
| commit | 31323a61a426ae3254cc3f3469100f50bf92375c (patch) | |
| tree | 3eba5f7043e6f7cd4ff331d81737d44c9cd19044 /src/devices/machine/dmac.cpp | |
| parent | 00a4fdec5de2b9fb843805817de1fab77f7ce7a1 (diff) | |
dmac: Add support for Rev. 2
Diffstat (limited to 'src/devices/machine/dmac.cpp')
| -rw-r--r-- | src/devices/machine/dmac.cpp | 98 |
1 files changed, 43 insertions, 55 deletions
diff --git a/src/devices/machine/dmac.cpp b/src/devices/machine/dmac.cpp index 06574584585..83c51fd215b 100644 --- a/src/devices/machine/dmac.cpp +++ b/src/devices/machine/dmac.cpp @@ -35,10 +35,11 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(AMIGA_DMAC, amiga_dmac_device, "amiga_dmac", "Amiga DMAC DMA Controller") +DEFINE_DEVICE_TYPE(AMIGA_DMAC_REV1, amiga_dmac_rev1_device, "amiga_dmac_rev1", "Amiga DMAC Rev. 1 DMA Controller") +DEFINE_DEVICE_TYPE(AMIGA_DMAC_REV2, amiga_dmac_rev2_device, "amiga_dmac_rev2", "Amiga DMAC Rev. 2 DMA Controller") -amiga_dmac_device::amiga_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, AMIGA_DMAC, tag, owner, clock), +amiga_dmac_device::amiga_dmac_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool rev1) : + device_t(mconfig, type, tag, owner, clock), amiga_autoconfig(), m_cfgout_cb(*this), m_int_cb(*this), @@ -56,6 +57,7 @@ amiga_dmac_device::amiga_dmac_device(const machine_config &mconfig, const char * m_space(nullptr), m_ram(nullptr), m_ram_size(-1), + m_rev1(rev1), m_cntr(0), m_istr(0), m_wtc(0), @@ -70,6 +72,16 @@ amiga_dmac_device::amiga_dmac_device(const machine_config &mconfig, const char * { } +amiga_dmac_rev1_device::amiga_dmac_rev1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + amiga_dmac_device(mconfig, AMIGA_DMAC_REV1, tag, owner, clock, true) +{ +} + +amiga_dmac_rev2_device::amiga_dmac_rev2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + amiga_dmac_device(mconfig, AMIGA_DMAC_REV2, tag, owner, clock, false) +{ +} + //************************************************************************** // ADDRESS MAPS @@ -80,8 +92,8 @@ void amiga_dmac_device::map(address_map &map) map(0x0000, 0x003f).rw(FUNC(amiga_dmac_device::autoconfig_r), FUNC(amiga_dmac_device::autoconfig_w)); map(0x0040, 0x0041).r(FUNC(amiga_dmac_device::istr_r)); map(0x0042, 0x0043).rw(FUNC(amiga_dmac_device::cntr_r), FUNC(amiga_dmac_device::cntr_w)); - map(0x0080, 0x0081).w(FUNC(amiga_dmac_device::wtc_hi_w)); - map(0x0082, 0x0083).w(FUNC(amiga_dmac_device::wtc_lo_w)); + map(0x0080, 0x0081).w(FUNC(amiga_dmac_device::wtc_hi_w)); // read? + map(0x0082, 0x0083).w(FUNC(amiga_dmac_device::wtc_lo_w)); // read? map(0x0084, 0x0085).w(FUNC(amiga_dmac_device::acr_hi_w)); map(0x0086, 0x0087).w(FUNC(amiga_dmac_device::acr_lo_w)); map(0x008e, 0x008f).w(FUNC(amiga_dmac_device::dawr_w)); @@ -180,7 +192,7 @@ TIMER_CALLBACK_MEMBER(amiga_dmac_device::update_dma) m_acr++; - if (m_cntr & CNTR_TCEN) + if (m_rev1 && (m_cntr & CNTR_TCEN)) { // we count words if ((m_acr & 1) == 0) @@ -242,16 +254,22 @@ void amiga_dmac_device::wtc_hi_w(offs_t offset, uint16_t data, uint16_t mem_mask { LOGMASKED(LOG_REGS, "wtc_hi_w: %04x & %04x\n", data, mem_mask); - m_wtc &= (~(uint32_t) mem_mask) << 16 | 0x0000ffff; - m_wtc |= ((uint32_t) data & mem_mask) << 16; + if (m_rev1) + { + m_wtc &= (~(uint32_t) mem_mask) << 16 | 0x0000ffff; + m_wtc |= ((uint32_t) data & mem_mask) << 16; + } } void amiga_dmac_device::wtc_lo_w(offs_t offset, uint16_t data, uint16_t mem_mask) { LOGMASKED(LOG_REGS, "wtc_lo_w: %04x & %04x\n", data, mem_mask); - m_wtc &= 0xffff0000 & (~mem_mask); - m_wtc |= data & mem_mask; + if (m_rev1) + { + m_wtc &= 0xffff0000 & (~mem_mask); + m_wtc |= data & mem_mask; + } } void amiga_dmac_device::acr_hi_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -267,7 +285,7 @@ void amiga_dmac_device::acr_lo_w(offs_t offset, uint16_t data, uint16_t mem_mask LOGMASKED(LOG_REGS, "acr_lo_w: %04x & %04x\n", data, mem_mask); m_acr &= 0xffff0000 & (~mem_mask); - m_acr |= (data & mem_mask) & 0xfffc; // 0xfffe for rev 2 + m_acr |= (data & mem_mask) & (m_rev1 ? 0xfffc : 0xfffe); } void amiga_dmac_device::dawr_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -283,64 +301,34 @@ void amiga_dmac_device::csx0_w(offs_t offset, uint8_t data) { m_csx0_write_cb(of uint8_t amiga_dmac_device::csx1_r(offs_t offset) { return m_csx1_read_cb(offset); } void amiga_dmac_device::csx1_w(offs_t offset, uint8_t data) { m_csx1_write_cb(offset, data); } -uint16_t amiga_dmac_device::st_dma_r(offs_t offset, uint16_t mem_mask) +void amiga_dmac_device::st_dma() { - LOGMASKED(LOG_DMA, "st_dma_r\n"); - + LOGMASKED(LOG_DMA, "st_dma\n"); start_dma(); - return 0; } -void amiga_dmac_device::st_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void amiga_dmac_device::sp_dma() { - LOGMASKED(LOG_DMA, "st_dma_w\n"); - - start_dma(); -} - -uint16_t amiga_dmac_device::sp_dma_r(offs_t offset, uint16_t mem_mask) -{ - LOGMASKED(LOG_DMA, "sp_dma_r\n"); - + LOGMASKED(LOG_DMA, "sp_dma\n"); stop_dma(); - return 0; } -void amiga_dmac_device::sp_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void amiga_dmac_device::cint() { - LOGMASKED(LOG_REGS, "sp_dma_w\n"); - - stop_dma(); -} - -uint16_t amiga_dmac_device::cint_r(offs_t offset, uint16_t mem_mask) -{ - LOGMASKED(LOG_INT, "cint_r\n"); - + LOGMASKED(LOG_DMA, "cint\n"); m_istr = 0; update_interrupts(); - - return 0; } -void amiga_dmac_device::cint_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void amiga_dmac_device::flush() { - LOGMASKED(LOG_INT, "cint_w\n"); + LOGMASKED(LOG_DMA, "flush\n"); - m_istr = 0; - update_interrupts(); -} - -uint16_t amiga_dmac_device::flush_r(offs_t offset, uint16_t mem_mask) -{ - LOGMASKED(LOG_REGS, "flush_r\n"); - - return 0; -} - -void amiga_dmac_device::flush_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - LOGMASKED(LOG_REGS, "flush_w\n"); + if (!m_rev1) + { + m_istr &= ~ISTR_FF_FLG; + m_istr |= ISTR_FE_FLG; + } } void amiga_dmac_device::ramsz_w(int state) @@ -486,7 +474,7 @@ void amiga_dmac_device::configin_w(int state) autoconfig_multi_device(false); autoconfig_8meg_preferred(false); autoconfig_can_shutup(true); - autoconfig_product(2); // or 3 for rev 2 + autoconfig_product(m_rev1 ? 2 : 3); autoconfig_manufacturer(514); autoconfig_serial(0x00000000); } |
