machine_notify_delegate modernization (nw)

This commit is contained in:
Miodrag Milanovic 2013-02-04 09:54:24 +00:00
parent c736577005
commit d63986040f
48 changed files with 238 additions and 296 deletions

View File

@ -723,6 +723,7 @@ public:
virtual void video_start();
UINT32 screen_update_cobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(cobra_vblank);
void cobra_video_exit();
};
void cobra_renderer::render_color_scan(INT32 scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid)
@ -982,15 +983,14 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t
}
}
static void cobra_video_exit(running_machine *machine)
void cobra_state::cobra_video_exit()
{
cobra_state *state = machine->driver_data<cobra_state>();
state->m_renderer->gfx_exit(*machine);
m_renderer->gfx_exit(machine());
}
void cobra_state::video_start()
{
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cobra_video_exit), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cobra_state::cobra_video_exit), this));
m_renderer = auto_alloc(machine(), cobra_renderer(machine()));
m_renderer->gfx_init(machine());

View File

@ -2731,38 +2731,36 @@ ROM_START( kikstart )
ROM_LOAD( "pal16l8.28", 0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */
ROM_END
static void reset_common(running_machine &machine)
void taitosj_state::reset_common()
{
taitosj_state *state = machine.driver_data<taitosj_state>();
state->m_sndnmi_disable = 1;
state->m_input_port_4_f0 = 0;
m_sndnmi_disable = 1;
m_input_port_4_f0 = 0;
/* start in 1st gear */
state->m_kikstart_gears[0] = 0x02;
state->m_kikstart_gears[1] = 0x02;
state->m_dac_out = 0;
state->m_dac_vol = 0;
m_kikstart_gears[0] = 0x02;
m_kikstart_gears[1] = 0x02;
m_dac_out = 0;
m_dac_vol = 0;
}
static void init_common(running_machine &machine)
void taitosj_state::init_common()
{
taitosj_state *state = machine.driver_data<taitosj_state>();
state->save_item(NAME(state->m_sndnmi_disable));
state->save_item(NAME(state->m_input_port_4_f0));
state->save_item(NAME(state->m_kikstart_gears));
state->save_item(NAME(state->m_dac_out));
state->save_item(NAME(state->m_dac_vol));
machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(reset_common), &machine));
save_item(NAME(m_sndnmi_disable));
save_item(NAME(m_input_port_4_f0));
save_item(NAME(m_kikstart_gears));
save_item(NAME(m_dac_out));
save_item(NAME(m_dac_vol));
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(taitosj_state::reset_common), this));
}
DRIVER_INIT_MEMBER(taitosj_state,taitosj)
{
init_common(machine());
init_common();
}
DRIVER_INIT_MEMBER(taitosj_state,spacecr)
{
init_common(machine());
init_common();
/* install protection handler */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd48b, 0xd48b, read8_delegate(FUNC(taitosj_state::spacecr_prot_r),this));
@ -2770,7 +2768,7 @@ DRIVER_INIT_MEMBER(taitosj_state,spacecr)
DRIVER_INIT_MEMBER(taitosj_state,alpine)
{
init_common(machine());
init_common();
/* install protection handlers */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
@ -2779,7 +2777,7 @@ DRIVER_INIT_MEMBER(taitosj_state,alpine)
DRIVER_INIT_MEMBER(taitosj_state,alpinea)
{
init_common(machine());
init_common();
/* install protection handlers */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
@ -2788,7 +2786,7 @@ DRIVER_INIT_MEMBER(taitosj_state,alpinea)
DRIVER_INIT_MEMBER(taitosj_state,junglhbr)
{
init_common(machine());
init_common();
/* inverter on bits 0 and 1 */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(taitosj_state::junglhbr_characterram_w),this));

View File

@ -616,10 +616,10 @@ public:
DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
};
/*
static void taitotz_exit(running_machine &machine)
{
/*
taitotz_state *state = machine.driver_data<taitotz_state>();
FILE *file;
@ -654,9 +654,9 @@ static void taitotz_exit(running_machine &machine)
fputc((UINT8)(state->m_texture_ram[i] >> 0), file);
}
fclose(file);
*/
}
*/
void taitotz_state::video_start()
{
int width = machine().primary_screen->width();
@ -669,7 +669,7 @@ void taitotz_state::video_start()
/* create renderer */
m_renderer = auto_alloc(machine(), taitotz_renderer(machine(), width, height, m_texture_ram));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitotz_exit), &machine()));
//machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitotz_exit), &machine()));
}
static const float dot3_tex_table[32] =

View File

@ -653,19 +653,19 @@ static void tecmosys_descramble(running_machine &machine)
DRIVER_INIT_MEMBER(tecmosys_state,deroon)
{
tecmosys_descramble(machine());
tecmosys_prot_init(machine(), 0); // machine/tecmosys.c
tecmosys_prot_init(0); // machine/tecmosys.c
}
DRIVER_INIT_MEMBER(tecmosys_state,tkdensho)
{
tecmosys_descramble(machine());
tecmosys_prot_init(machine(), 1);
tecmosys_prot_init(1);
}
DRIVER_INIT_MEMBER(tecmosys_state,tkdensha)
{
tecmosys_descramble(machine());
tecmosys_prot_init(machine(), 2);
tecmosys_prot_init(2);
}
GAME( 1995, deroon, 0, deroon, deroon, tecmosys_state, deroon, ROT0, "Tecmo", "Deroon DeroDero", 0 )

View File

@ -50,4 +50,5 @@ public:
UINT32 screen_update_galastrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(galastrm_interrupt);
TIMER_CALLBACK_MEMBER(galastrm_interrupt6);
void galastrm_exit();
};

View File

