mirror of
https://github.com/holub/mame
synced 2025-10-07 17:27:06 +03:00
Made IRQ_CALLBACK as members to work and made usage of delegates, with few updated drivers, rest will follow, this require clean build (no whatsnew)
This commit is contained in:
parent
2ab4d2770a
commit
3e73b779d0
@ -79,7 +79,7 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig
|
|||||||
m_timed_interrupt_period(attotime::zero),
|
m_timed_interrupt_period(attotime::zero),
|
||||||
m_is_octal(false),
|
m_is_octal(false),
|
||||||
m_nextexec(NULL),
|
m_nextexec(NULL),
|
||||||
m_driver_irq(0),
|
m_driver_irq_legacy(0),
|
||||||
m_timedint_timer(NULL),
|
m_timedint_timer(NULL),
|
||||||
m_profiler(PROFILER_IDLE),
|
m_profiler(PROFILER_IDLE),
|
||||||
m_icountptr(NULL),
|
m_icountptr(NULL),
|
||||||
@ -263,10 +263,21 @@ void device_execute_interface::abort_timeslice()
|
|||||||
|
|
||||||
void device_execute_interface::set_irq_acknowledge_callback(device_irq_acknowledge_callback callback)
|
void device_execute_interface::set_irq_acknowledge_callback(device_irq_acknowledge_callback callback)
|
||||||
{
|
{
|
||||||
m_driver_irq = callback;
|
m_driver_irq_legacy = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// set_irq_acknowledge_callback - install a driver-specific
|
||||||
|
// callback for IRQ acknowledge
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void device_execute_interface::set_irq_acknowledge_callback(device_irq_acknowledge_delegate callback)
|
||||||
|
{
|
||||||
|
m_driver_irq = callback;
|
||||||
|
m_driver_irq_legacy = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// suspend - set a suspend reason for this device
|
// suspend - set a suspend reason for this device
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -512,7 +523,7 @@ void device_execute_interface::interface_pre_start()
|
|||||||
// bind delegates
|
// bind delegates
|
||||||
m_vblank_interrupt.bind_relative_to(device());
|
m_vblank_interrupt.bind_relative_to(device());
|
||||||
m_timed_interrupt.bind_relative_to(device());
|
m_timed_interrupt.bind_relative_to(device());
|
||||||
// m_driver_irq.bind_relative_to(device());
|
m_driver_irq.bind_relative_to(device());
|
||||||
|
|
||||||
// fill in the initial states
|
// fill in the initial states
|
||||||
execute_interface_iterator iter(device().machine().root_device());
|
execute_interface_iterator iter(device().machine().root_device());
|
||||||
@ -653,8 +664,10 @@ int device_execute_interface::standard_irq_callback(int irqline)
|
|||||||
LOG(("static_standard_irq_callback('%s', %d) $%04x\n", device().tag(), irqline, vector));
|
LOG(("static_standard_irq_callback('%s', %d) $%04x\n", device().tag(), irqline, vector));
|
||||||
|
|
||||||
// if there's a driver callback, run it to get the vector
|
// if there's a driver callback, run it to get the vector
|
||||||
if (m_driver_irq != NULL)
|
if (m_driver_irq_legacy != NULL)
|
||||||
vector = (*m_driver_irq)(&device(), irqline);
|
vector = (*m_driver_irq_legacy)(&device(), irqline);
|
||||||
|
else if (!m_driver_irq.isnull())
|
||||||
|
vector = m_driver_irq(device(),irqline);
|
||||||
|
|
||||||
// notify the debugger
|
// notify the debugger
|
||||||
debugger_interrupt_hook(&device(), irqline);
|
debugger_interrupt_hook(&device(), irqline);
|
||||||
|
@ -101,6 +101,7 @@ enum
|
|||||||
|
|
||||||
// IRQ callback to be called by device implementations when an IRQ is actually taken
|
// IRQ callback to be called by device implementations when an IRQ is actually taken
|
||||||
#define IRQ_CALLBACK(func) int func(device_t *device, int irqline)
|
#define IRQ_CALLBACK(func) int func(device_t *device, int irqline)
|
||||||
|
#define IRQ_CALLBACK_MEMBER(func) int func(device_t &device, int irqline)
|
||||||
|
|
||||||
// interrupt generator callback called as a VBLANK or periodic interrupt
|
// interrupt generator callback called as a VBLANK or periodic interrupt
|
||||||
#define INTERRUPT_GEN(func) void func(device_t *device)
|
#define INTERRUPT_GEN(func) void func(device_t *device)
|
||||||
@ -141,7 +142,7 @@ typedef device_delegate<void (device_t &)> device_interrupt_delegate;
|
|||||||
typedef void (*device_interrupt_func)(device_t *device);
|
typedef void (*device_interrupt_func)(device_t *device);
|
||||||
|
|
||||||
// IRQ callback to be called by executing devices when an IRQ is actually taken
|
// IRQ callback to be called by executing devices when an IRQ is actually taken
|
||||||
typedef device_delegate<void (device_t &, int)> device_irq_acknowledge_delegate;
|
typedef device_delegate<int (device_t &, int)> device_irq_acknowledge_delegate;
|
||||||
typedef int (*device_irq_acknowledge_callback)(device_t *device, int irqnum);
|
typedef int (*device_irq_acknowledge_callback)(device_t *device, int irqnum);
|
||||||
|
|
||||||
|
|
||||||
@ -190,6 +191,7 @@ public:
|
|||||||
void set_input_line_and_vector(int linenum, int state, int vector) { m_input[linenum].set_state_synced(state, vector); }
|
void set_input_line_and_vector(int linenum, int state, int vector) { m_input[linenum].set_state_synced(state, vector); }
|
||||||
int input_state(int linenum) { return m_input[linenum].m_curstate; }
|
int input_state(int linenum) { return m_input[linenum].m_curstate; }
|
||||||
void set_irq_acknowledge_callback(device_irq_acknowledge_callback callback);
|
void set_irq_acknowledge_callback(device_irq_acknowledge_callback callback);
|
||||||
|
void set_irq_acknowledge_callback(device_irq_acknowledge_delegate callback);
|
||||||
|
|
||||||
// suspend/resume
|
// suspend/resume
|
||||||
void suspend(UINT32 reason, bool eatcycles);
|
void suspend(UINT32 reason, bool eatcycles);
|
||||||
@ -292,7 +294,8 @@ protected:
|
|||||||
device_execute_interface *m_nextexec; // pointer to the next device to execute, in order
|
device_execute_interface *m_nextexec; // pointer to the next device to execute, in order
|
||||||
|
|
||||||
// input states and IRQ callbacks
|
// input states and IRQ callbacks
|
||||||
device_irq_acknowledge_callback m_driver_irq; // driver-specific IRQ callback
|
device_irq_acknowledge_callback m_driver_irq_legacy;// driver-specific IRQ callback
|
||||||
|
device_irq_acknowledge_delegate m_driver_irq; // driver-specific IRQ callback
|
||||||
device_input m_input[MAX_INPUT_LINES]; // data about inputs
|
device_input m_input[MAX_INPUT_LINES]; // data about inputs
|
||||||
emu_timer * m_timedint_timer; // reference to this device's periodic interrupt timer
|
emu_timer * m_timedint_timer; // reference to this device's periodic interrupt timer
|
||||||
|
|
||||||
|
@ -205,6 +205,7 @@ public:
|
|||||||
TIMER_CALLBACK_MEMBER(keyboard_callback);
|
TIMER_CALLBACK_MEMBER(keyboard_callback);
|
||||||
TIMER_CALLBACK_MEMBER(counter_6ms_callback);
|
TIMER_CALLBACK_MEMBER(counter_6ms_callback);
|
||||||
TIMER_CALLBACK_MEMBER(swyft_reset);
|
TIMER_CALLBACK_MEMBER(swyft_reset);
|
||||||
|
IRQ_CALLBACK_MEMBER(cat_int_ack);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: this init doesn't actually work yet! please fix me!
|
// TODO: this init doesn't actually work yet! please fix me!
|
||||||
@ -681,9 +682,9 @@ TIMER_CALLBACK_MEMBER(cat_state::counter_6ms_callback)
|
|||||||
m_6ms_counter++;
|
m_6ms_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IRQ_CALLBACK(cat_int_ack)
|
IRQ_CALLBACK_MEMBER(cat_state::cat_int_ack)
|
||||||
{
|
{
|
||||||
device->machine().device("maincpu")->execute().set_input_line(M68K_IRQ_1,CLEAR_LINE);
|
machine().device("maincpu")->execute().set_input_line(M68K_IRQ_1,CLEAR_LINE);
|
||||||
return M68K_INT_ACK_AUTOVECTOR;
|
return M68K_INT_ACK_AUTOVECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,7 +701,7 @@ MACHINE_START_MEMBER(cat_state,cat)
|
|||||||
|
|
||||||
MACHINE_RESET_MEMBER(cat_state,cat)
|
MACHINE_RESET_MEMBER(cat_state,cat)
|
||||||
{
|
{
|
||||||
machine().device("maincpu")->execute().set_irq_acknowledge_callback(cat_int_ack);
|
machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(cat_state::cat_int_ack),this));
|
||||||
m_6ms_counter = 0;
|
m_6ms_counter = 0;
|
||||||
m_keyboard_timer->adjust(attotime::zero, 0, attotime::from_hz(120));
|
m_keyboard_timer->adjust(attotime::zero, 0, attotime::from_hz(120));
|
||||||
m_6ms_timer->adjust(attotime::zero, 0, attotime::from_hz((XTAL_19_968MHz/2)/65536));
|
m_6ms_timer->adjust(attotime::zero, 0, attotime::from_hz((XTAL_19_968MHz/2)/65536));
|
||||||
|
@ -115,6 +115,7 @@ public:
|
|||||||
TIMER_DEVICE_CALLBACK_MEMBER(pc100_100hz_irq);
|
TIMER_DEVICE_CALLBACK_MEMBER(pc100_100hz_irq);
|
||||||
TIMER_DEVICE_CALLBACK_MEMBER(pc100_50hz_irq);
|
TIMER_DEVICE_CALLBACK_MEMBER(pc100_50hz_irq);
|
||||||
TIMER_DEVICE_CALLBACK_MEMBER(pc100_10hz_irq);
|
TIMER_DEVICE_CALLBACK_MEMBER(pc100_10hz_irq);
|
||||||
|
IRQ_CALLBACK_MEMBER(pc100_irq_callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
void pc100_state::video_start()
|
void pc100_state::video_start()
|
||||||
@ -399,9 +400,9 @@ static I8255A_INTERFACE( pc100_ppi8255_interface_2 )
|
|||||||
DEVCB_DRIVER_MEMBER(pc100_state, crtc_bank_w)
|
DEVCB_DRIVER_MEMBER(pc100_state, crtc_bank_w)
|
||||||
};
|
};
|
||||||
|
|
||||||
static IRQ_CALLBACK(pc100_irq_callback)
|
IRQ_CALLBACK_MEMBER(pc100_state::pc100_irq_callback)
|
||||||
{
|
{
|
||||||
return pic8259_acknowledge( device->machine().device( "pic8259" ) );
|
return pic8259_acknowledge( device.machine().device( "pic8259" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_LINE_MEMBER( pc100_state::pc100_set_int_line )
|
WRITE_LINE_MEMBER( pc100_state::pc100_set_int_line )
|
||||||
@ -419,7 +420,7 @@ static const struct pic8259_interface pc100_pic8259_config =
|
|||||||
|
|
||||||
void pc100_state::machine_start()
|
void pc100_state::machine_start()
|
||||||
{
|
{
|
||||||
machine().device("maincpu")->execute().set_irq_acknowledge_callback(pc100_irq_callback);
|
machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc100_state::pc100_irq_callback),this));
|
||||||
m_kanji_rom = (UINT16 *)(*machine().root_device().memregion("kanji"));
|
m_kanji_rom = (UINT16 *)(*machine().root_device().memregion("kanji"));
|
||||||
m_vram = (UINT16 *)(*memregion("vram"));
|
m_vram = (UINT16 *)(*memregion("vram"));
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ public:
|
|||||||
UINT32 screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
UINT32 screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
INTERRUPT_GEN_MEMBER(vector06_interrupt);
|
INTERRUPT_GEN_MEMBER(vector06_interrupt);
|
||||||
TIMER_CALLBACK_MEMBER(reset_check_callback);
|
TIMER_CALLBACK_MEMBER(reset_check_callback);
|
||||||
|
IRQ_CALLBACK_MEMBER(vector06_irq_callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ INTERRUPT_GEN_MEMBER(vector06_state::vector06_interrupt)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static IRQ_CALLBACK( vector06_irq_callback )
|
IRQ_CALLBACK_MEMBER(vector06_state::vector06_irq_callback)
|
||||||
{
|
{
|
||||||
// Interupt is RST 7
|
// Interupt is RST 7
|
||||||
return 0xff;
|
return 0xff;
|
||||||
@ -170,7 +170,7 @@ void vector06_state::machine_reset()
|
|||||||
{
|
{
|
||||||
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
|
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||||
|
|
||||||
machine().device("maincpu")->execute().set_irq_acknowledge_callback(vector06_irq_callback);
|
machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(vector06_state::vector06_irq_callback),this));
|
||||||
space.install_read_bank (0x0000, 0x7fff, "bank1");
|
space.install_read_bank (0x0000, 0x7fff, "bank1");
|
||||||
space.install_write_bank(0x0000, 0x7fff, "bank2");
|
space.install_write_bank(0x0000, 0x7fff, "bank2");
|
||||||
space.install_read_bank (0x8000, 0xffff, "bank3");
|
space.install_read_bank (0x8000, 0xffff, "bank3");
|
||||||
|
Loading…
Reference in New Issue
Block a user