IRQ_CALLBACK_MEMBER cleanup (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-18 12:17:41 +00:00
parent fb972fd2b5
commit 8882b5f7f8
9 changed files with 41 additions and 45 deletions

View File

@ -181,6 +181,7 @@ public:
DECLARE_DRIVER_INIT(sq1);
DECLARE_DRIVER_INIT(denib);
DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
IRQ_CALLBACK_MEMBER(maincpu_irq_acknowledge_callback);
};
FLOPPY_FORMATS_MEMBER( esq5505_state::floppy_formats )
@ -191,29 +192,29 @@ static SLOT_INTERFACE_START( ensoniq_floppies )
SLOT_INTERFACE( "35dd", FLOPPY_35_DD )
SLOT_INTERFACE_END
static int maincpu_irq_acknowledge_callback(device_t *device, int irqnum) {
IRQ_CALLBACK_MEMBER(esq5505_state::maincpu_irq_acknowledge_callback)
{
// We immediately update the interrupt presented to the CPU, so that it doesn't
// end up retrying the same interrupt over and over. We then return the appropriate vector.
esq5505_state *esq5505 = device->machine().driver_data<esq5505_state>();
int vector = 0;
switch(irqnum) {
switch(irqline) {
case 1:
esq5505->otis_irq_state = 0;
otis_irq_state = 0;
vector = M68K_INT_ACK_AUTOVECTOR;
break;
case 2:
esq5505->dmac_irq_state = 0;
vector = esq5505->dmac_irq_vector;
dmac_irq_state = 0;
vector = dmac_irq_vector;
break;
case 3:
esq5505->duart_irq_state = 0;
vector = esq5505->duart_irq_vector;
duart_irq_state = 0;
vector = duart_irq_vector;
break;
default:
printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqnum);
printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline);
return 0;
}
esq5505->update_irq_to_maincpu();
update_irq_to_maincpu();
return vector;
}
@ -221,7 +222,7 @@ void esq5505_state::machine_reset()
{
m_rom = (UINT16 *)(void *)machine().root_device().memregion("osrom")->base();
m_ram = (UINT16 *)(void *)machine().root_device().memshare("osram")->ptr();
m_maincpu->set_irq_acknowledge_callback(maincpu_irq_acknowledge_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(esq5505_state::maincpu_irq_acknowledge_callback),this));
}
void esq5505_state::update_irq_to_maincpu() {

View File

@ -54,6 +54,7 @@ public:
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
TIMER_DEVICE_CALLBACK_MEMBER(vsync_callback);
IRQ_CALLBACK_MEMBER(fk1_irq_callback);
};
@ -404,12 +405,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::keyboard_callback)
0 ? PRINTER
*/
static IRQ_CALLBACK (fk1_irq_callback)
IRQ_CALLBACK_MEMBER(fk1_state::fk1_irq_callback)
{
fk1_state *state = device->machine().driver_data<fk1_state>();
logerror("IRQ %02x\n", state->m_int_vector*2);
return state->m_int_vector * 2;
logerror("IRQ %02x\n", m_int_vector*2);
return m_int_vector * 2;
}
TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::vsync_callback)
@ -430,7 +429,7 @@ void fk1_state::machine_reset()
membank("bank3")->set_base(ram + 0x8000);
membank("bank4")->set_base(ram + 0xc000);
machine().device("maincpu")->execute().set_irq_acknowledge_callback(fk1_irq_callback);
machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(fk1_state::fk1_irq_callback),this));
}
UINT32 fk1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)

View File

@ -36,6 +36,7 @@ public:
UINT8 m_tty_key_data;
int m_tty_cnt;
virtual void machine_reset();
IRQ_CALLBACK_MEMBER(mod8_irq_callback);
};
WRITE8_MEMBER( mod8_state::out_w )
@ -82,14 +83,14 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( mod8 )
INPUT_PORTS_END
static IRQ_CALLBACK ( mod8_irq_callback )
IRQ_CALLBACK_MEMBER(mod8_state::mod8_irq_callback)
{
return 0xC0; // LAA - NOP equivalent
}
void mod8_state::machine_reset()
{
machine().device("maincpu")->execute().set_irq_acknowledge_callback(mod8_irq_callback);
machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(mod8_state::mod8_irq_callback),this));
}
WRITE8_MEMBER( mod8_state::kbd_put )

View File