@ -61,6 +61,8 @@ public:
INTERRUPT_GEN_MEMBER(display_irq);
TIMER_CALLBACK_MEMBER(display_irq_off);
TIMER_CALLBACK_MEMBER(invasn_gun_callback);
void exit_handler();
void exit_handler2();
};
/*----------- defined in video/midzeus2.c -----------*/

View File

@ -168,6 +168,7 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(model2_timer_cb);
TIMER_DEVICE_CALLBACK_MEMBER(model2_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(model2c_interrupt);
void model2_exit();
};
/*----------- defined in video/model2.c -----------*/

View File

@ -203,6 +203,7 @@ public:
UINT32 screen_update_model3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(model3_sound_timer_tick);
TIMER_DEVICE_CALLBACK_MEMBER(model3_interrupt);
void model3_exit();
};

View File

@ -23,6 +23,8 @@ public:
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
void n64_machine_stop();
UINT32 screen_update_n64(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
};
@ -120,7 +122,6 @@ public:
void poll_reset_button(bool button);
UINT32 dp_clock;
protected:
// device-level overrides
virtual void device_start();

View File

@ -269,6 +269,8 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(dsp_master_serial_irq);
TIMER_DEVICE_CALLBACK_MEMBER(dsp_slave_serial_irq);
TIMER_DEVICE_CALLBACK_MEMBER(mcu_irq);
void namcos22_reset();
void namcos22_exit();
};
/*----------- defined in video/namcos22.c -----------*/

View File

@ -93,4 +93,6 @@ public:
TIMER_CALLBACK_MEMBER(taitosj_mcu_real_data_w);
TIMER_CALLBACK_MEMBER(taitosj_mcu_data_real_r);
TIMER_CALLBACK_MEMBER(taitosj_mcu_status_real_w);
void init_common();
void reset_common();
};

View File

@ -80,7 +80,7 @@ public:
virtual void machine_start();
virtual void video_start();
UINT32 screen_update_tecmosys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void tecmosys_prot_init(int which);
void tecmosys_prot_reset();
};
/*----------- defined in machine/tecmosys.c -----------*/
void tecmosys_prot_init(running_machine &machine, int which);

View File

@ -2383,9 +2383,9 @@ WRITE32_MEMBER( n64_periphs::pif_ram_w )
signal_rcp_interrupt(SI_INTERRUPT);
}
static void n64_machine_stop(running_machine &machine)
void n64_state::n64_machine_stop()
{
n64_periphs *periphs = machine.device<n64_periphs>("rcp");
n64_periphs *periphs = machine().device<n64_periphs>("rcp");
if( periphs->m_nvram_image == NULL )
return;
@ -2418,7 +2418,7 @@ void n64_state::machine_start()
rspdrc_add_imem(machine().device("rsp"), rsp_imem);
/* add a hook for battery save */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(n64_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(n64_state::n64_machine_stop),this));
}
void n64_state::machine_reset()

View File

@ -103,25 +103,23 @@ static const struct prot_data tkdensha_data =
};
static void tecmosys_prot_reset(running_machine &machine)
{
tecmosys_state *state = machine.driver_data<tecmosys_state>();
state->m_device_read_ptr = 0;
state->m_device_status = DS_IDLE;
state->m_device_value = 0xff;
void tecmosys_state::tecmosys_prot_reset()
{
m_device_read_ptr = 0;
m_device_status = DS_IDLE;
m_device_value = 0xff;
}
void tecmosys_prot_init(running_machine &machine, int which)
void tecmosys_state::tecmosys_prot_init(int which)
{
tecmosys_state *state = machine.driver_data<tecmosys_state>();
switch (which)
{
case 0: state->m_device_data = &deroon_data; break;
case 1: state->m_device_data = &tkdensho_data; break;
case 2: state->m_device_data = &tkdensha_data; break;
case 0: m_device_data = &deroon_data; break;
case 1: m_device_data = &tkdensho_data; break;
case 2: m_device_data = &tkdensha_data; break;
}
machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_prot_reset), &machine));
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_state::tecmosys_prot_reset),this));
}
READ16_MEMBER(tecmosys_state::tecmosys_prot_status_r)

View File

@ -20,10 +20,9 @@ struct polygon
/******************************************************************/
static void galastrm_exit(running_machine &machine)
void galastrm_state::galastrm_exit()
{
galastrm_state *state = machine.driver_data<galastrm_state>();
poly_free(state->m_poly);
poly_free(m_poly);
}
void galastrm_state::video_start()
@ -34,7 +33,7 @@ void galastrm_state::video_start()
machine().primary_screen->register_screen_bitmap(m_polybitmap);
m_poly = poly_alloc(machine(), 16, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(galastrm_exit), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(galastrm_state::galastrm_exit), this));
}
/************************************************************

View File

@ -82,8 +82,6 @@ static int is_mk4b;
*
*************************************/
static void exit_handler(running_machine &machine);
static void zeus_pointer_w(UINT32 which, UINT32 data, int logit);
static void zeus_register16_w(running_machine &machine, offs_t offset, UINT16 data, int logit);
static void zeus_register32_w(running_machine &machine, offs_t offset, UINT32 data, int logit);
@ -275,7 +273,7 @@ VIDEO_START_MEMBER(midzeus_state,midzeus)
poly = poly_alloc(machine(), 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
/* we need to cleanup on exit */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus_state::exit_handler), this));
yoffs = 0;
texel_width = 256;
@ -301,7 +299,7 @@ VIDEO_START_MEMBER(midzeus_state,midzeus)
}
static void exit_handler(running_machine &machine)
void midzeus_state::exit_handler()
{
#if DUMP_WAVE_RAM
FILE *f = fopen("waveram.dmp", "w");

View File

@ -101,8 +101,6 @@ static int subregwrite_count[0x100];
*
*************************************/
static void exit_handler(running_machine &machine);
static void zeus_register32_w(running_machine &machine, offs_t offset, UINT32 data, int logit);
static void zeus_register_update(running_machine &machine, offs_t offset, UINT32 oldval, int logit);
static void zeus_pointer_write(UINT8 which, UINT32 value);
@ -272,7 +270,7 @@ VIDEO_START_MEMBER(midzeus_state,midzeus2)
poly = poly_alloc(machine(), 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
/* we need to cleanup on exit */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus_state::exit_handler2), this));
zbase = 2.0f;
yoffs = 0;
@ -296,7 +294,7 @@ VIDEO_START_MEMBER(midzeus_state,midzeus2)
}
static void exit_handler(running_machine &machine)
void midzeus_state::exit_handler2()
{
#if DUMP_WAVE_RAM
FILE *f = fopen("waveram.dmp", "w");

View File

@ -2692,10 +2692,9 @@ static void geo_parse( model2_state *state )
/***********************************************************************************************/
static void model2_exit(running_machine &machine)
void model2_state::model2_exit()
{
model2_state *state = machine.driver_data<model2_state>();
poly_free(state->m_poly);
poly_free(m_poly);
}
VIDEO_START_MEMBER(model2_state,model2)
@ -2707,7 +2706,7 @@ VIDEO_START_MEMBER(model2_state,model2)
m_sys24_bitmap.allocate(width, height+4);
m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0);
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_exit), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_state::model2_exit), this));
/* initialize the hardware rasterizer */
model2_3d_init( machine(), (UINT16*)memregion("user3")->base() );

