From a9170dccb8be59bd1cb5905bd97fce088cd275e0 Mon Sep 17 00:00:00 2001 From: cracyc Date: Wed, 2 Jun 2021 15:13:52 -0500 Subject: hd63450: start handling bus errors --- src/devices/machine/hd63450.cpp | 7 +++++++ src/devices/machine/hd63450.h | 11 +++++++++++ src/mame/drivers/x68k.cpp | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/src/devices/machine/hd63450.cpp b/src/devices/machine/hd63450.cpp index 21b032f55f6..ec4647fd0db 100644 --- a/src/devices/machine/hd63450.cpp +++ b/src/devices/machine/hd63450.cpp @@ -364,6 +364,8 @@ void hd63450_device::single_transfer(int x) if (!dma_in_progress(x)) // DMA in progress in channel x return; + m_bec = 0; + if (m_reg[x].ocr & 0x80) // direction: 1 = device -> memory { if (!m_dma_read[x].isnull()) @@ -443,6 +445,11 @@ void hd63450_device::single_transfer(int x) // LOG("DMA#%i: byte transfer %08lx -> %08lx\n",x,m_reg[x].mar,m_reg[x].dar); } + if (m_bec == ERR_BUS) + { + set_error(x, 9); //assume error in mar, TODO: other errors + return; + } // decrease memory transfer counter if (m_reg[x].mtc > 0) diff --git a/src/devices/machine/hd63450.h b/src/devices/machine/hd63450.h index 5aa17321090..33ffd8b1097 100644 --- a/src/devices/machine/hd63450.h +++ b/src/devices/machine/hd63450.h @@ -49,6 +49,16 @@ public: DECLARE_WRITE_LINE_MEMBER(drq3_w); uint8_t iack(); + enum { + ERR_RESET = 0, + ERR_FREE_BUS_RETRY = 3, + ERR_RETRY = 4, + ERR_BUS = 5, + ERR_HALT = 6, + ERR_NONE= 7 + }; + void bec_w(offs_t offset, uint8_t data) { m_bec = data; } + void single_transfer(int x); void set_timer(int channel, const attotime &tm); @@ -97,6 +107,7 @@ private: bool m_drq_state[4]; int8_t m_irq_channel; + uint8_t m_bec; // tell if a channel is in use bool dma_in_progress(int channel) const { return (m_reg[channel].csr & 0x08) != 0; } diff --git a/src/mame/drivers/x68k.cpp b/src/mame/drivers/x68k.cpp index 254f62d79e8..a564e960fc8 100644 --- a/src/mame/drivers/x68k.cpp +++ b/src/mame/drivers/x68k.cpp @@ -936,6 +936,11 @@ void x68k_state::set_bus_error(uint32_t address, bool rw, uint16_t mem_mask) { if(m_bus_error) return; + else if(!m_maincpu->executing()) + { + m_hd63450->bec_w(0, hd63450_device::ERR_BUS); + return; + } if(!ACCESSING_BITS_8_15) address++; m_bus_error = true; -- cgit v1.2.3