summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/c64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/c64.cpp')
-rw-r--r--src/mame/drivers/c64.cpp269
1 files changed, 113 insertions, 156 deletions
diff --git a/src/mame/drivers/c64.cpp b/src/mame/drivers/c64.cpp
index 24ed190ff9a..ca7de0674be 100644
--- a/src/mame/drivers/c64.cpp
+++ b/src/mame/drivers/c64.cpp
@@ -27,6 +27,7 @@
#include "cpu/m6502/m6510.h"
#include "imagedev/snapquik.h"
#include "machine/cbm_snqk.h"
+#include "machine/input_merger.h"
#include "machine/mos6526.h"
#include "machine/pla.h"
#include "machine/ram.h"
@@ -51,6 +52,7 @@ public:
c64_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, M6510_TAG),
+ m_nmi(*this, "nmi"),
m_pla(*this, PLA_TAG),
m_vic(*this, MOS6569_TAG),
m_sid(*this, MOS6581_TAG),
@@ -59,7 +61,7 @@ public:
m_iec(*this, CBM_IEC_TAG),
m_joy1(*this, CONTROL1_TAG),
m_joy2(*this, CONTROL2_TAG),
- m_exp(*this, C64_EXPANSION_SLOT_TAG),
+ m_exp(*this, "exp"),
m_user(*this, PET_USER_PORT_TAG),
m_ram(*this, RAM_TAG),
m_cassette(*this, PET_DATASSETTE_PORT_TAG),
@@ -70,13 +72,7 @@ public:
m_hiram(1),
m_charen(1),
m_va14(1),
- m_va15(1),
- m_restore(1),
- m_cia1_irq(CLEAR_LINE),
- m_cia2_irq(CLEAR_LINE),
- m_vic_irq(CLEAR_LINE),
- m_exp_irq(CLEAR_LINE),
- m_exp_nmi(CLEAR_LINE)
+ m_va15(1)
{ }
// ROM
@@ -85,6 +81,7 @@ public:
uint8_t *m_charom;
required_device<m6510_device> m_maincpu;
+ required_device<input_merger_device> m_nmi;
required_device<pla_device> m_pla;
required_device<mos6566_device> m_vic;
required_device<mos6581_device> m_sid;
@@ -114,18 +111,15 @@ public:
DECLARE_READ8_MEMBER( vic_videoram_r );
DECLARE_READ8_MEMBER( vic_colorram_r );
- DECLARE_WRITE_LINE_MEMBER( vic_irq_w );
DECLARE_READ8_MEMBER( sid_potx_r );
DECLARE_READ8_MEMBER( sid_poty_r );
- DECLARE_WRITE_LINE_MEMBER( cia1_irq_w );
DECLARE_READ8_MEMBER( cia1_pa_r );
DECLARE_WRITE8_MEMBER( cia1_pa_w );
DECLARE_READ8_MEMBER( cia1_pb_r );
DECLARE_WRITE8_MEMBER( cia1_pb_w );
- DECLARE_WRITE_LINE_MEMBER( cia2_irq_w );
DECLARE_READ8_MEMBER( cia2_pa_r );
DECLARE_WRITE8_MEMBER( cia2_pa_w );
@@ -133,8 +127,6 @@ public:
DECLARE_WRITE8_MEMBER( cpu_w );
DECLARE_WRITE_LINE_MEMBER( write_restore );
- DECLARE_WRITE_LINE_MEMBER( exp_irq_w );
- DECLARE_WRITE_LINE_MEMBER( exp_nmi_w );
DECLARE_WRITE_LINE_MEMBER( exp_dma_w );
DECLARE_WRITE_LINE_MEMBER( exp_reset_w );
@@ -163,12 +155,6 @@ public:
int m_va15;
// interrupt state
- int m_restore;
- int m_cia1_irq;
- int m_cia2_irq;
- int m_vic_irq;
- int m_exp_irq;
- int m_exp_nmi;
int m_exp_dma;
int m_user_pa2;
@@ -265,12 +251,9 @@ QUICKLOAD_LOAD_MEMBER( c64_state, cbm_c64 )
void c64_state::check_interrupts()
{
- int irq = m_cia1_irq || m_vic_irq || m_exp_irq;
- int nmi = m_cia2_irq || !m_restore || m_exp_nmi;
+ //int irq = m_cia1_irq || m_vic_irq || m_exp_irq;
+ //int nmi = m_cia2_irq || !m_restore || m_exp_nmi;
//int rdy = m_exp_dma && m_vic_ba;
-
- m_maincpu->set_input_line(M6510_IRQ_LINE, irq);
- m_maincpu->set_input_line(M6510_NMI_LINE, nmi);
}
@@ -573,9 +556,7 @@ void c64_state::vic_colorram_map(address_map &map)
WRITE_LINE_MEMBER( c64_state::write_restore )
{
- m_restore = state;
-
- check_interrupts();
+ m_nmi->in_w<1>(!state);
}
static INPUT_PORTS_START( c64 )
@@ -704,18 +685,6 @@ INPUT_PORTS_END
//**************************************************************************
//-------------------------------------------------
-// vic2_interface vic_intf
-//-------------------------------------------------
-
-WRITE_LINE_MEMBER( c64_state::vic_irq_w )
-{
- m_vic_irq = state;
-
- check_interrupts();
-}
-
-
-//-------------------------------------------------
// MOS6581_INTERFACE( sid_intf )
//-------------------------------------------------
@@ -778,13 +747,6 @@ READ8_MEMBER( c64_state::sid_poty_r )
// MOS6526_INTERFACE( cia1_intf )
//-------------------------------------------------
-WRITE_LINE_MEMBER( c64_state::cia1_irq_w )
-{
- m_cia1_irq = state;
-
- check_interrupts();
-}
-
READ8_MEMBER( c64_state::cia1_pa_r )
{
/*
@@ -976,13 +938,6 @@ READ8_MEMBER( c64gs_state::cia1_pb_r )
// MOS6526_INTERFACE( cia2_intf )
//-------------------------------------------------
-WRITE_LINE_MEMBER( c64_state::cia2_irq_w )
-{
- m_cia2_irq = state;
-
- check_interrupts();
-}
-
READ8_MEMBER( c64_state::cia2_pa_r )
{
/*
@@ -1205,20 +1160,6 @@ WRITE8_MEMBER( c64gs_state::cpu_w )
// C64_EXPANSION_INTERFACE( expansion_intf )
//-------------------------------------------------
-WRITE_LINE_MEMBER( c64_state::exp_irq_w )
-{
- m_exp_irq = state;
-
- check_interrupts();
-}
-
-WRITE_LINE_MEMBER( c64_state::exp_nmi_w )
-{
- m_exp_nmi = state;
-
- check_interrupts();
-}
-
WRITE_LINE_MEMBER( c64_state::exp_dma_w )
{
if (m_exp_dma != state)
@@ -1290,11 +1231,6 @@ void c64_state::machine_start()
save_item(NAME(m_charen));
save_item(NAME(m_va14));
save_item(NAME(m_va15));
- save_item(NAME(m_cia1_irq));
- save_item(NAME(m_cia2_irq));
- save_item(NAME(m_vic_irq));
- save_item(NAME(m_exp_irq));
- save_item(NAME(m_exp_nmi));
save_item(NAME(m_exp_dma));
save_item(NAME(m_user_pb));
save_item(NAME(m_user_pa2));
@@ -1336,10 +1272,16 @@ MACHINE_CONFIG_START(c64_state::ntsc)
MCFG_M6510_PORT_PULLS(0x17, 0xc8)
MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
+ input_merger_device &irq(INPUT_MERGER_ANY_HIGH(config, "irq"));
+ irq.output_handler().set_inputline(m_maincpu, m6510_device::IRQ_LINE);
+
+ INPUT_MERGER_ANY_HIGH(config, m_nmi);
+ m_nmi->output_handler().set_inputline(m_maincpu, m6510_device::NMI_LINE);
+
// video hardware
mos6567_device &mos6567(MOS6567(config, MOS6567_TAG, XTAL(14'318'181)/14));
mos6567.set_cpu(M6510_TAG);
- mos6567.irq_callback().set(FUNC(c64_state::vic_irq_w));
+ mos6567.irq_callback().set("irq", FUNC(input_merger_device::in_w<1>));
mos6567.set_screen(SCREEN_TAG);
mos6567.set_addrmap(0, &c64_state::vic_videoram_map);
mos6567.set_addrmap(1, &c64_state::vic_colorram_map);
@@ -1361,7 +1303,7 @@ MACHINE_CONFIG_START(c64_state::ntsc)
MCFG_PLS100_ADD(PLA_TAG)
MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL(14'318'181)/14)
MCFG_MOS6526_TOD(60)
- MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, c64_state, cia1_irq_w))
+ MCFG_MOS6526_IRQ_CALLBACK(WRITELINE("irq", input_merger_device, in_w<0>))
MCFG_MOS6526_CNT_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4))
MCFG_MOS6526_SP_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5))
MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c64_state, cia1_pa_r))
@@ -1369,7 +1311,7 @@ MACHINE_CONFIG_START(c64_state::ntsc)
MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(*this, c64_state, cia1_pb_w))
MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL(14'318'181)/14)
MCFG_MOS6526_TOD(60)
- MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, c64_state, cia2_irq_w))
+ MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(m_nmi, input_merger_device, in_w<0>))
MCFG_MOS6526_CNT_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6))
MCFG_MOS6526_SP_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7))
MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c64_state, cia2_pa_r))
@@ -1384,31 +1326,32 @@ MACHINE_CONFIG_START(c64_state::ntsc)
MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, nullptr)
MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(WRITELINE(MOS6567_TAG, mos6567_device, lp_w))
MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy")
- MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL(14'318'181)/14, c64_expansion_cards, nullptr)
- MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, c64_state, exp_irq_w))
- MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(*this, c64_state, exp_nmi_w))
- MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(*this, c64_state, exp_reset_w))
- MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(*this, c64_state, read))
- MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(*this, c64_state, write))
- MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(*this, c64_state, exp_dma_w))
-
- MCFG_DEVICE_ADD(PET_USER_PORT_TAG, PET_USER_PORT, c64_user_port_cards, nullptr)
- MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(*this, c64_state, exp_reset_w))
- MCFG_PET_USER_PORT_4_HANDLER(WRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w))
- MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(MOS6526_1_TAG, mos6526_device, sp_w))
- MCFG_PET_USER_PORT_6_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w))
- MCFG_PET_USER_PORT_7_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, sp_w))
- MCFG_PET_USER_PORT_9_HANDLER(WRITELINE(CBM_IEC_TAG, cbm_iec_device, host_atn_w))
- MCFG_PET_USER_PORT_B_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, flag_w))
- MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(*this, c64_state, write_user_pb0))
- MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(*this, c64_state, write_user_pb1))
- MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(*this, c64_state, write_user_pb2))
- MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(*this, c64_state, write_user_pb3))
- MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(*this, c64_state, write_user_pb4))
- MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(*this, c64_state, write_user_pb5))
- MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(*this, c64_state, write_user_pb6))
- MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(*this, c64_state, write_user_pb7))
- MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(*this, c64_state, write_user_pa2))
+
+ C64_EXPANSION_SLOT(config, m_exp, XTAL(14'318'181)/14, c64_expansion_cards, nullptr);
+ m_exp->irq_callback().set("irq", FUNC(input_merger_device::in_w<2>));
+ m_exp->nmi_callback().set(m_nmi, FUNC(input_merger_device::in_w<2>));
+ m_exp->reset_callback().set(FUNC(c64_state::exp_reset_w));
+ m_exp->cd_input_callback().set(FUNC(c64_state::read));
+ m_exp->cd_output_callback().set(FUNC(c64_state::write));
+ m_exp->dma_callback().set(FUNC(c64_state::exp_dma_w));
+
+ PET_USER_PORT(config, m_user, c64_user_port_cards, nullptr);
+ m_user->p3_handler().set(FUNC(c64_state::exp_reset_w));
+ m_user->p4_handler().set(m_cia1, FUNC(mos6526_device::cnt_w));
+ m_user->p5_handler().set(m_cia1, FUNC(mos6526_device::sp_w));
+ m_user->p6_handler().set(m_cia2, FUNC(mos6526_device::cnt_w));
+ m_user->p7_handler().set(m_cia2, FUNC(mos6526_device::sp_w));
+ m_user->p9_handler().set(m_iec, FUNC(cbm_iec_device::host_atn_w));
+ m_user->pb_handler().set(m_cia2, FUNC(mos6526_device::flag_w));
+ m_user->pc_handler().set(FUNC(c64_state::write_user_pb0));
+ m_user->pd_handler().set(FUNC(c64_state::write_user_pb1));
+ m_user->pe_handler().set(FUNC(c64_state::write_user_pb2));
+ m_user->pf_handler().set(FUNC(c64_state::write_user_pb3));
+ m_user->ph_handler().set(FUNC(c64_state::write_user_pb4));
+ m_user->pj_handler().set(FUNC(c64_state::write_user_pb5));
+ m_user->pk_handler().set(FUNC(c64_state::write_user_pb6));
+ m_user->pl_handler().set(FUNC(c64_state::write_user_pb7));
+ m_user->pm_handler().set(FUNC(c64_state::write_user_pa2));
MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
@@ -1495,10 +1438,16 @@ MACHINE_CONFIG_START(c64_state::pal)
MCFG_M6510_PORT_PULLS(0x17, 0xc8)
MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
+ input_merger_device &irq(INPUT_MERGER_ANY_HIGH(config, "irq"));
+ irq.output_handler().set_inputline(m_maincpu, m6510_device::IRQ_LINE);
+
+ INPUT_MERGER_ANY_HIGH(config, m_nmi);
+ m_nmi->output_handler().set_inputline(m_maincpu, m6510_device::NMI_LINE);
+
// video hardware
mos6569_device &mos6569(MOS6569(config, MOS6569_TAG, XTAL(17'734'472)/18));
mos6569.set_cpu(M6510_TAG);
- mos6569.irq_callback().set(FUNC(c64_state::vic_irq_w));
+ mos6569.irq_callback().set("irq", FUNC(input_merger_device::in_w<1>));
mos6569.set_screen(SCREEN_TAG);
mos6569.set_addrmap(0, &c64_state::vic_videoram_map);
mos6569.set_addrmap(1, &c64_state::vic_colorram_map);
@@ -1520,7 +1469,7 @@ MACHINE_CONFIG_START(c64_state::pal)
MCFG_PLS100_ADD(PLA_TAG)
MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL(17'734'472)/18)
MCFG_MOS6526_TOD(50)
- MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, c64_state, cia1_irq_w))
+ MCFG_MOS6526_IRQ_CALLBACK(WRITELINE("irq", input_merger_device, in_w<0>))
MCFG_MOS6526_CNT_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4))
MCFG_MOS6526_SP_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5))
MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c64_state, cia1_pa_r))
@@ -1529,7 +1478,7 @@ MACHINE_CONFIG_START(c64_state::pal)
MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(*this, c64_state, cia1_pb_w))
MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL(17'734'472)/18)
MCFG_MOS6526_TOD(50)
- MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, c64_state, cia2_irq_w))
+ MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(m_nmi, input_merger_device, in_w<0>))
MCFG_MOS6526_CNT_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6))
MCFG_MOS6526_SP_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7))
MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c64_state, cia2_pa_r))
@@ -1544,31 +1493,32 @@ MACHINE_CONFIG_START(c64_state::pal)
MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, nullptr)
MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(WRITELINE(MOS6569_TAG, mos6569_device, lp_w))
MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy")
- MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL(17'734'472)/18, c64_expansion_cards, nullptr)
- MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, c64_state, exp_irq_w))
- MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(*this, c64_state, exp_nmi_w))
- MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(*this, c64_state, exp_reset_w))
- MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(*this, c64_state, read))
- MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(*this, c64_state, write))
- MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(*this, c64_state, exp_dma_w))
-
- MCFG_DEVICE_ADD(PET_USER_PORT_TAG, PET_USER_PORT, c64_user_port_cards, nullptr)
- MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(*this, c64_state, exp_reset_w))
- MCFG_PET_USER_PORT_4_HANDLER(WRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w))
- MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(MOS6526_1_TAG, mos6526_device, sp_w))
- MCFG_PET_USER_PORT_6_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w))
- MCFG_PET_USER_PORT_7_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, sp_w))
- MCFG_PET_USER_PORT_9_HANDLER(WRITELINE(CBM_IEC_TAG, cbm_iec_device, host_atn_w))
- MCFG_PET_USER_PORT_B_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, flag_w))
- MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(*this, c64_state, write_user_pb0))
- MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(*this, c64_state, write_user_pb1))
- MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(*this, c64_state, write_user_pb2))
- MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(*this, c64_state, write_user_pb3))
- MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(*this, c64_state, write_user_pb4))
- MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(*this, c64_state, write_user_pb5))
- MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(*this, c64_state, write_user_pb6))
- MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(*this, c64_state, write_user_pb7))
- MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(*this, c64_state, write_user_pa2))
+
+ C64_EXPANSION_SLOT(config, m_exp, XTAL(17'734'472)/18, c64_expansion_cards, nullptr);
+ m_exp->irq_callback().set("irq", FUNC(input_merger_device::in_w<2>));
+ m_exp->nmi_callback().set(m_nmi, FUNC(input_merger_device::in_w<2>));
+ m_exp->reset_callback().set(FUNC(c64_state::exp_reset_w));
+ m_exp->cd_input_callback().set(FUNC(c64_state::read));
+ m_exp->cd_output_callback().set(FUNC(c64_state::write));
+ m_exp->dma_callback().set(FUNC(c64_state::exp_dma_w));
+
+ PET_USER_PORT(config, m_user, c64_user_port_cards, nullptr);
+ m_user->p3_handler().set(FUNC(c64_state::exp_reset_w));
+ m_user->p4_handler().set(m_cia1, FUNC(mos6526_device::cnt_w));
+ m_user->p5_handler().set(m_cia1, FUNC(mos6526_device::sp_w));
+ m_user->p6_handler().set(m_cia2, FUNC(mos6526_device::cnt_w));
+ m_user->p7_handler().set(m_cia2, FUNC(mos6526_device::sp_w));
+ m_user->p9_handler().set(m_iec, FUNC(cbm_iec_device::host_atn_w));
+ m_user->pb_handler().set(m_cia2, FUNC(mos6526_device::flag_w));
+ m_user->pc_handler().set(FUNC(c64_state::write_user_pb0));
+ m_user->pd_handler().set(FUNC(c64_state::write_user_pb1));
+ m_user->pe_handler().set(FUNC(c64_state::write_user_pb2));
+ m_user->pf_handler().set(FUNC(c64_state::write_user_pb3));
+ m_user->ph_handler().set(FUNC(c64_state::write_user_pb4));
+ m_user->pj_handler().set(FUNC(c64_state::write_user_pb5));
+ m_user->pk_handler().set(FUNC(c64_state::write_user_pb6));
+ m_user->pl_handler().set(FUNC(c64_state::write_user_pb7));
+ m_user->pm_handler().set(FUNC(c64_state::write_user_pa2));
MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
@@ -1632,10 +1582,16 @@ MACHINE_CONFIG_START(c64gs_state::pal_gs)
MCFG_M6510_PORT_PULLS(0x07, 0xc0)
MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
+ input_merger_device &irq(INPUT_MERGER_ANY_HIGH(config, "irq"));
+ irq.output_handler().set_inputline(m_maincpu, m6510_device::IRQ_LINE);
+
+ INPUT_MERGER_ANY_HIGH(config, m_nmi);
+ m_nmi->output_handler().set_inputline(m_maincpu, m6510_device::NMI_LINE);
+
// video hardware
mos8565_device &mos8565(MOS8565(config, MOS6569_TAG, XTAL(17'734'472)/18));
mos8565.set_cpu(M6510_TAG);
- mos8565.irq_callback().set(FUNC(c64_state::vic_irq_w));
+ mos8565.irq_callback().set("irq", FUNC(input_merger_device::in_w<1>));
mos8565.set_screen(SCREEN_TAG);
mos8565.set_addrmap(0, &c64_state::vic_videoram_map);
mos8565.set_addrmap(1, &c64_state::vic_colorram_map);
@@ -1657,7 +1613,7 @@ MACHINE_CONFIG_START(c64gs_state::pal_gs)
MCFG_PLS100_ADD(PLA_TAG)
MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL(17'734'472)/18)
MCFG_MOS6526_TOD(50)
- MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, c64_state, cia1_irq_w))
+ MCFG_MOS6526_IRQ_CALLBACK(WRITELINE("irq", input_merger_device, in_w<0>))
MCFG_MOS6526_CNT_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4))
MCFG_MOS6526_SP_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5))
MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c64gs_state, cia1_pa_r))
@@ -1666,7 +1622,7 @@ MACHINE_CONFIG_START(c64gs_state::pal_gs)
MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(*this, c64_state, cia1_pb_w))
MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL(17'734'472)/18)
MCFG_MOS6526_TOD(50)
- MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, c64_state, cia2_irq_w))
+ MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(m_nmi, input_merger_device, in_w<0>))
MCFG_MOS6526_CNT_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6))
MCFG_MOS6526_SP_CALLBACK(WRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7))
MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c64_state, cia2_pa_r))
@@ -1680,31 +1636,32 @@ MACHINE_CONFIG_START(c64gs_state::pal_gs)
MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, nullptr)
MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(WRITELINE(MOS6569_TAG, mos6569_device, lp_w))
MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy")
- MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL(17'734'472)/18, c64_expansion_cards, nullptr)
- MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, c64_state, exp_irq_w))
- MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(*this, c64_state, exp_nmi_w))
- MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(*this, c64_state, exp_reset_w))
- MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(*this, c64_state, read))
- MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(*this, c64_state, write))
- MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(*this, c64_state, exp_dma_w))
-
- MCFG_DEVICE_ADD(PET_USER_PORT_TAG, PET_USER_PORT, c64_user_port_cards, nullptr)
- MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(*this, c64_state, exp_reset_w))
- MCFG_PET_USER_PORT_4_HANDLER(WRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w))
- MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(MOS6526_1_TAG, mos6526_device, sp_w))
- MCFG_PET_USER_PORT_6_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w))
- MCFG_PET_USER_PORT_7_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, sp_w))
- MCFG_PET_USER_PORT_9_HANDLER(WRITELINE(CBM_IEC_TAG, cbm_iec_device, host_atn_w))
- MCFG_PET_USER_PORT_B_HANDLER(WRITELINE(MOS6526_2_TAG, mos6526_device, flag_w))
- MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(*this, c64_state, write_user_pb0))
- MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(*this, c64_state, write_user_pb1))
- MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(*this, c64_state, write_user_pb2))
- MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(*this, c64_state, write_user_pb3))
- MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(*this, c64_state, write_user_pb4))
- MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(*this, c64_state, write_user_pb5))
- MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(*this, c64_state, write_user_pb6))
- MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(*this, c64_state, write_user_pb7))
- MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(*this, c64_state, write_user_pa2))
+
+ C64_EXPANSION_SLOT(config, m_exp, XTAL(17'734'472)/18, c64_expansion_cards, nullptr);
+ m_exp->irq_callback().set("irq", FUNC(input_merger_device::in_w<2>));
+ m_exp->nmi_callback().set(m_nmi, FUNC(input_merger_device::in_w<2>));
+ m_exp->reset_callback().set(FUNC(c64_state::exp_reset_w));
+ m_exp->cd_input_callback().set(FUNC(c64_state::read));
+ m_exp->cd_output_callback().set(FUNC(c64_state::write));
+ m_exp->dma_callback().set(FUNC(c64_state::exp_dma_w));
+
+ PET_USER_PORT(config, m_user, c64_user_port_cards, nullptr);
+ m_user->p3_handler().set(FUNC(c64_state::exp_reset_w));
+ m_user->p4_handler().set(m_cia1, FUNC(mos6526_device::cnt_w));
+ m_user->p5_handler().set(m_cia1, FUNC(mos6526_device::sp_w));
+ m_user->p6_handler().set(m_cia2, FUNC(mos6526_device::cnt_w));
+ m_user->p7_handler().set(m_cia2, FUNC(mos6526_device::sp_w));
+ m_user->p9_handler().set(m_iec, FUNC(cbm_iec_device::host_atn_w));
+ m_user->pb_handler().set(m_cia2, FUNC(mos6526_device::flag_w));
+ m_user->pc_handler().set(FUNC(c64_state::write_user_pb0));
+ m_user->pd_handler().set(FUNC(c64_state::write_user_pb1));
+ m_user->pe_handler().set(FUNC(c64_state::write_user_pb2));
+ m_user->pf_handler().set(FUNC(c64_state::write_user_pb3));
+ m_user->ph_handler().set(FUNC(c64_state::write_user_pb4));
+ m_user->pj_handler().set(FUNC(c64_state::write_user_pb5));
+ m_user->pk_handler().set(FUNC(c64_state::write_user_pb6));
+ m_user->pl_handler().set(FUNC(c64_state::write_user_pb7));
+ m_user->pm_handler().set(FUNC(c64_state::write_user_pa2));
MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)