View File

@ -105,18 +105,17 @@ static const int num_bits[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
#define BYTE_REVERSE16(x) (((x >> 8) & 0xff) | ((x << 8) & 0xff00))
static void model3_exit(running_machine &machine)
void model3_state::model3_exit()
{
model3_state *state = machine.driver_data<model3_state>();
invalidate_texture(machine, 0, 0, 0, 6, 5);
invalidate_texture(machine, 1, 0, 0, 6, 5);
poly_free(state->m_poly);
invalidate_texture(machine(), 0, 0, 0, 6, 5);
invalidate_texture(machine(), 1, 0, 0, 6, 5);
poly_free(m_poly);
}
void model3_state::video_start()
{
m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0);
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_exit), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_state::model3_exit), this));
machine().primary_screen->register_screen_bitmap(m_bitmap3d);
machine().primary_screen->register_screen_bitmap(m_zbuffer);

View File

@ -2661,16 +2661,15 @@ WRITE32_MEMBER(namcos22_state::namcos22_paletteram_w)
m_dirtypal[offset&(0x7fff/4)] = 1;
}
static void namcos22_reset(running_machine &machine)
void namcos22_state::namcos22_reset()
{
memset(&mSceneRoot, 0, sizeof(mSceneRoot));
mpFreeSceneNode = NULL;
}
static void namcos22_exit(running_machine &machine)
void namcos22_state::namcos22_exit()
{
namcos22_state *state = machine.driver_data<namcos22_state>();
poly_free(state->m_poly);
poly_free(m_poly);
}
VIDEO_START_MEMBER(namcos22_state,common)
@ -2695,8 +2694,8 @@ VIDEO_START_MEMBER(namcos22_state,common)
m_pPolyH = m_pPolyM + m_PtRomSize;
m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0);
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_reset), &machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_exit), &machine()));
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_state::namcos22_reset), this));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_state::namcos22_exit), this));
machine().gfx[GFX_CHAR]->set_source((UINT8 *)m_cgram.target());
}

View File

@ -292,15 +292,8 @@ static void draw_object_bank(running_machine &machine, bitmap_ind16 &bitmap, con
}
static void taitojc_exit(running_machine &machine)
{
}
void taitojc_state::video_start()
{
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitojc_exit), &machine()));
/* find first empty slot to decode gfx */
for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++)
if (machine().gfx[m_gfx_index] == 0)

View File

@ -43,27 +43,25 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt,
static const UINT32 timer_clks[4] = { 16777216, 16777216/64, 16777216/256, 16777216/1024 };
static void gba_machine_stop(running_machine &machine)
void gba_state::gba_machine_stop()
{
gba_state *state = machine.driver_data<gba_state>();
// only do this if the cart loader detected some form of backup
if (state->m_nvsize > 0)
if (m_nvsize > 0)
{
device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage);
image->battery_save(state->m_nvptr, state->m_nvsize);
device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
image->battery_save(m_nvptr, m_nvsize);
}
if (state->m_flash_size > 0)
if (m_flash_size > 0)
{
device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage);
UINT8 *nvram = auto_alloc_array( machine, UINT8, state->m_flash_size);
for (int i = 0; i < state->m_flash_size; i++)
device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
UINT8 *nvram = auto_alloc_array( machine(), UINT8, m_flash_size);
for (int i = 0; i < m_flash_size; i++)
{
nvram[i] = state->m_mFlashDev->read_raw( i);
nvram[i] = m_mFlashDev->read_raw( i);
}
image->battery_save( nvram, state->m_flash_size);
auto_free( machine, nvram);
image->battery_save( nvram, m_flash_size);
auto_free( machine(), nvram);
}
}
@ -2129,7 +2127,7 @@ void gba_state::machine_reset()
void gba_state::machine_start()
{
/* add a hook for battery save */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_state::gba_machine_stop),this));
/* create a timer to fire scanline functions */
m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_scan),this));

View File