@ -266,7 +266,7 @@ public:
DECLARE_WRITE8_MEMBER(pc6001_8255_portc_w);
DECLARE_READ8_MEMBER(pc6001_8255_portc_r);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc6001_cass);
IRQ_CALLBACK_MEMBER(pc6001_irq_callback);
protected:
required_device<cpu_device> m_maincpu;
required_device<device_t> m_cassette;
@ -1906,11 +1906,10 @@ INTERRUPT_GEN_MEMBER(pc6001_state::pc6001sr_interrupt)
device.execute().set_input_line(0, ASSERT_LINE);
}
static IRQ_CALLBACK ( pc6001_irq_callback )
IRQ_CALLBACK_MEMBER(pc6001_state::pc6001_irq_callback)
{
pc6001_state *state = device->machine().driver_data<pc6001_state>();
device->execute().set_input_line(0, CLEAR_LINE);
return state->m_irq_vector;
device.execute().set_input_line(0, CLEAR_LINE);
return m_irq_vector;
}
READ8_MEMBER(pc6001_state::pc6001_8255_porta_r)
@ -2156,7 +2155,7 @@ void pc6001_state::machine_reset()
m_port_c_8255=0;
m_maincpu->set_irq_acknowledge_callback(pc6001_irq_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc6001_state::pc6001_irq_callback),this));
m_cas_switch = 0;
m_cas_offset = 0;
m_timer_irq_mask = 1;
@ -2173,7 +2172,7 @@ MACHINE_RESET_MEMBER(pc6001_state,pc6001m2)
m_port_c_8255=0;
m_maincpu->set_irq_acknowledge_callback(pc6001_irq_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc6001_state::pc6001_irq_callback),this));
m_cas_switch = 0;
m_cas_offset = 0;
@ -2208,7 +2207,7 @@ MACHINE_RESET_MEMBER(pc6001_state,pc6001sr)
m_port_c_8255=0;
m_maincpu->set_irq_acknowledge_callback(pc6001_irq_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc6001_state::pc6001_irq_callback),this));
m_cas_switch = 0;
m_cas_offset = 0;

View File

@ -41,7 +41,8 @@ public:
UINT32 screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(galaxy_interrupt);
TIMER_CALLBACK_MEMBER(gal_video);
IRQ_CALLBACK_MEMBER(galaxy_irq_callback);
void galaxy_set_timer();
protected:
required_device<cpu_device> m_maincpu;
required_device<cassette_image_device> m_cassette;
@ -54,7 +55,4 @@ protected:
/*----------- defined in machine/galaxy.c -----------*/
SNAPSHOT_LOAD( galaxy );
/*----------- defined in video/galaxy.c -----------*/
void galaxy_set_timer(running_machine &machine);
#endif /* GALAXY_H_ */

View File

@ -54,6 +54,7 @@ public:
TIMER_CALLBACK_MEMBER(poly88_cassette_timer_callback);
TIMER_CALLBACK_MEMBER(setup_machine_state);
DECLARE_WRITE_LINE_MEMBER(poly88_usart_rxready);
IRQ_CALLBACK_MEMBER(poly88_irq_callback);
protected:
required_device<cpu_device> m_maincpu;

View File

@ -46,11 +46,10 @@ INTERRUPT_GEN_MEMBER(galaxy_state::galaxy_interrupt)
device.execute().set_input_line(0, HOLD_LINE);
}
static IRQ_CALLBACK ( galaxy_irq_callback )
IRQ_CALLBACK_MEMBER(galaxy_state::galaxy_irq_callback)
{
galaxy_state *state = device->machine().driver_data<galaxy_state>();
galaxy_set_timer(device->machine());
state->m_interrupts_enabled = TRUE;
galaxy_set_timer();
m_interrupts_enabled = TRUE;
return 0xff;
}
@ -187,7 +186,7 @@ MACHINE_RESET_MEMBER(galaxy_state,galaxy)
if (ioport("ROM2")->read())
membank("bank10")->set_base(memregion("maincpu")->base() + 0x1000);
m_maincpu->set_irq_acknowledge_callback(galaxy_irq_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(galaxy_state::galaxy_irq_callback),this));
m_interrupts_enabled = TRUE;
}
@ -201,7 +200,7 @@ MACHINE_RESET_MEMBER(galaxy_state,galaxyp)
UINT8 *ROM = memregion("maincpu")->base();
address_space &space = m_maincpu->space(AS_PROGRAM);
m_maincpu->set_irq_acknowledge_callback(galaxy_irq_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(galaxy_state::galaxy_irq_callback),this));
ROM[0x0037] = 0x29;
ROM[0x03f9] = 0xcd;

View File

@ -130,10 +130,9 @@ TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback)
}
}
static IRQ_CALLBACK (poly88_irq_callback)
IRQ_CALLBACK_MEMBER(poly88_state::poly88_irq_callback)
{
poly88_state *state = device->machine().driver_data<poly88_state>();
return state->m_int_vector;
return m_int_vector;
}
TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback)
@ -208,7 +207,7 @@ DRIVER_INIT_MEMBER(poly88_state,poly88)
void poly88_state::machine_reset()
{
m_maincpu->set_irq_acknowledge_callback(poly88_irq_callback);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(poly88_state::poly88_irq_callback),this));
m_intr = 0;
m_last_code = 0;

View File

@ -102,11 +102,10 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video)
}
}
void galaxy_set_timer(running_machine &machine)
void galaxy_state::galaxy_set_timer()
{
galaxy_state *state = machine.driver_data<galaxy_state>();
state->m_gal_cnt = 0;
state->m_gal_video_timer->adjust(attotime::zero, 0, attotime::from_hz(6144000 / 8));
m_gal_cnt = 0;
m_gal_video_timer->adjust(attotime::zero, 0, attotime::from_hz(6144000 / 8));
}
void galaxy_state::video_start()