Previous 199869 Revisions Next

r20722 Monday 4th February, 2013 at 09:54:24 UTC by Miodrag Milanović
machine_notify_delegate modernization (nw)
[src/mame/drivers]cobra.c taitosj.c taitotz.c tecmosys.c
[src/mame/includes]galastrm.h midzeus.h model2.h model3.h n64.h namcos22.h taitosj.h tecmosys.h
[src/mame/machine]n64.c tecmosys.c
[src/mame/video]galastrm.c midzeus.c midzeus2.c model2.c model3.c namcos22.c taitojc.c
[src/mess/drivers]gba.c ip22.c nc.c pdp1.c tx0.c vboy.c
[src/mess/includes]apple2.h cybiko.h dgn_beta.h electron.h gb.h gba.h nc.h nes.h pdp1.h sms.h tx0.h wswan.h
[src/mess/machine]apple2.c cybiko.c dgn_beta.c electron.c gb.c lynx.c sms.c wswan.c
[src/mess/video]nes.c

trunk/src/mess/drivers/pdp1.c
r20721r20722
387387
388388
389389
390static void pdp1_machine_stop(running_machine &machine);
391
392390static void pdp1_tape_read_binary(device_t *device);
393391static void pdp1_io_sc_callback(device_t *device);
394392
r20721r20722
509507}
510508
511509
512static void pdp1_machine_stop(running_machine &machine)
510void pdp1_state::pdp1_machine_stop()
513511{
514   pdp1_state *state = machine.driver_data<pdp1_state>();
515512   /* the core will take care of freeing the timers, BUT we must set the variables
516513   to NULL if we don't want to risk confusing the tape image init function */
517   state->m_tape_reader.timer = state->m_tape_puncher.timer = state->m_typewriter.tyo_timer = state->m_dpy_timer = NULL;
514   m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.tyo_timer = m_dpy_timer = NULL;
518515}
519516
520517
r20721r20722
656653   dst = machine().root_device().memregion("gfx1")->base();
657654   memcpy(dst, fontdata6x8, pdp1_fontdata_size);
658655
659   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine()));
656   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_state::pdp1_machine_stop),this));
660657
661658   m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this));
662659   m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this));
trunk/src/mess/drivers/vboy.c
r20721r20722
217217   TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick);
218218   TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL);
219219   TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR);
220   void vboy_machine_stop();
220221};
221222
222223
r20721r20722
11641165   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low
11651166INPUT_PORTS_END
11661167
1167static void vboy_machine_stop(running_machine &machine)
1168void vboy_state::vboy_machine_stop()
11681169{
1169   vboy_state *state = machine.driver_data<vboy_state>();
1170
11711170   // only do this if the cart loader detected some form of backup
1172   if (state->m_nvptr != NULL)
1171   if (m_nvptr != NULL)
11731172   {
1174      device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage);
1175      image->battery_save(state->m_nvptr, 0x10000);
1173      device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
1174      image->battery_save(m_nvptr, 0x10000);
11761175   }
11771176}
11781177
11791178void vboy_state::machine_start()
11801179{
11811180   /* add a hook for battery save */
1182   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_machine_stop),&machine()));
1181   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_state::vboy_machine_stop),this));
11831182
11841183//  m_vboy_sram = auto_alloc_array(machine(), UINT32, 0x10000/4);
11851184}
trunk/src/mess/drivers/nc.c
r20721r20722
120120
121121static void nc_printer_update(running_machine &machine, UINT8 data);
122122
123
124
125
126static void nc100_machine_stop(running_machine &machine);
127static void nc200_machine_stop(running_machine &machine);
128
129123/*
130124    Port 0x00:
131125    ==========
r20721r20722
933927   m_irq_latch_mask = (1<<0) | (1<<1);
934928}
935929
936static void nc100_machine_stop(running_machine &machine)
930void nc_state::nc100_machine_stop()
937931{
938   nc_common_open_stream_for_writing(machine);
939   nc_common_store_memory_to_stream(machine);
940   nc_common_close_stream(machine);
932   nc_common_open_stream_for_writing(machine());
933   nc_common_store_memory_to_stream(machine());
934   nc_common_close_stream(machine());
941935}
942936
943937void nc_state::machine_start()
944938{
945939   m_type = NC_TYPE_1xx;
946940
947   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc100_machine_stop),&machine()));
941   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc_state::nc100_machine_stop),this));
948942
949943   /* keyboard timer */
950944   m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this));
r20721r20722
13111305   nc200_video_set_backlight(machine(), 0);
13121306}
13131307
1314static void nc200_machine_stop(running_machine &machine)
1308void nc_state::nc200_machine_stop()
13151309{
1316   nc_common_open_stream_for_writing(machine);
1317   nc_common_store_memory_to_stream(machine);
1318   nc_common_close_stream(machine);
1310   nc_common_open_stream_for_writing(machine());
1311   nc_common_store_memory_to_stream(machine());
1312   nc_common_close_stream(machine());
13191313}
13201314
13211315MACHINE_START_MEMBER(nc_state,nc200)
13221316{
13231317   m_type = NC_TYPE_200;
13241318
1325   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc200_machine_stop),&machine()));
1319   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc_state::nc200_machine_stop),this));
13261320
13271321   /* keyboard timer */
13281322   m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this));
trunk/src/mess/drivers/tx0.c
r20721r20722
372372}
373373
374374
375static void tx0_machine_stop(running_machine &machine)
375void tx0_state::tx0_machine_stop()
376376{
377   tx0_state *state = machine.driver_data<tx0_state>();
378377   /* the core will take care of freeing the timers, BUT we must set the variables
379378   to NULL if we don't want to risk confusing the tape image init function */
380   state->m_tape_reader.timer = state->m_tape_puncher.timer = state->m_typewriter.prt_timer = state->m_dis_timer = NULL;
379   m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.prt_timer = m_dis_timer = NULL;
381380}
382381
383382
r20721r20722
388387   m_typewriter.prt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::prt_callback),this));
389388   m_dis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::dis_callback),this));
390389
391   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_machine_stop),&machine()));
390   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_state::tx0_machine_stop),this));
392391}
393392
394393
trunk/src/mess/drivers/ip22.c
r20721r20722
14761476   &scsi_irq,      /* command completion IRQ */
14771477};
14781478
1479static void ip225015_exit(running_machine &machine)
1480{
1481}
1482
14831479static int ip22_get_out2(running_machine &machine)
14841480{
14851481   ip22_state *state = machine.driver_data<ip22_state>();
r20721r20722
14911487   sgi_mc_init(machine());
14921488
14931489   // SCSI init
1494   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ip225015_exit),&machine()));
1495
14961490   machine().device<nvram_device>("nvram_user")->set_base(m_RTC.nUserRAM, 0x200);
14971491   machine().device<nvram_device>("nvram")->set_base(m_RTC.nRAM, 0x200);
14981492}
trunk/src/mess/drivers/gba.c
r20721r20722
4343
4444static const UINT32 timer_clks[4] = { 16777216, 16777216/64, 16777216/256, 16777216/1024 };
4545
46static void gba_machine_stop(running_machine &machine)
46void gba_state::gba_machine_stop()
4747{
48   gba_state *state = machine.driver_data<gba_state>();
49
5048   // only do this if the cart loader detected some form of backup
51   if (state->m_nvsize > 0)
49   if (m_nvsize > 0)
5250   {
53      device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage);
54      image->battery_save(state->m_nvptr, state->m_nvsize);
51      device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
52      image->battery_save(m_nvptr, m_nvsize);
5553   }
5654
57   if (state->m_flash_size > 0)
55   if (m_flash_size > 0)
5856   {
59      device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage);
60      UINT8 *nvram = auto_alloc_array( machine, UINT8, state->m_flash_size);
61      for (int i = 0; i < state->m_flash_size; i++)
57      device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
58      UINT8 *nvram = auto_alloc_array( machine(), UINT8, m_flash_size);
59      for (int i = 0; i < m_flash_size; i++)
6260      {
63         nvram[i] = state->m_mFlashDev->read_raw( i);
61         nvram[i] = m_mFlashDev->read_raw( i);
6462      }
65      image->battery_save( nvram, state->m_flash_size);
66      auto_free( machine, nvram);
63      image->battery_save( nvram, m_flash_size);
64      auto_free( machine(), nvram);
6765   }
6866}
6967
r20721r20722
21292127void gba_state::machine_start()
21302128{
21312129   /* add a hook for battery save */
2132   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_machine_stop),&machine()));
2130   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_state::gba_machine_stop),this));
21332131
21342132   /* create a timer to fire scanline functions */
21352133   m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_scan),this));
trunk/src/mess/machine/cybiko.c
r20721r20722
2121// FUNCTION PROTOTYPES //
2222/////////////////////////
2323
24#define MACHINE_STOP(name) \
25   static void machine_stop_##name( running_machine &machine)
26
27// machine stop
28MACHINE_STOP( cybikov1 );
29MACHINE_STOP( cybikov2 );
30MACHINE_STOP( cybikoxt );
31
3224// state->m_rs232
3325static void cybiko_rs232_init(running_machine &machine);
3426static void cybiko_rs232_exit(void);
r20721r20722
192184   // serial port
193185   cybiko_rs232_init(machine());
194186   // other
195   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov1),&machine()));
187   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikov1),this));
196188}
197189
198190MACHINE_START_MEMBER(cybiko_state,cybikov2)
r20721r20722
210202   // serial port
211203   cybiko_rs232_init(machine());
212204   // other
213   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov2),&machine()));
205   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikov2),this));
214206}
215207
216208MACHINE_START_MEMBER(cybiko_state,cybikoxt)
r20721r20722
227219   // serial port
228220   cybiko_rs232_init(machine());
229221   // other
230   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikoxt),&machine()));
222   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikoxt),this));
231223}
232224
233225///////////////////
r20721r20722
256248// MACHINE STOP //
257249//////////////////
258250
259MACHINE_STOP( cybikov1 )
251void cybiko_state::machine_stop_cybikov1()
260252{
261253   _logerror( 0, ("machine_stop_cybikov1\n"));
262254   // real-time clock
263   nvram_system_save( machine, "rtc", cybiko_pcf8593_save);
255   nvram_system_save( machine(), "rtc", cybiko_pcf8593_save);
264256   // serial dataflash
265   nvram_system_save( machine, "flash1", cybiko_at45dbxx_save);
257   nvram_system_save( machine(), "flash1", cybiko_at45dbxx_save);
266258   // serial port
267259   cybiko_rs232_exit();
268260}
269261
270MACHINE_STOP( cybikov2 )
262void cybiko_state::machine_stop_cybikov2()
271263{
272264   _logerror( 0, ("machine_stop_cybikov2\n"));
273265   // real-time clock
274   nvram_system_save( machine, "rtc", cybiko_pcf8593_save);
266   nvram_system_save( machine(), "rtc", cybiko_pcf8593_save);
275267   // serial dataflash
276   nvram_system_save( machine, "flash1", cybiko_at45dbxx_save);
268   nvram_system_save( machine(), "flash1", cybiko_at45dbxx_save);
277269   // multi-purpose flash
278   nvram_system_save( machine, "flash2", cybiko_sst39vfx_save);
270   nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save);
279271   // serial port
280272   cybiko_rs232_exit();
281273}
282274
283MACHINE_STOP( cybikoxt )
275void cybiko_state::machine_stop_cybikoxt()
284276{
285277   _logerror( 0, ("machine_stop_cybikoxt\n"));
286278   // real-time clock
287   nvram_system_save( machine, "rtc", cybiko_pcf8593_save);
279   nvram_system_save( machine(), "rtc", cybiko_pcf8593_save);
288280   // multi-purpose flash
289   nvram_system_save( machine, "flash2", cybiko_sst39vfx_save);
281   nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save);
290282   // ramdisk
291   nvram_system_save( machine, "ramdisk", cybiko_ramdisk_save);
283   nvram_system_save( machine(), "ramdisk", cybiko_ramdisk_save);
292284   // serial port
293285   cybiko_rs232_exit();
294286}
trunk/src/mess/machine/apple2.c
r20721r20722
11751175 * Machine reset
11761176 * ----------------------------------------------------------------------- */
11771177
1178static void apple2_reset(running_machine &machine)
1178void apple2_state::machine_reset()
11791179{
1180   apple2_state *state = machine.driver_data<apple2_state>();
11811180   int need_intcxrom;
11821181
1183   state->m_rambase = state->m_ram->pointer();
1184   state->apple2_refresh_delegates();
1182   m_rambase = m_ram->pointer();
1183   apple2_refresh_delegates();
11851184
1186   need_intcxrom = !strcmp(machine.system().name, "apple2c")
1187      || !strcmp(machine.system().name, "apple2c0")
1188      || !strcmp(machine.system().name, "apple2c3")
1189      || !strcmp(machine.system().name, "apple2c4")
1190      || !strcmp(machine.system().name, "prav8c")
1191      || !strcmp(machine.system().name, "apple2cp")
1192      || !strncmp(machine.system().name, "apple2g", 7);
1193   apple2_setvar(machine, need_intcxrom ? VAR_INTCXROM : 0, ~0);
1185   need_intcxrom = !strcmp(machine().system().name, "apple2c")
1186      || !strcmp(machine().system().name, "apple2c0")
1187      || !strcmp(machine().system().name, "apple2c3")
1188      || !strcmp(machine().system().name, "apple2c4")
1189      || !strcmp(machine().system().name, "prav8c")
1190      || !strcmp(machine().system().name, "apple2cp")
1191      || !strncmp(machine().system().name, "apple2g", 7);
1192   apple2_setvar(machine(), need_intcxrom ? VAR_INTCXROM : 0, ~0);
11941193
11951194   // ROM 0 cannot boot unless language card bank 2 is write-enabled (but read ROM) on startup
1196   if (!strncmp(machine.system().name, "apple2g", 7))
1195   if (!strncmp(machine().system().name, "apple2g", 7))
11971196   {
1198      apple2_setvar(machine, VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2);
1197      apple2_setvar(machine(), VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2);
11991198   }
12001199
1201   state->m_a2_speaker_state = 0;
1200   m_a2_speaker_state = 0;
12021201
1203   state->m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset
1202   m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset
12041203
1205   state->m_joystick_x1_time = state->m_joystick_y1_time = 0;
1206   state->m_joystick_x2_time = state->m_joystick_y2_time = 0;
1204   m_joystick_x1_time = m_joystick_y1_time = 0;
1205   m_joystick_x2_time = m_joystick_y2_time = 0;
12071206}
12081207
12091208
r20721r20722
17601759   state->m_fdc_diskreg = 0;
17611760
17621761   AY3600_init(machine);
1763   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(apple2_reset),&machine));
17641762
17651763   /* state save registers */
17661764   state->save_item(NAME(state->m_flags));
r20721r20722
18071805   mem_cfg.memmap = apple2_memmap_entries;
18081806   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
18091807   apple2_setup_memory(machine(), &mem_cfg);
1810
1811   /* perform initial reset */
1812   apple2_reset(machine());
18131808}
18141809
18151810MACHINE_START_MEMBER(apple2_state,laser128)
r20721r20722
18271822   mem_cfg.memmap = apple2_memmap_entries;
18281823   mem_cfg.auxmem = (UINT8*)NULL;
18291824   apple2_setup_memory(machine(), &mem_cfg);
1830
1831   /* perform initial reset */
1832   apple2_reset(machine());
18331825}
18341826
18351827MACHINE_START_MEMBER(apple2_state,apple2orig)
r20721r20722
18501842   mem_cfg.memmap = apple2_memmap_entries;
18511843   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
18521844   apple2_setup_memory(machine(), &mem_cfg);
1853
1854   /* perform initial reset */
1855   apple2_reset(machine());
18561845}
18571846
18581847MACHINE_START_MEMBER(apple2_state,space84)
r20721r20722
18731862   mem_cfg.memmap = apple2_memmap_entries;
18741863   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
18751864   apple2_setup_memory(machine(), &mem_cfg);
1876
1877   /* perform initial reset */
1878   apple2_reset(machine());
18791865}
18801866
18811867MACHINE_START_MEMBER(apple2_state,tk2000)
r20721r20722
18951881   mem_cfg.memmap = tk2000_memmap_entries;
18961882   mem_cfg.auxmem = (UINT8*)NULL;
18971883   apple2_setup_memory(machine(), &mem_cfg);
1898
1899   /* perform initial reset */
1900   apple2_reset(machine());
19011884}
19021885
19031886int apple2_state::apple2_pressed_specialkey(UINT8 key)
trunk/src/mess/machine/gb.c
r20721r20722
129129*/
130130
131131
132static void gb_machine_stop(running_machine &machine);
133
134132#ifdef MAME_DEBUG
135133/* #define V_GENERAL*/      /* Display general debug information */
136134/* #define V_BANK*/         /* Display bank switching debug information */
r20721r20722
283281
284282MACHINE_START_MEMBER(gb_state,gb)
285283{
286   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine()));
284   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this));
287285
288286   /* Allocate the serial timer, and disable it */
289287   m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this));
r20721r20722
294292
295293MACHINE_START_MEMBER(gb_state,gbc)
296294{
297   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine()));
295   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this));
298296
299297   /* Allocate the serial timer, and disable it */
300298   m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this));
r20721r20722
323321   m_sgb_packets = -1;
324322   m_sgb_tile_data = auto_alloc_array_clear(machine(), UINT8, 0x2000 );
325323
326   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine()));
324   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this));
327325
328326   /* Allocate the serial timer, and disable it */
329327   m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this));
r20721r20722
409407   }
410408}
411409
412static void gb_machine_stop(running_machine &machine)
410void gb_state::gb_machine_stop()
413411{
414   gb_state *state = machine.driver_data<gb_state>();
415412   /* Don't save if there was no battery */
416   if(!(state->m_CartType & BATTERY) || !state->m_RAMBanks)
413   if(!(m_CartType & BATTERY) || !m_RAMBanks)
417414      return;
418415
419416   /* NOTE: The reason we save the carts RAM this way instead of using MAME's
420417      built in macros is because they force the filename to be the name of
421418      the machine.  We need to have a separate name for each game. */
422   device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart"));
423   image->battery_save(state->m_gb_cart_ram, state->m_RAMBanks * 0x2000);
419   device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart"));
420   image->battery_save(m_gb_cart_ram, m_RAMBanks * 0x2000);
424421}
425422
426423void gb_state::gb_set_mbc1_banks()
trunk/src/mess/machine/wswan.c
r20721r20722
181181   }
182182}
183183
184static void wswan_machine_stop( running_machine &machine )
184void wswan_state::wswan_machine_stop()
185185{
186   wswan_state *state = machine.driver_data<wswan_state>();
187   device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart"));
188   if ( state->m_eeprom.size )
186   device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart"));
187   if ( m_eeprom.size )
189188   {
190      image->battery_save(state->m_eeprom.data, state->m_eeprom.size );
189      image->battery_save(m_eeprom.data, m_eeprom.size );
191190   }
192191}
193192
r20721r20722
204203{
205204   m_ws_bios_bank = NULL;
206205   m_system_type = TYPE_WSWAN;
207   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine()));
206   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_state::wswan_machine_stop),this));
208207   m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp );
209208   m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
210209
r20721r20722
221220{
222221   m_ws_bios_bank = NULL;
223222   m_system_type = TYPE_WSC;
224   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine()));
223   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_state::wswan_machine_stop),this));
225224   m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp );
226225   m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
227226
trunk/src/mess/machine/dgn_beta.c
r20721r20722
10061006
10071007
10081008/********************************* Machine/Driver Initialization ****************************************/
1009static void dgnbeta_reset(running_machine &machine)
1009void dgn_beta_state::machine_reset()
10101010{
1011   dgn_beta_state *state = machine.driver_data<dgn_beta_state>();
1012   device_t *fdc = machine.device(FDC_TAG);
1013   pia6821_device *pia_0 = machine.device<pia6821_device>( PIA_0_TAG );
1014   pia6821_device *pia_1 = machine.device<pia6821_device>( PIA_1_TAG );
1015   pia6821_device *pia_2 = machine.device<pia6821_device>( PIA_2_TAG );
1011   device_t *fdc = machine().device(FDC_TAG);
1012   pia6821_device *pia_0 = machine().device<pia6821_device>( PIA_0_TAG );
1013   pia6821_device *pia_1 = machine().device<pia6821_device>( PIA_1_TAG );
1014   pia6821_device *pia_2 = machine().device<pia6821_device>( PIA_2_TAG );
10161015
10171016   logerror("MACHINE_RESET( dgnbeta )\n");
10181017
1019   state->m_system_rom = state->memregion(MAINCPU_TAG)->base();
1018   m_system_rom = memregion(MAINCPU_TAG)->base();
10201019
10211020   /* Make sure CPU 1 is started out halted ! */
1022   machine.device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
1021   machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
10231022
10241023   /* Reset to task 0, and map banks disabled, so standard memory map */
10251024   /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */
10261025   /* and ROM at $FF00-$FFFF */
1027   state->m_TaskReg = 0;
1028   state->m_PIATaskReg = 0;
1029   state->m_EnableMapRegs = 0;
1030   memset(state->m_PageRegs, 0, sizeof(state->m_PageRegs));    /* Reset page registers to 0 */
1031   SetDefaultTask(machine);
1026   m_TaskReg = 0;
1027   m_PIATaskReg = 0;
1028   m_EnableMapRegs = 0;
1029   memset(m_PageRegs, 0, sizeof(m_PageRegs));    /* Reset page registers to 0 */
1030   SetDefaultTask(machine());
10321031
10331032   /* Set pullups on all PIA port A, to match what hardware does */
10341033   pia_0->set_port_a_z_mask(0xFF);
10351034   pia_1->set_port_a_z_mask(0xFF);
10361035   pia_2->set_port_a_z_mask(0xFF);
10371036
1038   state->m_d_pia1_pa_last = 0x00;
1039   state->m_d_pia1_pb_last = 0x00;
1040   state->m_RowShifter = 0x00;         /* shift register to select row */
1041   state->m_Keyrow = 0x00;             /* Keyboard row being shifted out */
1042   state->m_d_pia0_pb_last = 0x00;     /* Last byte output to pia0 port b */
1043   state->m_d_pia0_cb2_last = 0x00;        /* Last state of CB2 */
1037   m_d_pia1_pa_last = 0x00;
1038   m_d_pia1_pb_last = 0x00;
1039   m_RowShifter = 0x00;         /* shift register to select row */
1040   m_Keyrow = 0x00;             /* Keyboard row being shifted out */
1041   m_d_pia0_pb_last = 0x00;     /* Last byte output to pia0 port b */
1042   m_d_pia0_cb2_last = 0x00;        /* Last state of CB2 */
10441043
1045   state->m_KInDat_next = 0x00;            /* Next data bit to input */
1046   state->m_KAny_next = 0x00;          /* Next value for KAny */
1044   m_KInDat_next = 0x00;            /* Next data bit to input */
1045   m_KAny_next = 0x00;          /* Next value for KAny */
10471046
1048   state->m_DMA_NMI_LAST = 0x80;       /* start with DMA NMI inactive, as pulled up */
1047   m_DMA_NMI_LAST = 0x80;       /* start with DMA NMI inactive, as pulled up */
10491048//  DMA_NMI = CLEAR_LINE;       /* start with DMA NMI inactive */
10501049
10511050   wd17xx_dden_w(fdc, CLEAR_LINE);
10521051   wd17xx_set_drive(fdc, 0);
10531052
1054   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 */
1053   m_videoram.set_target(machine().device<ram_device>(RAM_TAG)->pointer(),m_videoram.bytes());     /* Point video ram at the start of physical ram */
10551054
10561055   wd17xx_reset(fdc);
1057   state->m_wd2797_written=0;
1056   m_wd2797_written=0;
10581057}
10591058
10601059void dgn_beta_state::machine_start()
r20721r20722
10651064      machine().device<cpu_device>(MAINCPU_TAG)->debug()->set_dasm_override(dgnbeta_dasm_override);
10661065   }
10671066
1068   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(dgnbeta_reset),&machine()));
1069   dgnbeta_reset(machine());
10701067   /* setup debug commands */
10711068   if (machine().debug_flags & DEBUG_FLAG_ENABLED)
10721069   {
trunk/src/mess/machine/sms.c
r20721r20722
13371337   return m_gg_sio[offset];
13381338}
13391339
1340static void sms_machine_stop( running_machine &machine )
1340void sms_state::sms_machine_stop()
13411341{
1342   sms_state *state = machine.driver_data<sms_state>();
1343
13441342   /* Does the cartridge have SRAM that should be saved? */
1345   if (state->m_cartridge[state->m_current_cartridge].sram_save) {
1346      device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart1"));
1347      image->battery_save(state->m_cartridge[state->m_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
1343   if (m_cartridge[m_current_cartridge].sram_save) {
1344      device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart1"));
1345      image->battery_save(m_cartridge[m_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
13481346   }
13491347}
13501348
r20721r20722
19081906
19091907MACHINE_START_MEMBER(sms_state,sms)
19101908{
1911   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_machine_stop),&machine()));
1909   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_state::sms_machine_stop),this));
19121910   m_rapid_fire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::rapid_fire_callback),this));
19131911   m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));
19141912
trunk/src/mess/machine/electron.c
r20721r20722
321321   beep_set_frequency( speaker, 300 );
322322}
323323
324static void electron_reset(running_machine &machine)
324void electron_state::machine_reset()
325325{
326   electron_state *state = machine.driver_data<electron_state>();
327   state->membank("bank2")->set_entry(0);
326   membank("bank2")->set_entry(0);
328327
329   state->m_ula.communication_mode = 0x04;
330   state->m_ula.screen_mode = 0;
331   state->m_ula.cassette_motor_mode = 0;
332   state->m_ula.capslock_mode = 0;
333   state->m_ula.screen_mode = 0;
334   state->m_ula.screen_start = 0x3000;
335   state->m_ula.screen_base = 0x3000;
336   state->m_ula.screen_size = 0x8000 - 0x3000;
337   state->m_ula.screen_addr = 0;
338   state->m_ula.tape_running = 0;
339   state->m_ula.vram = (UINT8 *)machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(state->m_ula.screen_base);
328   m_ula.communication_mode = 0x04;
329   m_ula.screen_mode = 0;
330   m_ula.cassette_motor_mode = 0;
331   m_ula.capslock_mode = 0;
332   m_ula.screen_mode = 0;
333   m_ula.screen_start = 0x3000;
334   m_ula.screen_base = 0x3000;
335   m_ula.screen_size = 0x8000 - 0x3000;
336   m_ula.screen_addr = 0;
337   m_ula.tape_running = 0;
338   m_ula.vram = (UINT8 *)machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(m_ula.screen_base);
340339}
341340
342341void electron_state::machine_start()
r20721r20722
347346   m_ula.interrupt_control = 0x00;
348347   machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this));
349348   m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this));
350   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(electron_reset),&machine()));
351349}
trunk/src/mess/machine/lynx.c
r20721r20722
19201920   membank("bank4")->set_entry((data & 8) ? 1 : 0);
19211921}
19221922
1923static void lynx_reset(running_machine &machine)
1923void lynx_state::machine_reset()
19241924{
1925   lynx_state *state = machine.driver_data<lynx_state>();
1926   state->lynx_memory_config_w(machine.device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
1925   lynx_memory_config_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
19271926
1928   machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
1929   machine.device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE);
1927   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
1928   machine().device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE);
19301929
1931   memset(&state->m_suzy, 0, sizeof(state->m_suzy));
1932   memset(&state->m_mikey, 0, sizeof(state->m_mikey));
1930   memset(&m_suzy, 0, sizeof(m_suzy));
1931   memset(&m_mikey, 0, sizeof(m_mikey));
19331932
1934   state->m_suzy.data[0x88]  = 0x01;
1935   state->m_suzy.data[0x90]  = 0x00;
1936   state->m_suzy.data[0x91]  = 0x00;
1937   state->m_mikey.data[0x80] = 0x00;
1938   state->m_mikey.data[0x81] = 0x00;
1939   state->m_mikey.data[0x88] = 0x01;
1940   state->m_mikey.data[0x8a] = 0x00;
1941   state->m_mikey.data[0x8c] = 0x00;
1942   state->m_mikey.data[0x90] = 0x00;
1943   state->m_mikey.data[0x92] = 0x00;
1933   m_suzy.data[0x88]  = 0x01;
1934   m_suzy.data[0x90]  = 0x00;
1935   m_suzy.data[0x91]  = 0x00;
1936   m_mikey.data[0x80] = 0x00;
1937   m_mikey.data[0x81] = 0x00;
1938   m_mikey.data[0x88] = 0x01;
1939   m_mikey.data[0x8a] = 0x00;
1940   m_mikey.data[0x8c] = 0x00;
1941   m_mikey.data[0x90] = 0x00;
1942   m_mikey.data[0x92] = 0x00;
19441943
1945   lynx_uart_reset(state);
1944   lynx_uart_reset(this);
19461945
19471946   // hack to allow current object loading to work
19481947#if 0
1949   lynx_timer_write( state, 0, 0, 160 ); // set backup value (hpos) = 160
1950   lynx_timer_write( state, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period
1951   lynx_timer_write( state, 2, 0, 105 ); // set backup value (vpos) = 102
1952   lynx_timer_write( state, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link
1948   lynx_timer_write( this, 0, 0, 160 ); // set backup value (hpos) = 160
1949   lynx_timer_write( this, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period
1950   lynx_timer_write( this, 2, 0, 105 ); // set backup value (vpos) = 102
1951   lynx_timer_write( this, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link
19531952#endif
1953
1954   render_target *target = machine().render().first_target();
1955   target->set_view(m_rotate);
19541956}
19551957
19561958void lynx_state::lynx_postload()
r20721r20722
19761978
19771979   memset(&m_suzy, 0, sizeof(m_suzy));
19781980
1979   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lynx_reset),&machine()));
1980
19811981   for (i = 0; i < NR_LYNX_TIMERS; i++)
19821982      lynx_timer_init(machine(), i);
19831983}
19841984
1985void lynx_state::machine_reset()
1986{
1987   render_target *target = machine().render().first_target();
1988   target->set_view(m_rotate);
1989}
19901985
19911986/****************************************
19921987
trunk/src/mess/includes/nes.h
r20721r20722
117117   virtual void machine_stop();
118118   virtual void machine_reset();
119119   virtual void video_start();
120   virtual void video_reset();
120121   virtual void palette_init();
121122   UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
122123   TIMER_CALLBACK_MEMBER(nes_irq_callback);
trunk/src/mess/includes/dgn_beta.h
r20721r20722
143143   int m_Field;
144144   int m_DrawInterlace;
145145   virtual void machine_start();
146   virtual void machine_reset();
146147   virtual void palette_init();
147148   DECLARE_WRITE8_MEMBER(dgnbeta_ram_b0_w);
148149   DECLARE_WRITE8_MEMBER(dgnbeta_ram_b1_w);
trunk/src/mess/includes/pdp1.h
r20721r20722
267267   TIMER_CALLBACK_MEMBER(tyo_callback);
268268   TIMER_CALLBACK_MEMBER(dpy_callback);
269269   TIMER_CALLBACK_MEMBER(il_timer_callback);
270   void pdp1_machine_stop();
270271};
271272
272273/*----------- defined in video/pdp1.c -----------*/
trunk/src/mess/includes/tx0.h
r20721r20722
157157   TIMER_CALLBACK_MEMBER(puncher_callback);
158158   TIMER_CALLBACK_MEMBER(prt_callback);
159159   TIMER_CALLBACK_MEMBER(dis_callback);
160   void tx0_machine_stop();
160161};
161162
162163
trunk/src/mess/includes/wswan.h
r20721r20722
143143   DECLARE_PALETTE_INIT(wscolor);
144144   TIMER_CALLBACK_MEMBER(wswan_rtc_callback);
145145   TIMER_CALLBACK_MEMBER(wswan_scanline_interrupt);
146   void wswan_machine_stop();
146147
147148protected:
148149   /* Interrupt flags */
trunk/src/mess/includes/cybiko.h
r20721r20722
8787   DECLARE_MACHINE_START(cybikoxt);
8888   DECLARE_MACHINE_RESET(cybikoxt);
8989   UINT32 screen_update_cybiko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
90   void machine_stop_cybikov1();
91   void machine_stop_cybikov2();
92   void machine_stop_cybikoxt();
9093};
9194
9295#endif /* CYBIKO_H_ */
trunk/src/mess/includes/apple2.h
r20721r20722
271271   DECLARE_WRITE8_MEMBER(a2bus_nmi_w);
272272   DECLARE_WRITE8_MEMBER(a2bus_inh_w);
273273   void apple2_update_memory_postload();
274   virtual void machine_reset();
274275};
275276
276277
trunk/src/mess/includes/sms.h
r20721r20722
208208   DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
209209   DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
210210   DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback);
211
211   void sms_machine_stop();
212212protected:
213213   required_shared_ptr<UINT8> m_mainram;
214214
trunk/src/mess/includes/electron.h
r20721r20722
7272   void electron_tape_start();
7373   void electron_tape_stop();
7474   virtual void machine_start();
75   virtual void machine_reset();
7576   virtual void video_start();
7677   virtual void palette_init();
7778   UINT32 screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mess/includes/nc.h
r20721r20722
9494   DECLARE_WRITE_LINE_MEMBER(nc200_fdc_interrupt);
9595
9696   void nc200_fdc_interrupt(bool state);
97   void nc100_machine_stop();
98   void nc200_machine_stop();
9799};
98100
99101
trunk/src/mess/includes/gb.h
r20721r20722
302302   void gbc_hdma(UINT16 length);
303303   void gb_increment_scanline();
304304   void gb_lcd_switch_on();
305   void gb_machine_stop();
305306};
306307
307308
trunk/src/mess/includes/gba.h
r20721r20722
277277   TIMER_CALLBACK_MEMBER(handle_irq);
278278   TIMER_CALLBACK_MEMBER(perform_hbl);
279279   TIMER_CALLBACK_MEMBER(perform_scan);
280   void gba_machine_stop();
280281};
281282
282283/*----------- defined in video/gba.c -----------*/
trunk/src/mess/video/nes.c
r20721r20722
1111#include "includes/nes.h"
1212//#include "includes/nes_mmc.h"
1313
14static void nes_vh_reset( running_machine &machine )
14void nes_state::video_reset()
1515{
16   nes_state *state = machine.driver_data<nes_state>();
17   state->m_ppu->set_vidaccess_callback(nes_ppu_vidaccess);
16   m_ppu->set_vidaccess_callback(nes_ppu_vidaccess);
1817}
1918
2019void nes_state::video_start()
2120{
2221   m_last_frame_flip =  0;
23
24   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(nes_vh_reset),&machine()));
2522}
2623
2724void nes_state::palette_init()
trunk/src/mame/machine/n64.c
r20721r20722
23832383   signal_rcp_interrupt(SI_INTERRUPT);
23842384}
23852385
2386static void n64_machine_stop(running_machine &machine)
2386void n64_state::n64_machine_stop()
23872387{
2388   n64_periphs *periphs = machine.device<n64_periphs>("rcp");
2388   n64_periphs *periphs = machine().device<n64_periphs>("rcp");
23892389
23902390   if( periphs->m_nvram_image == NULL )
23912391      return;
r20721r20722
24182418   rspdrc_add_imem(machine().device("rsp"), rsp_imem);
24192419
24202420   /* add a hook for battery save */
2421   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(n64_machine_stop),&machine()));
2421   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(n64_state::n64_machine_stop),this));
24222422}
24232423
24242424void n64_state::machine_reset()
trunk/src/mame/machine/tecmosys.c
r20721r20722
103103};
104104
105105
106static void tecmosys_prot_reset(running_machine &machine)
107{
108   tecmosys_state *state = machine.driver_data<tecmosys_state>();
109   state->m_device_read_ptr = 0;
110   state->m_device_status = DS_IDLE;
111   state->m_device_value = 0xff;
106void tecmosys_state::tecmosys_prot_reset()
107{   
108   m_device_read_ptr = 0;
109   m_device_status = DS_IDLE;
110   m_device_value = 0xff;
112111}
113112
114void tecmosys_prot_init(running_machine &machine, int which)
113void tecmosys_state::tecmosys_prot_init(int which)
115114{
116   tecmosys_state *state = machine.driver_data<tecmosys_state>();
117115   switch (which)
118116   {
119   case 0: state->m_device_data = &deroon_data; break;
120   case 1: state->m_device_data = &tkdensho_data; break;
121   case 2: state->m_device_data = &tkdensha_data; break;
117   case 0: m_device_data = &deroon_data; break;
118   case 1: m_device_data = &tkdensho_data; break;
119   case 2: m_device_data = &tkdensha_data; break;
122120   }
123121
124   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_prot_reset), &machine));
122   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_state::tecmosys_prot_reset),this));
125123}
126124
127125READ16_MEMBER(tecmosys_state::tecmosys_prot_status_r)
trunk/src/mame/video/model2.c
r20721r20722
26922692/***********************************************************************************************/
26932693
26942694
2695static void model2_exit(running_machine &machine)
2695void model2_state::model2_exit()
26962696{
2697   model2_state *state = machine.driver_data<model2_state>();
2698   poly_free(state->m_poly);
2697   poly_free(m_poly);
26992698}
27002699
27012700VIDEO_START_MEMBER(model2_state,model2)
r20721r20722
27072706   m_sys24_bitmap.allocate(width, height+4);
27082707
27092708   m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0);
2710   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_exit), &machine()));
2709   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_state::model2_exit), this));
27112710
27122711   /* initialize the hardware rasterizer */
27132712   model2_3d_init( machine(), (UINT16*)memregion("user3")->base() );
trunk/src/mame/video/galastrm.c
r20721r20722
2020
2121/******************************************************************/
2222
23static void galastrm_exit(running_machine &machine)
23void galastrm_state::galastrm_exit()
2424{
25   galastrm_state *state = machine.driver_data<galastrm_state>();
26   poly_free(state->m_poly);
25   poly_free(m_poly);
2726}
2827
2928void galastrm_state::video_start()
r20721r20722
3433   machine().primary_screen->register_screen_bitmap(m_polybitmap);
3534
3635   m_poly = poly_alloc(machine(), 16, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
37   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(galastrm_exit), &machine()));
36   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(galastrm_state::galastrm_exit), this));
3837}
3938
4039/************************************************************
trunk/src/mame/video/model3.c
r20721r20722
105105#define BYTE_REVERSE16(x)       (((x >> 8) & 0xff) | ((x << 8) & 0xff00))
106106
107107
108static void model3_exit(running_machine &machine)
108void model3_state::model3_exit()
109109{
110   model3_state *state = machine.driver_data<model3_state>();
111   invalidate_texture(machine, 0, 0, 0, 6, 5);
112   invalidate_texture(machine, 1, 0, 0, 6, 5);
113   poly_free(state->m_poly);
110   invalidate_texture(machine(), 0, 0, 0, 6, 5);
111   invalidate_texture(machine(), 1, 0, 0, 6, 5);
112   poly_free(m_poly);
114113}
115114
116115void model3_state::video_start()
117116{
118117   m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0);
119   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_exit), &machine()));
118   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_state::model3_exit), this));
120119
121120   machine().primary_screen->register_screen_bitmap(m_bitmap3d);
122121   machine().primary_screen->register_screen_bitmap(m_zbuffer);
trunk/src/mame/video/namcos22.c
r20721r20722
26612661   m_dirtypal[offset&(0x7fff/4)] = 1;
26622662}
26632663
2664static void namcos22_reset(running_machine &machine)
2664void namcos22_state::namcos22_reset()
26652665{
26662666   memset(&mSceneRoot, 0, sizeof(mSceneRoot));
26672667   mpFreeSceneNode = NULL;
26682668}
26692669
2670static void namcos22_exit(running_machine &machine)
2670void namcos22_state::namcos22_exit()
26712671{
2672   namcos22_state *state = machine.driver_data<namcos22_state>();
2673   poly_free(state->m_poly);
2672   poly_free(m_poly);
26742673}
26752674
26762675VIDEO_START_MEMBER(namcos22_state,common)
r20721r20722
26952694   m_pPolyH = m_pPolyM + m_PtRomSize;
26962695
26972696   m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0);
2698   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_reset), &machine()));
2699   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_exit), &machine()));
2697   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_state::namcos22_reset), this));
2698   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_state::namcos22_exit), this));
27002699
27012700   machine().gfx[GFX_CHAR]->set_source((UINT8 *)m_cgram.target());
27022701}
trunk/src/mame/video/midzeus.c
r20721r20722
8282 *
8383 *************************************/
8484
85static void exit_handler(running_machine &machine);
86
8785static void zeus_pointer_w(UINT32 which, UINT32 data, int logit);
8886static void zeus_register16_w(running_machine &machine, offs_t offset, UINT16 data, int logit);
8987static void zeus_register32_w(running_machine &machine, offs_t offset, UINT32 data, int logit);
r20721r20722
275273   poly = poly_alloc(machine(), 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
276274
277275   /* we need to cleanup on exit */
278   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine()));
276   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus_state::exit_handler), this));
279277
280278   yoffs = 0;
281279   texel_width = 256;
r20721r20722
301299}
302300
303301
304static void exit_handler(running_machine &machine)
302void midzeus_state::exit_handler()
305303{
306304#if DUMP_WAVE_RAM
307305   FILE *f = fopen("waveram.dmp", "w");
trunk/src/mame/video/taitojc.c
r20721r20722
292292}
293293
294294
295
296static void taitojc_exit(running_machine &machine)
297{
298}
299
300295void taitojc_state::video_start()
301296{
302   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitojc_exit), &machine()));
303
304297   /* find first empty slot to decode gfx */
305298   for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++)
306299      if (machine().gfx[m_gfx_index] == 0)
trunk/src/mame/video/midzeus2.c
r20721r20722
101101 *
102102 *************************************/
103103
104static void exit_handler(running_machine &machine);
105
106104static void zeus_register32_w(running_machine &machine, offs_t offset, UINT32 data, int logit);
107105static void zeus_register_update(running_machine &machine, offs_t offset, UINT32 oldval, int logit);
108106static void zeus_pointer_write(UINT8 which, UINT32 value);
r20721r20722
272270   poly = poly_alloc(machine(), 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
273271
274272   /* we need to cleanup on exit */
275   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine()));
273   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus_state::exit_handler2), this));
276274
277275   zbase = 2.0f;
278276   yoffs = 0;
r20721r20722
296294}
297295
298296
299static void exit_handler(running_machine &machine)
297void midzeus_state::exit_handler2()
300298{
301299#if DUMP_WAVE_RAM
302300   FILE *f = fopen("waveram.dmp", "w");
trunk/src/mame/includes/n64.h
r20721r20722
2323   virtual void machine_start();
2424   virtual void machine_reset();
2525   virtual void video_start();
26   void n64_machine_stop();
27   
2628   UINT32 screen_update_n64(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
2729};
2830
r20721r20722
120122   void poll_reset_button(bool button);
121123
122124   UINT32 dp_clock;
123
124125protected:
125126   // device-level overrides
126127   virtual void device_start();
trunk/src/mame/includes/taitosj.h
r20721r20722
9393   TIMER_CALLBACK_MEMBER(taitosj_mcu_real_data_w);
9494   TIMER_CALLBACK_MEMBER(taitosj_mcu_data_real_r);
9595   TIMER_CALLBACK_MEMBER(taitosj_mcu_status_real_w);
96   void init_common();
97   void reset_common();
9698};
trunk/src/mame/includes/model2.h
r20721r20722
168168   TIMER_DEVICE_CALLBACK_MEMBER(model2_timer_cb);
169169   TIMER_DEVICE_CALLBACK_MEMBER(model2_interrupt);
170170   TIMER_DEVICE_CALLBACK_MEMBER(model2c_interrupt);
171   void model2_exit();
171172};
172173
173174/*----------- defined in video/model2.c -----------*/
trunk/src/mame/includes/model3.h
r20721r20722
203203   UINT32 screen_update_model3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
204204   TIMER_CALLBACK_MEMBER(model3_sound_timer_tick);
205205   TIMER_DEVICE_CALLBACK_MEMBER(model3_interrupt);
206   void model3_exit();
206207};
207208
208209
trunk/src/mame/includes/galastrm.h
r20721r20722
5050   UINT32 screen_update_galastrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5151   INTERRUPT_GEN_MEMBER(galastrm_interrupt);
5252   TIMER_CALLBACK_MEMBER(galastrm_interrupt6);
53   void galastrm_exit();
5354};
trunk/src/mame/includes/namcos22.h
r20721r20722
269269   TIMER_DEVICE_CALLBACK_MEMBER(dsp_master_serial_irq);
270270   TIMER_DEVICE_CALLBACK_MEMBER(dsp_slave_serial_irq);
271271   TIMER_DEVICE_CALLBACK_MEMBER(mcu_irq);
272   void namcos22_reset();
273   void namcos22_exit();
272274};
273275
274276/*----------- defined in video/namcos22.c -----------*/
trunk/src/mame/includes/midzeus.h
r20721r20722
6161   INTERRUPT_GEN_MEMBER(display_irq);
6262   TIMER_CALLBACK_MEMBER(display_irq_off);
6363   TIMER_CALLBACK_MEMBER(invasn_gun_callback);
64   void exit_handler();
65   void exit_handler2();
6466};
6567
6668/*----------- defined in video/midzeus2.c -----------*/
trunk/src/mame/includes/tecmosys.h
r20721r20722
8080   virtual void machine_start();
8181   virtual void video_start();
8282   UINT32 screen_update_tecmosys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
83   void tecmosys_prot_init(int which);
84   void tecmosys_prot_reset();
8385};
8486
85/*----------- defined in machine/tecmosys.c -----------*/
86void tecmosys_prot_init(running_machine &machine, int which);
trunk/src/mame/drivers/tecmosys.c
r20721r20722
653653DRIVER_INIT_MEMBER(tecmosys_state,deroon)
654654{
655655   tecmosys_descramble(machine());
656   tecmosys_prot_init(machine(), 0); // machine/tecmosys.c
656   tecmosys_prot_init(0); // machine/tecmosys.c
657657}
658658
659659DRIVER_INIT_MEMBER(tecmosys_state,tkdensho)
660660{
661661   tecmosys_descramble(machine());
662   tecmosys_prot_init(machine(), 1);
662   tecmosys_prot_init(1);
663663}
664664
665665DRIVER_INIT_MEMBER(tecmosys_state,tkdensha)
666666{
667667   tecmosys_descramble(machine());
668   tecmosys_prot_init(machine(), 2);
668   tecmosys_prot_init(2);
669669}
670670
671671GAME( 1995, deroon,           0, deroon, deroon, tecmosys_state, deroon,     ROT0, "Tecmo", "Deroon DeroDero", 0 )
trunk/src/mame/drivers/cobra.c
r20721r20722
723723   virtual void video_start();
724724   UINT32 screen_update_cobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
725725   INTERRUPT_GEN_MEMBER(cobra_vblank);
726   void cobra_video_exit();
726727};
727728
728729void cobra_renderer::render_color_scan(INT32 scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid)
r20721r20722
982983   }
983984}
984985
985static void cobra_video_exit(running_machine *machine)
986void cobra_state::cobra_video_exit()
986987{
987   cobra_state *state = machine->driver_data<cobra_state>();
988   state->m_renderer->gfx_exit(*machine);
988   m_renderer->gfx_exit(machine());
989989}
990990
991991void cobra_state::video_start()
992992{
993   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cobra_video_exit), &machine()));
993   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cobra_state::cobra_video_exit), this));
994994
995995   m_renderer = auto_alloc(machine(), cobra_renderer(machine()));
996996   m_renderer->gfx_init(machine());
trunk/src/mame/drivers/taitosj.c
r20721r20722
27312731   ROM_LOAD( "pal16l8.28",   0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */
27322732ROM_END
27332733
2734static void reset_common(running_machine &machine)
2734void taitosj_state::reset_common()
27352735{
2736   taitosj_state *state = machine.driver_data<taitosj_state>();
2737   state->m_sndnmi_disable = 1;
2738   state->m_input_port_4_f0 = 0;
2736   m_sndnmi_disable = 1;
2737   m_input_port_4_f0 = 0;
27392738   /* start in 1st gear */
2740   state->m_kikstart_gears[0] = 0x02;
2741   state->m_kikstart_gears[1] = 0x02;
2742   state->m_dac_out = 0;
2743   state->m_dac_vol = 0;
2739   m_kikstart_gears[0] = 0x02;
2740   m_kikstart_gears[1] = 0x02;
2741   m_dac_out = 0;
2742   m_dac_vol = 0;
27442743}
27452744
2746static void init_common(running_machine &machine)
2745void taitosj_state::init_common()
27472746{
2748   taitosj_state *state = machine.driver_data<taitosj_state>();
2749   state->save_item(NAME(state->m_sndnmi_disable));
2750   state->save_item(NAME(state->m_input_port_4_f0));
2751   state->save_item(NAME(state->m_kikstart_gears));
2752   state->save_item(NAME(state->m_dac_out));
2753   state->save_item(NAME(state->m_dac_vol));
2754
2755   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(reset_common), &machine));
2747   save_item(NAME(m_sndnmi_disable));
2748   save_item(NAME(m_input_port_4_f0));
2749   save_item(NAME(m_kikstart_gears));
2750   save_item(NAME(m_dac_out));
2751   save_item(NAME(m_dac_vol));
2752   
2753   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(taitosj_state::reset_common), this));
27562754}
27572755
27582756DRIVER_INIT_MEMBER(taitosj_state,taitosj)
27592757{
2760   init_common(machine());
2758   init_common();
27612759}
27622760
27632761DRIVER_INIT_MEMBER(taitosj_state,spacecr)
27642762{
2765   init_common(machine());
2763   init_common();
27662764
27672765   /* install protection handler */
27682766   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd48b, 0xd48b, read8_delegate(FUNC(taitosj_state::spacecr_prot_r),this));
r20721r20722
27702768
27712769DRIVER_INIT_MEMBER(taitosj_state,alpine)
27722770{
2773   init_common(machine());
2771   init_common();
27742772
27752773   /* install protection handlers */
27762774   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
r20721r20722
27792777
27802778DRIVER_INIT_MEMBER(taitosj_state,alpinea)
27812779{
2782   init_common(machine());
2780   init_common();
27832781
27842782   /* install protection handlers */
27852783   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
r20721r20722
27882786
27892787DRIVER_INIT_MEMBER(taitosj_state,junglhbr)
27902788{
2791   init_common(machine());
2789   init_common();
27922790
27932791   /* inverter on bits 0 and 1 */
27942792   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(taitosj_state::junglhbr_characterram_w),this));
trunk/src/mame/drivers/taitotz.c
r20721r20722
616616   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
617617};
618618
619
619/*
620620static void taitotz_exit(running_machine &machine)
621621{
622   /*
622   
623623   taitotz_state *state = machine.driver_data<taitotz_state>();
624624
625625   FILE *file;
r20721r20722
654654       fputc((UINT8)(state->m_texture_ram[i] >> 0), file);
655655   }
656656   fclose(file);
657   */
657   
658658}
659
659*/
660660void taitotz_state::video_start()
661661{
662662   int width = machine().primary_screen->width();
r20721r20722
669669   /* create renderer */
670670   m_renderer = auto_alloc(machine(), taitotz_renderer(machine(), width, height, m_texture_ram));
671671
672   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitotz_exit), &machine()));
672   //machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitotz_exit), &machine()));
673673}
674674
675675static const float dot3_tex_table[32] =

Previous 199869 Revisions Next


© 1997-2024 The MAME Team