@ -1476,10 +1476,6 @@ static const struct WD33C93interface wd33c93_intf =
&scsi_irq, /* command completion IRQ */
};
static void ip225015_exit(running_machine &machine)
{
}
static int ip22_get_out2(running_machine &machine)
{
ip22_state *state = machine.driver_data<ip22_state>();
@ -1491,8 +1487,6 @@ void ip22_state::machine_start()
sgi_mc_init(machine());
// SCSI init
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ip225015_exit),&machine()));
machine().device<nvram_device>("nvram_user")->set_base(m_RTC.nUserRAM, 0x200);
machine().device<nvram_device>("nvram")->set_base(m_RTC.nRAM, 0x200);
}

View File

@ -120,12 +120,6 @@ receive clock and transmit clock inputs */
static void nc_printer_update(running_machine &machine, UINT8 data);
static void nc100_machine_stop(running_machine &machine);
static void nc200_machine_stop(running_machine &machine);
/*
Port 0x00:
==========
@ -933,18 +927,18 @@ void nc_state::machine_reset()
m_irq_latch_mask = (1<<0) | (1<<1);
}
static void nc100_machine_stop(running_machine &machine)
void nc_state::nc100_machine_stop()
{
nc_common_open_stream_for_writing(machine);
nc_common_store_memory_to_stream(machine);
nc_common_close_stream(machine);
nc_common_open_stream_for_writing(machine());
nc_common_store_memory_to_stream(machine());
nc_common_close_stream(machine());
}
void nc_state::machine_start()
{
m_type = NC_TYPE_1xx;
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc100_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc_state::nc100_machine_stop),this));
/* keyboard timer */
m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this));
@ -1311,18 +1305,18 @@ MACHINE_RESET_MEMBER(nc_state,nc200)
nc200_video_set_backlight(machine(), 0);
}
static void nc200_machine_stop(running_machine &machine)
void nc_state::nc200_machine_stop()
{
nc_common_open_stream_for_writing(machine);
nc_common_store_memory_to_stream(machine);
nc_common_close_stream(machine);
nc_common_open_stream_for_writing(machine());
nc_common_store_memory_to_stream(machine());
nc_common_close_stream(machine());
}
MACHINE_START_MEMBER(nc_state,nc200)
{
m_type = NC_TYPE_200;
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc200_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc_state::nc200_machine_stop),this));
/* keyboard timer */
m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this));

View File

@ -387,8 +387,6 @@ static int tape_read(pdp1_state *state, UINT8 *reply);
static void pdp1_machine_stop(running_machine &machine);
static void pdp1_tape_read_binary(device_t *device);
static void pdp1_io_sc_callback(device_t *device);
@ -509,12 +507,11 @@ void pdp1_state::machine_reset()
}
static void pdp1_machine_stop(running_machine &machine)
void pdp1_state::pdp1_machine_stop()
{
pdp1_state *state = machine.driver_data<pdp1_state>();
/* the core will take care of freeing the timers, BUT we must set the variables
to NULL if we don't want to risk confusing the tape image init function */
state->m_tape_reader.timer = state->m_tape_puncher.timer = state->m_typewriter.tyo_timer = state->m_dpy_timer = NULL;
m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.tyo_timer = m_dpy_timer = NULL;
}
@ -656,7 +653,7 @@ void pdp1_state::machine_start()
dst = machine().root_device().memregion("gfx1")->base();
memcpy(dst, fontdata6x8, pdp1_fontdata_size);
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_state::pdp1_machine_stop),this));
m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this));
m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this));

View File

@ -372,12 +372,11 @@ void tx0_state::machine_reset()
}
static void tx0_machine_stop(running_machine &machine)
void tx0_state::tx0_machine_stop()
{
tx0_state *state = machine.driver_data<tx0_state>();
/* the core will take care of freeing the timers, BUT we must set the variables
to NULL if we don't want to risk confusing the tape image init function */
state->m_tape_reader.timer = state->m_tape_puncher.timer = state->m_typewriter.prt_timer = state->m_dis_timer = NULL;
m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.prt_timer = m_dis_timer = NULL;
}
@ -388,7 +387,7 @@ void tx0_state::machine_start()
m_typewriter.prt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::prt_callback),this));
m_dis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::dis_callback),this));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_state::tx0_machine_stop),this));
}

View File

@ -217,6 +217,7 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick);
TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL);
TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR);
void vboy_machine_stop();
};
@ -1164,22 +1165,20 @@ static INPUT_PORTS_START( vboy )
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low
INPUT_PORTS_END
static void vboy_machine_stop(running_machine &machine)
void vboy_state::vboy_machine_stop()
{
vboy_state *state = machine.driver_data<vboy_state>();
// only do this if the cart loader detected some form of backup
if (state->m_nvptr != NULL)
if (m_nvptr != NULL)
{
device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage);
image->battery_save(state->m_nvptr, 0x10000);
device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
image->battery_save(m_nvptr, 0x10000);
}
}
void vboy_state::machine_start()
{
/* add a hook for battery save */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_state::vboy_machine_stop),this));
// m_vboy_sram = auto_alloc_array(machine(), UINT32, 0x10000/4);
}

View File

@ -271,6 +271,7 @@ public:
DECLARE_WRITE8_MEMBER(a2bus_nmi_w);
DECLARE_WRITE8_MEMBER(a2bus_inh_w);
void apple2_update_memory_postload();
virtual void machine_reset();
};

View File

@ -87,6 +87,9 @@ public:
DECLARE_MACHINE_START(cybikoxt);
DECLARE_MACHINE_RESET(cybikoxt);
UINT32 screen_update_cybiko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void machine_stop_cybikov1();
void machine_stop_cybikov2();
void machine_stop_cybikoxt();
};
#endif /* CYBIKO_H_ */

View File

@ -143,6 +143,7 @@ public:
int m_Field;
int m_DrawInterlace;
virtual void machine_start();
virtual void machine_reset();
virtual void palette_init();
DECLARE_WRITE8_MEMBER(dgnbeta_ram_b0_w);
DECLARE_WRITE8_MEMBER(dgnbeta_ram_b1_w);

