diff --git a/src/devices/machine/am9517a.cpp b/src/devices/machine/am9517a.cpp index 7f2ecb7e37f..6238d6e2d08 100644 --- a/src/devices/machine/am9517a.cpp +++ b/src/devices/machine/am9517a.cpp @@ -49,6 +49,7 @@ const device_type AM9517A = &device_creator; const device_type V53_DMAU = &device_creator; +const device_type PCXPORT_DMAC = &device_creator; //************************************************************************** @@ -422,7 +423,7 @@ inline void am9517a_device::dma_advance() // end_of_process - //------------------------------------------------- -inline void am9517a_device::end_of_process() +void am9517a_device::end_of_process() { // terminal count if (COMMAND_MEM_TO_MEM) @@ -530,6 +531,11 @@ upd71071_v53_device::upd71071_v53_device(const machine_config &mconfig, const ch { } +pcxport_dmac_device::pcxport_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : am9517a_device(mconfig, PCXPORT_DMAC, "PC Transporter DMAC", tag, owner, clock, "pcx_dmac") +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -1277,3 +1283,58 @@ WRITE8_MEMBER(upd71071_v53_device::write) trigger(1); } + +void pcxport_dmac_device::device_reset() +{ + m_state = STATE_SI; + m_command = 0; + m_status = 0; + m_request = 0; + m_mask = 0; + m_temp = 0; + m_msb = 0; + m_current_channel = -1; + m_last_channel = 3; + m_hreq = -1; + m_eop = 0; + + set_hreq(0); + set_eop(ASSERT_LINE); + + set_dack(); +} + +void pcxport_dmac_device::end_of_process() +{ + // terminal count + if (COMMAND_MEM_TO_MEM) + { + m_status |= 1 << 0; + m_status |= 1 << 1; + m_request &= ~(1 << 0); + m_request &= ~(1 << 1); + } + else + { + m_status |= 1 << m_current_channel; + m_request &= ~(1 << m_current_channel); + } + + if (MODE_AUTOINITIALIZE) + { + // autoinitialize + m_channel[m_current_channel].m_address = m_channel[m_current_channel].m_base_address; + m_channel[m_current_channel].m_count = m_channel[m_current_channel].m_base_count; + } + // don't mask out channel if not autoinitialize + + // signal end of process + set_eop(ASSERT_LINE); + set_hreq(0); + + m_current_channel = -1; + set_dack(); + + m_state = STATE_SI; +} + diff --git a/src/devices/machine/am9517a.h b/src/devices/machine/am9517a.h index 7d5bd2601f4..764f29e12c4 100644 --- a/src/devices/machine/am9517a.h +++ b/src/devices/machine/am9517a.h @@ -46,6 +46,8 @@ class am9517a_device : public device_t, public device_execute_interface { + friend class pcxport_dmac_device; + public: // construction/destruction am9517a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); @@ -90,6 +92,8 @@ protected: virtual void device_reset() override; virtual void execute_run() override; + virtual void end_of_process(); + int m_icount; UINT32 m_address_mask; @@ -127,7 +131,6 @@ private: inline void dma_read(); inline void dma_write(); inline void dma_advance(); - inline void end_of_process(); devcb_write_line m_out_hreq_cb; devcb_write_line m_out_eop_cb; @@ -176,11 +179,24 @@ protected: }; +class pcxport_dmac_device : public am9517a_device +{ +public: + // construction/destruction + pcxport_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + virtual void device_reset() override; + + virtual void end_of_process() override; +}; + // device type definition extern const device_type AM9517A; extern const device_type V53_DMAU; +extern const device_type PCXPORT_DMAC; /***************************************************************************