mirror of
https://github.com/holub/mame
synced 2025-07-23 02:01:08 +03:00
hd63450: add primitive /own and /dtack support
* also improve auto-request mode logic
This commit is contained in:
parent
3c729314b8
commit
ee6cb33f46
@ -18,6 +18,7 @@ hd63450_device::hd63450_device(const machine_config &mconfig, const char *tag, d
|
|||||||
: device_t(mconfig, HD63450, tag, owner, clock)
|
: device_t(mconfig, HD63450, tag, owner, clock)
|
||||||
, m_irq_callback(*this)
|
, m_irq_callback(*this)
|
||||||
, m_dma_end(*this)
|
, m_dma_end(*this)
|
||||||
|
, m_own(*this)
|
||||||
, m_dma_read(*this, 0)
|
, m_dma_read(*this, 0)
|
||||||
, m_dma_write(*this)
|
, m_dma_write(*this)
|
||||||
, m_cpu(*this, finder_base::DUMMY_TAG)
|
, m_cpu(*this, finder_base::DUMMY_TAG)
|
||||||
@ -360,6 +361,9 @@ void hd63450_device::single_transfer(int x)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_bec = 0;
|
m_bec = 0;
|
||||||
|
m_dtack = true;
|
||||||
|
|
||||||
|
m_own(0);
|
||||||
|
|
||||||
if (m_reg[x].ocr & 0x80) // direction: 1 = device -> memory
|
if (m_reg[x].ocr & 0x80) // direction: 1 = device -> memory
|
||||||
{
|
{
|
||||||
@ -440,6 +444,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);
|
// LOG("DMA#%i: byte transfer %08lx -> %08lx\n",x,m_reg[x].mar,m_reg[x].dar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_own(1);
|
||||||
|
|
||||||
|
if (!m_dtack)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_bec == ERR_BUS)
|
if (m_bec == ERR_BUS)
|
||||||
{
|
{
|
||||||
set_error(x, 9); //assume error in mar, TODO: other errors
|
set_error(x, 9); //assume error in mar, TODO: other errors
|
||||||
@ -525,7 +534,10 @@ void hd63450_device::drq_w(int channel, int state)
|
|||||||
bool ostate = m_drq_state[channel];
|
bool ostate = m_drq_state[channel];
|
||||||
m_drq_state[channel] = state;
|
m_drq_state[channel] = state;
|
||||||
|
|
||||||
if ((m_reg[channel].ocr & 2) && (state && !ostate))
|
// check for external request modes
|
||||||
|
if (m_reg[channel].ocr & 2)
|
||||||
|
{
|
||||||
|
if (state && !ostate)
|
||||||
{
|
{
|
||||||
// in cycle steal mode DRQ is supposed to be edge triggered
|
// in cycle steal mode DRQ is supposed to be edge triggered
|
||||||
single_transfer(channel);
|
single_transfer(channel);
|
||||||
@ -534,6 +546,7 @@ void hd63450_device::drq_w(int channel, int state)
|
|||||||
else if (!state)
|
else if (!state)
|
||||||
m_timer[channel]->adjust(attotime::never);
|
m_timer[channel]->adjust(attotime::never);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void hd63450_device::pcl_w(int channel, int state)
|
void hd63450_device::pcl_w(int channel, int state)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ public:
|
|||||||
|
|
||||||
auto irq_callback() { return m_irq_callback.bind(); }
|
auto irq_callback() { return m_irq_callback.bind(); }
|
||||||
auto dma_end() { return m_dma_end.bind(); }
|
auto dma_end() { return m_dma_end.bind(); }
|
||||||
|
auto own() { return m_own.bind(); }
|
||||||
template <int Ch> auto dma_read() { return m_dma_read[Ch].bind(); }
|
template <int Ch> auto dma_read() { return m_dma_read[Ch].bind(); }
|
||||||
template <int Ch> auto dma_write() { return m_dma_write[Ch].bind(); }
|
template <int Ch> auto dma_write() { return m_dma_write[Ch].bind(); }
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ public:
|
|||||||
ERR_NONE= 7
|
ERR_NONE= 7
|
||||||
};
|
};
|
||||||
void bec_w(offs_t offset, uint8_t data) { m_bec = data; }
|
void bec_w(offs_t offset, uint8_t data) { m_bec = data; }
|
||||||
|
void dtack_w(int state) { m_dtack = !state; }
|
||||||
|
|
||||||
void single_transfer(int x);
|
void single_transfer(int x);
|
||||||
void set_timer(int channel, const attotime &tm);
|
void set_timer(int channel, const attotime &tm);
|
||||||
@ -96,6 +98,7 @@ private:
|
|||||||
|
|
||||||
devcb_write_line m_irq_callback;
|
devcb_write_line m_irq_callback;
|
||||||
devcb_write8 m_dma_end;
|
devcb_write8 m_dma_end;
|
||||||
|
devcb_write_line m_own;
|
||||||
devcb_read8::array<4> m_dma_read;
|
devcb_read8::array<4> m_dma_read;
|
||||||
devcb_write8::array<4> m_dma_write;
|
devcb_write8::array<4> m_dma_write;
|
||||||
|
|
||||||
@ -113,6 +116,8 @@ private:
|
|||||||
int8_t m_irq_channel;
|
int8_t m_irq_channel;
|
||||||
uint8_t m_bec;
|
uint8_t m_bec;
|
||||||
|
|
||||||
|
bool m_dtack;
|
||||||
|
|
||||||
// tell if a channel is in use
|
// tell if a channel is in use
|
||||||
bool dma_in_progress(int channel) const { return (m_reg[channel].csr & 0x08) != 0; }
|
bool dma_in_progress(int channel) const { return (m_reg[channel].csr & 0x08) != 0; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user