View File

@ -72,6 +72,7 @@ public:
void electron_tape_start();
void electron_tape_stop();
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

View File

@ -302,6 +302,7 @@ protected:
void gbc_hdma(UINT16 length);
void gb_increment_scanline();
void gb_lcd_switch_on();
void gb_machine_stop();
};

View File

@ -277,6 +277,7 @@ public:
TIMER_CALLBACK_MEMBER(handle_irq);
TIMER_CALLBACK_MEMBER(perform_hbl);
TIMER_CALLBACK_MEMBER(perform_scan);
void gba_machine_stop();
};
/*----------- defined in video/gba.c -----------*/

View File

@ -94,6 +94,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(nc200_fdc_interrupt);
void nc200_fdc_interrupt(bool state);
void nc100_machine_stop();
void nc200_machine_stop();
};

View File

@ -117,6 +117,7 @@ public:
virtual void machine_stop();
virtual void machine_reset();
virtual void video_start();
virtual void video_reset();
virtual void palette_init();
UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(nes_irq_callback);

View File

@ -267,6 +267,7 @@ public:
TIMER_CALLBACK_MEMBER(tyo_callback);
TIMER_CALLBACK_MEMBER(dpy_callback);
TIMER_CALLBACK_MEMBER(il_timer_callback);
void pdp1_machine_stop();
};
/*----------- defined in video/pdp1.c -----------*/

View File

@ -208,7 +208,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback);
void sms_machine_stop();
protected:
required_shared_ptr<UINT8> m_mainram;

View File

@ -157,6 +157,7 @@ public:
TIMER_CALLBACK_MEMBER(puncher_callback);
TIMER_CALLBACK_MEMBER(prt_callback);
TIMER_CALLBACK_MEMBER(dis_callback);
void tx0_machine_stop();
};

View File

@ -143,6 +143,7 @@ public:
DECLARE_PALETTE_INIT(wscolor);
TIMER_CALLBACK_MEMBER(wswan_rtc_callback);
TIMER_CALLBACK_MEMBER(wswan_scanline_interrupt);
void wswan_machine_stop();
protected:
/* Interrupt flags */

View File

@ -1175,35 +1175,34 @@ UINT8 apple2_getfloatingbusvalue(running_machine &machine)
* Machine reset
* ----------------------------------------------------------------------- */
static void apple2_reset(running_machine &machine)
void apple2_state::machine_reset()
{
apple2_state *state = machine.driver_data<apple2_state>();
int need_intcxrom;
state->m_rambase = state->m_ram->pointer();
state->apple2_refresh_delegates();
m_rambase = m_ram->pointer();
apple2_refresh_delegates();
need_intcxrom = !strcmp(machine.system().name, "apple2c")
|| !strcmp(machine.system().name, "apple2c0")
|| !strcmp(machine.system().name, "apple2c3")
|| !strcmp(machine.system().name, "apple2c4")
|| !strcmp(machine.system().name, "prav8c")
|| !strcmp(machine.system().name, "apple2cp")
|| !strncmp(machine.system().name, "apple2g", 7);
apple2_setvar(machine, need_intcxrom ? VAR_INTCXROM : 0, ~0);
need_intcxrom = !strcmp(machine().system().name, "apple2c")
|| !strcmp(machine().system().name, "apple2c0")
|| !strcmp(machine().system().name, "apple2c3")
|| !strcmp(machine().system().name, "apple2c4")
|| !strcmp(machine().system().name, "prav8c")
|| !strcmp(machine().system().name, "apple2cp")
|| !strncmp(machine().system().name, "apple2g", 7);
apple2_setvar(machine(), need_intcxrom ? VAR_INTCXROM : 0, ~0);
// ROM 0 cannot boot unless language card bank 2 is write-enabled (but read ROM) on startup
if (!strncmp(machine.system().name, "apple2g", 7))
if (!strncmp(machine().system().name, "apple2g", 7))
{
apple2_setvar(machine, VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2);
apple2_setvar(machine(), VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2);
}
state->m_a2_speaker_state = 0;
m_a2_speaker_state = 0;
state->m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset
m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset
state->m_joystick_x1_time = state->m_joystick_y1_time = 0;
state->m_joystick_x2_time = state->m_joystick_y2_time = 0;
m_joystick_x1_time = m_joystick_y1_time = 0;
m_joystick_x2_time = m_joystick_y2_time = 0;
}
@ -1760,7 +1759,6 @@ void apple2_init_common(running_machine &machine)
state->m_fdc_diskreg = 0;
AY3600_init(machine);
machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(apple2_reset),&machine));
/* state save registers */
state->save_item(NAME(state->m_flags));
@ -1807,9 +1805,6 @@ MACHINE_START_MEMBER(apple2_state,apple2)
mem_cfg.memmap = apple2_memmap_entries;
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
apple2_setup_memory(machine(), &mem_cfg);
/* perform initial reset */
apple2_reset(machine());
}
MACHINE_START_MEMBER(apple2_state,laser128)
@ -1827,9 +1822,6 @@ MACHINE_START_MEMBER(apple2_state,laser128)
mem_cfg.memmap = apple2_memmap_entries;
mem_cfg.auxmem = (UINT8*)NULL;
apple2_setup_memory(machine(), &mem_cfg);
/* perform initial reset */
apple2_reset(machine());
}
MACHINE_START_MEMBER(apple2_state,apple2orig)
@ -1850,9 +1842,6 @@ MACHINE_START_MEMBER(apple2_state,apple2orig)
mem_cfg.memmap = apple2_memmap_entries;
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
apple2_setup_memory(machine(), &mem_cfg);
/* perform initial reset */
apple2_reset(machine());
}
MACHINE_START_MEMBER(apple2_state,space84)
@ -1873,9 +1862,6 @@ MACHINE_START_MEMBER(apple2_state,space84)
mem_cfg.memmap = apple2_memmap_entries;
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
apple2_setup_memory(machine(), &mem_cfg);
/* perform initial reset */
apple2_reset(machine());
}
MACHINE_START_MEMBER(apple2_state,tk2000)
@ -1895,9 +1881,6 @@ MACHINE_START_MEMBER(apple2_state,tk2000)
mem_cfg.memmap = tk2000_memmap_entries;
mem_cfg.auxmem = (UINT8*)NULL;
apple2_setup_memory(machine(), &mem_cfg);
/* perform initial reset */
apple2_reset(machine());
}
int apple2_state::apple2_pressed_specialkey(UINT8 key)

