mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
bus/cbus: Interrupt lines are now callbacks (nw)
This commit is contained in:
parent
f5a1f095fd
commit
48b45768a0
10 changed files with 74 additions and 12 deletions
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "emu.h"
|
||||
#include "mpu_pc98.h"
|
||||
#include "machine/pic8259.h"
|
||||
|
||||
#define MPU_CORE_TAG "mpu401"
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "emu.h"
|
||||
#include "bus/cbus/pc9801_118.h"
|
||||
|
||||
#include "machine/pic8259.h"
|
||||
#include "sound/2608intf.h"
|
||||
#include "speaker.h"
|
||||
|
||||
|
@ -43,7 +42,7 @@ WRITE8_MEMBER(pc9801_118_device::opn_portb_w){ m_joy_sel = data; }
|
|||
WRITE_LINE_MEMBER(pc9801_118_device::pc9801_sound_irq)
|
||||
{
|
||||
/* TODO: seems to die very often */
|
||||
machine().device<pic8259_device>(":pic8259_slave")->ir4_w(state);
|
||||
m_bus->int_w<5>(state);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "bus/cbus/pc9801_cbus.h"
|
||||
#include "machine/pic8259.h"
|
||||
#include "sound/2608intf.h"
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "emu.h"
|
||||
#include "bus/cbus/pc9801_26.h"
|
||||
|
||||
#include "machine/pic8259.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "speaker.h"
|
||||
|
||||
|
@ -43,7 +42,7 @@ WRITE8_MEMBER(pc9801_26_device::opn_portb_w){ m_joy_sel = data; }
|
|||
WRITE_LINE_MEMBER(pc9801_26_device::pc9801_sound_irq)
|
||||
{
|
||||
/* TODO: seems to die very often */
|
||||
machine().device<pic8259_device>(":pic8259_slave")->ir4_w(state);
|
||||
m_bus->int_w<5>(state);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ Template for skeleton device
|
|||
#pragma once
|
||||
|
||||
#include "bus/cbus/pc9801_cbus.h"
|
||||
#include "machine/pic8259.h"
|
||||
#include "sound/2203intf.h"
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ WRITE_LINE_MEMBER(pc9801_86_device::sound_irq)
|
|||
{
|
||||
m_fmirq = state ? true : false;
|
||||
/* TODO: seems to die very often */
|
||||
machine().device<pic8259_device>(":pic8259_slave")->ir4_w(state || (m_pcmirq ? ASSERT_LINE : CLEAR_LINE));
|
||||
m_bus->int_w<5>(state || (m_pcmirq ? ASSERT_LINE : CLEAR_LINE));
|
||||
}
|
||||
|
||||
|
||||
|
@ -274,7 +274,7 @@ WRITE8_MEMBER(pc9801_86_device::pcm_w)
|
|||
m_head = m_tail = m_count = 0;
|
||||
if(!(data & 0x10))
|
||||
{
|
||||
machine().device<pic8259_device>(":pic8259_slave")->ir4_w(m_fmirq ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_bus->int_w<5>(m_fmirq ? ASSERT_LINE : CLEAR_LINE);
|
||||
if(!(queue_count() < m_irq_rate) || !(data & 0x80))
|
||||
m_pcmirq = false; //TODO: this needs research
|
||||
}
|
||||
|
@ -356,6 +356,6 @@ void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int pa
|
|||
if((queue_count() < m_irq_rate) && (m_pcm_ctrl & 0x20))
|
||||
{
|
||||
m_pcmirq = true;
|
||||
machine().device<pic8259_device>(":pic8259_slave")->ir4_w(ASSERT_LINE);
|
||||
m_bus->int_w<5>(ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "bus/cbus/pc9801_cbus.h"
|
||||
#include "machine/pic8259.h"
|
||||
#include "sound/2608intf.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface()
|
|||
pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, PC9801CBUS_SLOT, tag, owner, clock),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_cpu(*this, "^maincpu")
|
||||
m_cpu(*this, "^maincpu"),
|
||||
m_int_callback{{*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -72,6 +73,19 @@ void pc9801_slot_device::device_config_complete()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_resolve_objects - resolve objects that
|
||||
// may be needed for other devices to set
|
||||
// initial conditions at start time
|
||||
//-------------------------------------------------
|
||||
|
||||
void pc9801_slot_device::device_resolve_objects()
|
||||
{
|
||||
for (auto &cb : m_int_callback)
|
||||
cb.resolve_safe();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
|
|
@ -27,6 +27,26 @@
|
|||
MCFG_DEVICE_ADD(_tag, PC9801CBUS_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
|
||||
|
||||
#define MCFG_PC9801CBUS_INT0_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<0>(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_PC9801CBUS_INT1_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<1>(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_PC9801CBUS_INT2_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<2>(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_PC9801CBUS_INT3_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<3>(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_PC9801CBUS_INT4_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<4>(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_PC9801CBUS_INT5_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<5>(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_PC9801CBUS_INT6_CALLBACK(_devcb) \
|
||||
devcb = &downcast<pc9801_slot_device &>(*device).set_int_callback<6>(DEVCB_##_devcb);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -58,16 +78,22 @@ public:
|
|||
// construction/destruction
|
||||
pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// configuration access
|
||||
template<int I, class Object> devcb_base &set_int_callback(Object &&cb) { return m_int_callback[I].set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
address_space &io_space() const { return m_cpu->space(AS_IO); }
|
||||
template<int I> void int_w(bool state) { m_int_callback[I](state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_config_complete() override;
|
||||
virtual void device_resolve_objects() override;
|
||||
|
||||
private:
|
||||
// device_pc9801_slot_card_interface *m_card;
|
||||
required_device<cpu_device> m_cpu;
|
||||
devcb_write_line m_int_callback[7];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2225,8 +2225,36 @@ MACHINE_CONFIG_END
|
|||
|
||||
MACHINE_CONFIG_START(pc9801_state::pc9801_cbus)
|
||||
MCFG_PC9801CBUS_SLOT_ADD("cbus0", pc9801_cbus_devices, "pc9801_26")
|
||||
MCFG_PC9801CBUS_INT0_CALLBACK(WRITELINE("ir3", input_merger_device, in_w<0>))
|
||||
MCFG_PC9801CBUS_INT1_CALLBACK(WRITELINE("ir5", input_merger_device, in_w<0>))
|
||||
MCFG_PC9801CBUS_INT2_CALLBACK(WRITELINE("ir6", input_merger_device, in_w<0>))
|
||||
MCFG_PC9801CBUS_INT3_CALLBACK(WRITELINE("ir9", input_merger_device, in_w<0>))
|
||||
MCFG_PC9801CBUS_INT4_CALLBACK(WRITELINE("pic8259_slave", pic8259_device, ir2_w))
|
||||
MCFG_PC9801CBUS_INT5_CALLBACK(WRITELINE("ir12", input_merger_device, in_w<0>))
|
||||
MCFG_PC9801CBUS_INT6_CALLBACK(WRITELINE("ir13", input_merger_device, in_w<0>))
|
||||
|
||||
MCFG_PC9801CBUS_SLOT_ADD("cbus1", pc9801_cbus_devices, nullptr)
|
||||
MCFG_PC9801CBUS_INT0_CALLBACK(WRITELINE("ir3", input_merger_device, in_w<1>))
|
||||
MCFG_PC9801CBUS_INT1_CALLBACK(WRITELINE("ir5", input_merger_device, in_w<1>))
|
||||
MCFG_PC9801CBUS_INT2_CALLBACK(WRITELINE("ir6", input_merger_device, in_w<1>))
|
||||
MCFG_PC9801CBUS_INT3_CALLBACK(WRITELINE("ir9", input_merger_device, in_w<1>))
|
||||
MCFG_PC9801CBUS_INT4_CALLBACK(WRITELINE("pic8259_slave", pic8259_device, ir3_w))
|
||||
MCFG_PC9801CBUS_INT5_CALLBACK(WRITELINE("ir12", input_merger_device, in_w<1>))
|
||||
MCFG_PC9801CBUS_INT6_CALLBACK(WRITELINE("ir13", input_merger_device, in_w<1>))
|
||||
// TODO: six max slots
|
||||
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("ir3")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("pic8259_master", pic8259_device, ir3_w))
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("ir5")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("pic8259_master", pic8259_device, ir5_w))
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("ir6")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("pic8259_master", pic8259_device, ir6_w))
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("ir9")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir1_w))
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("ir12")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir4_w))
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("ir13")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir5_w))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(pc9801_state::pc9801_sasi)
|
||||
|
|
Loading…
Reference in a new issue