diff --git a/src/mame/drivers/interpro.cpp b/src/mame/drivers/interpro.cpp index 322c5e141dc..094d31b9c49 100644 --- a/src/mame/drivers/interpro.cpp +++ b/src/mame/drivers/interpro.cpp @@ -463,9 +463,10 @@ static MACHINE_CONFIG_START(ip2800, interpro_state) MCFG_INTERPRO_IOGA_ADD(INTERPRO_IOGA_TAG) MCFG_INTERPRO_IOGA_NMI_CB(INPUTLINE(INTERPRO_CPU_TAG, INPUT_LINE_NMI)) MCFG_INTERPRO_IOGA_IRQ_CB(INPUTLINE(INTERPRO_CPU_TAG, INPUT_LINE_IRQ0)) - - // use callbacks to tell the ioga what the dma read and write methods of each device are - // MCFG_INTERPRO_IOGA_DMA_CALLBACK(channel, n82077aa_device, dma_r, dma_w) + //MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_CHANNEL_PLOTTER, unknown) + //MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_CHANNEL_SCSI, DEVREAD8(INTERPRO_SCSI_TAG, ncr539x_device, dma_read_data), DEVWRITE8(INTERPRO_SCSI_TAG, ncr539x_device, dma_write_data)) + MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_CHANNEL_FLOPPY, DEVREAD8(INTERPRO_FDC_TAG, n82077aa_device, mdma_r), DEVWRITE8(INTERPRO_FDC_TAG, n82077aa_device, mdma_w)) + MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_CHANNEL_SERIAL, DEVREAD8(INTERPRO_SCC1_TAG, z80scc_device, da_r), DEVWRITE8(INTERPRO_SCC1_TAG, z80scc_device, da_w)) MACHINE_CONFIG_END diff --git a/src/mame/machine/interpro_ioga.cpp b/src/mame/machine/interpro_ioga.cpp index 30030ecf87a..2475cd9c775 100644 --- a/src/mame/machine/interpro_ioga.cpp +++ b/src/mame/machine/interpro_ioga.cpp @@ -35,17 +35,25 @@ const device_type INTERPRO_IOGA = &device_creator; interpro_ioga_device::interpro_ioga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, INTERPRO_IOGA, "InterPro IOGA", tag, owner, clock, "ioga", __FILE__), m_out_nmi_func(*this), - m_out_int_func(*this) -{ + m_out_int_func(*this), + m_dma_r_func{ { *this }, { *this }, { *this }, { *this } }, + m_dma_w_func{ { *this }, { *this }, { *this }, { *this } } + { } void interpro_ioga_device::device_start() { // resolve callbacks + m_out_nmi_func.resolve(); m_out_int_func.resolve(); + for (auto & r : m_dma_r_func) + r.resolve_safe(0xff); + + for (auto & w : m_dma_w_func) + w.resolve(); + m_cpu = machine().device("cpu"); - m_fdc = machine().device("fdc"); // allocate ioga timers m_timer[0] = timer_alloc(IOGA_TIMER_0); @@ -164,7 +172,7 @@ void interpro_ioga_device::device_timer(emu_timer &timer, device_timer_id id, in { address_space &space = m_cpu->space(AS_PROGRAM); - space.write_byte(m_fdc_dma[0]++, m_fdc->dma_r()); + space.write_byte(m_fdc_dma[0]++, m_dma_r_func[IOGA_DMA_CHANNEL_FLOPPY]()); if (--m_fdc_dma[2]) m_dma_timer->adjust(attotime::from_usec(10)); else diff --git a/src/mame/machine/interpro_ioga.h b/src/mame/machine/interpro_ioga.h index 2035fd1e4b9..3a6fc8cebb7 100644 --- a/src/mame/machine/interpro_ioga.h +++ b/src/mame/machine/interpro_ioga.h @@ -7,7 +7,6 @@ #define INTERPRO_IOGA_H_ #include "emu.h" -#include "machine/upd765.h" #define MCFG_INTERPRO_IOGA_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, INTERPRO_IOGA, 0) @@ -18,6 +17,10 @@ #define MCFG_INTERPRO_IOGA_IRQ_CB(_out_int) \ devcb = &interpro_ioga_device::static_set_out_int_callback(*device, DEVCB_##_out_int); +#define MCFG_INTERPRO_IOGA_DMA_CB(_channel, _dma_r, _dma_w) \ + devcb = &interpro_ioga_device::static_set_dma_r_callback(*device, _channel, DEVCB_##_dma_r); \ + devcb = &interpro_ioga_device::static_set_dma_w_callback(*device, _channel, DEVCB_##_dma_w); + // timer 0 seem to be a 60Hz cycle #define IOGA_TIMER0_IRQ 14 @@ -42,6 +45,12 @@ // FIXME: hack for forced interrupts #define IOGA_INTERRUPT_FORCED 0x8000 +#define IOGA_DMA_CHANNELS 4 +#define IOGA_DMA_CHANNEL_PLOTTER 0 +#define IOGA_DMA_CHANNEL_SCSI 1 +#define IOGA_DMA_CHANNEL_FLOPPY 2 +#define IOGA_DMA_CHANNEL_SERIAL 3 + class interpro_ioga_device : public device_t { public: @@ -51,6 +60,9 @@ public: template static devcb_base &static_set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_func.set_callback(object); } template static devcb_base &static_set_out_int_callback(device_t &device, _Object object) { return downcast(device).m_out_int_func.set_callback(object); } + template static devcb_base &static_set_dma_r_callback(device_t &device, int channel, _Object object) { return downcast(device).m_dma_r_func[channel].set_callback(object); } + template static devcb_base &static_set_dma_w_callback(device_t &device, int channel, _Object object) { return downcast(device).m_dma_w_func[channel].set_callback(object); } + virtual DECLARE_ADDRESS_MAP(map, 8); // external interrupt lines @@ -122,8 +134,8 @@ private: devcb_write_line m_out_nmi_func; devcb_write_line m_out_int_func; - // a hack to get hold of the dma devices - upd765_family_device *m_fdc; + devcb_read8 m_dma_r_func[IOGA_DMA_CHANNELS]; + devcb_write8 m_dma_w_func[IOGA_DMA_CHANNELS]; bool m_irq_active; uint32_t m_irq_current;