View File

@ -21,14 +21,6 @@
// FUNCTION PROTOTYPES //
/////////////////////////
#define MACHINE_STOP(name) \
static void machine_stop_##name( running_machine &machine)
// machine stop
MACHINE_STOP( cybikov1 );
MACHINE_STOP( cybikov2 );
MACHINE_STOP( cybikoxt );
// state->m_rs232
static void cybiko_rs232_init(running_machine &machine);
static void cybiko_rs232_exit(void);
@ -192,7 +184,7 @@ void cybiko_state::machine_start()
// serial port
cybiko_rs232_init(machine());
// other
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov1),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikov1),this));
}
MACHINE_START_MEMBER(cybiko_state,cybikov2)
@ -210,7 +202,7 @@ MACHINE_START_MEMBER(cybiko_state,cybikov2)
// serial port
cybiko_rs232_init(machine());
// other
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov2),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikov2),this));
}
MACHINE_START_MEMBER(cybiko_state,cybikoxt)
@ -227,7 +219,7 @@ MACHINE_START_MEMBER(cybiko_state,cybikoxt)
// serial port
cybiko_rs232_init(machine());
// other
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikoxt),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikoxt),this));
}
///////////////////
@ -256,39 +248,39 @@ MACHINE_RESET_MEMBER(cybiko_state,cybikoxt)
// MACHINE STOP //
//////////////////
MACHINE_STOP( cybikov1 )
void cybiko_state::machine_stop_cybikov1()
{
_logerror( 0, ("machine_stop_cybikov1\n"));
// real-time clock
nvram_system_save( machine, "rtc", cybiko_pcf8593_save);
nvram_system_save( machine(), "rtc", cybiko_pcf8593_save);
// serial dataflash
nvram_system_save( machine, "flash1", cybiko_at45dbxx_save);
nvram_system_save( machine(), "flash1", cybiko_at45dbxx_save);
// serial port
cybiko_rs232_exit();
}
MACHINE_STOP( cybikov2 )
void cybiko_state::machine_stop_cybikov2()
{
_logerror( 0, ("machine_stop_cybikov2\n"));
// real-time clock
nvram_system_save( machine, "rtc", cybiko_pcf8593_save);
nvram_system_save( machine(), "rtc", cybiko_pcf8593_save);
// serial dataflash
nvram_system_save( machine, "flash1", cybiko_at45dbxx_save);
nvram_system_save( machine(), "flash1", cybiko_at45dbxx_save);
// multi-purpose flash
nvram_system_save( machine, "flash2", cybiko_sst39vfx_save);
nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save);
// serial port
cybiko_rs232_exit();
}
MACHINE_STOP( cybikoxt )
void cybiko_state::machine_stop_cybikoxt()
{
_logerror( 0, ("machine_stop_cybikoxt\n"));
// real-time clock
nvram_system_save( machine, "rtc", cybiko_pcf8593_save);
nvram_system_save( machine(), "rtc", cybiko_pcf8593_save);
// multi-purpose flash
nvram_system_save( machine, "flash2", cybiko_sst39vfx_save);
nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save);
// ramdisk
nvram_system_save( machine, "ramdisk", cybiko_ramdisk_save);
nvram_system_save( machine(), "ramdisk", cybiko_ramdisk_save);
// serial port
cybiko_rs232_exit();
}

View File

@ -1006,55 +1006,54 @@ void dgn_beta_line_interrupt (int data)
/********************************* Machine/Driver Initialization ****************************************/
static void dgnbeta_reset(running_machine &machine)
void dgn_beta_state::machine_reset()
{
dgn_beta_state *state = machine.driver_data<dgn_beta_state>();
device_t *fdc = machine.device(FDC_TAG);
pia6821_device *pia_0 = machine.device<pia6821_device>( PIA_0_TAG );
pia6821_device *pia_1 = machine.device<pia6821_device>( PIA_1_TAG );
pia6821_device *pia_2 = machine.device<pia6821_device>( PIA_2_TAG );
device_t *fdc = machine().device(FDC_TAG);
pia6821_device *pia_0 = machine().device<pia6821_device>( PIA_0_TAG );
pia6821_device *pia_1 = machine().device<pia6821_device>( PIA_1_TAG );
pia6821_device *pia_2 = machine().device<pia6821_device>( PIA_2_TAG );
logerror("MACHINE_RESET( dgnbeta )\n");
state->m_system_rom = state->memregion(MAINCPU_TAG)->base();
m_system_rom = memregion(MAINCPU_TAG)->base();
/* Make sure CPU 1 is started out halted ! */
machine.device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
/* Reset to task 0, and map banks disabled, so standard memory map */
/* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */
/* and ROM at $FF00-$FFFF */
state->m_TaskReg = 0;
state->m_PIATaskReg = 0;
state->m_EnableMapRegs = 0;
memset(state->m_PageRegs, 0, sizeof(state->m_PageRegs)); /* Reset page registers to 0 */
SetDefaultTask(machine);
m_TaskReg = 0;
m_PIATaskReg = 0;
m_EnableMapRegs = 0;
memset(m_PageRegs, 0, sizeof(m_PageRegs)); /* Reset page registers to 0 */
SetDefaultTask(machine());
/* Set pullups on all PIA port A, to match what hardware does */
pia_0->set_port_a_z_mask(0xFF);
pia_1->set_port_a_z_mask(0xFF);
pia_2->set_port_a_z_mask(0xFF);
state->m_d_pia1_pa_last = 0x00;
state->m_d_pia1_pb_last = 0x00;
state->m_RowShifter = 0x00; /* shift register to select row */
state->m_Keyrow = 0x00; /* Keyboard row being shifted out */
state->m_d_pia0_pb_last = 0x00; /* Last byte output to pia0 port b */
state->m_d_pia0_cb2_last = 0x00; /* Last state of CB2 */
m_d_pia1_pa_last = 0x00;
m_d_pia1_pb_last = 0x00;
m_RowShifter = 0x00; /* shift register to select row */
m_Keyrow = 0x00; /* Keyboard row being shifted out */
m_d_pia0_pb_last = 0x00; /* Last byte output to pia0 port b */
m_d_pia0_cb2_last = 0x00; /* Last state of CB2 */
state->m_KInDat_next = 0x00; /* Next data bit to input */
state->m_KAny_next = 0x00; /* Next value for KAny */
m_KInDat_next = 0x00; /* Next data bit to input */
m_KAny_next = 0x00; /* Next value for KAny */
state->m_DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */
m_DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */
// DMA_NMI = CLEAR_LINE; /* start with DMA NMI inactive */
wd17xx_dden_w(fdc, CLEAR_LINE);
wd17xx_set_drive(fdc, 0);
state->m_videoram.set_target(machine.device<ram_device>(RAM_TAG)->pointer(),state->m_videoram.bytes()); /* Point video ram at the start of physical ram */
m_videoram.set_target(machine().device<ram_device>(RAM_TAG)->pointer(),m_videoram.bytes()); /* Point video ram at the start of physical ram */
wd17xx_reset(fdc);
state->m_wd2797_written=0;
m_wd2797_written=0;
}
void dgn_beta_state::machine_start()
@ -1065,8 +1064,6 @@ void dgn_beta_state::machine_start()
machine().device<cpu_device>(MAINCPU_TAG)->debug()->set_dasm_override(dgnbeta_dasm_override);
}
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(dgnbeta_reset),&machine()));
dgnbeta_reset(machine());
/* setup debug commands */
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
{

View File

@ -321,22 +321,21 @@ TIMER_CALLBACK_MEMBER(electron_state::setup_beep)
beep_set_frequency( speaker, 300 );
}
static void electron_reset(running_machine &machine)
void electron_state::machine_reset()
{
electron_state *state = machine.driver_data<electron_state>();
state->membank("bank2")->set_entry(0);
membank("bank2")->set_entry(0);
state->m_ula.communication_mode = 0x04;
state->m_ula.screen_mode = 0;
state->m_ula.cassette_motor_mode = 0;
state->m_ula.capslock_mode = 0;
state->m_ula.screen_mode = 0;
state->m_ula.screen_start = 0x3000;
state->m_ula.screen_base = 0x3000;
state->m_ula.screen_size = 0x8000 - 0x3000;
state->m_ula.screen_addr = 0;
state->m_ula.tape_running = 0;
state->m_ula.vram = (UINT8 *)machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(state->m_ula.screen_base);
m_ula.communication_mode = 0x04;
m_ula.screen_mode = 0;
m_ula.cassette_motor_mode = 0;
m_ula.capslock_mode = 0;
m_ula.screen_mode = 0;
m_ula.screen_start = 0x3000;
m_ula.screen_base = 0x3000;
m_ula.screen_size = 0x8000 - 0x3000;
m_ula.screen_addr = 0;
m_ula.tape_running = 0;
m_ula.vram = (UINT8 *)machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(m_ula.screen_base);
}
void electron_state::machine_start()
@ -347,5 +346,4 @@ void electron_state::machine_start()
m_ula.interrupt_control = 0x00;
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this));
m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this));
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(electron_reset),&machine()));
}

View File

@ -129,8 +129,6 @@ enum {
*/
static void gb_machine_stop(running_machine &machine);
#ifdef MAME_DEBUG
/* #define V_GENERAL*/ /* Display general debug information */
/* #define V_BANK*/ /* Display bank switching debug information */
@ -283,7 +281,7 @@ void gb_state::gb_init()
MACHINE_START_MEMBER(gb_state,gb)
{
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this));
/* Allocate the serial timer, and disable it */
m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this));
@ -294,7 +292,7 @@ MACHINE_START_MEMBER(gb_state,gb)
MACHINE_START_MEMBER(gb_state,gbc)
{
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this));
/* Allocate the serial timer, and disable it */
m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this));
@ -323,7 +321,7 @@ MACHINE_START_MEMBER(gb_state,sgb)
m_sgb_packets = -1;
m_sgb_tile_data = auto_alloc_array_clear(machine(), UINT8, 0x2000 );
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this));
/* Allocate the serial timer, and disable it */
m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this));
@ -409,18 +407,17 @@ MACHINE_RESET_MEMBER(gb_state,gbc)
}
}
static void gb_machine_stop(running_machine &machine)
void gb_state::gb_machine_stop()
{
gb_state *state = machine.driver_data<gb_state>();
/* Don't save if there was no battery */
if(!(state->m_CartType & BATTERY) || !state->m_RAMBanks)
if(!(m_CartType & BATTERY) || !m_RAMBanks)
return;
/* NOTE: The reason we save the carts RAM this way instead of using MAME's
built in macros is because they force the filename to be the name of
the machine. We need to have a separate name for each game. */
device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart"));
image->battery_save(state->m_gb_cart_ram, state->m_RAMBanks * 0x2000);
device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart"));
image->battery_save(m_gb_cart_ram, m_RAMBanks * 0x2000);
}
void gb_state::gb_set_mbc1_banks()

View File

@ -1920,37 +1920,39 @@ WRITE8_MEMBER(lynx_state::lynx_memory_config_w)
membank("bank4")->set_entry((data & 8) ? 1 : 0);
}
static void lynx_reset(running_machine &machine)
void lynx_state::machine_reset()
{
lynx_state *state = machine.driver_data<lynx_state>();
state->lynx_memory_config_w(machine.device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
lynx_memory_config_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
machine.device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE);
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
machine().device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE);
memset(&state->m_suzy, 0, sizeof(state->m_suzy));
memset(&state->m_mikey, 0, sizeof(state->m_mikey));
memset(&m_suzy, 0, sizeof(m_suzy));
memset(&m_mikey, 0, sizeof(m_mikey));
state->m_suzy.data[0x88] = 0x01;
state->m_suzy.data[0x90] = 0x00;
state->m_suzy.data[0x91] = 0x00;
state->m_mikey.data[0x80] = 0x00;
state->m_mikey.data[0x81] = 0x00;
state->m_mikey.data[0x88] = 0x01;
state->m_mikey.data[0x8a] = 0x00;
state->m_mikey.data[0x8c] = 0x00;
state->m_mikey.data[0x90] = 0x00;
state->m_mikey.data[0x92] = 0x00;
m_suzy.data[0x88] = 0x01;
m_suzy.data[0x90] = 0x00;
m_suzy.data[0x91] = 0x00;
m_mikey.data[0x80] = 0x00;
m_mikey.data[0x81] = 0x00;
m_mikey.data[0x88] = 0x01;
m_mikey.data[0x8a] = 0x00;
m_mikey.data[0x8c] = 0x00;
m_mikey.data[0x90] = 0x00;
m_mikey.data[0x92] = 0x00;
lynx_uart_reset(state);
lynx_uart_reset(this);
// hack to allow current object loading to work
#if 0
lynx_timer_write( state, 0, 0, 160 ); // set backup value (hpos) = 160
lynx_timer_write( state, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period
lynx_timer_write( state, 2, 0, 105 ); // set backup value (vpos) = 102
lynx_timer_write( state, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link
lynx_timer_write( this, 0, 0, 160 ); // set backup value (hpos) = 160
lynx_timer_write( this, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period
lynx_timer_write( this, 2, 0, 105 ); // set backup value (vpos) = 102
lynx_timer_write( this, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link
#endif
render_target *target = machine().render().first_target();
target->set_view(m_rotate);
}
void lynx_state::lynx_postload()
@ -1976,17 +1978,10 @@ void lynx_state::machine_start()
memset(&m_suzy, 0, sizeof(m_suzy));
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lynx_reset),&machine()));
for (i = 0; i < NR_LYNX_TIMERS; i++)
lynx_timer_init(machine(), i);
}
void lynx_state::machine_reset()
{
render_target *target = machine().render().first_target();
target->set_view(m_rotate);
}
/****************************************

View File

@ -1337,14 +1337,12 @@ READ8_MEMBER(sms_state::gg_sio_r)
return m_gg_sio[offset];
}
static void sms_machine_stop( running_machine &machine )
void sms_state::sms_machine_stop()
{
sms_state *state = machine.driver_data<sms_state>();
/* Does the cartridge have SRAM that should be saved? */
if (state->m_cartridge[state->m_current_cartridge].sram_save) {
device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart1"));
image->battery_save(state->m_cartridge[state->m_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
if (m_cartridge[m_current_cartridge].sram_save) {
device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart1"));
image->battery_save(m_cartridge[m_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
}
}
@ -1908,7 +1906,7 @@ void sms_state::setup_banks()
MACHINE_START_MEMBER(sms_state,sms)
{
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_state::sms_machine_stop),this));
m_rapid_fire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::rapid_fire_callback),this));
m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));

View File

@ -181,13 +181,12 @@ TIMER_CALLBACK_MEMBER(wswan_state::wswan_rtc_callback)
}
}
static void wswan_machine_stop( running_machine &machine )
void wswan_state::wswan_machine_stop()
{
wswan_state *state = machine.driver_data<wswan_state>();
device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart"));
if ( state->m_eeprom.size )
device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart"));
if ( m_eeprom.size )
{
image->battery_save(state->m_eeprom.data, state->m_eeprom.size );
image->battery_save(m_eeprom.data, m_eeprom.size );
}
}
@ -204,7 +203,7 @@ void wswan_state::machine_start()
{
m_ws_bios_bank = NULL;
m_system_type = TYPE_WSWAN;
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_state::wswan_machine_stop),this));
m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp );
m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
@ -221,7 +220,7 @@ MACHINE_START_MEMBER(wswan_state,wscolor)
{
m_ws_bios_bank = NULL;
m_system_type = TYPE_WSC;
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine()));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_state::wswan_machine_stop),this));
m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp );
m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );

View File

@ -11,17 +11,14 @@
#include "includes/nes.h"
//#include "includes/nes_mmc.h"
static void nes_vh_reset( running_machine &machine )
void nes_state::video_reset()
{
nes_state *state = machine.driver_data<nes_state>();
state->m_ppu->set_vidaccess_callback(nes_ppu_vidaccess);
m_ppu->set_vidaccess_callback(nes_ppu_vidaccess);
}
void nes_state::video_start()
{
m_last_frame_flip = 0;
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(nes_vh_reset),&machine()));
}
void nes_state::palette_init()