Previous 15994 Revisions Next

r10316 Sunday 6th February, 2011 at 12:42:37 UTC by Miodrag Milanović
Sync with MAME (convert emu_timers to objects)
[src/emu]devcpu.h devimage.c devintrf.c devintrf.h diexec.c emu.h emucore.h inptport.c machine.c machine.h schedule.c schedule.h screen.c screen.h sound.c timer.c timer.h uimenu.c video.c watchdog.c
[src/emu/audio]generic.c
[src/emu/cpu/cop400]cop400.c
[src/emu/cpu/e132xs]e132xs.c
[src/emu/cpu/h83002]h8_8.c h8periph.c
[src/emu/cpu/hd61700]hd61700.c
[src/emu/cpu/lr35902]lr35902.c lr35902.h
[src/emu/cpu/m37710]m37710.c
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/mb88xx]mb88xx.c
[src/emu/cpu/mcs48]mcs48.c
[src/emu/cpu/mips]mips3com.c
[src/emu/cpu/mn10200]mn10200.c
[src/emu/cpu/nec]v25.c
[src/emu/cpu/powerpc]ppc.c ppccom.c
[src/emu/cpu/sc61860]sc61860.c
[src/emu/cpu/sh2]sh2comn.c
[src/emu/cpu/sh4]sh4comn.c
[src/emu/cpu/tlcs90]tlcs90.c
[src/emu/cpu/tms34010]tms34010.c
[src/emu/cpu/tms9900]99xxcore.h
[src/emu/cpu/z8]z8.c
[src/emu/debug]debugcpu.c
[src/emu/imagedev]bitbngr.c cassette.c flopdrv.c snapquik.c
[src/emu/machine]6522via.c 6526cia.c 6532riot.c 6840ptm.c 6850acia.c 68681.c 74123.c 8042kbdc.c 8237dma.c 8257dma.c am53cf96.c at28c16.c cdp1852.c ds2401.c ds2404.c f3853.c generic.c idectrl.c ins8250.c intelfsh.c k056230.c latch8.c ldcore.c ldpr8210.c ldv1000.c ldvp931.c mb3773.c mc146818.c mc68901.c microtch.c pc16552d.c pic8259.c pit8253.c rtc65271.c s3c24xx.c timekpr.c tmp68301.c wd33c93.c z80ctc.c z80dart.c z80dma.c z80sio.c z80sti.c
[src/emu/sound]2203intf.c 2608intf.c 2610intf.c 2612intf.c 262intf.c 3526intf.c 3812intf.c 8950intf.c aica.c asc.c bsmt2000.c cdp1864.c cdp1869.c es5503.c fm.h fmopl.c ics2115.c k053260.c k053260.h k054539.c k056800.c mos6560.c msm5205.c pokey.c scsp.c sp0250.c speaker.c tms5110.c tms5220.c upd7759.c ym2151.c ym2413.c ymf262.c ymf271.c ymf278b.c ymz280b.c
[src/emu/video]mc6845.c pc_vga.c tms34061.c voodoo.c
[src/ldplayer]ldplayer.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]8080bw.c amiga.c beezer.c cage.c cinemat.c dcs.c exidy.c geebee.c gottlieb.c harddriv.c jedi.c leland.c m72.c mcr.c n8080.c namco52.c namco54.c qix.c segag80r.c segasnd.c senjyo.c snes_snd.c starwars.c t5182.c turbo.c vicdual.c warpwarp.c williams.c
[src/mame/drivers]2mindril.c 39in1.c 40love.c acefruit.c alg.c alpha68k.c aristmk4.c aristmk5.c artmagic.c asterix.c astinvad.c asuka.c atarisy2.c atetris.c beaminv.c berzerk.c bfcobra.c bfm_sc1.c bfm_sc2.c bfmsys85.c bigevglf.c bombjack.c boxer.c btoads.c buggychl.c capbowl.c cave.c cball.c ccastles.c cclimber.c champbas.c cidelsa.c clayshoo.c cliffhgr.c cloud9.c cojag.c combatsc.c coolpool.c crgolf.c crystal.c cubeqst.c cvs.c dec8.c destroyr.c enigma2.c eolith.c eolithsp.c equites.c esh.c espial.c esripsys.c exidy440.c exterm.c fgoal.c firebeat.c firetrk.c flstory.c flyball.c fromance.c fuukifg2.c fuukifg3.c gaelco3d.c galaga.c galastrm.c gaplus.c gcpinbal.c gijoe.c gottlieb.c gpworld.c grchamp.c gridlee.c groundfx.c gticlub.c guab.c gunbustr.c halleys.c hitme.c hng64.c hornet.c hyprduel.c itech32.c itech8.c jangou.c jedi.c jpmimpct.c jpmsys5.c kinst.c konamigx.c ksys573.c ladyfrog.c lgp.c lkage.c m10.c m107.c m63.c m72.c m92.c magmax.c mappy.c marineb.c maygay1b.c mazerbla.c megadriv.c megatech.c metro.c mgolf.c midvunit.c midzeus.c missile.c mjsister.c mlanding.c moo.c mpu4.c mpu4drvr.c msisaac.c multigam.c mustache.c mw18w.c* mw8080bw.c namcofl.c namconb1.c namcos10.c namcos22.c namcos23.c naomi.c neodrvr.c neogeo.c nmk16.c nycaptor.c orbit.c othunder.c panicr.c parodius.c peplus.c pgm.c pipedrm.c pipeline.c policetr.c powerins.c psikyo.c qdrmfgp.c rabbit.c rollerg.c rpunch.c runaway.c sbrkout.c seattle.c segahang.c segaorun.c segas16a.c segas16b.c segas18.c segas32.c segaxbd.c segaybd.c seta.c simpsons.c skullxbo.c slapshot.c snk.c sothello.c spacefb.c sprint4.c ssfindo.c sslam.c ssv.c st0016.c stv.c superqix.c suprridr.c taito_b.c taito_f2.c taito_f3.c taito_z.c taitogn.c tankbust.c tehkanwc.c tetrisp2.c thayers.c thunderx.c tickee.c tmmjprd.c tmnt.c toaplan2.c topspeed.c toypop.c trucocl.c trvquest.c tubep.c tugboat.c turbo.c twincobr.c ultratnk.c undrfire.c vaportra.c vegas.c vendetta.c vicdual.c videopin.c wardner.c wgp.c wheelfir.c wink.c wolfpack.c xexex.c zn.c zodiack.c zr107.c
[src/mame/includes]cave.h
[src/mame/layout]18w.lay* gamball.lay mpu4ext.lay*
[src/mame/machine]amiga.c archimds.c arkanoid.c asic65.c atarigen.c balsente.c bublbobl.c cdi070.c cdicdic.c cdislave.c cubocd32.c dc.c decocass.c gaelco3d.c harddriv.c irobot.c leland.c lsasquad.c mcr.c mcr68.c megadriv.c meters.c meters.h mhavoc.c micro3d.c midwayic.c midwunit.c model1.c mw8080bw.c n64.c namco06.c namco50.c namco53.c namcos2.c nb1413m3.c nmk004.c nmk112.c opwolf.c pcshare.c pitnrun.c psx.c qix.c rainbow.c segamsys.c slapstic.c slikshot.c snes.c starwars.c steppers.c steppers.h stfight.c tait8741.c taitosj.c ticket.c tnzs.c vertigo.c volfied.c williams.c
[src/mame/video]artmagic.c astrocde.c atari.c atarimo.c atarisy2.c avgdvg.c blstroid.c cave.c cchasm.c changela.c dc.c dcheese.c dday.c dkong.c esripsys.c exidy.c exidy440.c fromance.c galaxold.c gameplan.c hyhoo.c itech32.c itech8.c jaguar.c leland.c lethalj.c lockon.c m92.c mcd212.c midtunit.c midvunit.c midyunit.c midzeus2.c mystston.c n8080.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c nbmj9195.c neogeo.c niyanpai.c pastelg.c ppu2c0x.c rpunch.c segag80r.c segaic16.c segaic16.h segas32.c sprint8.c starfire.c tank8.c triplhnt.c tubep.c twin16.c tx1.c victory.c
[src/mess/audio]dave.c lynx.c mea8000.c svision.c t6721.c ted7360.c upd1771.c
[src/mess/devices]cococart.c kermit.c microdrv.c sonydriv.c xmodem.c
[src/mess/drivers]4004clk.c a2600.c a7000.c abc80.c atarist.c avigo.c beta.c bml3.c busicom.c c10.c cat.c coleco.c craft.c dectalk.c fk1.c fm7.c fmtowns.c gba.c glasgow.c gp32.c h19.c intv.c ip20.c ip22.c jr200.c junior.c kim1.c mekd2.c mephisto.c micronic.c mk1.c mk2.c mpf1.c multi8.c mycom.c nanos.c nc.c newbrain.c ng_aes.c ngp.c okean240.c osbexec.c osi.c pasogo.c pb1000.c pc6001.c pc8801.c pc88va.c pcw.c pcw16.c pockstat.c polgar.c prof80.c psion.c psx.c ptcsol.c pv1000.c px4.c samcoupe.c saturn.c scorpion.c scv.c sg1000.c smc777.c snes.c socrates.c ssystem3.c studio2.c supercon.c supracan.c svision.c tec1.c ti89.c tk80bs.c tm990189.c tmc1800.c tutor.c vg5k.c vt100.c x07.c x1.c x68k.c z88.c
[src/mess/formats]mz_cas.c
[src/mess/includes]coco.h
[src/mess/machine]64h156.c 6525tpi.c 6551.c 8530scc.c abc77.c adc080x.c amigacd.c amigacrt.c amigafdc.c amigakbd.c amstrad.c apple1.c apple2.c apple2gs.c applefdc.c at29040.c at29040a.c ay31015.c ay3600.c bbc.c bebox.c bk.c c128.c c1541.c c1551.c c1571.c c16.c c2040.c c64.c c65.c cbm.c cbmb.c cdp1871.c cgenie.c coco.c com8116.c compis.c comx35.c corvushd.c ctronics.c cybiko.c dai.c dc.c e0516.c electron.c europc.c fm_scsi.c gamecom.c gb.c hd63450.c hec2hrp.c hecdisk2.c hp48.c i8155.c i8257.c i8271.c ibmpc.c intv.c irisha.c kay_kbd.c kaypro.c kb3600.c kc.c kr2376.c lisa.c llc.c lviv.c lynx.c mac.c matsucd.c mb89352.c mbee.c mc68328.c mc6843.c mc6846.c mc6852.c mc6854.c microtan.c mikro80.c mm58274c.c mm74c922.c mos6530.c msm58321.c mz700.c nes.c nes_pcb.c odyssey2.c ondra.c oric.c osborne1.c pc.c pc1251.c pc1350.c pc1401.c pc1403.c pc_fdc.c pc_hdc.c pc_joy.c pc_mouse.c pc_turbo.c pce.c pcf8593.c pdp1.c pecom.c pet.c pmd85.c pokemini.c poly88.c radio86.c rmnimbus.c rp5c01a.c rp5c15.c samcoupe.c scsibus.c serial.c sgi.c smc92x4.c sms.c sorcerer.c special.c super80.c sym1.c tc8521.c teleprinter.c terminal.c tf20.c thomflop.c thomson.c ti85.c ti990.c tms5501.c tms9901.c tms9902.c trs80.c tx0.c upd1990a.c upd7002.c upd71071.c upd765.c ut88.c vector06.c vectrex.c wd17xx.c wswan.c x68k_hdc.c z80ne.c zx.c zx8302.c
[src/mess/machine/ti99]bwg.c handset.c hfdc.c spchsyn.c speech8.c ti_fdc.c
[src/mess/tools/messtest]core.c testmess.c
[src/mess/video]911_vdt.c aim65.c apple1.c apple2.c atarist.c cdp1861.c coco3.c coco6847.c crt9007.c crtc6845.c crtc_ega.c ef9345.c electron.c fm7.c fmtowns.c galaxy.c gamecom.c gb.c hd44352.c hd44780.c hd61830.c hp48.c k1ge.c m6845.c m6847.c mz700.c odyssey2.c oric.c pc_cga.c pc_mda.c pc_vga_mess.c smsvdp.c thomson.c upd3301.c upd7220.c vdc8563.c vectrex.c vic4567.c vic6567.c vtvideo.c x68k.c zx.c zx8301.c
[src/osd/osdmini]minimain.c

src/mame/audio/warpwarp.c
r10315r10316
236236
237237   state->channel = device->machine->sound().stream_alloc(*device, 0, 1, CLOCK_16H, NULL, warpwarp_sound_update);
238238
239   state->sound_volume_timer = timer_alloc(machine, sound_volume_decay, state);
240   state->music_volume_timer = timer_alloc(machine, music_volume_decay, state);
239   state->sound_volume_timer = machine->scheduler().timer_alloc(FUNC(sound_volume_decay), state);
240   state->music_volume_timer = machine->scheduler().timer_alloc(FUNC(music_volume_decay), state);
241241}
242242
243243
src/mame/audio/n8080.c
r10315r10316
329329
330330WRITE8_HANDLER( n8080_sound_1_w )
331331{
332   timer_call_after_resynch(space->machine, NULL, data, delayed_sound_1_callback); /* force CPUs to sync */
332   space->machine->scheduler().synchronize(FUNC(delayed_sound_1_callback), data); /* force CPUs to sync */
333333}
334334
335335WRITE8_HANDLER( n8080_sound_2_w )
336336{
337   timer_call_after_resynch(space->machine, NULL, data, delayed_sound_2_callback); /* force CPUs to sync */
337   space->machine->scheduler().synchronize(FUNC(delayed_sound_2_callback), data); /* force CPUs to sync */
338338}
339339
340340
r10315r10316
431431      state->helifire_dac_timing = DECAY_RATE * log(state->helifire_dac_volume);
432432   }
433433
434   state->helifire_dac_timing += timer_get_time(space->machine).as_double();
434   state->helifire_dac_timing += space->machine->time().as_double();
435435}
436436
437437
r10315r10316
453453static TIMER_DEVICE_CALLBACK( helifire_dac_volume_timer )
454454{
455455   n8080_state *state = timer.machine->driver_data<n8080_state>();
456   double t = state->helifire_dac_timing - timer_get_time(timer.machine).as_double();
456   double t = state->helifire_dac_timing - timer.machine->time().as_double();
457457
458458   if (state->helifire_dac_phase)
459459   {
r10315r10316
470470{
471471   n8080_state *state = machine->driver_data<n8080_state>();
472472
473   state->sound_timer[0] = timer_alloc(machine, stop_mono_flop_callback, NULL);
474   state->sound_timer[1] = timer_alloc(machine, stop_mono_flop_callback, NULL);
475   state->sound_timer[2] = timer_alloc(machine, stop_mono_flop_callback, NULL);
473   state->sound_timer[0] = machine->scheduler().timer_alloc(FUNC(stop_mono_flop_callback));
474   state->sound_timer[1] = machine->scheduler().timer_alloc(FUNC(stop_mono_flop_callback));
475   state->sound_timer[2] = machine->scheduler().timer_alloc(FUNC(stop_mono_flop_callback));
476476
477477   state_save_register_global(machine, state->prev_snd_data);
478478   state_save_register_global(machine, state->prev_sound_pins);
r10315r10316
502502{
503503   n8080_state *state = machine->driver_data<n8080_state>();
504504
505   state->sound_timer[0] = timer_alloc(machine, stop_mono_flop_callback, NULL);
506   state->sound_timer[1] = timer_alloc(machine, stop_mono_flop_callback, NULL);
505   state->sound_timer[0] = machine->scheduler().timer_alloc(FUNC(stop_mono_flop_callback));
506   state->sound_timer[1] = machine->scheduler().timer_alloc(FUNC(stop_mono_flop_callback));
507507
508508   state_save_register_global(machine, state->prev_snd_data);
509509   state_save_register_global(machine, state->prev_sound_pins);
src/mame/audio/turbo.c
r10315r10316
111111#else
112112
113113   if (((data ^ last_sound_a) & 0x1e) && (last_sound_a & 0x1e) != 0x1e)
114      timer_set(space->machine, attotime::from_hz(20000), NULL, data, update_sound_a);
114      space->machine->scheduler().timer_set(attotime::from_hz(20000), FUNC(update_sound_a), data);
115115   else
116116      update_sound_a(data);
117117
src/mame/audio/cage.c
r10315r10316
541541   running_machine *machine = cage_cpu->machine;
542542   if (LOG_COMM)
543543      logerror("%s:Command to CAGE = %04X\n", cpuexec_describe_context(machine), data);
544   timer_call_after_resynch(machine, NULL, data, deferred_cage_w);
544   machine->scheduler().synchronize(FUNC(deferred_cage_w), data);
545545}
546546
547547
src/mame/audio/namco52.c
r10315r10316
142142{
143143   namco_52xx_state *state = get_safe_token(device);
144144
145   timer_call_after_resynch(device->machine, (void *)device, data, namco_52xx_latch_callback);
145   device->machine->scheduler().synchronize(FUNC(namco_52xx_latch_callback), data, (void *)device);
146146
147147   cpu_set_input_line(state->cpu, 0, ASSERT_LINE);
148148
r10315r10316
154154
155155   /* the 52xx uses TSTI to check for an interrupt; it also may be handling
156156       a timer interrupt, so we need to ensure the IRQ line is held long enough */
157   timer_set(device->machine, attotime::from_usec(5*21), (void *)device, 0, namco_52xx_irq_clear);
157   device->machine->scheduler().timer_set(attotime::from_usec(5*21), FUNC(namco_52xx_irq_clear), 0, (void *)device);
158158}
159159
160160
r10315r10316
220220
221221   /* start the external clock */
222222   if (intf->extclock != 0)
223      timer_pulse(device->machine, attotime(0, intf->extclock), (void *)device, 0, external_clock_pulse);
223      device->machine->scheduler().timer_pulse(attotime(0, intf->extclock), FUNC(external_clock_pulse), 0, device);
224224}
225225
226226
src/mame/audio/senjyo.c
r10315r10316
9090   sample_set_volume(device, 0, state->single_volume / 15.0);
9191   sample_start_raw(device, 0, state->single_data, SINGLE_LENGTH, state->single_rate, 1);
9292
93   timer_pulse(machine, machine->primary_screen->frame_period(), NULL, 0, senjyo_sh_update);
93   machine->scheduler().timer_pulse(machine->primary_screen->frame_period(), FUNC(senjyo_sh_update));
9494}
src/mame/audio/segasnd.c
r10315r10316
222222
223223WRITE8_HANDLER( sega_speech_data_w )
224224{
225   timer_call_after_resynch(space->machine, NULL, data, delayed_speech_w);
225   space->machine->scheduler().synchronize(FUNC(delayed_speech_w), data);
226226}
227227
228228
r10315r10316
356356WRITE8_HANDLER( sega_usb_data_w )
357357{
358358   LOG(("%04X:usb_data_w = %02X\n", cpu_get_pc(space->cpu), data));
359   timer_call_after_resynch(space->machine, NULL, data, delayed_usb_data_w);
359   space->machine->scheduler().synchronize(FUNC(delayed_usb_data_w), data);
360360
361361   /* boost the interleave so that sequences can be sent */
362362   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(250));
src/mame/audio/leland.c
r10315r10316
557557
558558   /* create timers here so they stick around */
559559   state->i80186.cpu = dmaspace->cpu;
560   state->i80186.timer[0].int_timer = timer_alloc(machine, internal_timer_int, device);
561   state->i80186.timer[1].int_timer = timer_alloc(machine, internal_timer_int, device);
562   state->i80186.timer[2].int_timer = timer_alloc(machine, internal_timer_int, device);
563   state->i80186.timer[0].time_timer = timer_alloc(machine, NULL, NULL);
564   state->i80186.timer[1].time_timer = timer_alloc(machine, NULL, NULL);
565   state->i80186.timer[2].time_timer = timer_alloc(machine, NULL, NULL);
566   state->i80186.dma[0].finish_timer = timer_alloc(machine, dma_timer_callback, device);
567   state->i80186.dma[1].finish_timer = timer_alloc(machine, dma_timer_callback, device);
560   state->i80186.timer[0].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int), device);
561   state->i80186.timer[1].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int), device);
562   state->i80186.timer[2].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int), device);
563   state->i80186.timer[0].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
564   state->i80186.timer[1].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
565   state->i80186.timer[2].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
566   state->i80186.dma[0].finish_timer = machine->scheduler().timer_alloc(FUNC(dma_timer_callback), device);
567   state->i80186.dma[1].finish_timer = machine->scheduler().timer_alloc(FUNC(dma_timer_callback), device);
568568
569569   for (i = 0; i < 9; i++)
570      state->counter[i].timer = timer_alloc(machine, NULL, NULL);
570      state->counter[i].timer = machine->scheduler().timer_alloc(FUNC(NULL));
571571}
572572
573573static DEVICE_START( leland_80186_sound )
r10315r10316
694694static IRQ_CALLBACK( int_callback )
695695{
696696   leland_sound_state *state = get_safe_token(device->machine->device("custom"));
697   if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", timer_get_time(device->machine).as_double(), state->i80186.intr.poll_status & 0x1f);
697   if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", device->machine->time().as_double(), state->i80186.intr.poll_status & 0x1f);
698698
699699   /* clear the interrupt */
700700   cpu_set_input_line(state->i80186.cpu, 0, CLEAR_LINE);
r10315r10316
809809   if (!state->i80186.intr.pending)
810810      cputag_set_input_line(machine, "audiocpu", 0, ASSERT_LINE);
811811   state->i80186.intr.pending = 1;
812   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", timer_get_time(machine).as_double(), new_vector);
812   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine->time().as_double(), new_vector);
813813}
814814
815815
r10315r10316
836836         case 0x0f:   state->i80186.intr.in_service &= ~0x80;   break;
837837         default:   logerror("%s:ERROR - 80186 EOI with unknown vector %02X\n", cpuexec_describe_context(machine), data & 0x1f);
838838      }
839      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", timer_get_time(machine).as_double(), data & 0x1f);
839      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine->time().as_double(), data & 0x1f);
840840   }
841841
842842   /* non-specific case */
r10315r10316
849849         if ((state->i80186.intr.timer & 7) == i && (state->i80186.intr.in_service & 0x01))
850850         {
851851            state->i80186.intr.in_service &= ~0x01;
852            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", timer_get_time(machine).as_double());
852            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", machine->time().as_double());
853853            return;
854854         }
855855
r10315r10316
858858            if ((state->i80186.intr.dma[j] & 7) == i && (state->i80186.intr.in_service & (0x04 << j)))
859859            {
860860               state->i80186.intr.in_service &= ~(0x04 << j);
861               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", timer_get_time(machine).as_double(), j);
861               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", machine->time().as_double(), j);
862862               return;
863863            }
864864
r10315r10316
867867            if ((state->i80186.intr.ext[j] & 7) == i && (state->i80186.intr.in_service & (0x10 << j)))
868868            {
869869               state->i80186.intr.in_service &= ~(0x10 << j);
870               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", timer_get_time(machine).as_double(), j);
870               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", machine->time().as_double(), j);
871871               return;
872872            }
873873      }
r10315r10316
18141814
18151815WRITE8_DEVICE_HANDLER( leland_80186_command_lo_w )
18161816{
1817   timer_call_after_resynch(device->machine, device, data, command_lo_sync);
1817   device->machine->scheduler().synchronize(FUNC(command_lo_sync), data, device);
18181818}
18191819
18201820
r10315r10316
18771877   if (LOG_COMM) logerror("%04X:Read sound response latch = %02X\n", pc, state->sound_response);
18781878
18791879   /* synchronize the response */
1880   timer_call_after_resynch(device->machine, device, pc + 2, delayed_response_r);
1880   device->machine->scheduler().synchronize(FUNC(delayed_response_r), pc + 2, device);
18811881   return state->sound_response;
18821882}
18831883
src/mame/audio/segag80r.c
r10315r10316
582582   sega005_stream = device->machine->sound().stream_alloc(*device, 0, 1, SEGA005_COUNTER_FREQ, NULL, sega005_stream_update);
583583
584584   /* create a timer for the 555 */
585   sega005_sound_timer = timer_alloc(machine, sega005_auto_timer, NULL);
585   sega005_sound_timer = machine->scheduler().timer_alloc(FUNC(sega005_auto_timer));
586586
587587   /* set the initial sound data */
588588   sound_data = 0x00;
src/mame/audio/dcs.c
r10315r10316
15151515      logerror("%s: DCS reset = %d\n", cpuexec_describe_context(dcs.cpu->machine), state);
15161516
15171517      /* just run through the init code again */
1518      timer_call_after_resynch(dcs.cpu->machine, NULL, 0, dcs_reset);
1518      dcs.cpu->machine->scheduler().synchronize(FUNC(dcs_reset));
15191519      cpu_set_input_line(dcs.cpu, INPUT_LINE_RESET, ASSERT_LINE);
15201520   }
15211521
r10315r10316
15891589
15901590   /* if we are DCS1, set a timer to latch the data */
15911591   if (dcs.sport_timer == NULL)
1592      timer_call_after_resynch(dcs.cpu->machine, NULL, data, dcs_delayed_data_w_callback);
1592      dcs.cpu->machine->scheduler().synchronize(FUNC(dcs_delayed_data_w_callback), data);
15931593   else
15941594      dcs_delayed_data_w(dcs.cpu->machine, data);
15951595}
r10315r10316
16321632{
16331633   if (LOG_DCS_IO)
16341634      logerror("%08X:output_latch_w(%04X) (empty=%d)\n", cpu_get_pc(space->cpu), data, IS_OUTPUT_EMPTY());
1635   timer_call_after_resynch(space->machine, NULL, data, latch_delayed_w);
1635   space->machine->scheduler().synchronize(FUNC(latch_delayed_w), data);
16361636}
16371637
16381638
r10315r10316
16501650
16511651void dcs_ack_w(void)
16521652{
1653   timer_call_after_resynch(dcs.cpu->machine, NULL, 0, delayed_ack_w_callback);
1653   dcs.cpu->machine->scheduler().synchronize(FUNC(delayed_ack_w_callback));
16541654}
16551655
16561656
r10315r10316
16861686{
16871687   if (LOG_DCS_IO)
16881688      logerror("%04X:output_control = %04X\n", cpu_get_pc(space->cpu), data);
1689   timer_call_after_resynch(space->machine, NULL, data, output_control_delayed_w);
1689   space->machine->scheduler().synchronize(FUNC(output_control_delayed_w), data);
16901690}
16911691
16921692
r10315r10316
21222122   /* if the output is full, stall for a usec */
21232123   if (IS_OUTPUT_FULL())
21242124   {
2125      timer_set(machine, attotime::from_usec(1), NULL, param, s1_ack_callback2);
2125      machine->scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback2), param);
21262126      return;
21272127   }
21282128   output_latch_w(cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_PROGRAM), 0, 0x000a, 0xffff);
r10315r10316
21342134   /* if the output is full, stall for a usec */
21352135   if (IS_OUTPUT_FULL())
21362136   {
2137      timer_set(machine, attotime::from_usec(1), NULL, param, s1_ack_callback1);
2137      machine->scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback1), param);
21382138      return;
21392139   }
21402140   output_latch_w(cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_PROGRAM), 0, param, 0xffff);
21412141
21422142   /* chain to the next word we need to write back */
2143   timer_set(machine, attotime::from_usec(1), NULL, 0, s1_ack_callback2);
2143   machine->scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback2));
21442144}
21452145
21462146
r10315r10316
22562256
22572257            /* if we're done, start a timer to send the response words */
22582258            if (transfer.state == 0)
2259               timer_set(machine, attotime::from_usec(1), NULL, transfer.sum, s1_ack_callback1);
2259               machine->scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback1), transfer.sum);
22602260            return 1;
22612261         }
22622262         break;
r10315r10316
22722272   /* if the output is full, stall for a usec */
22732273   if (IS_OUTPUT_FULL())
22742274   {
2275      timer_set(machine, attotime::from_usec(1), NULL, param, s2_ack_callback);
2275      machine->scheduler().timer_set(attotime::from_usec(1), FUNC(s2_ack_callback), param);
22762276      return;
22772277   }
22782278   output_latch_w(space, 0, param, 0xffff);
r10315r10316
23692369            /* if we're done, start a timer to send the response words */
23702370            if (transfer.state == 0)
23712371            {
2372               timer_set(machine, attotime::from_usec(1), NULL, transfer.sum, s2_ack_callback);
2372               machine->scheduler().timer_set(attotime::from_usec(1), FUNC(s2_ack_callback), transfer.sum);
23732373               transfer.watchdog->reset();
23742374            }
23752375            return 1;
src/mame/audio/gottlieb.c
r10315r10316
272272   }
273273
274274   /* generate a NMI after a while to make the CPU continue to send data */
275   timer_set(space->machine, attotime::from_usec(50), NULL, 0, gottlieb_nmi_generate);
275   space->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(gottlieb_nmi_generate));
276276}
277277
278278static WRITE8_HANDLER( speech_clock_dac_w )
r10315r10316
446446   nmi_state_update(machine);
447447
448448   /* set a timer to turn it off again on hte next SOUND_CLOCK/16 */
449   timer_set(machine, attotime::from_hz(SOUND2_CLOCK/16), NULL, 0, nmi_clear);
449   machine->scheduler().timer_set(attotime::from_hz(SOUND2_CLOCK/16), FUNC(nmi_clear));
450450
451451   /* adjust the NMI timer for the next time */
452452   nmi_timer_adjust();
r10315r10316
526526static SOUND_START( gottlieb2 )
527527{
528528   /* set up the NMI timer */
529   nmi_timer = timer_alloc(machine, nmi_callback, NULL);
529   nmi_timer = machine->scheduler().timer_alloc(FUNC(nmi_callback));
530530   nmi_rate = 0;
531531   nmi_timer_adjust();
532532
src/mame/audio/jedi.c
r10315r10316
8888
8989WRITE8_HANDLER( jedi_audio_latch_w )
9090{
91   timer_call_after_resynch(space->machine, NULL, data, delayed_audio_latch_w);
91   space->machine->scheduler().synchronize(FUNC(delayed_audio_latch_w), data);
9292}
9393
9494
src/mame/audio/exidy.c
r10315r10316
495495
496496   if (state->tms != NULL)
497497   {
498      logerror("(%f)%s:TMS5220 data write = %02X\n", timer_get_time(device->machine).as_double(), cpuexec_describe_context(device->machine), riot6532_porta_out_get(state->riot));
498      logerror("(%f)%s:TMS5220 data write = %02X\n", device->machine->time().as_double(), cpuexec_describe_context(device->machine), riot6532_porta_out_get(state->riot));
499499      tms5220_data_w(state->tms, 0, data);
500500   }
501501}
r10315r10316
505505   exidy_sound_state *state = get_safe_token(device);
506506   if (state->tms != NULL)
507507   {
508      logerror("(%f)%s:TMS5220 status read = %02X\n", timer_get_time(device->machine).as_double(), cpuexec_describe_context(device->machine), tms5220_status_r(state->tms, 0));
508      logerror("(%f)%s:TMS5220 status read = %02X\n", device->machine->time().as_double(), cpuexec_describe_context(device->machine), tms5220_status_r(state->tms, 0));
509509      return tms5220_status_r(state->tms, 0);
510510   }
511511   else
r10315r10316
10081008
10091009   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound command = %02X\n", cpu_get_previouspc(state->maincpu), data);
10101010
1011   timer_call_after_resynch(device->machine, state->pia1, data, delayed_command_w);
1011   device->machine->scheduler().synchronize(FUNC(delayed_command_w), data, state->pia1);
10121012}
10131013
10141014
src/mame/audio/8080bw.c
r10315r10316
918918{
919919   mw8080bw_state *state = machine->driver_data<mw8080bw_state>();
920920
921   state->schaser_effect_555_timer = timer_alloc(machine, schaser_effect_555_cb, NULL);
921   state->schaser_effect_555_timer = machine->scheduler().timer_alloc(FUNC(schaser_effect_555_cb));
922922
923923   state_save_register_global(machine, state->schaser_explosion);
924924   state_save_register_global(machine, state->schaser_effect_555_is_low);
src/mame/audio/qix.c
r10315r10316
109109static WRITE8_DEVICE_HANDLER( sync_sndpia1_porta_w )
110110{
111111   /* we need to synchronize this so the sound CPU doesn't drop anything important */
112   timer_call_after_resynch(device->machine, (void *)device, data, deferred_sndpia1_porta_w);
112   device->machine->scheduler().synchronize(FUNC(deferred_sndpia1_porta_w), data, (void *)device);
113113}
114114
115115
src/mame/audio/amiga.c
r10315r10316
270270   for (i = 0; i < 4; i++)
271271   {
272272      audio_state->channel[i].index = i;
273      audio_state->channel[i].irq_timer = timer_alloc(device->machine, signal_irq, NULL);
273      audio_state->channel[i].irq_timer = device->machine->scheduler().timer_alloc(FUNC(signal_irq));
274274   }
275275
276276   /* create the stream */
src/mame/audio/cinemat.c
r10315r10316
14711471
14721472   /* watch for a 0->1 edge on bit 4 ("shift in") to clock in the new data */
14731473   if ((bits_changed & 0x10) && (sound_val & 0x10))
1474      timer_call_after_resynch(machine, NULL, sound_val & 0x0f, synced_sound_w);
1474      machine->scheduler().synchronize(FUNC(synced_sound_w), sound_val & 0x0f);
14751475}
14761476
14771477
src/mame/audio/namco54.c
r10315r10316
120120{
121121   namco_54xx_state *state = get_safe_token(device);
122122
123   timer_call_after_resynch(device->machine, (void *)device, data, namco_54xx_latch_callback);
123   device->machine->scheduler().synchronize(FUNC(namco_54xx_latch_callback), data, (void *)device);
124124
125125   cpu_set_input_line(state->cpu, 0, ASSERT_LINE);
126126
r10315r10316
129129   // The input clock to the 06XX interface chip is 64H, that is
130130   // 18432000/6/64 = 48kHz, so it makes sense for the irq line to be
131131   // asserted for one clock cycle ~= 21us.
132   timer_set(device->machine, attotime::from_usec(21), (void *)device, 0, namco_54xx_irq_clear);
132   device->machine->scheduler().timer_set(attotime::from_usec(21), FUNC(namco_54xx_irq_clear), 0, (void *)device);
133133}
134134
135135
src/mame/audio/mcr.c
r10315r10316
358358/********* external interfaces ***********/
359359WRITE8_HANDLER( ssio_data_w )
360360{
361   timer_call_after_resynch(space->machine, NULL, (offset << 8) | (data & 0xff), ssio_delayed_data_w);
361   space->machine->scheduler().synchronize(FUNC(ssio_delayed_data_w), (offset << 8) | (data & 0xff));
362362}
363363
364364READ8_HANDLER( ssio_status_r )
r10315r10316
548548/********* external interfaces ***********/
549549WRITE8_HANDLER( csdeluxe_data_w )
550550{
551   timer_call_after_resynch(space->machine, NULL, data, csdeluxe_delayed_data_w);
551   space->machine->scheduler().synchronize(FUNC(csdeluxe_delayed_data_w), data);
552552}
553553
554554READ8_HANDLER( csdeluxe_status_r )
r10315r10316
666666/********* external interfaces ***********/
667667WRITE8_HANDLER( soundsgood_data_w )
668668{
669   timer_call_after_resynch(space->machine, NULL, data, soundsgood_delayed_data_w);
669   space->machine->scheduler().synchronize(FUNC(soundsgood_delayed_data_w), data);
670670}
671671
672672READ8_HANDLER( soundsgood_status_r )
r10315r10316
770770/********* external interfaces ***********/
771771WRITE8_HANDLER( turbocs_data_w )
772772{
773   timer_call_after_resynch(space->machine, NULL, data, turbocs_delayed_data_w);
773   space->machine->scheduler().synchronize(FUNC(turbocs_delayed_data_w), data);
774774}
775775
776776READ8_HANDLER( turbocs_status_r )
r10315r10316
903903/********* external interfaces ***********/
904904WRITE8_HANDLER( squawkntalk_data_w )
905905{
906   timer_call_after_resynch(space->machine, NULL, data, squawkntalk_delayed_data_w);
906   space->machine->scheduler().synchronize(FUNC(squawkntalk_delayed_data_w), data);
907907}
908908
909909void squawkntalk_reset_w(running_machine *machine, int state)
src/mame/audio/t5182.c
r10315r10316
206206
207207WRITE8_HANDLER( t5182_sound_irq_w )
208208{
209   timer_call_after_resynch(space->machine, NULL, CPU_ASSERT,setirq_callback);
209   space->machine->scheduler().synchronize(FUNC(setirq_callback), CPU_ASSERT);
210210}
211211
212212static WRITE8_HANDLER( t5182_ym2151_irq_ack_w )
213213{
214   timer_call_after_resynch(space->machine, NULL, YM2151_ACK,setirq_callback);
214   space->machine->scheduler().synchronize(FUNC(setirq_callback), YM2151_ACK);
215215}
216216
217217static WRITE8_HANDLER( t5182_cpu_irq_ack_w )
218218{
219   timer_call_after_resynch(space->machine, NULL, CPU_CLEAR,setirq_callback);
219   space->machine->scheduler().synchronize(FUNC(setirq_callback), CPU_CLEAR);
220220}
221221
222222static void t5182_ym2151_irq_handler(device_t *device, int irq)
223223{
224224   if (irq)
225      timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT,setirq_callback);
225      device->machine->scheduler().synchronize(FUNC(setirq_callback), YM2151_ASSERT);
226226   else
227      timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR,setirq_callback);
227      device->machine->scheduler().synchronize(FUNC(setirq_callback), YM2151_CLEAR);
228228}
229229
230230
src/mame/audio/vicdual.c
r10315r10316
139139
140140MACHINE_START( frogs_audio )
141141{
142   frogs_croak_timer = timer_alloc(machine, frogs_croak_callback, NULL);
142   frogs_croak_timer = machine->scheduler().timer_alloc(FUNC(frogs_croak_callback));
143143}
144144
145145
src/mame/audio/harddriv.c
r10315r10316
7878
7979WRITE16_HANDLER( hd68k_snd_data_w )
8080{
81   timer_call_after_resynch(space->machine, NULL, data, delayed_68k_w);
81   space->machine->scheduler().synchronize(FUNC(delayed_68k_w), data);
8282   logerror("%06X:main write to sound=%04X\n", cpu_get_previouspc(space->cpu), data);
8383}
8484
src/mame/audio/m72.c
r10315r10316
118118void m72_ym2151_irq_handler(device_t *device, int irq)
119119{
120120   if (irq)
121      timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT,setvector_callback);
121      device->machine->scheduler().synchronize(FUNC(setvector_callback), YM2151_ASSERT);
122122   else
123      timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR,setvector_callback);
123      device->machine->scheduler().synchronize(FUNC(setvector_callback), YM2151_CLEAR);
124124}
125125
126126WRITE16_HANDLER( m72_sound_command_w )
r10315r10316
128128   if (ACCESSING_BITS_0_7)
129129   {
130130      soundlatch_w(space,offset,data);
131      timer_call_after_resynch(space->machine, NULL, Z80_ASSERT,setvector_callback);
131      space->machine->scheduler().synchronize(FUNC(setvector_callback), Z80_ASSERT);
132132   }
133133}
134134
135135WRITE8_HANDLER( m72_sound_command_byte_w )
136136{
137137   soundlatch_w(space,offset,data);
138   timer_call_after_resynch(space->machine, NULL, Z80_ASSERT,setvector_callback);
138   space->machine->scheduler().synchronize(FUNC(setvector_callback), Z80_ASSERT);
139139}
140140
141141WRITE8_HANDLER( m72_sound_irq_ack_w )
142142{
143   timer_call_after_resynch(space->machine, NULL, Z80_CLEAR,setvector_callback);
143   space->machine->scheduler().synchronize(FUNC(setvector_callback), Z80_CLEAR);
144144}
145145
146146
src/mame/audio/geebee.c
r10315r10316
141141   state->channel = device->machine->sound().stream_alloc(*device, 0, 1, 18432000 / 3 / 2 / 384, NULL, geebee_sound_update);
142142   state->vcount = 0;
143143
144   state->volume_timer = timer_alloc(machine, volume_decay, state);
144   state->volume_timer = machine->scheduler().timer_alloc(FUNC(volume_decay), state);
145145}
146146
147147DEVICE_GET_INFO( geebee_sound )
src/mame/audio/beezer.c
r10315r10316
77    AKA Lord Nightmare
88 
99    TODO:
10    * get rid of sh6840_LFSR_oldxor, is leftover of old code.
1110    * Several inexplicable things on the schematic are not handled, such as the
1211     'VCO' input for 6840 channel 2 external clock whose source does not appear
1312     anywhere on the schematic, nor does it handle the 'DMOD DATA' and 'DMOD
r10315r10316
102101   UINT8 sh6840_volume[4];
103102   UINT8 sh6840_MSB_latch;
104103   UINT8 sh6840_LSB_latch;
105   UINT8 sh6840_LFSR_oldxor;
106104   UINT32 sh6840_LFSR;
107105   UINT32 sh6840_LFSR_clocks;
108106   UINT32 sh6840_clocks_per_sample;
r10315r10316
218216         state->sh6840_LFSR_clocks = 0;
219217         /* shift the LFSR. finally or in the result and see if we've
220218         * had a 0->1 transition */
221         state->sh6840_LFSR_oldxor = state->sh6840_LFSR&0x1;
222219         newxor = (((state->sh6840_LFSR&0x10000)?1:0) ^ ((state->sh6840_LFSR&0x2000)?1:0))?1:0; 
223220         state->sh6840_LFSR <<= 1;
224221         state->sh6840_LFSR |= newxor;
r10315r10316
248245   state_save_register_device_item_array(device, 0, state->sh6840_volume);
249246   state_save_register_device_item(device, 0, state->sh6840_MSB_latch);
250247   state_save_register_device_item(device, 0, state->sh6840_LSB_latch);
251   state_save_register_device_item(device, 0, state->sh6840_LFSR_oldxor);
252248   state_save_register_device_item(device, 0, state->sh6840_LFSR);
253249   state_save_register_device_item(device, 0, state->sh6840_LFSR_clocks);
254250   state_save_register_device_item(device, 0, state->sh6840_clock_count);
r10315r10316
335331         if (noisy != 0)
336332         {
337333            noise_clocks_this_sample = sh6840_update_noise(state, t->clocks - chan1_clocks);
338            if (clocks) state->sh6840_noiselatch3 = state->sh6840_LFSR_oldxor;
334            if (clocks) state->sh6840_noiselatch3 = (state->sh6840_LFSR&0x1);
339335         }
340336 
341337         /* handle timer 2 if enabled */
r10315r10316
423419   state->sh6840_noiselatch3 = 0;
424420 
425421   /* LFSR */
426   state->sh6840_LFSR_oldxor = 0;
427422   state->sh6840_LFSR = 0xffffffff;
428423   state->sh6840_LFSR_clocks = 0;
429424}
r10315r10316
493488   state->sh6840_latchwrite = data&0x80;
494489   if ((!state->sh6840_latchwriteold) && (state->sh6840_latchwrite)) // rising edge
495490   {
496      state->sh6840_noiselatch1 = state->sh6840_LFSR_oldxor;
491      state->sh6840_noiselatch1 = (state->sh6840_LFSR&0x1);
497492   }
498493}
499494 
r10315r10316
503498 
504499   /* force an update of the stream */
505500   state->stream->update();
506   return state->sh6840_LFSR_oldxor;
501   return (state->sh6840_LFSR&0x1);
507502}
508503 
509504WRITE8_DEVICE_HANDLER( beezer_sh6840_w )
src/mame/audio/snes_snd.c
r10315r10316
13201320   memcpy(spc700->ipl_region, machine->region("user5")->base(), 64);
13211321
13221322   /* Initialize the timers */
1323   spc700->timer[0] = timer_alloc(machine, snes_spc_timer, spc700);
1323   spc700->timer[0] = machine->scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
13241324   timer_adjust_periodic(spc700->timer[0], attotime::from_hz(8000),  0, attotime::from_hz(8000));
13251325   timer_enable(spc700->timer[0], 0);
1326   spc700->timer[1] = timer_alloc(machine, snes_spc_timer, spc700);
1326   spc700->timer[1] = machine->scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
13271327   timer_adjust_periodic(spc700->timer[1], attotime::from_hz(8000),  1, attotime::from_hz(8000));
13281328   timer_enable(spc700->timer[1], 0);
1329   spc700->timer[2] = timer_alloc(machine, snes_spc_timer, spc700);
1329   spc700->timer[2] = machine->scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
13301330   timer_adjust_periodic(spc700->timer[2], attotime::from_hz(64000), 2, attotime::from_hz(64000));
13311331   timer_enable(spc700->timer[2], 0);
13321332
src/mame/audio/williams.c
r10315r10316
480480
481481void williams_cvsd_data_w(running_machine *machine, int data)
482482{
483   timer_call_after_resynch(machine, NULL, data, williams_cvsd_delayed_data_w);
483   machine->scheduler().synchronize(FUNC(williams_cvsd_delayed_data_w), data);
484484}
485485
486486
r10315r10316
554554
555555static WRITE8_HANDLER( narc_master_sync_w )
556556{
557   timer_set(space->machine, attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), NULL, 0x01, narc_sync_clear);
557   space->machine->scheduler().timer_set(attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), FUNC(narc_sync_clear), 0x01);
558558   audio_sync |= 0x01;
559559   logerror("Master sync = %02X\n", data);
560560}
r10315r10316
568568
569569static WRITE8_HANDLER( narc_slave_sync_w )
570570{
571   timer_set(space->machine, attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), NULL, 0x02, narc_sync_clear);
571   space->machine->scheduler().timer_set(attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), FUNC(narc_sync_clear), 0x02);
572572   audio_sync |= 0x02;
573573   logerror("Slave sync = %02X\n", data);
574574}
r10315r10316
649649
650650   /* don't clear the external IRQ state for a short while; this allows the
651651       self-tests to pass */
652   timer_set(space->machine, attotime::from_usec(10), NULL, 0, clear_irq_state);
652   space->machine->scheduler().timer_set(attotime::from_usec(10), FUNC(clear_irq_state));
653653   return soundlatch_r(space, 0);
654654}
655655
src/mame/audio/starwars.c
r10315r10316
100100
101101WRITE8_HANDLER( starwars_sout_w )
102102{
103   timer_call_after_resynch(space->machine, NULL, data, sound_callback);
103   space->machine->scheduler().synchronize(FUNC(sound_callback), data);
104104}
105105
106106
r10315r10316
138138
139139WRITE8_HANDLER( starwars_main_wr_w )
140140{
141   timer_call_after_resynch(space->machine, NULL, data, main_callback);
141   space->machine->scheduler().synchronize(FUNC(main_callback), data);
142142}
143143
144144
src/mame/machine/micro3d.c
r10315r10316
594594
595595   /* TODO: Calculate a better estimate for timing */
596596   if (state->mac_stat)
597      timer_set(space->machine, attotime::from_hz(MAC_CLK) * mac_cycles, NULL, 0, mac_done_callback);
597      space->machine->scheduler().timer_set(attotime::from_hz(MAC_CLK) * mac_cycles, FUNC(mac_done_callback));
598598
599599   state->mrab11 = mrab11;
600600   state->vtx_addr = vtx_addr;
r10315r10316
658658      return;
659659   }
660660
661   timer_set(space->machine, attotime::from_usec(40), NULL, data & ~4, adc_done_callback);
661   space->machine->scheduler().timer_set(attotime::from_usec(40), FUNC(adc_done_callback), data & ~4);
662662}
663663
664664CUSTOM_INPUT( botssa_hwchk_r )
r10315r10316
757757    non-zero on a reset, otherwise the 3D object data doesn't get uploaded! */
758758   space->write_dword(0x00470000, 0xa5a5a5a5);
759759
760   state->mc68901.timer_a = timer_alloc(machine, mfp_timer_a_cb, NULL);
760   state->mc68901.timer_a = machine->scheduler().timer_alloc(FUNC(mfp_timer_a_cb));
761761
762762   /* TODO? BOTSS crashes when starting the final stage because the 68000
763763    overwrites memory in use by the Am29000. Slowing down the 68000 slightly
src/mame/machine/rainbow.c
r10315r10316
833833
834834   state_save_register_item(machine, "cchip", NULL, 0, state->current_bank);
835835
836   timer_pulse(machine, attotime::from_hz(60), NULL, 0, cchip_timer);
836   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(cchip_timer));
837837}
src/mame/machine/cubocd32.c
r10315r10316
197197   state->cdrom_cmd_resp = 0;
198198
199199   state->cdrom_toc = NULL;
200   state->dma_timer = timer_alloc(machine, akiko_dma_proc, state);
201   state->frame_timer = timer_alloc(machine, akiko_frame_proc, state);
200   state->dma_timer = machine->scheduler().timer_alloc(FUNC(akiko_dma_proc), state);
201   state->frame_timer = machine->scheduler().timer_alloc(FUNC(akiko_frame_proc), state);
202202   state->i2cmem = machine->device("i2cmem");
203203
204204
r10315r10316
702702      {
703703         state->cdrom_cmd_start = (state->cdrom_cmd_start+3) & 0xff;
704704
705         timer_set( state->machine, attotime::from_msec(1), state, resp[0], akiko_cd_delayed_cmd );
705         state->machine->scheduler().timer_set( attotime::from_msec(1), FUNC(akiko_cd_delayed_cmd ), resp[0], state);
706706
707707         break;
708708      }
src/mame/machine/nmk004.c
r10315r10316
10461046void NMK004_init(running_machine *machine)
10471047{
10481048   /* we have to do this via a timer because we get called before the sound reset */
1049   timer_call_after_resynch(machine, NULL, 0, real_nmk004_init);
1049   machine->scheduler().synchronize(FUNC(real_nmk004_init));
10501050}
10511051
10521052
src/mame/machine/gaelco3d.c
r10315r10316
275275 
276276static void set_status(gaelco_serial_state *state, UINT8 mask, UINT8 set, int wait)
277277{
278   timer_set(state->device->machine, attotime::from_hz(wait),
279         state, (mask << 8)|set, set_status_cb);
278   state->device->machine->scheduler().timer_set(attotime::from_hz(wait), FUNC(set_status_cb), (mask << 8)|set, 
279         state);
280280}
281281 
282282static void process_in(gaelco_serial_state *state)
r10315r10316
465465   state->device = device;
466466 
467467   devcb_resolve_write_line(&state->irq_func, &intf->irq_func, device);
468   state->sync_timer = timer_alloc(device->machine, link_cb, state);
468   state->sync_timer = device->machine->scheduler().timer_alloc(FUNC(link_cb), state);
469469 
470470   /* register for save states */
471471   //state_save_register_device_item(device, 0, earom->offset);
src/mame/machine/bublbobl.c
r10315r10316
103103WRITE8_HANDLER( bublbobl_sound_command_w )
104104{
105105   soundlatch_w(space, offset, data);
106   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
106   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
107107}
108108
109109WRITE8_HANDLER( bublbobl_sh_nmi_disable_w )
src/mame/machine/asic65.c
r10315r10316
192192   /* rom-based use a deferred write mechanism */
193193   if (asic65.type == ASIC65_ROMBASED)
194194   {
195      timer_call_after_resynch(space->machine, NULL, data | (offset << 16), m68k_asic65_deferred_w);
195      space->machine->scheduler().synchronize(FUNC(m68k_asic65_deferred_w), data | (offset << 16));
196196      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(20));
197197      return;
198198   }
src/mame/machine/tnzs.c
r10315r10316
484484
485485static WRITE8_HANDLER( tnzs_sync_kludge_w )
486486{
487    timer_call_after_resynch(space->machine, NULL, data,kludge_callback);
487    space->machine->scheduler().synchronize(FUNC(kludge_callback), data);
488488}
489489*/
490490
src/mame/machine/mhavoc.c
r10315r10316
136136   cputag_set_input_line(machine, "gamma", INPUT_LINE_NMI, PULSE_LINE);
137137
138138   /* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */
139   timer_set(machine, attotime::from_usec(250), NULL, 0, 0);
139   machine->scheduler().timer_set(attotime::from_usec(250), FUNC(NULL));
140140}
141141
142142
r10315r10316
144144{
145145   mhavoc_state *state = space->machine->driver_data<mhavoc_state>();
146146   logerror("  writing to gamma processor: %02x (%d %d)\n", data, state->gamma_rcvd, state->alpha_xmtd);
147   timer_call_after_resynch(space->machine, NULL, data, delayed_gamma_w);
147   space->machine->scheduler().synchronize(FUNC(delayed_gamma_w), data);
148148}
149149
150150
src/mame/machine/decocass.c
r10315r10316
208208WRITE8_HANDLER( decocass_reset_w )
209209{
210210   decocass_state *state = space->machine->driver_data<decocass_state>();
211   LOG(1,("%10s 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
211   LOG(1,("%10s 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
212212   state->decocass_reset = data;
213213
214214   /* CPU #1 active high reset */
r10315r10316
288288
289289      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
290290      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n",
291         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data,
291         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data,
292292         (data & 1) ? "OBF" : "-",
293293         (data & 2) ? "IBF" : "-"));
294294   }
r10315r10316
336336         (((prom[promaddr] >> 4) & 1)            << MAP7(state->type1_outmap));
337337
338338      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x\n",
339         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
339         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
340340
341341      state->latch1 = save;      /* latch the data for the next A0 == 0 read */
342342   }
r10315r10316
368368
369369      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
370370      LOG(4,("%10s 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x <- (%s %s)\n",
371         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data,
371         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data,
372372         (data & 1) ? "OBF" : "-",
373373         (data & 2) ? "IBF" : "-"));
374374   }
r10315r10316
416416         (((prom[promaddr] >> 4) & 1)            << MAP7(state->type1_outmap));
417417
418418      LOG(3,("%10s 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x\n",
419         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
419         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
420420
421421      state->latch1 = save;      /* latch the data for the next A0 == 0 read */
422422   }
r10315r10316
448448
449449      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
450450      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n",
451         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data,
451         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data,
452452         (data & 1) ? "OBF" : "-",
453453         (data & 2) ? "IBF" : "-"));
454454   }
r10315r10316
496496         (((state->latch1 >> MAP7(state->type1_inmap)) & 1)      << MAP7(state->type1_outmap));
497497
498498      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x\n",
499         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
499         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
500500
501501      state->latch1 = save;      /* latch the data for the next A0 == 0 read */
502502   }
r10315r10316
528528
529529      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
530530      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x <- (%s %s)\n",
531         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data,
531         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data,
532532         (data & 1) ? "OBF" : "-",
533533         (data & 2) ? "IBF" : "-"));
534534   }
r10315r10316
576576         (((prom[promaddr] >> 4) & 1)            << MAP7(state->type1_outmap));
577577
578578      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x\n",
579         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
579         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
580580
581581      state->latch1 = save;      /* latch the data for the next A0 == 0 read */
582582   }
r10315r10316
610610
611611      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
612612      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x <- (%s %s)\n",
613         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data,
613         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data,
614614         (data & 1) ? "OBF" : "-",
615615         (data & 2) ? "IBF" : "-"));
616616   }
r10315r10316
658658         (((prom[promaddr] >> 4) & 1)            << MAP7(state->type1_outmap));
659659
660660      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x\n",
661         timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
661         space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
662662
663663      state->latch1 = save;      /* latch the data for the next A0 == 0 read */
664664   }
r10315r10316
688688      {
689689         UINT8 *prom = space->machine->region("dongle")->base();
690690         data = prom[256 * state->type2_d2_latch + state->type2_promaddr];
691         LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, 256 * state->type2_d2_latch + state->type2_promaddr));
691         LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, 256 * state->type2_d2_latch + state->type2_promaddr));
692692      }
693693      else
694694      {
r10315r10316
702702      else
703703         data = offset & 0xff;
704704
705      LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- 8041-%s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "STATUS" : "DATA"));
705      LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- 8041-%s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "STATUS" : "DATA"));
706706   }
707707   return data;
708708}
r10315r10316
714714   {
715715      if (1 == (offset & 1))
716716      {
717         LOG(4,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM+D2 latch", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
717         LOG(4,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM+D2 latch", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
718718      }
719719      else
720720      {
721721         state->type2_promaddr = data;
722         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM addr $%02x\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type2_promaddr));
722         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM addr $%02x\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type2_promaddr));
723723         return;
724724      }
725725   }
726726   else
727727   {
728      LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s ", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041 DATA"));
728      LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s ", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041 DATA"));
729729   }
730730   if (1 == (offset & 1))
731731   {
r10315r10316
770770      {
771771         UINT8 *prom = space->machine->region("dongle")->base();
772772         data = prom[state->type3_ctrs];
773         LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type3_ctrs));
773         LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type3_ctrs));
774774         if (++state->type3_ctrs == 4096)
775775            state->type3_ctrs = 0;
776776      }
r10315r10316
779779         if (0 == (offset & E5XX_MASK))
780780         {
781781            data = upi41_master_r(state->mcu, 1);
782            LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
782            LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
783783         }
784784         else
785785         {
786786            data = 0xff;   /* open data bus? */
787            LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
787            LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
788788         }
789789      }
790790   }
r10315r10316
793793      if (1 == state->type3_pal_19)
794794      {
795795         save = data = 0xff;    /* open data bus? */
796         LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
796         LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
797797      }
798798      else
799799      {
r10315r10316
924924                  (BIT(save, 7) << 7);
925925            }
926926            state->type3_d0_latch = save & 1;
927            LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- 8041-DATA\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
927            LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- 8041-DATA\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
928928         }
929929         else
930930         {
r10315r10316
938938               (BIT(save, 5) << 5) |
939939               (BIT(save, 6) << 7) |
940940               (BIT(save, 7) << 6);
941            LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
941            LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
942942            state->type3_d0_latch = save & 1;
943943         }
944944      }
r10315r10316
955955      if (1 == state->type3_pal_19)
956956      {
957957         state->type3_ctrs = data << 4;
958         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, "LDCTRS"));
958         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, "LDCTRS"));
959959         return;
960960      }
961961      else
r10315r10316
967967      if (1 == state->type3_pal_19)
968968      {
969969         /* write nowhere?? */
970         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, "nowhere?"));
970         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, "nowhere?"));
971971         return;
972972      }
973973   }
974   LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
974   LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
975975   upi41_master_w(state->mcu, offset, data);
976976}
977977
r10315r10316
997997      if (0 == (offset & E5XX_MASK))
998998      {
999999         data = upi41_master_r(state->mcu, 1);
1000         LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1000         LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
10011001      }
10021002      else
10031003      {
10041004         data = 0xff;   /* open data bus? */
1005         LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1005         LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
10061006      }
10071007   }
10081008   else
r10315r10316
10121012         UINT8 *prom = space->machine->region("dongle")->base();
10131013
10141014         data = prom[state->type4_ctrs];
1015         LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.', state->type4_ctrs));
1015         LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.', state->type4_ctrs));
10161016         state->type4_ctrs = (state->type4_ctrs + 1) & 0x7fff;
10171017      }
10181018      else
r10315r10316
10201020         if (0 == (offset & E5XX_MASK))
10211021         {
10221022            data = upi41_master_r(state->mcu, 0);
1023            LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
1023            LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
10241024         }
10251025         else
10261026         {
10271027            data = 0xff;   /* open data bus? */
1028            LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1028            LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
10291029         }
10301030      }
10311031   }
r10315r10316
10411041      if (1 == state->type4_latch)
10421042      {
10431043         state->type4_ctrs = (state->type4_ctrs & 0x00ff) | ((data & 0x7f) << 8);
1044         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS MSB (%04x)\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type4_ctrs));
1044         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS MSB (%04x)\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type4_ctrs));
10451045         return;
10461046      }
10471047      else
r10315r10316
10551055      if (state->type4_latch)
10561056      {
10571057         state->type4_ctrs = (state->type4_ctrs & 0xff00) | data;
1058         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS LSB (%04x)\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type4_ctrs));
1058         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS LSB (%04x)\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, state->type4_ctrs));
10591059         return;
10601060      }
10611061   }
1062   LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
1062   LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
10631063   upi41_master_w(state->mcu, offset, data);
10641064}
10651065
r10315r10316
10821082      if (0 == (offset & E5XX_MASK))
10831083      {
10841084         data = upi41_master_r(state->mcu, 1);
1085         LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1085         LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
10861086      }
10871087      else
10881088      {
10891089         data = 0xff;   /* open data bus? */
1090         LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1090         LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
10911091      }
10921092   }
10931093   else
r10315r10316
10951095      if (state->type5_latch)
10961096      {
10971097         data = 0x55;   /* Only a fixed value? It looks like this is all we need to do */
1098         LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- fixed value???\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
1098         LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- fixed value???\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
10991099      }
11001100      else
11011101      {
11021102         if (0 == (offset & E5XX_MASK))
11031103         {
11041104            data = upi41_master_r(state->mcu, 0);
1105            LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
1105            LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
11061106         }
11071107         else
11081108         {
11091109            data = 0xff;   /* open data bus? */
1110            LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1110            LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
11111111         }
11121112      }
11131113   }
r10315r10316
11221122   {
11231123      if (1 == state->type5_latch)
11241124      {
1125         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, "latch #2??"));
1125         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, "latch #2??"));
11261126         return;
11271127      }
11281128      else
r10315r10316
11341134      if (state->type5_latch)
11351135      {
11361136         /* write nowhere?? */
1137         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, "nowhere?"));
1137         LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, "nowhere?"));
11381138         return;
11391139      }
11401140   }
1141   LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
1141   LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
11421142   upi41_master_w(state->mcu, offset, data);
11431143}
11441144
r10315r10316
11601160      if (0 == (offset & E5XX_MASK))
11611161      {
11621162         data = upi41_master_r(state->mcu, 1);
1163         LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1163         LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
11641164      }
11651165      else
11661166      {
11671167         data = 0xff;   /* open data bus? */
1168         LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1168         LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
11691169      }
11701170   }
11711171   else
r10315r10316
11731173      if (0 == (offset & E5XX_MASK))
11741174      {
11751175         data = upi41_master_r(state->mcu, 0);
1176         LOG(3,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
1176         LOG(3,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.'));
11771177      }
11781178      else
11791179      {
11801180         data = 0xff;   /* open data bus? */
1181         LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1181         LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
11821182      }
11831183   }
11841184
r10315r10316
12121212         (!tape_is_present(state->cassette) << 7);   /* D7 = cassette present */
12131213
12141214      LOG(4,("%10s 6502-PC: %04x decocass_e5xx_r(%02x): $%02x <- STATUS (%s%s%s%s%s%s%s%s)\n",
1215         timer_get_time(space->machine).as_string(6),
1215         space->machine->time().as_string(6),
12161216         cpu_get_previouspc(space->cpu),
12171217         offset, data,
12181218         data & 0x01 ? "" : "REQ/",
r10315r10316
12451245
12461246   if (0 == (offset & E5XX_MASK))
12471247   {
1248      LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
1248      LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA"));
12491249      upi41_master_w(state->mcu, offset & 1, data);
12501250#ifdef MAME_DEBUG
12511251      decocass_fno(space->machine, offset, data);
r10315r10316
12531253   }
12541254   else
12551255   {
1256      LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> dongle\n", timer_get_time(space->machine).as_string(6), cpu_get_previouspc(space->cpu), offset, data));
1256      LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> dongle\n", space->machine->time().as_string(6), cpu_get_previouspc(space->cpu), offset, data));
12571257   }
12581258}
12591259
r10315r10316
17021702   if (data != state->i8041_p1_write_latch)
17031703   {
17041704      LOG(4,("%10s 8041-PC: %03x i8041_p1_w: $%02x (%s%s%s%s%s%s%s%s)\n",
1705         timer_get_time(space->machine).as_string(6),
1705         space->machine->time().as_string(6),
17061706         cpu_get_previouspc(space->cpu),
17071707         data,
17081708         data & 0x01 ? "" : "DATA-WRT",
r10315r10316
17391739   if (data != state->i8041_p1_read_latch)
17401740   {
17411741      LOG(4,("%10s 8041-PC: %03x i8041_p1_r: $%02x (%s%s%s%s%s%s%s%s)\n",
1742         timer_get_time(space->machine).as_string(6),
1742         space->machine->time().as_string(6),
17431743         cpu_get_previouspc(space->cpu),
17441744         data,
17451745         data & 0x01 ? "" : "DATA-WRT",
r10315r10316
17611761   if (data != state->i8041_p2_write_latch)
17621762   {
17631763      LOG(4,("%10s 8041-PC: %03x i8041_p2_w: $%02x (%s%s%s%s%s%s%s%s)\n",
1764         timer_get_time(space->machine).as_string(6),
1764         space->machine->time().as_string(6),
17651765         cpu_get_previouspc(space->cpu),
17661766         data,
17671767         data & 0x01 ? "" : "FNO/",
r10315r10316
17871787   if (data != state->i8041_p2_read_latch)
17881788   {
17891789      LOG(4,("%10s 8041-PC: %03x i8041_p2_r: $%02x (%s%s%s%s%s%s%s%s)\n",
1790         timer_get_time(space->machine).as_string(6),
1790         space->machine->time().as_string(6),
17911791         cpu_get_previouspc(space->cpu),
17921792         data,
17931793         data & 0x01 ? "" : "FNO/",
r10315r10316
21782178   assert(device->machine->config != NULL);
21792179
21802180   /* fetch the data pointer */
2181   tape->timer = timer_alloc(device->machine, tape_clock_callback, (void *)device);
2181   tape->timer = device->machine->scheduler().timer_alloc(FUNC(tape_clock_callback), (void *)device);
21822182   if (device->region() == NULL)
21832183      return;
21842184   UINT8 *regionbase = *device->region();
src/mame/machine/irobot.c
r10315r10316
169169    /* set a callback for the next 32-scanline increment */
170170    scanline += 32;
171171    if (scanline >= 256) scanline = 0;
172    timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, scanline_callback);
172    machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(scanline_callback), scanline);
173173}
174174
175175MACHINE_RESET( irobot )
r10315r10316
190190   state->irmb_timer = machine->device<timer_device>("irmb_timer");
191191
192192   /* set an initial timer to go off on scanline 0 */
193   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, scanline_callback);
193   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(scanline_callback));
194194
195195   irobot_rom_banksel_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),0,0);
196196   irobot_out0_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),0,0);
src/mame/machine/leland.c
r10315r10316
366366   battery_ram = reinterpret_cast<UINT8 *>(memory_get_shared(*machine, "battery"));
367367
368368   /* start scanline interrupts going */
369   master_int_timer = timer_alloc(machine, leland_interrupt_callback, NULL);
369   master_int_timer = machine->scheduler().timer_alloc(FUNC(leland_interrupt_callback));
370370}
371371
372372
r10315r10316
415415   extra_tram = auto_alloc_array(machine, UINT8, ATAXX_EXTRA_TRAM_SIZE);
416416
417417   /* start scanline interrupts going */
418   master_int_timer = timer_alloc(machine, ataxx_interrupt_callback, NULL);
418   master_int_timer = machine->scheduler().timer_alloc(FUNC(ataxx_interrupt_callback));
419419}
420420
421421
src/mame/machine/namco06.c
r10315r10316
271271      }
272272
273273   /* allocate a timer */
274   state->nmi_timer = timer_alloc(device->machine, nmi_generate, (void *)device);
274   state->nmi_timer = device->machine->scheduler().timer_alloc(FUNC(nmi_generate), (void *)device);
275275
276276   state_save_register_device_item(device, 0, state->control);
277277}
src/mame/machine/midwayic.c
r10315r10316
281281
282282   pic.yearoffs = yearoffs;
283283   pic.time_just_written = 0;
284   pic.time_write_timer = timer_alloc(machine, reset_timer, NULL);
284   pic.time_write_timer = machine->scheduler().timer_alloc(FUNC(reset_timer));
285285   memset(pic.default_nvram, 0xff, sizeof(pic.default_nvram));
286286   generate_serial_data(machine, upper);
287287}
r10315r10316
300300   /* if we're still holding the data ready bit high, do it */
301301   if (pic.latch & 0xf00)
302302   {
303      if (timer_get_time(space->machine) > pic.latch_expire_time)
303      if (space->machine->time() > pic.latch_expire_time)
304304         pic.latch &= 0xff;
305305      else
306306         pic.latch -= 0x100;
r10315r10316
347347
348348   /* store in the latch, along with a bit to indicate we have data */
349349   pic.latch = (data & 0x00f) | 0x480;
350   pic.latch_expire_time = timer_get_time(machine) + attotime::from_msec(1);
350   pic.latch_expire_time = machine->time() + attotime::from_msec(1);
351351   if (data & 0x10)
352352   {
353353      int cmd = pic.state ? (pic.state & 0x0f) : (pic.latch & 0x0f);
src/mame/machine/cdicdic.c
r10315r10316
12161216{
12171217    register_globals();
12181218
1219    m_interrupt_timer = timer_alloc(&m_machine, trigger_readback_int, 0);
1219    m_interrupt_timer = m_machine.scheduler().timer_alloc(FUNC(trigger_readback_int));
12201220    timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
12211221
1222    m_audio_sample_timer = timer_alloc(&m_machine, audio_sample_trigger, 0);
1222    m_audio_sample_timer = m_machine.scheduler().timer_alloc(FUNC(audio_sample_trigger));
12231223    timer_adjust_oneshot(m_audio_sample_timer, attotime::never, 0);
12241224
12251225    m_ram = auto_alloc_array(&m_machine, UINT16, 0x3c00/2);
src/mame/machine/ticket.c
r10315r10316
133133   state->ticketdispensed      = config->statushigh ? state->active_bit : 0;
134134   state->ticketnotdispensed   = state->ticketdispensed ^ state->active_bit;
135135
136   state->timer            = timer_alloc(device->machine, ticket_dispenser_toggle, (void *)device);
136   state->timer            = device->machine->scheduler().timer_alloc(FUNC(ticket_dispenser_toggle), (void *)device);
137137
138138   state_save_register_device_item(device, 0, state->status);
139139   state_save_register_device_item(device, 0, state->power);
src/mame/machine/dc.c
r10315r10316
265265   wave_dma.flag = (wave_dma.indirect & 1) ? 1 : 0;
266266   /* Note: if you trigger an instant DMA IRQ trigger, sfz3upper doesn't play any bgm. */
267267   /* TODO: timing of this */
268   timer_set(space->machine, attotime::from_usec(300), NULL, 0, aica_dma_irq);
268   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(aica_dma_irq));
269269}
270270
271271static void pvr_dma_execute(address_space *space)
r10315r10316
303303   }
304304   /* Note: do not update the params, since this DMA type doesn't support it. */
305305   /* TODO: timing of this */
306   timer_set(space->machine, attotime::from_usec(250), NULL, 0, pvr_dma_irq);
306   space->machine->scheduler().timer_set(attotime::from_usec(250), FUNC(pvr_dma_irq));
307307}
308308
309309// register decode helpers
r10315r10316
689689               dc_sysctrl_regs[SB_C2DSTAT]=address+ddtdata.length;
690690
691691            /* 200 usecs breaks sfz3upper */
692            timer_set(space->machine, attotime::from_usec(50), NULL, 0, ch2_dma_irq);
692            space->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(ch2_dma_irq));
693693            /* simulate YUV FIFO processing here */
694694            if((address & 0x1800000) == 0x0800000)
695               timer_set(space->machine, attotime::from_usec(500), NULL, 0, yuv_fifo_irq);
695               space->machine->scheduler().timer_set(attotime::from_usec(500), FUNC(yuv_fifo_irq));
696696         }
697697         break;
698698
r10315r10316
10661066
10671067               if (endflag)
10681068               {
1069                  timer_set(space->machine, attotime::from_usec(200), NULL, 0, maple_dma_irq);
1069                  space->machine->scheduler().timer_set(attotime::from_usec(200), FUNC(maple_dma_irq));
10701070                  break;
10711071               }
10721072               // skip fixed packet header
r10315r10316
12151215
12161216               if (endflag)
12171217               {
1218                  timer_set(space->machine, attotime::from_usec(200), NULL, 0, maple_dma_irq);
1218                  space->machine->scheduler().timer_set(attotime::from_usec(200), FUNC(maple_dma_irq));
12191219                  break;
12201220               }
12211221               // skip fixed packet header
r10315r10316
13331333         sh4_dma_ddt(space->machine->device("maincpu"), &ddtdata);
13341334         /* Note: KOF Neowave definitely wants this to be delayed (!) */
13351335         /* FIXME: timing of this */
1336         timer_set(space->machine, attotime::from_usec(500), NULL, 0, gdrom_dma_irq);
1336         space->machine->scheduler().timer_set(attotime::from_usec(500), FUNC(gdrom_dma_irq));
13371337      }
13381338      break;
13391339   }
r10315r10316
16091609   dc_rtcregister[RTC2] = current_time & 0x0000ffff;
16101610   dc_rtcregister[RTC1] = (current_time & 0xffff0000) >> 16;
16111611
1612   dc_rtc_timer = timer_alloc(machine, dc_rtc_increment, 0);
1612   dc_rtc_timer = machine->scheduler().timer_alloc(FUNC(dc_rtc_increment));
16131613}
16141614
16151615MACHINE_START( dc )
src/mame/machine/pitnrun.c
r10315r10316
2929READ8_HANDLER( pitnrun_mcu_data_r )
3030{
3131   pitnrun_state *state = space->machine->driver_data<pitnrun_state>();
32   timer_call_after_resynch(space->machine, NULL, 0,pitnrun_mcu_real_data_r);
32   space->machine->scheduler().synchronize(FUNC(pitnrun_mcu_real_data_r));
3333   return state->toz80;
3434}
3535
r10315r10316
4343
4444WRITE8_HANDLER( pitnrun_mcu_data_w )
4545{
46   timer_call_after_resynch(space->machine, NULL, data,pitnrun_mcu_real_data_w);
46   space->machine->scheduler().synchronize(FUNC(pitnrun_mcu_real_data_w), data);
4747   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(5));
4848}
4949
r10315r10316
115115   if (~data & 0x02)
116116   {
117117      /* 68705 is going to read data from the Z80 */
118      timer_call_after_resynch(space->machine, NULL, 0,pitnrun_mcu_data_real_r);
118      space->machine->scheduler().synchronize(FUNC(pitnrun_mcu_data_real_r));
119119      cputag_set_input_line(space->machine, "mcu",0,CLEAR_LINE);
120120      state->portA_in = state->fromz80;
121121   }
122122   if (~data & 0x04)
123123   {
124124      /* 68705 is writing data for the Z80 */
125      timer_call_after_resynch(space->machine, NULL, state->portA_out,pitnrun_mcu_status_real_w);
125      space->machine->scheduler().synchronize(FUNC(pitnrun_mcu_status_real_w), state->portA_out);
126126   }
127127   if (~data & 0x10)
128128   {
src/mame/machine/namco53.c
r10315r10316
126126   // The input clock to the 06XX interface chip is 64H, that is
127127   // 18432000/6/64 = 48kHz, so it makes sense for the irq line to be
128128   // asserted for one clock cycle ~= 21us.
129   timer_set(device->machine, attotime::from_usec(21), (void *)device, 0, namco_53xx_irq_clear);
129   device->machine->scheduler().timer_set(attotime::from_usec(21), FUNC(namco_53xx_irq_clear), 0, (void *)device);
130130}
131131
132132READ8_DEVICE_HANDLER( namco_53xx_read )
src/mame/machine/n64.c
r10315r10316
11561156            }
11571157            else if (ai_status & 0x40000000)
11581158            {
1159                double secs_left = (timer_firetime(audio_timer) - timer_get_time(space->machine)).as_double();
1159                double secs_left = (timer_firetime(audio_timer) - space->machine->time()).as_double();
11601160                unsigned int samples_left = secs_left * DACRATE_NTSC / (ai_dacrate + 1);
11611161                return samples_left * 4;
11621162            }
r10315r10316
20232023   rspdrc_set_options(machine->device("rsp"), RSPDRC_STRICT_VERIFY);
20242024   rspdrc_flush_drc_cache(machine->device("rsp"));
20252025
2026   audio_timer = timer_alloc(machine, audio_timer_callback, NULL);
2026   audio_timer = machine->scheduler().timer_alloc(FUNC(audio_timer_callback));
20272027}
20282028
20292029MACHINE_RESET( n64 )
src/mame/machine/stfight.c
r10315r10316
130130{
131131    // Do a RST10
132132    cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7);
133    timer_set(device->machine, attotime::from_hz(120), NULL, 0, stfight_interrupt_1);
133    device->machine->scheduler().timer_set(attotime::from_hz(120), FUNC(stfight_interrupt_1));
134134}
135135
136136/*
src/mame/machine/nmk112.c
r10315r10316
2020   UINT8 page_mask;
2121
2222   UINT8 current_bank[8];
23   UINT8 last_bank[2];
2423
2524   UINT8 *rom0, *rom1;
2625   int   size0, size1;
r10315r10316
4645}
4746
4847/*****************************************************************************
49    DEVICE HANDLERS
48    STATIC FUNCTIONS
5049*****************************************************************************/
5150
52WRITE8_DEVICE_HANDLER( nmk112_okibank_w )
51static void do_bankswitch( nmk112_state *nmk112, int offset, int data )
5352{
54   nmk112_state *nmk112 = get_safe_token(device);
5553   int chip = (offset & 4) >> 2;
5654   int banknum = offset & 3;
5755   int paged = (nmk112->page_mask & (1 << chip));
5856
5957   UINT8 *rom = chip ? nmk112->rom1 : nmk112->rom0;
6058   int size = chip ? nmk112->size1 : nmk112->size0;
61   int bankaddr = (data * BANKSIZE) % size;
6259
63   if (nmk112->current_bank[offset] == data)
64      return;
65
6660   nmk112->current_bank[offset] = data;
6761
62   if (size == 0) return;
63
64   int bankaddr = (data * BANKSIZE) % size;
65
6866   /* copy the samples */
6967   if ((paged) && (banknum == 0))
7068      memcpy(rom + 0x400, rom + 0x40000 + bankaddr + 0x400, BANKSIZE - 0x400);
r10315r10316
7775      rom += banknum * TABLESIZE;
7876      memcpy(rom, rom + 0x40000 + bankaddr, TABLESIZE);
7977   }
78}
8079
81   nmk112->last_bank[chip] = offset & 3;
80/*****************************************************************************
81    DEVICE HANDLERS
82*****************************************************************************/
83
84WRITE8_DEVICE_HANDLER( nmk112_okibank_w )
85{
86   nmk112_state *nmk112 = get_safe_token(device);
87
88   if (nmk112->current_bank[offset] != data)
89      do_bankswitch(nmk112, offset, data);
8290}
8391
8492WRITE16_DEVICE_HANDLER( nmk112_okibank_lsb_w )
r10315r10316
92100static STATE_POSTLOAD( nmk112_postload_bankswitch )
93101{
94102   nmk112_state *nmk112 = (nmk112_state *)param;
95   int i;
96103
97   for (i = 0; i < 2; i++)
98   {
99      int banknum = nmk112->last_bank[i];
100      int paged = (nmk112->page_mask & (1 << i));
101
102      UINT8 *rom = i ? nmk112->rom1 : nmk112->rom0;
103      int size = i ? nmk112->size1 : nmk112->size0;
104      int bankaddr = (nmk112->current_bank[nmk112->last_bank[i] + i * 4] * BANKSIZE) % size;
105
106      /* copy the samples */
107      if ((paged) && (banknum == 0))
108         memcpy(rom + 0x400, rom + 0x40000 + bankaddr + 0x400, BANKSIZE - 0x400);
109      else
110         memcpy(rom + banknum * BANKSIZE, rom + 0x40000 + bankaddr, BANKSIZE);
111
112      /* also copy the sample address table, if it is paged on this chip */
113      if (paged)
114      {
115         rom += banknum * TABLESIZE;
116         memcpy(rom, rom + 0x40000 + bankaddr, TABLESIZE);
117      }
118   }
104   for (int i = 0; i < 8; i++)
105      do_bankswitch(nmk112, i, nmk112->current_bank[i]);
119106}
120107
121108
r10315r10316
128115   nmk112_state *nmk112 = get_safe_token(device);
129116   const nmk112_interface *intf = get_interface(device);
130117
131   nmk112->rom0 = device->machine->region(intf->rgn0)->base();
132   nmk112->size0 = device->machine->region(intf->rgn0)->bytes() - 0x40000;
133   nmk112->rom1 = device->machine->region(intf->rgn1)->base();
134   nmk112->size1 = device->machine->region(intf->rgn1)->bytes() - 0x40000;
118   if (intf->rgn0 == NULL)
119   {
120      nmk112->rom0 = NULL;
121      nmk112->size0 = 0;
122   }
123   else
124   {
125      nmk112->rom0 = device->machine->region(intf->rgn0)->base();
126      nmk112->size0 = device->machine->region(intf->rgn0)->bytes() - 0x40000;
127   }
135128
129   if (intf->rgn1 == NULL)
130   {
131      nmk112->rom1 = NULL;
132      nmk112->size1 = 0;
133   }
134   else
135   {
136      nmk112->rom1 = device->machine->region(intf->rgn1)->base();
137      nmk112->size1 = device->machine->region(intf->rgn1)->bytes() - 0x40000;
138   }
139
136140   nmk112->page_mask = ~intf->disable_page_mask;
137141
138142   state_save_register_device_item_array(device, 0, nmk112->current_bank);
139   state_save_register_device_item_array(device, 0, nmk112->last_bank);
140143   state_save_register_postload(device->machine, nmk112_postload_bankswitch, nmk112);
141144}
142145
143146static DEVICE_RESET( nmk112 )
144147{
145148   nmk112_state *nmk112 = get_safe_token(device);
146   int i;
147149
148   for (i = 0; i < 8; i++)
149      nmk112->current_bank[i] = ~0;
150   for (int i = 0; i < 8; i++)
151   {
152      nmk112->current_bank[i] = 0;
153      do_bankswitch(nmk112, i, nmk112->current_bank[i]);
154   }
150155}
151156
152157
src/mame/machine/tait8741.c
r10315r10316
204204            st->txd[0] = st->portHandler ? st->portHandler(space,0) : st->portName ? input_port_read(space->machine, st->portName) : 0;
205205            if( sst )
206206            {
207               timer_call_after_resynch(space->machine, NULL, num, taito8741_serial_tx);
207               space->machine->scheduler().synchronize(FUNC(taito8741_serial_tx), num);
208208               st->serial_out = 0;
209209               st->status |= 0x04;
210210               st->phase = CMD_08;
r10315r10316
440440   if( (i8741[num].sts & 0x02) )
441441   {
442442      /* transmit data */
443      timer_set (machine, attotime::from_usec(1), NULL, num, josvolly_8741_tx);
443      machine->scheduler().timer_set (attotime::from_usec(1), FUNC(josvolly_8741_tx), num);
444444   }
445445}
446446
src/mame/machine/volfied.c
r10315r10316
392392         // Palette request cmd - verified to take around 122242 68000 cycles to complete
393393         if (state->current_cmd >= 0x1 && state->current_cmd < 0x12)
394394         {
395            timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(122242), NULL, 0, volfied_timer_callback);
395            space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(122242), FUNC(volfied_timer_callback));
396396         }
397397         // Unknown cmd - verified to take around 105500 68000 cycles to complete
398398         else if (state->current_cmd >= 0x81 && state->current_cmd < 0x92)
399399         {
400            timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(105500), NULL, 0, volfied_timer_callback);
400            space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(105500), FUNC(volfied_timer_callback));
401401         }
402402         else
403403         {
src/mame/machine/balsente.c
r10315r10316
4949   cputag_set_input_line(timer.machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE);
5050
5151   /* it will turn off on the next HBLANK */
52   timer_set(timer.machine, timer.machine->primary_screen->time_until_pos(param, BALSENTE_HBSTART), NULL, 0, irq_off);
52   timer.machine->scheduler().timer_set(timer.machine->primary_screen->time_until_pos(param, BALSENTE_HBSTART), FUNC(irq_off));
5353
5454   /* if this is Grudge Match, update the steering */
5555   if (state->grudge_steering_result & 0x80)
r10315r10316
482482
483483   /* set a timer for 500usec later to actually transmit the data */
484484   /* (this is very important for several games, esp Snacks'n Jaxson) */
485   timer_set(machine, attotime::from_usec(500), NULL, param, m6850_data_ready_callback);
485   machine->scheduler().timer_set(attotime::from_usec(500), FUNC(m6850_data_ready_callback), param);
486486}
487487
488488
r10315r10316
501501
502502   /* output register is at offset 1; set a timer to synchronize the CPUs */
503503   else
504      timer_call_after_resynch(space->machine, NULL, data, m6850_w_callback);
504      space->machine->scheduler().synchronize(FUNC(m6850_w_callback), data);
505505}
506506
507507
r10315r10316
628628   /* set a timer to go off and read the value after 50us */
629629   /* it's important that we do this for Mini Golf */
630630logerror("adc_select %d\n", offset & 7);
631   timer_set(space->machine, attotime::from_usec(50), NULL, offset & 7, adc_finished);
631   space->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(adc_finished), offset & 7);
632632}
633633
634634
src/mame/machine/megadriv.c
r10315r10316
16591659
16601660   for (i=0; i<3; i++)
16611661   {
1662      io_timeout[i] = timer_alloc(machine, io_timeout_timer_callback, (void*)(FPTR)i);
1662      io_timeout[i] = machine->scheduler().timer_alloc(FUNC(io_timeout_timer_callback), (void*)(FPTR)i);
16631663   }
16641664}
16651665
r10315r10316
22692269
22702270   /* If the z80 is running, sync the z80 execution state */
22712271   if ( ! genz80.z80_is_reset )
2272      timer_set( space->machine, attotime::zero, NULL, 0, megadriv_z80_run_state );
2272      space->machine->scheduler().timer_set( attotime::zero, FUNC(megadriv_z80_run_state ));
22732273}
22742274
22752275static WRITE16_HANDLER ( megadriv_68k_req_z80_reset )
r10315r10316
23132313         genz80.z80_is_reset = 1;
23142314      }
23152315   }
2316   timer_set( space->machine, attotime::zero, NULL, 0, megadriv_z80_run_state );
2316   space->machine->scheduler().timer_set( attotime::zero, FUNC(megadriv_z80_run_state ));
23172317}
23182318
23192319
r10315r10316
29772977// reads
29782978static READ16_HANDLER( _32x_68k_commsram_r )
29792979{
2980   if (_32X_COMMS_PORT_SYNC) timer_call_after_resynch(space->machine, NULL, 0, NULL);
2980   if (_32X_COMMS_PORT_SYNC) space->machine->scheduler().synchronize();
29812981   return commsram[offset];
29822982}
29832983
r10315r10316
29852985static WRITE16_HANDLER( _32x_68k_commsram_w )
29862986{
29872987   COMBINE_DATA(&commsram[offset]);
2988   if (_32X_COMMS_PORT_SYNC) timer_call_after_resynch(space->machine, NULL, 0, NULL);
2988   if (_32X_COMMS_PORT_SYNC) space->machine->scheduler().synchronize();
29892989}
29902990
29912991/**********************************************************************************************/
r10315r10316
41454145
41464146static READ16_HANDLER( segacd_comms_flags_r )
41474147{
4148   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4148   space->machine->scheduler().synchronize();
41494149   return segacd_comms_flags;
41504150}
41514151
r10315r10316
41544154   if (ACCESSING_BITS_0_7)
41554155   {
41564156      segacd_comms_flags = (segacd_comms_flags & 0xff00) | (data & 0x00ff);
4157      timer_call_after_resynch(space->machine, NULL, 0, NULL);
4157      space->machine->scheduler().synchronize();
41584158   }
41594159
41604160   if (ACCESSING_BITS_8_15)
r10315r10316
41804180   if (ACCESSING_BITS_8_15)
41814181   {
41824182      segacd_comms_flags = (segacd_comms_flags & 0x00ff) | (data & 0xff00);
4183      timer_call_after_resynch(space->machine, NULL, 0, NULL);
4183      space->machine->scheduler().synchronize();
41844184   }
41854185}
41864186
r10315r10316
42164216
42174217static READ16_HANDLER( segacd_comms_main_part1_r )
42184218{
4219   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4219   space->machine->scheduler().synchronize();
42204220   return segacd_comms_part1[offset];
42214221}
42224222
42234223static WRITE16_HANDLER( segacd_comms_main_part1_w )
42244224{
4225   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4225   space->machine->scheduler().synchronize();
42264226   COMBINE_DATA(&segacd_comms_part1[offset]);
42274227}
42284228
42294229static READ16_HANDLER( segacd_comms_main_part2_r )
42304230{
4231   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4231   space->machine->scheduler().synchronize();
42324232   return segacd_comms_part2[offset];
42334233}
42344234
r10315r10316
42404240
42414241static READ16_HANDLER( segacd_comms_sub_part1_r )
42424242{
4243   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4243   space->machine->scheduler().synchronize();
42444244   return segacd_comms_part1[offset];
42454245}
42464246
r10315r10316
42514251
42524252static READ16_HANDLER( segacd_comms_sub_part2_r )
42534253{
4254   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4254   space->machine->scheduler().synchronize();
42554255   return segacd_comms_part2[offset];
42564256}
42574257
42584258static WRITE16_HANDLER( segacd_comms_sub_part2_w )
42594259{
4260   timer_call_after_resynch(space->machine, NULL, 0, NULL);
4260   space->machine->scheduler().synchronize();
42614261   COMBINE_DATA(&segacd_comms_part2[offset]);
42624262}
42634263
r10315r10316
50215021
50225022   memory_install_read16_handler (space, 0x0000070, 0x0000073, 0, 0, scd_hint_vector_r );
50235023
5024   segacd_gfx_conversion_timer = timer_alloc(machine, segacd_gfx_conversion_timer_callback, 0);
5024   segacd_gfx_conversion_timer = machine->scheduler().timer_alloc(FUNC(segacd_gfx_conversion_timer_callback));
50255025   timer_adjust_oneshot(segacd_gfx_conversion_timer, attotime::never, 0);
50265026
5027   segacd_dmna_ret_timer = timer_alloc(machine, segacd_dmna_ret_timer_callback, 0);
5027   segacd_dmna_ret_timer = machine->scheduler().timer_alloc(FUNC(segacd_dmna_ret_timer_callback));
50285028   timer_adjust_oneshot(segacd_gfx_conversion_timer, attotime::never, 0);
50295029
5030   segacd_hock_timer = timer_alloc(machine, segacd_hock_callback, 0);
5030   segacd_hock_timer = machine->scheduler().timer_alloc(FUNC(segacd_hock_callback));
50315031   timer_adjust_oneshot(segacd_hock_timer, attotime::never, 0);
50325032
5033   segacd_irq3_timer = timer_alloc(machine, segacd_irq3_timer_callback, 0);
5033   segacd_irq3_timer = machine->scheduler().timer_alloc(FUNC(segacd_irq3_timer_callback));
50345034   timer_adjust_oneshot(segacd_irq3_timer, attotime::never, 0);
50355035
50365036
r10315r10316
52595259   if((segacd_cdd.ctrl & 4 || dir) && segacd_irq_mask & 0x10) // export status, check if bit 2 (HOst ClocK) and irq is enabled
52605260   {
52615261      segacd_cdd.ctrl |= 4; // enable Hock bit if it isn't already active
5262      timer_set(machine, attotime::from_hz(75), NULL,0, execute_hock_irq); // 1 / 75th of a second
5262      machine->scheduler().timer_set(attotime::from_hz(75), FUNC(execute_hock_irq)); // 1 / 75th of a second
52635263   }
52645264}
52655265#endif
r10315r10316
82468246       top-left of the screen.  The first scanline is scanline 0 (we set scanline to -1 in
82478247       VIDEO_EOF) */
82488248
8249   timer_call_after_resynch(timer.machine, NULL, 0, 0);
8249   timer.machine->scheduler().synchronize();
82508250   /* Compensate for some rounding errors
82518251
82528252       When the counter reaches 261 we should have reached the end of the frame, however due
r10315r10316
84248424      genz80.z80_has_bus = 1;
84258425      genz80.z80_bank_addr = 0;
84268426      genesis_scanline_counter = -1;
8427      timer_set( machine, attotime::zero, NULL, 0, megadriv_z80_run_state );
8427      machine->scheduler().timer_set( attotime::zero, FUNC(megadriv_z80_run_state ));
84288428   }
84298429
84308430   megadrive_imode = 0;
r10315r10316
89598959
89608960   if(_32x_is_connected)
89618961   {
8962      _32x_pwm_timer = timer_alloc(machine, _32x_pwm_callback, 0);
8962      _32x_pwm_timer = machine->scheduler().timer_alloc(FUNC(_32x_pwm_callback));
89638963      timer_adjust_oneshot(_32x_pwm_timer, attotime::never, 0);
89648964   }
89658965
src/mame/machine/meters.c
r10315r10316
22//                                                                       //
33// Electro mechanical meters                                             //
44//                                                                       //
5// 23-07-2004: Re-Animator                                               //
65//                                                                       //
7// TODO: - meter ticks if the signal changes from high to low AND the    //
8//         signal was high for at least 'reacttime' cycles               //
9//         It should tick if the signal goes from low to high AND stays  //
10//         high for at least xxx milliseconds                            //
11//                                                                       //
126///////////////////////////////////////////////////////////////////////////
137
148#include "emu.h"
r10315r10316
1812
1913static struct
2014{
21  long timestamp,   // time stamp in cycles after which timer will tick
22      reacttime,
23      count;      // mechmeter value
24  int  state;      // state 0/1
15   long on,   // Activity of reel
16      reacttime,
17      count;      // mechmeter value
18   int  state;      // state 0/1
19   emu_timer *meter_timer;
2520} meter_info[MAXMECHMETERS];
2621
27
2822static int number_mtr;
2923
3024///////////////////////////////////////////////////////////////////////////
25static TIMER_CALLBACK( meter_callback )
26{
27   meter_info[param].count++;
28}
3129
32void Mechmtr_init(int number)
30void MechMtr_config(running_machine *machine, int number)
3331{
34  int i;
32   int i;
3533
36  if ( number > MAXMECHMETERS ) number = MAXMECHMETERS;
34   if ( number > MAXMECHMETERS ) number = MAXMECHMETERS;
3735
38  for ( i = 0; i < number; i++ )
39  {
40   meter_info[i].reacttime = METERREACTTIME;
41   meter_info[i].state     = 0;
42   meter_info[i].count     = 0;
43   meter_info[i].timestamp = 0;
44  }
45  number_mtr = number;
36   for ( i = 0; i < number; i++ )
37   {
38      meter_info[i].reacttime = METERREACTTIME;
39      meter_info[i].state     = 0;
40      meter_info[i].count     = 0;
41      meter_info[i].on      = 0;
42      meter_info[i].meter_timer = machine->scheduler().timer_alloc(FUNC(meter_callback), (void*)(FPTR)i);
43      timer_reset(meter_info[i].meter_timer, attotime::never);
44   }
45   number_mtr = number;
4646}
4747
4848///////////////////////////////////////////////////////////////////////////
4949
50int MechMtr_GetNumberMeters(void)
50int MechMtr_GetNumberMeters(void)
5151{
52  return number_mtr;
52   return number_mtr;
5353}
5454
5555///////////////////////////////////////////////////////////////////////////
5656
5757void MechMtr_Setcount(int id, long count)
5858{
59  if ( id >= number_mtr ) return;
59   if ( id >= number_mtr ) return;
6060
61  meter_info[id].count = count;
61   meter_info[id].count = count;
6262}
6363
6464///////////////////////////////////////////////////////////////////////////
6565
6666long MechMtr_Getcount(int id)
6767{
68  long result = 0;
68   long result = 0;
6969
70  if ( id < number_mtr ) result = meter_info[id].count;
70   if ( id < number_mtr ) result = meter_info[id].count;
7171
72  return result;
72   return result;
7373}
7474
7575///////////////////////////////////////////////////////////////////////////
7676
7777void MechMtr_ReactTime(int id, long cycles)
7878{
79  if ( id >= number_mtr ) return;
79   if ( id >= number_mtr ) return;
80   meter_info[id].reacttime = cycles;
81}
8082
81  meter_info[id].reacttime = cycles;
83///////////////////////////////////////////////////////////////////////////
84
85int MechMtr_GetActivity(int id)
86{
87   return meter_info[id].on;
8288}
8389
8490///////////////////////////////////////////////////////////////////////////
8591
86int Mechmtr_update(int id, long cycles, int state)
92int MechMtr_update(int id, int state)
8793{
8894  int res = 0;
8995
r10315r10316
97103
98104   if ( state )
99105   {
100     meter_info[id].timestamp = cycles + meter_info[id].reacttime;
106      meter_info[id].on =1;
107      timer_adjust_oneshot(meter_info[id].meter_timer, attotime::from_seconds(meter_info[id].reacttime), id);
101108   }
102109   else
103110   {
104     if ( cycles > meter_info[id].timestamp )
105     { // meter has been active long enough
106      res = 1;
107      meter_info[id].count++;
108     }
111      meter_info[id].on =0;
112      timer_adjust_oneshot(meter_info[id].meter_timer, attotime::never, id);
109113   }
110114  }
111115
src/mame/machine/qix.c
r10315r10316
480480{
481481   /* make all the CPUs synchronize, and only AFTER that write the command to the PIA */
482482   /* otherwise the 68705 will miss commands */
483   timer_call_after_resynch(device->machine, (void *)device, data | (offset << 8), pia_w_callback);
483   device->machine->scheduler().synchronize(FUNC(pia_w_callback), data | (offset << 8), (void *)device);
484484}
485485
486486
src/mame/machine/meters.h
r10315r10316
44//                                                                       //
55// 23-07-2004: Re-Animator                                               //
66//                                                                       //
7// TODO: - meter ticks if the signal changes from high to low AND the    //
8//         signal was high for at least 'reacttime' cycles               //
9//         It should tick if the signal goes from low to high AND stays  //
10//         high for at least xxx milliseconds                            //
117//                                                                       //
128///////////////////////////////////////////////////////////////////////////
139
14#ifndef INC_MMTR
15#define INC_MMTR
10#pragma once
1611
12#ifndef __METERS_H__
13#define __METERS_H__
14
15#include "emu.h"
16
17
1718#define MAXMECHMETERS 8
1819
19#define METERREACTTIME 30000   // number of cycles meter has to be active to tick
20#define METERREACTTIME 0.025 // number of seconds meter has to be active to tick
2021
21void Mechmtr_init(     int number);
22void MechMtr_config(running_machine *machine, int number);
2223
2324int  MechMtr_GetNumberMeters(void);
2425
r10315r10316
2829
2930void MechMtr_ReactTime(int id, long cycles);
3031
31int  Mechmtr_update(   int id, long cycles, int state); // returns 1 if meter ticked
32int  MechMtr_update(   int id, int state);
3233
34int MechMtr_GetActivity(int id);
3335#endif
src/mame/machine/steppers.c
r10315r10316
1111// 05-03-2004: Re-Animator                                               //
1212//                                                                       //
1313// TODO:  add different types of stepper motors if needed                //
14//                                                                       //
14//        someone who understands the device system may want to convert  //
15//        this                                                           //
1516///////////////////////////////////////////////////////////////////////////
1617
1718#include "emu.h"
r10315r10316
344345   0, //0001->0110 1->6
345346   0, //0001->0111 1->7
346347   0, //0001->1000 1->8
347   -1,//0001->1001 1->9
348   -1,//0001->1001 1->9   -1,//1001->1000 9->8
348349   0, //0001->1010 1->A
349350   0, //0001->1011 1->B
350351   0, //0001->1100 1->C
r10315r10316
660661      start = step[which].index_start,
661662      end = step[which].index_end;
662663
663   if ( (( pos >= start ) && ( pos <= end )) &&
664   if (start > end) // cope with index patterns that wrap around
665   {
666      if ( (( pos > start ) || ( pos < end )) &&
664667      ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) ||
665668      ( step[which].pattern == 0 &&
666669      (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0)
667670      ) ) )
671      {
672         step[which].optic = 1;
673      }
674      else step[which].optic = 0;
675      }
676   else
668677   {
678      if ( (( pos > start ) && ( pos < end )) &&
679      ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) ||
680      ( step[which].pattern == 0 &&
681      (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0)
682      ) ) )
683      {
669684      step[which].optic = 1;
685      }
686      else step[which].optic = 0;
670687   }
671   else step[which].optic = 0;
672688}
673
674689///////////////////////////////////////////////////////////////////////////
675690
676691void stepper_reset_position(int which)
r10315r10316
729744         break;
730745      }
731746      #if 0 /* Assists with new index generation */
732      if ( which ==0 )logerror("which %d Index %d Steps %d Pattern Old %02X New %02X\n",which,index,steps,step[which].old_pattern,step[which].pattern);
747      if ( which ==0 )popmessage("which %d Index %d Steps %d Pattern Old %02X New %02X\n",which,index,steps,step[which].old_pattern,step[which].pattern);
733748      #endif
734749
735750      if ( steps )
src/mame/machine/snes.c
r10315r10316
213213   /* Start of VBlank */
214214   if (snes_ppu.beam.current_vert == snes_ppu.beam.last_visible_line)
215215   {
216      timer_set(machine, machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert, 10), NULL, 0, snes_reset_oam_address);
216      machine->scheduler().timer_set(machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert, 10), FUNC(snes_reset_oam_address));
217217
218218      snes_ram[HVBJOY] |= 0x81;      /* Set vblank bit to on & indicate controllers being read */
219219      snes_ram[RDNMI] |= 0x80;      /* Set NMI occured bit */
r10315r10316
766766         break;
767767      case HDMAEN:   /* HDMA channel designation */
768768         if (data) //if a HDMA is enabled, data is inited at the next scanline
769            timer_set(space->machine, space->machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert + 1), NULL, 0, snes_reset_hdma);
769            space->machine->scheduler().timer_set(space->machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert + 1), FUNC(snes_reset_hdma));
770770         break;
771771      case MEMSEL:   /* Access cycle designation in memory (2) area */
772772         /* FIXME: Need to adjust the speed only during access of banks 0x80+
r10315r10316
17081708   snes_state *state = machine->driver_data<snes_state>();
17091709
17101710   /* init timers and stop them */
1711   state->scanline_timer = timer_alloc(machine, snes_scanline_tick, NULL);
1711   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(snes_scanline_tick));
17121712   timer_adjust_oneshot(state->scanline_timer, attotime::never, 0);
1713   state->hblank_timer = timer_alloc(machine, snes_hblank_tick, NULL);
1713   state->hblank_timer = machine->scheduler().timer_alloc(FUNC(snes_hblank_tick));
17141714   timer_adjust_oneshot(state->hblank_timer, attotime::never, 0);
1715   state->nmi_timer = timer_alloc(machine, snes_nmi_tick, NULL);
1715   state->nmi_timer = machine->scheduler().timer_alloc(FUNC(snes_nmi_tick));
17161716   timer_adjust_oneshot(state->nmi_timer, attotime::never, 0);
1717   state->hirq_timer = timer_alloc(machine, snes_hirq_tick_callback, NULL);
1717   state->hirq_timer = machine->scheduler().timer_alloc(FUNC(snes_hirq_tick_callback));
17181718   timer_adjust_oneshot(state->hirq_timer, attotime::never, 0);
1719   state->div_timer = timer_alloc(machine, snes_div_callback, NULL);
1719   state->div_timer = machine->scheduler().timer_alloc(FUNC(snes_div_callback));
17201720   timer_adjust_oneshot(state->div_timer, attotime::never, 0);
1721   state->mult_timer = timer_alloc(machine, snes_mult_callback, NULL);
1721   state->mult_timer = machine->scheduler().timer_alloc(FUNC(snes_mult_callback));
17221722   timer_adjust_oneshot(state->mult_timer, attotime::never, 0);
1723   state->io_timer = timer_alloc(machine, snes_update_io, NULL);
1723   state->io_timer = machine->scheduler().timer_alloc(FUNC(snes_update_io));
17241724   timer_adjust_oneshot(state->io_timer, attotime::never, 0);
17251725
17261726   // SNES hcounter has a 0-339 range.  hblank starts at counter 260.
src/mame/machine/steppers.h
r10315r10316
11///////////////////////////////////////////////////////////////////////////
22//                                                                       //
3// Steppermotor emulation                                                //
3// steppers.c steppermotor emulation                                     //
44//                                                                       //
55// Emulates : 48 step motors driven with full step or half step          //
66//            also emulates the index optic                              //
77//                                                                       //
8// 13-08-2008: J. Wallace - Added a rigid interface structure,           //
9//                          and removed unnecessary inline functions     //
10//                          Rewritten to make it more flexible           //
118// 26-01-2007: J. Wallace - Rewritten to make it more flexible           //
12// 26-01-2007: J. Wallace - Rewritten to make it more flexible           //
13// 26-01-2007: J. Wallace - Rewritten to make it more flexible           //
149//                          and to allow indices to be set in drivers    //
1510// 29-12-2006: J. Wallace - Added state save support                     //
1611// 05-03-2004: Re-Animator                                               //
1712//                                                                       //
1813// TODO:  add different types of stepper motors if needed                //
19//                                                                       //
14//        someone who understands the device system may want to convert  //
15//        this                                                           //
2016///////////////////////////////////////////////////////////////////////////
2117
2218
src/mame/machine/taitosj.c
r10315r10316
116116WRITE8_HANDLER( taitosj_mcu_data_w )
117117{
118118   LOG(("%04x: protection write %02x\n",cpu_get_pc(space->cpu),data));
119   timer_call_after_resynch(space->machine, NULL, data,taitosj_mcu_real_data_w);
119   space->machine->scheduler().synchronize(FUNC(taitosj_mcu_real_data_w), data);
120120   /* temporarily boost the interleave to sync things up */
121121   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
122122}
r10315r10316
200200   if (~data & 0x02)
201201   {
202202      /* 68705 is going to read data from the Z80 */
203      timer_call_after_resynch(space->machine, NULL, 0, taitosj_mcu_data_real_r);
203      space->machine->scheduler().synchronize(FUNC(taitosj_mcu_data_real_r));
204204      cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
205205      state->portA_in = state->fromz80;
206206      LOG(("%04x: 68705 <- Z80 %02x\n", cpu_get_pc(space->cpu), state->portA_in));
r10315r10316
214214      LOG(("%04x: 68705 -> Z80 %02x\n", cpu_get_pc(space->cpu), state->portA_out));
215215
216216      /* 68705 is writing data for the Z80 */
217      timer_call_after_resynch(space->machine, NULL, state->portA_out, taitosj_mcu_status_real_w);
217      space->machine->scheduler().synchronize(FUNC(taitosj_mcu_status_real_w), state->portA_out);
218218   }
219219   if (~data & 0x10)
220220   {
src/mame/machine/amiga.c
r10315r10316
251251   }
252252
253253   /* setup the timers */
254   state->irq_timer = timer_alloc(machine, amiga_irq_proc, NULL);
255   state->blitter_timer = timer_alloc(machine, amiga_blitter_proc, NULL);
254   state->irq_timer = machine->scheduler().timer_alloc(FUNC(amiga_irq_proc));
255   state->blitter_timer = machine->scheduler().timer_alloc(FUNC(amiga_blitter_proc));
256256
257257   state->sound_device = machine->device("amiga");
258258}
r10315r10316
297297      (*state->intf->reset_callback)(machine);
298298
299299   /* start the scanline timer */
300   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, scanline_callback);
300   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(scanline_callback));
301301}
302302
303303
r10315r10316
346346
347347   /* set timer for next line */
348348   scanline = (scanline + 1) % machine->primary_screen->height();
349   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, scanline_callback);
349   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(scanline_callback), scanline);
350350}
351351
352352
r10315r10316
12811281         if (state->intf->serdat_w != NULL)
12821282            (*state->intf->serdat_w)(space->machine, data);
12831283         CUSTOM_REG(REG_SERDATR) &= ~0x3000;
1284         timer_set(space->machine, amiga_get_serial_char_period(space->machine), NULL, 0, finish_serial_write);
1284         space->machine->scheduler().timer_set(amiga_get_serial_char_period(space->machine), FUNC(finish_serial_write));
12851285         break;
12861286
12871287      case REG_BLTSIZE:
src/mame/machine/vertigo.c
r10315r10316
9595static WRITE_LINE_DEVICE_HANDLER( v_irq4_w )
9696{
9797   update_irq_encoder(device->machine, INPUT_LINE_IRQ4, state);
98   vertigo_vproc(device->machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_get_time(device->machine) - irq4_time), state);
99   irq4_time = timer_get_time(device->machine);
98   vertigo_vproc(device->machine->device<cpu_device>("maincpu")->attotime_to_cycles(device->machine->time() - irq4_time), state);
99   irq4_time = device->machine->time();
100100}
101101
102102
r10315r10316
186186WRITE16_HANDLER( vertigo_audio_w )
187187{
188188   if (ACCESSING_BITS_0_7)
189      timer_call_after_resynch(space->machine, NULL, data & 0xff, sound_command_w);
189      space->machine->scheduler().synchronize(FUNC(sound_command_w), data & 0xff);
190190}
191191
192192
r10315r10316
229229   ttl74148_update(ttl74148);
230230   vertigo_vproc_reset(machine);
231231
232   irq4_time = timer_get_time(machine);
232   irq4_time = machine->time();
233233   irq_state = 7;
234234}
235235
src/mame/machine/pcshare.c
r10315r10316
3131
3232#define VERBOSE_DBG 0       /* general debug messages */
3333#define DBG_LOG(N,M,A) \
34   if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(pc_keyb.machine).as_double(),(char*)M ); logerror A; }
34   if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s",pc_keyb.machine->time().as_double(),(char*)M ); logerror A; }
3535
3636#define VERBOSE_JOY 0      /* JOY (joystick port) */
3737#define JOY_LOG(N,M,A) \
38   if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(pc_keyb.machine).as_double(),(char*)M ); logerror A; }
38   if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s",pc_keyb.machine->time().as_double(),(char*)M ); logerror A; }
3939
4040
4141static TIMER_CALLBACK( pc_keyb_timer );
r10315r10316
6969   memset(&pc_keyb, 0, sizeof(pc_keyb));
7070   pc_keyb.machine = machine;
7171   pc_keyb.int_cb = set_keyb_int_func;
72   pc_keyb.timer = timer_alloc(machine, pc_keyb_timer, NULL);
72   pc_keyb.timer = machine->scheduler().timer_alloc(FUNC(pc_keyb_timer));
7373}
7474
7575UINT8 pc_keyb_read(void)
src/mame/machine/atarigen.c
r10315r10316
119119   for (i = 0, screen = machine->first_screen(); screen != NULL; i++, screen = screen->next_screen())
120120   {
121121      state->screen_timer[i].screen = screen;
122      state->screen_timer[i].scanline_interrupt_timer = timer_alloc(machine, scanline_interrupt_callback, (void *)screen);
123      state->screen_timer[i].scanline_timer = timer_alloc(machine, scanline_timer_callback, (void *)screen);
124      state->screen_timer[i].atarivc_eof_update_timer = timer_alloc(machine, atarivc_eof_update, (void *)screen);
122      state->screen_timer[i].scanline_interrupt_timer = machine->scheduler().timer_alloc(FUNC(scanline_interrupt_callback), (void *)screen);
123      state->screen_timer[i].scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_timer_callback), (void *)screen);
124      state->screen_timer[i].atarivc_eof_update_timer = machine->scheduler().timer_alloc(FUNC(atarivc_eof_update), (void *)screen);
125125   }
126126
127127   state_save_register_global(machine, state->scanline_int_state);
r10315r10316
639639
640640WRITE16_HANDLER( atarigen_sound_reset_w )
641641{
642   timer_call_after_resynch(space->machine, NULL, 0, delayed_sound_reset);
642   space->machine->scheduler().synchronize(FUNC(delayed_sound_reset));
643643}
644644
645645
r10315r10316
650650
651651void atarigen_sound_reset(running_machine *machine)
652652{
653   timer_call_after_resynch(machine, NULL, 1, delayed_sound_reset);
653   machine->scheduler().synchronize(FUNC(delayed_sound_reset), 1);
654654}
655655
656656
r10315r10316
664664WRITE16_HANDLER( atarigen_sound_w )
665665{
666666   if (ACCESSING_BITS_0_7)
667      timer_call_after_resynch(space->machine, NULL, data & 0xff, delayed_sound_w);
667      space->machine->scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff);
668668}
669669
670670WRITE16_HANDLER( atarigen_sound_upper_w )
671671{
672672   if (ACCESSING_BITS_8_15)
673      timer_call_after_resynch(space->machine, NULL, (data >> 8) & 0xff, delayed_sound_w);
673      space->machine->scheduler().synchronize(FUNC(delayed_sound_w), (data >> 8) & 0xff);
674674}
675675
676676WRITE32_HANDLER( atarigen_sound_upper32_w )
677677{
678678   if (ACCESSING_BITS_24_31)
679      timer_call_after_resynch(space->machine, NULL, (data >> 24) & 0xff, delayed_sound_w);
679      space->machine->scheduler().synchronize(FUNC(delayed_sound_w), (data >> 24) & 0xff);
680680}
681681
682682
r10315r10316
719719
720720WRITE8_HANDLER( atarigen_6502_sound_w )
721721{
722   timer_call_after_resynch(space->machine, NULL, data, delayed_6502_sound_w);
722   space->machine->scheduler().synchronize(FUNC(delayed_6502_sound_w), data);
723723}
724724
725725
r10315r10316
13821382      hblank += width;
13831383
13841384   /* halt and set a timer to wake up */
1385   timer_set(screen.machine, screen.scan_period() * (hblank - hpos) / width, (void *)cpu, 0, unhalt_cpu);
1385   screen.machine->scheduler().timer_set(screen.scan_period() * (hblank - hpos) / width, FUNC(unhalt_cpu), 0, (void *)cpu);
13861386   cpu_set_input_line(cpu, INPUT_LINE_HALT, ASSERT_LINE);
13871387}
13881388
src/mame/machine/cdislave.c
r10315r10316
474474{
475475    register_globals();
476476
477    m_interrupt_timer = timer_alloc(&m_machine, trigger_readback_int, 0);
477    m_interrupt_timer = m_machine.scheduler().timer_alloc(FUNC(trigger_readback_int));
478478    timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
479479}
480480
src/mame/machine/midwunit.c
r10315r10316
302302            int temp = midwunit_sound_state_r(space, 0, 0xffff);
303303            result |= (temp & 0x800) >> 9;
304304            result |= (~temp & 0x400) >> 10;
305            timer_call_after_resynch(space->machine, NULL, 0, 0);
305            space->machine->scheduler().synchronize();
306306         }
307307         break;
308308
r10315r10316
329329            int temp = midwunit_sound_state_r(space, 0, 0xffff);
330330            result |= (temp & 0x800) >> 11;
331331            result |= (~temp & 0x400) >> 8;
332            timer_call_after_resynch(space->machine, NULL, 0, 0);
332            space->machine->scheduler().synchronize();
333333         }
334334         break;
335335
src/mame/machine/namcos2.c
r10315r10316
107107{
108108   namcos2_eeprom = auto_alloc_array(machine, UINT8, namcos2_eeprom_size);
109109   machine->device<nvram_device>("nvram")->set_base(namcos2_eeprom, namcos2_eeprom_size);
110   namcos2_posirq_timer = timer_alloc(machine, namcos2_posirq_tick, NULL);
110   namcos2_posirq_timer = machine->scheduler().timer_alloc(FUNC(namcos2_posirq_tick));
111111}
112112
113113MACHINE_RESET( namcos2 )
src/mame/machine/namco50.c
r10315r10316
219219   // The input clock to the 06XX interface chip is 64H, that is
220220   // 18432000/6/64 = 48kHz, so it makes sense for the irq line to be
221221   // asserted for one clock cycle ~= 21us.
222   timer_set(device->machine, attotime::from_usec(21), (void *)device, 0, namco_50xx_irq_clear);
222   device->machine->scheduler().timer_set(attotime::from_usec(21), FUNC(namco_50xx_irq_clear), 0, (void *)device);
223223}
224224
225225WRITE8_DEVICE_HANDLER( namco_50xx_write )
226226{
227   timer_call_after_resynch(device->machine, (void *)device, data, namco_50xx_latch_callback);
227   device->machine->scheduler().synchronize(FUNC(namco_50xx_latch_callback), data, (void *)device);
228228
229229   namco_50xx_irq_set(device);
230230}
r10315r10316
232232
233233void namco_50xx_read_request(device_t *device)
234234{
235   timer_call_after_resynch(device->machine, (void *)device, 0, namco_50xx_readrequest_callback);
235   device->machine->scheduler().synchronize(FUNC(namco_50xx_readrequest_callback), 0, (void *)device);
236236
237237   namco_50xx_irq_set(device);
238238}
src/mame/machine/mcr.c
r10315r10316
168168MACHINE_START( nflfoot )
169169{
170170   /* allocate a timer for the IPU watchdog */
171   ipu_watchdog_timer = timer_alloc(machine, ipu_watchdog_reset, NULL);
171   ipu_watchdog_timer = machine->scheduler().timer_alloc(FUNC(ipu_watchdog_reset));
172172}
173173
174174
src/mame/machine/arkanoid.c
r10315r10316
3434
3535WRITE8_HANDLER( arkanoid_Z80_mcu_w )
3636{
37   timer_call_after_resynch(space->machine, NULL, data, test);
37   space->machine->scheduler().synchronize(FUNC(test), data);
3838   /* boost the interleave for a few usecs to make sure it is read successfully */
3939   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
4040}
src/mame/machine/archimds.c
r10315r10316
231231{
232232   memc_pagesize = 0;
233233
234   vbl_timer = timer_alloc(machine, vidc_vblank, NULL);
234   vbl_timer = machine->scheduler().timer_alloc(FUNC(vidc_vblank));
235235   timer_adjust_oneshot(vbl_timer, attotime::never, 0);
236236
237   timer[0] = timer_alloc(machine, ioc_timer, NULL);
238   timer[1] = timer_alloc(machine, ioc_timer, NULL);
239   timer[2] = timer_alloc(machine, ioc_timer, NULL);
240   timer[3] = timer_alloc(machine, ioc_timer, NULL);
237   timer[0] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
238   timer[1] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
239   timer[2] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
240   timer[3] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
241241   timer_adjust_oneshot(timer[0], attotime::never, 0);
242242   timer_adjust_oneshot(timer[1], attotime::never, 0);
243243   timer_adjust_oneshot(timer[2], attotime::never, 0);
244244   timer_adjust_oneshot(timer[3], attotime::never, 0);
245245
246   vid_timer = timer_alloc(machine, vidc_video_tick, NULL);
247   snd_timer = timer_alloc(machine, vidc_audio_tick, NULL);
246   vid_timer = machine->scheduler().timer_alloc(FUNC(vidc_video_tick));
247   snd_timer = machine->scheduler().timer_alloc(FUNC(vidc_audio_tick));
248248   timer_adjust_oneshot(snd_timer, attotime::never, 0);
249249}
250250
src/mame/machine/segamsys.c
r10315r10316
438438   chip->writemode = 0;
439439   chip->r_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_RGB15);
440440
441   chip->sms_scanline_timer = timer_alloc(machine, sms_scanline_timer_callback, chip);
441   chip->sms_scanline_timer = machine->scheduler().timer_alloc(FUNC(sms_scanline_timer_callback), chip);
442442
443443   return chip;
444444}
src/mame/machine/slikshot.c
r10315r10316
415415   inters_to_words(inter1, inter2, inter3, &beams, &word1, &word2, &word3);
416416   words_to_sensors(word1, word2, word3, beams, &sensor0, &sensor1, &sensor2, &sensor3);
417417
418   logerror("%15f: Sensor values: %04x %04x %04x %04x\n", timer_get_time(machine).as_double(), sensor0, sensor1, sensor2, sensor3);
418   logerror("%15f: Sensor values: %04x %04x %04x %04x\n", machine->time().as_double(), sensor0, sensor1, sensor2, sensor3);
419419}
420420
421421
r10315r10316
525525
526526WRITE8_HANDLER( slikshot_z80_control_w )
527527{
528   timer_call_after_resynch(space->machine, NULL, data, delayed_z80_control_w);
528   space->machine->scheduler().synchronize(FUNC(delayed_z80_control_w), data);
529529}
530530
531531
src/mame/machine/harddriv.c
r10315r10316
697697
698698   /* if being written from the 68000, synchronize on it */
699699   if (state->hd34010_host_access)
700      timer_call_after_resynch(space->machine, NULL, newdata | (offset << 16) | (which << 28), stmsp_sync_update);
700      space->machine->scheduler().synchronize(FUNC(stmsp_sync_update), newdata | (offset << 16) | (which << 28));
701701
702702   /* otherwise, just update */
703703   else
r10315r10316
790790   if (offset == 0x1fff)
791791   {
792792      logerror("%06X:ADSP sync address written (%04X)\n", cpu_get_previouspc(space->cpu), data);
793      timer_call_after_resynch(space->machine, NULL, 0, 0);
793      space->machine->scheduler().synchronize();
794794      cpu_triggerint(state->adsp);
795795   }
796796   else
r10315r10316
897897
898898      case 3:
899899         logerror("ADSP bank = %d (deferred)\n", val);
900         timer_call_after_resynch(space->machine, NULL, val, deferred_adsp_bank_switch);
900         space->machine->scheduler().synchronize(FUNC(deferred_adsp_bank_switch), val);
901901         break;
902902
903903      case 5:
r10315r10316
15201520      COMBINE_DATA(&newdata);
15211521      state->dataptr[state->next_msp_sync % MAX_MSP_SYNC] = dptr;
15221522      state->dataval[state->next_msp_sync % MAX_MSP_SYNC] = newdata;
1523      timer_call_after_resynch(space->machine, NULL, state->next_msp_sync++ % MAX_MSP_SYNC, rddsp32_sync_cb);
1523      space->machine->scheduler().synchronize(FUNC(rddsp32_sync_cb), state->next_msp_sync++ % MAX_MSP_SYNC);
15241524   }
15251525   else
15261526      COMBINE_DATA(&state->rddsp32_sync[0][offset]);
r10315r10316
15371537      COMBINE_DATA(&newdata);
15381538      state->dataptr[state->next_msp_sync % MAX_MSP_SYNC] = dptr;
15391539      state->dataval[state->next_msp_sync % MAX_MSP_SYNC] = newdata;
1540      timer_call_after_resynch(space->machine, NULL, state->next_msp_sync++ % MAX_MSP_SYNC, rddsp32_sync_cb);
1540      space->machine->scheduler().synchronize(FUNC(rddsp32_sync_cb), state->next_msp_sync++ % MAX_MSP_SYNC);
15411541   }
15421542   else
15431543      COMBINE_DATA(&state->rddsp32_sync[1][offset]);
src/mame/machine/psx.c
r10315r10316
16611661
16621662   for( n = 0; n < 7; n++ )
16631663   {
1664      p_psx->channel[ n ].timer = timer_alloc( machine, dma_finished_callback, machine );
1664      p_psx->channel[ n ].timer = machine->scheduler().timer_alloc( FUNC(dma_finished_callback), machine );
16651665      p_psx->channel[ n ].fn_read = NULL;
16661666      p_psx->channel[ n ].fn_write = NULL;
16671667   }
16681668
16691669   for( n = 0; n < 3; n++ )
16701670   {
1671      p_psx->root[ n ].timer = timer_alloc( machine, root_finished , NULL);
1671      p_psx->root[ n ].timer = machine->scheduler().timer_alloc( FUNC(root_finished ));
16721672   }
16731673
16741674   for( n = 0; n < 2; n++ )
16751675   {
1676      p_psx->sio[ n ].timer = timer_alloc( machine, sio_clock , NULL);
1676      p_psx->sio[ n ].timer = machine->scheduler().timer_alloc( FUNC(sio_clock ));
16771677      p_psx->sio[ n ].fn_handler = NULL;
16781678   }
16791679
src/mame/machine/lsasquad.c
r10315r10316
4343   state->sound_cmd = data;
4444
4545   //logerror("%04x: sound cmd %02x\n", cpu_get_pc(space->cpu), data);
46   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
46   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
4747}
4848
4949READ8_HANDLER( lsasquad_sh_sound_command_r )
src/mame/machine/williams.c
r10315r10316
280280   pia6821_ca1_w(pia_1, 1);
281281
282282   /* set a timer to turn it off once the scanline counter resets */
283   timer_set(timer.machine, timer.machine->primary_screen->time_until_pos(0), NULL, 0, williams_count240_off_callback);
283   timer.machine->scheduler().timer_set(timer.machine->primary_screen->time_until_pos(0), FUNC(williams_count240_off_callback));
284284
285285   /* set a timer for next frame */
286286   timer.adjust(timer.machine->primary_screen->time_until_pos(240));
r10315r10316
425425   pia6821_ca1_w(pia_0, 0);
426426
427427   /* set a timer to turn it off once the scanline counter resets */
428   timer_set(timer.machine, timer.machine->primary_screen->time_until_pos(8), NULL, 0, williams2_endscreen_off_callback);
428   timer.machine->scheduler().timer_set(timer.machine->primary_screen->time_until_pos(8), FUNC(williams2_endscreen_off_callback));
429429
430430   /* set a timer for next frame */
431431   timer.adjust(timer.machine->primary_screen->time_until_pos(254));
r10315r10316
546546WRITE8_DEVICE_HANDLER( williams_snd_cmd_w )
547547{
548548   /* the high two bits are set externally, and should be 1 */
549   timer_call_after_resynch(device->machine, NULL, data | 0xc0, williams_deferred_snd_cmd_w);
549   device->machine->scheduler().synchronize(FUNC(williams_deferred_snd_cmd_w), data | 0xc0);
550550}
551551
552552WRITE8_DEVICE_HANDLER( playball_snd_cmd_w )
553553{
554   timer_call_after_resynch(device->machine, NULL, data, williams_deferred_snd_cmd_w);
554   device->machine->scheduler().synchronize(FUNC(williams_deferred_snd_cmd_w), data);
555555}
556556
557557
r10315r10316
564564
565565static WRITE8_DEVICE_HANDLER( williams2_snd_cmd_w )
566566{
567   timer_call_after_resynch(device->machine, NULL, data, williams2_deferred_snd_cmd_w);
567   device->machine->scheduler().synchronize(FUNC(williams2_deferred_snd_cmd_w), data);
568568}
569569
570570
r10315r10316
983983{
984984   joust2_current_sound_data = (joust2_current_sound_data & ~0xff) | (data & 0xff);
985985   williams_cvsd_data_w(device->machine, joust2_current_sound_data);
986   timer_call_after_resynch(device->machine, NULL, joust2_current_sound_data, joust2_deferred_snd_cmd_w);
986   device->machine->scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), joust2_current_sound_data);
987987}
src/mame/machine/mcr68.c
r10315r10316
4848static UINT8 v493_irq_state;
4949static UINT8 v493_irq_vector;
5050
51static timer_fired_func v493_callback;
51static timer_expired_func v493_callback;
5252
5353static UINT8 zwackery_sound_data;
5454
r10315r10316
169169   {
170170      struct counter_state *m6840 = &m6840_state[i];
171171
172      m6840->timer = timer_alloc(machine, counter_fired_callback, NULL);
172      m6840->timer = machine->scheduler().timer_alloc(FUNC(counter_fired_callback));
173173
174174      state_save_register_item(machine, "m6840", NULL, i, m6840->control);
175175      state_save_register_item(machine, "m6840", NULL, i, m6840->latch);
r10315r10316
267267   /* also set a timer to generate the 493 signal at a specific time before the next VBLANK */
268268   /* the timing of this is crucial for Blasted and Tri-Sports, which check the timing of */
269269   /* VBLANK and 493 using counter 2 */
270   timer_set(device->machine, attotime::from_hz(30) - mcr68_timing_factor, NULL, 0, v493_callback);
270   device->machine->scheduler().timer_set(attotime::from_hz(30) - mcr68_timing_factor, FUNC(v493_callback));
271271}
272272
273273
r10315r10316
296296{
297297   v493_irq_state = 1;
298298   update_mcr68_interrupts(machine);
299   timer_set(machine, machine->primary_screen->scan_period(), NULL, 0, mcr68_493_off_callback);
299   machine->scheduler().timer_set(machine->primary_screen->scan_period(), FUNC(mcr68_493_off_callback));
300300   logerror("--- (INT1) ---\n");
301301}
302302
r10315r10316
351351   device_t *pia = machine->device("pia0");
352352
353353   pia6821_ca1_w(pia, 1);
354   timer_set(machine, machine->primary_screen->scan_period(), NULL, 0, zwackery_493_off_callback);
354   machine->scheduler().timer_set(machine->primary_screen->scan_period(), FUNC(zwackery_493_off_callback));
355355}
356356
357357
src/mame/machine/opwolf.c
r10315r10316
695695   {
696696      // Simulate time for command to execute (exact timing unknown, this is close)
697697      state->current_cmd = 0xf5;
698      timer_set(machine, state->maincpu->cycles_to_attotime(80000), NULL, 0, opwolf_timer_callback);
698      machine->scheduler().timer_set(state->maincpu->cycles_to_attotime(80000), FUNC(opwolf_timer_callback));
699699   }
700700   state->cchip_last_7a = state->cchip_ram[0x7a];
701701
r10315r10316
752752   state->cchip_coins_for_credit[1] = 1;
753753   state->cchip_credits_for_coin[1] = 1;
754754
755   timer_pulse(machine, attotime::from_hz(60), NULL, 0, cchip_timer);
755   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(cchip_timer));
756756}
src/mame/machine/starwars.c
r10315r10316
178178      state->PROM_AM[cnt]  = (val >> 7) & 0x0001;
179179   }
180180
181   state->math_timer = timer_alloc(machine, math_run_clear, NULL);
181   state->math_timer = machine->scheduler().timer_alloc(FUNC(math_run_clear));
182182}
183183
184184
src/mame/machine/nb1413m3.c
r10315r10316
4343#define NB1413M3_TIMER_BASE 20000000
4444static TIMER_CALLBACK( nb1413m3_timer_callback )
4545{
46   timer_set(machine, attotime::from_hz(NB1413M3_TIMER_BASE) * 256, NULL, 0, nb1413m3_timer_callback);
46   machine->scheduler().timer_set(attotime::from_hz(NB1413M3_TIMER_BASE) * 256, FUNC(nb1413m3_timer_callback));
4747
4848   nb1413m3_74ls193_counter++;
4949   nb1413m3_74ls193_counter &= 0x0f;
r10315r10316
140140
141141   nb1413m3_74ls193_counter = 0;
142142
143   timer_call_after_resynch(machine, NULL, 0, nb1413m3_timer_callback);
143   machine->scheduler().synchronize(FUNC(nb1413m3_timer_callback));
144144}
145145
146146WRITE8_HANDLER( nb1413m3_nmi_clock_w )
src/mame/machine/model1.c
r10315r10316
20372037      // Reading from empty FIFO causes the v60 to enter wait state
20382038      v60_stall(space->machine->device("maincpu"));
20392039
2040      timer_call_after_resynch(space->machine, NULL, 0, NULL);
2040      space->machine->scheduler().synchronize();
20412041
20422042      return 0;
20432043   }
src/mame/machine/slapstic.c
r10315r10316
11431143      slapsticlog = fopen("slapstic.log", "w");
11441144   if (slapsticlog)
11451145   {
1146      attotime time = timer_get_time(machine);
1146      attotime time = machine->time();
11471147
11481148      if ((time - last_time) > attotime::from_seconds(1))
11491149         fprintf(slapsticlog, "------------------------------------\n");
src/mame/machine/cdi070.c
r10315r10316
11431143    state_save_register_global(machine, scc68070->mmu.desc[7].segment);
11441144    state_save_register_global(machine, scc68070->mmu.desc[7].base);
11451145
1146   scc68070->timers.timer0_timer = timer_alloc(machine, scc68070_timer0_callback, 0);
1146   scc68070->timers.timer0_timer = machine->scheduler().timer_alloc(FUNC(scc68070_timer0_callback));
11471147   timer_adjust_oneshot(scc68070->timers.timer0_timer, attotime::never, 0);
11481148
1149   scc68070->uart.rx_timer = timer_alloc(machine, scc68070_rx_callback, 0);
1149   scc68070->uart.rx_timer = machine->scheduler().timer_alloc(FUNC(scc68070_rx_callback));
11501150   timer_adjust_oneshot(scc68070->uart.rx_timer, attotime::never, 0);
11511151
1152   scc68070->uart.tx_timer = timer_alloc(machine, scc68070_tx_callback, 0);
1152   scc68070->uart.tx_timer = machine->scheduler().timer_alloc(FUNC(scc68070_tx_callback));
11531153   timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::never, 0);
11541154}
11551155
src/mame/machine/mw8080bw.c
r10315r10316
7575static void mw8080bw_create_interrupt_timer( running_machine *machine )
7676{
7777   mw8080bw_state *state = machine->driver_data<mw8080bw_state>();
78   state->interrupt_timer = timer_alloc(machine, mw8080bw_interrupt_callback, NULL);
78   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(mw8080bw_interrupt_callback));
7979}
8080
8181
src/mame/mamedriv.c
r10315r10316
13831383   DRIVER( cosmo )      /* TDS+Mints */
13841384   DRIVER( darthvdr )   /* bootleg */
13851385
1386   DRIVER( 18w )      /* 653 (c) 1979 Midway */
1387   DRIVER( 18w2 )      /* 653 (c) 1979 Midway */
13861388   DRIVER( sspeedr )   /* 1979 Midway */
13871389
13881390   /* Similar but with a M6800 instead of an 8080 */
r10315r10316
48974899   DRIVER( vfurlong )   /* 2005.03 Net Select Keiba Victory Furlong */
48984900                  /* 2005.03 The Rumble Fish 2 */
48994901   DRIVER( ngbc )      /* 2005.07 NeoGeo Battle Colloseum */
4900                  /* 2005.09 Samurai Spirits Tenkaichi Kenkakuden */
4902   DRIVER( samsptk )   /* 2005.09 Samurai Spirits Tenkaichi Kenkakuden */
49014903   DRIVER( kofxi )      /* 2005.10 The King of Fighters XI */
49024904   DRIVER( fotns )      /* 2005.12 Hokuto no Ken */
49034905   DRIVER( mslug6 )   /* 2006.02 Metal Slug 6 */
r10315r10316
89618963   DRIVER( eyesdown )   /* 199? */
89628964   DRIVER( eyesdownd )   /* 199? */
89638965
8966   /* BwB games */
89648967   DRIVER( blox )      /* 199? */
89658968   DRIVER( bloxd )      /* 199? */
8969   DRIVER( bwbtetrs )   /* 199? */
89668970   DRIVER( prizeinv )   /* 199? */
89678971   DRIVER( vgpoker )   /* 199? */
8972   DRIVER( renoreel )   /* 199? */
8973   DRIVER( redhtpkr )   /* 199? */
89688974
89698975   /* ADP games */
89708976   DRIVER( backgamn )   /* (c) 1990 */
r10315r10316
92359241   DRIVER( ironfortj )   /* (c) 1998 Eolith */
92369242   DRIVER( puzzlekg )   /* (c) 1998 Eolith */
92379243   DRIVER( hidctch2 )   /* (c) 1999 Eolith */
9244   DRIVER( hidctch2a)   /* (c) 1999 Eolith */
92389245   DRIVER( nhidctch )   /* (c) 1999 Eolith */
92399246   DRIVER( landbrk )   /* (c) 1999 Eolith */
92409247   DRIVER( landbrka )   /* (c) 1999 Eolith */
r10315r10316
1056110568   DRIVER( m_oldtmr )   /* Barcrest - highly prelim*/
1056210569   DRIVER( m_ccelbr )
1056310570   DRIVER( m_gmball )
10571   DRIVER( m_grtecp )   /* 199? */
1056410572
1056510573   /* MPU5 */
1056610574   DRIVER( m_honmon )
src/mame/includes/cave.h
r10315r10316
2525{
2626public:
2727   cave_state(running_machine &machine, const driver_device_config_base &config)
28      : driver_device(machine, config) { }
28      : driver_device(machine, config), int_timer(*this, "int_timer") { }
2929
3030   /* memory pointers */
3131   UINT16 *     videoregs;
r10315r10316
112112   /* devices */
113113   device_t *maincpu;
114114   device_t *audiocpu;
115   required_device<timer_device> int_timer;
115116};
116117
117118/*----------- defined in video/cave.c -----------*/
src/mame/mame.mak
r10315r10316
892892$(MAMEOBJ)/midw8080.a: \
893893   $(DRIVERS)/8080bw.o $(AUDIO)/8080bw.o $(VIDEO)/8080bw.o \
894894   $(DRIVERS)/m79amb.o $(AUDIO)/m79amb.o \
895   $(DRIVERS)/mw18w.o \
895896   $(DRIVERS)/mw8080bw.o $(MACHINE)/mw8080bw.o $(AUDIO)/mw8080bw.o $(VIDEO)/mw8080bw.o \
896897   $(DRIVERS)/rotaryf.o \
897898   $(DRIVERS)/sspeedr.o $(VIDEO)/sspeedr.o \
r10315r10316
18751876
18761877$(DRIVERS)/mpu4.o:      $(LAYOUT)/mpu4.lh \
18771878                  $(LAYOUT)/connect4.lh \
1879                  $(LAYOUT)/mpu4ext.lh \
18781880                  $(LAYOUT)/gamball.lh
18791881
1882$(DRIVERS)/mw18w.o:      $(LAYOUT)/18w.lh
1883
18801884$(DRIVERS)/mw8080bw.o:   $(LAYOUT)/280zzzap.lh \
18811885                  $(LAYOUT)/clowns.lh \
18821886                  $(LAYOUT)/invaders.lh \
src/mame/video/mcd212.c
r10315r10316
16551655    VIDEO_START_CALL(generic_bitmapped);
16561656    mcd212_ab_init(&state->mcd212_ab);
16571657    mcd212_init(machine, &state->mcd212_regs);
1658    state->mcd212_regs.scan_timer = timer_alloc(machine, mcd212_perform_scan, 0);
1658    state->mcd212_regs.scan_timer = machine->scheduler().timer_alloc(FUNC(mcd212_perform_scan));
16591659    timer_adjust_oneshot(state->mcd212_regs.scan_timer, machine->primary_screen->time_until_pos(0, 0), 0);
16601660
16611661    state->lcdbitmap = downcast<screen_device *>(machine->device("lcd"))->alloc_compatible_bitmap();
src/mame/video/mystston.c
r10315r10316
228228   tilemap_set_transparent_pen(state->fg_tilemap, 0);
229229
230230   /* create the interrupt timer */
231   state->interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
231   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
232232}
233233
234234
src/mame/video/midyunit.c
r10315r10316
541541   }
542542
543543   /* signal we're done */
544   timer_set(space->machine, attotime::from_nsec(41 * dma_state.width * dma_state.height), NULL, 0, dma_callback);
544   space->machine->scheduler().timer_set(attotime::from_nsec(41 * dma_state.width * dma_state.height), FUNC(dma_callback));
545545
546546   g_profiler.stop();
547547}
r10315r10316
580580   /* if this is the last update of the screen, set a timer to clear out the final line */
581581   /* (since we update one behind) */
582582   if (scanline == screen.visible_area().max_y)
583      timer_set(screen.machine, screen.time_until_pos(scanline + 1, 0), NULL, params->rowaddr, autoerase_line);
583      screen.machine->scheduler().timer_set(screen.time_until_pos(scanline + 1), FUNC(autoerase_line), params->rowaddr);
584584}
src/mame/video/nbmj9195.c
r10315r10316
387387   nb19010_busyflag = 0;
388388
389389   /* 1650ns per count */
390   timer_set(machine, attotime::from_nsec(nb19010_busyctr * 1650), NULL, 0, blitter_timer_callback);
390   machine->scheduler().timer_set(attotime::from_nsec(nb19010_busyctr * 1650), FUNC(blitter_timer_callback));
391391}
392392
393393/******************************************************************************
src/mame/video/artmagic.c
r10315r10316
308308   g_profiler.stop();
309309
310310#if (!INSTANT_BLIT)
311   blitter_busy_until = timer_get_time(machine) + attotime::from_nsec(w*h*20);
311   blitter_busy_until = machine->time() + attotime::from_nsec(w*h*20);
312312#endif
313313}
314314
r10315r10316
322322    */
323323   UINT16 result = 0xffef | (blitter_page << 4);
324324#if (!INSTANT_BLIT)
325   if (timer_get_time(space->machine) < blitter_busy_until)
325   if (space->machine->time() < blitter_busy_until)
326326      result ^= 6;
327327#endif
328328   return result;
src/mame/video/midtunit.c
r10315r10316
787787
788788   /* signal we're done */
789789skipdma:
790   timer_set(space->machine, attotime::from_nsec(41 * pixels), NULL, 0, dma_callback);
790   space->machine->scheduler().timer_set(attotime::from_nsec(41 * pixels), FUNC(dma_callback));
791791
792792   g_profiler.stop();
793793}
src/mame/video/niyanpai.c
r10315r10316
347347   }
348348
349349   nb19010_busyflag = 0;
350   timer_set(machine, attotime::from_nsec(1650 * nb19010_busyctr), NULL, 0, blitter_timer_callback);
350   machine->scheduler().timer_set(attotime::from_nsec(1650 * nb19010_busyctr), FUNC(blitter_timer_callback));
351351}
352352
353353/******************************************************************************
src/mame/video/itech32.c
r10315r10316
232232   /* reset statics */
233233   memset(itech32_video, 0, 0x80);
234234
235   scanline_timer = timer_alloc(machine, scanline_interrupt, NULL);
235   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_interrupt));
236236   enable_latch[0] = 1;
237237   enable_latch[1] = (itech32_planes > 1) ? 1 : 0;
238238
src/mame/video/dkong.c
r10315r10316
944944
945945   VIDEO_START_CALL(dkong_base);
946946
947   state->scanline_timer = timer_alloc(machine, scanline_callback, NULL);
947   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
948948   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
949949
950950   switch (state->hardware_type)
src/mame/video/atarimo.c
r10315r10316
440440   init_gfxelement(mo, desc->gfxindex);
441441
442442   /* start a timer to update a few times during refresh */
443   force_update_timer = timer_alloc(machine, force_update, NULL);
443   force_update_timer = machine->scheduler().timer_alloc(FUNC(force_update));
444444   timer_adjust_oneshot(force_update_timer,machine->primary_screen->time_until_pos(0), 0);
445445
446446   init_savestate(machine, map, mo);
src/mame/video/tank8.c
r10315r10316
284284               index |= 0x80; /* collision on right side */
285285         }
286286
287         timer_set(machine, machine->primary_screen->time_until_pos(y, x), NULL, index, tank8_collision_callback);
287         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(y, x), FUNC(tank8_collision_callback), index);
288288
289289         _state = 1;
290290      }
src/mame/video/lethalj.c
r10315r10316
165165      else
166166         do_blit();
167167
168      timer_set(space->machine, attotime::from_hz(XTAL_32MHz) * ((blitter_data[5] + 1) * (blitter_data[7] + 1)), NULL, 0, gen_ext1_int);
168      space->machine->scheduler().timer_set(attotime::from_hz(XTAL_32MHz) * ((blitter_data[5] + 1) * (blitter_data[7] + 1)), FUNC(gen_ext1_int));
169169   }
170170
171171   /* clear the IRQ on offset 0 */
src/mame/video/itech8.c
r10315r10316
523523      blit_in_progress = 1;
524524
525525      /* set a timer to go off when we're done */
526      timer_set(space->machine, attotime::from_hz(12000000/4) * (BLITTER_WIDTH * BLITTER_HEIGHT + 12), NULL, 0, blitter_done);
526      space->machine->scheduler().timer_set(attotime::from_hz(12000000/4) * (BLITTER_WIDTH * BLITTER_HEIGHT + 12), FUNC(blitter_done));
527527   }
528528
529529   /* debugging */
src/mame/video/leland.c
r10315r10316
8383   leland_video_ram = auto_alloc_array_clear(machine, UINT8, VRAM_SIZE);
8484
8585   /* scanline timer */
86   scanline_timer = timer_alloc(machine, scanline_callback, NULL);
86   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
8787   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(0), 0);
8888
8989}
r10315r10316
318318
319319WRITE8_HANDLER( leland_mvram_port_w )
320320{
321   timer_call_after_resynch(space->machine, NULL, 0x00000 | (offset << 8) | data, leland_delayed_mvram_w);
321   space->machine->scheduler().synchronize(FUNC(leland_delayed_mvram_w), 0x00000 | (offset << 8) | data);
322322}
323323
324324
r10315r10316
363363WRITE8_HANDLER( ataxx_mvram_port_w )
364364{
365365   offset = ((offset >> 1) & 0x07) | ((offset << 3) & 0x08) | (offset & 0x10);
366   timer_call_after_resynch(space->machine, NULL, 0x00000 | (offset << 8) | data, leland_delayed_mvram_w);
366   space->machine->scheduler().synchronize(FUNC(leland_delayed_mvram_w), 0x00000 | (offset << 8) | data);
367367}
368368
369369
src/mame/video/segag80r.c
r10315r10316
5252   /* set a timer to mimic the 555 timer that drives the EDGINT signal */
5353   /* the 555 is run in monostable mode with R=56000 and C=1000pF */
5454   vblank_latch = 1;
55   timer_set(machine, PERIOD_OF_555_MONOSTABLE(CAP_P(1000), RES_K(56)), NULL, 0, vblank_latch_clear);
55   machine->scheduler().timer_set(PERIOD_OF_555_MONOSTABLE(CAP_P(1000), RES_K(56)), FUNC(vblank_latch_clear));
5656
5757   /* latch the current flip state at the same time */
5858   video_flip = video_control & 1;
src/mame/video/dc.c
r10315r10316
13991399      /* FIXME: timing of these */
14001400      switch (state_ta.tafifo_listtype)
14011401      {
1402      case 0: timer_set(machine, attotime::from_usec(100), NULL, 0, transfer_opaque_list_irq); break;
1403      case 1: timer_set(machine, attotime::from_usec(100), NULL, 0, transfer_opaque_modifier_volume_list_irq); break;
1404      case 2: timer_set(machine, attotime::from_usec(100), NULL, 0, transfer_translucent_list_irq); break;
1405      case 3: timer_set(machine, attotime::from_usec(100), NULL, 0, transfer_translucent_modifier_volume_list_irq); break;
1406      case 4: timer_set(machine, attotime::from_usec(100), NULL, 0, transfer_punch_through_list_irq); break;
1402      case 0: machine->scheduler().timer_set(attotime::from_usec(100), FUNC(transfer_opaque_list_irq)); break;
1403      case 1: machine->scheduler().timer_set(attotime::from_usec(100), FUNC(transfer_opaque_modifier_volume_list_irq)); break;
1404      case 2: machine->scheduler().timer_set(attotime::from_usec(100), FUNC(transfer_translucent_list_irq)); break;
1405      case 3: machine->scheduler().timer_set(attotime::from_usec(100), FUNC(transfer_translucent_modifier_volume_list_irq)); break;
1406      case 4: machine->scheduler().timer_set(attotime::from_usec(100), FUNC(transfer_punch_through_list_irq)); break;
14071407      }
14081408      state_ta.tafifo_listtype= -1; // no list being received
14091409      state_ta.listtype_used |= (2+8);
r10315r10316
25512551
25522552   computedilated();
25532553
2554   vbout_timer = timer_alloc(machine, vbout, 0);
2554   vbout_timer = machine->scheduler().timer_alloc(FUNC(vbout));
25552555   timer_adjust_oneshot(vbout_timer, machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num), 0);
25562556
2557   vbin_timer = timer_alloc(machine, vbin, 0);
2557   vbin_timer = machine->scheduler().timer_alloc(FUNC(vbin));
25582558   timer_adjust_oneshot(vbin_timer, machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num), 0);
25592559
2560   hbin_timer = timer_alloc(machine, hbin, 0);
2560   hbin_timer = machine->scheduler().timer_alloc(FUNC(hbin));
25612561   timer_adjust_oneshot(hbin_timer, machine->primary_screen->time_until_pos(0, spg_hblank_in_irq-1), 0);
25622562
25632563   scanline = 0;
25642564   next_y = 0;
25652565
2566   endofrender_timer_isp = timer_alloc(machine, endofrender_isp, 0);
2567   endofrender_timer_tsp = timer_alloc(machine, endofrender_tsp, 0);
2568   endofrender_timer_video = timer_alloc(machine, endofrender_video, 0);
2566   endofrender_timer_isp = machine->scheduler().timer_alloc(FUNC(endofrender_isp));
2567   endofrender_timer_tsp = machine->scheduler().timer_alloc(FUNC(endofrender_tsp));
2568   endofrender_timer_video = machine->scheduler().timer_alloc(FUNC(endofrender_video));
25692569
25702570   timer_adjust_oneshot(endofrender_timer_isp, attotime::never, 0);
25712571   timer_adjust_oneshot(endofrender_timer_tsp, attotime::never, 0);
src/mame/video/segaic16.c
r10315r10316
10951095   }
10961096
10971097   /* set a timer to do this again next frame */
1098   timer_set(machine, machine->primary_screen->time_until_pos(261), NULL, param, segaic16_tilemap_16b_latch_values);
1098   info->latch_timer->adjust(machine->primary_screen->time_until_pos(261), param);
10991099}
11001100
11011101
11021102static void segaic16_tilemap_16b_reset(running_machine *machine, struct tilemap_info *info)
11031103{
11041104   /* set a timer to latch values on scanline 261 */
1105   timer_set(machine, machine->primary_screen->time_until_pos(261), NULL, info->index, segaic16_tilemap_16b_latch_values);
1105   info->latch_timer->adjust(machine->primary_screen->time_until_pos(261), info->index);
11061106}
11071107
11081108
r10315r10316
11511151         info->numpages = 4;
11521152         info->draw_layer = segaic16_tilemap_16a_draw_layer;
11531153         info->reset = NULL;
1154         info->latch_timer = NULL;
11541155         break;
11551156
11561157      case SEGAIC16_TILEMAP_16A:
r10315r10316
11591160         info->numpages = 8;
11601161         info->draw_layer = segaic16_tilemap_16a_draw_layer;
11611162         info->reset = NULL;
1163         info->latch_timer = NULL;
11621164         break;
11631165
11641166      case SEGAIC16_TILEMAP_16B:
r10315r10316
11671169         info->numpages = 16;
11681170         info->draw_layer = segaic16_tilemap_16b_draw_layer;
11691171         info->reset = segaic16_tilemap_16b_reset;
1172         info->latch_timer = machine->scheduler().timer_alloc(FUNC(segaic16_tilemap_16b_latch_values));
11701173         break;
11711174
11721175      case SEGAIC16_TILEMAP_16B_ALT:
r10315r10316
11751178         info->numpages = 16;
11761179         info->draw_layer = segaic16_tilemap_16b_draw_layer;
11771180         info->reset = segaic16_tilemap_16b_reset;
1181         info->latch_timer = machine->scheduler().timer_alloc(FUNC(segaic16_tilemap_16b_latch_values));
11781182         break;
11791183
11801184      default:
src/mame/video/midzeus2.c
r10315r10316
280280   texel_width = 256;
281281   zeus_renderbase = waveram[1];
282282
283   int_timer = timer_alloc(machine, int_timer_callback, NULL);
283   int_timer = machine->scheduler().timer_alloc(FUNC(int_timer_callback));
284284
285285   /* save states */
286286   state_save_register_global_pointer(machine, waveram[0], WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8 / sizeof(waveram[0][0]));
src/mame/video/segaic16.h
r10315r10316
121121   void         (*draw_layer)(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, int which, int flags, int priority);
122122   UINT16 *      textram;                  /* pointer to textram pointer */
123123   UINT16 *      tileram;                  /* pointer to tileram pointer */
124   emu_timer *      latch_timer;               /* timer for latching 16b tilemap scroll values */
124125};
125126
126127struct road_info
src/mame/video/gameplan.c
r10315r10316
203203         /* set a timer for an arbitrarily short period.
204204               The real time it takes to clear to screen is not
205205               important to the software */
206         timer_call_after_resynch(device->machine, NULL, 0, clear_screen_done_callback);
206         device->machine->scheduler().synchronize(FUNC(clear_screen_done_callback));
207207
208208         break;
209209      }
r10315r10316
223223   /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is
224224       cleared by the irq handler. Therefore, I wait a bit before triggering the irq to
225225       leave time for the program to see the flag change. */
226   timer_set(device->machine, attotime::from_usec(50), NULL, state, via_irq_delayed);
226   device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(via_irq_delayed), state);
227227}
228228
229229
r10315r10316
291291   state->videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND);
292292   state->videoram = auto_alloc_array(machine, UINT8, state->videoram_size);
293293
294   state->via_0_ca1_timer = timer_alloc(machine, via_0_ca1_timer_callback, NULL);
294   state->via_0_ca1_timer = machine->scheduler().timer_alloc(FUNC(via_0_ca1_timer_callback));
295295
296296   /* register for save states */
297297   state_save_register_global_pointer(machine, state->videoram, state->videoram_size);
src/mame/video/cchasm.c
r10315r10316
100100      }
101101   }
102102    /* Refresh processor runs with 6 MHz */
103    timer_set (machine, attotime::from_hz(6000000) * total_length, NULL, 0, cchasm_refresh_end);
103    machine->scheduler().timer_set (attotime::from_hz(6000000) * total_length, FUNC(cchasm_refresh_end));
104104}
105105
106106
src/mame/video/pastelg.c
r10315r10316
286286   }
287287
288288   nb1413m3_busyflag = 0;
289   timer_set(machine, attotime::from_hz(400000) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
289   machine->scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
290290}
291291
292292/******************************************************************************
src/mame/video/starfire.c
r10315r10316
2020   starfire_state *state = machine->driver_data<starfire_state>();
2121
2222   state->starfire_screen = machine->primary_screen->alloc_compatible_bitmap();
23   state->scanline_timer = timer_alloc(machine, starfire_scanline_callback, NULL);
23   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(starfire_scanline_callback));
2424   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(STARFIRE_VBEND), STARFIRE_VBEND);
2525
2626    /* register for state saving */
src/mame/video/galaxold.c
r10315r10316
15001500
15011501   galaxold_stars_on = 0;
15021502   stars_blink_state = 0;
1503   stars_blink_timer = timer_alloc(machine, stars_blink_callback, NULL);
1504   stars_scroll_timer = timer_alloc(machine, stars_scroll_callback, NULL);
1503   stars_blink_timer = machine->scheduler().timer_alloc(FUNC(stars_blink_callback));
1504   stars_scroll_timer = machine->scheduler().timer_alloc(FUNC(stars_scroll_callback));
15051505   timer_adjusted = 0;
15061506   stars_colors_start = colors_offset;
15071507
src/mame/video/sprint8.c
r10315r10316
188188
189189      for (x = visarea.min_x; x <= visarea.max_x; x++)
190190         if (p1[x] != 0x20 && p2[x] == 0x23)
191            timer_set(machine, machine->primary_screen->time_until_pos(y + 24, x), NULL,
192                    colortable_entry_get_value(machine->colortable, p1[x]),
193                    sprint8_collision_callback);
191            machine->scheduler().timer_set(machine->primary_screen->time_until_pos(y + 24, x),
192                  FUNC(sprint8_collision_callback),
193                  colortable_entry_get_value(machine->colortable, p1[x]));
194194   }
195195}
src/mame/video/midvunit.c
r10315r10316
6161   {
6262      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
6363      timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(scanline + 1), scanline);
64      timer_set(machine, attotime::from_hz(25000000), NULL, -1, scanline_timer_cb);
64      machine->scheduler().timer_set(attotime::from_hz(25000000), FUNC(scanline_timer_cb), -1);
6565   }
6666   else
6767      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
r10315r10316
7676
7777VIDEO_START( midvunit )
7878{
79   scanline_timer = timer_alloc(machine, scanline_timer_cb, NULL);
79   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_timer_cb));
8080   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
8181   machine->add_notifier(MACHINE_NOTIFY_EXIT, midvunit_exit);
8282
src/mame/video/atarisy2.c
r10315r10316
110110   tilemap_set_transparent_pen(state->alpha_tilemap, 0);
111111
112112   /* reset the statics */
113   state->yscroll_reset_timer = timer_alloc(machine, reset_yscroll_callback, NULL);
113   state->yscroll_reset_timer = machine->scheduler().timer_alloc(FUNC(reset_yscroll_callback));
114114   state->videobank = 0;
115115
116116   /* save states */
src/mame/video/jaguar.c
r10315r10316
628628   if (offset == B_CMD)
629629   {
630630      blitter_status = 0;
631      timer_set(space->machine, attotime::from_usec(100), NULL, 0, blitter_done);
631      space->machine->scheduler().timer_set(attotime::from_usec(100), FUNC(blitter_done));
632632      blitter_run(space->machine);
633633   }
634634
r10315r10316
688688   if (gpu_regs[PIT0])
689689   {
690690      sample_period = attotime::from_nsec(((machine->device("gpu")->unscaled_clock()*PIT_MULT_DBG_HACK) / (1+gpu_regs[PIT0])) / (1+gpu_regs[PIT1]));
691      timer_set(machine, sample_period, NULL, 0, jaguar_pit);
691      machine->scheduler().timer_set(sample_period, FUNC(jaguar_pit));
692692   }
693693}
694694
r10315r10316
713713            if (gpu_regs[PIT0] && gpu_regs[PIT0] != 0xffff) //FIXME: avoid too much small timers for now
714714            {
715715               sample_period = attotime::from_nsec(((space->machine->device("gpu")->unscaled_clock()*PIT_MULT_DBG_HACK) / (1+gpu_regs[PIT0])) / (1+gpu_regs[PIT1]));
716               timer_set(space->machine, sample_period, NULL, 0, jaguar_pit);
716               space->machine->scheduler().timer_set(sample_period, FUNC(jaguar_pit));
717717            }
718718            break;
719719
r10315r10316
902902   memset(&gpu_regs, 0, sizeof(gpu_regs));
903903   cpu_irq_state = 0;
904904
905   object_timer = timer_alloc(machine, cojag_scanline_update, NULL);
905   object_timer = machine->scheduler().timer_alloc(FUNC(cojag_scanline_update));
906906   adjust_object_timer(machine, 0);
907907
908908   screen_bitmap = auto_bitmap_alloc(machine, 760, 512, BITMAP_FORMAT_RGB32);
src/mame/video/n8080.c
r10315r10316
9393{
9494   n8080_state *state = machine->driver_data<n8080_state>();
9595
96   state->cannon_timer = timer_alloc(machine, spacefev_stop_red_cannon, NULL);
96   state->cannon_timer = machine->scheduler().timer_alloc(FUNC(spacefev_stop_red_cannon));
9797
9898   flip_screen_set_no_update(machine, 0);
9999
src/mame/video/nbmj8891.c
r10315r10316
486486   }
487487
488488   nb1413m3_busyflag = 0;
489   timer_set(machine, attotime::from_hz(400000) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
489   machine->scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
490490}
491491
492492/******************************************************************************
src/mame/video/astrocde.c
r10315r10316
222222VIDEO_START( astrocde )
223223{
224224   /* allocate a per-scanline timer */
225   scanline_timer = timer_alloc(machine, scanline_callback, NULL);
225   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
226226   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(1), 1);
227227
228228   /* register for save states */
r10315r10316
237237VIDEO_START( profpac )
238238{
239239   /* allocate a per-scanline timer */
240   scanline_timer = timer_alloc(machine, scanline_callback, NULL);
240   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
241241   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(1), 1);
242242
243243   /* allocate videoram */
r10315r10316
443443      if ((interrupt_enable & 0x01) == 0)
444444      {
445445         cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, interrupt_vector & 0xf0);
446         timer_set(machine, machine->primary_screen->time_until_pos(vfeedback), NULL, 0, interrupt_off);
446         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(vfeedback), FUNC(interrupt_off));
447447      }
448448
449449      /* mode 1 means assert for 1 instruction */
450450      else
451451      {
452452         cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, interrupt_vector & 0xf0);
453         timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), NULL, 0, interrupt_off);
453         machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(interrupt_off));
454454      }
455455
456456      /* latch the feedback registers */
r10315r10316
483483      if ((interrupt_enable & 0x04) == 0)
484484      {
485485         cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, interrupt_vector);
486         timer_set(machine, machine->primary_screen->time_until_vblank_end(), NULL, 0, interrupt_off);
486         machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_end(), FUNC(interrupt_off));
487487      }
488488
489489      /* mode 1 means assert for 1 instruction */
490490      else
491491      {
492492         cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, interrupt_vector);
493         timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), NULL, 0, interrupt_off);
493         machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(interrupt_off));
494494      }
495495   }
496496
src/mame/video/nbmj8688.c
r10315r10316
548548   nb1413m3_busyflag = 0;
549549
550550   if (gfxtype == GFXTYPE_8BIT)
551      timer_set(machine, attotime::from_hz(400000) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
551      machine->scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
552552   else
553      timer_set(machine, attotime::from_hz(400000) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
553      machine->scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
554554}
555555
556556
src/mame/video/victory.c
r10315r10316
8686   scrollx = scrolly = 0;
8787   video_control = 0;
8888   memset(&micro, 0, sizeof(micro));
89   micro.timer = timer_alloc(machine, NULL, NULL);
89   micro.timer = machine->scheduler().timer_alloc(FUNC(NULL));
9090
9191   /* register for state saving */
9292   state_save_register_global_array(machine, victory_paletteram);
r10315r10316
11251125         int bpix = bg[(x + scrollx) & 255];
11261126         scanline[x] = bpix | (fpix << 3);
11271127         if (fpix && (bpix & bgcollmask) && count++ < 128)
1128            timer_set(screen->machine, screen->time_until_pos(y, x), NULL, x | (y << 8), bgcoll_irq_callback);
1128            screen->machine->scheduler().timer_set(screen->time_until_pos(y, x), FUNC(bgcoll_irq_callback), x | (y << 8));
11291129      }
11301130   }
11311131
src/mame/video/avgdvg.c
r10315r10316
15041504
15051505   flip_x = flip_y = 0;
15061506
1507   vg_halt_timer = timer_alloc(machine, vg_set_halt_callback, NULL);
1508   vg_run_timer = timer_alloc(machine, run_state_machine, NULL);
1507   vg_halt_timer = machine->scheduler().timer_alloc(FUNC(vg_set_halt_callback));
1508   vg_run_timer = machine->scheduler().timer_alloc(FUNC(run_state_machine));
15091509
15101510   /*
15111511     * The x and y DACs use 10 bit of the counter values which are in
r10315r10316
15301530   xmin = visarea.min_x;
15311531   ymin = visarea.min_y;
15321532
1533   vg_halt_timer = timer_alloc(machine, vg_set_halt_callback, NULL);
1534   vg_run_timer = timer_alloc(machine, run_state_machine, NULL);
1533   vg_halt_timer = machine->scheduler().timer_alloc(FUNC(vg_set_halt_callback));
1534   vg_run_timer = machine->scheduler().timer_alloc(FUNC(run_state_machine));
15351535
15361536   register_state (machine);
15371537
src/mame/video/esripsys.c
r10315r10316
104104   line_buffer[1].priority_buf = auto_alloc_array(machine, UINT8, 512);
105105
106106   /* Create and initialise the HBLANK timers */
107   hblank_start_timer = timer_alloc(machine, hblank_start_callback, NULL);
108   hblank_end_timer = timer_alloc(machine, hblank_end_callback, NULL);
107   hblank_start_timer = machine->scheduler().timer_alloc(FUNC(hblank_start_callback));
108   hblank_end_timer = machine->scheduler().timer_alloc(FUNC(hblank_end_callback));
109109   timer_adjust_oneshot(hblank_start_timer, machine->primary_screen->time_until_pos(0, ESRIPSYS_HBLANK_START), 0);
110110
111111   /* Create the sprite scaling table */
src/mame/video/nbmj8991.c
r10315r10316
294294   }
295295
296296   nb1413m3_busyflag = 0;
297   timer_set(machine, attotime::from_nsec(1650) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
297   machine->scheduler().timer_set(attotime::from_nsec(1650) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
298298}
299299
300300/******************************************************************************
src/mame/video/exidy440.c
r10315r10316
374374
375375                  /* check the collisions bit */
376376                  if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128))
377                     timer_set(screen.machine, screen.time_until_pos(yoffs, currx), NULL, currx, collide_firq_callback);
377                     screen.machine->scheduler().timer_set(screen.time_until_pos(yoffs, currx), FUNC(collide_firq_callback), currx);
378378               }
379379               currx++;
380380
r10315r10316
387387
388388                  /* check the collisions bit */
389389                  if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128))
390                     timer_set(screen.machine, screen.time_until_pos(yoffs, currx), NULL, currx, collide_firq_callback);
390                     screen.machine->scheduler().timer_set(screen.time_until_pos(yoffs, currx), FUNC(collide_firq_callback), currx);
391391               }
392392               currx++;
393393            }
r10315r10316
458458      attotime time = screen->time_until_pos(beamy, beamx) - increment * 6;
459459      for (i = 0; i <= 12; i++)
460460      {
461         timer_set(screen->machine, time, NULL, beamx, beam_firq_callback);
461         screen->machine->scheduler().timer_set(time, FUNC(beam_firq_callback), beamx);
462462         time += increment;
463463      }
464464   }
src/mame/video/tx1.c
r10315r10316
11281128   tx1_rod_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240);
11291129
11301130   /* Set a timer to run the interrupts */
1131   interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
1131   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
11321132
11331133   /* /CUDISP CRTC interrupt */
11341134   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
r10315r10316
30473047   bb_rod_bmp = auto_alloc_array(machine, UINT8, 3 * 256 * 240);
30483048
30493049   /* Set a timer to run the interrupts */
3050   interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
3050   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
30513051
30523052   /* /CUDISP CRTC interrupt */
30533053   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
r10315r10316
30613061   bb_rod_bmp = auto_alloc_array(machine, UINT8, 256 * 240);
30623062
30633063   /* Set a timer to run the interrupts */
3064   interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
3064   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
30653065
30663066   /* /CUDISP CRTC interrupt */
30673067   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
src/mame/video/blstroid.c
r10315r10316
130130         period_on  = screen.time_until_pos(vpos + 7, width * 0.9);
131131         period_off = screen.time_until_pos(vpos + 8, width * 0.9);
132132
133         timer_set(screen.machine, period_on, NULL,  0, irq_on);
134         timer_set(screen.machine, period_off, NULL, 0, irq_off);
133         screen.machine->scheduler().timer_set(period_on, FUNC(irq_on));
134         screen.machine->scheduler().timer_set(period_off, FUNC(irq_off));
135135      }
136136}
137137
src/mame/video/nbmj8900.c
r10315r10316
376376   }
377377
378378   nb1413m3_busyflag = 0;
379   timer_set(machine, attotime::from_nsec(2500) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
379   machine->scheduler().timer_set(attotime::from_nsec(2500) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
380380}
381381
382382/******************************************************************************
src/mame/video/dday.c
r10315r10316
3939
4040   state->timer_value = 0;
4141
42   timer_pulse(machine, attotime::from_seconds(1), NULL, 0, countdown_timer_callback);
42   machine->scheduler().timer_pulse(attotime::from_seconds(1), FUNC(countdown_timer_callback));
4343}
4444
4545
src/mame/video/lockon.c
r10315r10316
918918   state->obj_pal_ram = auto_alloc_array(machine, UINT8, 2048);
919919
920920   /* Timer for ground display list callback */
921   state->bufend_timer = timer_alloc(machine, bufend_callback, NULL);
921   state->bufend_timer = machine->scheduler().timer_alloc(FUNC(bufend_callback));
922922
923923   /* Timer for the CRTC cursor pulse */
924   state->cursor_timer = timer_alloc(machine, cursor_callback, NULL);
924   state->cursor_timer = machine->scheduler().timer_alloc(FUNC(cursor_callback));
925925   timer_adjust_oneshot(state->cursor_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
926926
927927   state_save_register_global_bitmap(machine, state->back_buffer);
src/mame/video/atari.c
r10315r10316
10511051   return machine->primary_screen->hpos() * CYCLES_PER_LINE / machine->primary_screen->width();
10521052}
10531053
1054static void after(running_machine *machine, int cycles, timer_fired_func function, const char *funcname)
1054static void after(running_machine *machine, int cycles, timer_expired_func function, const char *funcname)
10551055{
10561056    attotime duration = machine->primary_screen->scan_period() * cycles / CYCLES_PER_LINE;
10571057    (void)funcname;
10581058   LOG(("           after %3d (%5.1f us) %s\n", cycles, duration.as_double() * 1.0e6, funcname));
1059   timer_set(machine, duration, NULL, 0, function);
1059   machine->scheduler().timer_set(duration, function, funcname);
10601060}
10611061
10621062static TIMER_CALLBACK( antic_issue_dli )
r10315r10316
11581158static TIMER_CALLBACK( antic_steal_cycles )
11591159{
11601160   LOG(("           @cycle #%3d steal %d cycles\n", cycle(machine), antic.steal_cycles));
1161   after(machine, antic.steal_cycles, antic_line_done, "antic_line_done");
1161   after(machine, antic.steal_cycles, FUNC(antic_line_done));
11621162    antic.steal_cycles = 0;
11631163   cpu_spinuntil_trigger( machine->device("maincpu"), TRIGGER_STEAL );
11641164}
r10315r10316
12291229
12301230    antic.steal_cycles += CYCLES_REFRESH;
12311231   LOG(("           run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles));
1232   after(machine, CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles, antic_steal_cycles, "antic_steal_cycles");
1232   after(machine, CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles, FUNC(antic_steal_cycles));
12331233}
12341234
12351235
r10315r10316
13411341               {
13421342                  /* remove the DLI bit */
13431343                  new_cmd &= ~ANTIC_DLI;
1344                  after(machine, CYCLES_DLI_NMI, antic_issue_dli, "antic_issue_dli");
1344                  after(machine, CYCLES_DLI_NMI, FUNC(antic_issue_dli));
13451345               }
13461346               /* load memory scan bit set ? */
13471347               if( new_cmd & ANTIC_LMS )
r10315r10316
14731473
14741474   antic.r.nmist &= ~DLI_NMI;
14751475   if( antic.modelines == 1 && (antic.cmd & antic.w.nmien & DLI_NMI) )
1476      after(machine, CYCLES_DLI_NMI, antic_issue_dli, "antic_issue_dli");
1476      after(machine, CYCLES_DLI_NMI, FUNC(antic_issue_dli));
14771477
1478   after(machine, CYCLES_HSTART, antic_scanline_render, "antic_scanline_render");
1478   after(machine, CYCLES_HSTART, FUNC(antic_scanline_render));
14791479}
14801480
14811481/*****************************************************************************
src/mame/video/segas32.c
r10315r10316
373373{
374374   /* at the end of VBLANK is when automatic sprite rendering happens */
375375   if (!state)
376      timer_set(machine, attotime::from_usec(50), NULL, 1, update_sprites);
376      machine->scheduler().timer_set(attotime::from_usec(50), FUNC(update_sprites), 1);
377377}
378378
379379
src/mame/video/fromance.c
r10315r10316
7070   tilemap_set_transparent_pen(state->fg_tilemap, 15);
7171
7272   /* reset the timer */
73   state->crtc_timer = timer_alloc(machine, crtc_interrupt_gen, NULL);
73   state->crtc_timer = machine->scheduler().timer_alloc(FUNC(crtc_interrupt_gen));
7474
7575   /* state save */
7676   state_save_register_global(machine, state->selected_videoram);
src/mame/video/neogeo.c
r10315r10316
243243static void create_auto_animation_timer( running_machine *machine )
244244{
245245   neogeo_state *state = machine->driver_data<neogeo_state>();
246   state->auto_animation_timer = timer_alloc(machine, auto_animation_timer_callback, NULL);
246   state->auto_animation_timer = machine->scheduler().timer_alloc(FUNC(auto_animation_timer_callback));
247247}
248248
249249
r10315r10316
664664static void create_sprite_line_timer( running_machine *machine )
665665{
666666   neogeo_state *state = machine->driver_data<neogeo_state>();
667   state->sprite_line_timer = timer_alloc(machine, sprite_line_timer_callback, NULL);
667   state->sprite_line_timer = machine->scheduler().timer_alloc(FUNC(sprite_line_timer_callback));
668668}
669669
670670
src/mame/video/ppu2c0x.c
r10315r10316
13011301      ppu2c0x->security_value = 0x1b;
13021302
13031303   /* initialize the scanline handling portion */
1304   ppu2c0x->scanline_timer = timer_alloc(device->machine, scanline_callback, (void *) device);
1304   ppu2c0x->scanline_timer = device->machine->scheduler().timer_alloc(FUNC(scanline_callback), (void *) device);
13051305   timer_adjust_oneshot(ppu2c0x->scanline_timer, device->machine->primary_screen->time_until_pos(1), 0);
13061306
1307   ppu2c0x->hblank_timer = timer_alloc(device->machine, hblank_callback, (void *) device);
1307   ppu2c0x->hblank_timer = device->machine->scheduler().timer_alloc(FUNC(hblank_callback), (void *) device);
13081308   timer_adjust_oneshot(ppu2c0x->hblank_timer, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(86.67), 0); // ??? FIXME - hardcoding NTSC, need better calculation
13091309
1310   ppu2c0x->nmi_timer = timer_alloc(device->machine, nmi_callback, (void *) device);
1310   ppu2c0x->nmi_timer = device->machine->scheduler().timer_alloc(FUNC(nmi_callback), (void *) device);
13111311   timer_adjust_oneshot(ppu2c0x->nmi_timer, attotime::never, 0);
13121312
13131313   ppu2c0x->nmi_callback_proc = intf->nmi_handler;
src/mame/video/tubep.c
r10315r10316
590590         cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
591591
592592         /* 2.assert /SINT again after this time */
593         timer_set( space->machine, attotime::from_hz(19968000/8) * ((XSize+1)*(YSize+1)), NULL, 0, sprite_timer_callback);
593         space->machine->scheduler().timer_set( attotime::from_hz(19968000/8) * ((XSize+1)*(YSize+1)), FUNC(sprite_timer_callback));
594594
595595         /* 3.clear of /SINT starts sprite drawing circuit */
596596         draw_sprite(space->machine);
src/mame/video/exidy.c
r10315r10316
361361
362362            /* if we got one, trigger an interrupt */
363363            if ((current_collision_mask & collision_mask) && (count++ < 128))
364               timer_set(machine, machine->primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), NULL, current_collision_mask, collision_irq_callback);
364               machine->scheduler().timer_set(machine->primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), FUNC(collision_irq_callback), current_collision_mask);
365365         }
366366
367367         if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != 0xff)
r10315r10316
369369            /* check for background collision (M2CHAR) */
370370            if (*BITMAP_ADDR16(background_bitmap, org_2_y + sy, org_2_x + sx) != 0)
371371               if ((collision_mask & 0x08) && (count++ < 128))
372                  timer_set(machine, machine->primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), NULL, 0x08, collision_irq_callback);
372                  machine->scheduler().timer_set(machine->primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), FUNC(collision_irq_callback), 0x08);
373373         }
374374      }
375375}
src/mame/video/hyhoo.c
r10315r10316
228228   }
229229
230230   nb1413m3_busyflag = 0;
231   timer_set(machine, attotime::from_hz(400000) * nb1413m3_busyctr, NULL, 0, blitter_timer_callback);
231   machine->scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, FUNC(blitter_timer_callback));
232232}
233233
234234
src/mame/video/m92.c
r10315r10316
7979      /* Pixel clock is 26.6666 MHz, we have 0x800 bytes, or 0x400 words
8080           to copy from spriteram to the buffer.  It seems safe to assume 1
8181           word can be copied per clock.*/
82      timer_set(space->machine, attotime::from_hz(26666000) * 0x400, NULL, 0, spritebuffer_callback);
82      space->machine->scheduler().timer_set(attotime::from_hz(26666000) * 0x400, FUNC(spritebuffer_callback));
8383   }
8484//  logerror("%04x: m92_spritecontrol_w %08x %08x\n",cpu_get_pc(space->cpu),offset,data);
8585}
src/mame/video/twin16.c
r10315r10316
504504
505505   memset(twin16_sprite_buffer,0xff,0x800*sizeof(UINT16));
506506   twin16_sprite_busy = 0;
507   twin16_sprite_timer = timer_alloc(machine, twin16_sprite_tick, NULL);
507   twin16_sprite_timer = machine->scheduler().timer_alloc(FUNC(twin16_sprite_tick));
508508   timer_adjust_oneshot(twin16_sprite_timer, attotime::never, 0);
509509
510510   /* register for savestates */
src/mame/video/dcheese.c
r10315r10316
9898   state->dstbitmap = auto_bitmap_alloc(machine, DSTBITMAP_WIDTH, DSTBITMAP_HEIGHT, machine->primary_screen->format());
9999
100100   /* create a timer */
101   state->blitter_timer = timer_alloc(machine, blitter_scanline_callback, NULL);
101   state->blitter_timer = machine->scheduler().timer_alloc(FUNC(blitter_scanline_callback));
102102
103103   /* register for saving */
104104   state_save_register_global_array(machine, state->blitter_color);
r10315r10316
151151      memset(BITMAP_ADDR16(state->dstbitmap, y % DSTBITMAP_HEIGHT, 0), 0, DSTBITMAP_WIDTH * 2);
152152
153153   /* signal an IRQ when done (timing is just a guess) */
154   timer_set(machine, machine->primary_screen->scan_period(), NULL, 1, dcheese_signal_irq_callback);
154   machine->scheduler().timer_set(machine->primary_screen->scan_period(), FUNC(dcheese_signal_irq_callback), 1);
155155}
156156
157157
r10315r10316
206206   }
207207
208208   /* signal an IRQ when done (timing is just a guess) */
209   timer_set(machine, machine->primary_screen->scan_period() / 2, NULL, 2, dcheese_signal_irq_callback);
209   machine->scheduler().timer_set(machine->primary_screen->scan_period() / 2, FUNC(dcheese_signal_irq_callback), 2);
210210
211211   /* these extra parameters are written but they are always zero, so I don't know what they do */
212212   if (state->blitter_xparam[8] != 0 || state->blitter_xparam[9] != 0 || state->blitter_xparam[10] != 0 || state->blitter_xparam[11] != 0 ||
src/mame/video/cave.c
r10315r10316
17621762
17631763static STATE_POSTLOAD( cave_sprite_postload )
17641764{
1765   /* FIXME: this is probably not enough to restore sprites, but anyway saves do not
1766    currently work due to pending timers hence it is hard to test what is missing */
1765   /* FIXME: this is probably not the best way to restore the sprites,
1766   but it seems to work more or less (sprites may be wrong for one frame) */
17671767   cave_get_sprite_info(machine);
17681768}
src/mame/video/rpunch.c
r10315r10316
100100      memset(rpunch_bitmapram, 0xff, rpunch_bitmapram_size);
101101
102102   /* reset the timer */
103   crtc_timer = timer_alloc(machine, crtc_interrupt_gen, NULL);
103   crtc_timer = machine->scheduler().timer_alloc(FUNC(crtc_interrupt_gen));
104104}
105105
106106
src/mame/video/changela.c
r10315r10316
2929   state->tree0_bitmap = machine->primary_screen->alloc_compatible_bitmap();
3030   state->tree1_bitmap = machine->primary_screen->alloc_compatible_bitmap();
3131
32   state->scanline_timer = timer_alloc(machine, changela_scanline_callback, NULL);
32   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(changela_scanline_callback));
3333   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(30), 30);
3434
3535   state_save_register_global_pointer(machine, state->memory_devices, 4 * 0x800);
src/mame/video/triplhnt.c
r10315r10316
124124   }
125125
126126   if (hit_line != 999 && hit_code != 999)
127      timer_set(machine, machine->primary_screen->time_until_pos(hit_line), NULL, hit_code, triplhnt_hit_callback);
127      machine->scheduler().timer_set(machine->primary_screen->time_until_pos(hit_line), FUNC(triplhnt_hit_callback), hit_code);
128128}
129129
130130
src/mame/layout/mpu4ext.lay
r0r10316
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="digit">
4   <led7seg>
5         <color red="1.0" green="0.0" blue="0.0" />
6   </led7seg>
7   </element>
8   <element name="matrixlamp">
9      <rect state ="0">
10         <bounds x="0" y="0" width="7" height="7" />
11         <color red="0.7" green="0.7" blue="0.7" />
12      </rect>
13      <rect state ="1">
14         <bounds x="0" y="0" width="7" height="7" />
15         <color red="0.0" green="0.0" blue="1.0" />
16      </rect>
17      <rect state ="2">
18         <bounds x="0" y="0" width="7" height="7" />
19         <color red="0.0" green="1.0" blue="0.0" />
20      </rect>
21   </element>
22   <element name="Steppers" defstate="96">
23      <text string="00" state="0">
24         <color red="1.0" green="1.0" blue="1.0" />
25         <bounds x="0" y="0.1" width="1" height="1" />
26      </text>
27      <text string="01" state="1">
28         <color red="1.0" green="1.0" blue="1.0" />
29         <bounds x="0" y="0.1" width="1" height="1" />
30      </text>
31      <text string="02" state="2">
32         <color red="1.0" green="1.0" blue="1.0" />
33         <bounds x="0" y="0.1" width="1" height="1" />
34      </text>
35      <text string="03" state="3">
36         <color red="1.0" green="1.0" blue="1.0" />
37         <bounds x="0" y="0.1" width="1" height="1" />
38      </text>
39      <text string="04" state="4">
40         <color red="1.0" green="1.0" blue="1.0" />
41         <bounds x="0" y="0.1" width="1" height="1" />
42      </text>
43      <text string="05" state="5">
44         <color red="1.0" green="1.0" blue="1.0" />
45         <bounds x="0" y="0.1" width="1" height="1" />
46      </text>
47      <text string="06" state="6">
48         <color red="1.0" green="1.0" blue="1.0" />
49         <bounds x="0" y="0.1" width="1" height="1" />
50      </text>
51      <text string="07" state="7">
52         <color red="1.0" green="1.0" blue="1.0" />
53         <bounds x="0" y="0.1" width="1" height="1" />
54      </text>
55      <text string="08" state="8">
56         <color red="1.0" green="1.0" blue="1.0" />
57         <bounds x="0" y="0.1" width="1" height="1" />
58      </text>
59      <text string="09" state="9">
60         <color red="1.0" green="1.0" blue="1.0" />
61         <bounds x="0" y="0.1" width="1" height="1" />
62      </text>
63      <text string="10" state="10">
64         <color red="1.0" green="1.0" blue="1.0" />
65         <bounds x="0" y="0.1" width="1" height="1" />
66      </text>
67      <text string="11" state="11">
68         <color red="1.0" green="1.0" blue="1.0" />
69         <bounds x="0" y="0.1" width="1" height="1" />
70      </text>
71      <text string="12" state="12">
72         <color red="1.0" green="1.0" blue="1.0" />
73         <bounds x="0" y="0.1" width="1" height="1" />
74      </text>
75      <text string="13" state="13">
76         <color red="1.0" green="1.0" blue="1.0" />
77         <bounds x="0" y="0.1" width="1" height="1" />
78      </text>
79      <text string="14" state="14">
80         <color red="1.0" green="1.0" blue="1.0" />
81         <bounds x="0" y="0.1" width="1" height="1" />
82      </text>
83      <text string="15" state="15">
84         <color red="1.0" green="1.0" blue="1.0" />
85         <bounds x="0" y="0.1" width="1" height="1" />
86      </text>
87      <text string="16" state="16">
88         <color red="1.0" green="1.0" blue="1.0" />
89         <bounds x="0" y="0.1" width="1" height="1" />
90      </text>
91      <text string="17" state="17">
92         <color red="1.0" green="1.0" blue="1.0" />
93         <bounds x="0" y="0.1" width="1" height="1" />
94      </text>
95      <text string="18" state="18">
96         <color red="1.0" green="1.0" blue="1.0" />
97         <bounds x="0" y="0.1" width="1" height="1" />
98      </text>
99      <text string="19" state="19">
100         <color red="1.0" green="1.0" blue="1.0" />
101         <bounds x="0" y="0.1" width="1" height="1" />
102      </text>
103      <text string="20" state="20">
104         <color red="1.0" green="1.0" blue="1.0" />
105         <bounds x="0" y="0.1" width="1" height="1" />
106      </text>
107      <text string="21" state="21">
108         <color red="1.0" green="1.0" blue="1.0" />
109         <bounds x="0" y="0.1" width="1" height="1" />
110      </text>
111      <text string="22" state="22">
112         <color red="1.0" green="1.0" blue="1.0" />
113         <bounds x="0" y="0.1" width="1" height="1" />
114      </text>
115      <text string="23" state="23">
116         <color red="1.0" green="1.0" blue="1.0" />
117         <bounds x="0" y="0.1" width="1" height="1" />
118      </text>
119      <text string="24" state="24">
120         <color red="1.0" green="1.0" blue="1.0" />
121         <bounds x="0" y="0.1" width="1" height="1" />
122      </text>
123      <text string="25" state="25">
124         <color red="1.0" green="1.0" blue="1.0" />
125         <bounds x="0" y="0.1" width="1" height="1" />
126      </text>
127      <text string="26" state="26">
128         <color red="1.0" green="1.0" blue="1.0" />
129         <bounds x="0" y="0.1" width="1" height="1" />
130      </text>
131      <text string="27" state="27">
132         <color red="1.0" green="1.0" blue="1.0" />
133         <bounds x="0" y="0.1" width="1" height="1" />
134      </text>
135      <text string="28" state="28">
136         <color red="1.0" green="1.0" blue="1.0" />
137         <bounds x="0" y="0.1" width="1" height="1" />
138      </text>
139      <text string="29" state="29">
140         <color red="1.0" green="1.0" blue="1.0" />
141         <bounds x="0" y="0.1" width="1" height="1" />
142      </text>
143      <text string="30" state="30">
144         <color red="1.0" green="1.0" blue="1.0" />
145         <bounds x="0" y="0.1" width="1" height="1" />
146      </text>
147      <text string="31" state="31">
148         <color red="1.0" green="1.0" blue="1.0" />
149         <bounds x="0" y="0.1" width="1" height="1" />
150      </text>
151      <text string="32" state="32">
152         <color red="1.0" green="1.0" blue="1.0" />
153         <bounds x="0" y="0.1" width="1" height="1" />
154      </text>
155      <text string="33" state="33">
156         <color red="1.0" green="1.0" blue="1.0" />
157         <bounds x="0" y="0.1" width="1" height="1" />
158      </text>
159      <text string="34" state="34">
160         <color red="1.0" green="1.0" blue="1.0" />
161         <bounds x="0" y="0.1" width="1" height="1" />
162      </text>
163      <text string="35" state="35">
164         <color red="1.0" green="1.0" blue="1.0" />
165         <bounds x="0" y="0.1" width="1" height="1" />
166      </text>
167      <text string="36" state="36">
168         <color red="1.0" green="1.0" blue="1.0" />
169         <bounds x="0" y="0.1" width="1" height="1" />
170      </text>
171      <text string="37" state="37">
172         <color red="1.0" green="1.0" blue="1.0" />
173         <bounds x="0" y="0.1" width="1" height="1" />
174      </text>
175      <text string="38" state="38">
176         <color red="1.0" green="1.0" blue="1.0" />
177         <bounds x="0" y="0.1" width="1" height="1" />
178      </text>
179      <text string="39" state="39">
180         <color red="1.0" green="1.0" blue="1.0" />
181         <bounds x="0" y="0.1" width="1" height="1" />
182      </text>
183      <text string="40" state="40">
184         <color red="1.0" green="1.0" blue="1.0" />
185         <bounds x="0" y="0.1" width="1" height="1" />
186      </text>
187      <text string="41" state="41">
188         <color red="1.0" green="1.0" blue="1.0" />
189         <bounds x="0" y="0.1" width="1" height="1" />
190      </text>
191      <text string="42" state="42">
192         <color red="1.0" green="1.0" blue="1.0" />
193         <bounds x="0" y="0.1" width="1" height="1" />
194      </text>
195      <text string="43" state="43">
196         <color red="1.0" green="1.0" blue="1.0" />
197         <bounds x="0" y="0.1" width="1" height="1" />
198      </text>
199      <text string="44" state="44">
200         <color red="1.0" green="1.0" blue="1.0" />
201         <bounds x="0" y="0.1" width="1" height="1" />
202      </text>
203      <text string="45" state="45">
204         <color red="1.0" green="1.0" blue="1.0" />
205         <bounds x="0" y="0.1" width="1" height="1" />
206      </text>
207      <text string="46" state="46">
208         <color red="1.0" green="1.0" blue="1.0" />
209         <bounds x="0" y="0.1" width="1" height="1" />
210      </text>
211      <text string="47" state="47">
212         <color red="1.0" green="1.0" blue="1.0" />
213         <bounds x="0" y="0.1" width="1" height="1" />
214      </text>
215      <text string="48" state="48">
216         <color red="1.0" green="1.0" blue="1.0" />
217         <bounds x="0" y="0.1" width="1" height="1" />
218      </text>
219      <text string="49" state="49">
220         <color red="1.0" green="1.0" blue="1.0" />
221         <bounds x="0" y="0.1" width="1" height="1" />
222      </text>
223      <text string="50" state="50">
224         <color red="1.0" green="1.0" blue="1.0" />
225         <bounds x="0" y="0.1" width="1" height="1" />
226      </text>
227      <text string="51" state="51">
228         <color red="1.0" green="1.0" blue="1.0" />
229         <bounds x="0" y="0.1" width="1" height="1" />
230      </text>
231      <text string="52" state="52">
232         <color red="1.0" green="1.0" blue="1.0" />
233         <bounds x="0" y="0.1" width="1" height="1" />
234      </text>
235      <text string="53" state="53">
236         <color red="1.0" green="1.0" blue="1.0" />
237         <bounds x="0" y="0.1" width="1" height="1" />
238      </text>
239      <text string="54" state="54">
240         <color red="1.0" green="1.0" blue="1.0" />
241         <bounds x="0" y="0.1" width="1" height="1" />
242      </text>
243      <text string="55" state="55">
244         <color red="1.0" green="1.0" blue="1.0" />
245         <bounds x="0" y="0.1" width="1" height="1" />
246      </text>
247      <text string="56" state="56">
248         <color red="1.0" green="1.0" blue="1.0" />
249         <bounds x="0" y="0.1" width="1" height="1" />
250      </text>
251      <text string="57" state="57">
252         <color red="1.0" green="1.0" blue="1.0" />
253         <bounds x="0" y="0.1" width="1" height="1" />
254      </text>
255      <text string="58" state="58">
256         <color red="1.0" green="1.0" blue="1.0" />
257         <bounds x="0" y="0.1" width="1" height="1" />
258      </text>
259      <text string="59" state="59">
260         <color red="1.0" green="1.0" blue="1.0" />
261         <bounds x="0" y="0.1" width="1" height="1" />
262      </text>
263      <text string="60" state="60">
264         <color red="1.0" green="1.0" blue="1.0" />
265         <bounds x="0" y="0.1" width="1" height="1" />
266      </text>
267      <text string="61" state="61">
268         <color red="1.0" green="1.0" blue="1.0" />
269         <bounds x="0" y="0.1" width="1" height="1" />
270      </text>
271      <text string="62" state="62">
272         <color red="1.0" green="1.0" blue="1.0" />
273         <bounds x="0" y="0.1" width="1" height="1" />
274      </text>
275      <text string="63" state="63">
276         <color red="1.0" green="1.0" blue="1.0" />
277         <bounds x="0" y="0.1" width="1" height="1" />
278      </text>
279      <text string="64" state="64">
280         <color red="1.0" green="1.0" blue="1.0" />
281         <bounds x="0" y="0.1" width="1" height="1" />
282      </text>
283      <text string="65" state="65">
284         <color red="1.0" green="1.0" blue="1.0" />
285         <bounds x="0" y="0.1" width="1" height="1" />
286      </text>
287      <text string="66" state="66">
288         <color red="1.0" green="1.0" blue="1.0" />
289         <bounds x="0" y="0.1" width="1" height="1" />
290      </text>
291      <text string="67" state="67">
292         <color red="1.0" green="1.0" blue="1.0" />
293         <bounds x="0" y="0.1" width="1" height="1" />
294      </text>
295      <text string="68" state="68">
296         <color red="1.0" green="1.0" blue="1.0" />
297         <bounds x="0" y="0.1" width="1" height="1" />
298      </text>
299      <text string="69" state="69">
300         <color red="1.0" green="1.0" blue="1.0" />
301         <bounds x="0" y="0.1" width="1" height="1" />
302      </text>
303      <text string="70" state="70">
304         <color red="1.0" green="1.0" blue="1.0" />
305         <bounds x="0" y="0.1" width="1" height="1" />
306      </text>
307      <text string="71" state="71">
308         <color red="1.0" green="1.0" blue="1.0" />
309         <bounds x="0" y="0.1" width="1" height="1" />
310      </text>
311      <text string="72" state="72">
312         <color red="1.0" green="1.0" blue="1.0" />
313         <bounds x="0" y="0.1" width="1" height="1" />
314      </text>
315      <text string="73" state="73">
316         <color red="1.0" green="1.0" blue="1.0" />
317         <bounds x="0" y="0.1" width="1" height="1" />
318      </text>
319      <text string="74" state="74">
320         <color red="1.0" green="1.0" blue="1.0" />
321         <bounds x="0" y="0.1" width="1" height="1" />
322      </text>
323      <text string="75" state="75">
324         <color red="1.0" green="1.0" blue="1.0" />
325         <bounds x="0" y="0.1" width="1" height="1" />
326      </text>
327      <text string="76" state="76">
328         <color red="1.0" green="1.0" blue="1.0" />
329         <bounds x="0" y="0.1" width="1" height="1" />
330      </text>
331      <text string="77" state="77">
332         <color red="1.0" green="1.0" blue="1.0" />
333         <bounds x="0" y="0.1" width="1" height="1" />
334      </text>
335      <text string="78" state="78">
336         <color red="1.0" green="1.0" blue="1.0" />
337         <bounds x="0" y="0.1" width="1" height="1" />
338      </text>
339      <text string="79" state="79">
340         <color red="1.0" green="1.0" blue="1.0" />
341         <bounds x="0" y="0.1" width="1" height="1" />
342      </text>
343      <text string="80" state="80">
344         <color red="1.0" green="1.0" blue="1.0" />
345         <bounds x="0" y="0.1" width="1" height="1" />
346      </text>
347      <text string="81" state="81">
348         <color red="1.0" green="1.0" blue="1.0" />
349         <bounds x="0" y="0.1" width="1" height="1" />
350      </text>
351      <text string="82" state="82">
352         <color red="1.0" green="1.0" blue="1.0" />
353         <bounds x="0" y="0.1" width="1" height="1" />
354      </text>
355      <text string="83" state="83">
356         <color red="1.0" green="1.0" blue="1.0" />
357         <bounds x="0" y="0.1" width="1" height="1" />
358      </text>
359      <text string="84" state="84">
360         <color red="1.0" green="1.0" blue="1.0" />
361         <bounds x="0" y="0.1" width="1" height="1" />
362      </text>
363      <text string="85" state="85">
364         <color red="1.0" green="1.0" blue="1.0" />
365         <bounds x="0" y="0.1" width="1" height="1" />
366      </text>
367      <text string="86" state="86">
368         <color red="1.0" green="1.0" blue="1.0" />
369         <bounds x="0" y="0.1" width="1" height="1" />
370      </text>
371      <text string="87" state="87">
372         <color red="1.0" green="1.0" blue="1.0" />
373         <bounds x="0" y="0.1" width="1" height="1" />
374      </text>
375      <text string="88" state="88">
376         <color red="1.0" green="1.0" blue="1.0" />
377         <bounds x="0" y="0.1" width="1" height="1" />
378      </text>
379      <text string="89" state="89">
380         <color red="1.0" green="1.0" blue="1.0" />
381         <bounds x="0" y="0.1" width="1" height="1" />
382      </text>
383      <text string="90" state="90">
384         <color red="1.0" green="1.0" blue="1.0" />
385         <bounds x="0" y="0.1" width="1" height="1" />
386      </text>
387      <text string="91" state="91">
388         <color red="1.0" green="1.0" blue="1.0" />
389         <bounds x="0" y="0.1" width="1" height="1" />
390      </text>
391      <text string="92" state="92">
392         <color red="1.0" green="1.0" blue="1.0" />
393         <bounds x="0" y="0.1" width="1" height="1" />
394      </text>
395      <text string="93" state="93">
396         <color red="1.0" green="1.0" blue="1.0" />
397         <bounds x="0" y="0.1" width="1" height="1" />
398      </text>
399      <text string="94" state="94">
400         <color red="1.0" green="1.0" blue="1.0" />
401         <bounds x="0" y="0.1" width="1" height="1" />
402      </text>
403      <text string="95" state="95">
404         <color red="1.0" green="1.0" blue="1.0" />
405         <bounds x="0" y="0.1" width="1" height="1" />
406      </text>
407   </element>
408   <element name="vfd0">
409   <led16segsc>
410         <color red="0" green="0.6" blue="1.0" />
411   </led16segsc>
412   </element>
413
414   <view name="AWP Simulated Video (No Artwork)">
415      <backdrop name="reel1" element="Steppers" state="0">
416         <bounds x="10" y="300" width="50" height="50"/>
417      </backdrop>
418      <backdrop name="reel2" element="Steppers" state="0">
419         <bounds x="60" y="300" width="50" height="50"/>
420      </backdrop>
421      <backdrop name="reel3" element="Steppers" state="0">
422         <bounds x="110" y="300" width="50" height="50"/>
423      </backdrop>
424      <backdrop name="reel4" element="Steppers" state="0">
425         <bounds x="160" y="300" width="50" height="50"/>
426      </backdrop>
427      <backdrop name="reel5" element="Steppers" state="0">
428         <bounds x="220" y="300" width="50" height="50"/>
429      </backdrop>
430      <backdrop name="reel6" element="Steppers" state="0">
431         <bounds x="280" y="300" width="50" height="50"/>
432      </backdrop>
433      <backdrop name="lamp0" element="matrixlamp" state="0">
434         <bounds x="0" y="0" width="7" height="7"/>
435      </backdrop>
436      <backdrop name="lamp1" element="matrixlamp" state="0">
437         <bounds x="0" y="8" width="7" height="7"/>
438      </backdrop>
439      <backdrop name="lamp2" element="matrixlamp" state="0">
440         <bounds x="0" y="16" width="7" height="7"/>
441      </backdrop>
442      <backdrop name="lamp3" element="matrixlamp" state="0">
443         <bounds x="0" y="24" width="7" height="7"/>
444      </backdrop>
445      <backdrop name="lamp4" element="matrixlamp" state="0">
446         <bounds x="0" y="32" width="7" height="7"/>
447      </backdrop>
448      <backdrop name="lamp5" element="matrixlamp" state="0">
449         <bounds x="0" y="40" width="7" height="7"/>
450      </backdrop>
451      <backdrop name="lamp6" element="matrixlamp" state="0">
452         <bounds x="0" y="48" width="7" height="7"/>
453      </backdrop>
454      <backdrop name="lamp7" element="matrixlamp" state="0">
455         <bounds x="0" y="56" width="7" height="7"/>
456      </backdrop>
457      <backdrop name="lamp8" element="matrixlamp" state="0">
458         <bounds x="8" y="0" width="7" height="7"/>
459      </backdrop>
460      <backdrop name="lamp9" element="matrixlamp" state="0">
461         <bounds x="8" y="8" width="7" height="7"/>
462      </backdrop>
463      <backdrop name="lamp10" element="matrixlamp" state="0">
464         <bounds x="8" y="16" width="7" height="7"/>
465      </backdrop>
466      <backdrop name="lamp11" element="matrixlamp" state="0">
467         <bounds x="8" y="24" width="7" height="7"/>
468      </backdrop>
469      <backdrop name="lamp12" element="matrixlamp" state="0">
470         <bounds x="8" y="32" width="7" height="7"/>
471      </backdrop>
472      <backdrop name="lamp13" element="matrixlamp" state="0">
473         <bounds x="8" y="40" width="7" height="7"/>
474      </backdrop>
475      <backdrop name="lamp14" element="matrixlamp" state="0">
476         <bounds x="8" y="48" width="7" height="7"/>
477      </backdrop>
478      <backdrop name="lamp15" element="matrixlamp" state="0">
479         <bounds x="8" y="56" width="7" height="7"/>
480      </backdrop>
481      <backdrop name="lamp16" element="matrixlamp" state="0">
482         <bounds x="16" y="0" width="7" height="7"/>
483      </backdrop>
484      <backdrop name="lamp17" element="matrixlamp" state="0">
485         <bounds x="16" y="8" width="7" height="7"/>
486      </backdrop>
487      <backdrop name="lamp18" element="matrixlamp" state="0">
488         <bounds x="16" y="16" width="7" height="7"/>
489      </backdrop>
490      <backdrop name="lamp19" element="matrixlamp" state="0">
491         <bounds x="16" y="24" width="7" height="7"/>
492      </backdrop>
493      <backdrop name="lamp20" element="matrixlamp" state="0">
494         <bounds x="16" y="32" width="7" height="7"/>
495      </backdrop>
496      <backdrop name="lamp21" element="matrixlamp" state="0">
497         <bounds x="16" y="40" width="7" height="7"/>
498      </backdrop>
499      <backdrop name="lamp22" element="matrixlamp" state="0">
500         <bounds x="16" y="48" width="7" height="7"/>
501      </backdrop>
502      <backdrop name="lamp23" element="matrixlamp" state="0">
503         <bounds x="16" y="56" width="7" height="7"/>
504      </backdrop>
505      <backdrop name="lamp24" element="matrixlamp" state="0">
506         <bounds x="24" y="0" width="7" height="7"/>
507      </backdrop>
508      <backdrop name="lamp25" element="matrixlamp" state="0">
509         <bounds x="24" y="8" width="7" height="7"/>
510      </backdrop>
511      <backdrop name="lamp26" element="matrixlamp" state="0">
512         <bounds x="24" y="16" width="7" height="7"/>
513      </backdrop>
514      <backdrop name="lamp27" element="matrixlamp" state="0">
515         <bounds x="24" y="24" width="7" height="7"/>
516      </backdrop>
517      <backdrop name="lamp28" element="matrixlamp" state="0">
518         <bounds x="24" y="32" width="7" height="7"/>
519      </backdrop>
520      <backdrop name="lamp29" element="matrixlamp" state="0">
521         <bounds x="24" y="40" width="7" height="7"/>
522      </backdrop>
523      <backdrop name="lamp30" element="matrixlamp" state="0">
524         <bounds x="24" y="48" width="7" height="7"/>
525      </backdrop>
526      <backdrop name="lamp31" element="matrixlamp" state="0">
527         <bounds x="24" y="56" width="7" height="7"/>
528      </backdrop>
529      <backdrop name="lamp32" element="matrixlamp" state="0">
530         <bounds x="32" y="0" width="7" height="7"/>
531      </backdrop>
532      <backdrop name="lamp33" element="matrixlamp" state="0">
533         <bounds x="32" y="8" width="7" height="7"/>
534      </backdrop>
535      <backdrop name="lamp34" element="matrixlamp" state="0">
536         <bounds x="32" y="16" width="7" height="7"/>
537      </backdrop>
538      <backdrop name="lamp35" element="matrixlamp" state="0">
539         <bounds x="32" y="24" width="7" height="7"/>
540      </backdrop>
541      <backdrop name="lamp36" element="matrixlamp" state="0">
542         <bounds x="32" y="32" width="7" height="7"/>
543      </backdrop>
544      <backdrop name="lamp37" element="matrixlamp" state="0">
545         <bounds x="32" y="40" width="7" height="7"/>
546      </backdrop>
547      <backdrop name="lamp38" element="matrixlamp" state="0">
548         <bounds x="32" y="48" width="7" height="7"/>
549      </backdrop>
550      <backdrop name="lamp39" element="matrixlamp" state="0">
551         <bounds x="32" y="56" width="7" height="7"/>
552      </backdrop>
553      <backdrop name="lamp40" element="matrixlamp" state="0">
554         <bounds x="40" y="0" width="7" height="7"/>
555      </backdrop>
556      <backdrop name="lamp41" element="matrixlamp" state="0">
557         <bounds x="40" y="8" width="7" height="7"/>
558      </backdrop>
559      <backdrop name="lamp42" element="matrixlamp" state="0">
560         <bounds x="40" y="16" width="7" height="7"/>
561      </backdrop>
562      <backdrop name="lamp43" element="matrixlamp" state="0">
563         <bounds x="40" y="24" width="7" height="7"/>
564      </backdrop>
565      <backdrop name="lamp44" element="matrixlamp" state="0">
566         <bounds x="40" y="32" width="7" height="7"/>
567      </backdrop>
568      <backdrop name="lamp45" element="matrixlamp" state="0">
569         <bounds x="40" y="40" width="7" height="7"/>
570      </backdrop>
571      <backdrop name="lamp46" element="matrixlamp" state="0">
572         <bounds x="40" y="48" width="7" height="7"/>
573      </backdrop>
574      <backdrop name="lamp47" element="matrixlamp" state="0">
575         <bounds x="40" y="56" width="7" height="7"/>
576      </backdrop>
577      <backdrop name="lamp48" element="matrixlamp" state="0">
578         <bounds x="48" y="0" width="7" height="7"/>
579      </backdrop>
580      <backdrop name="lamp49" element="matrixlamp" state="0">
581         <bounds x="48" y="8" width="7" height="7"/>
582      </backdrop>
583      <backdrop name="lamp50" element="matrixlamp" state="0">
584         <bounds x="48" y="16" width="7" height="7"/>
585      </backdrop>
586      <backdrop name="lamp51" element="matrixlamp" state="0">
587         <bounds x="48" y="24" width="7" height="7"/>
588      </backdrop>
589      <backdrop name="lamp52" element="matrixlamp" state="0">
590         <bounds x="48" y="32" width="7" height="7"/>
591      </backdrop>
592      <backdrop name="lamp53" element="matrixlamp" state="0">
593         <bounds x="48" y="40" width="7" height="7"/>
594      </backdrop>
595      <backdrop name="lamp54" element="matrixlamp" state="0">
596         <bounds x="48" y="48" width="7" height="7"/>
597      </backdrop>
598      <backdrop name="lamp55" element="matrixlamp" state="0">
599         <bounds x="48" y="56" width="7" height="7"/>
600      </backdrop>
601      <backdrop name="lamp56" element="matrixlamp" state="0">
602         <bounds x="56" y="0" width="7" height="7"/>
603      </backdrop>
604      <backdrop name="lamp57" element="matrixlamp" state="0">
605         <bounds x="56" y="8" width="7" height="7"/>
606      </backdrop>
607      <backdrop name="lamp58" element="matrixlamp" state="0">
608         <bounds x="56" y="16" width="7" height="7"/>
609      </backdrop>
610      <backdrop name="lamp59" element="matrixlamp" state="0">
611         <bounds x="56" y="24" width="7" height="7"/>
612      </backdrop>
613      <backdrop name="lamp60" element="matrixlamp" state="0">
614         <bounds x="56" y="32" width="7" height="7"/>
615      </backdrop>
616      <backdrop name="lamp61" element="matrixlamp" state="0">
617         <bounds x="56" y="40" width="7" height="7"/>
618      </backdrop>
619      <backdrop name="lamp62" element="matrixlamp" state="0">
620         <bounds x="56" y="48" width="7" height="7"/>
621      </backdrop>
622      <backdrop name="lamp63" element="matrixlamp" state="0">
623         <bounds x="56" y="56" width="7" height="7"/>
624      </backdrop>
625      <backdrop name="lamp64" element="matrixlamp" state="0">
626         <bounds x="64" y="0" width="7" height="7"/>
627      </backdrop>
628      <backdrop name="lamp65" element="matrixlamp" state="0">
629         <bounds x="64" y="8" width="7" height="7"/>
630      </backdrop>
631      <backdrop name="lamp66" element="matrixlamp" state="0">
632         <bounds x="64" y="16" width="7" height="7"/>
633      </backdrop>
634      <backdrop name="lamp67" element="matrixlamp" state="0">
635         <bounds x="64" y="24" width="7" height="7"/>
636      </backdrop>
637      <backdrop name="lamp68" element="matrixlamp" state="0">
638         <bounds x="64" y="32" width="7" height="7"/>
639      </backdrop>
640      <backdrop name="lamp69" element="matrixlamp" state="0">
641         <bounds x="64" y="40" width="7" height="7"/>
642      </backdrop>
643      <backdrop name="lamp70" element="matrixlamp" state="0">
644         <bounds x="64" y="48" width="7" height="7"/>
645      </backdrop>
646      <backdrop name="lamp71" element="matrixlamp" state="0">
647         <bounds x="64" y="56" width="7" height="7"/>
648      </backdrop>
649      <backdrop name="lamp72" element="matrixlamp" state="0">
650         <bounds x="72" y="0" width="7" height="7"/>
651      </backdrop>
652      <backdrop name="lamp73" element="matrixlamp" state="0">
653         <bounds x="72" y="8" width="7" height="7"/>
654      </backdrop>
655      <backdrop name="lamp74" element="matrixlamp" state="0">
656         <bounds x="72" y="16" width="7" height="7"/>
657      </backdrop>
658      <backdrop name="lamp75" element="matrixlamp" state="0">
659         <bounds x="72" y="24" width="7" height="7"/>
660      </backdrop>
661      <backdrop name="lamp76" element="matrixlamp" state="0">
662         <bounds x="72" y="32" width="7" height="7"/>
663      </backdrop>
664      <backdrop name="lamp77" element="matrixlamp" state="0">
665         <bounds x="72" y="40" width="7" height="7"/>
666      </backdrop>
667      <backdrop name="lamp78" element="matrixlamp" state="0">
668         <bounds x="72" y="48" width="7" height="7"/>
669      </backdrop>
670      <backdrop name="lamp79" element="matrixlamp" state="0">
671         <bounds x="72" y="56" width="7" height="7"/>
672      </backdrop>
673      <backdrop name="lamp80" element="matrixlamp" state="0">
674         <bounds x="80" y="0" width="7" height="7"/>
675      </backdrop>
676      <backdrop name="lamp81" element="matrixlamp" state="0">
677         <bounds x="80" y="8" width="7" height="7"/>
678      </backdrop>
679      <backdrop name="lamp82" element="matrixlamp" state="0">
680         <bounds x="80" y="16" width="7" height="7"/>
681      </backdrop>
682      <backdrop name="lamp83" element="matrixlamp" state="0">
683         <bounds x="80" y="24" width="7" height="7"/>
684      </backdrop>
685      <backdrop name="lamp84" element="matrixlamp" state="0">
686         <bounds x="80" y="32" width="7" height="7"/>
687      </backdrop>
688      <backdrop name="lamp85" element="matrixlamp" state="0">
689         <bounds x="80" y="40" width="7" height="7"/>
690      </backdrop>
691      <backdrop name="lamp86" element="matrixlamp" state="0">
692         <bounds x="80" y="48" width="7" height="7"/>
693      </backdrop>
694      <backdrop name="lamp87" element="matrixlamp" state="0">
695         <bounds x="80" y="56" width="7" height="7"/>
696      </backdrop>
697      <backdrop name="lamp88" element="matrixlamp" state="0">
698         <bounds x="88" y="0" width="7" height="7"/>
699      </backdrop>
700      <backdrop name="lamp89" element="matrixlamp" state="0">
701         <bounds x="88" y="8" width="7" height="7"/>
702      </backdrop>
703      <backdrop name="lamp90" element="matrixlamp" state="0">
704         <bounds x="88" y="16" width="7" height="7"/>
705      </backdrop>
706      <backdrop name="lamp91" element="matrixlamp" state="0">
707         <bounds x="88" y="24" width="7" height="7"/>
708      </backdrop>
709      <backdrop name="lamp92" element="matrixlamp" state="0">
710         <bounds x="88" y="32" width="7" height="7"/>
711      </backdrop>
712      <backdrop name="lamp93" element="matrixlamp" state="0">
713         <bounds x="88" y="40" width="7" height="7"/>
714      </backdrop>
715      <backdrop name="lamp94" element="matrixlamp" state="0">
716         <bounds x="88" y="48" width="7" height="7"/>
717      </backdrop>
718      <backdrop name="lamp95" element="matrixlamp" state="0">
719         <bounds x="88" y="56" width="7" height="7"/>
720      </backdrop>
721      <backdrop name="lamp96" element="matrixlamp" state="0">
722         <bounds x="96" y="0" width="7" height="7"/>
723      </backdrop>
724      <backdrop name="lamp97" element="matrixlamp" state="0">
725         <bounds x="96" y="8" width="7" height="7"/>
726      </backdrop>
727      <backdrop name="lamp98" element="matrixlamp" state="0">
728         <bounds x="96" y="16" width="7" height="7"/>
729      </backdrop>
730      <backdrop name="lamp99" element="matrixlamp" state="0">
731         <bounds x="96" y="24" width="7" height="7"/>
732      </backdrop>
733      <backdrop name="lamp100" element="matrixlamp" state="0">
734         <bounds x="96" y="32" width="7" height="7"/>
735      </backdrop>
736      <backdrop name="lamp101" element="matrixlamp" state="0">
737         <bounds x="96" y="40" width="7" height="7"/>
738      </backdrop>
739      <backdrop name="lamp102" element="matrixlamp" state="0">
740         <bounds x="96" y="48" width="7" height="7"/>
741      </backdrop>
742      <backdrop name="lamp103" element="matrixlamp" state="0">
743         <bounds x="96" y="56" width="7" height="7"/>
744      </backdrop>
745      <backdrop name="lamp104" element="matrixlamp" state="0">
746         <bounds x="104" y="0" width="7" height="7"/>
747      </backdrop>
748      <backdrop name="lamp105" element="matrixlamp" state="0">
749         <bounds x="104" y="8" width="7" height="7"/>
750      </backdrop>
751      <backdrop name="lamp106" element="matrixlamp" state="0">
752         <bounds x="104" y="16" width="7" height="7"/>
753      </backdrop>
754      <backdrop name="lamp107" element="matrixlamp" state="0">
755         <bounds x="104" y="24" width="7" height="7"/>
756      </backdrop>
757      <backdrop name="lamp108" element="matrixlamp" state="0">
758         <bounds x="104" y="32" width="7" height="7"/>
759      </backdrop>
760      <backdrop name="lamp109" element="matrixlamp" state="0">
761         <bounds x="104" y="40" width="7" height="7"/>
762      </backdrop>
763      <backdrop name="lamp110" element="matrixlamp" state="0">
764         <bounds x="104" y="48" width="7" height="7"/>
765      </backdrop>
766      <backdrop name="lamp111" element="matrixlamp" state="0">
767         <bounds x="104" y="56" width="7" height="7"/>
768      </backdrop>
769      <backdrop name="lamp112" element="matrixlamp" state="0">
770         <bounds x="112" y="0" width="7" height="7"/>
771      </backdrop>
772      <backdrop name="lamp113" element="matrixlamp" state="0">
773         <bounds x="112" y="8" width="7" height="7"/>
774      </backdrop>
775      <backdrop name="lamp114" element="matrixlamp" state="0">
776         <bounds x="112" y="16" width="7" height="7"/>
777      </backdrop>
778      <backdrop name="lamp115" element="matrixlamp" state="0">
779         <bounds x="112" y="24" width="7" height="7"/>
780      </backdrop>
781      <backdrop name="lamp116" element="matrixlamp" state="0">
782         <bounds x="112" y="32" width="7" height="7"/>
783      </backdrop>
784      <backdrop name="lamp117" element="matrixlamp" state="0">
785         <bounds x="112" y="40" width="7" height="7"/>
786      </backdrop>
787      <backdrop name="lamp118" element="matrixlamp" state="0">
788         <bounds x="112" y="48" width="7" height="7"/>
789      </backdrop>
790      <backdrop name="lamp119" element="matrixlamp" state="0">
791         <bounds x="112" y="56" width="7" height="7"/>
792      </backdrop>
793      <backdrop name="lamp120" element="matrixlamp" state="0">
794         <bounds x="120" y="0" width="7" height="7"/>
795      </backdrop>
796      <backdrop name="lamp121" element="matrixlamp" state="0">
797         <bounds x="120" y="8" width="7" height="7"/>
798      </backdrop>
799      <backdrop name="lamp122" element="matrixlamp" state="0">
800         <bounds x="120" y="16" width="7" height="7"/>
801      </backdrop>
802      <backdrop name="lamp123" element="matrixlamp" state="0">
803         <bounds x="120" y="24" width="7" height="7"/>
804      </backdrop>
805      <backdrop name="lamp124" element="matrixlamp" state="0">
806         <bounds x="120" y="32" width="7" height="7"/>
807      </backdrop>
808      <backdrop name="lamp125" element="matrixlamp" state="0">
809         <bounds x="120" y="40" width="7" height="7"/>
810      </backdrop>
811      <backdrop name="lamp126" element="matrixlamp" state="0">
812         <bounds x="120" y="48" width="7" height="7"/>
813      </backdrop>
814      <backdrop name="lamp127" element="matrixlamp" state="0">
815         <bounds x="120" y="56" width="7" height="7"/>
816      </backdrop>
817      <backdrop name="lamp128" element="matrixlamp" state="0">
818         <bounds x="128" y="0" width="7" height="7"/>
819      </backdrop>
820      <backdrop name="lamp129" element="matrixlamp" state="0">
821         <bounds x="128" y="8" width="7" height="7"/>
822      </backdrop>
823      <backdrop name="lamp130" element="matrixlamp" state="0">
824         <bounds x="128" y="16" width="7" height="7"/>
825      </backdrop>
826      <backdrop name="lamp131" element="matrixlamp" state="0">
827         <bounds x="128" y="24" width="7" height="7"/>
828      </backdrop>
829      <backdrop name="lamp132" element="matrixlamp" state="0">
830         <bounds x="128" y="32" width="7" height="7"/>
831      </backdrop>
832      <backdrop name="lamp133" element="matrixlamp" state="0">
833         <bounds x="128" y="40" width="7" height="7"/>
834      </backdrop>
835      <backdrop name="lamp134" element="matrixlamp" state="0">
836         <bounds x="128" y="48" width="7" height="7"/>
837      </backdrop>
838      <backdrop name="lamp135" element="matrixlamp" state="0">
839         <bounds x="128" y="56" width="7" height="7"/>
840      </backdrop>
841      <backdrop name="lamp136" element="matrixlamp" state="0">
842         <bounds x="136" y="0" width="7" height="7"/>
843      </backdrop>
844      <backdrop name="lamp137" element="matrixlamp" state="0">
845         <bounds x="136" y="8" width="7" height="7"/>
846      </backdrop>
847      <backdrop name="lamp138" element="matrixlamp" state="0">
848         <bounds x="136" y="16" width="7" height="7"/>
849      </backdrop>
850      <backdrop name="lamp139" element="matrixlamp" state="0">
851         <bounds x="136" y="24" width="7" height="7"/>
852      </backdrop>
853      <backdrop name="lamp140" element="matrixlamp" state="0">
854         <bounds x="136" y="32" width="7" height="7"/>
855      </backdrop>
856      <backdrop name="lamp141" element="matrixlamp" state="0">
857         <bounds x="136" y="40" width="7" height="7"/>
858      </backdrop>
859      <backdrop name="lamp142" element="matrixlamp" state="0">
860         <bounds x="136" y="48" width="7" height="7"/>
861      </backdrop>
862      <backdrop name="lamp143" element="matrixlamp" state="0">
863         <bounds x="136" y="56" width="7" height="7"/>
864      </backdrop>
865      <backdrop name="lamp144" element="matrixlamp" state="0">
866         <bounds x="144" y="0" width="7" height="7"/>
867      </backdrop>
868      <backdrop name="lamp145" element="matrixlamp" state="0">
869         <bounds x="144" y="8" width="7" height="7"/>
870      </backdrop>
871      <backdrop name="lamp146" element="matrixlamp" state="0">
872         <bounds x="144" y="16" width="7" height="7"/>
873      </backdrop>
874      <backdrop name="lamp147" element="matrixlamp" state="0">
875         <bounds x="144" y="24" width="7" height="7"/>
876      </backdrop>
877      <backdrop name="lamp148" element="matrixlamp" state="0">
878         <bounds x="144" y="32" width="7" height="7"/>
879      </backdrop>
880      <backdrop name="lamp149" element="matrixlamp" state="0">
881         <bounds x="144" y="40" width="7" height="7"/>
882      </backdrop>
883      <backdrop name="lamp150" element="matrixlamp" state="0">
884         <bounds x="144" y="48" width="7" height="7"/>
885      </backdrop>
886      <backdrop name="lamp151" element="matrixlamp" state="0">
887         <bounds x="144" y="56" width="7" height="7"/>
888      </backdrop>
889      <backdrop name="lamp152" element="matrixlamp" state="0">
890         <bounds x="152" y="0" width="7" height="7"/>
891      </backdrop>
892      <backdrop name="lamp153" element="matrixlamp" state="0">
893         <bounds x="152" y="8" width="7" height="7"/>
894      </backdrop>
895      <backdrop name="lamp154" element="matrixlamp" state="0">
896         <bounds x="152" y="16" width="7" height="7"/>
897      </backdrop>
898      <backdrop name="lamp155" element="matrixlamp" state="0">
899         <bounds x="152" y="24" width="7" height="7"/>
900      </backdrop>
901      <backdrop name="lamp156" element="matrixlamp" state="0">
902         <bounds x="152" y="32" width="7" height="7"/>
903      </backdrop>
904      <backdrop name="lamp157" element="matrixlamp" state="0">
905         <bounds x="152" y="40" width="7" height="7"/>
906      </backdrop>
907      <backdrop name="lamp158" element="matrixlamp" state="0">
908         <bounds x="152" y="48" width="7" height="7"/>
909      </backdrop>
910      <backdrop name="lamp159" element="matrixlamp" state="0">
911         <bounds x="152" y="56" width="7" height="7"/>
912      </backdrop>
913      <backdrop name="lamp160" element="matrixlamp" state="0">
914         <bounds x="160" y="0" width="7" height="7"/>
915      </backdrop>
916      <backdrop name="lamp161" element="matrixlamp" state="0">
917         <bounds x="160" y="8" width="7" height="7"/>
918      </backdrop>
919      <backdrop name="lamp162" element="matrixlamp" state="0">
920         <bounds x="160" y="16" width="7" height="7"/>
921      </backdrop>
922      <backdrop name="lamp163" element="matrixlamp" state="0">
923         <bounds x="160" y="24" width="7" height="7"/>
924      </backdrop>
925      <backdrop name="lamp164" element="matrixlamp" state="0">
926         <bounds x="160" y="32" width="7" height="7"/>
927      </backdrop>
928      <backdrop name="lamp165" element="matrixlamp" state="0">
929         <bounds x="160" y="40" width="7" height="7"/>
930      </backdrop>
931      <backdrop name="lamp166" element="matrixlamp" state="0">
932         <bounds x="160" y="48" width="7" height="7"/>
933      </backdrop>
934      <backdrop name="lamp167" element="matrixlamp" state="0">
935         <bounds x="160" y="56" width="7" height="7"/>
936      </backdrop>
937      <backdrop name="lamp168" element="matrixlamp" state="0">
938         <bounds x="168" y="0" width="7" height="7"/>
939      </backdrop>
940      <backdrop name="lamp169" element="matrixlamp" state="0">
941         <bounds x="168" y="8" width="7" height="7"/>
942      </backdrop>
943      <backdrop name="lamp170" element="matrixlamp" state="0">
944         <bounds x="168" y="16" width="7" height="7"/>
945      </backdrop>
946      <backdrop name="lamp171" element="matrixlamp" state="0">
947         <bounds x="168" y="24" width="7" height="7"/>
948      </backdrop>
949      <backdrop name="lamp172" element="matrixlamp" state="0">
950         <bounds x="168" y="32" width="7" height="7"/>
951      </backdrop>
952      <backdrop name="lamp173" element="matrixlamp" state="0">
953         <bounds x="168" y="40" width="7" height="7"/>
954      </backdrop>
955      <backdrop name="lamp174" element="matrixlamp" state="0">
956         <bounds x="168" y="48" width="7" height="7"/>
957      </backdrop>
958      <backdrop name="lamp175" element="matrixlamp" state="0">
959         <bounds x="168" y="56" width="7" height="7"/>
960      </backdrop>
961      <backdrop name="lamp176" element="matrixlamp" state="0">
962         <bounds x="176" y="0" width="7" height="7"/>
963      </backdrop>
964      <backdrop name="lamp177" element="matrixlamp" state="0">
965         <bounds x="176" y="8" width="7" height="7"/>
966      </backdrop>
967      <backdrop name="lamp178" element="matrixlamp" state="0">
968         <bounds x="176" y="16" width="7" height="7"/>
969      </backdrop>
970      <backdrop name="lamp179" element="matrixlamp" state="0">
971         <bounds x="176" y="24" width="7" height="7"/>
972      </backdrop>
973      <backdrop name="lamp180" element="matrixlamp" state="0">
974         <bounds x="176" y="32" width="7" height="7"/>
975      </backdrop>
976      <backdrop name="lamp181" element="matrixlamp" state="0">
977         <bounds x="176" y="40" width="7" height="7"/>
978      </backdrop>
979      <backdrop name="lamp182" element="matrixlamp" state="0">
980         <bounds x="176" y="48" width="7" height="7"/>
981      </backdrop>
982      <backdrop name="lamp183" element="matrixlamp" state="0">
983         <bounds x="176" y="56" width="7" height="7"/>
984      </backdrop>
985      <backdrop name="lamp184" element="matrixlamp" state="0">
986         <bounds x="184" y="0" width="7" height="7"/>
987      </backdrop>
988      <backdrop name="lamp185" element="matrixlamp" state="0">
989         <bounds x="184" y="8" width="7" height="7"/>
990      </backdrop>
991      <backdrop name="lamp186" element="matrixlamp" state="0">
992         <bounds x="184" y="16" width="7" height="7"/>
993      </backdrop>
994      <backdrop name="lamp187" element="matrixlamp" state="0">
995         <bounds x="184" y="24" width="7" height="7"/>
996      </backdrop>
997      <backdrop name="lamp188" element="matrixlamp" state="0">
998         <bounds x="184" y="32" width="7" height="7"/>
999      </backdrop>
1000      <backdrop name="lamp189" element="matrixlamp" state="0">
1001         <bounds x="184" y="40" width="7" height="7"/>
1002      </backdrop>
1003      <backdrop name="lamp190" element="matrixlamp" state="0">
1004         <bounds x="184" y="48" width="7" height="7"/>
1005      </backdrop>
1006      <backdrop name="lamp191" element="matrixlamp" state="0">
1007         <bounds x="184" y="56" width="7" height="7"/>
1008      </backdrop>
1009      <backdrop name="lamp192" element="matrixlamp" state="0">
1010         <bounds x="192" y="0" width="7" height="7"/>
1011      </backdrop>
1012      <backdrop name="lamp193" element="matrixlamp" state="0">
1013         <bounds x="192" y="8" width="7" height="7"/>
1014      </backdrop>
1015      <backdrop name="lamp194" element="matrixlamp" state="0">
1016         <bounds x="192" y="16" width="7" height="7"/>
1017      </backdrop>
1018      <backdrop name="lamp195" element="matrixlamp" state="0">
1019         <bounds x="192" y="24" width="7" height="7"/>
1020      </backdrop>
1021      <backdrop name="lamp196" element="matrixlamp" state="0">
1022         <bounds x="192" y="32" width="7" height="7"/>
1023      </backdrop>
1024      <backdrop name="lamp197" element="matrixlamp" state="0">
1025         <bounds x="192" y="40" width="7" height="7"/>
1026      </backdrop>
1027      <backdrop name="lamp198" element="matrixlamp" state="0">
1028         <bounds x="192" y="48" width="7" height="7"/>
1029      </backdrop>
1030      <backdrop name="lamp199" element="matrixlamp" state="0">
1031         <bounds x="192" y="56" width="7" height="7"/>
1032      </backdrop>
1033      <backdrop name="lamp200" element="matrixlamp" state="0">
1034         <bounds x="200" y="0" width="7" height="7"/>
1035      </backdrop>
1036      <backdrop name="lamp201" element="matrixlamp" state="0">
1037         <bounds x="200" y="8" width="7" height="7"/>
1038      </backdrop>
1039      <backdrop name="lamp202" element="matrixlamp" state="0">
1040         <bounds x="200" y="16" width="7" height="7"/>
1041      </backdrop>
1042      <backdrop name="lamp203" element="matrixlamp" state="0">
1043         <bounds x="200" y="24" width="7" height="7"/>
1044      </backdrop>
1045      <backdrop name="lamp204" element="matrixlamp" state="0">
1046         <bounds x="200" y="32" width="7" height="7"/>
1047      </backdrop>
1048      <backdrop name="lamp205" element="matrixlamp" state="0">
1049         <bounds x="200" y="40" width="7" height="7"/>
1050      </backdrop>
1051      <backdrop name="lamp206" element="matrixlamp" state="0">
1052         <bounds x="200" y="48" width="7" height="7"/>
1053      </backdrop>
1054      <backdrop name="lamp207" element="matrixlamp" state="0">
1055         <bounds x="200" y="56" width="7" height="7"/>
1056      </backdrop>
1057      <backdrop name="lamp208" element="matrixlamp" state="0">
1058         <bounds x="208" y="0" width="7" height="7"/>
1059      </backdrop>
1060      <backdrop name="lamp209" element="matrixlamp" state="0">
1061         <bounds x="208" y="8" width="7" height="7"/>
1062      </backdrop>
1063      <backdrop name="lamp210" element="matrixlamp" state="0">
1064         <bounds x="208" y="16" width="7" height="7"/>
1065      </backdrop>
1066      <backdrop name="lamp211" element="matrixlamp" state="0">
1067         <bounds x="208" y="24" width="7" height="7"/>
1068      </backdrop>
1069      <backdrop name="lamp212" element="matrixlamp" state="0">
1070         <bounds x="208" y="32" width="7" height="7"/>
1071      </backdrop>
1072      <backdrop name="lamp213" element="matrixlamp" state="0">
1073         <bounds x="208" y="40" width="7" height="7"/>
1074      </backdrop>
1075      <backdrop name="lamp214" element="matrixlamp" state="0">
1076         <bounds x="208" y="48" width="7" height="7"/>
1077      </backdrop>
1078      <backdrop name="lamp215" element="matrixlamp" state="0">
1079         <bounds x="208" y="56" width="7" height="7"/>
1080      </backdrop>
1081      <backdrop name="lamp216" element="matrixlamp" state="0">
1082         <bounds x="216" y="0" width="7" height="7"/>
1083      </backdrop>
1084      <backdrop name="lamp217" element="matrixlamp" state="0">
1085         <bounds x="216" y="8" width="7" height="7"/>
1086      </backdrop>
1087      <backdrop name="lamp218" element="matrixlamp" state="0">
1088         <bounds x="216" y="16" width="7" height="7"/>
1089      </backdrop>
1090      <backdrop name="lamp219" element="matrixlamp" state="0">
1091         <bounds x="216" y="24" width="7" height="7"/>
1092      </backdrop>
1093      <backdrop name="lamp220" element="matrixlamp" state="0">
1094         <bounds x="216" y="32" width="7" height="7"/>
1095      </backdrop>
1096      <backdrop name="lamp221" element="matrixlamp" state="0">
1097         <bounds x="216" y="40" width="7" height="7"/>
1098      </backdrop>
1099      <backdrop name="lamp222" element="matrixlamp" state="0">
1100         <bounds x="216" y="48" width="7" height="7"/>
1101      </backdrop>
1102      <backdrop name="lamp223" element="matrixlamp" state="0">
1103         <bounds x="216" y="56" width="7" height="7"/>
1104      </backdrop>
1105      <backdrop name="lamp224" element="matrixlamp" state="0">
1106         <bounds x="224" y="0" width="7" height="7"/>
1107      </backdrop>
1108      <backdrop name="digit0" element="digit" state="0">
1109         <bounds x="300" y="200" width="8" height="10"/>
1110      </backdrop>
1111      <backdrop name="digit1" element="digit" state="0">
1112         <bounds x="308" y="200" width="8" height="10"/>
1113      </backdrop>
1114      <backdrop name="digit2" element="digit" state="0">
1115         <bounds x="316" y="200" width="8" height="10"/>
1116      </backdrop>
1117      <backdrop name="digit3" element="digit" state="0">
1118         <bounds x="324" y="200" width="8" height="10"/>
1119      </backdrop>
1120      <backdrop name="digit4" element="digit" state="0">
1121         <bounds x="332" y="200" width="8" height="10"/>
1122      </backdrop>
1123      <backdrop name="digit5" element="digit" state="0">
1124         <bounds x="340" y="200" width="8" height="10"/>
1125      </backdrop>
1126      <backdrop name="digit6" element="digit" state="0">
1127         <bounds x="348" y="200" width="8" height="10"/>
1128      </backdrop>
1129      <backdrop name="digit7" element="digit" state="0">
1130         <bounds x="356" y="200" width="8" height="10"/>
1131      </backdrop>
1132      <backdrop name="digit8" element="digit" state="0">
1133         <bounds x="300" y="211" width="8" height="10"/>
1134      </backdrop>
1135      <backdrop name="digit9" element="digit" state="0">
1136         <bounds x="308" y="211" width="8" height="10"/>
1137      </backdrop>
1138      <backdrop name="digit10" element="digit" state="0">
1139         <bounds x="316" y="211" width="8" height="10"/>
1140      </backdrop>
1141      <backdrop name="digit11" element="digit" state="0">
1142         <bounds x="324" y="211" width="8" height="10"/>
1143      </backdrop>
1144      <backdrop name="digit12" element="digit" state="0">
1145         <bounds x="332" y="211" width="8" height="10"/>
1146      </backdrop>
1147      <backdrop name="digit13" element="digit" state="0">
1148         <bounds x="340" y="211" width="8" height="10"/>
1149      </backdrop>
1150      <backdrop name="digit14" element="digit" state="0">
1151         <bounds x="348" y="211" width="8" height="10"/>
1152      </backdrop>
1153      <backdrop name="digit15" element="digit" state="0">
1154         <bounds x="356" y="211" width="8" height="10"/>
1155      </backdrop>
1156      <backdrop name="digit16" element="digit" state="0">
1157         <bounds x="300" y="222" width="8" height="10"/>
1158      </backdrop>
1159      <backdrop name="digit17" element="digit" state="0">
1160         <bounds x="308" y="222" width="8" height="10"/>
1161      </backdrop>
1162      <backdrop name="digit18" element="digit" state="0">
1163         <bounds x="316" y="222" width="8" height="10"/>
1164      </backdrop>
1165      <backdrop name="digit19" element="digit" state="0">
1166         <bounds x="324" y="222" width="8" height="10"/>
1167      </backdrop>
1168      <backdrop name="digit20" element="digit" state="0">
1169         <bounds x="332" y="222" width="8" height="10"/>
1170      </backdrop>
1171      <backdrop name="digit21" element="digit" state="0">
1172         <bounds x="340" y="222" width="8" height="10"/>
1173      </backdrop>
1174      <backdrop name="digit22" element="digit" state="0">
1175         <bounds x="348" y="222" width="8" height="10"/>
1176      </backdrop>
1177      <backdrop name="digit23" element="digit" state="0">
1178         <bounds x="356" y="222" width="8" height="10"/>
1179      </backdrop>
1180      <backdrop name="digit24" element="digit" state="0">
1181         <bounds x="300" y="233" width="8" height="10"/>
1182      </backdrop>
1183      <backdrop name="digit25" element="digit" state="0">
1184         <bounds x="308" y="233" width="8" height="10"/>
1185      </backdrop>
1186      <backdrop name="digit26" element="digit" state="0">
1187         <bounds x="316" y="233" width="8" height="10"/>
1188      </backdrop>
1189      <backdrop name="digit27" element="digit" state="0">
1190         <bounds x="324" y="233" width="8" height="10"/>
1191      </backdrop>
1192      <backdrop name="digit28" element="digit" state="0">
1193         <bounds x="332" y="233" width="8" height="10"/>
1194      </backdrop>
1195      <backdrop name="digit29" element="digit" state="0">
1196         <bounds x="340" y="233" width="8" height="10"/>
1197      </backdrop>
1198      <backdrop name="digit30" element="digit" state="0">
1199         <bounds x="348" y="233" width="8" height="10"/>
1200      </backdrop>
1201      <backdrop name="digit31" element="digit" state="0">
1202         <bounds x="356" y="233" width="8" height="10"/>
1203      </backdrop>
1204      <backdrop name="digit32" element="digit" state="0">
1205         <bounds x="300" y="244" width="8" height="10"/>
1206      </backdrop>
1207      <backdrop name="digit33" element="digit" state="0">
1208         <bounds x="308" y="244" width="8" height="10"/>
1209      </backdrop>
1210      <backdrop name="digit34" element="digit" state="0">
1211         <bounds x="316" y="244" width="8" height="10"/>
1212      </backdrop>
1213      <backdrop name="digit35" element="digit" state="0">
1214         <bounds x="324" y="244" width="8" height="10"/>
1215      </backdrop>
1216      <backdrop name="digit36" element="digit" state="0">
1217         <bounds x="332" y="244" width="8" height="10"/>
1218      </backdrop>
1219      <backdrop name="digit37" element="digit" state="0">
1220         <bounds x="340" y="244" width="8" height="10"/>
1221      </backdrop>
1222      <backdrop name="digit38" element="digit" state="0">
1223         <bounds x="348" y="244" width="8" height="10"/>
1224      </backdrop>
1225      <backdrop name="digit39" element="digit" state="0">
1226         <bounds x="356" y="244" width="8" height="10"/>
1227      </backdrop>
1228      <backdrop name="vfd0" element="vfd0" state="0">
1229         <bounds x="17" y="280" width="7" height="24"/>
1230      </backdrop>
1231      <backdrop name="vfd1" element="vfd0" state="0">
1232         <bounds x="24" y="280" width="7" height="24"/>
1233      </backdrop>
1234      <backdrop name="vfd2" element="vfd0" state="0">
1235         <bounds x="31" y="280" width="7" height="24"/>
1236      </backdrop>
1237      <backdrop name="vfd3" element="vfd0" state="0">
1238         <bounds x="38" y="280" width="7" height="24"/>
1239      </backdrop>
1240      <backdrop name="vfd4" element="vfd0" state="0">
1241         <bounds x="45" y="280" width="7" height="24"/>
1242      </backdrop>
1243      <backdrop name="vfd5" element="vfd0" state="0">
1244         <bounds x="52" y="280" width="7" height="24"/>
1245      </backdrop>
1246      <backdrop name="vfd6" element="vfd0" state="0">
1247         <bounds x="59" y="280" width="7" height="24"/>
1248      </backdrop>
1249      <backdrop name="vfd7" element="vfd0" state="0">
1250         <bounds x="66" y="280" width="7" height="24"/>
1251      </backdrop>
1252      <backdrop name="vfd8" element="vfd0" state="0">
1253         <bounds x="73" y="280" width="7" height="24"/>
1254      </backdrop>
1255      <backdrop name="vfd9" element="vfd0" state="0">
1256         <bounds x="80" y="280" width="7" height="24"/>
1257      </backdrop>
1258      <backdrop name="vfd10" element="vfd0" state="0">
1259         <bounds x="87" y="280" width="7" height="24"/>
1260      </backdrop>
1261      <backdrop name="vfd11" element="vfd0" state="0">
1262         <bounds x="94" y="280" width="7" height="24"/>
1263      </backdrop>
1264      <backdrop name="vfd12" element="vfd0" state="0">
1265         <bounds x="101" y="280" width="7" height="24"/>
1266      </backdrop>
1267      <backdrop name="vfd13" element="vfd0" state="0">
1268         <bounds x="108" y="280" width="7" height="24"/>
1269      </backdrop>
1270      <backdrop name="vfd14" element="vfd0" state="0">
1271         <bounds x="115" y="280" width="7" height="24"/>
1272      </backdrop>
1273      <backdrop name="vfd15" element="vfd0" state="0">
1274         <bounds x="122" y="280" width="7" height="24"/>
1275      </backdrop>
1276   </view>
1277   <view name="VFD Display Output Only">
1278      <bezel name="vfd0" element="vfd0" state="0">
1279         <bounds x="10" y="200" width="9" height="17"/>
1280      </bezel>
1281      <bezel name="vfd1" element="vfd0" state="0">
1282         <bounds x="19" y="200" width="9" height="17"/>
1283      </bezel>
1284      <bezel name="vfd2" element="vfd0" state="0">
1285         <bounds x="28" y="200" width="9" height="17"/>
1286      </bezel>
1287      <bezel name="vfd3" element="vfd0" state="0">
1288         <bounds x="37" y="200" width="9" height="17"/>
1289      </bezel>
1290      <bezel name="vfd4" element="vfd0" state="0">
1291         <bounds x="46" y="200" width="9" height="17"/>
1292      </bezel>
1293      <bezel name="vfd5" element="vfd0" state="0">
1294         <bounds x="55" y="200" width="9" height="17"/>
1295      </bezel>
1296      <bezel name="vfd6" element="vfd0" state="0">
1297         <bounds x="64" y="200" width="9" height="17"/>
1298      </bezel>
1299      <bezel name="vfd7" element="vfd0" state="0">
1300         <bounds x="73" y="200" width="9" height="17"/>
1301      </bezel>
1302      <bezel name="vfd8" element="vfd0" state="0">
1303         <bounds x="82" y="200" width="9" height="17"/>
1304      </bezel>
1305      <bezel name="vfd9" element="vfd0" state="0">
1306         <bounds x="91" y="200" width="9" height="17"/>
1307      </bezel>
1308      <bezel name="vfd10" element="vfd0" state="0">
1309         <bounds x="100" y="200" width="9" height="17"/>
1310      </bezel>
1311      <bezel name="vfd11" element="vfd0" state="0">
1312         <bounds x="109" y="200" width="9" height="17"/>
1313      </bezel>
1314      <bezel name="vfd12" element="vfd0" state="0">
1315         <bounds x="118" y="200" width="9" height="17"/>
1316      </bezel>
1317      <bezel name="vfd13" element="vfd0" state="0">
1318         <bounds x="127" y="200" width="9" height="17"/>
1319      </bezel>
1320      <bezel name="vfd14" element="vfd0" state="0">
1321         <bounds x="136" y="200" width="9" height="17"/>
1322      </bezel>
1323      <bezel name="vfd15" element="vfd0" state="0">
1324         <bounds x="145" y="200" width="9" height="17"/>
1325      </bezel>
1326   </view>
1327</mamelayout>
src/mame/layout/gamball.lay
r10315r10316
20072007         <bounds x="120" y="56" width="7" height="7"/>
20082008      </backdrop>
20092009      <backdrop name="digit3" element="digit" state="0">
2010         <bounds x="308" y="230" width="8" height="10"/>
2011      </backdrop>
2012      <backdrop name="digit4" element="digit" state="0">
20132010         <bounds x="316" y="230" width="8" height="10"/>
20142011      </backdrop>
2015      <backdrop name="digit5" element="digit" state="0">
2016         <bounds x="300" y="200" width="8" height="10"/>
2017      </backdrop>
2018      <backdrop name="digit6" element="digit" state="0">
2019         <bounds x="308" y="200" width="8" height="10"/>
2020      </backdrop>
2021      <backdrop name="digit7" element="digit" state="0">
2022         <bounds x="316" y="200" width="8" height="10"/>
2023      </backdrop>
2024      <backdrop name="vfd0" element="vfd0" state="0">
2025         <bounds x="17" y="280" width="7" height="24"/>
2026      </backdrop>
2027      <backdrop name="vfd1" element="vfd0" state="0">
2028         <bounds x="24" y="280" width="7" height="24"/>
2029      </backdrop>
2030      <backdrop name="vfd2" element="vfd0" state="0">
2031         <bounds x="31" y="280" width="7" height="24"/>
2032      </backdrop>
2033      <backdrop name="vfd3" element="vfd0" state="0">
2034         <bounds x="38" y="280" width="7" height="24"/>
2035      </backdrop>
2036      <backdrop name="vfd4" element="vfd0" state="0">
2037         <bounds x="45" y="280" width="7" height="24"/>
2038      </backdrop>
2039      <backdrop name="vfd5" element="vfd0" state="0">
2040         <bounds x="52" y="280" width="7" height="24"/>
2041      </backdrop>
2042      <backdrop name="vfd6" element="vfd0" state="0">
2043         <bounds x="59" y="280" width="7" height="24"/>
2044      </backdrop>
2045      <backdrop name="vfd7" element="vfd0" state="0">
2046         <bounds x="66" y="280" width="7" height="24"/>
2047      </backdrop>
2048      <backdrop name="vfd8" element="vfd0" state="0">
2049         <bounds x="73" y="280" width="7" height="24"/>
2050      </backdrop>
2051      <backdrop name="vfd9" element="vfd0" state="0">
2052         <bounds x="80" y="280" width="7" height="24"/>
2053      </backdrop>
2054      <backdrop name="vfd10" element="vfd0" state="0">
2055         <bounds x="87" y="280" width="7" height="24"/>
2056      </backdrop>
2057      <backdrop name="vfd11" element="vfd0" state="0">
2058         <bounds x="94" y="280" width="7" height="24"/>
2059      </backdrop>
2060      <backdrop name="vfd12" element="vfd0" state="0">
2061         <bounds x="101" y="280" width="7" height="24"/>
2062      </backdrop>
2063      <backdrop name="vfd13" element="vfd0" state="0">
2064         <bounds x="108" y="280" width="7" height="24"/>
2065      </backdrop>
2066      <backdrop name="vfd14" element="vfd0" state="0">
2067         <bounds x="115" y="280" width="7" height="24"/>
2068      </backdrop>
2069      <backdrop name="vfd15" element="vfd0" state="0">
2070         <bounds x="122" y="280" width="7" height="24"/>
2071      </backdrop>
2072   </view>
2073</mamelayout>
2074<?xml version="1.0"?>
2075<mamelayout version="2">
2076   <element name="TotalReels" defstate="4"/>
2077   <element name="ReelSteps1" defstate="8"/>
2078   <element name="ReelSymbols1" defstate="3"/>
2079   <element name="ReelSteps2" defstate="6"/>
2080   <element name="digit">
2081   <led7seg>
2082         <color red="1.0" green="0.0" blue="0.0" />
2083   </led7seg>
2084   </element>
2085   <element name="matrixlamp">
2086      <rect state ="0">
2087         <bounds x="0" y="0" width="7" height="7" />
2088         <color red="0.7" green="0.7" blue="0.7" />
2089      </rect>
2090      <rect state ="1">
2091         <bounds x="0" y="0" width="7" height="7" />
2092         <color red="0.0" green="0.0" blue="1.0" />
2093      </rect>
2094      <rect state ="2">
2095         <bounds x="0" y="0" width="7" height="7" />
2096         <color red="0.0" green="1.0" blue="0.0" />
2097      </rect>
2098   </element>
2099   <element name="Reel1" defstate="96">
2100      <text string="3.00 RPT" state="0">
2101         <color red="1.0" green="1.0" blue="1.0" />
2102         <bounds x="0" y="0.1" width="1" height="1" />
2103      </text>
2104      <text string="3.00 RPT" state="1">
2105         <color red="1.0" green="1.0" blue="1.0" />
2106         <bounds x="0" y="0.1" width="1" height="1" />
2107      </text>
2108      <text string="3.00 RPT" state="2">
2109         <color red="1.0" green="1.0" blue="1.0" />
2110         <bounds x="0" y="0.1" width="1" height="1" />
2111      </text>
2112      <text string="3.00 RPT" state="3">
2113         <color red="1.0" green="1.0" blue="1.0" />
2114         <bounds x="0" y="0.1" width="1" height="1" />
2115      </text>
2116      <text string="3.00 RPT" state="4">
2117         <color red="1.0" green="1.0" blue="1.0" />
2118         <bounds x="0" y="0.1" width="1" height="1" />
2119      </text>
2120      <text string="3.00 RPT" state="5">
2121         <color red="1.0" green="1.0" blue="1.0" />
2122         <bounds x="0" y="0.1" width="1" height="1" />
2123      </text>
2124      <text string="3.00 RPT" state="6">
2125         <color red="1.0" green="1.0" blue="1.0" />
2126         <bounds x="0" y="0.1" width="1" height="1" />
2127      </text>
2128      <text string="3.00 RPT" state="7">
2129         <color red="1.0" green="1.0" blue="1.0" />
2130         <bounds x="0" y="0.1" width="1" height="1" />
2131      </text>
2132      <text string="POT" state="8">
2133         <color red="1.0" green="1.0" blue="1.0" />
2134         <bounds x="0" y="0.1" width="1" height="1" />
2135      </text>
2136      <text string="POT" state="9">
2137         <color red="1.0" green="1.0" blue="1.0" />
2138         <bounds x="0" y="0.1" width="1" height="1" />
2139      </text>
2140      <text string="POT" state="10">
2141         <color red="1.0" green="1.0" blue="1.0" />
2142         <bounds x="0" y="0.1" width="1" height="1" />
2143      </text>
2144      <text string="POT" state="11">
2145         <color red="1.0" green="1.0" blue="1.0" />
2146         <bounds x="0" y="0.1" width="1" height="1" />
2147      </text>
2148      <text string="POT" state="12">
2149         <color red="1.0" green="1.0" blue="1.0" />
2150         <bounds x="0" y="0.1" width="1" height="1" />
2151      </text>
2152      <text string="POT" state="13">
2153         <color red="1.0" green="1.0" blue="1.0" />
2154         <bounds x="0" y="0.1" width="1" height="1" />
2155      </text>
2156      <text string="POT" state="14">
2157         <color red="1.0" green="1.0" blue="1.0" />
2158         <bounds x="0" y="0.1" width="1" height="1" />
2159      </text>
2160      <text string="POT" state="15">
2161         <color red="1.0" green="1.0" blue="1.0" />
2162         <bounds x="0" y="0.1" width="1" height="1" />
2163      </text>
2164      <text string="JACK" state="16">
2165         <color red="1.0" green="1.0" blue="1.0" />
2166         <bounds x="0" y="0.1" width="1" height="1" />
2167      </text>
2168      <text string="JACK" state="17">
2169         <color red="1.0" green="1.0" blue="1.0" />
2170         <bounds x="0" y="0.1" width="1" height="1" />
2171      </text>
2172      <text string="JACK" state="18">
2173         <color red="1.0" green="1.0" blue="1.0" />
2174         <bounds x="0" y="0.1" width="1" height="1" />
2175      </text>
2176      <text string="JACK" state="19">
2177         <color red="1.0" green="1.0" blue="1.0" />
2178         <bounds x="0" y="0.1" width="1" height="1" />
2179      </text>
2180      <text string="JACK" state="20">
2181         <color red="1.0" green="1.0" blue="1.0" />
2182         <bounds x="0" y="0.1" width="1" height="1" />
2183      </text>
2184      <text string="JACK" state="21">
2185         <color red="1.0" green="1.0" blue="1.0" />
2186         <bounds x="0" y="0.1" width="1" height="1" />
2187      </text>
2188      <text string="JACK" state="22">
2189         <color red="1.0" green="1.0" blue="1.0" />
2190         <bounds x="0" y="0.1" width="1" height="1" />
2191      </text>
2192      <text string="JACK" state="23">
2193         <color red="1.0" green="1.0" blue="1.0" />
2194         <bounds x="0" y="0.1" width="1" height="1" />
2195      </text>
2196      <text string="LOSE" state="24">
2197         <color red="1.0" green="1.0" blue="1.0" />
2198         <bounds x="0" y="0.1" width="1" height="1" />
2199      </text>
2200      <text string="LOSE" state="25">
2201         <color red="1.0" green="1.0" blue="1.0" />
2202         <bounds x="0" y="0.1" width="1" height="1" />
2203      </text>
2204      <text string="LOSE" state="26">
2205         <color red="1.0" green="1.0" blue="1.0" />
2206         <bounds x="0" y="0.1" width="1" height="1" />
2207      </text>
2208      <text string="LOSE" state="27">
2209         <color red="1.0" green="1.0" blue="1.0" />
2210         <bounds x="0" y="0.1" width="1" height="1" />
2211      </text>
2212      <text string="LOSE" state="28">
2213         <color red="1.0" green="1.0" blue="1.0" />
2214         <bounds x="0" y="0.1" width="1" height="1" />
2215      </text>
2216      <text string="LOSE" state="29">
2217         <color red="1.0" green="1.0" blue="1.0" />
2218         <bounds x="0" y="0.1" width="1" height="1" />
2219      </text>
2220      <text string="LOSE" state="30">
2221         <color red="1.0" green="1.0" blue="1.0" />
2222         <bounds x="0" y="0.1" width="1" height="1" />
2223      </text>
2224      <text string="LOSE" state="31">
2225         <color red="1.0" green="1.0" blue="1.0" />
2226         <bounds x="0" y="0.1" width="1" height="1" />
2227      </text>
2228      <text string="60p" state="32">
2229         <color red="1.0" green="1.0" blue="1.0" />
2230         <bounds x="0" y="0.1" width="1" height="1" />
2231      </text>
2232      <text string="60p" state="33">
2233         <color red="1.0" green="1.0" blue="1.0" />
2234         <bounds x="0" y="0.1" width="1" height="1" />
2235      </text>
2236      <text string="60p" state="34">
2237         <color red="1.0" green="1.0" blue="1.0" />
2238         <bounds x="0" y="0.1" width="1" height="1" />
2239      </text>
2240      <text string="60p" state="35">
2241         <color red="1.0" green="1.0" blue="1.0" />
2242         <bounds x="0" y="0.1" width="1" height="1" />
2243      </text>
2244      <text string="60p" state="36">
2245         <color red="1.0" green="1.0" blue="1.0" />
2246         <bounds x="0" y="0.1" width="1" height="1" />
2247      </text>
2248      <text string="60p" state="37">
2249         <color red="1.0" green="1.0" blue="1.0" />
2250         <bounds x="0" y="0.1" width="1" height="1" />
2251      </text>
2252      <text string="60p" state="38">
2253         <color red="1.0" green="1.0" blue="1.0" />
2254         <bounds x="0" y="0.1" width="1" height="1" />
2255      </text>
2256      <text string="60p" state="39">
2257         <color red="1.0" green="1.0" blue="1.0" />
2258         <bounds x="0" y="0.1" width="1" height="1" />
2259      </text>
2260      <text string="80p" state="40">
2261         <color red="1.0" green="1.0" blue="1.0" />
2262         <bounds x="0" y="0.1" width="1" height="1" />
2263      </text>
2264      <text string="80p" state="41">
2265         <color red="1.0" green="1.0" blue="1.0" />
2266         <bounds x="0" y="0.1" width="1" height="1" />
2267      </text>
2268      <text string="80p" state="42">
2269         <color red="1.0" green="1.0" blue="1.0" />
2270         <bounds x="0" y="0.1" width="1" height="1" />
2271      </text>
2272      <text string="80p" state="43">
2273         <color red="1.0" green="1.0" blue="1.0" />
2274         <bounds x="0" y="0.1" width="1" height="1" />
2275      </text>
2276      <text string="80p" state="44">
2277         <color red="1.0" green="1.0" blue="1.0" />
2278         <bounds x="0" y="0.1" width="1" height="1" />
2279      </text>
2280      <text string="80p" state="45">
2281         <color red="1.0" green="1.0" blue="1.0" />
2282         <bounds x="0" y="0.1" width="1" height="1" />
2283      </text>
2284      <text string="80p" state="46">
2285         <color red="1.0" green="1.0" blue="1.0" />
2286         <bounds x="0" y="0.1" width="1" height="1" />
2287      </text>
2288      <text string="80p" state="47">
2289         <color red="1.0" green="1.0" blue="1.0" />
2290         <bounds x="0" y="0.1" width="1" height="1" />
2291      </text>
2292      <text string="1.00" state="48">
2293         <color red="1.0" green="1.0" blue="1.0" />
2294         <bounds x="0" y="0.1" width="1" height="1" />
2295      </text>
2296      <text string="1.00" state="49">
2297         <color red="1.0" green="1.0" blue="1.0" />
2298         <bounds x="0" y="0.1" width="1" height="1" />
2299      </text>
2300      <text string="1.00" state="50">
2301         <color red="1.0" green="1.0" blue="1.0" />
2302         <bounds x="0" y="0.1" width="1" height="1" />
2303      </text>
2304      <text string="1.00" state="51">
2305         <color red="1.0" green="1.0" blue="1.0" />
2306         <bounds x="0" y="0.1" width="1" height="1" />
2307      </text>
2308      <text string="1.00" state="52">
2309         <color red="1.0" green="1.0" blue="1.0" />
2310         <bounds x="0" y="0.1" width="1" height="1" />
2311      </text>
2312      <text string="1.00" state="53">
2313         <color red="1.0" green="1.0" blue="1.0" />
2314         <bounds x="0" y="0.1" width="1" height="1" />
2315      </text>
2316      <text string="1.00" state="54">
2317         <color red="1.0" green="1.0" blue="1.0" />
2318         <bounds x="0" y="0.1" width="1" height="1" />
2319      </text>
2320      <text string="1.00" state="55">
2321         <color red="1.0" green="1.0" blue="1.0" />
2322         <bounds x="0" y="0.1" width="1" height="1" />
2323      </text>
2324      <text string="1.20" state="56">
2325         <color red="1.0" green="1.0" blue="1.0" />
2326         <bounds x="0" y="0.1" width="1" height="1" />
2327      </text>
2328      <text string="1.20" state="57">
2329         <color red="1.0" green="1.0" blue="1.0" />
2330         <bounds x="0" y="0.1" width="1" height="1" />
2331      </text>
2332      <text string="1.20" state="58">
2333         <color red="1.0" green="1.0" blue="1.0" />
2334         <bounds x="0" y="0.1" width="1" height="1" />
2335      </text>
2336      <text string="1.20" state="59">
2337         <color red="1.0" green="1.0" blue="1.0" />
2338         <bounds x="0" y="0.1" width="1" height="1" />
2339      </text>
2340      <text string="1.20" state="60">
2341         <color red="1.0" green="1.0" blue="1.0" />
2342         <bounds x="0" y="0.1" width="1" height="1" />
2343      </text>
2344      <text string="1.20" state="61">
2345         <color red="1.0" green="1.0" blue="1.0" />
2346         <bounds x="0" y="0.1" width="1" height="1" />
2347      </text>
2348      <text string="1.20" state="62">
2349         <color red="1.0" green="1.0" blue="1.0" />
2350         <bounds x="0" y="0.1" width="1" height="1" />
2351      </text>
2352      <text string="1.20" state="63">
2353         <color red="1.0" green="1.0" blue="1.0" />
2354         <bounds x="0" y="0.1" width="1" height="1" />
2355      </text>
2356      <text string="1.60" state="64">
2357         <color red="1.0" green="1.0" blue="1.0" />
2358         <bounds x="0" y="0.1" width="1" height="1" />
2359      </text>
2360      <text string="1.60" state="65">
2361         <color red="1.0" green="1.0" blue="1.0" />
2362         <bounds x="0" y="0.1" width="1" height="1" />
2363      </text>
2364      <text string="1.60" state="66">
2365         <color red="1.0" green="1.0" blue="1.0" />
2366         <bounds x="0" y="0.1" width="1" height="1" />
2367      </text>
2368      <text string="1.60" state="67">
2369         <color red="1.0" green="1.0" blue="1.0" />
2370         <bounds x="0" y="0.1" width="1" height="1" />
2371      </text>
2372      <text string="1.60" state="68">
2373         <color red="1.0" green="1.0" blue="1.0" />
2374         <bounds x="0" y="0.1" width="1" height="1" />
2375      </text>
2376      <text string="1.60" state="69">
2377         <color red="1.0" green="1.0" blue="1.0" />
2378         <bounds x="0" y="0.1" width="1" height="1" />
2379      </text>
2380      <text string="1.60" state="70">
2381         <color red="1.0" green="1.0" blue="1.0" />
2382         <bounds x="0" y="0.1" width="1" height="1" />
2383      </text>
2384      <text string="1.60" state="71">
2385         <color red="1.0" green="1.0" blue="1.0" />
2386         <bounds x="0" y="0.1" width="1" height="1" />
2387      </text>
2388      <text string="2.00" state="72">
2389         <color red="1.0" green="1.0" blue="1.0" />
2390         <bounds x="0" y="0.1" width="1" height="1" />
2391      </text>
2392      <text string="2.00" state="73">
2393         <color red="1.0" green="1.0" blue="1.0" />
2394         <bounds x="0" y="0.1" width="1" height="1" />
2395      </text>
2396      <text string="2.00" state="74">
2397         <color red="1.0" green="1.0" blue="1.0" />
2398         <bounds x="0" y="0.1" width="1" height="1" />
2399      </text>
2400      <text string="2.00" state="75">
2401         <color red="1.0" green="1.0" blue="1.0" />
2402         <bounds x="0" y="0.1" width="1" height="1" />
2403      </text>
2404      <text string="2.00" state="76">
2405         <color red="1.0" green="1.0" blue="1.0" />
2406         <bounds x="0" y="0.1" width="1" height="1" />
2407      </text>
2408      <text string="2.00" state="77">
2409         <color red="1.0" green="1.0" blue="1.0" />
2410         <bounds x="0" y="0.1" width="1" height="1" />
2411      </text>
2412      <text string="2.00" state="78">
2413         <color red="1.0" green="1.0" blue="1.0" />
2414         <bounds x="0" y="0.1" width="1" height="1" />
2415      </text>
2416      <text string="2.00" state="79">
2417         <color red="1.0" green="1.0" blue="1.0" />
2418         <bounds x="0" y="0.1" width="1" height="1" />
2419      </text>
2420      <text string="2.20" state="80">
2421         <color red="1.0" green="1.0" blue="1.0" />
2422         <bounds x="0" y="0.1" width="1" height="1" />
2423      </text>
2424      <text string="2.20" state="81">
2425         <color red="1.0" green="1.0" blue="1.0" />
2426         <bounds x="0" y="0.1" width="1" height="1" />
2427      </text>
2428      <text string="2.20" state="82">
2429         <color red="1.0" green="1.0" blue="1.0" />
2430         <bounds x="0" y="0.1" width="1" height="1" />
2431      </text>
2432      <text string="2.20" state="83">
2433         <color red="1.0" green="1.0" blue="1.0" />
2434         <bounds x="0" y="0.1" width="1" height="1" />
2435      </text>
2436      <text string="2.20" state="84">
2437         <color red="1.0" green="1.0" blue="1.0" />
2438         <bounds x="0" y="0.1" width="1" height="1" />
2439      </text>
2440      <text string="2.20" state="85">
2441         <color red="1.0" green="1.0" blue="1.0" />
2442         <bounds x="0" y="0.1" width="1" height="1" />
2443      </text>
2444      <text string="2.20" state="86">
2445         <color red="1.0" green="1.0" blue="1.0" />
2446         <bounds x="0" y="0.1" width="1" height="1" />
2447      </text>
2448      <text string="2.20" state="87">
2449         <color red="1.0" green="1.0" blue="1.0" />
2450         <bounds x="0" y="0.1" width="1" height="1" />
2451      </text>
2452      <text string="2.40" state="88">
2453         <color red="1.0" green="1.0" blue="1.0" />
2454         <bounds x="0" y="0.1" width="1" height="1" />
2455      </text>
2456      <text string="2.40" state="89">
2457         <color red="1.0" green="1.0" blue="1.0" />
2458         <bounds x="0" y="0.1" width="1" height="1" />
2459      </text>
2460      <text string="2.40" state="90">
2461         <color red="1.0" green="1.0" blue="1.0" />
2462         <bounds x="0" y="0.1" width="1" height="1" />
2463      </text>
2464      <text string="2.40" state="91">
2465         <color red="1.0" green="1.0" blue="1.0" />
2466         <bounds x="0" y="0.1" width="1" height="1" />
2467      </text>
2468      <text string="2.40" state="92">
2469         <color red="1.0" green="1.0" blue="1.0" />
2470         <bounds x="0" y="0.1" width="1" height="1" />
2471      </text>
2472      <text string="2.40" state="93">
2473         <color red="1.0" green="1.0" blue="1.0" />
2474         <bounds x="0" y="0.1" width="1" height="1" />
2475      </text>
2476      <text string="2.40" state="94">
2477         <color red="1.0" green="1.0" blue="1.0" />
2478         <bounds x="0" y="0.1" width="1" height="1" />
2479      </text>
2480      <text string="2.40" state="95">
2481         <color red="1.0" green="1.0" blue="1.0" />
2482         <bounds x="0" y="0.1" width="1" height="1" />
2483      </text>
2484   </element>
2485   
2486   <element name="Reel2" defstate="96">
2487      <text string="7" state="0">
2488         <color red="1.0" green="1.0" blue="1.0" />
2489         <bounds x="0" y="0.1" width="1" height="1" />
2490      </text>
2491      <text string="7" state="1">
2492         <color red="1.0" green="1.0" blue="1.0" />
2493         <bounds x="0" y="0.1" width="1" height="1" />
2494      </text>
2495      <text string="7" state="2">
2496         <color red="1.0" green="1.0" blue="1.0" />
2497         <bounds x="0" y="0.1" width="1" height="1" />
2498      </text>
2499      <text string="7" state="3">
2500         <color red="1.0" green="1.0" blue="1.0" />
2501         <bounds x="0" y="0.1" width="1" height="1" />
2502      </text>
2503      <text string="7" state="4">
2504         <color red="1.0" green="1.0" blue="1.0" />
2505         <bounds x="0" y="0.1" width="1" height="1" />
2506      </text>
2507      <text string="7" state="5">
2508         <color red="1.0" green="1.0" blue="1.0" />
2509         <bounds x="0" y="0.1" width="1" height="1" />
2510      </text>
2511      <text string="Cherry" state="6">
2512         <color red="1.0" green="1.0" blue="1.0" />
2513         <bounds x="0" y="0.1" width="1" height="1" />
2514      </text>
2515      <text string="Cherry" state="7">
2516         <color red="1.0" green="1.0" blue="1.0" />
2517         <bounds x="0" y="0.1" width="1" height="1" />
2518      </text>
2519      <text string="Cherry" state="8">
2520         <color red="1.0" green="1.0" blue="1.0" />
2521         <bounds x="0" y="0.1" width="1" height="1" />
2522      </text>
2523      <text string="Cherry" state="9">
2524         <color red="1.0" green="1.0" blue="1.0" />
2525         <bounds x="0" y="0.1" width="1" height="1" />
2526      </text>
2527      <text string="Cherry" state="10">
2528         <color red="1.0" green="1.0" blue="1.0" />
2529         <bounds x="0" y="0.1" width="1" height="1" />
2530      </text>
2531      <text string="Cherry" state="11">
2532         <color red="1.0" green="1.0" blue="1.0" />
2533         <bounds x="0" y="0.1" width="1" height="1" />
2534      </text>
2535      <text string="Bar" state="12">
2536         <color red="1.0" green="1.0" blue="1.0" />
2537         <bounds x="0" y="0.1" width="1" height="1" />
2538      </text>
2539      <text string="Bar" state="13">
2540         <color red="1.0" green="1.0" blue="1.0" />
2541         <bounds x="0" y="0.1" width="1" height="1" />
2542      </text>
2543      <text string="Bar" state="14">
2544         <color red="1.0" green="1.0" blue="1.0" />
2545         <bounds x="0" y="0.1" width="1" height="1" />
2546      </text>
2547      <text string="Bar" state="15">
2548         <color red="1.0" green="1.0" blue="1.0" />
2549         <bounds x="0" y="0.1" width="1" height="1" />
2550      </text>
2551      <text string="Bar" state="16">
2552         <color red="1.0" green="1.0" blue="1.0" />
2553         <bounds x="0" y="0.1" width="1" height="1" />
2554      </text>
2555      <text string="Bar" state="17">
2556         <color red="1.0" green="1.0" blue="1.0" />
2557         <bounds x="0" y="0.1" width="1" height="1" />
2558      </text>
2559      <text string="Melon" state="18">
2560         <color red="1.0" green="1.0" blue="1.0" />
2561         <bounds x="0" y="0.1" width="1" height="1" />
2562      </text>
2563      <text string="Melon" state="19">
2564         <color red="1.0" green="1.0" blue="1.0" />
2565         <bounds x="0" y="0.1" width="1" height="1" />
2566      </text>
2567      <text string="Melon" state="20">
2568         <color red="1.0" green="1.0" blue="1.0" />
2569         <bounds x="0" y="0.1" width="1" height="1" />
2570      </text>
2571      <text string="Melon" state="21">
2572         <color red="1.0" green="1.0" blue="1.0" />
2573         <bounds x="0" y="0.1" width="1" height="1" />
2574      </text>
2575      <text string="Melon" state="22">
2576         <color red="1.0" green="1.0" blue="1.0" />
2577         <bounds x="0" y="0.1" width="1" height="1" />
2578      </text>
2579      <text string="Melon" state="23">
2580         <color red="1.0" green="1.0" blue="1.0" />
2581         <bounds x="0" y="0.1" width="1" height="1" />
2582      </text>
2583      <text string="7" state="24">
2584         <color red="1.0" green="1.0" blue="1.0" />
2585         <bounds x="0" y="0.1" width="1" height="1" />
2586      </text>
2587      <text string="7" state="25">
2588         <color red="1.0" green="1.0" blue="1.0" />
2589         <bounds x="0" y="0.1" width="1" height="1" />
2590      </text>
2591      <text string="7" state="26">
2592         <color red="1.0" green="1.0" blue="1.0" />
2593         <bounds x="0" y="0.1" width="1" height="1" />
2594      </text>
2595      <text string="7" state="27">
2596         <color red="1.0" green="1.0" blue="1.0" />
2597         <bounds x="0" y="0.1" width="1" height="1" />
2598      </text>
2599      <text string="7" state="28">
2600         <color red="1.0" green="1.0" blue="1.0" />
2601         <bounds x="0" y="0.1" width="1" height="1" />
2602      </text>
2603      <text string="7" state="29">
2604         <color red="1.0" green="1.0" blue="1.0" />
2605         <bounds x="0" y="0.1" width="1" height="1" />
2606      </text>
2607      <text string="Bar" state="30">
2608         <color red="1.0" green="1.0" blue="1.0" />
2609         <bounds x="0" y="0.1" width="1" height="1" />
2610      </text>
2611      <text string="Bar" state="31">
2612         <color red="1.0" green="1.0" blue="1.0" />
2613         <bounds x="0" y="0.1" width="1" height="1" />
2614      </text>
2615      <text string="Bar" state="32">
2616         <color red="1.0" green="1.0" blue="1.0" />
2617         <bounds x="0" y="0.1" width="1" height="1" />
2618      </text>
2619      <text string="Bar" state="33">
2620         <color red="1.0" green="1.0" blue="1.0" />
2621         <bounds x="0" y="0.1" width="1" height="1" />
2622      </text>
2623      <text string="Bar" state="34">
2624         <color red="1.0" green="1.0" blue="1.0" />
2625         <bounds x="0" y="0.1" width="1" height="1" />
2626      </text>
2627      <text string="Bar" state="35">
2628         <color red="1.0" green="1.0" blue="1.0" />
2629         <bounds x="0" y="0.1" width="1" height="1" />
2630      </text>
2631      <text string="Bell" state="36">
2632         <color red="1.0" green="1.0" blue="1.0" />
2633         <bounds x="0" y="0.1" width="1" height="1" />
2634      </text>
2635      <text string="Bell" state="37">
2636         <color red="1.0" green="1.0" blue="1.0" />
2637         <bounds x="0" y="0.1" width="1" height="1" />
2638      </text>
2639      <text string="Bell" state="38">
2640         <color red="1.0" green="1.0" blue="1.0" />
2641         <bounds x="0" y="0.1" width="1" height="1" />
2642      </text>
2643      <text string="Bell" state="39">
2644         <color red="1.0" green="1.0" blue="1.0" />
2645         <bounds x="0" y="0.1" width="1" height="1" />
2646      </text>
2647      <text string="Bell" state="40">
2648         <color red="1.0" green="1.0" blue="1.0" />
2649         <bounds x="0" y="0.1" width="1" height="1" />
2650      </text>
2651      <text string="Bell" state="41">
2652         <color red="1.0" green="1.0" blue="1.0" />
2653         <bounds x="0" y="0.1" width="1" height="1" />
2654      </text>
2655      <text string="Cherry" state="42">
2656         <color red="1.0" green="1.0" blue="1.0" />
2657         <bounds x="0" y="0.1" width="1" height="1" />
2658      </text>
2659      <text string="Cherry" state="43">
2660         <color red="1.0" green="1.0" blue="1.0" />
2661         <bounds x="0" y="0.1" width="1" height="1" />
2662      </text>
2663      <text string="Cherry" state="44">
2664         <color red="1.0" green="1.0" blue="1.0" />
2665         <bounds x="0" y="0.1" width="1" height="1" />
2666      </text>
2667      <text string="Cherry" state="45">
2668         <color red="1.0" green="1.0" blue="1.0" />
2669         <bounds x="0" y="0.1" width="1" height="1" />
2670      </text>
2671      <text string="Cherry" state="46">
2672         <color red="1.0" green="1.0" blue="1.0" />
2673         <bounds x="0" y="0.1" width="1" height="1" />
2674      </text>
2675      <text string="Cherry" state="47">
2676         <color red="1.0" green="1.0" blue="1.0" />
2677         <bounds x="0" y="0.1" width="1" height="1" />
2678      </text>
2679      <text string="Melon" state="48">
2680         <color red="1.0" green="1.0" blue="1.0" />
2681         <bounds x="0" y="0.1" width="1" height="1" />
2682      </text>
2683      <text string="Melon" state="49">
2684         <color red="1.0" green="1.0" blue="1.0" />
2685         <bounds x="0" y="0.1" width="1" height="1" />
2686      </text>
2687      <text string="Melon" state="50">
2688         <color red="1.0" green="1.0" blue="1.0" />
2689         <bounds x="0" y="0.1" width="1" height="1" />
2690      </text>
2691      <text string="Melon" state="51">
2692         <color red="1.0" green="1.0" blue="1.0" />
2693         <bounds x="0" y="0.1" width="1" height="1" />
2694      </text>
2695      <text string="Melon" state="52">
2696         <color red="1.0" green="1.0" blue="1.0" />
2697         <bounds x="0" y="0.1" width="1" height="1" />
2698      </text>
2699      <text string="Melon" state="53">
2700         <color red="1.0" green="1.0" blue="1.0" />
2701         <bounds x="0" y="0.1" width="1" height="1" />
2702      </text>
2703      <text string="Bell" state="54">
2704         <color red="1.0" green="1.0" blue="1.0" />
2705         <bounds x="0" y="0.1" width="1" height="1" />
2706      </text>
2707      <text string="Bell" state="55">
2708         <color red="1.0" green="1.0" blue="1.0" />
2709         <bounds x="0" y="0.1" width="1" height="1" />
2710      </text>
2711      <text string="Bell" state="56">
2712         <color red="1.0" green="1.0" blue="1.0" />
2713         <bounds x="0" y="0.1" width="1" height="1" />
2714      </text>
2715      <text string="Bell" state="57">
2716         <color red="1.0" green="1.0" blue="1.0" />
2717         <bounds x="0" y="0.1" width="1" height="1" />
2718      </text>
2719      <text string="Bell" state="58">
2720         <color red="1.0" green="1.0" blue="1.0" />
2721         <bounds x="0" y="0.1" width="1" height="1" />
2722      </text>
2723      <text string="Bell" state="59">
2724         <color red="1.0" green="1.0" blue="1.0" />
2725         <bounds x="0" y="0.1" width="1" height="1" />
2726      </text>
2727      <text string="7" state="60">
2728         <color red="1.0" green="1.0" blue="1.0" />
2729         <bounds x="0" y="0.1" width="1" height="1" />
2730      </text>
2731      <text string="7" state="61">
2732         <color red="1.0" green="1.0" blue="1.0" />
2733         <bounds x="0" y="0.1" width="1" height="1" />
2734      </text>
2735      <text string="7" state="62">
2736         <color red="1.0" green="1.0" blue="1.0" />
2737         <bounds x="0" y="0.1" width="1" height="1" />
2738      </text>
2739      <text string="7" state="63">
2740         <color red="1.0" green="1.0" blue="1.0" />
2741         <bounds x="0" y="0.1" width="1" height="1" />
2742      </text>
2743      <text string="7" state="64">
2744         <color red="1.0" green="1.0" blue="1.0" />
2745         <bounds x="0" y="0.1" width="1" height="1" />
2746      </text>
2747      <text string="7" state="65">
2748         <color red="1.0" green="1.0" blue="1.0" />
2749         <bounds x="0" y="0.1" width="1" height="1" />
2750      </text>
2751      <text string="Bar" state="66">
2752         <color red="1.0" green="1.0" blue="1.0" />
2753         <bounds x="0" y="0.1" width="1" height="1" />
2754      </text>
2755      <text string="Bar" state="67">
2756         <color red="1.0" green="1.0" blue="1.0" />
2757         <bounds x="0" y="0.1" width="1" height="1" />
2758      </text>
2759      <text string="Bar" state="68">
2760         <color red="1.0" green="1.0" blue="1.0" />
2761         <bounds x="0" y="0.1" width="1" height="1" />
2762      </text>
2763      <text string="Bar" state="69">
2764         <color red="1.0" green="1.0" blue="1.0" />
2765         <bounds x="0" y="0.1" width="1" height="1" />
2766      </text>
2767      <text string="Bar" state="70">
2768         <color red="1.0" green="1.0" blue="1.0" />
2769         <bounds x="0" y="0.1" width="1" height="1" />
2770      </text>
2771      <text string="Bar" state="71">
2772         <color red="1.0" green="1.0" blue="1.0" />
2773         <bounds x="0" y="0.1" width="1" height="1" />
2774      </text>
2775      <text string="Cherry" state="72">
2776         <color red="1.0" green="1.0" blue="1.0" />
2777         <bounds x="0" y="0.1" width="1" height="1" />
2778      </text>
2779      <text string="Cherry" state="73">
2780         <color red="1.0" green="1.0" blue="1.0" />
2781         <bounds x="0" y="0.1" width="1" height="1" />
2782      </text>
2783      <text string="Cherry" state="74">
2784         <color red="1.0" green="1.0" blue="1.0" />
2785         <bounds x="0" y="0.1" width="1" height="1" />
2786      </text>
2787      <text string="Cherry" state="75">
2788         <color red="1.0" green="1.0" blue="1.0" />
2789         <bounds x="0" y="0.1" width="1" height="1" />
2790      </text>
2791      <text string="Cherry" state="76">
2792         <color red="1.0" green="1.0" blue="1.0" />
2793         <bounds x="0" y="0.1" width="1" height="1" />
2794      </text>
2795      <text string="Cherry" state="77">
2796         <color red="1.0" green="1.0" blue="1.0" />
2797         <bounds x="0" y="0.1" width="1" height="1" />
2798      </text>
2799      <text string="Bell" state="78">
2800         <color red="1.0" green="1.0" blue="1.0" />
2801         <bounds x="0" y="0.1" width="1" height="1" />
2802      </text>
2803      <text string="Bell" state="79">
2804         <color red="1.0" green="1.0" blue="1.0" />
2805         <bounds x="0" y="0.1" width="1" height="1" />
2806      </text>
2807      <text string="Bell" state="80">
2808         <color red="1.0" green="1.0" blue="1.0" />
2809         <bounds x="0" y="0.1" width="1" height="1" />
2810      </text>
2811      <text string="Bell" state="81">
2812         <color red="1.0" green="1.0" blue="1.0" />
2813         <bounds x="0" y="0.1" width="1" height="1" />
2814      </text>
2815      <text string="Bell" state="82">
2816         <color red="1.0" green="1.0" blue="1.0" />
2817         <bounds x="0" y="0.1" width="1" height="1" />
2818      </text>
2819      <text string="Bell" state="83">
2820         <color red="1.0" green="1.0" blue="1.0" />
2821         <bounds x="0" y="0.1" width="1" height="1" />
2822      </text>
2823      <text string="Bar" state="84">
2824         <color red="1.0" green="1.0" blue="1.0" />
2825         <bounds x="0" y="0.1" width="1" height="1" />
2826      </text>
2827      <text string="Bar" state="85">
2828         <color red="1.0" green="1.0" blue="1.0" />
2829         <bounds x="0" y="0.1" width="1" height="1" />
2830      </text>
2831      <text string="Bar" state="86">
2832         <color red="1.0" green="1.0" blue="1.0" />
2833         <bounds x="0" y="0.1" width="1" height="1" />
2834      </text>
2835      <text string="Bar" state="87">
2836         <color red="1.0" green="1.0" blue="1.0" />
2837         <bounds x="0" y="0.1" width="1" height="1" />
2838      </text>
2839      <text string="Bar" state="88">
2840         <color red="1.0" green="1.0" blue="1.0" />
2841         <bounds x="0" y="0.1" width="1" height="1" />
2842      </text>
2843      <text string="Bar" state="89">
2844         <color red="1.0" green="1.0" blue="1.0" />
2845         <bounds x="0" y="0.1" width="1" height="1" />
2846      </text>
2847      <text string="Melon" state="90">
2848         <color red="1.0" green="1.0" blue="1.0" />
2849         <bounds x="0" y="0.1" width="1" height="1" />
2850      </text>
2851      <text string="Melon" state="91">
2852         <color red="1.0" green="1.0" blue="1.0" />
2853         <bounds x="0" y="0.1" width="1" height="1" />
2854      </text>
2855      <text string="Melon" state="92">
2856         <color red="1.0" green="1.0" blue="1.0" />
2857         <bounds x="0" y="0.1" width="1" height="1" />
2858      </text>
2859      <text string="Melon" state="93">
2860         <color red="1.0" green="1.0" blue="1.0" />
2861         <bounds x="0" y="0.1" width="1" height="1" />
2862      </text>
2863      <text string="Melon" state="94">
2864         <color red="1.0" green="1.0" blue="1.0" />
2865         <bounds x="0" y="0.1" width="1" height="1" />
2866      </text>
2867      <text string="Melon" state="95">
2868         <color red="1.0" green="1.0" blue="1.0" />
2869         <bounds x="0" y="0.1" width="1" height="1" />
2870      </text>
2871   </element>
2872   
2873   <element name="Reel3" defstate="96">
2874      <text string="7" state="0">
2875         <color red="1.0" green="1.0" blue="1.0" />
2876         <bounds x="0" y="0.1" width="1" height="1" />
2877      </text>
2878      <text string="7" state="1">
2879         <color red="1.0" green="1.0" blue="1.0" />
2880         <bounds x="0" y="0.1" width="1" height="1" />
2881      </text>
2882      <text string="7" state="2">
2883         <color red="1.0" green="1.0" blue="1.0" />
2884         <bounds x="0" y="0.1" width="1" height="1" />
2885      </text>
2886      <text string="7" state="3">
2887         <color red="1.0" green="1.0" blue="1.0" />
2888         <bounds x="0" y="0.1" width="1" height="1" />
2889      </text>
2890      <text string="7" state="4">
2891         <color red="1.0" green="1.0" blue="1.0" />
2892         <bounds x="0" y="0.1" width="1" height="1" />
2893      </text>
2894      <text string="7" state="5">
2895         <color red="1.0" green="1.0" blue="1.0" />
2896         <bounds x="0" y="0.1" width="1" height="1" />
2897      </text>
2898      <text string="Melon" state="6">
2899         <color red="1.0" green="1.0" blue="1.0" />
2900         <bounds x="0" y="0.1" width="1" height="1" />
2901      </text>
2902      <text string="Melon" state="7">
2903         <color red="1.0" green="1.0" blue="1.0" />
2904         <bounds x="0" y="0.1" width="1" height="1" />
2905      </text>
2906      <text string="Melon" state="8">
2907         <color red="1.0" green="1.0" blue="1.0" />
2908         <bounds x="0" y="0.1" width="1" height="1" />
2909      </text>
2910      <text string="Melon" state="9">
2911         <color red="1.0" green="1.0" blue="1.0" />
2912         <bounds x="0" y="0.1" width="1" height="1" />
2913      </text>
2914      <text string="Melon" state="10">
2915         <color red="1.0" green="1.0" blue="1.0" />
2916         <bounds x="0" y="0.1" width="1" height="1" />
2917      </text>
2918      <text string="Melon" state="11">
2919         <color red="1.0" green="1.0" blue="1.0" />
2920         <bounds x="0" y="0.1" width="1" height="1" />
2921      </text>
2922      <text string="Bell" state="12">
2923         <color red="1.0" green="1.0" blue="1.0" />
2924         <bounds x="0" y="0.1" width="1" height="1" />
2925      </text>
2926      <text string="Bell" state="13">
2927         <color red="1.0" green="1.0" blue="1.0" />
2928         <bounds x="0" y="0.1" width="1" height="1" />
2929      </text>
2930      <text string="Bell" state="14">
2931         <color red="1.0" green="1.0" blue="1.0" />
2932         <bounds x="0" y="0.1" width="1" height="1" />
2933      </text>
2934      <text string="Bell" state="15">
2935         <color red="1.0" green="1.0" blue="1.0" />
2936         <bounds x="0" y="0.1" width="1" height="1" />
2937      </text>
2938      <text string="Bell" state="16">
2939         <color red="1.0" green="1.0" blue="1.0" />
2940         <bounds x="0" y="0.1" width="1" height="1" />
2941      </text>
2942      <text string="Bell" state="17">
2943         <color red="1.0" green="1.0" blue="1.0" />
2944         <bounds x="0" y="0.1" width="1" height="1" />
2945      </text>
2946      <text string="Cherry" state="18">
2947         <color red="1.0" green="1.0" blue="1.0" />
2948         <bounds x="0" y="0.1" width="1" height="1" />
2949      </text>
2950      <text string="Cherry" state="19">
2951         <color red="1.0" green="1.0" blue="1.0" />
2952         <bounds x="0" y="0.1" width="1" height="1" />
2953      </text>
2954      <text string="Cherry" state="20">
2955         <color red="1.0" green="1.0" blue="1.0" />
2956         <bounds x="0" y="0.1" width="1" height="1" />
2957      </text>
2958      <text string="Cherry" state="21">
2959         <color red="1.0" green="1.0" blue="1.0" />
2960         <bounds x="0" y="0.1" width="1" height="1" />
2961      </text>
2962      <text string="Cherry" state="22">
2963         <color red="1.0" green="1.0" blue="1.0" />
2964         <bounds x="0" y="0.1" width="1" height="1" />
2965      </text>
2966      <text string="Cherry" state="23">
2967         <color red="1.0" green="1.0" blue="1.0" />
2968         <bounds x="0" y="0.1" width="1" height="1" />
2969      </text>
2970      <text string="Bar" state="24">
2971         <color red="1.0" green="1.0" blue="1.0" />
2972         <bounds x="0" y="0.1" width="1" height="1" />
2973      </text>
2974      <text string="Bar" state="25">
2975         <color red="1.0" green="1.0" blue="1.0" />
2976         <bounds x="0" y="0.1" width="1" height="1" />
2977      </text>
2978      <text string="Bar" state="26">
2979         <color red="1.0" green="1.0" blue="1.0" />
2980         <bounds x="0" y="0.1" width="1" height="1" />
2981      </text>
2982      <text string="Bar" state="27">
2983         <color red="1.0" green="1.0" blue="1.0" />
2984         <bounds x="0" y="0.1" width="1" height="1" />
2985      </text>
2986      <text string="Bar" state="28">
2987         <color red="1.0" green="1.0" blue="1.0" />
2988         <bounds x="0" y="0.1" width="1" height="1" />
2989      </text>
2990      <text string="Bar" state="29">
2991         <color red="1.0" green="1.0" blue="1.0" />
2992         <bounds x="0" y="0.1" width="1" height="1" />
2993      </text>
2994      <text string="Bell" state="30">
2995         <color red="1.0" green="1.0" blue="1.0" />
2996         <bounds x="0" y="0.1" width="1" height="1" />
2997      </text>
2998      <text string="Bell" state="31">
2999         <color red="1.0" green="1.0" blue="1.0" />
3000         <bounds x="0" y="0.1" width="1" height="1" />
3001      </text>
3002      <text string="Bell" state="32">
3003         <color red="1.0" green="1.0" blue="1.0" />
3004         <bounds x="0" y="0.1" width="1" height="1" />
3005      </text>
3006      <text string="Bell" state="33">
3007         <color red="1.0" green="1.0" blue="1.0" />
3008         <bounds x="0" y="0.1" width="1" height="1" />
3009      </text>
3010      <text string="Bell" state="34">
3011         <color red="1.0" green="1.0" blue="1.0" />
3012         <bounds x="0" y="0.1" width="1" height="1" />
3013      </text>
3014      <text string="Bell" state="35">
3015         <color red="1.0" green="1.0" blue="1.0" />
3016         <bounds x="0" y="0.1" width="1" height="1" />
3017      </text>
3018      <text string="Melon" state="36">
3019         <color red="1.0" green="1.0" blue="1.0" />
3020         <bounds x="0" y="0.1" width="1" height="1" />
3021      </text>
3022      <text string="Melon" state="37">
3023         <color red="1.0" green="1.0" blue="1.0" />
3024         <bounds x="0" y="0.1" width="1" height="1" />
3025      </text>
3026      <text string="Melon" state="38">
3027         <color red="1.0" green="1.0" blue="1.0" />
3028         <bounds x="0" y="0.1" width="1" height="1" />
3029      </text>
3030      <text string="Melon" state="39">
3031         <color red="1.0" green="1.0" blue="1.0" />
3032         <bounds x="0" y="0.1" width="1" height="1" />
3033      </text>
3034      <text string="Melon" state="40">
3035         <color red="1.0" green="1.0" blue="1.0" />
3036         <bounds x="0" y="0.1" width="1" height="1" />
3037      </text>
3038      <text string="Melon" state="41">
3039         <color red="1.0" green="1.0" blue="1.0" />
3040         <bounds x="0" y="0.1" width="1" height="1" />
3041      </text>
3042      <text string="Bar" state="42">
3043         <color red="1.0" green="1.0" blue="1.0" />
3044         <bounds x="0" y="0.1" width="1" height="1" />
3045      </text>
3046      <text string="Bar" state="43">
3047         <color red="1.0" green="1.0" blue="1.0" />
3048         <bounds x="0" y="0.1" width="1" height="1" />
3049      </text>
3050      <text string="Bar" state="44">
3051         <color red="1.0" green="1.0" blue="1.0" />
3052         <bounds x="0" y="0.1" width="1" height="1" />
3053      </text>
3054      <text string="Bar" state="45">
3055         <color red="1.0" green="1.0" blue="1.0" />
3056         <bounds x="0" y="0.1" width="1" height="1" />
3057      </text>
3058      <text string="Bar" state="46">
3059         <color red="1.0" green="1.0" blue="1.0" />
3060         <bounds x="0" y="0.1" width="1" height="1" />
3061      </text>
3062      <text string="Bar" state="47">
3063         <color red="1.0" green="1.0" blue="1.0" />
3064         <bounds x="0" y="0.1" width="1" height="1" />
3065      </text>
3066      <text string="Cherry" state="48">
3067         <color red="1.0" green="1.0" blue="1.0" />
3068         <bounds x="0" y="0.1" width="1" height="1" />
3069      </text>
3070      <text string="Cherry" state="49">
3071         <color red="1.0" green="1.0" blue="1.0" />
3072         <bounds x="0" y="0.1" width="1" height="1" />
3073      </text>
3074      <text string="Cherry" state="50">
3075         <color red="1.0" green="1.0" blue="1.0" />
3076         <bounds x="0" y="0.1" width="1" height="1" />
3077      </text>
3078      <text string="Cherry" state="51">
3079         <color red="1.0" green="1.0" blue="1.0" />
3080         <bounds x="0" y="0.1" width="1" height="1" />
3081      </text>
3082      <text string="Cherry" state="52">
3083         <color red="1.0" green="1.0" blue="1.0" />
3084         <bounds x="0" y="0.1" width="1" height="1" />
3085      </text>
3086      <text string="Cherry" state="53">
3087         <color red="1.0" green="1.0" blue="1.0" />
3088         <bounds x="0" y="0.1" width="1" height="1" />
3089      </text>
3090      <text string="7" state="54">
3091         <color red="1.0" green="1.0" blue="1.0" />
3092         <bounds x="0" y="0.1" width="1" height="1" />
3093      </text>
3094      <text string="7" state="55">
3095         <color red="1.0" green="1.0" blue="1.0" />
3096         <bounds x="0" y="0.1" width="1" height="1" />
3097      </text>
3098      <text string="7" state="56">
3099         <color red="1.0" green="1.0" blue="1.0" />
3100         <bounds x="0" y="0.1" width="1" height="1" />
3101      </text>
3102      <text string="7" state="57">
3103         <color red="1.0" green="1.0" blue="1.0" />
3104         <bounds x="0" y="0.1" width="1" height="1" />
3105      </text>
3106      <text string="7" state="58">
3107         <color red="1.0" green="1.0" blue="1.0" />
3108         <bounds x="0" y="0.1" width="1" height="1" />
3109      </text>
3110      <text string="7" state="59">
3111         <color red="1.0" green="1.0" blue="1.0" />
3112         <bounds x="0" y="0.1" width="1" height="1" />
3113      </text>
3114      <text string="Melon" state="60">
3115         <color red="1.0" green="1.0" blue="1.0" />
3116         <bounds x="0" y="0.1" width="1" height="1" />
3117      </text>
3118      <text string="Melon" state="61">
3119         <color red="1.0" green="1.0" blue="1.0" />
3120         <bounds x="0" y="0.1" width="1" height="1" />
3121      </text>
3122      <text string="Melon" state="62">
3123         <color red="1.0" green="1.0" blue="1.0" />
3124         <bounds x="0" y="0.1" width="1" height="1" />
3125      </text>
3126      <text string="Melon" state="63">
3127         <color red="1.0" green="1.0" blue="1.0" />
3128         <bounds x="0" y="0.1" width="1" height="1" />
3129      </text>
3130      <text string="Melon" state="64">
3131         <color red="1.0" green="1.0" blue="1.0" />
3132         <bounds x="0" y="0.1" width="1" height="1" />
3133      </text>
3134      <text string="Melon" state="65">
3135         <color red="1.0" green="1.0" blue="1.0" />
3136         <bounds x="0" y="0.1" width="1" height="1" />
3137      </text>
3138      <text string="Bar" state="66">
3139         <color red="1.0" green="1.0" blue="1.0" />
3140         <bounds x="0" y="0.1" width="1" height="1" />
3141      </text>
3142      <text string="Bar" state="67">
3143         <color red="1.0" green="1.0" blue="1.0" />
3144         <bounds x="0" y="0.1" width="1" height="1" />
3145      </text>
3146      <text string="Bar" state="68">
3147         <color red="1.0" green="1.0" blue="1.0" />
3148         <bounds x="0" y="0.1" width="1" height="1" />
3149      </text>
3150      <text string="Bar" state="69">
3151         <color red="1.0" green="1.0" blue="1.0" />
3152         <bounds x="0" y="0.1" width="1" height="1" />
3153      </text>
3154      <text string="Bar" state="70">
3155         <color red="1.0" green="1.0" blue="1.0" />
3156         <bounds x="0" y="0.1" width="1" height="1" />
3157      </text>
3158      <text string="Bar" state="71">
3159         <color red="1.0" green="1.0" blue="1.0" />
3160         <bounds x="0" y="0.1" width="1" height="1" />
3161      </text>
3162      <text string="Cherry" state="72">
3163         <color red="1.0" green="1.0" blue="1.0" />
3164         <bounds x="0" y="0.1" width="1" height="1" />
3165      </text>
3166      <text string="Cherry" state="73">
3167         <color red="1.0" green="1.0" blue="1.0" />
3168         <bounds x="0" y="0.1" width="1" height="1" />
3169      </text>
3170      <text string="Cherry" state="74">
3171         <color red="1.0" green="1.0" blue="1.0" />
3172         <bounds x="0" y="0.1" width="1" height="1" />
3173      </text>
3174      <text string="Cherry" state="75">
3175         <color red="1.0" green="1.0" blue="1.0" />
3176         <bounds x="0" y="0.1" width="1" height="1" />
3177      </text>
3178      <text string="Cherry" state="76">
3179         <color red="1.0" green="1.0" blue="1.0" />
3180         <bounds x="0" y="0.1" width="1" height="1" />
3181      </text>
3182      <text string="Cherry" state="77">
3183         <color red="1.0" green="1.0" blue="1.0" />
3184         <bounds x="0" y="0.1" width="1" height="1" />
3185      </text>
3186      <text string="Melon" state="78">
3187         <color red="1.0" green="1.0" blue="1.0" />
3188         <bounds x="0" y="0.1" width="1" height="1" />
3189      </text>
3190      <text string="Melon" state="79">
3191         <color red="1.0" green="1.0" blue="1.0" />
3192         <bounds x="0" y="0.1" width="1" height="1" />
3193      </text>
3194      <text string="Melon" state="80">
3195         <color red="1.0" green="1.0" blue="1.0" />
3196         <bounds x="0" y="0.1" width="1" height="1" />
3197      </text>
3198      <text string="Melon" state="81">
3199         <color red="1.0" green="1.0" blue="1.0" />
3200         <bounds x="0" y="0.1" width="1" height="1" />
3201      </text>
3202      <text string="Melon" state="82">
3203         <color red="1.0" green="1.0" blue="1.0" />
3204         <bounds x="0" y="0.1" width="1" height="1" />
3205      </text>
3206      <text string="Melon" state="83">
3207         <color red="1.0" green="1.0" blue="1.0" />
3208         <bounds x="0" y="0.1" width="1" height="1" />
3209      </text>
3210      <text string="Cherry" state="84">
3211         <color red="1.0" green="1.0" blue="1.0" />
3212         <bounds x="0" y="0.1" width="1" height="1" />
3213      </text>
3214      <text string="Cherry" state="85">
3215         <color red="1.0" green="1.0" blue="1.0" />
3216         <bounds x="0" y="0.1" width="1" height="1" />
3217      </text>
3218      <text string="Cherry" state="86">
3219         <color red="1.0" green="1.0" blue="1.0" />
3220         <bounds x="0" y="0.1" width="1" height="1" />
3221      </text>
3222      <text string="Cherry" state="87">
3223         <color red="1.0" green="1.0" blue="1.0" />
3224         <bounds x="0" y="0.1" width="1" height="1" />
3225      </text>
3226      <text string="Cherry" state="88">
3227         <color red="1.0" green="1.0" blue="1.0" />
3228         <bounds x="0" y="0.1" width="1" height="1" />
3229      </text>
3230      <text string="Cherry" state="89">
3231         <color red="1.0" green="1.0" blue="1.0" />
3232         <bounds x="0" y="0.1" width="1" height="1" />
3233      </text>
3234      <text string="Bell" state="90">
3235         <color red="1.0" green="1.0" blue="1.0" />
3236         <bounds x="0" y="0.1" width="1" height="1" />
3237      </text>
3238      <text string="Bell" state="91">
3239         <color red="1.0" green="1.0" blue="1.0" />
3240         <bounds x="0" y="0.1" width="1" height="1" />
3241      </text>
3242      <text string="Bell" state="92">
3243         <color red="1.0" green="1.0" blue="1.0" />
3244         <bounds x="0" y="0.1" width="1" height="1" />
3245      </text>
3246      <text string="Bell" state="93">
3247         <color red="1.0" green="1.0" blue="1.0" />
3248         <bounds x="0" y="0.1" width="1" height="1" />
3249      </text>
3250      <text string="Bell" state="94">
3251         <color red="1.0" green="1.0" blue="1.0" />
3252         <bounds x="0" y="0.1" width="1" height="1" />
3253      </text>
3254      <text string="Bell" state="95">
3255         <color red="1.0" green="1.0" blue="1.0" />
3256         <bounds x="0" y="0.1" width="1" height="1" />
3257      </text>
3258   </element>
3259
3260   <element name="Reel4" defstate="96">
3261      <text string="Bell" state="0">
3262         <color red="1.0" green="1.0" blue="1.0" />
3263         <bounds x="0" y="0.1" width="1" height="1" />
3264      </text>
3265      <text string="Bell" state="1">
3266         <color red="1.0" green="1.0" blue="1.0" />
3267         <bounds x="0" y="0.1" width="1" height="1" />
3268      </text>
3269      <text string="Bell" state="2">
3270         <color red="1.0" green="1.0" blue="1.0" />
3271         <bounds x="0" y="0.1" width="1" height="1" />
3272      </text>
3273      <text string="Bell" state="3">
3274         <color red="1.0" green="1.0" blue="1.0" />
3275         <bounds x="0" y="0.1" width="1" height="1" />
3276      </text>
3277      <text string="Bell" state="4">
3278         <color red="1.0" green="1.0" blue="1.0" />
3279         <bounds x="0" y="0.1" width="1" height="1" />
3280      </text>
3281      <text string="Bell" state="5">
3282         <color red="1.0" green="1.0" blue="1.0" />
3283         <bounds x="0" y="0.1" width="1" height="1" />
3284      </text>
3285      <text string="7" state="6">
3286         <color red="1.0" green="1.0" blue="1.0" />
3287         <bounds x="0" y="0.1" width="1" height="1" />
3288      </text>
3289      <text string="7" state="7">
3290         <color red="1.0" green="1.0" blue="1.0" />
3291         <bounds x="0" y="0.1" width="1" height="1" />
3292      </text>
3293      <text string="7" state="8">
3294         <color red="1.0" green="1.0" blue="1.0" />
3295         <bounds x="0" y="0.1" width="1" height="1" />
3296      </text>
3297      <text string="7" state="9">
3298         <color red="1.0" green="1.0" blue="1.0" />
3299         <bounds x="0" y="0.1" width="1" height="1" />
3300      </text>
3301      <text string="7" state="10">
3302         <color red="1.0" green="1.0" blue="1.0" />
3303         <bounds x="0" y="0.1" width="1" height="1" />
3304      </text>
3305      <text string="7" state="11">
3306         <color red="1.0" green="1.0" blue="1.0" />
3307         <bounds x="0" y="0.1" width="1" height="1" />
3308      </text>
3309      <text string="Bell" state="12">
3310         <color red="1.0" green="1.0" blue="1.0" />
3311         <bounds x="0" y="0.1" width="1" height="1" />
3312      </text>
3313      <text string="Bell" state="13">
3314         <color red="1.0" green="1.0" blue="1.0" />
3315         <bounds x="0" y="0.1" width="1" height="1" />
3316      </text>
3317      <text string="Bell" state="14">
3318         <color red="1.0" green="1.0" blue="1.0" />
3319         <bounds x="0" y="0.1" width="1" height="1" />
3320      </text>
3321      <text string="Bell" state="15">
3322         <color red="1.0" green="1.0" blue="1.0" />
3323         <bounds x="0" y="0.1" width="1" height="1" />
3324      </text>
3325      <text string="Bell" state="16">
3326         <color red="1.0" green="1.0" blue="1.0" />
3327         <bounds x="0" y="0.1" width="1" height="1" />
3328      </text>
3329      <text string="Bell" state="17">
3330         <color red="1.0" green="1.0" blue="1.0" />
3331         <bounds x="0" y="0.1" width="1" height="1" />
3332      </text>
3333      <text string="Bar" state="18">
3334         <color red="1.0" green="1.0" blue="1.0" />
3335         <bounds x="0" y="0.1" width="1" height="1" />
3336      </text>
3337      <text string="Bar" state="19">
3338         <color red="1.0" green="1.0" blue="1.0" />
3339         <bounds x="0" y="0.1" width="1" height="1" />
3340      </text>
3341      <text string="Bar" state="20">
3342         <color red="1.0" green="1.0" blue="1.0" />
3343         <bounds x="0" y="0.1" width="1" height="1" />
3344      </text>
3345      <text string="Bar" state="21">
3346         <color red="1.0" green="1.0" blue="1.0" />
3347         <bounds x="0" y="0.1" width="1" height="1" />
3348      </text>
3349      <text string="Bar" state="22">
3350         <color red="1.0" green="1.0" blue="1.0" />
3351         <bounds x="0" y="0.1" width="1" height="1" />
3352      </text>
3353      <text string="Bar" state="23">
3354         <color red="1.0" green="1.0" blue="1.0" />
3355         <bounds x="0" y="0.1" width="1" height="1" />
3356      </text>
3357      <text string="7" state="24">
3358         <color red="1.0" green="1.0" blue="1.0" />
3359         <bounds x="0" y="0.1" width="1" height="1" />
3360      </text>
3361      <text string="7" state="25">
3362         <color red="1.0" green="1.0" blue="1.0" />
3363         <bounds x="0" y="0.1" width="1" height="1" />
3364      </text>
3365      <text string="7" state="26">
3366         <color red="1.0" green="1.0" blue="1.0" />
3367         <bounds x="0" y="0.1" width="1" height="1" />
3368      </text>
3369      <text string="7" state="27">
3370         <color red="1.0" green="1.0" blue="1.0" />
3371         <bounds x="0" y="0.1" width="1" height="1" />
3372      </text>
3373      <text string="7" state="28">
3374         <color red="1.0" green="1.0" blue="1.0" />
3375         <bounds x="0" y="0.1" width="1" height="1" />
3376      </text>
3377      <text string="7" state="29">
3378         <color red="1.0" green="1.0" blue="1.0" />
3379         <bounds x="0" y="0.1" width="1" height="1" />
3380      </text>
3381      <text string="Cherry" state="30">
3382         <color red="1.0" green="1.0" blue="1.0" />
3383         <bounds x="0" y="0.1" width="1" height="1" />
3384      </text>
3385      <text string="Cherry" state="31">
3386         <color red="1.0" green="1.0" blue="1.0" />
3387         <bounds x="0" y="0.1" width="1" height="1" />
3388      </text>
3389      <text string="Cherry" state="32">
3390         <color red="1.0" green="1.0" blue="1.0" />
3391         <bounds x="0" y="0.1" width="1" height="1" />
3392      </text>
3393      <text string="Cherry" state="33">
3394         <color red="1.0" green="1.0" blue="1.0" />
3395         <bounds x="0" y="0.1" width="1" height="1" />
3396      </text>
3397      <text string="Cherry" state="34">
3398         <color red="1.0" green="1.0" blue="1.0" />
3399         <bounds x="0" y="0.1" width="1" height="1" />
3400      </text>
3401      <text string="Cherry" state="35">
3402         <color red="1.0" green="1.0" blue="1.0" />
3403         <bounds x="0" y="0.1" width="1" height="1" />
3404      </text>
3405      <text string="Melon" state="36">
3406         <color red="1.0" green="1.0" blue="1.0" />
3407         <bounds x="0" y="0.1" width="1" height="1" />
3408      </text>
3409      <text string="Melon" state="37">
3410         <color red="1.0" green="1.0" blue="1.0" />
3411         <bounds x="0" y="0.1" width="1" height="1" />
3412      </text>
3413      <text string="Melon" state="38">
3414         <color red="1.0" green="1.0" blue="1.0" />
3415         <bounds x="0" y="0.1" width="1" height="1" />
3416      </text>
3417      <text string="Melon" state="39">
3418         <color red="1.0" green="1.0" blue="1.0" />
3419         <bounds x="0" y="0.1" width="1" height="1" />
3420      </text>
3421      <text string="Melon" state="40">
3422         <color red="1.0" green="1.0" blue="1.0" />
3423         <bounds x="0" y="0.1" width="1" height="1" />
3424      </text>
3425      <text string="Melon" state="41">
3426         <color red="1.0" green="1.0" blue="1.0" />
3427         <bounds x="0" y="0.1" width="1" height="1" />
3428      </text>
3429      <text string="Bell" state="42">
3430         <color red="1.0" green="1.0" blue="1.0" />
3431         <bounds x="0" y="0.1" width="1" height="1" />
3432      </text>
3433      <text string="Bell" state="43">
3434         <color red="1.0" green="1.0" blue="1.0" />
3435         <bounds x="0" y="0.1" width="1" height="1" />
3436      </text>
3437      <text string="Bell" state="44">
3438         <color red="1.0" green="1.0" blue="1.0" />
3439         <bounds x="0" y="0.1" width="1" height="1" />
3440      </text>
3441      <text string="Bell" state="45">
3442         <color red="1.0" green="1.0" blue="1.0" />
3443         <bounds x="0" y="0.1" width="1" height="1" />
3444      </text>
3445      <text string="Bell" state="46">
3446         <color red="1.0" green="1.0" blue="1.0" />
3447         <bounds x="0" y="0.1" width="1" height="1" />
3448      </text>
3449      <text string="Bell" state="47">
3450         <color red="1.0" green="1.0" blue="1.0" />
3451         <bounds x="0" y="0.1" width="1" height="1" />
3452      </text>
3453      <text string="Cherry" state="48">
3454         <color red="1.0" green="1.0" blue="1.0" />
3455         <bounds x="0" y="0.1" width="1" height="1" />
3456      </text>
3457      <text string="Cherry" state="49">
3458         <color red="1.0" green="1.0" blue="1.0" />
3459         <bounds x="0" y="0.1" width="1" height="1" />
3460      </text>
3461      <text string="Cherry" state="50">
3462         <color red="1.0" green="1.0" blue="1.0" />
3463         <bounds x="0" y="0.1" width="1" height="1" />
3464      </text>
3465      <text string="Cherry" state="51">
3466         <color red="1.0" green="1.0" blue="1.0" />
3467         <bounds x="0" y="0.1" width="1" height="1" />
3468      </text>
3469      <text string="Cherry" state="52">
3470         <color red="1.0" green="1.0" blue="1.0" />
3471         <bounds x="0" y="0.1" width="1" height="1" />
3472      </text>
3473      <text string="Cherry" state="53">
3474         <color red="1.0" green="1.0" blue="1.0" />
3475         <bounds x="0" y="0.1" width="1" height="1" />
3476      </text>
3477      <text string="Bar" state="54">
3478         <color red="1.0" green="1.0" blue="1.0" />
3479         <bounds x="0" y="0.1" width="1" height="1" />
3480      </text>
3481      <text string="Bar" state="55">
3482         <color red="1.0" green="1.0" blue="1.0" />
3483         <bounds x="0" y="0.1" width="1" height="1" />
3484      </text>
3485      <text string="Bar" state="56">
3486         <color red="1.0" green="1.0" blue="1.0" />
3487         <bounds x="0" y="0.1" width="1" height="1" />
3488      </text>
3489      <text string="Bar" state="57">
3490         <color red="1.0" green="1.0" blue="1.0" />
3491         <bounds x="0" y="0.1" width="1" height="1" />
3492      </text>
3493      <text string="Bar" state="58">
3494         <color red="1.0" green="1.0" blue="1.0" />
3495         <bounds x="0" y="0.1" width="1" height="1" />
3496      </text>
3497      <text string="Bar" state="59">
3498         <color red="1.0" green="1.0" blue="1.0" />
3499         <bounds x="0" y="0.1" width="1" height="1" />
3500      </text>
3501      <text string="7" state="60">
3502         <color red="1.0" green="1.0" blue="1.0" />
3503         <bounds x="0" y="0.1" width="1" height="1" />
3504      </text>
3505      <text string="7" state="61">
3506         <color red="1.0" green="1.0" blue="1.0" />
3507         <bounds x="0" y="0.1" width="1" height="1" />
3508      </text>
3509      <text string="7" state="62">
3510         <color red="1.0" green="1.0" blue="1.0" />
3511         <bounds x="0" y="0.1" width="1" height="1" />
3512      </text>
3513      <text string="7" state="63">
3514         <color red="1.0" green="1.0" blue="1.0" />
3515         <bounds x="0" y="0.1" width="1" height="1" />
3516      </text>
3517      <text string="7" state="64">
3518         <color red="1.0" green="1.0" blue="1.0" />
3519         <bounds x="0" y="0.1" width="1" height="1" />
3520      </text>
3521      <text string="7" state="65">
3522         <color red="1.0" green="1.0" blue="1.0" />
3523         <bounds x="0" y="0.1" width="1" height="1" />
3524      </text>
3525      <text string="Melon" state="66">
3526         <color red="1.0" green="1.0" blue="1.0" />
3527         <bounds x="0" y="0.1" width="1" height="1" />
3528      </text>
3529      <text string="Melon" state="67">
3530         <color red="1.0" green="1.0" blue="1.0" />
3531         <bounds x="0" y="0.1" width="1" height="1" />
3532      </text>
3533      <text string="Melon" state="68">
3534         <color red="1.0" green="1.0" blue="1.0" />
3535         <bounds x="0" y="0.1" width="1" height="1" />
3536      </text>
3537      <text string="Melon" state="69">
3538         <color red="1.0" green="1.0" blue="1.0" />
3539         <bounds x="0" y="0.1" width="1" height="1" />
3540      </text>
3541      <text string="Melon" state="70">
3542         <color red="1.0" green="1.0" blue="1.0" />
3543         <bounds x="0" y="0.1" width="1" height="1" />
3544      </text>
3545      <text string="Melon" state="71">
3546         <color red="1.0" green="1.0" blue="1.0" />
3547         <bounds x="0" y="0.1" width="1" height="1" />
3548      </text>
3549      <text string="Cherry" state="72">
3550         <color red="1.0" green="1.0" blue="1.0" />
3551         <bounds x="0" y="0.1" width="1" height="1" />
3552      </text>
3553      <text string="Cherry" state="73">
3554         <color red="1.0" green="1.0" blue="1.0" />
3555         <bounds x="0" y="0.1" width="1" height="1" />
3556      </text>
3557      <text string="Cherry" state="74">
3558         <color red="1.0" green="1.0" blue="1.0" />
3559         <bounds x="0" y="0.1" width="1" height="1" />
3560      </text>
3561      <text string="Cherry" state="75">
3562         <color red="1.0" green="1.0" blue="1.0" />
3563         <bounds x="0" y="0.1" width="1" height="1" />
3564      </text>
3565      <text string="Cherry" state="76">
3566         <color red="1.0" green="1.0" blue="1.0" />
3567         <bounds x="0" y="0.1" width="1" height="1" />
3568      </text>
3569      <text string="Cherry" state="77">
3570         <color red="1.0" green="1.0" blue="1.0" />
3571         <bounds x="0" y="0.1" width="1" height="1" />
3572      </text>
3573      <text string="Bell" state="78">
3574         <color red="1.0" green="1.0" blue="1.0" />
3575         <bounds x="0" y="0.1" width="1" height="1" />
3576      </text>
3577      <text string="Bell" state="79">
3578         <color red="1.0" green="1.0" blue="1.0" />
3579         <bounds x="0" y="0.1" width="1" height="1" />
3580      </text>
3581      <text string="Bell" state="80">
3582         <color red="1.0" green="1.0" blue="1.0" />
3583         <bounds x="0" y="0.1" width="1" height="1" />
3584      </text>
3585      <text string="Bell" state="81">
3586         <color red="1.0" green="1.0" blue="1.0" />
3587         <bounds x="0" y="0.1" width="1" height="1" />
3588      </text>
3589      <text string="Bell" state="82">
3590         <color red="1.0" green="1.0" blue="1.0" />
3591         <bounds x="0" y="0.1" width="1" height="1" />
3592      </text>
3593      <text string="Bell" state="83">
3594         <color red="1.0" green="1.0" blue="1.0" />
3595         <bounds x="0" y="0.1" width="1" height="1" />
3596      </text>
3597      <text string="Bar" state="84">
3598         <color red="1.0" green="1.0" blue="1.0" />
3599         <bounds x="0" y="0.1" width="1" height="1" />
3600      </text>
3601      <text string="Bar" state="85">
3602         <color red="1.0" green="1.0" blue="1.0" />
3603         <bounds x="0" y="0.1" width="1" height="1" />
3604      </text>
3605      <text string="Bar" state="86">
3606         <color red="1.0" green="1.0" blue="1.0" />
3607         <bounds x="0" y="0.1" width="1" height="1" />
3608      </text>
3609      <text string="Bar" state="87">
3610         <color red="1.0" green="1.0" blue="1.0" />
3611         <bounds x="0" y="0.1" width="1" height="1" />
3612      </text>
3613      <text string="Bar" state="88">
3614         <color red="1.0" green="1.0" blue="1.0" />
3615         <bounds x="0" y="0.1" width="1" height="1" />
3616      </text>
3617      <text string="Bar" state="89">
3618         <color red="1.0" green="1.0" blue="1.0" />
3619         <bounds x="0" y="0.1" width="1" height="1" />
3620      </text>
3621      <text string="Melon" state="90">
3622         <color red="1.0" green="1.0" blue="1.0" />
3623         <bounds x="0" y="0.1" width="1" height="1" />
3624      </text>
3625      <text string="Melon" state="91">
3626         <color red="1.0" green="1.0" blue="1.0" />
3627         <bounds x="0" y="0.1" width="1" height="1" />
3628      </text>
3629      <text string="Melon" state="92">
3630         <color red="1.0" green="1.0" blue="1.0" />
3631         <bounds x="0" y="0.1" width="1" height="1" />
3632      </text>
3633      <text string="Melon" state="93">
3634         <color red="1.0" green="1.0" blue="1.0" />
3635         <bounds x="0" y="0.1" width="1" height="1" />
3636      </text>
3637      <text string="Melon" state="94">
3638         <color red="1.0" green="1.0" blue="1.0" />
3639         <bounds x="0" y="0.1" width="1" height="1" />
3640      </text>
3641      <text string="Melon" state="95">
3642         <color red="1.0" green="1.0" blue="1.0" />
3643         <bounds x="0" y="0.1" width="1" height="1" />
3644      </text>
3645   </element>
3646   <element name="vfd0">
3647   <led16segsc>
3648         <color red="0" green="0.6" blue="1.0" />
3649   </led16segsc>
3650   </element>
3651
3652   <view name="Gamball AWP Simulated Video (No Artwork)">
3653      <backdrop name="TotalReels" element="TotalReels"/>
3654      <backdrop name="ReelSteps1" element="ReelSteps1"/>
3655      <backdrop name="ReelSteps2" element="ReelSteps2"/>
3656      <backdrop name="ReelSteps3" element="ReelSteps2"/>
3657      <backdrop name="ReelSteps4" element="ReelSteps2"/>
3658      <backdrop name="ReelSymbols1" element="ReelSymbols1"/>
3659      <backdrop name="ReelSymbols2" element="ReelSymbols1"/>
3660      <backdrop name="ReelSymbols3" element="ReelSymbols1"/>
3661      <backdrop name="ReelSymbols4" element="ReelSymbols1"/>
3662      <backdrop name="reel1a1" element="Reel1" state="96">
3663         <bounds x="85" y="463" width="49" height="29.3333"/>
3664      </backdrop>
3665      <backdrop name="reel1" element="Reel1" state="96">
3666         <bounds x="85" y="491.3333" width="49" height="29.3333"/>
3667      </backdrop>
3668      <backdrop name="reel1b1" element="Reel1" state="96">
3669         <bounds x="85" y="520.6666" width="49" height="29.3333"/>
3670      </backdrop>
3671      <backdrop name="reel2a1" element="Reel2" state="96">
3672         <bounds x="161" y="463" width="49" height="29.3333"/>
3673      </backdrop>
3674      <backdrop name="reel2" element="Reel2" state="96">
3675         <bounds x="161" y="491.3333" width="49" height="29.3333"/>
3676      </backdrop>
3677      <backdrop name="reel2b1" element="Reel2" state="96">
3678         <bounds x="161" y="520.6666" width="49" height="29.3333"/>
3679      </backdrop>
3680      <backdrop name="reel3a1" element="Reel3" state="96">
3681         <bounds x="236" y="463" width="49" height="29.3333"/>
3682      </backdrop>
3683      <backdrop name="reel3" element="Reel3" state="96">
3684         <bounds x="236" y="491.3333" width="49" height="29.3333"/>
3685      </backdrop>
3686      <backdrop name="reel3b1" element="Reel3" state="96">
3687         <bounds x="236" y="520.6666" width="49" height="29.3333"/>
3688      </backdrop>
3689      <backdrop name="reel4a1" element="Reel4" state="96">
3690         <bounds x="311" y="463" width="49" height="29.3333"/>
3691      </backdrop>
3692      <backdrop name="reel4" element="Reel4" state="96">
3693         <bounds x="311" y="491.3333" width="49" height="29.3333"/>
3694      </backdrop>
3695      <backdrop name="reel4b1" element="Reel4" state="96">
3696         <bounds x="311" y="520.6666" width="49" height="29.3333"/>
3697      </backdrop>
3698      <backdrop name="lamp0" element="matrixlamp" state="0">
3699         <bounds x="0" y="0" width="7" height="7"/>
3700      </backdrop>
3701      <backdrop name="lamp1" element="matrixlamp" state="0">
3702         <bounds x="0" y="8" width="7" height="7"/>
3703      </backdrop>
3704      <backdrop name="lamp2" element="matrixlamp" state="0">
3705         <bounds x="0" y="16" width="7" height="7"/>
3706      </backdrop>
3707      <backdrop name="lamp3" element="matrixlamp" state="0">
3708         <bounds x="0" y="24" width="7" height="7"/>
3709      </backdrop>
3710      <backdrop name="lamp4" element="matrixlamp" state="0">
3711         <bounds x="0" y="32" width="7" height="7"/>
3712      </backdrop>
3713      <backdrop name="lamp5" element="matrixlamp" state="0">
3714         <bounds x="0" y="40" width="7" height="7"/>
3715      </backdrop>
3716      <backdrop name="lamp6" element="matrixlamp" state="0">
3717         <bounds x="0" y="48" width="7" height="7"/>
3718      </backdrop>
3719      <backdrop name="lamp7" element="matrixlamp" state="0">
3720         <bounds x="0" y="56" width="7" height="7"/>
3721      </backdrop>
3722      <backdrop name="lamp8" element="matrixlamp" state="0">
3723         <bounds x="8" y="0" width="7" height="7"/>
3724      </backdrop>
3725      <backdrop name="lamp9" element="matrixlamp" state="0">
3726         <bounds x="8" y="8" width="7" height="7"/>
3727      </backdrop>
3728      <backdrop name="lamp10" element="matrixlamp" state="0">
3729         <bounds x="8" y="16" width="7" height="7"/>
3730      </backdrop>
3731      <backdrop name="lamp11" element="matrixlamp" state="0">
3732         <bounds x="8" y="24" width="7" height="7"/>
3733      </backdrop>
3734      <backdrop name="lamp12" element="matrixlamp" state="0">
3735         <bounds x="8" y="32" width="7" height="7"/>
3736      </backdrop>
3737      <backdrop name="lamp13" element="matrixlamp" state="0">
3738         <bounds x="8" y="40" width="7" height="7"/>
3739      </backdrop>
3740      <backdrop name="lamp14" element="matrixlamp" state="0">
3741         <bounds x="8" y="48" width="7" height="7"/>
3742      </backdrop>
3743      <backdrop name="lamp15" element="matrixlamp" state="0">
3744         <bounds x="8" y="56" width="7" height="7"/>
3745      </backdrop>
3746      <backdrop name="lamp16" element="matrixlamp" state="0">
3747         <bounds x="16" y="0" width="7" height="7"/>
3748      </backdrop>
3749      <backdrop name="lamp17" element="matrixlamp" state="0">
3750         <bounds x="16" y="8" width="7" height="7"/>
3751      </backdrop>
3752      <backdrop name="lamp18" element="matrixlamp" state="0">
3753         <bounds x="16" y="16" width="7" height="7"/>
3754      </backdrop>
3755      <backdrop name="lamp19" element="matrixlamp" state="0">
3756         <bounds x="16" y="24" width="7" height="7"/>
3757      </backdrop>
3758      <backdrop name="lamp20" element="matrixlamp" state="0">
3759         <bounds x="16" y="32" width="7" height="7"/>
3760      </backdrop>
3761      <backdrop name="lamp21" element="matrixlamp" state="0">
3762         <bounds x="16" y="40" width="7" height="7"/>
3763      </backdrop>
3764      <backdrop name="lamp22" element="matrixlamp" state="0">
3765         <bounds x="16" y="48" width="7" height="7"/>
3766      </backdrop>
3767      <backdrop name="lamp23" element="matrixlamp" state="0">
3768         <bounds x="16" y="56" width="7" height="7"/>
3769      </backdrop>
3770      <backdrop name="lamp24" element="matrixlamp" state="0">
3771         <bounds x="24" y="0" width="7" height="7"/>
3772      </backdrop>
3773      <backdrop name="lamp25" element="matrixlamp" state="0">
3774         <bounds x="24" y="8" width="7" height="7"/>
3775      </backdrop>
3776      <backdrop name="lamp26" element="matrixlamp" state="0">
3777         <bounds x="24" y="16" width="7" height="7"/>
3778      </backdrop>
3779      <backdrop name="lamp27" element="matrixlamp" state="0">
3780         <bounds x="24" y="24" width="7" height="7"/>
3781      </backdrop>
3782      <backdrop name="lamp28" element="matrixlamp" state="0">
3783         <bounds x="24" y="32" width="7" height="7"/>
3784      </backdrop>
3785      <backdrop name="lamp29" element="matrixlamp" state="0">
3786         <bounds x="24" y="40" width="7" height="7"/>
3787      </backdrop>
3788      <backdrop name="lamp30" element="matrixlamp" state="0">
3789         <bounds x="24" y="48" width="7" height="7"/>
3790      </backdrop>
3791      <backdrop name="lamp31" element="matrixlamp" state="0">
3792         <bounds x="24" y="56" width="7" height="7"/>
3793      </backdrop>
3794      <backdrop name="lamp32" element="matrixlamp" state="0">
3795         <bounds x="32" y="0" width="7" height="7"/>
3796      </backdrop>
3797      <backdrop name="lamp33" element="matrixlamp" state="0">
3798         <bounds x="32" y="8" width="7" height="7"/>
3799      </backdrop>
3800      <backdrop name="lamp34" element="matrixlamp" state="0">
3801         <bounds x="32" y="16" width="7" height="7"/>
3802      </backdrop>
3803      <backdrop name="lamp35" element="matrixlamp" state="0">
3804         <bounds x="32" y="24" width="7" height="7"/>
3805      </backdrop>
3806      <backdrop name="lamp36" element="matrixlamp" state="0">
3807         <bounds x="32" y="32" width="7" height="7"/>
3808      </backdrop>
3809      <backdrop name="lamp37" element="matrixlamp" state="0">
3810         <bounds x="32" y="40" width="7" height="7"/>
3811      </backdrop>
3812      <backdrop name="lamp38" element="matrixlamp" state="0">
3813         <bounds x="32" y="48" width="7" height="7"/>
3814      </backdrop>
3815      <backdrop name="lamp39" element="matrixlamp" state="0">
3816         <bounds x="32" y="56" width="7" height="7"/>
3817      </backdrop>
3818      <backdrop name="lamp40" element="matrixlamp" state="0">
3819         <bounds x="40" y="0" width="7" height="7"/>
3820      </backdrop>
3821      <backdrop name="lamp41" element="matrixlamp" state="0">
3822         <bounds x="40" y="8" width="7" height="7"/>
3823      </backdrop>
3824      <backdrop name="lamp42" element="matrixlamp" state="0">
3825         <bounds x="40" y="16" width="7" height="7"/>
3826      </backdrop>
3827      <backdrop name="lamp43" element="matrixlamp" state="0">
3828         <bounds x="40" y="24" width="7" height="7"/>
3829      </backdrop>
3830      <backdrop name="lamp44" element="matrixlamp" state="0">
3831         <bounds x="40" y="32" width="7" height="7"/>
3832      </backdrop>
3833      <backdrop name="lamp45" element="matrixlamp" state="0">
3834         <bounds x="40" y="40" width="7" height="7"/>
3835      </backdrop>
3836      <backdrop name="lamp46" element="matrixlamp" state="0">
3837         <bounds x="40" y="48" width="7" height="7"/>
3838      </backdrop>
3839      <backdrop name="lamp47" element="matrixlamp" state="0">
3840         <bounds x="40" y="56" width="7" height="7"/>
3841      </backdrop>
3842      <backdrop name="lamp48" element="matrixlamp" state="0">
3843         <bounds x="48" y="0" width="7" height="7"/>
3844      </backdrop>
3845      <backdrop name="lamp49" element="matrixlamp" state="0">
3846         <bounds x="48" y="8" width="7" height="7"/>
3847      </backdrop>
3848      <backdrop name="lamp50" element="matrixlamp" state="0">
3849         <bounds x="48" y="16" width="7" height="7"/>
3850      </backdrop>
3851      <backdrop name="lamp51" element="matrixlamp" state="0">
3852         <bounds x="48" y="24" width="7" height="7"/>
3853      </backdrop>
3854      <backdrop name="lamp52" element="matrixlamp" state="0">
3855         <bounds x="48" y="32" width="7" height="7"/>
3856      </backdrop>
3857      <backdrop name="lamp53" element="matrixlamp" state="0">
3858         <bounds x="48" y="40" width="7" height="7"/>
3859      </backdrop>
3860      <backdrop name="lamp54" element="matrixlamp" state="0">
3861         <bounds x="48" y="48" width="7" height="7"/>
3862      </backdrop>
3863      <backdrop name="lamp55" element="matrixlamp" state="0">
3864         <bounds x="48" y="56" width="7" height="7"/>
3865      </backdrop>
3866      <backdrop name="lamp56" element="matrixlamp" state="0">
3867         <bounds x="56" y="0" width="7" height="7"/>
3868      </backdrop>
3869      <backdrop name="lamp57" element="matrixlamp" state="0">
3870         <bounds x="56" y="8" width="7" height="7"/>
3871      </backdrop>
3872      <backdrop name="lamp58" element="matrixlamp" state="0">
3873         <bounds x="56" y="16" width="7" height="7"/>
3874      </backdrop>
3875      <backdrop name="lamp59" element="matrixlamp" state="0">
3876         <bounds x="56" y="24" width="7" height="7"/>
3877      </backdrop>
3878      <backdrop name="lamp60" element="matrixlamp" state="0">
3879         <bounds x="56" y="32" width="7" height="7"/>
3880      </backdrop>
3881      <backdrop name="lamp61" element="matrixlamp" state="0">
3882         <bounds x="56" y="40" width="7" height="7"/>
3883      </backdrop>
3884      <backdrop name="lamp62" element="matrixlamp" state="0">
3885         <bounds x="56" y="48" width="7" height="7"/>
3886      </backdrop>
3887      <backdrop name="lamp63" element="matrixlamp" state="0">
3888         <bounds x="56" y="56" width="7" height="7"/>
3889      </backdrop>
3890      <backdrop name="lamp64" element="matrixlamp" state="0">
3891         <bounds x="64" y="0" width="7" height="7"/>
3892      </backdrop>
3893      <backdrop name="lamp65" element="matrixlamp" state="0">
3894         <bounds x="64" y="8" width="7" height="7"/>
3895      </backdrop>
3896      <backdrop name="lamp66" element="matrixlamp" state="0">
3897         <bounds x="64" y="16" width="7" height="7"/>
3898      </backdrop>
3899      <backdrop name="lamp67" element="matrixlamp" state="0">
3900         <bounds x="64" y="24" width="7" height="7"/>
3901      </backdrop>
3902      <backdrop name="lamp68" element="matrixlamp" state="0">
3903         <bounds x="64" y="32" width="7" height="7"/>
3904      </backdrop>
3905      <backdrop name="lamp69" element="matrixlamp" state="0">
3906         <bounds x="64" y="40" width="7" height="7"/>
3907      </backdrop>
3908      <backdrop name="lamp70" element="matrixlamp" state="0">
3909         <bounds x="64" y="48" width="7" height="7"/>
3910      </backdrop>
3911      <backdrop name="lamp71" element="matrixlamp" state="0">
3912         <bounds x="64" y="56" width="7" height="7"/>
3913      </backdrop>
3914      <backdrop name="lamp72" element="matrixlamp" state="0">
3915         <bounds x="72" y="0" width="7" height="7"/>
3916      </backdrop>
3917      <backdrop name="lamp73" element="matrixlamp" state="0">
3918         <bounds x="72" y="8" width="7" height="7"/>
3919      </backdrop>
3920      <backdrop name="lamp74" element="matrixlamp" state="0">
3921         <bounds x="72" y="16" width="7" height="7"/>
3922      </backdrop>
3923      <backdrop name="lamp75" element="matrixlamp" state="0">
3924         <bounds x="72" y="24" width="7" height="7"/>
3925      </backdrop>
3926      <backdrop name="lamp76" element="matrixlamp" state="0">
3927         <bounds x="72" y="32" width="7" height="7"/>
3928      </backdrop>
3929      <backdrop name="lamp77" element="matrixlamp" state="0">
3930         <bounds x="72" y="40" width="7" height="7"/>
3931      </backdrop>
3932      <backdrop name="lamp78" element="matrixlamp" state="0">
3933         <bounds x="72" y="48" width="7" height="7"/>
3934      </backdrop>
3935      <backdrop name="lamp79" element="matrixlamp" state="0">
3936         <bounds x="72" y="56" width="7" height="7"/>
3937      </backdrop>
3938      <backdrop name="lamp80" element="matrixlamp" state="0">
3939         <bounds x="80" y="0" width="7" height="7"/>
3940      </backdrop>
3941      <backdrop name="lamp81" element="matrixlamp" state="0">
3942         <bounds x="80" y="8" width="7" height="7"/>
3943      </backdrop>
3944      <backdrop name="lamp82" element="matrixlamp" state="0">
3945         <bounds x="80" y="16" width="7" height="7"/>
3946      </backdrop>
3947      <backdrop name="lamp83" element="matrixlamp" state="0">
3948         <bounds x="80" y="24" width="7" height="7"/>
3949      </backdrop>
3950      <backdrop name="lamp84" element="matrixlamp" state="0">
3951         <bounds x="80" y="32" width="7" height="7"/>
3952      </backdrop>
3953      <backdrop name="lamp85" element="matrixlamp" state="0">
3954         <bounds x="80" y="40" width="7" height="7"/>
3955      </backdrop>
3956      <backdrop name="lamp86" element="matrixlamp" state="0">
3957         <bounds x="80" y="48" width="7" height="7"/>
3958      </backdrop>
3959      <backdrop name="lamp87" element="matrixlamp" state="0">
3960         <bounds x="80" y="56" width="7" height="7"/>
3961      </backdrop>
3962      <backdrop name="lamp88" element="matrixlamp" state="0">
3963         <bounds x="88" y="0" width="7" height="7"/>
3964      </backdrop>
3965      <backdrop name="lamp89" element="matrixlamp" state="0">
3966         <bounds x="88" y="8" width="7" height="7"/>
3967      </backdrop>
3968      <backdrop name="lamp90" element="matrixlamp" state="0">
3969         <bounds x="88" y="16" width="7" height="7"/>
3970      </backdrop>
3971      <backdrop name="lamp91" element="matrixlamp" state="0">
3972         <bounds x="88" y="24" width="7" height="7"/>
3973      </backdrop>
3974      <backdrop name="lamp92" element="matrixlamp" state="0">
3975         <bounds x="88" y="32" width="7" height="7"/>
3976      </backdrop>
3977      <backdrop name="lamp93" element="matrixlamp" state="0">
3978         <bounds x="88" y="40" width="7" height="7"/>
3979      </backdrop>
3980      <backdrop name="lamp94" element="matrixlamp" state="0">
3981         <bounds x="88" y="48" width="7" height="7"/>
3982      </backdrop>
3983      <backdrop name="lamp95" element="matrixlamp" state="0">
3984         <bounds x="88" y="56" width="7" height="7"/>
3985      </backdrop>
3986      <backdrop name="lamp96" element="matrixlamp" state="0">
3987         <bounds x="96" y="0" width="7" height="7"/>
3988      </backdrop>
3989      <backdrop name="lamp97" element="matrixlamp" state="0">
3990         <bounds x="96" y="8" width="7" height="7"/>
3991      </backdrop>
3992      <backdrop name="lamp98" element="matrixlamp" state="0">
3993         <bounds x="96" y="16" width="7" height="7"/>
3994      </backdrop>
3995      <backdrop name="lamp99" element="matrixlamp" state="0">
3996         <bounds x="96" y="24" width="7" height="7"/>
3997      </backdrop>
3998      <backdrop name="lamp100" element="matrixlamp" state="0">
3999         <bounds x="96" y="32" width="7" height="7"/>
4000      </backdrop>
4001      <backdrop name="lamp101" element="matrixlamp" state="0">
4002         <bounds x="96" y="40" width="7" height="7"/>
4003      </backdrop>
4004      <backdrop name="lamp102" element="matrixlamp" state="0">
4005         <bounds x="96" y="48" width="7" height="7"/>
4006      </backdrop>
4007      <backdrop name="lamp103" element="matrixlamp" state="0">
4008         <bounds x="96" y="56" width="7" height="7"/>
4009      </backdrop>
4010      <backdrop name="lamp104" element="matrixlamp" state="0">
4011         <bounds x="104" y="0" width="7" height="7"/>
4012      </backdrop>
4013      <backdrop name="lamp105" element="matrixlamp" state="0">
4014         <bounds x="104" y="8" width="7" height="7"/>
4015      </backdrop>
4016      <backdrop name="lamp106" element="matrixlamp" state="0">
4017         <bounds x="104" y="16" width="7" height="7"/>
4018      </backdrop>
4019      <backdrop name="lamp107" element="matrixlamp" state="0">
4020         <bounds x="104" y="24" width="7" height="7"/>
4021      </backdrop>
4022      <backdrop name="lamp108" element="matrixlamp" state="0">
4023         <bounds x="104" y="32" width="7" height="7"/>
4024      </backdrop>
4025      <backdrop name="lamp109" element="matrixlamp" state="0">
4026         <bounds x="104" y="40" width="7" height="7"/>
4027      </backdrop>
4028      <backdrop name="lamp110" element="matrixlamp" state="0">
4029         <bounds x="104" y="48" width="7" height="7"/>
4030      </backdrop>
4031      <backdrop name="lamp111" element="matrixlamp" state="0">
4032         <bounds x="104" y="56" width="7" height="7"/>
4033      </backdrop>
4034      <backdrop name="lamp112" element="matrixlamp" state="0">
4035         <bounds x="112" y="0" width="7" height="7"/>
4036      </backdrop>
4037      <backdrop name="lamp113" element="matrixlamp" state="0">
4038         <bounds x="112" y="8" width="7" height="7"/>
4039      </backdrop>
4040      <backdrop name="lamp114" element="matrixlamp" state="0">
4041         <bounds x="112" y="16" width="7" height="7"/>
4042      </backdrop>
4043      <backdrop name="lamp115" element="matrixlamp" state="0">
4044         <bounds x="112" y="24" width="7" height="7"/>
4045      </backdrop>
4046      <backdrop name="lamp116" element="matrixlamp" state="0">
4047         <bounds x="112" y="32" width="7" height="7"/>
4048      </backdrop>
4049      <backdrop name="lamp117" element="matrixlamp" state="0">
4050         <bounds x="112" y="40" width="7" height="7"/>
4051      </backdrop>
4052      <backdrop name="lamp118" element="matrixlamp" state="0">
4053         <bounds x="112" y="48" width="7" height="7"/>
4054      </backdrop>
4055      <backdrop name="lamp119" element="matrixlamp" state="0">
4056         <bounds x="112" y="56" width="7" height="7"/>
4057      </backdrop>
4058      <backdrop name="lamp120" element="matrixlamp" state="0">
4059         <bounds x="120" y="0" width="7" height="7"/>
4060      </backdrop>
4061      <backdrop name="lamp121" element="matrixlamp" state="0">
4062         <bounds x="120" y="8" width="7" height="7"/>
4063      </backdrop>
4064      <backdrop name="lamp122" element="matrixlamp" state="0">
4065         <bounds x="120" y="16" width="7" height="7"/>
4066      </backdrop>
4067      <backdrop name="lamp123" element="matrixlamp" state="0">
4068         <bounds x="120" y="24" width="7" height="7"/>
4069      </backdrop>
4070      <backdrop name="lamp124" element="matrixlamp" state="0">
4071         <bounds x="120" y="32" width="7" height="7"/>
4072      </backdrop>
4073      <backdrop name="lamp125" element="matrixlamp" state="0">
4074         <bounds x="120" y="40" width="7" height="7"/>
4075      </backdrop>
4076      <backdrop name="lamp126" element="matrixlamp" state="0">
4077         <bounds x="120" y="48" width="7" height="7"/>
4078      </backdrop>
4079      <backdrop name="lamp127" element="matrixlamp" state="0">
4080         <bounds x="120" y="56" width="7" height="7"/>
4081      </backdrop>
4082      <backdrop name="digit3" element="digit" state="0">
2012      <backdrop name="digit4" element="digit" state="0">
40832013         <bounds x="308" y="230" width="8" height="10"/>
40842014      </backdrop>
4085      <backdrop name="digit4" element="digit" state="0">
4086         <bounds x="316" y="230" width="8" height="10"/>
4087      </backdrop>
40882015      <backdrop name="digit5" element="digit" state="0">
40892016         <bounds x="300" y="200" width="8" height="10"/>
40902017      </backdrop>
src/mame/layout/18w.lay
r0r10316
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="digit" defstate="0">
4      <led7seg>
5         <color red="1.0" green="0.3" blue="0.0" />
6      </led7seg>
7   </element>
8   
9   <view name="Simple LEDs">
10      <bounds left="0" right="256" top="0" bottom="256" />
11     
12      <!-- left panel -->
13      <!-- TIME -->
14      <bezel name="digit3" element="digit">
15         <bounds left="0" top="0" right="9" bottom="15" />
16      </bezel>
17      <bezel name="digit2" element="digit">
18         <bounds left="10" top="0" right="19" bottom="15" />
19      </bezel>
20     
21      <!-- not connected -->
22      <bezel name="dummy_digita" element="digit">
23         <bounds left="20" top="0" right="29" bottom="15" />
24      </bezel>
25      <bezel name="dummy_digitb" element="digit">
26         <bounds left="30" top="0" right="39" bottom="15" />
27      </bezel>
28     
29      <!-- M.P.H. -->
30      <bezel name="digit1" element="digit">
31         <bounds left="40" top="0" right="49" bottom="15" />
32      </bezel>
33      <bezel name="digit0" element="digit">
34         <bounds left="50" top="0" right="59" bottom="15" />
35      </bezel>
36     
37      <!-- right panel -->
38      <!-- SCORE -->
39      <bezel name="digit9" element="digit">
40         <bounds left="100" top="0" right="109" bottom="15" />
41      </bezel>
42      <bezel name="digit8" element="digit">
43         <bounds left="110" top="0" right="119" bottom="15" />
44      </bezel>
45      <bezel name="digit7" element="digit">
46         <bounds left="120" top="0" right="129" bottom="15" />
47      </bezel>
48      <bezel name="digit6" element="digit">
49         <bounds left="130" top="0" right="139" bottom="15" />
50      </bezel>
51      <bezel name="digit5" element="digit">
52         <bounds left="140" top="0" right="149" bottom="15" />
53      </bezel>
54      <bezel name="digit4" element="digit">
55         <bounds left="150" top="0" right="159" bottom="15" />
56      </bezel>
57   </view>
58</mamelayout>
src/mame/drivers/bfcobra.c
r10315r10316
13601360{
13611361   int i;
13621362   int  changed = meter_latch ^ data;
1363   UINT64 cycles = downcast<cpu_device *>(space->cpu)->total_cycles();
13641363
13651364   meter_latch = data;
13661365
r10315r10316
13721371   {
13731372      if (changed & (1 << i))
13741373      {
1375         Mechmtr_update(i, cycles, data & (1 << i) );
1374         MechMtr_update(i, data & (1 << i) );
13761375         generic_pulse_irq_line(space->cpu, M6809_FIRQ_LINE);
13771376      }
13781377   }
src/mame/drivers/nycaptor.c
r10315r10316
290290static WRITE8_HANDLER( sound_command_w )
291291{
292292   soundlatch_w(space, 0, data);
293   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
293   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
294294}
295295
296296static WRITE8_HANDLER( nmi_disable_w )
src/mame/drivers/mgolf.c
r10315r10316
9292   {
9393      if (val == 0)
9494      {
95         state->time_released = timer_get_time(machine);
95         state->time_released = machine->time();
9696
9797         if (!state->mask)
9898            cpu_set_input_line(state->maincpu, INPUT_LINE_NMI, PULSE_LINE);
9999      }
100100      else
101         state->time_pushed = timer_get_time(machine);
101         state->time_pushed = machine->time();
102102
103103      state->prev = val;
104104   }
r10315r10316
119119   if (scanline >= 262)
120120      scanline = 16;
121121
122   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, interrupt_callback);
122   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline);
123123}
124124
125125
126126static double calc_plunger_pos(running_machine *machine)
127127{
128128   mgolf_state *state = machine->driver_data<mgolf_state>();
129   return (timer_get_time(machine).as_double() - state->time_released.as_double()) * (state->time_released.as_double() - state->time_pushed.as_double() + 0.2);
129   return (machine->time().as_double() - state->time_released.as_double()) * (state->time_released.as_double() - state->time_pushed.as_double() + 0.2);
130130}
131131
132132
r10315r10316
312312static MACHINE_RESET( mgolf )
313313{
314314   mgolf_state *state = machine->driver_data<mgolf_state>();
315   timer_set(machine, machine->primary_screen->time_until_pos(16), NULL, 16, interrupt_callback);
315   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(16), FUNC(interrupt_callback), 16);
316316
317317   state->mask = 0;
318318   state->prev = 0;
src/mame/drivers/fgoal.c
r10315r10316
8686   if (scanline > 256)
8787      scanline = 0;
8888
89   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, 0, interrupt_callback);
89   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(interrupt_callback));
9090}
9191
9292
r10315r10316
356356{
357357   fgoal_state *state = machine->driver_data<fgoal_state>();
358358
359   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, interrupt_callback);
359   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(interrupt_callback));
360360
361361   state->xpos = 0;
362362   state->ypos = 0;
src/mame/drivers/bfm_sc1.c
r10315r10316
269269   else
270270   {
271271      int  changed = mmtr_latch ^ data;
272      UINT64 cycles  = downcast<cpu_device *>(space->cpu)->total_cycles();
273272
274273      mmtr_latch = data;
275274
r10315r10316
277276      {
278277         if ( changed & (1 << i) )
279278         {
280            Mechmtr_update(i, cycles, data & (1 << i) );
279            MechMtr_update(i, data & (1 << i) );
281280            generic_pulse_irq_line(space->machine->device("maincpu"), M6809_FIRQ_LINE);
282281         }
283282      }
r10315r10316
13621361{
13631362   sc1_common_init(machine,3,1);
13641363   adder2_decode_char_roms(machine);   // decode GFX roms
1365   Mechmtr_init(8);
1364   MechMtr_config(machine,8);
13661365
13671366   BFM_BD1_init(0);
13681367}
r10315r10316
13701369static DRIVER_INIT(lotse)
13711370{
13721371   sc1_common_init(machine,6,1);
1373   Mechmtr_init(8);
1372   MechMtr_config(machine,8);
13741373
13751374   BFM_BD1_init(0);
13761375   BFM_BD1_init(1);
r10315r10316
13811380static DRIVER_INIT(rou029)
13821381{
13831382   sc1_common_init(machine,6,0);
1384   Mechmtr_init(8);
1383   MechMtr_config(machine,8);
13851384
13861385   BFM_BD1_init(0);
13871386}
r10315r10316
13911390static DRIVER_INIT(clatt)
13921391{
13931392   sc1_common_init(machine,6,1);
1394   Mechmtr_init(8);
1393   MechMtr_config(machine,8);
13951394
13961395   BFM_BD1_init(0);
13971396
src/mame/drivers/segaxbd.c
r10315r10316
318318}
319319
320320
321static TIMER_CALLBACK( scanline_callback )
321static TIMER_DEVICE_CALLBACK( scanline_callback )
322322{
323   segas1x_state *state = machine->driver_data<segas1x_state>();
323   segas1x_state *state = timer.machine->driver_data<segas1x_state>();
324324
325325   int scanline = param;
326326   int next_scanline = (scanline + 2) % 262;
r10315r10316
349349
350350   /* update IRQs on the main CPU */
351351   if (update)
352      update_main_irqs(machine);
352      update_main_irqs(timer.machine);
353353
354354   /* come back in 2 scanlines */
355   timer_set(machine, machine->primary_screen->time_until_pos(next_scanline), NULL, next_scanline, scanline_callback);
355   timer.adjust(timer.machine->primary_screen->time_until_pos(next_scanline), next_scanline);
356356}
357357
358358
r10315r10316
385385
386386static void sound_data_w(running_machine *machine, UINT8 data)
387387{
388   timer_call_after_resynch(machine, NULL, data, delayed_sound_data_w);
388   machine->scheduler().synchronize(FUNC(delayed_sound_data_w), data);
389389}
390390
391391
r10315r10316
424424
425425static MACHINE_RESET( xboard )
426426{
427   segas1x_state *state = machine->driver_data<segas1x_state>();
427428   fd1094_machine_init(machine->device("maincpu"));
428429   segaic16_tilemap_reset(machine, 0);
429430
r10315r10316
431432   m68k_set_reset_callback(machine->device("maincpu"), xboard_reset);
432433
433434   /* start timers to track interrupts */
434   timer_set(machine, machine->primary_screen->time_until_pos(1), NULL, 1, scanline_callback);
435   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(1), 1);
435436}
436437
437438
r10315r10316
13491350   MCFG_NVRAM_ADD_0FILL("backup2")
13501351   MCFG_QUANTUM_TIME(attotime::from_hz(6000))
13511352
1353   MCFG_TIMER_ADD("int_timer", scanline_callback)
1354
13521355   MCFG_315_5248_ADD("5248_main")
13531356   MCFG_315_5248_ADD("5248_subx")
13541357   MCFG_315_5249_ADD("5249_main")
src/mame/drivers/sslam.c
r10315r10316
938938   state_save_register_global(machine, state->bar);
939939   state_save_register_global(machine, state->snd_bank);
940940
941   state->music_timer = timer_alloc(machine, music_playback, NULL);
941   state->music_timer = machine->scheduler().timer_alloc(FUNC(music_playback));
942942}
943943
944944static DRIVER_INIT( powerbls )
src/mame/drivers/hornet.c
r10315r10316
848848   state_save_register_global_pointer(machine, jvs_sdata, 1024);
849849   state_save_register_global(machine, jvs_sdata_ptr);
850850
851    sound_irq_timer = timer_alloc(machine, irq_off, 0);
851    sound_irq_timer = machine->scheduler().timer_alloc(FUNC(irq_off));
852852}
853853
854854static MACHINE_RESET( hornet )
src/mame/drivers/pipedrm.c
r10315r10316
224224
225225static WRITE8_HANDLER( sound_command_w )
226226{
227   timer_call_after_resynch(space->machine, NULL, data | 0x100, delayed_command_w);
227   space->machine->scheduler().synchronize(FUNC(delayed_command_w), data | 0x100);
228228}
229229
230230
231231static WRITE8_HANDLER( sound_command_nonmi_w )
232232{
233   timer_call_after_resynch(space->machine, NULL, data, delayed_command_w);
233   space->machine->scheduler().synchronize(FUNC(delayed_command_w), data);
234234}
235235
236236
src/mame/drivers/ccastles.c
r10315r10316
220220   memory_configure_bank(machine, "bank1", 0, 2, machine->region("maincpu")->base() + 0xa000, 0x6000);
221221
222222   /* create a timer for IRQs and set up the first callback */
223   state->irq_timer = timer_alloc(machine, clock_irq, NULL);
223   state->irq_timer = machine->scheduler().timer_alloc(FUNC(clock_irq));
224224   state->irq_state = 0;
225225   schedule_next_irq(machine, 0);
226226
src/mame/drivers/orbit.c
r10315r10316
5050static INTERRUPT_GEN( orbit_interrupt )
5151{
5252   cpu_set_input_line(device, 0, ASSERT_LINE);
53   timer_set(device->machine, device->machine->primary_screen->time_until_vblank_end(), NULL, 0, irq_off);
53   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_vblank_end(), FUNC(irq_off));
5454}
5555
5656
src/mame/drivers/policetr.c
r10315r10316
127127static INTERRUPT_GEN( irq4_gen )
128128{
129129   cpu_set_input_line(device, R3000_IRQ4, ASSERT_LINE);
130   timer_set(device->machine, device->machine->primary_screen->time_until_pos(0), NULL, 0, irq5_gen);
130   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(0), FUNC(irq5_gen));
131131}
132132
133133
src/mame/drivers/gaplus.c
r10315r10316
259259                        // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
260260
261261   if (!namcoio_read_reset_line(io58xx))      /* give the cpu a tiny bit of time to write the command before processing it */
262      timer_set(device->machine, attotime::from_usec(50), NULL, 0, namcoio_run);
262      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(namcoio_run));
263263
264264   if (!namcoio_read_reset_line(io56xx))      /* give the cpu a tiny bit of time to write the command before processing it */
265      timer_set(device->machine, attotime::from_usec(50), NULL, 1, namcoio_run);
265      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(namcoio_run), 1);
266266
267267}
268268
src/mame/drivers/powerins.c
r10315r10316
399399
400400   MCFG_DEVICE_REMOVE("oki2")
401401   MCFG_DEVICE_REMOVE("ym2203")
402   MCFG_DEVICE_REMOVE("nmk112")
402403MACHINE_CONFIG_END
403404
404405static MACHINE_CONFIG_DERIVED( powerinb, powerins )
src/mame/drivers/jedi.c
r10315r10316
158158   jedi_state *state = machine->driver_data<jedi_state>();
159159
160160   /* set a timer to run the interrupts */
161   state->interrupt_timer = timer_alloc(machine, generate_interrupt, NULL);
161   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(generate_interrupt));
162162   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(32), 32);
163163
164164   /* configure the banks */
src/mame/drivers/zn.c
r10315r10316
482482      n_game++;
483483   }
484484
485   state->dip_timer = timer_alloc( machine, dip_timer_fired, NULL );
485   state->dip_timer = machine->scheduler().timer_alloc( FUNC(dip_timer_fired), NULL );
486486}
487487
488488static void psx_spu_irq(device_t *device, UINT32 data)
src/mame/drivers/midzeus.c
r10315r10316
7878
7979static MACHINE_START( midzeus )
8080{
81   timer[0] = timer_alloc(machine, NULL, NULL);
82   timer[1] = timer_alloc(machine, NULL, NULL);
81   timer[0] = machine->scheduler().timer_alloc(FUNC(NULL));
82   timer[1] = machine->scheduler().timer_alloc(FUNC(NULL));
8383
84   gun_timer[0] = timer_alloc(machine, invasn_gun_callback, NULL);
85   gun_timer[1] = timer_alloc(machine, invasn_gun_callback, NULL);
84   gun_timer[0] = machine->scheduler().timer_alloc(FUNC(invasn_gun_callback));
85   gun_timer[1] = machine->scheduler().timer_alloc(FUNC(invasn_gun_callback));
8686
8787   state_save_register_global(machine, gun_control);
8888   state_save_register_global(machine, gun_irq_state);
r10315r10316
118118static INTERRUPT_GEN( display_irq )
119119{
120120   cpu_set_input_line(device, 0, ASSERT_LINE);
121   timer_set(device->machine, attotime::from_hz(30000000), NULL, 0, display_irq_off);
121   device->machine->scheduler().timer_set(attotime::from_hz(30000000), FUNC(display_irq_off));
122122}
123123
124124
src/mame/drivers/segaybd.c
r10315r10316
245245static WRITE16_HANDLER( sound_data_w )
246246{
247247   if (ACCESSING_BITS_0_7)
248      timer_call_after_resynch(space->machine, NULL, data & 0xff, delayed_sound_data_w);
248      space->machine->scheduler().synchronize(FUNC(delayed_sound_data_w), data & 0xff);
249249}
250250
251251
src/mame/drivers/cclimber.c
r10315r10316
267267
268268   /* we must do this on a timer in order to have it take effect */
269269   /* otherwise, the reset process will override our changes */
270   timer_call_after_resynch(machine, NULL, 0, disable_interrupts);
270   machine->scheduler().synchronize(FUNC(disable_interrupts));
271271
272272   toprollr_rombank = 0;
273273}
src/mame/drivers/namcos10.c
r10315r10316
267267#include "cpu/mips/psx.h"
268268#include "includes/psx.h"
269269
270WRITE32_HANDLER( namcos10_bank_w )
271{
272   memory_set_bank( space->machine, "bank1", data & 0xf );
273}
274
270275class namcos10_state : public psx_state
271276{
272277public:
r10315r10316
275280};
276281
277282static ADDRESS_MAP_START( namcos10_map, ADDRESS_SPACE_PROGRAM, 32 )
278   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("share1") /* ram */
283   AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_SHARE("share1") /* ram */
279284   AM_RANGE(0x1f800000, 0x1f8003ff) AM_RAM /* scratchpad */
280285   AM_RANGE(0x1f801000, 0x1f801007) AM_WRITENOP
281286   AM_RANGE(0x1f801008, 0x1f80100b) AM_RAM /* ?? */
r10315r10316
293298   AM_RANGE(0x1f802020, 0x1f802033) AM_RAM /* ?? */
294299   AM_RANGE(0x1f802040, 0x1f802043) AM_WRITENOP
295300   AM_RANGE(0x1fc00000, 0x1fffffff) AM_ROM AM_SHARE("share2") AM_REGION("user1", 0) /* bios */
296   AM_RANGE(0x80000000, 0x803fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
301   AM_RANGE(0x80000000, 0x80ffffff) AM_RAM AM_SHARE("share1") /* ram mirror */
297302   AM_RANGE(0x9fc00000, 0x9fffffff) AM_ROM AM_SHARE("share2") /* bios mirror */
298   AM_RANGE(0xa0000000, 0xa03fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
303   AM_RANGE(0xa0000000, 0xa0ffffff) AM_RAM AM_SHARE("share1") /* ram mirror */
299304   AM_RANGE(0xbfc00000, 0xbfffffff) AM_ROM AM_SHARE("share2") /* bios mirror */
300305   AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP
301306ADDRESS_MAP_END
302307
303static void memcpy32le( UINT32 *dst, UINT8 *src, int len )
308static void memm_driver_init( running_machine *machine )
304309{
310   psx_driver_init(machine);
311   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f300000, 0x1f300003, 0, 0, namcos10_bank_w );
312   memory_install_read_bank( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, "bank1" );
313   memory_configure_bank( machine, "bank1", 0, 16, machine->region( "user2" )->base(), 4 * 1024 * 1024 );
314}
315
316UINT8 *nand_base;
317UINT32 nand_address = 0;
318
319READ32_HANDLER( nand_status_r )
320{
321   return 0;
322}
323
324WRITE32_HANDLER( nand_address1_w )
325{
326   nand_address = ( nand_address & 0x00ffffff ) | ( ( data & 0xff ) << 24 );
327}
328
329WRITE32_HANDLER( nand_address2_w )
330{
331   nand_address = ( nand_address & 0xff00ffff ) | ( ( data & 0xff ) << 16 );
332}
333
334WRITE32_HANDLER( nand_address3_w )
335{
336   nand_address = ( nand_address & 0xffff00ff ) | ( ( data & 0xff ) << 8 );
337}
338
339WRITE32_HANDLER( nand_address4_w )
340{
341   nand_address = ( nand_address & 0xffffff00 ) | ( ( data & 0xff ) << 0 );
342}
343
344UINT16 nand_read( UINT32 address )
345{
346   int index = ( ( address / 512 ) * 528 ) + ( address % 512 );
347   return nand_base[ index ] | ( nand_base[ index + 1 ] << 8 );
348}
349
350UINT16 nand_read2( UINT32 address )
351{
352   int index = ( ( address / 512 ) * 528 ) + ( address % 512 );
353   return nand_base[ index + 1 ] | ( nand_base[ index ] << 8 );
354}
355
356READ32_HANDLER( nand_data_r )
357{
358   UINT32 data = nand_read2( nand_address * 2 );
359
360   printf( "data<-%08x (%08x)\n", data, nand_address );
361   nand_address++;
362
363   return data;
364}
365
366static void nand_copy( UINT32 *dst, UINT32 address, int len )
367{
305368   while( len > 0 )
306369   {
307      *( dst ) = ( *( src + 0 ) << 0 ) | ( *( src + 1 ) << 8 ) | ( *( src + 2 ) << 16 ) | ( *( src + 3 ) << 24 );
308      dst++;
309      src += 4;
370      *( dst++ ) = nand_read( address ) | ( nand_read( address + 2 ) << 16 );
371      address += 4;
310372      len -= 4;
311373   }
312374}
313375
314static void memm_driver_init( running_machine *machine )
315{
316   psx_driver_init(machine);
317}
318
319376static void memn_driver_init( running_machine *machine )
320377{
321378   UINT8 *BIOS = (UINT8 *)machine->region( "user1" )->base();
322   UINT8 *ROM = (UINT8 *)machine->region( "user2" )->base();
379   nand_base = (UINT8 *)machine->region( "user2" )->base();
323380
324   memcpy32le( (UINT32 *)( BIOS + 0x0000000 ), ROM + 0x08000, 0x001c000 );
325   memcpy32le( (UINT32 *)( BIOS + 0x0020000 ), ROM + 0x24000, 0x03dffff );
381   nand_copy( (UINT32 *)( BIOS + 0x0000000 ), 0x08000, 0x001c000 );
382   nand_copy( (UINT32 *)( BIOS + 0x0020000 ), 0x24000, 0x03e0000 );
326383
384   memory_install_read32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f400003, 0, 0, nand_status_r );
385   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f410000, 0x1f410003, 0, 0, nand_address1_w );
386   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f420000, 0x1f420003, 0, 0, nand_address2_w );
387   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f430000, 0x1f430003, 0, 0, nand_address3_w );
388   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f440000, 0x1f440003, 0, 0, nand_address4_w );
389   memory_install_read32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f450000, 0x1f450003, 0, 0, nand_data_r );
390
327391   psx_driver_init(machine);
328392}
329393
r10315r10316
384448
385449static MACHINE_CONFIG_START( namcos10, namcos10_state )
386450   /* basic machine hardware */
387   MCFG_CPU_ADD( "maincpu", PSXCPU, XTAL_101_4912MHz )
451   MCFG_CPU_ADD( "maincpu", CXD8661R, XTAL_101_4912MHz )
388452   MCFG_CPU_PROGRAM_MAP( namcos10_map)
389453   MCFG_CPU_VBLANK_INT("screen", psx_vblank)
390454
r10315r10316
465529   ROM_LOAD( "dr21vera.1a",  0x000000, 0x800000, CRC(f93532a2) SHA1(8b72f2868978be1f0e0abd11425a3c8b2b0c4e99) )
466530
467531   ROM_REGION( 0x4000000, "user2", 0 ) /* main prg */
468        ROM_LOAD( "dr21ma1.1d", 0x0000000, 0x1000000, CRC(26dc6f55) SHA1(a9cedf547fa7a4d5850b9b3b867d46e577a035e0) )
469        ROM_LOAD( "dr21ma2.2d", 0x1000000, 0x1000000, CRC(702556ff) SHA1(c95defd5fd6a9b406fc8d8f28ecfab732ef1ff42) )
532   ROM_LOAD( "dr21ma1.1d", 0x0000000, 0x1000000, CRC(26dc6f55) SHA1(a9cedf547fa7a4d5850b9b3b867d46e577a035e0) )
533   ROM_LOAD( "dr21ma2.2d", 0x1000000, 0x1000000, CRC(702556ff) SHA1(c95defd5fd6a9b406fc8d8f28ecfab732ef1ff42) )
470534ROM_END
471535
472536ROM_START( mrdrlr2a )
473537   ROM_REGION32_LE( 0x800000, "user1", 0 ) /* main prg */
474        ROM_LOAD( "dr22vera.1a",  0x000000, 0x800000, CRC(f2633388) SHA1(42e56c9758ee833390003d4b41956f75f5a22760) )
538   ROM_LOAD( "dr22vera.1a",  0x000000, 0x800000, CRC(f2633388) SHA1(42e56c9758ee833390003d4b41956f75f5a22760) )
475539
476540   ROM_REGION( 0x4000000, "user2", 0 ) /* main prg */
477        ROM_LOAD( "dr21ma1.1d", 0x0000000, 0x1000000, CRC(26dc6f55) SHA1(a9cedf547fa7a4d5850b9b3b867d46e577a035e0) )
478        ROM_LOAD( "dr21ma2.2d", 0x1000000, 0x1000000, CRC(702556ff) SHA1(c95defd5fd6a9b406fc8d8f28ecfab732ef1ff42) )
541   ROM_LOAD( "dr21ma1.1d", 0x0000000, 0x1000000, CRC(26dc6f55) SHA1(a9cedf547fa7a4d5850b9b3b867d46e577a035e0) )
542   ROM_LOAD( "dr21ma2.2d", 0x1000000, 0x1000000, CRC(702556ff) SHA1(c95defd5fd6a9b406fc8d8f28ecfab732ef1ff42) )
479543ROM_END
480544
481545ROM_START( gjspace )
r10315r10316
483547   ROM_FILL( 0x0000000, 0x400000, 0x55 )
484548
485549   ROM_REGION( 0x4000000, "user2", 0 ) /* main prg */
486   ROM_LOAD( "10011a_0.bin", 0x0000000, 0x1000000, CRC(853e329e) SHA1(dd272ab2de9052c5aeee9e0ead4ee3d14347593e) )
487   ROM_LOAD( "10011a_1.bin", 0x1000000, 0x1000000, CRC(7d4e96f7) SHA1(41b0d27b93662f15547311c8723ac5141e129cab) )
488   ROM_LOAD( "10011a_2.bin", 0x2000000, 0x1000000, CRC(83111de6) SHA1(d760fd41644104f6d3a2806ab4664df2c77bdc42) )
489   ROM_LOAD( "10011a_3.bin", 0x3000000, 0x1000000, CRC(b6ea8be7) SHA1(3e65deda2b0e6758ce0ed05419ed096efb8ad755) )
550   ROM_LOAD( "10011a_0.bin", 0x0000000, 0x1000000, BAD_DUMP CRC(853e329e) SHA1(dd272ab2de9052c5aeee9e0ead4ee3d14347593e) )
551   ROM_LOAD( "10011a_1.bin", 0x1000000, 0x1000000, BAD_DUMP CRC(7d4e96f7) SHA1(41b0d27b93662f15547311c8723ac5141e129cab) )
552   ROM_LOAD( "10011a_2.bin", 0x2000000, 0x1000000, BAD_DUMP CRC(83111de6) SHA1(d760fd41644104f6d3a2806ab4664df2c77bdc42) )
553   ROM_LOAD( "10011a_3.bin", 0x3000000, 0x1000000, BAD_DUMP CRC(b6ea8be7) SHA1(3e65deda2b0e6758ce0ed05419ed096efb8ad755) )
490554ROM_END
491555
492556ROM_START( mrdrilrg )
r10315r10316
494558   ROM_FILL( 0x0000000, 0x400000, 0x55 )
495559
496560   ROM_REGION( 0x3000000, "user2", 0 ) /* main prg */
497   ROM_LOAD( "drg1a_0.bin",  0x0000000, 0x1000000, CRC(1e5595f1) SHA1(0373ccb6e4b6fe96010afbb9657c3c0b2b02dd57) )
498   ROM_LOAD( "drg1a_1.bin",  0x1000000, 0x1000000, CRC(4db3a361) SHA1(d6a4fb682ab75cd98a9a960c244e94cacd367f12) )
499   ROM_LOAD( "drg1a_2.bin",  0x2000000, 0x1000000, CRC(c99ffa30) SHA1(fdcc0a348fe705c5ed1611170570f2fd9068525a) )
561   ROM_LOAD( "drg1a_0.bin",  0x0000000, 0x1000000, BAD_DUMP CRC(1e5595f1) SHA1(0373ccb6e4b6fe96010afbb9657c3c0b2b02dd57) )
562   ROM_LOAD( "drg1a_1.bin",  0x1000000, 0x1000000, BAD_DUMP CRC(4db3a361) SHA1(d6a4fb682ab75cd98a9a960c244e94cacd367f12) )
563   ROM_LOAD( "drg1a_2.bin",  0x2000000, 0x1000000, BAD_DUMP CRC(c99ffa30) SHA1(fdcc0a348fe705c5ed1611170570f2fd9068525a) )
500564ROM_END
501565
502566ROM_START( knpuzzle )
r10315r10316
504568   ROM_FILL( 0x0000000, 0x400000, 0x55 )
505569
506570   ROM_REGION( 0x3000000, "user2", 0 ) /* main prg */
507   ROM_LOAD( "kpm1a_0.bin",  0x0000000, 0x1000000, CRC(606d001b) SHA1(5a94e56a164a9132af7f9bd51cae0674dbe0e036) )
508   ROM_LOAD( "kpm1a_1.bin",  0x1000000, 0x1000000, CRC(a506d767) SHA1(f4830edc8eaa42ff80e83aca2fa38a4d2807c667) )
509   ROM_LOAD( "kpm1a_2.bin",  0x2000000, 0x1000000, CRC(5f40c402) SHA1(2a56421c0f0c9cc5b7b93ddacfc6f3d214a946d9) )
571   ROM_LOAD( "kpm1a_0.bin",  0x0000000, 0x1000000, BAD_DUMP CRC(606d001b) SHA1(5a94e56a164a9132af7f9bd51cae0674dbe0e036) )
572   ROM_LOAD( "kpm1a_1.bin",  0x1000000, 0x1000000, BAD_DUMP CRC(a506d767) SHA1(f4830edc8eaa42ff80e83aca2fa38a4d2807c667) )
573   ROM_LOAD( "kpm1a_2.bin",  0x2000000, 0x1000000, BAD_DUMP CRC(5f40c402) SHA1(2a56421c0f0c9cc5b7b93ddacfc6f3d214a946d9) )
510574ROM_END
511575
512576ROM_START( startrgn )
r10315r10316
514578   ROM_FILL( 0x0000000, 0x400000, 0x55 )
515579
516580   ROM_REGION( 0x2000000, "user2", 0 ) /* main prg */
517   ROM_LOAD( "stt1a_0.bin",  0x0000000, 0x1000000, CRC(07513d66) SHA1(baed445ff81e7f687e39b26648b3fe2ff601826b) )
518   ROM_LOAD( "stt1a_1.bin",  0x1000000, 0x1000000, CRC(f6e8e641) SHA1(37c8c1482d652b46a744252721299448b15e1027) )
581   ROM_LOAD( "stt1a_0.bin",  0x0000000, 0x1000000, BAD_DUMP CRC(07513d66) SHA1(baed445ff81e7f687e39b26648b3fe2ff601826b) )
582   ROM_LOAD( "stt1a_1.bin",  0x1000000, 0x1000000, BAD_DUMP CRC(f6e8e641) SHA1(37c8c1482d652b46a744252721299448b15e1027) )
519583ROM_END
520584
521585ROM_START( gamshara )
522586   ROM_REGION32_LE( 0x400000, "user1", 0 ) /* bios */
523587   ROM_FILL( 0x0000000, 0x400000, 0x55 )
524588
525   ROM_REGION( 0x2000000, "user2", 0 ) /* main prg */
526   ROM_LOAD( "10021a.8e",    0x0000000, 0x1000000, CRC(db0a3687) SHA1(757360c43fba247e6c0c0fc66bb089575e19d646) )
527   ROM_LOAD( "10021a.8d",    0x1000000, 0x1000000, CRC(bebafef6) SHA1(6c965c09f3186523d27c50894a15b9c1dd02a794) )
589   ROM_REGION( 0x2100000, "user2", 0 ) /* main prg */
590   ROM_LOAD( "10021a.8e",    0x0000000, 0x1080000, CRC(6c0361fc) SHA1(7debf1f2e6bed31d59fb224a78a17a94fc573785) )
591   ROM_LOAD( "10021a.8d",    0x1080000, 0x1080000, CRC(73669ff7) SHA1(eb8bbf931f1f8a049208d081d040512a3ffa9c00) )
528592ROM_END
529593
530594GAME( 2000, mrdrilr2,  0,        namcos10, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/mpu4.c
r10315r10316
44  This is the core driver, no video specific stuff should go in here.
55  This driver holds all the mechanical games.
66
7     01-2011: Adding the missing 'OKI' sound card, and documented it.
78     05-2009: Miscellaneous lamp fixes, based on data from FME Forever.
89     09-2007: Haze: Added Deal 'Em video support.
910  03-08-2007: J Wallace: Removed audio filter for now, since sound is more accurate without them.
r10315r10316
5354-----------+---+-----------------+--------------------------------------------------------------------------
5455 0850 ?    | W | ??????????????? | page latch (NV)
5556-----------+---+-----------------+--------------------------------------------------------------------------
56 0880      |R/W| D D D D D D D D | PIA6821 on soundboard (Oki MSM6376@16MHz,(NV)
57 0880      |R/W| D D D D D D D D | PIA6821 on soundboard (Oki MSM6376@16MHz)
5758           |   |                 | port A = ??
5859           |   |                 | port B (882)
5960           |   |                 |        b7 = 0 if OKI busy
r10315r10316
6667           |   |                 |        b1 = ??
6768           |   |                 |        b0 = ??
6869-----------+---+-----------------+--------------------------------------------------------------------------
69 08C0      |   |                 | MC6840 on sound board(NV?)
70 08C0      |   |                 | MC6840 on sound board
7071-----------+---+-----------------+--------------------------------------------------------------------------
7172 0900-     |R/W| D D D D D D D D | MC6840 PTM IC2
7273
r10315r10316
198199
199200TODO: - Fix lamp timing, MAME doesn't update fast enough to see everything
200201      - Distinguish door switches using manual
202     - Complete stubs for hoppers (needs slightly better 68681 emulation, and new 'hoppers' device)
203     - Any reel using the remote meter drive (CB2) slips backwards due to timing mismatches, a better method
204     is needed to combine the data. This eventually leads to spin alarms i.e Flo's move in Great Escape
205     - Add a BwB game with characteriser.
201206***********************************************************************************************************/
202207#include "emu.h"
203208#include "machine/6821pia.h"
r10315r10316
223228#define LOG_CHR_FULL(x)   do { if (MPU4VERBOSE) logerror x; } while (0)
224229#define LOG_IC3(x)   do { if (MPU4VERBOSE) logerror x; } while (0)
225230#define LOG_IC8(x)   do { if (MPU4VERBOSE) logerror x; } while (0)
231#define LOG_SS(x)   do { if (1) logerror x; } while (0)
226232
227233#include "video/awpvid.h"      //Fruit Machines Only
228234#include "connect4.lh"
229235#include "gamball.lh"
230236#include "mpu4.lh"
237#include "mpu4ext.lh"
231238#define MPU4_MASTER_CLOCK (6880000)
232239
233240/* local vars */
r10315r10316
239246static int serial_data;
240247static int signal_50hz;
241248static int ic4_input_b;
249static int aux1_input;
250static int aux2_input;
242251static int IC23G1;
243252static int IC23G2A;
244253static int IC23G2B;
r10315r10316
249258static int lamp_col;
250259static int reel_flag;
251260static int ic23_active;
252static int led_extend;
261static int led_lamp;
253262static int link7a_connected;
254static int multiplex_smooth;
255263static emu_timer *ic24_timer;
256264static TIMER_CALLBACK( ic24_timeout );
257265
258static int expansion_latch;// OKI MOD 4 and above only
259static int global_volume;// OKI MOD 4 and above only
260
261
266static int expansion_latch;// OKI MOD 4 and above only (PIA on Gamecard)
267static int global_volume;// OKI MOD 4 and above only (PIA on Gamecard)
262268/* 32 multiplexed inputs - but a further 8 possible per AUX.
263269Two connectors 'orange' (sampled every 8ms) and 'black' (sampled every 16ms)
264270Each connector carries two banks of eight inputs and two enable signals */
r10315r10316
267273static UINT8  lamp_data;
268274static UINT8  ay_data;
269275
270static UINT8 MPU4_chr_data[72];
271
272static UINT8 Lamps[128];      /* 128 multiplexed lamps */
276static UINT8 Lamps[224];      /* 128 multiplexed lamps + 96 extension */
273277static int optic_pattern;
278static int active_reel;
279static int remote_meter;
274280
281static UINT8 reel_mux_table[8]= {0,4,2,6,1,5,3,7};//include 7, although I don't think it's used
282static UINT8 reel_mux_table7[8]= {3,1,5,6,4,2,0,7};
283
284static int reel_mux;      /* added support for up to 8 reels */
285#define STANDARD_REEL  0   /* As originally designed 3/4 reels*/
286#define FIVE_REEL_5TO8 1   /* Interfaces to meter port, allows some mechanical metering, but there is significant 'bounce' in the extra reel*/
287#define FIVE_REEL_8TO5 2   /* Mounted backwards for space reasons, but different board*/
288#define FIVE_REEL_3TO6 3   /* Connected to the centre of the meter connector, taking up meters 3 to 6 */
289#define SIX_REEL_1TO8  4   /* Two reels on the meter drives*/
290#define SIX_REEL_5TO8  5   /* Like FIVE_REEL_5TO8, but with an extra reel elsewhere*/
291#define SEVEN_REEL     6   /* Mainly club machines, significant reworking of reel hardware*/
292
293static int lamp_extender;/* Plug in boards that add additional lamps and leds via the AUX ports. */
294static int last_b7;
295static int last_latch;
296#define NO_EXTENDER         0   /* As originally designed */
297#define SMALL_CARD         1
298#define LARGE_CARD_A      2 //96 Lamps
299#define LARGE_CARD_B      3 // 96 Lamps, 16 LEDs - as used by BwB
300#define LARGE_CARD_C      4 //Identical to B, no built in LED support
301
302static int lamp_sense;
303static int card_live;
304
305static int led_extender;   /* Plug in boards that add leds via the AUX ports. */
306#define CARD_A         1
307#define CARD_B         2
308#define CARD_C         3
309
310static int hopper =0;
311#define TUBES            0
312#define HOPPER_DUART_A      1
313#define HOPPER_DUART_B      2
314#define HOPPER_DUART_C      3
315#define HOPPER_NONDUART_A   4
316#define HOPPER_NONDUART_B   5
275317/* Lookup table for CHR data */
276318
277319struct mpu4_chr_table
r10315r10316
3013438 display enables (pins 10 - 17)
302344*/
303345
304static UINT8 led_segs[8];
346static UINT8 led_segs[40];//8 regular, up to 32 on extender cards
305347
306348
307349/* Process lamp and LED data for output system */
r10315r10316
313355
314356static void draw_lamps(void)
315357{
316   int i;
358   int i,j;
317359
318360   for (i = 0; i < 8; i++)
319361   {
320362      output_set_lamp_value((8*input_strobe)+i, (Lamps[(8*input_strobe)+i]));
321363      output_set_lamp_value((8*input_strobe)+i+64, (Lamps[(8*input_strobe)+i+64]));
322364   }
365   if (lamp_extender)
366   {
367      for (j = 0; j < 6; j++)
368      {
369         output_set_lamp_value((6*input_strobe)+128+j, (Lamps[(6*input_strobe)+128+j]));
370         output_set_lamp_value((6*input_strobe)+176+j, (Lamps[(6*input_strobe)+176+j]));
371      }
372   }
323373}
324374
325
326375static void update_lamps(void)
327376{
328   int i;
377   int i,j;
329378
330379   for (i = 0; i < 8; i++)
331380   {
r10315r10316
333382      Lamps[(8*input_strobe)+i+64] = (lamp_strobe2 & (1 << i)) != 0;
334383   }
335384
336   if (led_extend)
385   if (led_lamp)
337386   {
338      /* Some games uses 'programmable' LED displays, built from light display lines. */
387      /* Some games (like Connect 4) use 'programmable' LED displays, built from light display lines. */
339388      UINT8 pled_segs[2] = {0,0};
340389
341390      static const int lamps1[8] = { 106, 107, 108, 109, 104, 105, 110, 133 };
r10315r10316
351400      mpu4_draw_led(9, pled_segs[1]);
352401   }
353402
354   /* Lamp smoothing, this draws lamps only at the peaks of the AC power that would light them */
355   if ((multiplex_smooth == (input_strobe - 1))||((multiplex_smooth == 7) && (input_strobe == 0)))
403   draw_lamps();
404   mpu4_draw_led(input_strobe, led_segs[input_strobe]);
405   if (led_extender)
356406   {
357      draw_lamps();
358      mpu4_draw_led(input_strobe, led_segs[input_strobe]);
359      multiplex_smooth = input_strobe;
407      for (j = 0; j < 5; j++)
408      {
409         mpu4_draw_led(((8*input_strobe)+8+j), led_segs[((8*input_strobe)+8+j)]);
410      }
360411   }
412}
361413
414static void lamp_extend_small(int data)
415{
416   int lamp_strobe_ext,column,i;
417   column = data & 0x07;
418
419   lamp_strobe_ext = 0x1f - ((data & 0xf8) >> 3);
420   if ( lamp_strobe_ext )
421   {
422      for (i = 0; i < 5; i++)
423      {
424         Lamps[(5*column)+i+128]    = (lamp_strobe_ext  & (1 << i)) != 0;
425      }
426    }
362427}
363428
429static void lamp_extend_largea(int data,int column,int active)
430{
431   int lampbase,i,byte7;
364432
433   lamp_sense = 0;
434   byte7 = data & 0x80;
435   if ( byte7 != last_b7 )
436   {
437      if ( byte7 )
438      {
439         lampbase = 128 + column * 8;
440      }
441      else
442      {
443         lampbase = 192 + column * 8;
444      }
445      if ( data & 0x3f )
446      {
447           lamp_sense = 1;
448      }
449      if ( active )
450      {
451         for (i = 0; i < 6; i++)
452         {
453            Lamps[(lampbase)+i]    = (data  & (1 << i)) != 0;
454         }
455      }
456    }
457    last_b7 = byte7;
458}
459
460static void lamp_extend_largebc(int data,int column,int active)
461{
462   int lampbase,i,byte7;
463
464   lamp_sense = 0;
465   byte7 = data & 0x80;
466   if ( byte7 != last_b7 )
467   {
468      card_live = 1;
469       if ( byte7 )
470      {
471         lampbase = 128 + column * 8;
472      }
473      else
474      {
475         lampbase = 192 + column * 8;
476      }
477      if ( data & 0x3f )
478      {
479         lamp_sense = 1;
480      }
481       if ( active )
482      {
483         for (i = 0; i < 6; i++)
484         {
485            Lamps[(lampbase)+i]    = (data  & (1 << i)) != 0;
486         }
487      }
488   last_b7 = byte7;
489   }
490   else
491   {
492      card_live = 0;
493   }
494}
495
496static void led_write_latch(int latch, int data, int column)
497{
498   int diff;
499
500   diff = (latch ^ last_latch) & latch;
501   column = 7 - column;
502   data = ~data;//inverted?
503
504   if ( diff & 1 )
505   {
506      led_segs[column] = data;
507    }
508   if ( diff & 2 )
509   {
510      led_segs[8+column] = data;
511   }
512   if ( diff & 4 )
513   {
514      led_segs[16+column] = data;
515   }
516   if ( diff & 8 )
517   {
518      led_segs[24+column] = data;
519   }
520   if ( diff & 16 )
521   {
522      led_segs[32+column] = data;
523   }
524   last_latch = diff;
525}
526
527
528static void update_meters(void)
529{
530   int meter;
531   int data = ((mmtr_data & 0x7f) | remote_meter);
532   switch (reel_mux)
533   {
534      case STANDARD_REEL:
535      // Change nothing
536      break;
537      case FIVE_REEL_5TO8:
538      stepper_update(4, (data >> 4));
539      data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements
540      awp_draw_reel(4);
541      break;
542      case FIVE_REEL_8TO5:
543      stepper_update(4, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ;
544      data = 0x00; //Strip all reel data from meter drives, nothing is connected
545      awp_draw_reel(4);
546      break;
547      case FIVE_REEL_3TO6:
548      stepper_update(4, ((data >> 2) & 0x0f));
549      data = 0x00; //Strip all reel data from meter drives
550      awp_draw_reel(4);
551      break;
552      case SIX_REEL_1TO8:
553      stepper_update(4, (data & 0x0f));
554      stepper_update(5, ((data >> 4) & 0x0f));
555      data = 0x00; //Strip all reel data from meter drives
556      awp_draw_reel(4);
557      awp_draw_reel(5);
558      break;
559      case SIX_REEL_5TO8:
560      stepper_update(4, ((data >> 4) & 0x0f));
561      data = 0x00; //Strip all reel data from meter drives
562      awp_draw_reel(4);
563      break;
564      case SEVEN_REEL:
565      stepper_update(0, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ;
566      data = 0x00; //Strip all reel data from meter drives
567      awp_draw_reel(0);
568      break;
569   }
570
571   MechMtr_update(7, (data & 0x80));
572   for (meter = 0; meter < 4; meter ++)
573   {
574      MechMtr_update(meter, (data & (1 << meter)));
575   }
576   if (reel_mux == STANDARD_REEL)
577   {
578      for (meter = 4; meter < 7; meter ++)
579      {
580         MechMtr_update(meter, (data & (1 << meter)));
581      }
582   }
583}
584
365585/* called if board is reset */
366586static void mpu4_stepper_reset(void)
367587{
r10315r10316
427647                   pia6821_get_irq_a(pia8) | pia6821_get_irq_b(pia8) |
428648                   ptm6840_get_irq(ptm2);
429649
430   if (!link7a_connected)
650   if (!link7a_connected) //7B = IRQ, 7A = FIRQ, both = NMI
431651   {
432652      cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
433653      LOG(("6809 int%d \n", combined_state));
r10315r10316
439659   }
440660}
441661
442/*static WRITE_LINE_DEVICE_HANDLER( cpu0_irq_m6840 )
443{
444//  cpu0_irq(device->machine->device("pia_ic3"), state);
445    cpu0_irq(device->machine->device("6840ptm"), state);
446}*/
447
448
449662/* Bankswitching */
450663static WRITE8_HANDLER( bankswitch_w )
451664{
r10315r10316
466679
467680   /* copy output value to IC2 c2
468681    this output is the clock for timer2 */
682   /* 1200Hz System interrupt timer */
469683}
470684
471685
r10315r10316
473687{
474688   device_t *pia = device->machine->device("pia_ic3");
475689   pia6821_ca1_w(pia, data); /* copy output value to IC3 ca1 */
476
477690   /* the output from timer2 is the input clock for timer3 */
691   /* miscellaneous interrupts generated here */
478692   ptm6840_set_c3(device, 0, data);
479693}
480694
r10315r10316
483697{
484698   /* the output from timer3 is used as a square wave for the alarm output
485699    and as an external clock source for timer 1! */
486
700   /* also runs lamp fade */
487701   ptm6840_set_c1(device, 0, data);
488702}
489703
r10315r10316
495709   { DEVCB_HANDLER(ic2_o1_callback),
496710     DEVCB_HANDLER(ic2_o2_callback),
497711     DEVCB_HANDLER(ic2_o3_callback) },
498   DEVCB_LINE(cpu0_irq)//_m6840)
712   DEVCB_LINE(cpu0_irq)
499713};
500714
501715
r10315r10316
628842}
629843
630844
631/* IC4 IC4, 7 seg leds, 50Hz timer reel sensors, current sensors */
845/* IC4, 7 seg leds, 50Hz timer reel sensors, current sensors */
632846static WRITE8_DEVICE_HANDLER( pia_ic4_porta_w )
633847{
634848   if(ic23_active)
635849   {
850      if (((lamp_extender == NO_EXTENDER)||(lamp_extender == SMALL_CARD)||(lamp_extender == LARGE_CARD_C))&& (led_extender == NO_EXTENDER))
636851      led_segs[input_strobe] = data;
637      mpu4_draw_led(input_strobe, led_segs[input_strobe]);
638852   }
639853}
640854
855static WRITE8_DEVICE_HANDLER( pia_ic4_portb_w )
856{
857   if (reel_mux)
858   {
859      /* A write here connects one reel (and only one)
860      to the optic test circuit. This allows 8 reels
861      to be supported instead of 4. */
862      if (reel_mux == SEVEN_REEL)
863      {
864         active_reel= reel_mux_table7[(data >> 4) & 0x07];
865      }
866      else
867      active_reel= reel_mux_table[(data >> 4) & 0x07];
868   }
869}
641870
871
642872static READ8_DEVICE_HANDLER( pia_ic4_portb_r )
643873{
644874   if ( serial_data )
r10315r10316
652882      pia6821_cb1_w(device, 0);
653883   }
654884
655   if ( optic_pattern & 0x01 ) ic4_input_b |=  0x40; /* reel A tab */
656   else                        ic4_input_b &= ~0x40;
885   if (!reel_mux)
886   {
887      if ( optic_pattern & 0x01 ) ic4_input_b |=  0x40; /* reel A tab */
888      else                        ic4_input_b &= ~0x40;
657889
658   if ( optic_pattern & 0x02 ) ic4_input_b |=  0x20; /* reel B tab */
659   else                        ic4_input_b &= ~0x20;
890      if ( optic_pattern & 0x02 ) ic4_input_b |=  0x20; /* reel B tab */
891      else                        ic4_input_b &= ~0x20;
660892
661   if ( optic_pattern & 0x04 ) ic4_input_b |=  0x10; /* reel C tab */
662   else                        ic4_input_b &= ~0x10;
893      if ( optic_pattern & 0x04 ) ic4_input_b |=  0x10; /* reel C tab */
894      else                        ic4_input_b &= ~0x10;
663895
664   if ( optic_pattern & 0x08 ) ic4_input_b |=  0x08; /* reel D tab */
665   else                        ic4_input_b &= ~0x08;
896      if ( optic_pattern & 0x08 ) ic4_input_b |=  0x08; /* reel D tab */
897      else                        ic4_input_b &= ~0x08;
666898
899   }
900   else
901   {
902      if (stepper_optic_state(active_reel))
903      {
904         ic4_input_b |=  0x08;
905      }
906      else
907      {
908         ic4_input_b &= ~0x08;
909      }
910   }
667911   if ( signal_50hz )         ic4_input_b |=  0x04; /* 50 Hz */
668912   else                       ic4_input_b &= ~0x04;
669913
670   ic4_input_b |= 0x02; //By triggering the overcurrent circuit here, we can make the MPU4 lamp test pass.
914   if (ic4_input_b & 0x02)
915   {
916      ic4_input_b &= ~0x02;
917   }
918   else
919   {
920      ic4_input_b |= 0x02; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
921   }
671922   #ifdef UNUSED_FUNCTION
672   if ( lamp_overcurrent  ) ic4_input_b |= 0x02;
673923   if ( lamp_undercurrent ) ic4_input_b |= 0x01;
674924   #endif
675925
r10315r10316
700950   DEVCB_NULL,      /* line CA2 in */
701951   DEVCB_NULL,      /* line CB2 in */
702952   DEVCB_HANDLER(pia_ic4_porta_w),      /* port A out */
703   DEVCB_NULL,      /* port B out */
953   DEVCB_HANDLER(pia_ic4_portb_w),      /* port B out */
704954   DEVCB_LINE(pia_ic4_ca2_w),      /* line CA2 out */
705955   DEVCB_LINE(pia_ic4_cb2_w),      /* line CB2 out */
706956   DEVCB_LINE(cpu0_irq),      /* IRQA */
r10315r10316
710960/* IC5, AUX ports, coin lockouts and AY sound chip select (MODs below 4 only) */
711961static READ8_DEVICE_HANDLER( pia_ic5_porta_r )
712962{
963   if (lamp_extender == LARGE_CARD_A)
964   {
965      if (lamp_sense && ic23_active)
966      {
967         aux1_input |= 0x40;
968      }
969      else
970      {
971         aux1_input &= ~0x40; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
972      }
973   }
974   if (hopper == HOPPER_NONDUART_A)
975   {
976/*      if (hopper1_active)
977      {
978         aux1_input |= 0x04;
979      }
980      else
981      {
982         aux1_input &= ~0x04;
983      }*/
984   }
713985   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",cpuexec_describe_context(device->machine)));
714986
715   return input_port_read(device->machine, "AUX1");
987   return input_port_read(device->machine, "AUX1")|aux1_input;
716988}
717989
990static WRITE8_DEVICE_HANDLER( pia_ic5_porta_w )
991{
992   device_t *pia_ic4 = device->machine->device("pia_ic5");
993   if (hopper == HOPPER_NONDUART_A)
994   {
995      //hopper1_drive_sensor(data&0x10);
996   }
997   switch (lamp_extender)
998   {
999   case NO_EXTENDER:
1000      if (led_extender == CARD_B)
1001      {
1002         led_write_latch(data & 0x1f, pia6821_get_output_a(pia_ic4),input_strobe);
1003      }
1004      else if ((led_extender != CARD_A)||(led_extender != NO_EXTENDER))
1005      {
1006         led_segs[(input_strobe+8)] = data;
1007      }
1008      break;
1009   case SMALL_CARD:
1010      if(ic23_active)
1011      {
1012         lamp_extend_small(data);
1013      }
1014      break;
1015   case LARGE_CARD_A:
1016      lamp_extend_largea(data,input_strobe,ic23_active);
1017      break;
1018   case LARGE_CARD_B:
1019      lamp_extend_largebc(data,input_strobe,ic23_active);
1020      if ((ic23_active) && card_live)
1021      {
1022         led_segs[(8*(last_b7 >>7))+input_strobe] = (~data);
1023      }
1024      break;
1025   case LARGE_CARD_C:
1026      lamp_extend_largebc(data,input_strobe,ic23_active);
1027      break;
1028   }
1029   if (reel_mux == SIX_REEL_5TO8)
1030   {
1031      stepper_update(4, data&0x0F);
1032      stepper_update(5, (data >> 4)&0x0F);
1033      awp_draw_reel(4);
1034      awp_draw_reel(5);
1035   }
1036   else
1037   if (reel_mux == SEVEN_REEL)
1038   {
1039      stepper_update(1, data&0x0F);
1040      stepper_update(2, (data >> 4)&0x0F);
1041      awp_draw_reel(1);
1042      awp_draw_reel(2);
1043   }
7181044
1045}
1046
1047static WRITE8_DEVICE_HANDLER( pia_ic5_portb_w )
1048{
1049   if (hopper == HOPPER_NONDUART_B)
1050   {
1051      //hopper1_drive_motor(data &0x01)
1052      //hopper1_drive_sensor(data &0x08)
1053   }
1054   if (led_extender == CARD_A)
1055   {
1056      // led_write_latch(data & 0x07, pia_get_output_a(pia_ic4),input_strobe)
1057   }
1058}
7191059static READ8_DEVICE_HANDLER( pia_ic5_portb_r )
7201060{
7211061   device_t *pia_ic5 = device->machine->device("pia_ic5");
1062   if (hopper == HOPPER_NONDUART_B)
1063   {/*
1064      if (hopper1_active)
1065      {
1066         aux2_input |= 0x08;
1067      }
1068      else
1069      {
1070         aux2_input &= ~0x08;
1071      }*/
1072   }
1073
7221074   LOG(("%s: IC5 PIA Read of Port B (coin input AUX2)\n",cpuexec_describe_context(device->machine)));
7231075   coin_lockout_w(device->machine, 0, (pia6821_get_output_b(pia_ic5) & 0x01) );
7241076   coin_lockout_w(device->machine, 1, (pia6821_get_output_b(pia_ic5) & 0x02) );
7251077   coin_lockout_w(device->machine, 2, (pia6821_get_output_b(pia_ic5) & 0x04) );
7261078   coin_lockout_w(device->machine, 3, (pia6821_get_output_b(pia_ic5) & 0x08) );
727   return input_port_read(device->machine, "AUX2");
1079   return input_port_read(device->machine, "AUX2") | aux2_input;
7281080}
7291081
7301082
r10315r10316
8151167   DEVCB_NULL,      /* line CB1 in */
8161168   DEVCB_NULL,      /* line CA2 in */
8171169   DEVCB_NULL,      /* line CB2 in */
818   DEVCB_NULL,      /* port A out */
819   DEVCB_NULL,      /* port B out */
1170   DEVCB_HANDLER(pia_ic5_porta_w),      /* port A out */
1171   DEVCB_HANDLER(pia_ic5_portb_w),      /* port B out */
8201172   DEVCB_LINE(pia_ic5_ca2_w),      /* line CA2 out */
8211173   DEVCB_LINE(pia_ic5_cb2_w),      /* port CB2 out */
8221174   DEVCB_LINE(cpu0_irq),         /* IRQA */
r10315r10316
8281180static WRITE8_DEVICE_HANDLER( pia_ic6_portb_w )
8291181{
8301182   LOG(("%s: IC6 PIA Port B Set to %2x (Reel A and B)\n", cpuexec_describe_context(device->machine),data));
831   stepper_update(0, data & 0x0F );
832   stepper_update(1, (data>>4) & 0x0F );
8331183
834   if (reel_flag)
1184   if (reel_mux == SEVEN_REEL)
8351185   {
1186      stepper_update(3, data&0x0F);
1187      stepper_update(4, (data >> 4)&0x0F);
1188      awp_draw_reel(3);
1189      awp_draw_reel(4);
1190   }
1191   else
1192   {
1193      stepper_update(0, data & 0x0F );
1194      stepper_update(1, (data>>4) & 0x0F );
1195      awp_draw_reel(0);
1196      awp_draw_reel(1);
1197   }
1198
1199   if (reel_flag && (reel_mux == STANDARD_REEL))
1200   {
8361201      if ( stepper_optic_state(0) ) optic_pattern |=  0x01;
8371202      else                          optic_pattern &= ~0x01;
8381203
8391204      if ( stepper_optic_state(1) ) optic_pattern |=  0x02;
8401205      else                          optic_pattern &= ~0x02;
8411206   }
842   awp_draw_reel(0);
843   awp_draw_reel(1);
8441207}
8451208
8461209
r10315r10316
9001263static WRITE8_DEVICE_HANDLER( pia_ic7_porta_w )
9011264{
9021265   LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", cpuexec_describe_context(device->machine),data));
903   stepper_update(2, data & 0x0F );
904   stepper_update(3, (data >> 4)& 0x0F );
1266   if (reel_mux == SEVEN_REEL)
1267   {
1268      stepper_update(5, data&0x0F);
1269      stepper_update(6, (data >> 4)&0x0F);
1270      awp_draw_reel(5);
1271      awp_draw_reel(6);
1272   }
1273   else
1274   {
1275      stepper_update(2, data & 0x0F );
1276      stepper_update(3, (data>>4) & 0x0F );
1277      awp_draw_reel(2);
1278      awp_draw_reel(3);
1279   }
9051280
906   if (reel_flag)
1281   if (reel_flag && (reel_mux == STANDARD_REEL))
9071282   {
9081283      if ( stepper_optic_state(2) ) optic_pattern |=  0x04;
9091284      else                          optic_pattern &= ~0x04;
9101285      if ( stepper_optic_state(3) ) optic_pattern |=  0x08;
9111286      else                          optic_pattern &= ~0x08;
9121287   }
913   awp_draw_reel(2);
914   awp_draw_reel(3);
9151288}
9161289
917
9181290static WRITE8_DEVICE_HANDLER( pia_ic7_portb_w )
9191291{
920   int meter;
921   UINT64 cycles = device->machine->device<cpu_device>("maincpu")->total_cycles();
1292   if (hopper == HOPPER_DUART_A)
1293   {
1294      //duart write data
1295   }
1296   else if (hopper == HOPPER_NONDUART_A)
1297   {
1298      //hoppr1_drive_motor(data & 0x10);
1299   }
9221300
1301    mmtr_data = data;
1302}
1303
1304static READ8_DEVICE_HANDLER( pia_ic7_portb_r )
1305{
9231306/* The meters are connected to a voltage drop sensor, where current
9241307flowing through them also passes through pin B7, meaning that when
9251308any meter is activated, pin B7 goes high.
9261309As for why they connected this to an output port rather than using
927CB1, no idea.
1310CB1, no idea, although it proved of benefit when the reel multiplexer was designed
1311as it allows a separate meter to be used when the rest of the port is blocked.
9281312This appears to have confounded the schematic drawer, who has assumed that
9291313all eight meters are driven from this port, giving the 8 line driver chip
93013149 connections in total. */
9311315
932   mmtr_data = data;
933   if (mmtr_data)
1316   //This may be overkill, but the meter sensing is VERY picky
1317
1318   int combined_meter = MechMtr_GetActivity(0) | MechMtr_GetActivity(1) |
1319                   MechMtr_GetActivity(2) | MechMtr_GetActivity(3) |
1320                   MechMtr_GetActivity(4) | MechMtr_GetActivity(5) |
1321                   MechMtr_GetActivity(6) | MechMtr_GetActivity(7);
1322
1323   if(combined_meter)
9341324   {
935      pia6821_portb_w(device, 0, mmtr_data | 0x80);
936      for (meter = 0; meter < 8; meter ++)
937      if (mmtr_data & (1 << meter))   Mechmtr_update(meter, cycles, mmtr_data & (1 << meter));
1325      return 0x80;
9381326   }
9391327   else
9401328   {
941      pia6821_portb_w(device, 0, mmtr_data &~0x80);
1329      return 0x00;
9421330   }
943
944   LOG(("%s: IC7 PIA Port B Set to %2x (Meters, Reel E and F)\n", cpuexec_describe_context(device->machine),data));
9451331}
9461332
9471333
1334
1335
1336
1337
1338
9481339static WRITE_LINE_DEVICE_HANDLER( pia_ic7_ca2_w )
9491340{
9501341   LOG(("%s: IC7 PIA write CA2 %2x (input strobe bit 0 / LED A)\n", cpuexec_describe_context(device->machine),state));
r10315r10316
9541345   ic23_update();
9551346}
9561347
957
9581348static WRITE_LINE_DEVICE_HANDLER( pia_ic7_cb2_w )
9591349{
960/* The eighth meter is connected here, because the voltage sensor
961is on PB7. */
962   UINT64 cycles = device->machine->device<cpu_device>("maincpu")->total_cycles();
963   if (state)
964   {
965      pia6821_portb_w(device, 0, mmtr_data|0x80);
966      Mechmtr_update(7, cycles, state );
967   }
968   LOG(("%s: IC7 PIA write CB2 %2x \n", cpuexec_describe_context(device->machine),state));
1350   remote_meter = state?0x80:0x00;
9691351}
9701352
971
9721353static const pia6821_interface pia_ic7_intf =
9731354{
9741355   DEVCB_NULL,      /* port A in */
975   DEVCB_NULL,      /* port B in */
1356   DEVCB_HANDLER(pia_ic7_portb_r),      /* port B in */
9761357   DEVCB_NULL,      /* line CA1 in */
9771358   DEVCB_NULL,      /* line CB1 in */
9781359   DEVCB_NULL,      /* line CA2 in */
r10315r10316
9801361   DEVCB_HANDLER(pia_ic7_porta_w),      /* port A out */
9811362   DEVCB_HANDLER(pia_ic7_portb_w),      /* port B out */
9821363   DEVCB_LINE(pia_ic7_ca2_w),         /* line CA2 out */
983   DEVCB_LINE(pia_ic7_cb2_w),         /* port CB2 out */
1364   DEVCB_LINE(pia_ic7_cb2_w),         /* line CB2 out */
9841365   DEVCB_LINE(cpu0_irq),            /* IRQA */
9851366   DEVCB_LINE(cpu0_irq)            /* IRQB */
9861367};
r10315r10316
10031384
10041385static WRITE8_DEVICE_HANDLER( pia_ic8_portb_w )
10051386{
1387   if (hopper == HOPPER_DUART_B)
1388   {
1389//      duart.drive_sensor(data & 0x04, data & 0x01, 0, 0);
1390   }
1391   else if (hopper == HOPPER_DUART_C)
1392   {
1393//      duart.drive_sensor(data & 0x04, data & 0x01, data & 0x04, data & 0x02);
1394   }
10061395   int i;
10071396   LOG_IC8(("%s: IC8 PIA Port B Set to %2x (OUTPUT PORT, TRIACS)\n", cpuexec_describe_context(device->machine),data));
10081397   for (i = 0; i < 8; i++)
1009      if ( data & (1 << i) )      output_set_indexed_value("triac", i, data & (1 << i));
1398   {
1399      output_set_indexed_value("triac", i, data & (1 << i));
1400   }
10101401}
10111402
1012
10131403static WRITE_LINE_DEVICE_HANDLER( pia_ic8_ca2_w )
10141404{
10151405   LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", cpuexec_describe_context(device->machine), state & 0xFF));
r10315r10316
10491439};
10501440
10511441
1442// Sampled sound card, using a PIA and PTM for timing and data handling
10521443static WRITE8_DEVICE_HANDLER( pia_gb_porta_w )
10531444{
10541445   device_t *msm6376 = device->machine->device("msm6376");
1055
1056   LOG(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data));
1446   LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data));
10571447   okim6376_w(msm6376, 0, data);
10581448}
10591449
r10315r10316
10611451{
10621452   int changed = expansion_latch^data;
10631453
1064   LOG(("%s: GAMEBOARD: PIA Port B Set to %2x\n", cpuexec_describe_context(device->machine),data));
1454   LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data));
10651455
10661456   expansion_latch = data;
10671457
r10315r10316
10811471         {
10821472//              float percent = (32-global_volume)/32.0; //volume_override?1.0:(32-global_volume)/32.0;
10831473//              LOG(("GAMEBOARD: OKI volume %f \n",percent));
1084//              sndti_set_output_gain(SOUND_OKIM6295,  0, 0, percent);
10851474         }
10861475      }
10871476   }
10881477}
10891478static READ8_DEVICE_HANDLER( pia_gb_portb_r )
10901479{
1091   LOG(("%s: GAMEBOARD: PIA Read of Port B\n",cpuexec_describe_context(device->machine)));
1480   device_t *msm6376 = device->machine->device("msm6376");
1481   LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n",cpuexec_describe_context(device->machine)));
10921482   //
10931483   // b7, 1 = OKI ready, 0 = OKI busy
10941484   // b5, vol clock
10951485   // b4, 1 = Vol down, 0 = Vol up
10961486   //
10971487
1098//if (offset == 0x40)
1099//{
1100//  return OKIM6295_status_r(0);
1101//}
1102   return 0x40;
1488   return okim6376_r(msm6376,0);
11031489}
11041490
11051491static WRITE_LINE_DEVICE_HANDLER( pia_gb_ca2_w )
11061492{
1107   LOG(("%s: GAMEBOARD: OKI RESET data = %02X\n", cpuexec_describe_context(device->machine), state));
1493   LOG_SS(("%s: GAMEBOARD: OKI RESET data = %02X\n", cpuexec_describe_context(device->machine), state));
11081494
1109//  return okim6376_status_0_r();
1495//  reset line
11101496}
11111497
1112static const pia6821_interface pia_gameboard_intf =
1498static const pia6821_interface pia_ic4ss_intf =
11131499{
11141500   DEVCB_NULL,      /* port A in */
11151501   DEVCB_HANDLER(pia_gb_portb_r),   /* port B in */
r10315r10316
11251511   DEVCB_NULL      /* IRQB */
11261512};
11271513
1514//Sampled sound timer
1515/*
1516FIXME
1517The MSM6376 sound chip is configured in a slightly strange way, to enable dynamic
1518sample rate changes (8Khz, 10.6 Khz, 16 KHz) by varying the clock.
1519According to the BwB programmer's guide, the formula is:
1520MSM6376 clock frequency:-
1521freq = (1720000/((t3L+1)(t3H+1)))*[(t3H(T3L+1)+1)/(2(t1+1))]
1522where [] means rounded up integer,
1523t3L is the LSB of Clock 3,
1524t3H is the MSB of Clock 3,
1525and t1 is the figure added to clock 1.
11281526
1527The sample speed divisor is f/300
1528*/
1529
1530//O3 -> G1  O1 -> c2 o2 -> c1
1531static WRITE8_DEVICE_HANDLER( ic3ss_o1_callback )
1532{
1533   ptm6840_set_c2(device, 0, data);
1534}
1535
1536
1537static WRITE8_DEVICE_HANDLER( ic3ss_o2_callback )//Generates 'beep' tone
1538{
1539   ptm6840_set_c1(device, 0, data);//?
1540}
1541
1542
1543static WRITE8_DEVICE_HANDLER( ic3ss_o3_callback )
1544{
1545   ptm6840_set_g1(device, 0, data); /* this output is the clock for timer1 */
1546}
1547
1548
1549static const ptm6840_interface ptm_ic3ss_intf =
1550{
1551   MPU4_MASTER_CLOCK / 4,
1552   { 0, 0, 0 },
1553   { DEVCB_HANDLER(ic3ss_o1_callback),
1554     DEVCB_HANDLER(ic3ss_o2_callback),
1555     DEVCB_HANDLER(ic3ss_o3_callback) },
1556   DEVCB_NULL//LINE(cpu1_ptm_irq)
1557};
1558
11291559/* input ports for MPU4 board */
11301560static INPUT_PORTS_START( mpu4 )
11311561   PORT_START("ORANGE1")
r10315r10316
14501880   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
14511881
14521882   PORT_START("AUX1")
1453/*  PORT_DIPNAME( 0x01, 0x00, "AUX101" )
1454    PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1455    PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1456    PORT_DIPNAME( 0x02, 0x00, "AUX102" )
1457    PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1458    PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1459    PORT_DIPNAME( 0x04, 0x00, "AUX103" )
1460    PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1461    PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1462    PORT_DIPNAME( 0x08, 0x00, "AUX104" )
1463    PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1464    PORT_DIPSETTING(    0x08, DEF_STR( On  ) )*/
14651883   PORT_DIPNAME( 0x10, 0x00, "AUX105" )
14661884   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
14671885   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
r10315r10316
14891907static const stepper_interface barcrest_reel_interface =
14901908{
14911909   BARCREST_48STEP_REEL,
1492   0,
1493   8,
1910   92,
1911   4,
14941912   0x00
14951913};
1914static const stepper_interface barcrest_opto1_interface =
1915{
1916   BARCREST_48STEP_REEL,
1917   4,
1918   12,
1919   0x00
1920};
14961921
14971922/* Common configurations */
14981923static void mpu4_config_common(running_machine *machine)
14991924{
1500   ic24_timer = timer_alloc(machine, ic24_timeout, NULL);
1925   ic24_timer = machine->scheduler().timer_alloc(FUNC(ic24_timeout));
15011926}
15021927
1928static void mpu4_config_common_reels(running_machine *machine,int reels)
1929{
1930   int n;
1931   /* setup n default 96 half step reels, using the standard optic flag */
1932   for ( n = 0; n < reels; n++ )
1933   {
1934      stepper_config(machine, n, &barcrest_reel_interface);
1935   }
1936   awp_reel_setup();
1937}
1938
15031939static MACHINE_START( mpu4mod2 )
15041940{
15051941   mpu4_config_common(machine);
r10315r10316
15081944   mod_number=2;
15091945
15101946   /* setup 8 mechanical meters */
1511   Mechmtr_init(8);
1947   MechMtr_config(machine,8);
15121948
1513   /* setup 4 reels */
1514   stepper_config(machine, 0, &barcrest_reel_interface);
1515   stepper_config(machine, 1, &barcrest_reel_interface);
1516   stepper_config(machine, 2, &barcrest_reel_interface);
1517   stepper_config(machine, 3, &barcrest_reel_interface);
1518
15191949   /* setup the standard oki MSC1937 display */
15201950   ROC10937_init(0, MSC1937,0);
15211951}
r10315r10316
15271957   link7a_connected=0;
15281958
15291959// setup 8 mechanical meters ////////////////////////////////////////////
1530   Mechmtr_init(8);
1960   MechMtr_config(machine,8);
15311961
1532// setup 4 default 96 half step reels ///////////////////////////////////
1533   stepper_config(machine, 0, &barcrest_reel_interface);
1534   stepper_config(machine, 1, &barcrest_reel_interface);
1535   stepper_config(machine, 2, &barcrest_reel_interface);
1536   stepper_config(machine, 3, &barcrest_reel_interface);
1537
15381962// setup the standard oki MSC1937 display ///////////////////////////////
1539   ROC10937_init(0, MSC1937,1);   // does oldtimer use a OKI MSC1937 alpha display controller?
1963   ROC10937_init(0, MSC1937,0);   // does oldtimer use a OKI MSC1937 alpha display controller?
15401964}
15411965
15421966static MACHINE_START( mpu4mod4 )
r10315r10316
15471971   mod_number=4;
15481972
15491973// setup 8 mechanical meters ////////////////////////////////////////////
1550   Mechmtr_init(8);
1974   MechMtr_config(machine,8);
15511975
1552// setup 4 default 96 half step reels ///////////////////////////////////
1553   stepper_config(machine, 0, &barcrest_reel_interface);
1554   stepper_config(machine, 1, &barcrest_reel_interface);
1555   stepper_config(machine, 2, &barcrest_reel_interface);
1556   stepper_config(machine, 3, &barcrest_reel_interface);
1557
1558   awp_reel_setup();
15591976// setup the standard oki MSC1937 display ///////////////////////////////
15601977   ROC10937_init(0, MSC1937,0);
15611978}
r10315r10316
15631980/*
15641981Characteriser (CHR)
15651982
1566I haven't been able to work out all the ways of finding the CHR data, but there must be a flag in the ROMs
1567somewhere to pick it out. As built, the CHR is a PAL which can perform basic bit manipulation according to an as yet unknown unique key. However, the programmers decided to best use this protection device in read/write/compare
1983As built, the CHR is a PAL which can perform basic bit manipulation according to
1984an as yet unknown unique key. However, the programmers decided to best use this protection device in read/write/compare
15681985cycles, storing almost the entire 'hidden' data table in the ROMs in plain sight. Only later rebuilds by BwB
1569avoided this 'feature' of the development kit, and as such, only low level access can defeat their protection.
1986avoided this 'feature' of the development kit, and will need a different setup.
15701987
15711988This information has been used to generate the CHR tables loaded by the programs, until a key can be determined.
15721989
15731990For most Barcrest games, the following method was used:
15741991
1575To calculate the values necessary to program the CHR, we must first find the version string, taking
1576the example of an AWP called Club Celebration, this starts at 0xff28 and terminates at 0xff2f.
15770xff2f then represents the CHR address.
1578For some reason, the tables always seem to start and end with '00 00'.
1579
1580From that point on, every word represents a call and response pair, until we have generated 8 8 byte rows of data.
1581
1582The call values appear to be fixed, so it would be possible to make a switch statement, but I believe the emulated
1583behaviour to be more likely.
1584
15851992The initial 'PALTEST' routine as found in the Barcrest programs simply writes the first 'call' to the CHR space,
15861993to read back the 'response'. There is no attempt to alter the order or anything else, just
15871994a simple runthrough of the entire data table. The only 'catch' in this is to note that the CHR chip always scans
r10315r10316
15992006   int x;
16002007   int call=data;
16012008   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(space->cpu),offset,data));
1602
16032009   if (!mpu4_current_chr_table)
16042010      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu));
16052011
16062012   if (offset == 0)
16072013   {
1608   //  for (x = prot_col; x < 64; x++)
16092014      {
16102015         if (call == 0)
16112016         {
r10315r10316
16282033   else if (offset == 2)
16292034   {
16302035      LOG_CHR(("Characteriser write 2 data %02X\n",data));
1631      for (x = lamp_col; x < 16; x++)
2036      switch (call)
2037      // Rather than the search strategy, we can map the calls directly here. Note that they are hex versions of the square number series
16322038      {
1633         if   (mpu4_current_chr_table[(64+x)].call == call)
1634         {
1635            lamp_col = x;
1636            LOG_CHR(("Characteriser find column %02X\n",lamp_col));
1637            break;
1638         }
1639         if (lamp_col > 7)
1640         {
1641            lamp_col = 0;
1642         }
2039         case 0x00:
2040         lamp_col = 0;
2041         break;
2042         case 0x01:
2043         lamp_col = 1;
2044         break;
2045         case 0x04:
2046         lamp_col = 2;
2047         break;
2048         case 0x09:
2049         lamp_col = 3;
2050         break;
2051         case 0x10:
2052         lamp_col = 4;
2053         break;
2054         case 0x19:
2055         lamp_col = 5;
2056         break;
2057         case 0x24:
2058         lamp_col = 6;
2059         break;
2060         case 0x31:
2061         lamp_col = 7;
2062         break;
16432063      }
2064      LOG_CHR(("Characteriser find 2 column %02X\n",lamp_col));
16442065   }
16452066}
16462067
r10315r10316
16512072      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu));
16522073
16532074   LOG_CHR(("Characteriser read offset %02X \n",offset));
1654   LOG_CHR_FULL(("%04x Characteriser read offset %02X", cpu_get_previouspc(space->cpu),offset));
16552075   if (offset == 0)
16562076   {
1657      LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[prot_col]));
2077      LOG_CHR(("Characteriser read data %02X \n",mpu4_current_chr_table[prot_col].response));
16582078      return mpu4_current_chr_table[prot_col].response;
16592079   }
16602080   if (offset == 3)
16612081   {
1662      LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[lamp_col+64]));
2082      LOG_CHR(("Characteriser read data off 3 %02X \n",mpu4_current_chr_table[lamp_col+64].response));
16632083      return mpu4_current_chr_table[lamp_col+64].response;
16642084   }
16652085   return 0;
r10315r10316
16892109{0x00, 0x00},{0x01, 0x18},{0x04, 0x08},{0x09, 0x10},{0x10, 0x00},{0x19, 0x18},{0x24, 0x08},{0x31, 0x00}
16902110};
16912111
2112static const mpu4_chr_table grtecp_data[72] = {
2113{0x00, 0x00},{0x1a, 0x84},{0x04, 0xa4},{0x10, 0xac},{0x18, 0x70},{0x0f, 0x80},{0x13, 0x2c},{0x1b, 0xc0},
2114{0x03, 0xbc},{0x07, 0x5c},{0x17, 0x5c},{0x1d, 0x5c},{0x36, 0xdc},{0x35, 0x5c},{0x2b, 0xcc},{0x28, 0x68},
2115{0x39, 0xd0},{0x21, 0xb8},{0x22, 0xdc},{0x25, 0x54},{0x2c, 0x08},{0x29, 0x58},{0x31, 0x54},{0x34, 0x90},
2116{0x0a, 0xb8},{0x1f, 0x5c},{0x06, 0x5c},{0x0e, 0x44},{0x1c, 0x84},{0x12, 0xac},{0x1e, 0xe0},{0x0d, 0xbc},
2117{0x14, 0xcc},{0x0a, 0xe8},{0x19, 0x70},{0x15, 0x00},{0x06, 0x8c},{0x0f, 0x70},{0x08, 0x00},{0x1b, 0x84},
2118{0x1e, 0xa4},{0x04, 0xa4},{0x01, 0xbc},{0x0c, 0xdc},{0x18, 0x5c},{0x1a, 0xcc},{0x11, 0xe8},{0x0b, 0xe0},
2119{0x03, 0xbc},{0x17, 0x4c},{0x10, 0xc8},{0x1d, 0xf8},{0x0e, 0xd4},{0x07, 0xa8},{0x12, 0x68},{0x09, 0x40},
2120{0x0d, 0x0c},{0x1f, 0xd8},{0x16, 0xdc},{0x05, 0x54},{0x13, 0x98},{0x1c, 0x44},{0x02, 0x9c},{0x00, 0x00},
2121{0x00, 0x00},{0x01, 0x18},{0x04, 0x00},{0x09, 0x18},{0x10, 0x08},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00}
2122};
2123
2124static const mpu4_chr_table oldtmr_data[72] = {
2125{0x00, 0x00},{0x1a, 0x90},{0x04, 0xc0},{0x10, 0x54},{0x18, 0xa4},{0x0f, 0xf0},{0x13, 0x64},{0x1b, 0x90},
2126{0x03, 0xe4},{0x07, 0xd4},{0x17, 0x60},{0x1d, 0xb4},{0x36, 0xc0},{0x35, 0x70},{0x2b, 0x80},{0x28, 0x74},
2127{0x39, 0xa4},{0x21, 0xf4},{0x22, 0xe4},{0x25, 0xd0},{0x2c, 0x64},{0x29, 0x10},{0x31, 0x20},{0x34, 0x90},
2128{0x0a, 0xe4},{0x1f, 0xf4},{0x06, 0xc4},{0x0e, 0x70},{0x1c, 0x00},{0x12, 0x14},{0x1e, 0x00},{0x0d, 0x14},
2129{0x14, 0xa0},{0x0a, 0xf0},{0x19, 0x64},{0x15, 0x10},{0x06, 0x84},{0x0f, 0x70},{0x08, 0x00},{0x1b, 0x90},
2130{0x1e, 0x40},{0x04, 0x90},{0x01, 0xe4},{0x0c, 0xf4},{0x18, 0x64},{0x1a, 0x90},{0x11, 0x64},{0x0b, 0x90},
2131{0x03, 0xe4},{0x17, 0x50},{0x10, 0x24},{0x1d, 0xb4},{0x0e, 0xe0},{0x07, 0xd4},{0x12, 0xe4},{0x09, 0x50},
2132{0x0d, 0x04},{0x1f, 0xb4},{0x16, 0xc0},{0x05, 0xd0},{0x13, 0x64},{0x1c, 0x90},{0x02, 0xe4},{0x00, 0x00},
2133{0x00, 0x00},{0x01, 0x00},{0x04, 0x00},{0x09, 0x00},{0x10, 0x00},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00}
2134};
2135
2136static DRIVER_INIT (m_oldtmr)
2137{
2138   reel_mux=SIX_REEL_1TO8;
2139
2140   stepper_config(machine, 0, &barcrest_opto1_interface);
2141   stepper_config(machine, 1, &barcrest_opto1_interface);
2142   stepper_config(machine, 2, &barcrest_opto1_interface);
2143   stepper_config(machine, 3, &barcrest_opto1_interface);
2144   stepper_config(machine, 4, &barcrest_opto1_interface);
2145   stepper_config(machine, 5, &barcrest_opto1_interface);
2146
2147   awp_reel_setup();
2148   mpu4_current_chr_table = oldtmr_data;
2149}
2150
16922151static DRIVER_INIT (m_ccelbr)
16932152{
2153   reel_mux=STANDARD_REEL;
2154   // setup 4 default 96 half step reels ///////////////////////////////////
2155   mpu4_config_common_reels(machine,4);
2156
16942157   mpu4_current_chr_table = ccelbr_data;
16952158}
16962159
16972160static DRIVER_INIT (m_gmball)
16982161{
1699      mpu4_current_chr_table = gmball_data;
2162   reel_mux=STANDARD_REEL;
2163   // setup 4 default 96 half step reels ///////////////////////////////////
2164   mpu4_config_common_reels(machine,4);
2165
2166   mpu4_current_chr_table = gmball_data;
17002167}
17012168
2169static DRIVER_INIT (m_grtecp)
2170{
2171   reel_mux=FIVE_REEL_5TO8;
2172   lamp_extender=SMALL_CARD;
2173   // setup 5 default 96 half step reels with the mux board
2174   mpu4_config_common_reels(machine,5);
2175   mpu4_current_chr_table = grtecp_data;
2176}
17022177
2178static DRIVER_INIT (mpu4tst2)
2179{
2180   reel_mux=STANDARD_REEL;
2181   // setup 5 default 96 half step reels with the mux board
2182   mpu4_config_common_reels(machine,4);
2183
2184}
2185
2186static DRIVER_INIT (mpu4utst)
2187{
2188   reel_mux=STANDARD_REEL;
2189   // setup 4 default 96 half step reels ///////////////////////////////////
2190   mpu4_config_common_reels(machine,4);
2191}
2192
2193static DRIVER_INIT (connect4)
2194{
2195   led_lamp=1;
2196}
2197
17032198/* generate a 50 Hz signal (based on an RC time) */
17042199static TIMER_DEVICE_CALLBACK( gen_50hz )
17052200{
r10315r10316
17092204   signal_50hz = signal_50hz?0:1;
17102205   update_lamps();
17112206   pia6821_ca1_w(timer.machine->device("pia_ic4"), signal_50hz);   /* signal is connected to IC4 CA1 */
2207
2208   if (signal_50hz)
2209   {
2210      update_meters();
2211   }
2212
17122213}
17132214
1714
17152215static ADDRESS_MAP_START( mod2_memmap, ADDRESS_SPACE_PROGRAM, 8 )
17162216   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
17172217   AM_RANGE(0x0800, 0x0810) AM_READWRITE(characteriser_r,characteriser_w)
r10315r10316
17622262
17632263   AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w)   // write bank (rom page select)
17642264
1765   AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_gamebd", pia6821_r,pia6821_w)      // PIA6821 on sampled sound board
2265   AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w)      // PIA6821 on sampled sound board
17662266
1767//  AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("??", ptm6840_read, ptm6840_write)  // 6840PTM on sampled sound board
2267   AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write)  // 6840PTM on sampled sound board
17682268
17692269//  AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers
17702270
r10315r10316
17892289//  AM_RANGE(0x0800, 0x0810) AM_READWRITE(characteriser_r,characteriser_w)
17902290
17912291   AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w)   // write bank (rom page select)
1792   AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_gamebd", pia6821_r,pia6821_w)      // PIA6821 on game board
2292   AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w)      // PIA6821 on sampled sound board
17932293
1794//  AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("??", ptm6840_read, ptm6840_write)  // 6840PTM on game board
2294   AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write)  // 6840PTM on sampled sound board
17952295
17962296//  AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers
17972297
r10315r10316
18622362static MACHINE_CONFIG_DERIVED( mod4oki, mpu4mod2 )
18632363   MCFG_MACHINE_START(mpu4mod4)
18642364
1865   MCFG_PIA6821_ADD("pia_gamebd", pia_gameboard_intf)
2365   MCFG_PTM6840_ADD("ptm_ic3ss", ptm_ic3ss_intf)
2366   MCFG_PIA6821_ADD("pia_ic4ss", pia_ic4ss_intf)
18662367
18672368   MCFG_CPU_MODIFY("maincpu")
18682369   MCFG_CPU_PROGRAM_MAP(mod4_oki_map)
18692370
18702371   MCFG_DEVICE_REMOVE("ay8913")
1871   MCFG_SOUND_ADD("msm6376", OKIM6376, 4000000) //?
2372   MCFG_SOUND_ADD("msm6376", OKIM6376, 64000) //Dynamic, can also be 85430 at 10.5KHz and 128000 at 16KHz
18722373   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18732374MACHINE_CONFIG_END
18742375
18752376static MACHINE_CONFIG_DERIVED( mpu4dutch, mod4oki )
18762377   MCFG_CPU_MODIFY("maincpu")
18772378   MCFG_CPU_PROGRAM_MAP(dutch_memmap)            // setup read and write memorymap
1878   MCFG_MACHINE_START(mpu4dutch)                  // main mpu4 board initialisation
2379   MCFG_MACHINE_START(mpu4dutch)               // main mpu4 board initialisation
18792380MACHINE_CONFIG_END
18802381
1881static DRIVER_INIT (connect4)
1882{
1883   led_extend=1;
1884}
1885
18862382ROM_START( m_oldtmr )
18872383   ROM_REGION( 0x10000, "maincpu", 0 )
18882384   ROM_LOAD( "dot11.bin",  0x00000, 0x10000,  CRC(da095666) SHA1(bc7654dc9da1f830a43f925db8079f27e18bb61e))
r10315r10316
19192415   ROM_LOAD( "meter-zero.p1",  0x8000, 0x8000,  CRC(e74297e5) SHA1(49a2cc85eda14199975ec37a794b685c839d3ab9))
19202416ROM_END
19212417
1922//    year, name,    parent,  machine,  input,       init,    monitor, company,         fullname,                                    flags
1923GAME( 198?, m_oldtmr,        0, mpu4dutch,  mpu4,       0,          ROT0, "Barcrest","Old Timer",GAME_NOT_WORKING|GAME_NO_SOUND|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL )
1924GAME( 198?, m_ccelbr,        0, mpu4mod2,   mpu4,   m_ccelbr,   ROT0, "Barcrest","Club Celebration",GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL )
1925GAMEL(198?, m_gmball,        0, mod4yam,    gamball,    m_gmball,   ROT0, "Barcrest","Gamball",GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL,layout_gamball )
2418ROM_START( m_grtecp )
2419   ROM_REGION( 0x10000, "maincpu", 0 )
2420   ROM_LOAD("an2k.p1",  0x00000, 0x10000,  CRC(c0886dff) SHA1(ef2b509fde05ef4ef055a09275afc9e153f50efc))
19262421
2422   ROM_REGION( 0x200000, "msm6376", 0 )
2423   ROM_LOAD( "an2snd.p1",  0x000000, 0x080000,  CRC(5394e9ae) SHA1(86ccd8531fc87f34d3c5482ba7e5a2c06ea69491) )
2424   ROM_LOAD( "an2snd.p2",  0x080000, 0x080000,  CRC(109ace1f) SHA1(9f0e8065186beb61ed50fea834de2d91e68db953) )
2425
2426ROM_END
2427//    year,  name,    parent,  machine,  input,   init,     monitor,company,        fullname,                     flags
2428GAME( 198?,  m_oldtmr,0,      mpu4dutch,mpu4,     m_oldtmr, ROT0,   "Barcrest",      "Old Timer",              GAME_NOT_WORKING|GAME_NO_SOUND|GAME_REQUIRES_ARTWORK )
2429GAME( 198?,  m_ccelbr,0,      mpu4mod2, mpu4,     m_ccelbr, ROT0,   "Barcrest",      "Club Celebration",           GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK )
2430GAMEL(198?,  m_gmball,0,      mod4yam,  gamball,  m_gmball, ROT0,   "Barcrest",     "Gamball",                 GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL,layout_gamball )//Mechanical ball launcher
2431GAMEL(198?,  m_grtecp,0,      mod4oki, mpu4,     m_grtecp, ROT0,   "Barcrest",      "Andy's Great Escape",        GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK,layout_mpu4ext )//5 reel meter mux
2432
19272433//SWP
19282434GAMEL(1989?,connect4,        0, mpu4mod2,   connect4,   connect4,   ROT0, "Dolbeck Systems","Connect 4",GAME_IMPERFECT_GRAPHICS|GAME_REQUIRES_ARTWORK,layout_connect4 )
19292435
19302436//Diagnostic ROMs
1931GAME( 198?, mpu4utst,        0, mpu4mod2,   mpu4,       0,          ROT0, "Barcrest","MPU4 Unit Test (Program 4)",GAME_MECHANICAL )
1932GAME( 198?, mpu4tst2,        0, mpu4mod2,   mpu4,       0,          ROT0, "Barcrest","MPU4 Unit Test (Program 2)",GAME_MECHANICAL )
2437GAME( 198?, mpu4utst,        0, mpu4mod2,   mpu4,       mpu4utst,   ROT0, "Barcrest","MPU4 Unit Test (Program 4)",GAME_MECHANICAL )
2438GAME( 198?, mpu4tst2,        0, mpu4mod2,   mpu4,       mpu4tst2,   ROT0, "Barcrest","MPU4 Unit Test (Program 2)",GAME_MECHANICAL )
19332439GAME( 198?, mpu4met0,        0, mpu4mod2,   mpu4,       0,          ROT0, "Barcrest","MPU4 Meter Clear ROM",GAME_MECHANICAL )
19342440
19352441#include "drivers/mpu4drvr.c"
src/mame/drivers/pipeline.c
r10315r10316
161161
162162static WRITE8_DEVICE_HANDLER(protection_w)
163163{
164   timer_call_after_resynch(device->machine, NULL, data, protection_deferred_w);
164   device->machine->scheduler().synchronize(FUNC(protection_deferred_w), data);
165165   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(100));
166166}
167167
src/mame/drivers/taito_b.c
r10315r10316
194194
195195static INTERRUPT_GEN( rastansaga2_interrupt )
196196{
197   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, rsaga2_interrupt2);
197   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(rsaga2_interrupt2));
198198   cpu_set_input_line(device, 4, HOLD_LINE);
199199}
200200
r10315r10316
207207
208208static INTERRUPT_GEN( crimec_interrupt )
209209{
210   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, crimec_interrupt3);
210   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(crimec_interrupt3));
211211   cpu_set_input_line(device, 5, HOLD_LINE);
212212}
213213
r10315r10316
220220
221221static INTERRUPT_GEN( hitice_interrupt )
222222{
223   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, hitice_interrupt6);
223   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(hitice_interrupt6));
224224   cpu_set_input_line(device, 4, HOLD_LINE);
225225}
226226
r10315r10316
233233
234234static INTERRUPT_GEN( rambo3_interrupt )
235235{
236   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, rambo3_interrupt1);
236   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(rambo3_interrupt1));
237237   cpu_set_input_line(device, 6, HOLD_LINE);
238238}
239239
r10315r10316
246246
247247static INTERRUPT_GEN( pbobble_interrupt )
248248{
249   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, pbobble_interrupt5);
249   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(pbobble_interrupt5));
250250   cpu_set_input_line(device, 3, HOLD_LINE);
251251}
252252
r10315r10316
258258
259259static INTERRUPT_GEN( viofight_interrupt )
260260{
261   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, viofight_interrupt1);
261   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(viofight_interrupt1));
262262   cpu_set_input_line(device, 4, HOLD_LINE);
263263}
264264
r10315r10316
270270
271271static INTERRUPT_GEN( masterw_interrupt )
272272{
273   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, masterw_interrupt4);
273   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(masterw_interrupt4));
274274   cpu_set_input_line(device, 5, HOLD_LINE);
275275}
276276
r10315r10316
282282
283283static INTERRUPT_GEN( silentd_interrupt )
284284{
285   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, silentd_interrupt4);
285   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(silentd_interrupt4));
286286   cpu_set_input_line(device, 6, HOLD_LINE);
287287}
288288
r10315r10316
294294
295295static INTERRUPT_GEN( selfeena_interrupt )
296296{
297   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(5000), NULL, 0, selfeena_interrupt4);
297   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(5000), FUNC(selfeena_interrupt4));
298298   cpu_set_input_line(device, 6, HOLD_LINE);
299299}
300300
r10315r10316
306306
307307static INTERRUPT_GEN( sbm_interrupt )//5
308308{
309   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(10000), NULL, 0, sbm_interrupt5);
309   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(10000), FUNC(sbm_interrupt5));
310310   cpu_set_input_line(device, 4, HOLD_LINE);
311311}
312312
src/mame/drivers/mw8080bw.c
r10315r10316
893893   mw8080bw_state *state = machine->driver_data<mw8080bw_state>();
894894
895895   /* create astable timer for IC B1 */
896   timer_pulse(machine, MAZE_555_B1_PERIOD, NULL, 0, maze_tone_timing_timer_callback);
896   machine->scheduler().timer_pulse(MAZE_555_B1_PERIOD, FUNC(maze_tone_timing_timer_callback));
897897
898898   /* initialize state of Tone Timing FF, IC C1 */
899899   state->maze_tone_timing_state = 0;
src/mame/drivers/vaportra.c
r10315r10316
2424   vaportra_state *state = space->machine->driver_data<vaportra_state>();
2525
2626   /* Force synchronisation between CPUs with fake timer */
27   timer_call_after_resynch(space->machine, NULL, 0, NULL);
27   space->machine->scheduler().synchronize();
2828   soundlatch_w(space, 0, data & 0xff);
2929   cpu_set_input_line(state->audiocpu, 0, ASSERT_LINE);
3030}
src/mame/drivers/gaelco3d.c
r10315r10316
376376   if (LOG)
377377      logerror("%06X:sound_data_w(%02X) = %08X & %08X\n", cpu_get_pc(space->cpu), offset, data, mem_mask);
378378   if (ACCESSING_BITS_0_7)
379      timer_call_after_resynch(space->machine, NULL, data & 0xff, delayed_sound_w);
379      space->machine->scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff);
380380}
381381
382382
src/mame/drivers/snk.c
r10315r10316
372372static WRITE8_HANDLER( sgladiat_soundlatch_w )
373373{
374374   soundlatch_w(space, offset, data);
375   timer_call_after_resynch(space->machine, NULL, CMDIRQ_BUSY_ASSERT, sgladiat_sndirq_update_callback);
375   space->machine->scheduler().synchronize(FUNC(sgladiat_sndirq_update_callback), CMDIRQ_BUSY_ASSERT);
376376}
377377
378378static READ8_HANDLER( sgladiat_soundlatch_r )
379379{
380   timer_call_after_resynch(space->machine, NULL, BUSY_CLEAR, sgladiat_sndirq_update_callback);
380   space->machine->scheduler().synchronize(FUNC(sgladiat_sndirq_update_callback), BUSY_CLEAR);
381381   return soundlatch_r(space,0);
382382}
383383
384384static READ8_HANDLER( sgladiat_sound_nmi_ack_r )
385385{
386   timer_call_after_resynch(space->machine, NULL, CMDIRQ_CLEAR, sgladiat_sndirq_update_callback);
386   space->machine->scheduler().synchronize(FUNC(sgladiat_sndirq_update_callback), CMDIRQ_CLEAR);
387387   return 0xff;
388388}
389389
r10315r10316
460460static void ymirq_callback_1(device_t *device, int irq)
461461{
462462   if (irq)
463      timer_call_after_resynch(device->machine, NULL, YM1IRQ_ASSERT, sndirq_update_callback);
463      device->machine->scheduler().synchronize(FUNC(sndirq_update_callback), YM1IRQ_ASSERT);
464464}
465465
466466static void ymirq_callback_2(device_t *device, int irq)
467467{
468468   if (irq)
469      timer_call_after_resynch(device->machine, NULL, YM2IRQ_ASSERT, sndirq_update_callback);
469      device->machine->scheduler().synchronize(FUNC(sndirq_update_callback), YM2IRQ_ASSERT);
470470}
471471
472472
r10315r10316
495495static WRITE8_HANDLER( snk_soundlatch_w )
496496{
497497   soundlatch_w(space, offset, data);
498   timer_call_after_resynch(space->machine, NULL, CMDIRQ_BUSY_ASSERT, sndirq_update_callback);
498   space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), CMDIRQ_BUSY_ASSERT);
499499}
500500
501501static CUSTOM_INPUT( snk_sound_busy )
r10315r10316
517517static WRITE8_HANDLER( snk_sound_status_w )
518518{
519519   if (~data & 0x10)   // ack YM1 irq
520      timer_call_after_resynch(space->machine, NULL, YM1IRQ_CLEAR, sndirq_update_callback);
520      space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), YM1IRQ_CLEAR);
521521
522522   if (~data & 0x20)   // ack YM2 irq
523      timer_call_after_resynch(space->machine, NULL, YM2IRQ_CLEAR, sndirq_update_callback);
523      space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), YM2IRQ_CLEAR);
524524
525525   if (~data & 0x40)   // clear busy flag
526      timer_call_after_resynch(space->machine, NULL, BUSY_CLEAR, sndirq_update_callback);
526      space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), BUSY_CLEAR);
527527
528528   if (~data & 0x80)   // ack command from main cpu
529      timer_call_after_resynch(space->machine, NULL, CMDIRQ_CLEAR, sndirq_update_callback);
529      space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), CMDIRQ_CLEAR);
530530}
531531
532532
533533
534534static READ8_HANDLER( tnk3_cmdirq_ack_r )
535535{
536   timer_call_after_resynch(space->machine, NULL, CMDIRQ_CLEAR, sndirq_update_callback);
536   space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), CMDIRQ_CLEAR);
537537   return 0xff;
538538}
539539
540540static READ8_HANDLER( tnk3_ymirq_ack_r )
541541{
542   timer_call_after_resynch(space->machine, NULL, YM1IRQ_CLEAR, sndirq_update_callback);
542   space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), YM1IRQ_CLEAR);
543543   return 0xff;
544544}
545545
r10315r10316
547547{
548548   // it's uncertain whether the latch should be cleared here or when it's read
549549   soundlatch_clear_w(space, 0, 0);
550   timer_call_after_resynch(space->machine, NULL, BUSY_CLEAR, sndirq_update_callback);
550   space->machine->scheduler().synchronize(FUNC(sndirq_update_callback), BUSY_CLEAR);
551551   return 0xff;
552552}
553553
src/mame/drivers/namconb1.c
r10315r10316
348348   }
349349   if( scanline < NAMCONB1_VBSTART )
350350   {
351      timer_set( device->machine, device->machine->primary_screen->time_until_pos(scanline), NULL, scanline, namconb1_TriggerPOSIRQ );
351      device->machine->scheduler().timer_set( device->machine->primary_screen->time_until_pos(scanline), FUNC(namconb1_TriggerPOSIRQ ), scanline);
352352   }
353353} /* namconb1_interrupt */
354354
r10315r10316
417417      scanline = 0;
418418
419419   if( scanline < NAMCONB1_VBSTART )
420      timer_set( device->machine, device->machine->primary_screen->time_until_pos(scanline), NULL, scanline, namconb2_TriggerPOSIRQ );
420      device->machine->scheduler().timer_set( device->machine->primary_screen->time_until_pos(scanline), FUNC(namconb2_TriggerPOSIRQ ), scanline);
421421} /* namconb2_interrupt */
422422
423423static void namconb1_cpureg8_w(running_machine *machine, int reg, UINT8 data)
src/mame/drivers/jpmimpct.c
r10315r10316
561561
562562static WRITE16_HANDLER( jpmio_w )
563563{
564   UINT64 cycles = space->machine->firstcpu->total_cycles();
565564   switch (offset)
566565   {
567566      case 0x02:
r10315r10316
589588         }
590589         else
591590//          slide = 0;
592         Mechmtr_update(0, cycles, data >> 10);
591         MechMtr_update(0, data >> 10);
593592         duart_1.IP &= ~0x10;
594593         break;
595594      }
r10315r10316
12061205static WRITE16_HANDLER( jpmioawp_w )
12071206{
12081207   int i;
1209   UINT64 cycles  = space->machine->firstcpu->total_cycles();
12101208   switch (offset)
12111209   {
12121210      case 0x00:
r10315r10316
12481246         }
12491247         else
12501248//          slide = 0;
1251         Mechmtr_update(0, cycles, data >> 10);
1249         MechMtr_update(0, data >> 10);
12521250         if ( data )
12531251         {
12541252            duart_1.IP &= ~0x10;
src/mame/drivers/tehkanwc.c
r10315r10316
158158
159159   /* in Gridiron, the sound CPU goes in a tight loop after the self test, */
160160   /* probably waiting to be reset by a watchdog */
161   if (cpu_get_pc(space->cpu) == 0x08bc) timer_set(space->machine, attotime::from_seconds(1), NULL, 0, reset_callback);
161   if (cpu_get_pc(space->cpu) == 0x08bc) space->machine->scheduler().timer_set(attotime::from_seconds(1), FUNC(reset_callback));
162162}
163163
164164
src/mame/drivers/jangou.c
r10315r10316
894894   jangou_state *state = machine->driver_data<jangou_state>();
895895
896896   /* Create a timer to feed the CVSD DAC with sample bits */
897   state->cvsd_bit_timer = timer_alloc(machine, cvsd_bit_timer_callback, NULL);
897   state->cvsd_bit_timer = machine->scheduler().timer_alloc(FUNC(cvsd_bit_timer_callback));
898898   timer_adjust_periodic(state->cvsd_bit_timer, attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024));
899899}
900900
src/mame/drivers/pgm.c
r10315r10316
752752{
753753   pgm_state *state = space->machine->driver_data<pgm_state>();
754754
755   timer_call_after_resynch(space->machine, NULL, 0, 0); // force resync
755   space->machine->scheduler().synchronize(); // force resync
756756
757757   return (state->kovsh_highlatch_68k_w << 16) | (state->kovsh_lowlatch_68k_w);
758758}
r10315r10316
761761{
762762   pgm_state *state = space->machine->driver_data<pgm_state>();
763763
764   timer_call_after_resynch(space->machine, NULL, 0, 0); // force resync
764   space->machine->scheduler().synchronize(); // force resync
765765
766766   if (ACCESSING_BITS_16_31)
767767   {
r10315r10316
779779{
780780   pgm_state *state = space->machine->driver_data<pgm_state>();
781781
782   timer_call_after_resynch(space->machine, NULL, 0, 0); // force resync
782   space->machine->scheduler().synchronize(); // force resync
783783
784784   switch (offset)
785785   {
r10315r10316
793793{
794794   pgm_state *state = space->machine->driver_data<pgm_state>();
795795
796   timer_call_after_resynch(space->machine, NULL, 0, 0); // force resync
796   space->machine->scheduler().synchronize(); // force resync
797797
798798   switch (offset)
799799   {
src/mame/drivers/capbowl.c
r10315r10316
126126   machine->primary_screen->update_partial(scanline - 1);
127127   scanline += 32;
128128   if (scanline > 240) scanline = 32;
129   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, capbowl_update);
129   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(capbowl_update), scanline);
130130}
131131
132132
r10315r10316
354354{
355355   capbowl_state *state = machine->driver_data<capbowl_state>();
356356
357   timer_set(machine, machine->primary_screen->time_until_pos(32), NULL, 32, capbowl_update);
357   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(32), FUNC(capbowl_update), 32);
358358
359359   state->blitter_addr = 0;
360360   state->last_trackball_val[0] = 0;
src/mame/drivers/kinst.c
r10315r10316
261261static INTERRUPT_GEN( irq0_start )
262262{
263263   cpu_set_input_line(device, 0, ASSERT_LINE);
264   timer_set(device->machine, attotime::from_usec(50), NULL, 0, irq0_stop);
264   device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(irq0_stop));
265265}
266266
267267
src/mame/drivers/st0016.c
r10315r10316
111111   if(!offset)
112112      latches[2]|=1;
113113   COMBINE_DATA(&latches[offset]);
114   timer_call_after_resynch(space->machine, NULL, 0, NULL);
114   space->machine->scheduler().synchronize();
115115}
116116
117117static READ8_HANDLER(latch8_r)
r10315r10316
126126   if(!offset)
127127      latches[2]|=2;
128128   latches[offset]=data;
129   timer_call_after_resynch(space->machine, NULL, 0, NULL);
129   space->machine->scheduler().synchronize();
130130}
131131
132132static ADDRESS_MAP_START( v810_mem,ADDRESS_SPACE_PROGRAM, 32 )
src/mame/drivers/toaplan2.c
r10315r10316
213213Pipi & Bibis (Ryouta Kikaku)   Working.
214214FixEight                       Working, MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-001-TURBO'
215215FixEight bootleg               Working. One unknown ROM (same as pipibibi one). Region hardcoded to Korea (@ $4d8)
216Grind Stormer / VFive          Working, MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-004-SPY'.*
217Batsugun / Batsugun Sp'        Working, MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-004-SPY'.*
216Grind Stormer / VFive          Working, MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-007-SPY'.*
217Batsugun / Batsugun Sp'        Working, MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-007-SPY'.*
218218Snow Bros. 2                   Working.
219219Mahou Daisakusen               Working.
220220Shippu Mahou Daisakusen        Working.
r10315r10316
542542static void toaplan2_vblank_irq(running_machine *machine, int irq_line)
543543{
544544   /* the IRQ appears to fire at line 0xe6 */
545   timer_set(machine, machine->primary_screen->time_until_pos(0xe6), NULL, irq_line, toaplan2_raise_irq);
545   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0xe6), FUNC(toaplan2_raise_irq), irq_line);
546546}
547547
548548static INTERRUPT_GEN( toaplan2_vblank_irq1 ) { toaplan2_vblank_irq(device->machine, 1); }
r10315r10316
811811   }
812812}
813813
814static WRITE16_HANDLER( fixeight_subcpu_ctrl_w )
815{
816   toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
817
818   cpu_set_input_line(state->sub_cpu, INPUT_LINE_RESET, (data & state->v25_reset_line) ? CLEAR_LINE : ASSERT_LINE);
819}
820
814821static WRITE16_DEVICE_HANDLER( oki_bankswitch_w )
815822{
816823   if (ACCESSING_BITS_0_7)
r10315r10316
12971304ADDRESS_MAP_END
12981305
12991306
1300WRITE16_HANDLER( fixeight_subcpu_ctrl )
1301{
1302   printf("fixeight_subcpu_ctrl %04x\n",data);
1303
1304   toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
1305
1306   cpu_set_input_line(state->sub_cpu, INPUT_LINE_RESET,  (data & state->v25_reset_line) ? CLEAR_LINE : ASSERT_LINE);
1307}
1308
1309
13101307/* this one is rather different to the other v25 based ones, shared ram is moved for example */
13111308static ADDRESS_MAP_START( fixeight_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
13121309   AM_RANGE(0x000000, 0x07ffff) AM_ROM
r10315r10316
13171314   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("SYS")
13181315   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_coin_word_w)   /* Coin count/lock */
13191316   AM_RANGE(0x280000, 0x28ffff) AM_READWRITE( batsugun_share_r, batsugun_share_w )
1320   AM_RANGE(0x700000, 0x700001) AM_WRITE(fixeight_subcpu_ctrl) // guess!!!
13211317   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
13221318   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
13231319   AM_RANGE(0x500000, 0x501fff) AM_READWRITE(toaplan2_txvideoram16_r, toaplan2_txvideoram16_w) AM_BASE_SIZE_MEMBER(toaplan2_state, txvideoram16, tx_vram_size)
13241320   AM_RANGE(0x502000, 0x5021ff) AM_READWRITE(toaplan2_txvideoram16_offs_r, toaplan2_txvideoram16_offs_w) AM_BASE_SIZE_MEMBER(toaplan2_state, txvideoram16_offs, tx_offs_vram_size)
13251321   AM_RANGE(0x503000, 0x5031ff) AM_READWRITE(toaplan2_txscrollram16_r, toaplan2_txscrollram16_w) AM_BASE_SIZE_MEMBER(toaplan2_state, txscrollram16, tx_scroll_vram_size)
13261322   AM_RANGE(0x600000, 0x60ffff) AM_READWRITE(toaplan2_tx_gfxram16_r, toaplan2_tx_gfxram16_w) AM_BASE_MEMBER(toaplan2_state, tx_gfxram16)
1323   AM_RANGE(0x700000, 0x700001) AM_WRITE(fixeight_subcpu_ctrl_w)
13271324   AM_RANGE(0x800000, 0x800001) AM_READ(video_count_r)
13281325ADDRESS_MAP_END
13291326
r10315r10316
37483745   MCFG_CPU_PROGRAM_MAP(V25_rambased_mem)
37493746   MCFG_CPU_IO_MAP(V25_port)
37503747
3751   MCFG_QUANTUM_TIME(attotime::from_hz(6000))
3752
37533748   MCFG_MACHINE_RESET(batsugun)
37543749
37553750   /* video hardware */
r10315r10316
39083903
39093904static const nmk112_interface bgaregga_nmk112_intf =
39103905{
3911   "oki", "oki", 0
3906   "oki", NULL, 0
39123907};
39133908
39143909static const nmk112_interface batrider_nmk112_intf =
r10315r10316
52665261GAME( 1991, whoopee,   pipibibs, whoopee,  whoopee,  T2_Z180,  ROT0,   "Toaplan", "Pipi & Bibis / Whoopee!! (Whoopee!! board)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) // original Whoopee!! boards have a HD647180 instead of Z80
52675262GAME( 1991, pipibibsbl,pipibibs, pipibibi_bootleg, pipibibsbl, pipibibsbl, ROT0,   "bootleg (Ryouta Kikaku)", "Pipi & Bibis / Whoopee!! (bootleg)", GAME_SUPPORTS_SAVE )
52685263
5269
52705264// region is in eeprom (and also requires correct return value from a v25 mapped address??)
52715265// todo: something could be wrong here, because the _dumped_ eeprom doesn't work..
52725266GAME( 1992, fixeight,   0,        fixeight, fixeight, fixeight, ROT270, "Toaplan", "FixEight (Europe)",  GAME_SUPPORTS_SAVE )
r10315r10316
53265320GAME( 1999, bkraiduj, bkraidu,  bbakradu, bbakraid, bbakradu, ROT270, "Eighting", "Battle Bakraid - Unlimited Version (Japan) (Tue Jun 8 1999)", GAME_SUPPORTS_SAVE )
53275321// older revision of the code
53285322GAME( 1999, bkraidj,  bkraidu,  bbakraid, bbakraid, bbakraid, ROT270, "Eighting", "Battle Bakraid (Japan) (Wed Apr 7 1999)", GAME_SUPPORTS_SAVE )
5329
5330
5331
5332
5333
src/mame/drivers/btoads.c
r10315r10316
6666   cpu_triggerint(machine->device("audiocpu"));
6767
6868   /* use a timer to make long transfers faster */
69   timer_set(machine, attotime::from_usec(50), NULL, 0, 0);
69   machine->scheduler().timer_set(attotime::from_usec(50), FUNC(NULL));
7070}
7171
7272
7373static WRITE16_HANDLER( main_sound_w )
7474{
7575   if (ACCESSING_BITS_0_7)
76      timer_call_after_resynch(space->machine, NULL, data & 0xff, delayed_sound_w);
76      space->machine->scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff);
7777}
7878
7979
src/mame/drivers/boxer.c
r10315r10316
8080
8181      for (i = 1; i < 256; i++)
8282         if (mask[i] != 0)
83            timer_set(machine, machine->primary_screen->time_until_pos(i), NULL, mask[i], pot_interrupt);
83            machine->scheduler().timer_set(machine->primary_screen->time_until_pos(i), FUNC(pot_interrupt), mask[i]);
8484
8585      state->pot_state = 0;
8686   }
r10315r10316
9090   if (scanline >= 262)
9191      scanline = 0;
9292
93   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, periodic_callback);
93   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(periodic_callback), scanline);
9494}
9595
9696
r10315r10316
428428static MACHINE_RESET( boxer )
429429{
430430   boxer_state *state = machine->driver_data<boxer_state>();
431   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, periodic_callback);
431   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(periodic_callback));
432432
433433   state->pot_state = 0;
434434   state->pot_latch = 0;
src/mame/drivers/vicdual.c
r10315r10316
9898      cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
9999
100100      /* simulate the coin switch being closed for a while */
101      timer_set(field->port->machine, 4 * field->port->machine->primary_screen->frame_period(), NULL, 0, clear_coin_status);
101      field->port->machine->scheduler().timer_set(4 * field->port->machine->primary_screen->frame_period(), FUNC(clear_coin_status));
102102   }
103103}
104104
r10315r10316
155155static CUSTOM_INPUT( vicdual_get_timer_value )
156156{
157157   /* return the state of the timer (old code claims "4MHz square wave", but it was toggled once every 2msec, or 500Hz) */
158   return timer_get_time(field->port->machine).as_ticks(500) & 1;
158   return field->port->machine->time().as_ticks(500) & 1;
159159}
160160
161161
src/mame/drivers/wgp.c
r10315r10316
477477
478478static INTERRUPT_GEN( wgp_cpub_interrupt )
479479{
480   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000-500), NULL, 0, wgp_cpub_interrupt6);
480   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000-500), FUNC(wgp_cpub_interrupt6));
481481   cpu_set_input_line(device, 4, HOLD_LINE);
482482}
483483
r10315r10316
601601       hardware has got the next a/d conversion ready. We set a token
602602       delay of 10000 cycles although our inputs are always ready. */
603603
604   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), NULL, 0, wgp_interrupt6);
604   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), FUNC(wgp_interrupt6));
605605}
606606
607607
src/mame/drivers/metro.c
r10315r10316
256256         state->requested_int[0] = 1;
257257         state->requested_int[5] = 1;   // write the scroll registers
258258         /* the duration is a guess */
259         timer_set(device->machine, attotime::from_usec(2500), NULL, 0, vblank_end_callback);
259         device->machine->scheduler().timer_set(attotime::from_usec(2500), FUNC(vblank_end_callback));
260260         update_irq_state(device->machine);
261261         break;
262262
r10315r10316
729729                       another blit. */
730730            if (b1 == 0)
731731            {
732               timer_set(space->machine, attotime::from_usec(500), NULL, 0, metro_blit_done);
732               space->machine->scheduler().timer_set(attotime::from_usec(500), FUNC(metro_blit_done));
733733               return;
734734            }
735735
r10315r10316
61236123   metro_state *state = machine->driver_data<metro_state>();
61246124   metro_common(machine);
61256125   state->irq_line = -1;   /* split interrupt handlers */
6126   state->mouja_irq_timer = timer_alloc(machine, mouja_irq_callback, NULL);
6126   state->mouja_irq_timer = machine->scheduler().timer_alloc(FUNC(mouja_irq_callback));
61276127}
61286128
61296129static DRIVER_INIT( gakusai )
src/mame/drivers/eolith.c
r10315r10316
663663   ROM_LOAD( "qs1001a.u96",  0x000000, 0x80000, CRC(d13c6407) SHA1(57b14f97c7d4f9b5d9745d3571a0b7115fbe3176) )
664664ROM_END
665665
666ROM_START( hidctch2a )
667   ROM_REGION( 0x80000, "maincpu", 0 ) /* Hyperstone CPU Code */
668   ROM_LOAD( "hc2j.u43",        0x00000, 0x80000, CRC(8d3b8394) SHA1(29093ee13eb3609abc670d6722f3095f03045af6) )
666669
670   ROM_REGION32_BE( 0x2000000, "user1", ROMREGION_ERASE00 ) /* Game Data - banked ROM, swapping necessary */
671   ROM_LOAD32_WORD_SWAP( "00", 0x0000000, 0x200000, CRC(c6b1bc84) SHA1(205d1dc5079562b11cef72fef25a3c570eaecf78) )
672   ROM_LOAD32_WORD_SWAP( "01", 0x0000002, 0x200000, CRC(5a1c1ab3) SHA1(3c07a98f9ea8b30bac5a260403e688314fd12abb) )
673   ROM_LOAD32_WORD_SWAP( "02", 0x0400000, 0x200000, CRC(3f7815aa) SHA1(ed46cbe03fde5cab15e004812036b0aaa00fc628) )
674   ROM_LOAD32_WORD_SWAP( "03", 0x0400002, 0x200000, CRC(d686c59b) SHA1(f82d97f17d9cb10cae4d47f4efdd3ba6c5baace3) )
675   ROM_LOAD32_WORD_SWAP( "04", 0x0800000, 0x200000, CRC(d35cb515) SHA1(75943b6c8052232c8b01ab57b4d32d54a22e7279) )
676   ROM_LOAD32_WORD_SWAP( "05", 0x0800002, 0x200000, CRC(7870e5c6) SHA1(e36a62cb205d396337abdea8e553d70b6da32f8f) )
677   ROM_LOAD32_WORD_SWAP( "06", 0x0c00000, 0x200000, CRC(10184a21) SHA1(fc99bc003ba69b651691ca37a5490beae29e36bc) )
678   ROM_LOAD32_WORD_SWAP( "07", 0x0c00002, 0x200000, CRC(b6c4879f) SHA1(b672d5d7fc3dd1b32cd2f1084a71d1a225594866) )
679   ROM_LOAD32_WORD_SWAP( "08", 0x1000000, 0x200000, CRC(670204d1) SHA1(efdead17ea1d1796f47abf65dc4792a10406b45c) )
680   ROM_LOAD32_WORD_SWAP( "09", 0x1000002, 0x200000, CRC(28c0f55c) SHA1(0390aaf272deb1338293823d9d3a27306b2d9db6) )
681   ROM_LOAD32_WORD_SWAP( "10", 0x1400000, 0x200000, CRC(45f374f4) SHA1(a5cec2fcb58445e0ff74c86b20aba7accd132ea5) )
682   ROM_LOAD32_WORD_SWAP( "11", 0x1400002, 0x200000, CRC(cac54db3) SHA1(c31366e22d242ec0c0bb9f79869352894173db88) )
683   ROM_LOAD32_WORD_SWAP( "12", 0x1800000, 0x200000, CRC(66e681ff) SHA1(8f78dec1dc3e5c6825f559cef69e413c98ed9aab) )
684   ROM_LOAD32_WORD_SWAP( "13", 0x1800002, 0x200000, CRC(14bd38a9) SHA1(a3ff48de8150616a8ca49abf60225455397b938c) )
685   ROM_LOAD32_WORD_SWAP( "14", 0x1c00000, 0x200000, CRC(8eb1b01b) SHA1(e144ba01aa65dc96e22d1d41c3ca87ae19e874d5) )
686   ROM_LOAD32_WORD_SWAP( "15", 0x1c00002, 0x200000, CRC(3b06fe4e) SHA1(35356a116e6b825b8ed93c8ea1e016491ac1863a) )
687
688   ROM_REGION( 0x008000, "cpu1", 0 ) /* QDSP ('51) Code */
689   ROM_LOAD( "u107",        0x0000, 0x8000, CRC(89450a2f) SHA1(d58efa805f497bec179fdbfb8c5860ac5438b4ec) )
690
691   ROM_REGION( 0x008000, "cpu2", 0 ) /* Sound (80c301) CPU Code */
692   ROM_LOAD( "hc2j.u111", 0x0000, 0x8000, CRC(79012474) SHA1(09a2d5705d7bc52cc2d1644c87c1e31ee44813ef) )
693
694   ROM_REGION( 0x080000, "music", 0 ) /* Music data */
695   ROM_LOAD( "u108",        0x00000, 0x80000, CRC(75fc7a65) SHA1(308715ab62d28787ee894ddcf7304464e2543b2e) )
696
697   ROM_REGION( 0x080000, "sfx", 0 ) /* QDSP samples (SFX) */
698   ROM_LOAD( "u97",        0x00000, 0x80000, CRC(a7a1627e) SHA1(a93ced858d839daac1fa9a85f4f8c89cb179bad5) )
699
700   ROM_REGION( 0x080000, "wavetable", 0 ) /* QDSP wavetable rom */
701   ROM_LOAD( "qs1001a.u96",  0x000000, 0x80000, CRC(d13c6407) SHA1(57b14f97c7d4f9b5d9745d3571a0b7115fbe3176) )
702ROM_END
703
704
667705/*
668706
669707Raccoon World
r10315r10316
11161154GAME( 1998, hidnctch,  0,        eolith45, hidnctch,  eolith,   ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.03)",  GAME_NO_SOUND ) // or Teurrin Geurim Chajgi '98
11171155GAME( 1998, raccoon,   0,        eolith45, raccoon,   eolith,   ROT0, "Eolith", "Raccoon World", GAME_NO_SOUND )
11181156GAME( 1998, puzzlekg,  0,        eolith45, puzzlekg,  eolith,   ROT0, "Eolith", "Puzzle King (Dance & Puzzle)",  GAME_NO_SOUND )
1119GAME( 1999, hidctch2,  0,        eolith50, hidnctch,  hidctch2, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 3.03)", GAME_NO_SOUND )
1157GAME( 1999, hidctch2,  0,        eolith50, hidnctch,  hidctch2, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 3.03) (Kor/Eng) (AT89c52 protected)", GAME_NO_SOUND )
1158GAME( 1999, hidctch2a, hidctch2, eolith50, hidnctch,  eolith,   ROT0, "Eolith", "Hidden Catch 2 (pcb ver 1.00) (Kor/Eng/Jpn/Chi)", GAME_NO_SOUND )
11201159GAME( 1999, landbrk,   0,        eolith45, landbrk,   landbrk,  ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.02)",  GAME_NO_SOUND ) // or Miss Ttang Jjareugi
1121GAME( 1999, landbrka,  landbrk,  eolith45, landbrk,   landbrka, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.03)",  GAME_NO_SOUND ) // or Miss Ttang Jjareugi
1122GAME( 1999, penfan,    0,        eolith45, landbrk,   eolith,   ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind",  GAME_NO_SOUND ) // alt title of Ribbon? (todo: speedup)
1160GAME( 1999, landbrka,  landbrk,  eolith45, landbrk,   landbrka, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.03) (AT89c52 protected)",  GAME_NO_SOUND ) // or Miss Ttang Jjareugi
1161GAME( 1999, penfan,    0,        eolith45, landbrk,   eolith,   ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind",  GAME_NO_SOUND ) // alt title of Ribbon?
11231162GAME( 1999, nhidctch,  0,        eolith45, hidnctch,  eolith,   ROT0, "Eolith", "New Hidden Catch (World) / New Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", GAME_NO_SOUND ) // or New Teurrin Geurim Chajgi '98
11241163GAME( 2000, hidctch3,  0,        eolith50, hidctch3,  hidctch3, ROT0, "Eolith", "Hidden Catch 3 (ver 1.00 / pcb ver 3.05)", GAME_NO_SOUND )
11251164GAME( 2001, fort2b,    0,        eolith50, common,    eolith,   ROT0, "Eolith", "Fortress 2 Blue Arcade (ver 1.01 / pcb ver 3.05)",  GAME_NO_SOUND )
src/mame/drivers/namcos23.c
r10315r10316
20402040
20412041static MACHINE_START( s23 )
20422042{
2043   c361_timer = timer_alloc(machine, c361_timer_cb, 0);
2043   c361_timer = machine->scheduler().timer_alloc(FUNC(c361_timer_cb));
20442044   timer_adjust_oneshot(c361_timer, attotime::never, 0);
20452045}
20462046
src/mame/drivers/atarisy2.c
r10315r10316
299299static WRITE16_HANDLER( int_enable_w )
300300{
301301   if (offset == 0 && ACCESSING_BITS_0_7)
302      timer_call_after_resynch(space->machine, NULL, data, delayed_int_enable_w);
302      space->machine->scheduler().synchronize(FUNC(delayed_int_enable_w), data);
303303}
304304
305305
src/mame/drivers/mjsister.c
r10315r10316
160160   dac_data_w(state->dac, DACROM[(state->dac_bank * 0x10000 + state->dac_adr++) & 0x1ffff]);
161161
162162   if (((state->dac_adr & 0xff00 ) >> 8) !=  state->dac_adr_e)
163      timer_set(machine, attotime::from_hz(MCLK) * 1024, NULL, 0, dac_callback);
163      machine->scheduler().timer_set(attotime::from_hz(MCLK) * 1024, FUNC(dac_callback));
164164   else
165165      state->dac_busy = 0;
166166}
r10315r10316
178178   state->dac_adr = state->dac_adr_s << 8;
179179
180180   if (state->dac_busy == 0)
181      timer_call_after_resynch(space->machine, NULL, 0, dac_callback);
181      space->machine->scheduler().synchronize(FUNC(dac_callback));
182182
183183   state->dac_busy = 1;
184184}
src/mame/drivers/spacefb.c
r10315r10316
147147
148148static void create_interrupt_timer(running_machine *machine)
149149{
150   interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
150   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
151151}
152152
153153
src/mame/drivers/wheelfir.c
r10315r10316
637637   wheelfir_state *state = space->machine->driver_data<wheelfir_state>();
638638   COMBINE_DATA(&state->soundlatch);
639639   cputag_set_input_line(space->machine, "subcpu", 1, HOLD_LINE); /* guess, tested also with periodic interrupts and latch clear*/
640   timer_call_after_resynch(space->machine, NULL, 0, 0);
640   space->machine->scheduler().synchronize();
641641}
642642
643643static READ16_HANDLER( wheelfir_snd_r )
r10315r10316
721721static TIMER_DEVICE_CALLBACK( scanline_timer_callback )
722722{
723723   wheelfir_state *state = timer.machine->driver_data<wheelfir_state>();
724   timer_call_after_resynch(timer.machine, NULL, 0, 0);
724   timer.machine->scheduler().synchronize();
725725   state->current_scanline=param;
726726
727727   if(state->current_scanline<NUM_SCANLINES)
src/mame/drivers/seta.c
r10315r10316
13701370      uPD71054->max[no] = 0xffff;
13711371   }
13721372   for( no = 0; no < USED_TIMER_NUM; no++ ) {
1373      uPD71054->timer[no] = timer_alloc( machine, uPD71054_timer_callback , NULL);
1373      uPD71054->timer[no] = machine->scheduler().timer_alloc( FUNC(uPD71054_timer_callback ));
13741374   }
13751375}
13761376
r10315r10316
20642064   if ((data & 0x0010) && !state->keroppi_prize_hop)
20652065   {
20662066      state->keroppi_prize_hop = 1;
2067      timer_set(space->machine, attotime::from_seconds(3), NULL, 0x20, keroppi_prize_hop_callback);      /* 3 seconds */
2067      space->machine->scheduler().timer_set(attotime::from_seconds(3), FUNC(keroppi_prize_hop_callback), 0x20);      /* 3 seconds */
20682068   }
20692069}
20702070
src/mame/drivers/naomi.c
r10315r10316
68996899static const UINT32 kofxi_key    = 0xa4be3;
69006900static const UINT32 dirtypig_key = 0xc194f;
69016901static const UINT32 mslug6_key   = 0x53627;
6902static const UINT32 samsptk_key  = 0xe935f;
69026903
69036904static DRIVER_INIT( atomiswave )
69046905{
r10315r10316
69496950AW_DRIVER_INIT(ftspeed)
69506951AW_DRIVER_INIT(dirtypig)
69516952AW_DRIVER_INIT(mslug6)
6953AW_DRIVER_INIT(samsptk)
69526954
69536955ROM_START( fotns )
69546956   ROM_REGION( 0x200000, "awflash", 0)
r10315r10316
72417243   ROM_COPY( "user1", 0x7000000, 0x9000000, 0x2000000)
72427244ROM_END
72437245
7246ROM_START( samsptk )
7247   ROM_REGION( 0x200000, "awflash", 0)
7248   AW_BIOS
7249
7250   ROM_REGION( 0x10000000, "user1", ROMREGION_ERASE)
7251   ROM_LOAD( "ax2901p01.fmem1", 0x0000000, 0x0800000, CRC(58e0030b) SHA1(ed8a66833beeb56d83770123eff28df0f25221d1) )
7252   ROM_LOAD( "ax2901m01.mrom1", 0x1000000, 0x2000000, CRC(dbbbd90d) SHA1(102ee0b249a3e0ca2f659b6c515816c522ad78d0) )
7253   ROM_LOAD( "ax2902m01.mrom2", 0x3000000, 0x2000000, CRC(a3bd7890) SHA1(9b8d934d6ebc3ef688cd8a6de47657a0663fea10) )
7254   ROM_LOAD( "ax2903m01.mrom3", 0x5000000, 0x2000000, CRC(56f50fdd) SHA1(8a5a4a99108c0279056998046c7b332e80121dee) )
7255   ROM_LOAD( "ax2904m01.mrom4", 0x7000000, 0x2000000, CRC(8a3ae175) SHA1(966f527a92e24c8eb770344697f2edf6140cf971) )
7256   ROM_LOAD( "ax2905m01.mrom5", 0x9000000, 0x2000000, CRC(429877ba) SHA1(88e1f3bc682b18d331e328ef8754065109cf9bda) )
7257   ROM_LOAD( "ax2906m01.mrom6", 0xb000000, 0x2000000, CRC(cb95298d) SHA1(5fb5d5a0d6801df61101a1b23de0c14ff29ef654) )
7258   ROM_LOAD( "ax2907m01.mrom7", 0xd000000, 0x2000000, CRC(48015081) SHA1(3c0a0a6dc9ab7bf889579477699e612c3092f9bf) )
7259ROM_END
7260
72447261/* Atomiswave */
72457262GAME( 2001, awbios,   0,        aw,    aw,    atomiswave, ROT0, "Sammy",                           "Atomiswave Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
72467263
r10315r10316
72577274GAME( 2004, kov7sprt, awbios,   aw,    aw,    kov7sprt, ROT0, "Sammy / IGS",          "Knights of Valour - The Seven Spirits", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
72587275GAME( 2005, vfurlong, awbios,   aw,    aw,    vfurlong, ROT0, "Sammy",                  "Net Select Keiba Victory Furlong", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
72597276GAME( 2005, ngbc,     awbios,   aw,    aw,    ngbc,     ROT0, "Sammy / SNK Playmore",            "Neo-Geo Battle Coliseum", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
7277GAME( 2005, samsptk,  awbios,   aw,    aw,    samsptk,  ROT0, "Sammy / SNK Playmore",            "Samurai Spirits Tenkaichi Kenkakuden", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
72607278GAME( 2005, kofxi,    awbios,   aw,    aw,    kofxi,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters XI", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
72617279GAME( 2005, fotns,    awbios,   aw,    aw,    fotns,    ROT0, "Sega / Arc System Works",         "Fist Of The North Star", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
72627280GAME( 2005, kofnw,    awbios,   aw,    aw,    kofnw,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters Neowave", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
src/mame/drivers/stv.c
r10315r10316
15311531   if(LOG_SCU) logerror("DMA transfer END\n");
15321532
15331533   /*TODO: timing of this*/
1534   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv0_ended);
1534   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended));
15351535
15361536   if(scu_add_tmp & 0x80000000)
15371537   {
r10315r10316
16321632
16331633   if(LOG_SCU) logerror("DMA transfer END\n");
16341634
1635   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv1_ended);
1635   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended));
16361636
16371637   if(scu_add_tmp & 0x80000000)
16381638   {
r10315r10316
17331733
17341734   if(LOG_SCU) logerror("DMA transfer END\n");
17351735
1736   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv2_ended);
1736   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended));
17371737
17381738   if(scu_add_tmp & 0x80000000)
17391739   {
r10315r10316
18081808
18091809   }while(job_done == 0);
18101810
1811   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv0_ended);
1811   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended));
18121812}
18131813
18141814static void dma_indirect_lv1(address_space *space)
r10315r10316
18771877
18781878   }while(job_done == 0);
18791879
1880   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv1_ended);
1880   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended));
18811881}
18821882
18831883static void dma_indirect_lv2(address_space *space)
r10315r10316
19451945
19461946   }while(job_done == 0);
19471947
1948   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv2_ended);
1948   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended));
19491949}
19501950
19511951
r10315r10316
26332633    smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
26342634    smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
26352635
2636   stv_rtc_timer = timer_alloc(machine, stv_rtc_increment, 0);
2636   stv_rtc_timer = machine->scheduler().timer_alloc(FUNC(stv_rtc_increment));
26372637}
26382638
26392639/*
r10315r10316
28162816
28172817   /*TODO: timing of this one (related to the VDP1 speed)*/
28182818   /*      (NOTE: value shouldn't be at h_sync/v_sync position (will break shienryu))*/
2819   timer_set(device->machine, device->machine->primary_screen->time_until_pos(0), NULL, 0, vdp1_irq);
2819   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(0), FUNC(vdp1_irq));
28202820}
28212821
28222822static MACHINE_RESET( stv )
src/mame/drivers/megatech.c
r10315r10316
272272   if (game_region)
273273   {
274274      {
275         timer_set( machine, attotime::zero, NULL, param, megatech_z80_run_state );
275         machine->scheduler().timer_set( attotime::zero, FUNC(megatech_z80_run_state ), param);
276276      }
277277   }
278278   else
r10315r10316
287287
288288static void megatech_select_game(running_machine *machine, int gameno)
289289{
290   timer_set( machine, attotime::zero, NULL, gameno, megatech_z80_stop_state );
290   machine->scheduler().timer_set( attotime::zero, FUNC(megatech_z80_stop_state ), gameno);
291291}
292292
293293static WRITE8_HANDLER( megatech_cart_select_w )
src/mame/drivers/gridlee.c
r10315r10316
163163    state_save_register_global_array(machine, last_analog_input);
164164    state_save_register_global_array(machine, last_analog_output);
165165
166    irq_off = timer_alloc(machine, irq_off_tick, 0);
167    irq_timer = timer_alloc(machine, irq_timer_tick, 0);
168    firq_off = timer_alloc(machine, firq_off_tick, 0);
169    firq_timer = timer_alloc(machine, firq_timer_tick, 0);
166    irq_off = machine->scheduler().timer_alloc(FUNC(irq_off_tick));
167    irq_timer = machine->scheduler().timer_alloc(FUNC(irq_timer_tick));
168    firq_off = machine->scheduler().timer_alloc(FUNC(firq_off_tick));
169    firq_timer = machine->scheduler().timer_alloc(FUNC(firq_timer_tick));
170170}
171171
172172
src/mame/drivers/slapshot.c
r10315r10316
182182
183183static INTERRUPT_GEN( slapshot_interrupt )
184184{
185   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), NULL, 0, slapshot_interrupt6);
185   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), FUNC(slapshot_interrupt6));
186186   cpu_set_input_line(device, 5, HOLD_LINE);
187187}
188188
src/mame/drivers/wardner.c
r10315r10316
419419   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK | VIDEO_BUFFERS_SPRITERAM)
420420
421421   MCFG_SCREEN_ADD("screen", RASTER)
422   MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
423   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
422   MCFG_SCREEN_RAW_PARAMS(XTAL_14MHz/2, 446, 0, 320, 286, 0, 240)
424423   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
425   MCFG_SCREEN_SIZE(64*8, 64*8)
426   MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
427424
428425   MCFG_GFXDECODE(wardner)
429426   MCFG_PALETTE_LENGTH(1792)
src/mame/drivers/missile.c
r10315r10316
518518   space->set_direct_update_handler(direct_update_delegate_create_static(missile_direct_handler, *machine));
519519
520520   /* create a timer to speed/slow the CPU */
521   state->cpu_timer = timer_alloc(machine, adjust_cpu_speed, NULL);
521   state->cpu_timer = machine->scheduler().timer_alloc(FUNC(adjust_cpu_speed));
522522   timer_adjust_oneshot(state->cpu_timer, machine->primary_screen->time_until_pos(v_to_scanline(state, 0), 0), 0);
523523
524524   /* create a timer for IRQs and set up the first callback */
525   state->irq_timer = timer_alloc(machine, clock_irq, NULL);
525   state->irq_timer = machine->scheduler().timer_alloc(FUNC(clock_irq));
526526   state->irq_state = 0;
527527   schedule_next_irq(machine, -32);
528528
src/mame/drivers/m63.c
r10315r10316
357357{
358358   m63_state *state = space->machine->driver_data<m63_state>();
359359   cpu_set_input_line(state->soundcpu, 0, ASSERT_LINE);
360   timer_call_after_resynch(space->machine, NULL, 0, NULL);
360   space->machine->scheduler().synchronize();
361361}
362362
363363static WRITE8_HANDLER( snddata_w )
src/mame/drivers/exidy440.c
r10315r10316
371371
372372static WRITE8_HANDLER( sound_command_w )
373373{
374   timer_call_after_resynch(space->machine, NULL, data, delayed_sound_command_w);
374   space->machine->scheduler().synchronize(FUNC(delayed_sound_command_w), data);
375375}
376376
377377
src/mame/drivers/m72.c
r10315r10316
106106static MACHINE_START( m72 )
107107{
108108   m72_state *state = machine->driver_data<m72_state>();
109   state->scanline_timer = timer_alloc(machine, m72_scanline_interrupt, NULL);
109   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(m72_scanline_interrupt));
110110
111111   state_save_register_global(machine, state->mcu_sample_addr);
112112   state_save_register_global(machine, state->mcu_snd_cmd_latch);
r10315r10316
115115static MACHINE_START( kengo )
116116{
117117   m72_state *state = machine->driver_data<m72_state>();
118   state->scanline_timer = timer_alloc(machine, kengo_scanline_interrupt, NULL);
118   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(kengo_scanline_interrupt));
119119
120120   state_save_register_global(machine, state->mcu_sample_addr);
121121   state_save_register_global(machine, state->mcu_snd_cmd_latch);
r10315r10316
135135   state->mcu_snd_cmd_latch = 0;
136136
137137   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
138   timer_call_after_resynch(machine,  NULL, 0, synch_callback);
138   machine->scheduler().synchronize(FUNC(synch_callback));
139139}
140140
141141static MACHINE_RESET( xmultipl )
r10315r10316
259259      state->protection_ram[offset] = val;
260260      cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE);
261261      /* Line driven, most likely by write line */
262      //timer_set(space->machine, space->machine->device<cpu_device>("mcu")->cycles_to_attotime(2), NULL, 0, mcu_irq0_clear);
263      //timer_set(space->machine, space->machine->device<cpu_device>("mcu")->cycles_to_attotime(0), NULL, 0, mcu_irq0_raise);
262      //space->machine->scheduler().timer_set(space->machine->device<cpu_device>("mcu")->cycles_to_attotime(2), FUNC(mcu_irq0_clear));
263      //space->machine->scheduler().timer_set(space->machine->device<cpu_device>("mcu")->cycles_to_attotime(0), FUNC(mcu_irq0_raise));
264264   }
265265   else
266      timer_call_after_resynch( space->machine, state->protection_ram, (offset<<16) | val, delayed_ram16_w);
266      space->machine->scheduler().synchronize( FUNC(delayed_ram16_w), (offset<<16) | val, state->protection_ram);
267267}
268268
269269static WRITE8_HANDLER( m72_mcu_data_w )
r10315r10316
273273   if (offset&1) val = (state->protection_ram[offset/2] & 0x00ff) | (data << 8);
274274   else val = (state->protection_ram[offset/2] & 0xff00) | (data&0xff);
275275
276   timer_call_after_resynch( space->machine, state->protection_ram, ((offset >>1 ) << 16) | val, delayed_ram16_w);
276   space->machine->scheduler().synchronize( FUNC(delayed_ram16_w), ((offset >>1 ) << 16) | val, state->protection_ram);
277277}
278278
279279static READ8_HANDLER(m72_mcu_data_r )
src/mame/drivers/crgolf.c
r10315r10316
139139
140140static WRITE8_HANDLER( main_to_sound_w )
141141{
142   timer_call_after_resynch(space->machine, NULL, data, main_to_sound_callback);
142   space->machine->scheduler().synchronize(FUNC(main_to_sound_callback), data);
143143}
144144
145145
r10315r10316
170170
171171static WRITE8_HANDLER( sound_to_main_w )
172172{
173   timer_call_after_resynch(space->machine, NULL, data, sound_to_main_callback);
173   space->machine->scheduler().synchronize(FUNC(sound_to_main_callback), data);
174174}
175175
176176
src/mame/drivers/topspeed.c
r10315r10316
303303static INTERRUPT_GEN( topspeed_interrupt )
304304{
305305   /* Unsure how many int6's per frame */
306   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), NULL, 0, topspeed_interrupt6);
306   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), FUNC(topspeed_interrupt6));
307307   cpu_set_input_line(device, 5, HOLD_LINE);
308308}
309309
310310static INTERRUPT_GEN( topspeed_cpub_interrupt )
311311{
312312   /* Unsure how many int6's per frame */
313   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), NULL, 0, topspeed_cpub_interrupt6);
313   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), FUNC(topspeed_cpub_interrupt6));
314314   cpu_set_input_line(device, 5, HOLD_LINE);
315315}
316316
src/mame/drivers/aristmk4.c
r10315r10316
446446      case 0x02:
447447         ret=ret^0x20;
448448         inscrd++;
449         timer_set(device->machine, attotime::from_msec(150), NULL, 0, coin_input_reset);
449         device->machine->scheduler().timer_set(attotime::from_msec(150), FUNC(coin_input_reset));
450450         break;
451451
452452      default:
r10315r10316
460460   {
461461      case 0x00:
462462         ret=ret^0x40;
463         timer_set(device->machine, attotime::from_msec(175), NULL, 0, hopper_reset);
463         device->machine->scheduler().timer_set(attotime::from_msec(175), FUNC(hopper_reset));
464464         hopper_motor=0x02;
465465         break;
466466      case 0x01:
src/mame/drivers/thunderx.c
r10315r10316
313313      calculate_collisions(space->machine);
314314
315315      /* 100 cycle delay is arbitrary */
316      timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100), NULL, 0, thunderx_firq_callback);
316      space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100), FUNC(thunderx_firq_callback));
317317   }
318318
319319   state->_1f98_data = data;
src/mame/drivers/videopin.c
r10315r10316
3131   {
3232      if (val == 0)
3333      {
34         state->time_released = timer_get_time(machine);
34         state->time_released = machine->time();
3535
3636         if (!state->mask)
3737            cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
3838      }
3939      else
40         state->time_pushed = timer_get_time(machine);
40         state->time_pushed = machine->time();
4141
4242      state->prev = val;
4343   }
r10315r10316
5757   if (scanline >= 263)
5858      scanline = 32;
5959
60   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, interrupt_callback);
60   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline);
6161}
6262
6363
r10315r10316
6565{
6666   device_t *discrete = machine->device("discrete");
6767
68   timer_set(machine, machine->primary_screen->time_until_pos(32), NULL, 32, interrupt_callback);
68   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(32), FUNC(interrupt_callback), 32);
6969
7070   /* both output latches are cleared on reset */
7171
r10315r10316
7777static double calc_plunger_pos(running_machine *machine)
7878{
7979   videopin_state *state = machine->driver_data<videopin_state>();
80   return (timer_get_time(machine).as_double() - state->time_released.as_double()) * (state->time_released.as_double() - state->time_pushed.as_double() + 0.2);
80   return (machine->time().as_double() - state->time_released.as_double()) * (state->time_released.as_double() - state->time_pushed.as_double() + 0.2);
8181}
8282
8383
src/mame/drivers/runaway.c
r10315r10316
3636static MACHINE_START( runaway )
3737{
3838   runaway_state *state = machine->driver_data<runaway_state>();
39   state->interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
39   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
4040}
4141
4242static MACHINE_RESET( runaway )
src/mame/drivers/sothello.c
r10315r10316
8484
8585static READ8_HANDLER( subcpu_halt_set )
8686{
87    timer_call_after_resynch(space->machine, NULL, 0, subcpu_suspend);
87    space->machine->scheduler().synchronize(FUNC(subcpu_suspend));
8888    subcpu_status|=2;
8989    return 0;
9090}
9191
9292static READ8_HANDLER( subcpu_halt_clear )
9393{
94    timer_call_after_resynch(space->machine,NULL, 0, subcpu_resume);
94    space->machine->scheduler().synchronize(FUNC(subcpu_resume));
9595    subcpu_status&=~1;
9696    subcpu_status&=~2;
9797    return 0;
src/mame/drivers/toypop.c
r10315r10316
110110                        // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
111111
112112   if (!namcoio_read_reset_line(namcoio_0))      /* give the cpu a tiny bit of time to write the command before processing it */
113      timer_set(device->machine, attotime::from_usec(50), NULL, 0, namcoio_run);
113      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(namcoio_run));
114114
115115   if (!namcoio_read_reset_line(namcoio_1))      /* give the cpu a tiny bit of time to write the command before processing it */
116      timer_set(device->machine, attotime::from_usec(50), NULL, 1, namcoio_run);
116      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(namcoio_run), 1);
117117
118118   if (!namcoio_read_reset_line(namcoio_2))      /* give the cpu a tiny bit of time to write the command before processing it */
119      timer_set(device->machine, attotime::from_usec(50), NULL, 2, namcoio_run);
119      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(namcoio_run), 2);
120120
121121}
122122
r10315r10316
154154{
155155   /* we must do this on a timer in order to have it take effect */
156156   /* otherwise, the reset process will override our changes */
157   timer_call_after_resynch(machine, NULL, 0, disable_interrupts);
157   machine->scheduler().synchronize(FUNC(disable_interrupts));
158158}
159159
160160static INTERRUPT_GEN( toypop_m68000_interrupt )
src/mame/drivers/ultratnk.c
r10315r10316
5757   if (input_port_read(machine, "IN0") & 0x40)
5858      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
5959
60   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, nmi_callback);
60   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(nmi_callback), scanline);
6161}
6262
6363
6464static MACHINE_RESET( ultratnk )
6565{
66   timer_set(machine, machine->primary_screen->time_until_pos(32), NULL, 32, nmi_callback);
66   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(32), FUNC(nmi_callback), 32);
6767}
6868
6969
src/mame/drivers/tugboat.c
r10315r10316
188188static TIMER_CALLBACK( interrupt_gen )
189189{
190190   cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
191   timer_set(machine, machine->primary_screen->frame_period(), NULL, 0, interrupt_gen);
191   machine->scheduler().timer_set(machine->primary_screen->frame_period(), FUNC(interrupt_gen));
192192}
193193
194194static MACHINE_RESET( tugboat )
195195{
196   timer_set(machine, machine->primary_screen->time_until_pos(30*8+4), NULL, 0, interrupt_gen);
196   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(30*8+4), FUNC(interrupt_gen));
197197}
198198
199199
src/mame/drivers/superqix.c
r10315r10316
199199
200200static READ8_HANDLER( mcu_acknowledge_r )
201201{
202   timer_call_after_resynch(space->machine, NULL, 0, mcu_acknowledge_callback);
202   space->machine->scheduler().synchronize(FUNC(mcu_acknowledge_callback));
203203   return 0;
204204}
205205
r10315r10316
463463            break;
464464
465465         case 0x5:   // answer to Z80
466            timer_call_after_resynch(space->machine, NULL, state->portB_out, delayed_mcu_z80_w);
466            space->machine->scheduler().synchronize(FUNC(delayed_mcu_z80_w), state->portB_out);
467467            break;
468468
469469         case 0x6:
r10315r10316
479479
480480static WRITE8_HANDLER( hotsmash_z80_mcu_w )
481481{
482   timer_call_after_resynch(space->machine, NULL, data, delayed_z80_mcu_w);
482   space->machine->scheduler().synchronize(FUNC(delayed_z80_mcu_w), data);
483483}
484484
485485static READ8_HANDLER(hotsmash_from_mcu_r)
src/mame/drivers/gijoe.c
r10315r10316
285285   state->k053246 = machine->device("k053246");
286286   state->k053251 = machine->device("k053251");
287287
288   state->dmadelay_timer = timer_alloc(machine, dmaend_callback, NULL);
288   state->dmadelay_timer = machine->scheduler().timer_alloc(FUNC(dmaend_callback));
289289
290290   state_save_register_global(machine, state->cur_control2);
291291}
src/mame/drivers/segas32.c
r10315r10316
615615{
616616   signal_v60_irq(device->machine, MAIN_IRQ_VBSTART);
617617   system32_set_vblank(device->machine, 1);
618   timer_set(device->machine, device->machine->primary_screen->time_until_pos(0), NULL, 0, end_of_vblank_int);
618   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(0), FUNC(end_of_vblank_int));
619619   if (system32_prot_vblank)
620620      (*system32_prot_vblank)(device);
621621}
src/mame/drivers/astinvad.c
r10315r10316
219219   timer_adjust_oneshot(state->int_timer, machine->primary_screen->time_until_pos(param), param);
220220
221221   /* an RC circuit turns the interrupt off after a short amount of time */
222   timer_set(machine, attotime::from_double(300 * 0.1e-6), NULL, 0, kamikaze_int_off);
222   machine->scheduler().timer_set(attotime::from_double(300 * 0.1e-6), FUNC(kamikaze_int_off));
223223}
224224
225225
r10315r10316
232232   state->ppi8255_1 = machine->device("ppi8255_1");
233233   state->samples = machine->device("samples");
234234
235   state->int_timer = timer_alloc(machine, kamizake_int_gen, NULL);
235   state->int_timer = machine->scheduler().timer_alloc(FUNC(kamizake_int_gen));
236236   timer_adjust_oneshot(state->int_timer, machine->primary_screen->time_until_pos(128), 128);
237237
238238   state_save_register_global(machine, state->screen_flip);
src/mame/drivers/neodrvr.c
r10315r10316
79687968   DRIVER_INIT_CALL(neogeo);
79697969
79707970   /* start a timer that will check the BIOS select DIP every second */
7971   timer_set(machine, attotime::zero, NULL, 0, ms5pcb_bios_timer_callback);
7972   timer_pulse(machine, attotime::from_msec(1000), NULL, 0, ms5pcb_bios_timer_callback);
7971   machine->scheduler().timer_set(attotime::zero, FUNC(ms5pcb_bios_timer_callback));
7972   machine->scheduler().timer_pulse(attotime::from_msec(1000), FUNC(ms5pcb_bios_timer_callback));
79737973
79747974   mslug5_decrypt_68k(machine);
79757975   svcpcb_gfx_decrypt(machine);
r10315r10316
80058005   DRIVER_INIT_CALL(neogeo);
80068006
80078007   /* start a timer that will check the BIOS select DIP every second */
8008   timer_set(machine, attotime::zero, NULL, 0, svcpcb_bios_timer_callback);
8009   timer_pulse(machine, attotime::from_msec(1000), NULL, 0, svcpcb_bios_timer_callback);
8008   machine->scheduler().timer_set(attotime::zero, FUNC(svcpcb_bios_timer_callback));
8009   machine->scheduler().timer_pulse(attotime::from_msec(1000), FUNC(svcpcb_bios_timer_callback));
80108010
80118011   svc_px_decrypt(machine);
80128012   svcpcb_gfx_decrypt(machine);
src/mame/drivers/esh.c
r10315r10316
268268{
269269   // IRQ
270270   cpu_set_input_line(device, 0, ASSERT_LINE);
271   timer_set(device->machine, attotime::from_usec(50), NULL, 0, irq_stop);
271   device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(irq_stop));
272272}
273273
274274static MACHINE_START( esh )
src/mame/drivers/eolithsp.c
r10315r10316
4444   { "raccoon",  0x40008204, 239 },
4545   { "puzzlekg", 0x40029458, 239 },
4646   { "hidctch2", 0x40009524, 239 },
47   { "hidctch2a",0x40029B58, 239 },
4748   { "landbrk",  0x40023574, 239 },
4849   { "landbrka", 0x4002446c, 239 },
4950   { "nhidctch", 0x40012778, 239 },
src/mame/drivers/fromance.c
r10315r10316
7171static WRITE8_HANDLER( fromance_commanddata_w )
7272{
7373   /* do this on a timer to let the slave CPU synchronize */
74   timer_call_after_resynch(space->machine, NULL, data, deferred_commanddata_w);
74   space->machine->scheduler().synchronize(FUNC(deferred_commanddata_w), data);
7575}
7676
7777
r10315r10316
8080   fromance_state *state = space->machine->driver_data<fromance_state>();
8181
8282   /* set a timer to force synchronization after the read */
83   timer_call_after_resynch(space->machine, NULL, 0, NULL);
83   space->machine->scheduler().synchronize();
8484
8585   if (!state->directionflag)
8686      return 0x00;      // standby
src/mame/drivers/halleys.c
r10315r10316
22152215
22162216   init_common(machine);
22172217
2218   blitter_reset_timer = timer_alloc(machine, blitter_reset, NULL);
2218   blitter_reset_timer = machine->scheduler().timer_alloc(FUNC(blitter_reset));
22192219}
22202220
22212221
src/mame/drivers/mustache.c
r10315r10316
192192static MACHINE_START( mustache )
193193{
194194   mustache_state *state = machine->driver_data<mustache_state>();
195   state->clear_irq_timer = timer_alloc(machine, clear_irq_cb, 0);
195   state->clear_irq_timer = machine->scheduler().timer_alloc(FUNC(clear_irq_cb));
196196}
197197
198198static MACHINE_CONFIG_START( mustache, mustache_state )
src/mame/drivers/segas16a.c
r10315r10316
265265
266266   /* if we have a fake i8751 handler, disable the actual 8751 */
267267   if (state->i8751_vblank_hook != NULL)
268      timer_call_after_resynch(machine, NULL, 0, suspend_i8751);
268      machine->scheduler().synchronize(FUNC(suspend_i8751));
269269
270270   state->mcu_control = 0x00;
271271}
r10315r10316
317317         /* the port C handshaking signals control the Z80 NMI, */
318318         /* so we have to sync whenever we access this PPI */
319319         if (ACCESSING_BITS_0_7)
320            timer_call_after_resynch(space->machine, NULL, ((offset & 3) << 8) | (data & 0xff), delayed_ppi8255_w);
320            space->machine->scheduler().synchronize(FUNC(delayed_ppi8255_w), ((offset & 3) << 8) | (data & 0xff));
321321         return;
322322   }
323323   logerror("%06X:standard_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(space->cpu), offset * 2, data, mem_mask);
src/mame/drivers/neogeo.c
r10315r10316
369369static void create_interrupt_timers( running_machine *machine )
370370{
371371   neogeo_state *state = machine->driver_data<neogeo_state>();
372   state->display_position_interrupt_timer = timer_alloc(machine, display_position_interrupt_callback, NULL);
373   state->display_position_vblank_timer = timer_alloc(machine, display_position_vblank_callback, NULL);
374   state->vblank_interrupt_timer = timer_alloc(machine, vblank_interrupt_callback, NULL);
372   state->display_position_interrupt_timer = machine->scheduler().timer_alloc(FUNC(display_position_interrupt_callback));
373   state->display_position_vblank_timer = machine->scheduler().timer_alloc(FUNC(display_position_vblank_callback));
374   state->vblank_interrupt_timer = machine->scheduler().timer_alloc(FUNC(vblank_interrupt_callback));
375375}
376376
377377
src/mame/drivers/segahang.c
r10315r10316
133133
134134   /* if we have a fake i8751 handler, disable the actual 8751 */
135135   if (state->i8751_vblank_hook != NULL)
136      timer_call_after_resynch(machine, NULL, 0, suspend_i8751);
136      machine->scheduler().synchronize(FUNC(suspend_i8751));
137137
138138   /* reset global state */
139139   state->adc_select = 0;
r10315r10316
204204         case 0x0000/2: /* PPI @ 4B */
205205            /* the port C handshaking signals control the Z80 NMI, */
206206            /* so we have to sync whenever we access this PPI */
207            timer_call_after_resynch(space->machine, NULL, ((offset & 3) << 8) | (data & 0xff), delayed_ppi8255_w);
207            space->machine->scheduler().synchronize(FUNC(delayed_ppi8255_w), ((offset & 3) << 8) | (data & 0xff));
208208            return;
209209
210210         case 0x3000/2: /* PPI @ 4C */
r10315r10316
260260         case 0x0000/2:
261261            /* the port C handshaking signals control the Z80 NMI, */
262262            /* so we have to sync whenever we access this PPI */
263            timer_call_after_resynch(space->machine, NULL, ((offset & 3) << 8) | (data & 0xff), delayed_ppi8255_w);
263            space->machine->scheduler().synchronize(FUNC(delayed_ppi8255_w), ((offset & 3) << 8) | (data & 0xff));
264264            return;
265265
266266         case 0x0020/2: /* PPI @ 4C */
src/mame/drivers/buggychl.c
r10315r10316
105105static WRITE8_HANDLER( sound_command_w )
106106{
107107   soundlatch_w(space, 0, data);
108   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
108   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
109109}
110110
111111static WRITE8_HANDLER( nmi_disable_w )
src/mame/drivers/taito_f2.c
r10315r10316
583583
584584static INTERRUPT_GEN( taitof2_interrupt )
585585{
586   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(500), NULL, 0, taitof2_interrupt6);
586   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(500), FUNC(taitof2_interrupt6));
587587   cpu_set_input_line(device, 5, HOLD_LINE);
588588}
589589
src/mame/drivers/gottlieb.c
r10315r10316
279279      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x05806, 0x05806, 0, 0x07f8, laserdisc_select_w);
280280
281281      /* allocate a timer for serial transmission, and one for philips code processing */
282      laserdisc_bit_timer = timer_alloc(machine, laserdisc_bit_callback, NULL);
283      laserdisc_philips_timer = timer_alloc(machine, laserdisc_philips_callback, NULL);
282      laserdisc_bit_timer = machine->scheduler().timer_alloc(FUNC(laserdisc_bit_callback));
283      laserdisc_philips_timer = machine->scheduler().timer_alloc(FUNC(laserdisc_philips_callback));
284284
285285      /* create some audio RAM */
286286      laserdisc_audio_buffer = auto_alloc_array(machine, UINT8, AUDIORAM_SIZE);
r10315r10316
487487
488488   /* assert the line and set a timer for deassertion */
489489   laserdisc_line_w(laserdisc, LASERDISC_LINE_CONTROL, ASSERT_LINE);
490   timer_set(machine, LASERDISC_CLOCK * 10, NULL, 0, laserdisc_bit_off_callback);
490   machine->scheduler().timer_set(LASERDISC_CLOCK * 10, FUNC(laserdisc_bit_off_callback));
491491
492492   /* determine how long for the next command; there is a 555 timer with a
493493       variable resistor controlling the timing of the pulses. Nominally, the
r10315r10316
689689{
690690   /* assert the NMI and set a timer to clear it at the first visible line */
691691   cpu_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE);
692   timer_set(device->machine, device->machine->primary_screen->time_until_pos(0), NULL, 0, nmi_clear);
692   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(0), FUNC(nmi_clear));
693693
694694   /* if we have a laserdisc, update it */
695695   if (laserdisc != NULL)
src/mame/drivers/asterix.c
r10315r10316
8282   asterix_state *state = space->machine->driver_data<asterix_state>();
8383
8484   cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
85   timer_set(space->machine, attotime::from_usec(5), NULL, 0, nmi_callback);
85   space->machine->scheduler().timer_set(attotime::from_usec(5), FUNC(nmi_callback));
8686}
8787
8888static WRITE16_HANDLER( sound_irq_w )
src/mame/drivers/moo.c
r10315r10316
448448   state_save_register_global_array(machine, state->layerpri);
449449   state_save_register_global_array(machine, state->protram);
450450
451    state->dmaend_timer = timer_alloc(machine, dmaend_callback, 0);
451    state->dmaend_timer = machine->scheduler().timer_alloc(FUNC(dmaend_callback));
452452}
453453
454454static MACHINE_RESET( moo )
src/mame/drivers/groundfx.c
r10315r10316
177177{
178178   /* One interrupt per input port (4 per frame, though only 2 used).
179179        1000 cycle delay is arbitrary */
180   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(1000), NULL, 0, groundfx_interrupt5);
180   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(1000), FUNC(groundfx_interrupt5));
181181}
182182
183183static WRITE32_HANDLER( rotate_control_w )   /* only a guess that it's rotation */
src/mame/drivers/tickee.c
r10315r10316
101101
102102   /* generate interrupts for player 1's gun */
103103   get_crosshair_xy(machine, 0, &beamx, &beamy);
104   timer_set(machine, machine->primary_screen->time_until_pos(beamy + beamyadd,     beamx + beamxadd), NULL, 0, trigger_gun_interrupt);
105   timer_set(machine, machine->primary_screen->time_until_pos(beamy + beamyadd + 1, beamx + beamxadd), NULL, 0, clear_gun_interrupt);
104   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd, beamx + beamxadd), FUNC(trigger_gun_interrupt), 0);
105   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd + 1, beamx + beamxadd), FUNC(clear_gun_interrupt), 0);
106106
107107   /* generate interrupts for player 2's gun */
108108   get_crosshair_xy(machine, 1, &beamx, &beamy);
109   timer_set(machine, machine->primary_screen->time_until_pos(beamy + beamyadd,     beamx + beamxadd), NULL, 1, trigger_gun_interrupt);
110   timer_set(machine, machine->primary_screen->time_until_pos(beamy + beamyadd + 1, beamx + beamxadd), NULL, 1, clear_gun_interrupt);
109   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd, beamx + beamxadd), FUNC(trigger_gun_interrupt), 1);
110   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd + 1, beamx + beamxadd), FUNC(clear_gun_interrupt), 1);
111111}
112112
113113
r10315r10316
121121static VIDEO_START( tickee )
122122{
123123   /* start a timer going on the first scanline of every frame */
124   setup_gun_timer = timer_alloc(machine, setup_gun_interrupts, NULL);
124   setup_gun_timer = machine->scheduler().timer_alloc(FUNC(setup_gun_interrupts));
125125   timer_adjust_oneshot(setup_gun_timer, machine->primary_screen->time_until_pos(0), 0);
126126}
127127
src/mame/drivers/m92.c
r10315r10316
235235   state_save_register_global(machine, state->bankaddress);
236236   state_save_register_postload(machine, m92_postload, NULL);
237237
238   state->scanline_timer = timer_alloc(machine, m92_scanline_interrupt, NULL);
238   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(m92_scanline_interrupt));
239239}
240240
241241static MACHINE_RESET( m92 )
r10315r10316
348348
349349static WRITE16_HANDLER( m92_soundlatch_w )
350350{
351   timer_call_after_resynch(space->machine, NULL, V30_ASSERT, setvector_callback);
351   space->machine->scheduler().synchronize(FUNC(setvector_callback), V30_ASSERT);
352352   soundlatch_w(space, 0, data & 0xff);
353353}
354354
r10315r10316
366366
367367static WRITE16_HANDLER( m92_sound_irq_ack_w )
368368{
369   timer_call_after_resynch(space->machine, NULL, V30_CLEAR, setvector_callback);
369   space->machine->scheduler().synchronize(FUNC(setvector_callback), V30_CLEAR);
370370}
371371
372372static WRITE16_HANDLER( m92_sound_status_w )
r10315r10316
911911static void sound_irq(device_t *device, int state)
912912{
913913   if (state)
914      timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT, setvector_callback);
914      device->machine->scheduler().synchronize(FUNC(setvector_callback), YM2151_ASSERT);
915915   else
916      timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR, setvector_callback);
916      device->machine->scheduler().synchronize(FUNC(setvector_callback), YM2151_CLEAR);
917917}
918918
919919static const ym2151_interface ym2151_config =
src/mame/drivers/destroyr.c
r10315r10316
130130   state->potsense[1] = 0;
131131
132132   /* PCB supports two dials, but cab has only got one */
133   timer_set(machine, machine->primary_screen->time_until_pos(input_port_read(machine, "PADDLE"), 0), NULL, 0, destroyr_dial_callback);
134   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, destroyr_frame_callback);
133   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(input_port_read(machine, "PADDLE")), FUNC(destroyr_dial_callback));
134   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(destroyr_frame_callback));
135135}
136136
137137
r10315r10316
139139{
140140   destroyr_state *state = machine->driver_data<destroyr_state>();
141141
142   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, destroyr_frame_callback);
142   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(destroyr_frame_callback));
143143
144144   state->cursor = 0;
145145   state->wavemod = 0;
src/mame/drivers/multigam.c
r10315r10316
654654   else
655655   {
656656      multigam_mmc1_reg_write_enable = 0;
657      timer_call_after_resynch(space->machine, NULL, 0, mmc1_resync_callback);
657      space->machine->scheduler().synchronize(FUNC(mmc1_resync_callback));
658658   }
659659
660660   int reg = (offset >> 13);
src/mame/drivers/fuukifg2.c
r10315r10316
401401{
402402   fuuki16_state *state = machine->driver_data<fuuki16_state>();
403403   cpu_set_input_line(state->maincpu, 1, HOLD_LINE);
404   timer_set(machine, machine->primary_screen->time_until_pos(248), NULL, 0, level_1_interrupt_callback);
404   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(248), FUNC(level_1_interrupt_callback));
405405}
406406
407407
r10315r10316
409409{
410410   fuuki16_state *state = machine->driver_data<fuuki16_state>();
411411   cpu_set_input_line(state->maincpu, 3, HOLD_LINE);   // VBlank IRQ
412   timer_set(machine, machine->primary_screen->time_until_vblank_start(), NULL, 0, vblank_interrupt_callback);
412   machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_start(), FUNC(vblank_interrupt_callback));
413413}
414414
415415
r10315r10316
432432   state->maincpu = machine->device("maincpu");
433433   state->audiocpu = machine->device("audiocpu");
434434
435   state->raster_interrupt_timer = timer_alloc(machine, raster_interrupt_callback, NULL);
435   state->raster_interrupt_timer = machine->scheduler().timer_alloc(FUNC(raster_interrupt_callback));
436436}
437437
438438
r10315r10316
441441   fuuki16_state *state = machine->driver_data<fuuki16_state>();
442442   const rectangle &visarea = machine->primary_screen->visible_area();
443443
444   timer_set(machine, machine->primary_screen->time_until_pos(248), NULL, 0, level_1_interrupt_callback);
445   timer_set(machine, machine->primary_screen->time_until_vblank_start(), NULL, 0, vblank_interrupt_callback);
444   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(248), FUNC(level_1_interrupt_callback));
445   machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_start(), FUNC(vblank_interrupt_callback));
446446   timer_adjust_oneshot(state->raster_interrupt_timer, machine->primary_screen->time_until_pos(0, visarea.max_x + 1), 0);
447447}
448448
src/mame/drivers/39in1.c
r10315r10316
15421542   for(index = 0; index < 16; index++)
15431543   {
15441544      state->dma_regs.dcsr[index] = 0x00000008;
1545      state->dma_regs.timer[index] = timer_alloc(machine, pxa255_dma_dma_end, 0);
1545      state->dma_regs.timer[index] = machine->scheduler().timer_alloc(FUNC(pxa255_dma_dma_end));
15461546   }
15471547
15481548   memset(&state->ostimer_regs, 0, sizeof(state->ostimer_regs));
15491549   for(index = 0; index < 4; index++)
15501550   {
15511551      state->ostimer_regs.osmr[index] = 0;
1552      state->ostimer_regs.timer[index] = timer_alloc(machine, pxa255_ostimer_match, 0);
1552      state->ostimer_regs.timer[index] = machine->scheduler().timer_alloc(FUNC(pxa255_ostimer_match));
15531553   }
15541554
15551555   memset(&state->intc_regs, 0, sizeof(state->intc_regs));
15561556
15571557   memset(&state->lcd_regs, 0, sizeof(state->lcd_regs));
1558   state->lcd_regs.dma[0].eof = timer_alloc(machine, pxa255_lcd_dma_eof, 0);
1559   state->lcd_regs.dma[1].eof = timer_alloc(machine, pxa255_lcd_dma_eof, 0);
1558   state->lcd_regs.dma[0].eof = machine->scheduler().timer_alloc(FUNC(pxa255_lcd_dma_eof));
1559   state->lcd_regs.dma[1].eof = machine->scheduler().timer_alloc(FUNC(pxa255_lcd_dma_eof));
15601560   state->lcd_regs.trgbr = 0x00aa5500;
15611561   state->lcd_regs.tcr = 0x0000754f;
15621562
src/mame/drivers/guab.c
r10315r10316
752752
753753 static MACHINE_START( guab )
754754{
755   fdc_timer = timer_alloc(machine, fdc_data_callback, NULL);
755   fdc_timer = machine->scheduler().timer_alloc(FUNC(fdc_data_callback));
756756}
757757
758758static MACHINE_RESET( guab )
src/mame/drivers/beaminv.c
r10315r10316
110110static void create_interrupt_timer( running_machine *machine )
111111{
112112   beaminv_state *state = machine->driver_data<beaminv_state>();
113   state->interrupt_timer = timer_alloc(machine, interrupt_callback, NULL);
113   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
114114}
115115
116116
src/mame/drivers/cloud9.c
r10315r10316
186186   machine->primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
187187
188188   /* create a timer for IRQs and set up the first callback */
189   state->irq_timer = timer_alloc(machine, clock_irq, NULL);
189   state->irq_timer = machine->scheduler().timer_alloc(FUNC(clock_irq));
190190   state->irq_state = 0;
191191   schedule_next_irq(machine, 0-64);
192192
src/mame/drivers/rpunch.c
r10315r10316
173173static WRITE16_HANDLER( sound_command_w )
174174{
175175   if (ACCESSING_BITS_0_7)
176      timer_call_after_resynch(space->machine, NULL, data & 0xff, sound_command_w_callback);
176      space->machine->scheduler().synchronize(FUNC(sound_command_w_callback), data & 0xff);
177177}
178178
179179
src/mame/drivers/cubeqst.c
r10315r10316
250250static void swap_linecpu_banks(running_machine *machine)
251251{
252252   /* Best sync up before we switch banks around */
253   timer_call_after_resynch(machine, NULL, 0, delayed_bank_swap);
253   machine->scheduler().synchronize(FUNC(delayed_bank_swap));
254254}
255255
256256
src/mame/drivers/segas18.c
r10315r10316
219219
220220   /* if we are running with a real live 8751, we need to boost the interleave at startup */
221221   if (state->mcu != NULL && state->mcu->type() == I8751)
222      timer_call_after_resynch(machine, NULL, 0, boost_interleave);
222      machine->scheduler().synchronize(FUNC(boost_interleave));
223223}
224224
225225
src/mame/drivers/crystal.c
r10315r10316
569569
570570   cpu_set_irq_callback(machine->device("maincpu"), icallback);
571571   for (i = 0; i < 4; i++)
572      state->Timer[i] = timer_alloc(machine, Timercb, (void*)(FPTR)i);
572      state->Timer[i] = machine->scheduler().timer_alloc(FUNC(Timercb), (void*)(FPTR)i);
573573
574574   PatchReset(machine);
575575
src/mame/drivers/hitme.c
r10315r10316
138138   static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
139139
140140   UINT8 val = input_port_read(machine, portnames[port]);
141   if (timer_get_time(machine) > state->timeout_time)
141   if (machine->time() > state->timeout_time)
142142      val ^= 0x80;
143143   return val;
144144}
r10315r10316
196196   UINT8 raw_game_speed = input_port_read(device->machine, "R3");
197197   double resistance = raw_game_speed * 25000 / 100;
198198   attotime duration = attotime(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data + 1));
199   state->timeout_time = timer_get_time(device->machine) + duration;
199   state->timeout_time = device->machine->time() + duration;
200200
201201   discrete_sound_w(device, HITME_DOWNCOUNT_VAL, data);
202202   discrete_sound_w(device, HITME_OUT0, 1);
src/mame/drivers/maygay1b.c
r10315r10316
645645   int i;
646646
647647// setup 8 mechanical meters ////////////////////////////////////////////
648   Mechmtr_init(8);
648   MechMtr_config(machine,8);
649649
650650// setup 6 default 96 half step reels ///////////////////////////////////
651651   for ( i = 0; i < 6; i++ )
r10315r10316
706706static WRITE8_DEVICE_HANDLER( m1_meter_w )
707707{
708708   int i;
709   UINT64 cycles  = device->machine->device<cpu_device>("maincpu")->total_cycles();
710709
711710   for (i=0; i<8; i++)
712   if ( data & (1 << i) )   Mechmtr_update(i, cycles, data & (1 << i) );
711   if ( data & (1 << i) )   MechMtr_update(i, data & (1 << i) );
713712}
714713
715714static WRITE8_HANDLER( m1_latch_w )
src/mame/drivers/lgp.c
r10315r10316
336336static MACHINE_START( lgp )
337337{
338338   laserdisc = machine->device("laserdisc");
339    irq_timer = timer_alloc(machine, irq_stop, 0);
339    irq_timer = machine->scheduler().timer_alloc(FUNC(irq_stop));
340340}
341341
342342
src/mame/drivers/cliffhgr.c
r10315r10316
217217static MACHINE_START( cliffhgr )
218218{
219219   laserdisc = machine->device("laserdisc");
220   irq_timer = timer_alloc(machine, cliff_irq_callback, NULL);
220   irq_timer = machine->scheduler().timer_alloc(FUNC(cliff_irq_callback));
221221}
222222
223223static MACHINE_RESET( cliffhgr )
src/mame/drivers/twincobr.c
r10315r10316
582582   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK | VIDEO_BUFFERS_SPRITERAM)
583583
584584   MCFG_SCREEN_ADD("screen", RASTER)
585   MCFG_SCREEN_REFRESH_RATE( (XTAL_28MHz / 4) / (446 * 286) )
586   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
585   MCFG_SCREEN_RAW_PARAMS(XTAL_28MHz/4, 446, 0, 320, 286, 0, 240)
587586   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
588   MCFG_SCREEN_SIZE(64*8, 64*8)
589   MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
590587
591588   MCFG_GFXDECODE(twincobr)
592589   MCFG_PALETTE_LENGTH(1792)
src/mame/drivers/artmagic.c
r10315r10316
161161   {
162162      hack_irq = 1;
163163      update_irq_state(space->machine);
164      timer_set(space->machine, attotime::from_usec(1), NULL, 0, irq_off);
164      space->machine->scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off));
165165   }
166166   return input_port_read(space->machine, "300000");
167167}
src/mame/drivers/exterm.c
r10315r10316
198198static WRITE16_HANDLER( sound_latch_w )
199199{
200200   if (ACCESSING_BITS_0_7)
201      timer_call_after_resynch(space->machine, NULL, data & 0xff, sound_delayed_w);
201      space->machine->scheduler().synchronize(FUNC(sound_delayed_w), data & 0xff);
202202}
203203
204204
src/mame/drivers/coolpool.c
r10315r10316
484484static WRITE16_HANDLER( coolpool_iop_w )
485485{
486486   logerror("%08x:IOP write %04x\n", cpu_get_pc(space->cpu), data);
487   timer_call_after_resynch(space->machine, NULL, data, deferred_iop_w);
487   space->machine->scheduler().synchronize(FUNC(deferred_iop_w), data);
488488}
489489
490490
src/mame/drivers/bfm_sc2.c
r10315r10316
183183static int  read_e2ram(void);
184184static void e2ram_reset(void);
185185
186// global vars ////////////////////////////////////////////////////////////
187
188static int sc2gui_update_mmtr;   // bit pattern which mechanical meter needs updating
189
190186// local vars /////////////////////////////////////////////////////////////
191187
192188static UINT8 key[16];      // security device on gamecard (video games only)
r10315r10316
321317
322318   hopper_running    = 0;  // for video games
323319   hopper_coin_sense = 0;
324   sc2gui_update_mmtr= 0xFF;
325320
326321   slide_states[0] = 0;
327322   slide_states[1] = 0;
r10315r10316
583578{
584579   int i;
585580   int  changed = mmtr_latch ^ data;
586   UINT64 cycles  = downcast<cpu_device *>(space->cpu)->total_cycles();
587581
588582   mmtr_latch = data;
589583
r10315r10316
591585   {
592586      if ( changed & (1 << i) )
593587      {
594         if ( Mechmtr_update(i, cycles, data & (1 << i) ) )
595         {
596            sc2gui_update_mmtr |= (1 << i);
597         }
588         MechMtr_update(i, data & (1 << i) );
598589      }
599590   }
600591   if ( data & 0x1F ) cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE );
r10315r10316
22512242{
22522243   sc2_common_init(machine, 1);
22532244   adder2_decode_char_roms(machine);
2254   Mechmtr_init(8);               // setup mech meters
2245   MechMtr_config(machine,8);               // setup mech meters
22552246
22562247   has_hopper = 0;
22572248
r10315r10316
40053996static DRIVER_INIT (bbrkfst)
40063997{
40073998   sc2awp_common_init(machine,5, 1);
4008   Mechmtr_init(8);
3999   MechMtr_config(machine,8);
40094000
40104001   BFM_BD1_init(0);
40114002   BFM_BD1_init(1);
r10315r10316
40274018static DRIVER_INIT (drwho)
40284019{
40294020   sc2awp_common_init(machine,4, 1);
4030   Mechmtr_init(8);
4021   MechMtr_config(machine,8);
40314022
40324023   BFM_BD1_init(0);
40334024   BFM_BD1_init(1);
r10315r10316
40474038static DRIVER_INIT (drwhon)
40484039{
40494040   sc2awp_common_init(machine,4, 0);
4050   Mechmtr_init(8);
4041   MechMtr_config(machine,8);
40514042
40524043   BFM_BD1_init(0);
40534044   BFM_BD1_init(1);
r10315r10316
40684059static DRIVER_INIT (focus)
40694060{
40704061   sc2awp_common_init(machine,6, 1);
4071   Mechmtr_init(5);
4062   MechMtr_config(machine,5);
40724063
40734064   BFM_BD1_init(0);
40744065}
r10315r10316
40774068{
40784069   sc2awp_common_init(machine,6, 1);
40794070
4080   Mechmtr_init(5);
4071   MechMtr_config(machine,5);
40814072
40824073   Scorpion2_SetSwitchState(3,3,1);   /*  5p play */
40834074   Scorpion2_SetSwitchState(3,4,1);   /* 20p play */
r10315r10316
41204111static DRIVER_INIT (bfmcgslm)
41214112{
41224113   sc2awp_common_init(machine,6, 1);
4123   Mechmtr_init(8);
4114   MechMtr_config(machine,8);
41244115   BFM_BD1_init(0);
41254116   has_hopper = 0;
41264117}
r10315r10316
41284119static DRIVER_INIT (luvjub)
41294120{
41304121   sc2awp_common_init(machine,6, 1);
4131   Mechmtr_init(8);
4122   MechMtr_config(machine,8);
41324123   has_hopper = 0;
41334124
41344125   Scorpion2_SetSwitchState(3,0,1);
src/mame/drivers/tmmjprd.c
r10315r10316
396396            if (!blt_amount)
397397            {
398398               if(BLITLOG) mame_printf_debug("end of blit list\n");
399               timer_set(machine, attotime::from_usec(500), NULL,0,tmmjprd_blit_done);
399               machine->scheduler().timer_set(attotime::from_usec(500), FUNC(tmmjprd_blit_done));
400400               return;
401401            }
402402
src/mame/drivers/namcofl.c
r10315r10316
535535static TIMER_CALLBACK( network_interrupt_callback )
536536{
537537   cputag_set_input_line(machine, "maincpu", I960_IRQ0, ASSERT_LINE);
538   timer_set(machine, machine->primary_screen->frame_period(), NULL, 0, network_interrupt_callback);
538   machine->scheduler().timer_set(machine->primary_screen->frame_period(), FUNC(network_interrupt_callback));
539539}
540540
541541
542542static TIMER_CALLBACK( vblank_interrupt_callback )
543543{
544544   cputag_set_input_line(machine, "maincpu", I960_IRQ2, ASSERT_LINE);
545   timer_set(machine, machine->primary_screen->frame_period(), NULL, 0, vblank_interrupt_callback);
545   machine->scheduler().timer_set(machine->primary_screen->frame_period(), FUNC(vblank_interrupt_callback));
546546}
547547
548548
r10315r10316
571571
572572static MACHINE_START( namcofl )
573573{
574   raster_interrupt_timer = timer_alloc(machine, raster_interrupt_callback, NULL);
574   raster_interrupt_timer = machine->scheduler().timer_alloc(FUNC(raster_interrupt_callback));
575575}
576576
577577
578578static MACHINE_RESET( namcofl )
579579{
580   timer_set(machine, machine->primary_screen->time_until_pos(machine->primary_screen->visible_area().max_y + 3, 0), NULL, 0, network_interrupt_callback);
581   timer_set(machine, machine->primary_screen->time_until_pos(machine->primary_screen->visible_area().max_y + 1, 0), NULL, 0, vblank_interrupt_callback);
580   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(machine->primary_screen->visible_area().max_y + 3), FUNC(network_interrupt_callback));
581   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(machine->primary_screen->visible_area().max_y + 1), FUNC(vblank_interrupt_callback));
582582
583583   memory_set_bankptr(machine,  "bank1", machine->region("maincpu")->base() );
584584   memory_set_bankptr(machine,  "bank2", namcofl_workram );
src/mame/drivers/megadriv.c
r10315r10316
295295
296296   for (i = 0; i < 3; i++)
297297   {
298      mess_io_timeout[i] = timer_alloc(machine, mess_io_timeout_timer_callback, (void*)(FPTR)i);
298      mess_io_timeout[i] = machine->scheduler().timer_alloc(FUNC(mess_io_timeout_timer_callback), (void*)(FPTR)i);
299299      mess_io_stage[i] = -1;
300300   }
301301}
src/mame/drivers/itech32.c
r10315r10316
520520   static int effx, effy;
521521   static int lastresult;
522522   static attotime lasttime;
523   attotime curtime = timer_get_time(space->machine);
523   attotime curtime = space->machine->time();
524524
525525   if ((curtime - lasttime) > space->machine->primary_screen->scan_period())
526526   {
r10315r10316
559559   static int effx, effy;
560560   static int lastresult;
561561   static attotime lasttime;
562   attotime curtime = timer_get_time(space->machine);
562   attotime curtime = space->machine->time();
563563
564564   if ((curtime - lasttime) > space->machine->primary_screen->scan_period())
565565   {
r10315r10316
678678static WRITE16_HANDLER( sound_data_w )
679679{
680680   if (ACCESSING_BITS_0_7)
681      timer_call_after_resynch(space->machine, NULL, data & 0xff, delayed_sound_data_w);
681      space->machine->scheduler().synchronize(FUNC(delayed_sound_data_w), data & 0xff);
682682}
683683
684684
r10315r10316
691691static WRITE32_HANDLER( sound_data32_w )
692692{
693693   if (ACCESSING_BITS_16_23)
694      timer_call_after_resynch(space->machine, NULL, (data >> 16) & 0xff, delayed_sound_data_w);
694      space->machine->scheduler().synchronize(FUNC(delayed_sound_data_w), (data >> 16) & 0xff);
695695}
696696
697697
src/mame/drivers/undrfire.c
r10315r10316
365365static WRITE32_HANDLER( unknown_int_req_w )
366366{
367367   /* 10000 cycle delay is arbitrary */
368   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), NULL, 0, interrupt5);
368   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), FUNC(interrupt5));
369369}
370370
371371
r10315r10316
456456{
457457   /* One interrupt per input port (4 per frame, though only 2 used).
458458        1000 cycle delay is arbitrary */
459   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(1000), NULL, 0, interrupt5);
459   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(1000), FUNC(interrupt5));
460460}
461461
462462/***********************************************************
src/mame/drivers/grchamp.c
r10315r10316
404404
405405static WRITE8_HANDLER( main_to_sub_comm_w )
406406{
407   timer_call_after_resynch(space->machine, NULL, data | (offset << 8), main_to_sub_comm_sync_w);
407   space->machine->scheduler().synchronize(FUNC(main_to_sub_comm_sync_w), data | (offset << 8));
408408}
409409
410410
src/mame/drivers/lkage.c
r10315r10316
107107static WRITE8_HANDLER( lkage_sound_command_w )
108108{
109109   soundlatch_w(space, offset, data);
110   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
110   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
111111}
112112
113113static WRITE8_HANDLER( lkage_sh_nmi_disable_w )
src/mame/drivers/vegas.c
r10315r10316
531531   voodoo = machine->device("voodoo");
532532
533533   /* allocate timers for the NILE */
534   timer[0] = timer_alloc(machine, NULL, NULL);
535   timer[1] = timer_alloc(machine, NULL, NULL);
536   timer[2] = timer_alloc(machine, nile_timer_callback, NULL);
537   timer[3] = timer_alloc(machine, nile_timer_callback, NULL);
534   timer[0] = machine->scheduler().timer_alloc(FUNC(NULL));
535   timer[1] = machine->scheduler().timer_alloc(FUNC(NULL));
536   timer[2] = machine->scheduler().timer_alloc(FUNC(nile_timer_callback));
537   timer[3] = machine->scheduler().timer_alloc(FUNC(nile_timer_callback));
538538
539539   /* identify our sound board */
540540   if (machine->device("dsio") != NULL)
src/mame/drivers/enigma2.c
r10315r10316
135135static void create_interrupt_timers( running_machine *machine )
136136{
137137   enigma2_state *state = machine->driver_data<enigma2_state>();
138   state->interrupt_clear_timer = timer_alloc(machine, interrupt_clear_callback, NULL);
139   state->interrupt_assert_timer = timer_alloc(machine, interrupt_assert_callback, NULL);
138   state->interrupt_clear_timer = machine->scheduler().timer_alloc(FUNC(interrupt_clear_callback));
139   state->interrupt_assert_timer = machine->scheduler().timer_alloc(FUNC(interrupt_assert_callback));
140140}
141141
142142
src/mame/drivers/segaorun.c
r10315r10316
375375
376376static void sound_data_w(running_machine *machine, UINT8 data)
377377{
378   timer_call_after_resynch(machine, NULL, data, delayed_sound_data_w);
378   machine->scheduler().synchronize(FUNC(delayed_sound_data_w), data);
379379}
380380
381381
r10315r10316
461461}
462462
463463
464static TIMER_CALLBACK( scanline_callback )
464static TIMER_DEVICE_CALLBACK( scanline_callback )
465465{
466   segas1x_state *state = machine->driver_data<segas1x_state>();
466   segas1x_state *state = timer.machine->driver_data<segas1x_state>();
467467   int scanline = param;
468468   int next_scanline = scanline;
469469
r10315r10316
474474      case 65:
475475      case 129:
476476      case 193:
477         timer_set(machine, machine->primary_screen->time_until_pos(scanline, machine->primary_screen->visible_area().max_x + 1), NULL, 0, irq2_gen);
477         timer.machine->scheduler().timer_set(timer.machine->primary_screen->time_until_pos(scanline, timer.machine->primary_screen->visible_area().max_x + 1), FUNC(irq2_gen));
478478         next_scanline = scanline + 1;
479479         break;
480480
r10315r10316
502502   }
503503
504504   /* update IRQs on the main CPU */
505   update_main_irqs(machine);
505   update_main_irqs(timer.machine);
506506
507507   /* come back at the next targeted scanline */
508   timer_set(machine, machine->primary_screen->time_until_pos(next_scanline), NULL, next_scanline, scanline_callback);
508   timer.adjust(timer.machine->primary_screen->time_until_pos(next_scanline), next_scanline);
509509}
510510
511511
r10315r10316
538538   m68k_set_reset_callback(machine->device("maincpu"), outrun_reset);
539539
540540   /* start timers to track interrupts */
541   timer_set(machine, machine->primary_screen->time_until_pos(223), NULL, 223, scanline_callback);
541   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(223), 223);
542542}
543543
544544
r10315r10316
11181118   MCFG_MACHINE_RESET(outrun)
11191119   MCFG_QUANTUM_TIME(attotime::from_hz(6000))
11201120
1121   MCFG_TIMER_ADD("int_timer", scanline_callback)
1122
11211123   MCFG_PPI8255_ADD( "ppi8255", single_ppi_intf )
11221124
11231125   /* video hardware */
src/mame/drivers/gticlub.c
r10315r10316
730730   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
731731
732732   cputag_set_input_line(machine, "audiocpu", line, ASSERT_LINE);
733   timer_set(machine, attotime::from_usec(1), NULL, line, irq_off);
733   machine->scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off), line);
734734}
735735
736736static const k056800_interface gticlub_k056800_interface =
src/mame/drivers/mazerbla.c
r10315r10316
742742   mazerbla_state *state = space->machine->driver_data<mazerbla_state>();
743743
744744   /* set a timer to force synchronization after the read */
745   timer_call_after_resynch(space->machine, NULL, 0, NULL);
745   space->machine->scheduler().synchronize();
746746
747747   return state->ls670_0[offset];
748748}
r10315r10316
759759static WRITE8_HANDLER( ls670_0_w )
760760{
761761   /* do this on a timer to let the CPUs synchronize */
762   timer_call_after_resynch(space->machine, NULL, (offset << 8) | data, deferred_ls670_0_w);
762   space->machine->scheduler().synchronize(FUNC(deferred_ls670_0_w), (offset << 8) | data);
763763}
764764
765765static READ8_HANDLER( ls670_1_r )
r10315r10316
767767   mazerbla_state *state = space->machine->driver_data<mazerbla_state>();
768768
769769   /* set a timer to force synchronization after the read */
770   timer_call_after_resynch(space->machine, NULL, 0, NULL);
770   space->machine->scheduler().synchronize();
771771
772772   return state->ls670_1[offset];
773773}
r10315r10316
784784static WRITE8_HANDLER( ls670_1_w )
785785{
786786   /* do this on a timer to let the CPUs synchronize */
787   timer_call_after_resynch(space->machine, NULL, (offset << 8) | data, deferred_ls670_1_w);
787   space->machine->scheduler().synchronize(FUNC(deferred_ls670_1_w), (offset << 8) | data);
788788}
789789
790790
r10315r10316
928928
929929static WRITE8_HANDLER( main_sound_w )
930930{
931   timer_call_after_resynch(space->machine, NULL, data & 0xff, delayed_sound_w);
931   space->machine->scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff);
932932}
933933
934934static WRITE8_HANDLER( sound_int_clear_w )
src/mame/drivers/acefruit.c
r10315r10316
5252
5353static VIDEO_START( acefruit )
5454{
55   acefruit_refresh_timer = timer_alloc(machine, acefruit_refresh, NULL);
55   acefruit_refresh_timer = machine->scheduler().timer_alloc(FUNC(acefruit_refresh));
5656}
5757
5858static INTERRUPT_GEN( acefruit_vblank )
src/mame/drivers/sprint4.c
r10315r10316
107107   if (input_port_read(machine, "IN0") & 0x40)
108108      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
109109
110   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, nmi_callback);
110   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(nmi_callback), scanline);
111111}
112112
113113
114114static MACHINE_RESET( sprint4 )
115115{
116116   sprint4_state *state = machine->driver_data<sprint4_state>();
117   timer_set(machine, machine->primary_screen->time_until_pos(32), NULL, 32, nmi_callback);
117   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(32), FUNC(nmi_callback), 32);
118118
119119   memset(state->steer_FF1, 0, sizeof state->steer_FF1);
120120   memset(state->steer_FF2, 0, sizeof state->steer_FF2);
src/mame/drivers/simpsons.c
r10315r10316
130130{
131131   simpsons_state *state = space->machine->driver_data<simpsons_state>();
132132   cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
133   timer_set(space->machine, attotime::from_usec(25), NULL, 0, nmi_callback);   /* kludge until the K053260 is emulated correctly */
133   space->machine->scheduler().timer_set(attotime::from_usec(25), FUNC(nmi_callback));   /* kludge until the K053260 is emulated correctly */
134134}
135135
136136static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8 )
r10315r10316
269269   {
270270      simpsons_objdma(device->machine);
271271      // 32+256us delay at 8MHz dotclock; artificially shortened since actual V-blank length is unknown
272      timer_set(device->machine, attotime::from_usec(30), NULL, 0, dmaend_callback);
272      device->machine->scheduler().timer_set(attotime::from_usec(30), FUNC(dmaend_callback));
273273   }
274274
275275   if (k052109_is_irq_enabled(state->k052109))
src/mame/drivers/qdrmfgp.c
r10315r10316
616616static MACHINE_START( qdrmfgp2 )
617617{
618618   /* sound irq (CCU? 240Hz) */
619   timer_pulse(machine, attotime::from_hz(18432000/76800), NULL, 0, gp2_timer_callback);
619   machine->scheduler().timer_pulse(attotime::from_hz(18432000/76800), FUNC(gp2_timer_callback));
620620
621621   MACHINE_START_CALL( qdrmfgp );
622622}
src/mame/drivers/itech8.c
r10315r10316
632632{
633633   /* signal the NMI */
634634   itech8_update_interrupts(device->machine, 1, -1, -1);
635   timer_set(device->machine, attotime::from_usec(1), NULL, 0, irq_off);
635   device->machine->scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off));
636636
637637   if (FULL_LOGGING) logerror("------------ VBLANK (%d) --------------\n", device->machine->primary_screen->vpos());
638638}
r10315r10316
664664static MACHINE_START( sstrike )
665665{
666666   /* we need to update behind the beam as well */
667   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 32, behind_the_beam_update);
667   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(behind_the_beam_update), 32);
668668}
669669
670670static MACHINE_RESET( itech8 )
r10315r10316
707707   if (scanline >= 256) scanline = 0;
708708
709709   /* set a new timer */
710   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, (scanline << 8) + interval, behind_the_beam_update);
710   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(behind_the_beam_update), (scanline << 8) + interval);
711711}
712712
713713
r10315r10316
806806
807807static WRITE8_HANDLER( sound_data_w )
808808{
809   timer_call_after_resynch(space->machine, NULL, data, delayed_sound_data_w);
809   space->machine->scheduler().synchronize(FUNC(delayed_sound_data_w), data);
810810}
811811
812812
r10315r10316
817817          ((data & 0x5d) << 1) |
818818          ((data & 0x20) >> 3) |
819819          ((data & 0x02) << 5);
820   timer_call_after_resynch(space->machine, NULL, data, delayed_sound_data_w);
820   space->machine->scheduler().synchronize(FUNC(delayed_sound_data_w), data);
821821}
822822
823823
src/mame/drivers/hyprduel.c
r10315r10316
7171      state->requested_int |= 0x20;
7272      cpu_set_input_line(device, 2, HOLD_LINE);
7373      /* the duration is a guess */
74      timer_set(device->machine, attotime::from_usec(2500), NULL, 0x20, vblank_end_callback);
74      device->machine->scheduler().timer_set(attotime::from_usec(2500), FUNC(vblank_end_callback), 0x20);
7575   }
7676   else
7777      state->requested_int |= 0x12;      /* hsync */
r10315r10316
342342                       another blit. */
343343               if (b1 == 0)
344344               {
345                  timer_set(space->machine, attotime::from_usec(500), NULL, 0, hyprduel_blit_done);
345                  space->machine->scheduler().timer_set(attotime::from_usec(500), FUNC(hyprduel_blit_done));
346346                  return;
347347               }
348348
r10315r10316
823823   hyprduel_state *state = machine->driver_data<hyprduel_state>();
824824
825825   state->int_num = 0x01;
826   state->magerror_irq_timer = timer_alloc(machine, magerror_irq_callback, NULL);
826   state->magerror_irq_timer = machine->scheduler().timer_alloc(FUNC(magerror_irq_callback));
827827}
828828
829829
src/mame/drivers/flstory.c
r10315r10316
5050static WRITE8_HANDLER( sound_command_w )
5151{
5252   soundlatch_w(space, 0, data);
53   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
53   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
5454}
5555
5656
src/mame/drivers/atetris.c
r10315r10316
114114   atetris_state *state = machine->driver_data<atetris_state>();
115115
116116   /* Allocate interrupt timer */
117   state->interrupt_timer = timer_alloc(machine, interrupt_gen, NULL);
117   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_gen));
118118
119119   /* Set up save state */
120120   state_save_register_global(machine, state->current_bank);
src/mame/drivers/espial.c
r10315r10316
5555   state->flipscreen = 0;
5656
5757   /* we must start with NMI interrupts disabled */
58   timer_call_after_resynch(machine, NULL, 0, interrupt_disable);
58   machine->scheduler().synchronize(FUNC(interrupt_disable));
5959   state->sound_nmi_enabled = FALSE;
6060}
6161
src/mame/drivers/tmnt.c
r10315r10316
348348   tmnt_state *state = space->machine->driver_data<tmnt_state>();
349349//  sound_nmi_enabled = 1;
350350   cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
351   timer_set(space->machine, attotime::from_usec(50), NULL, 0, nmi_callback);   /* kludge until the K053260 is emulated correctly */
351   space->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(nmi_callback));   /* kludge until the K053260 is emulated correctly */
352352}
353353
354354
src/mame/drivers/zodiack.c
r10315r10316
143143   zodiack_state *state = machine->driver_data<zodiack_state>();
144144
145145   /* we must start with NMI interrupts disabled */
146   timer_call_after_resynch(machine, NULL, 0, interrupt_disable);
146   machine->scheduler().synchronize(FUNC(interrupt_disable));
147147   state->sound_nmi_enabled = FALSE;
148148}
149149
src/mame/drivers/berzerk.c
r10315r10316
174174
175175static void create_irq_timer(running_machine *machine)
176176{
177   irq_timer = timer_alloc(machine, irq_callback, NULL);
177   irq_timer = machine->scheduler().timer_alloc(FUNC(irq_callback));
178178}
179179
180180
r10315r10316
251251
252252static void create_nmi_timer(running_machine *machine)
253253{
254   nmi_timer = timer_alloc(machine, nmi_callback, NULL);
254   nmi_timer = machine->scheduler().timer_alloc(FUNC(nmi_callback));
255255}
256256
257257
src/mame/drivers/suprridr.c
r10315r10316
124124
125125static WRITE8_HANDLER( sound_data_w )
126126{
127   timer_call_after_resynch(space->machine, NULL, data, delayed_sound_w);
127   space->machine->scheduler().synchronize(FUNC(delayed_sound_w), data);
128128}
129129
130130
src/mame/drivers/psikyo.c
r10315r10316
8888
8989      /* main CPU might be waiting for sound CPU to finish NMI,
9090           so set a timer to give sound CPU a chance to run */
91      timer_call_after_resynch(field->port->machine, NULL, 0, NULL);
91      field->port->machine->scheduler().synchronize();
9292//      logerror("%s - Read coin port during Z80 NMI\n", cpuexec_describe_context(machine));
9393   }
9494
r10315r10316
157157static WRITE32_HANDLER( psikyo_soundlatch_w )
158158{
159159   if (ACCESSING_BITS_0_7)
160      timer_call_after_resynch(space->machine, NULL, data & 0xff, psikyo_soundlatch_callback);
160      space->machine->scheduler().synchronize(FUNC(psikyo_soundlatch_callback), data & 0xff);
161161}
162162
163163/***************************************************************************
r10315r10316
167167static WRITE32_HANDLER( s1945_soundlatch_w )
168168{
169169   if (ACCESSING_BITS_16_23)
170      timer_call_after_resynch(space->machine, NULL, (data >> 16) & 0xff, psikyo_soundlatch_callback);
170      space->machine->scheduler().synchronize(FUNC(psikyo_soundlatch_callback), (data >> 16) & 0xff);
171171}
172172
173173static const UINT8 s1945_table[256] = {
src/mame/drivers/xexex.c
r10315r10316
495495   state_save_register_global(machine, state->cur_sound_region);
496496   state_save_register_postload(machine, xexex_postload, NULL);
497497
498   state->dmadelay_timer = timer_alloc(machine, dmaend_callback, NULL);
498   state->dmadelay_timer = machine->scheduler().timer_alloc(FUNC(dmaend_callback));
499499}
500500
501501static MACHINE_RESET( xexex )
src/mame/drivers/skullxbo.c
r10315r10316
5656   {
5757      int   width = screen.width();
5858      attotime period = screen.time_until_pos(screen.vpos() + 6, width * 0.9);
59      timer_set(screen.machine, period, NULL, 0, irq_gen);
59      screen.machine->scheduler().timer_set(period, FUNC(irq_gen));
6060   }
6161
6262   /* update the playfield and motion objects */
src/mame/drivers/mlanding.c
r10315r10316
284284   if (pixels)
285285   {
286286      dma_active = 1;
287      timer_set(space->machine, attotime::from_msec(20), NULL, 0, dma_complete);
287      space->machine->scheduler().timer_set(attotime::from_msec(20), FUNC(dma_complete));
288288   }
289289
290290   if(!(data & 0x40)) // unknown line used
src/mame/drivers/tankbust.c
r10315r10316
3232
3333static WRITE8_HANDLER( tankbust_soundlatch_w )
3434{
35   timer_call_after_resynch(space->machine, NULL, data,soundlatch_callback);
35   space->machine->scheduler().synchronize(FUNC(soundlatch_callback), data);
3636}
3737
3838static READ8_DEVICE_HANDLER( tankbust_soundlatch_r )
r10315r10316
8181   break;
8282
8383   case 1:   /* 0xe001 (value 0 then 1) written right after the soundlatch_w */
84      timer_call_after_resynch(space->machine, NULL, data,soundirqline_callback);
84      space->machine->scheduler().synchronize(FUNC(soundirqline_callback), data);
8585   break;
8686
8787   case 2:   /* 0xe002 coin counter */
src/mame/drivers/seattle.c
r10315r10316
515515   voodoo = machine->device("voodoo");
516516
517517   /* allocate timers for the galileo */
518   galileo.timer[0].timer = timer_alloc(machine, galileo_timer_callback, NULL);
519   galileo.timer[1].timer = timer_alloc(machine, galileo_timer_callback, NULL);
520   galileo.timer[2].timer = timer_alloc(machine, galileo_timer_callback, NULL);
521   galileo.timer[3].timer = timer_alloc(machine, galileo_timer_callback, NULL);
518   galileo.timer[0].timer = machine->scheduler().timer_alloc(FUNC(galileo_timer_callback));
519   galileo.timer[1].timer = machine->scheduler().timer_alloc(FUNC(galileo_timer_callback));
520   galileo.timer[2].timer = machine->scheduler().timer_alloc(FUNC(galileo_timer_callback));
521   galileo.timer[3].timer = machine->scheduler().timer_alloc(FUNC(galileo_timer_callback));
522522
523523   /* set the fastest DRC options, but strict verification */
524524   mips3drc_set_options(machine->device("maincpu"), MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
src/mame/drivers/galastrm.c
r10315r10316
166166
167167static WRITE32_HANDLER( galastrm_adstick_ctrl_w )
168168{
169   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(1000), NULL, 0, galastrm_interrupt6);
169   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(1000), FUNC(galastrm_interrupt6));
170170}
171171
172172/***********************************************************
src/mame/drivers/tetrisp2.c
r10315r10316
10441044
10451045static void init_rockn_timer(running_machine *machine)
10461046{
1047   timer_pulse(machine, attotime::from_msec(32), NULL, 0, rockn_timer_level1_callback);
1048   rockn_timer_l4 = timer_alloc(machine, rockn_timer_level4_callback, NULL);
1047   machine->scheduler().timer_pulse(attotime::from_msec(32), FUNC(rockn_timer_level1_callback));
1048   rockn_timer_l4 = machine->scheduler().timer_alloc(FUNC(rockn_timer_level4_callback));
10491049
10501050   state_save_register_global_array(machine, tetrisp2_systemregs);
10511051   state_save_register_global_array(machine, rocknms_sub_systemregs);
r10315r10316
10761076{
10771077   init_rockn_timer(machine);
10781078
1079   timer_pulse(machine, attotime::from_msec(32), NULL, 0, rockn_timer_sub_level1_callback);
1080   rockn_timer_sub_l4 = timer_alloc(machine, rockn_timer_sub_level4_callback, NULL);
1079   machine->scheduler().timer_pulse(attotime::from_msec(32), FUNC(rockn_timer_sub_level1_callback));
1080   rockn_timer_sub_l4 = machine->scheduler().timer_alloc(FUNC(rockn_timer_sub_level4_callback));
10811081
10821082   rockn_protectdata = 3;
10831083
src/mame/drivers/alpha68k.c
r10315r10316
29142914
29152915   ROM_REGION( 0x90000, "audiocpu", 0 )   /* Sound CPU */
29162916   ROM_LOAD( "gw-12.10f",      0x00000, 0x08000, CRC(e6d6c9cf) SHA1(c35a7a385592e55bdfe232d042f2228f4f7e9ffa) )
2917   ROM_CONTINUE(                0x18000, 0x08000 )
2918   ROM_LOAD( "gw-9.15f",      0x30000, 0x10000, CRC(84e5c946) SHA1(0b071d15b664a9c529713b1b896bdb5ebfa16c25) )
2917   ROM_CONTINUE(               0x18000, 0x08000 )
2918   ROM_LOAD( "gw-11.11f",      0x30000, 0x10000, CRC(7b9f2608) SHA1(8d61dfa32369450e396cc8a5d67c58eedb2167e6) )
29192919   ROM_LOAD( "gw-10.13f",      0x50000, 0x10000, CRC(eb305d42) SHA1(93910cf60c1b8a87969888d8693c7d6782f1e799) )
2920   ROM_LOAD( "gw-11.11f",      0x70000, 0x10000, CRC(7b9f2608) SHA1(8d61dfa32369450e396cc8a5d67c58eedb2167e6) )
2920   ROM_LOAD( "gw-9.15f",      0x70000, 0x10000, CRC(84e5c946) SHA1(0b071d15b664a9c529713b1b896bdb5ebfa16c25) )
29212921
29222922   ROM_REGION( 0x020000, "gfx1", 0 )  /* chars */
29232923   ROM_LOAD( "gw-13.4l",     0x000000, 0x10000, CRC(b75bf1d0) SHA1(c22c0049274c45701be0a7be2afc0517620a3a10) )
r10315r10316
29912991   ROM_REGION( 0x90000, "audiocpu", 0 )   /* Sound CPU */
29922992   ROM_LOAD( "u12",            0x00000, 0x08000, CRC(2620caa1) SHA1(bd464abce0bedab68cb913321e76d83eb36ca374) )
29932993   ROM_CONTINUE(               0x18000, 0x08000 )
2994   ROM_LOAD( "u11",            0x30000, 0x10000, CRC(2218ceb9) SHA1(69a843308cb0628ad856a09a33cd148f36ce0d24) )
2995   ROM_LOAD( "u10",            0x50000, 0x10000, CRC(636978ae) SHA1(5d8093bc43192c89e230af318609222a69866b6e) )
29942996   ROM_LOAD( "u9",             0x70000, 0x10000, CRC(9136745e) SHA1(d7a2bfeac69ab2dbd4565a5bd1abb1f3f1199b42) )
2995   ROM_LOAD( "u10",            0x50000, 0x10000, CRC(636978ae) SHA1(5d8093bc43192c89e230af318609222a69866b6e) )
2996   ROM_LOAD( "u11",            0x30000, 0x10000, CRC(2218ceb9) SHA1(69a843308cb0628ad856a09a33cd148f36ce0d24) )
29972997
29982998   ROM_REGION( 0x020000, "gfx1", 0 )  /* chars */
29992999   ROM_LOAD( "gwb_ic.m19",     0x000000, 0x10000, CRC(b75bf1d0) SHA1(c22c0049274c45701be0a7be2afc0517620a3a10) )
src/mame/drivers/namcos22.c
r10315r10316
21882188      { /* SUBCPU enable on System 22 (guessed, but too early crashes Rave Racer so it's a good test) */
21892189         if (data == 0xff00)
21902190         {
2191            timer_set(space->machine, attotime::from_msec(50), NULL, 0, start_subcpu);
2191            space->machine->scheduler().timer_set(attotime::from_msec(50), FUNC(start_subcpu));
21922192         }
21932193      }
21942194   }
src/mame/drivers/flyball.c
r10315r10316
136136
137137   for (i = 0; i < 64; i++)
138138      if (potsense[i] != 0)
139         timer_set(machine, machine->primary_screen->time_until_pos(scanline + i), NULL, potsense[i], flyball_joystick_callback);
139         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline + i), FUNC(flyball_joystick_callback), potsense[i]);
140140
141141   scanline += 0x40;
142142   scanline &= 0xff;
143143
144   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, flyball_quarter_callback);
144   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(flyball_quarter_callback), scanline);
145145
146146   state->potsense = 0;
147147   state->potmask = 0;
r10315r10316
387387
388388   machine->device("maincpu")->reset();
389389
390   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, flyball_quarter_callback);
390   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(flyball_quarter_callback));
391391
392392   state->pitcher_vert = 0;
393393   state->pitcher_horz = 0;
src/mame/drivers/ssv.c
r10315r10316
933933   if(!offset)
934934      state->latches[2]|=1;
935935   COMBINE_DATA(&state->latches[offset]);
936   timer_call_after_resynch(space->machine, NULL, 0, NULL);
936   space->machine->scheduler().synchronize();
937937}
938938
939939static READ16_HANDLER(latch16_r)
r10315r10316
952952   if(!offset)
953953      state->latches[2]|=2;
954954   state->latches[offset]=data;
955   timer_call_after_resynch(space->machine, NULL, 0, NULL);
955   space->machine->scheduler().synchronize();
956956}
957957
958958static ADDRESS_MAP_START( jsk_map, ADDRESS_SPACE_PROGRAM, 16 )
src/mame/drivers/mpu4drvr.c
r10315r10316
172172      - Hook up OKIM6376 sound in The Mating Game
173173      - Get the BwB games running
174174        * They have a slightly different 68k memory map. The 6850 is at e00000 and the 6840 is at e01000
175      They appear to hang on the handshake with the MPU4 board
175176      - Find out what causes the games to reset in service mode (see jump taken at CPU1:c8e8)
176177      - Deal 'Em lockouts vary on certain cabinets (normally connected to AUX2, but not there?)
177178      - Deal 'Em has bad tiles (apostrophe, logo, bottom corner), black should actually be transparent
r10315r10316
10941095   }
10951096}
10961097
1098/******************************************
1099 *
1100 *  Brooktree Bt471 RAMDAC
1101 *  Implementation stolen from JPM
1102 *  Impact, may not be 100% (that has a 477)
1103 ******************************************/
10971104
1105static struct
1106{
1107   UINT8 address;
1108   UINT8 addr_cnt;
1109   UINT8 pixmask;
1110   UINT8 command;
1111   rgb_t color;
1112} bt471;
1113
1114
1115/*
1116 *  0 0 0    Address register (RAM write mode)
1117 *  0 0 1    Color palette RAMs
1118 *  0 1 0    Pixel read mask register
1119 *  0 1 1    Address register (RAM read mode)
1120 *  1 0 0    Address register (overlay write mode)
1121 *  1 1 1    Address register (overlay read mode)
1122 *  1 0 1    Overlay register
1123 */
1124
1125WRITE16_HANDLER( bt471_w )
1126{
1127   UINT8 val = data & 0xff;
1128      {
1129         popmessage("Bt477: Unhandled write access (offset:%x, data:%x)", offset, val);
1130      }
1131
1132   switch (offset)
1133   {
1134      case 0x0:
1135      {
1136         bt471.address = val;
1137         bt471.addr_cnt = 0;
1138         break;
1139      }
1140      case 0x1:
1141      {
1142         UINT8 *addr_cnt = &bt471.addr_cnt;
1143         rgb_t *color = &bt471.color;
1144
1145         color[*addr_cnt] = val;
1146
1147         if (++*addr_cnt == 3)
1148         {
1149            palette_set_color(space->machine, bt471.address, MAKE_RGB(color[0], color[1], color[2]));
1150            *addr_cnt = 0;
1151
1152            /* Address register increments */
1153            bt471.address++;
1154         }
1155         break;
1156      }
1157      case 0x2:
1158      {
1159         bt471.pixmask = val;
1160         break;
1161      }
1162
1163//      default:
1164      {
1165         popmessage("Bt477: Unhandled write access (offset:%x, data:%x)", offset, val);
1166      }
1167   }
1168}
1169
1170READ16_HANDLER( bt471_r )
1171{
1172   popmessage("Bt477: Unhandled read access (offset:%x)", offset);
1173   return 0;
1174}
1175
1176
10981177/*************************************
10991178 *
11001179 *  Trackball interface
r10315r10316
18881967{
18891968   mpu4_config_common(machine);
18901969
1970   mod_number=4; //No AY chip
18911971   /* setup communications */
18921972   link7a_connected = 1;
18931973
18941974   /* setup 8 mechanical meters */
1895   Mechmtr_init(8);
1975   MechMtr_config(machine,8);
18961976
1897   /* setup 4 reels (for hybrid machines) */
1898   stepper_config(machine, 0, &barcrest_reel_interface);
1899   stepper_config(machine, 1, &barcrest_reel_interface);
1900   stepper_config(machine, 2, &barcrest_reel_interface);
1901   stepper_config(machine, 3, &barcrest_reel_interface);
1902
19031977   /* setup the standard oki MSC1937 display */
19041978   ROC10937_init(0, MSC1937, 0);
19051979
r10315r10316
19772051/*  AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w) Word-based version of old CHR??? */
19782052ADDRESS_MAP_END
19792053
2054static ADDRESS_MAP_START( bwbvid_6809_map, ADDRESS_SPACE_PROGRAM, 8 )
2055   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
2056   AM_RANGE(0x0800, 0x0800) AM_DEVREADWRITE("acia6850_0", acia6850_stat_r, acia6850_ctrl_w)
2057   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("acia6850_0", acia6850_data_r, acia6850_data_w)
2058   AM_RANGE(0x0880, 0x0881) //AM_NOP //Read/write here
2059   AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_read, ptm6840_write)
2060   AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w)
2061   AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w)
2062   AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE("pia_ic5", pia6821_r, pia6821_w)
2063   AM_RANGE(0x0d00, 0x0d03) AM_DEVREADWRITE("pia_ic6", pia6821_r, pia6821_w)
2064   AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE("pia_ic7", pia6821_r, pia6821_w)
2065   AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE("pia_ic8", pia6821_r, pia6821_w)
2066   AM_RANGE(0x4000, 0x7fff) AM_RAM
2067   AM_RANGE(0xbe00, 0xbfff) AM_RAM
2068   AM_RANGE(0xc000, 0xffff) AM_ROM   AM_REGION("maincpu",0)  /* 64k EPROM on board, only this region read */
2069ADDRESS_MAP_END
19802070
2071static ADDRESS_MAP_START( bwbvid_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
2072   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2073   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram)
2074   AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
2075   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff)
2076   AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff)
2077   AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
2078//   AM_RANGE(0xa00000, 0xa0000f) AM_READWRITE(bt471_r,bt471_w) //Some games use this
2079/*  AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
2080   AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
2081   AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
2082   AM_RANGE(0xe05000, 0xe05001) //AM_READWRITE(adpcm_r, adpcm_w)  CHR ?
2083   AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff)
2084   AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff)
2085ADDRESS_MAP_END
2086
2087static ADDRESS_MAP_START( bwbvid5_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
2088   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2089   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram)
2090   AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
2091   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff)
2092   AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff)
2093   AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
2094   //AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(bt471_r,bt471_w) Some games use this
2095/*  AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
2096   AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
2097   AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
2098   AM_RANGE(0xe05000, 0xe05001) //AM_READWRITE(adpcm_r, adpcm_w)  CHR ?
2099   AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_stat_r, acia6850_ctrl_w, 0xff)
2100   AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_data_r, acia6850_data_w, 0xff)
2101   AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff)
2102   AM_RANGE(0xe02000, 0xe02007) AM_DEVREADWRITE8("pia_ic4ss", pia6821_r, pia6821_w, 0xff)
2103   AM_RANGE(0xe03000, 0xe0300f) AM_DEVREADWRITE8("6840ptm_ic3ss", ptm6840_read, ptm6840_write, 0xff)
2104ADDRESS_MAP_END
2105//   
19812106/* Deal 'Em */
19822107/* Deal 'Em was designed as an enhanced gamecard, to fit into an existing MPU4 cabinet
19832108It's an unoffical addon, and does all its work through the existing 6809 CPU.
19842109Although given unofficial status, Barcrest's patent on the MPU4 Video hardware (GB1596363) describes
1985the Deal 'Em board design, rather than the one they ultimately used, suggesting some sort of licensing deal. */
2110the Deal 'Em board design, rather than the one they ultimately used, suggesting some sort of licensing deal.
2111Perhaps this was the (seemingly very rare) MPU3 Video card design? */
19862112
19872113static const gfx_layout dealemcharlayout =
19882114{
r10315r10316
21362262static TIMER_DEVICE_CALLBACK( scanline_timer_callback )
21372263{
21382264   int current_scanline=param;
2139   timer_call_after_resynch(timer.machine, NULL, 0, 0);
2265   timer.machine->scheduler().synchronize();
21402266
21412267
21422268   if (current_scanline==0)
r10315r10316
22692395   MCFG_PALETTE_LENGTH(16)
22702396
22712397   MCFG_PTM6840_ADD("6840ptm_68k", ptm_vid_intf)
2272
2273   MCFG_SPEAKER_STANDARD_MONO("mono")
2274   MCFG_SOUND_ADD("ay8913",AY8913, MPU4_MASTER_CLOCK/4)
2275   MCFG_SOUND_CONFIG(ay8910_config)
2276   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
2277
22782398   /* Present on all video cards */
22792399   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
22802400   MCFG_SOUND_ADD("saa", SAA1099, 8000000)
r10315r10316
22932413MACHINE_CONFIG_END
22942414
22952415static MACHINE_CONFIG_DERIVED( mating, crmaze )
2296
22972416   MCFG_SOUND_ADD("oki", OKIM6376, 64000) //?
2298   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
2417   MCFG_SOUND_ROUTE(0, "lspeaker", 0.5)
2418   MCFG_SOUND_ROUTE(1, "rspeaker", 0.5)
22992419MACHINE_CONFIG_END
23002420
23012421static MACHINE_CONFIG_DERIVED( vgpoker, mpu4_vid )
r10315r10316
23032423   MCFG_CPU_PROGRAM_MAP(vp_68k_map)
23042424MACHINE_CONFIG_END
23052425
2426static MACHINE_CONFIG_START( bwbvid, driver_device )
2427   MCFG_CPU_ADD("maincpu", M6809, MPU4_MASTER_CLOCK/4 )
2428   MCFG_CPU_PROGRAM_MAP(bwbvid_6809_map)
2429   MCFG_TIMER_ADD_PERIODIC("50hz",gen_50hz, attotime::from_hz(100))
23062430
2431   MCFG_NVRAM_ADD_0FILL("nvram")            /* confirm */
23072432
2433   /* 6840 PTM */
2434   MCFG_PTM6840_ADD("ptm_ic2", ptm_ic2_intf)
2435
2436   MCFG_PIA6821_ADD("pia_ic3", pia_ic3_intf)
2437   MCFG_PIA6821_ADD("pia_ic4", pia_ic4_intf)
2438   MCFG_PIA6821_ADD("pia_ic5", pia_ic5_intf)
2439   MCFG_PIA6821_ADD("pia_ic6", pia_ic6_intf)
2440   MCFG_PIA6821_ADD("pia_ic7", pia_ic7_intf)
2441   MCFG_PIA6821_ADD("pia_ic8", pia_ic8_intf)
2442
2443   /* video hardware */
2444   MCFG_SCREEN_ADD("screen", RASTER)
2445   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
2446   MCFG_SCREEN_SIZE(64*8, 40*8) // note this directly affects the scanline counters used below, and thus the timing of everything
2447   MCFG_SCREEN_VISIBLE_AREA(0*8, 63*8-1, 0*8, 37*8-1)
2448   MCFG_SCREEN_REFRESH_RATE(50)
2449
2450   MCFG_CPU_ADD("video", M68000, VIDEO_MASTER_CLOCK )
2451   MCFG_CPU_PROGRAM_MAP(bwbvid_68k_map)
2452
2453   MCFG_QUANTUM_TIME(attotime::from_hz(960))
2454
2455   MCFG_MACHINE_START(mpu4_vid)
2456   MCFG_MACHINE_RESET(mpu4_vid)
2457   MCFG_VIDEO_START (mpu4_vid)
2458   MCFG_VIDEO_UPDATE(mpu4_vid)
2459
2460   MCFG_PALETTE_LENGTH(16)
2461
2462   MCFG_PTM6840_ADD("6840ptm_68k", ptm_vid_intf)
2463
2464   /* Present on all video cards */
2465   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
2466   MCFG_SOUND_ADD("saa", SAA1099, 8000000)
2467   MCFG_SOUND_ROUTE(0, "lspeaker", 0.5)
2468   MCFG_SOUND_ROUTE(1, "rspeaker", 0.5)
2469
2470   MCFG_ACIA6850_ADD("acia6850_0", m6809_acia_if)
2471   MCFG_ACIA6850_ADD("acia6850_1", m68k_acia_if)
2472
2473   // for the video timing
2474   MCFG_TIMER_ADD_SCANLINE("scan_timer", scanline_timer_callback, "screen", 0, 1)
2475MACHINE_CONFIG_END
2476
2477static MACHINE_CONFIG_DERIVED( bwbvid5, bwbvid )
2478   MCFG_CPU_MODIFY("video")
2479   MCFG_CPU_PROGRAM_MAP(bwbvid5_68k_map)
2480
2481   MCFG_PTM6840_ADD("6840ptm_ic3ss", ptm_ic3ss_intf)
2482   MCFG_PIA6821_ADD("pia_ic4ss", pia_ic4ss_intf)
2483
2484   MCFG_SOUND_ADD("msm6376", OKIM6376, 64000) //?
2485   MCFG_SOUND_ROUTE(0, "lspeaker", 0.5)
2486   MCFG_SOUND_ROUTE(1, "rspeaker", 0.5)
2487
2488MACHINE_CONFIG_END
2489
23082490/* machine driver for Zenitone Deal 'Em board */
23092491static MACHINE_CONFIG_START( dealem, driver_device )
23102492   MCFG_MACHINE_START(mpu4mod2)                     /* main mpu4 board initialisation */
r10315r10316
26972879   ROM_LOAD16_BYTE( "blxv___2.0_6",  0x040001, 0x10000, CRC(a3d92b5b) SHA1(1e7042d5eae4a19a01a3ef7d806c434886dc9f4d) )
26982880ROM_END
26992881
2882ROM_START( bwbtetrs )
2883   ROM_REGION( 0x10000, "maincpu", 0 )
2884   ROM_LOAD("tetris22.p0",  0x00000, 0x04000, CRC(b711c7ae) SHA1(767b17ddf9021fdf79ff6c52f04a5d8ea60cf30e) )
2885
2886   ROM_REGION( 0x800000, "video", 0 )
2887   ROM_LOAD16_BYTE( "tetris22.p1",  0x000000, 0x10000, CRC(e81dd182) SHA1(28b460224abf6fe24b637542ccd1c84040674555) )
2888   ROM_LOAD16_BYTE( "tetris22.p2",  0x000001, 0x10000, CRC(68aa4f15) SHA1(4e4511a64391fc64e5f5b7ccb46a78fd2e1d94d6) )
2889   ROM_LOAD16_BYTE( "tetris22.p3",  0x020000, 0x10000, CRC(b38b4763) SHA1(d28e77fdd6869cb5b5ec40ed1f300a2a947e0482) )
2890   ROM_LOAD16_BYTE( "tetris22.p4",  0x020001, 0x10000, CRC(1649f604) SHA1(ca4ac303391a0969d41c8f988b8e81cfcee1a21c) )
2891   ROM_LOAD16_BYTE( "tetris22.p5",  0x040001, 0x10000, CRC(02859676) SHA1(5293c767021a6b5253eecab0b0568aa082ea7084) )
2892   ROM_LOAD16_BYTE( "tetris22.p6",  0x040001, 0x10000, CRC(40d24c82) SHA1(7ac3cf148af84ad93eaf11ce3420abbe45d986e2) )
2893ROM_END
2894
2895/* Vegas Poker Prototype dumped by HIGHWAYMAN */
2896ROM_START( vgpoker )
2897   ROM_REGION( 0x10000, "maincpu", 0 )
2898   ROM_LOAD("comms-v2.0.bin",  0x00000, 0x10000,  CRC(1717581f) SHA1(40f8cae39a2ab0c89d2bbfd8a37725aaae229c96))
2899
2900   ROM_REGION( 0x800000, "video", 0 )
2901   ROM_LOAD16_BYTE("video-1.bin",  0x000000, 0x010000,  CRC(7ba2396c) SHA1(eb24b802b984315fc2eba4f15c208e2c1925c1c8))
2902   ROM_LOAD16_BYTE("video-2.bin",  0x000001, 0x010000,  CRC(4f9e830b) SHA1(f17bebb289c3620bf4c88b2b358a9dab87ac214f))
2903   ROM_LOAD16_BYTE("video-3.bin",  0x020000, 0x010000,  CRC(607e0baa) SHA1(9f64a46ef3b9a854e939b5e7f0d1e6e925735922))
2904   ROM_LOAD16_BYTE("video-4.bin",  0x020001, 0x010000,  CRC(2019f5d3) SHA1(d183b3b92d03be9f9d57b5df1a621cbfe955ed93))
2905   ROM_LOAD16_BYTE("video-5.bin",  0x040000, 0x010000,  CRC(c029202e) SHA1(b08bb2678c2ff62a58ef67d5440c326d0fadc34e))
2906   ROM_LOAD16_BYTE("video-6.bin",  0x040001, 0x010000,  CRC(3287ae4e) SHA1(3b05a036de3ca7ec644bfbf04934e44e631d1e28))
2907   ROM_LOAD16_BYTE("video-7.bin",  0x060000, 0x010000,  CRC(231cf163) SHA1(02b28ef0e1661a82d0fba2ecc5474c79651fa9e7))
2908   ROM_LOAD16_BYTE("video-8.bin",  0x060001, 0x010000,  CRC(076efdc8) SHA1(bef0a1d8f0e7486ee5dc7407ce5c96854cefa5cf))
2909ROM_END
2910
2911
2912ROM_START( renoreel )
2913   ROM_REGION( 0x10000, "maincpu", 0 )
2914   ROM_LOAD("rr_27s__.a60",  0x00000, 0x10000,  CRC(44c9ff47) SHA1(93a3155144b233c113aa3b49bd4eb5969e400a68))
2915
2916   ROM_REGION( 0x800000, "video", 0 )   
2917   ROM_LOAD16_BYTE( "rr______.a_1",  0x000000, 0x80000,  CRC(ff27d0ba) SHA1(85cce36495f00a05c1806ecde37274212680e466) )
2918   ROM_LOAD16_BYTE( "rr______.a_2",  0x000001, 0x80000,  CRC(519b9ae1) SHA1(8ccfe8de0f2c85923df81af8cba6f20af43d2fe2) )
2919
2920   ROM_REGION( 0x200000, "msm6376", 0 )
2921   ROM_LOAD( "renosnda.bin",  0x000000, 0x080000,  CRC(a72a5e1b) SHA1(a0d5338a400345a55484848a7612119405f617b1) )
2922   ROM_LOAD( "renosndb.bin",  0x080000, 0x080000,  CRC(46e9a32f) SHA1(d45835a82368992597e44b3c5b9d00d8b901e733) )
2923
2924ROM_END
2925
2926ROM_START( redhtpkr )
2927   ROM_REGION( 0x10000, "maincpu", 0 )
2928   ROM_LOAD("rp_20s__.3_0",  0x00000, 0x10000,  CRC(b7d02d22) SHA1(f9da1c6dde064bc39d0c48a165dac7acde933397))
2929
2930   ROM_REGION( 0x800000, "video", 0 )
2931   ROM_LOAD16_BYTE("rp______.3_1",  0x000000, 0x010000,  CRC(b987406d) SHA1(8c4d386570c0c6298b1cabf50295021b3b0cf625))
2932   ROM_LOAD16_BYTE("rp______.3_2",  0x000001, 0x010000,  CRC(73e3c12e) SHA1(19e3ed7255fa0c3bfa14b6a4b705c0c3e1a237b6))
2933   ROM_LOAD16_BYTE("rp______.3_3",  0x020000, 0x010000,  CRC(05a30183) SHA1(302f4926073bf7335da7f0b1e6399b64ea9bbae4))
2934   ROM_LOAD16_BYTE("rp______.3_4",  0x020001, 0x010000,  CRC(6b122765) SHA1(72cd0fda322790bed8cdc7697306ec01efc43789))
2935   ROM_LOAD16_BYTE("rp______.3_5",  0x040000, 0x010000,  CRC(d9fd05d0) SHA1(330ef58c012b5d5fd018bea54b3ae315b3e45cfd))
2936   ROM_LOAD16_BYTE("rp______.3_6",  0x040001, 0x010000,  CRC(eeea91ff) SHA1(cc7870a68f62d4dd70c13713a432a61a091821ef))
2937
2938ROM_END
2939
27002940ROM_START( crmaze )
27012941   ROM_REGION( 0x10000, "maincpu", 0 )
27022942   VID_BIOS
r10315r10316
31223362ROM_END
31233363
31243364
3125/* Vegas Poker Prototype dumped by HIGHWAYMAN */
3126ROM_START( vgpoker )
3127   ROM_REGION( 0x10000, "maincpu", 0 )
3128   ROM_LOAD("comms-v2.0.bin",  0x00000, 0x10000,  CRC(1717581f) SHA1(40f8cae39a2ab0c89d2bbfd8a37725aaae229c96))
3129
3130   ROM_REGION( 0x800000, "video", 0 )
3131   ROM_LOAD16_BYTE("video-1.bin",  0x000000, 0x010000,  CRC(7ba2396c) SHA1(eb24b802b984315fc2eba4f15c208e2c1925c1c8))
3132   ROM_LOAD16_BYTE("video-2.bin",  0x000001, 0x010000,  CRC(4f9e830b) SHA1(f17bebb289c3620bf4c88b2b358a9dab87ac214f))
3133   ROM_LOAD16_BYTE("video-3.bin",  0x020000, 0x010000,  CRC(607e0baa) SHA1(9f64a46ef3b9a854e939b5e7f0d1e6e925735922))
3134   ROM_LOAD16_BYTE("video-4.bin",  0x020001, 0x010000,  CRC(2019f5d3) SHA1(d183b3b92d03be9f9d57b5df1a621cbfe955ed93))
3135   ROM_LOAD16_BYTE("video-5.bin",  0x040000, 0x010000,  CRC(c029202e) SHA1(b08bb2678c2ff62a58ef67d5440c326d0fadc34e))
3136   ROM_LOAD16_BYTE("video-6.bin",  0x040001, 0x010000,  CRC(3287ae4e) SHA1(3b05a036de3ca7ec644bfbf04934e44e631d1e28))
3137   ROM_LOAD16_BYTE("video-7.bin",  0x060000, 0x010000,  CRC(231cf163) SHA1(02b28ef0e1661a82d0fba2ecc5474c79651fa9e7))
3138   ROM_LOAD16_BYTE("video-8.bin",  0x060001, 0x010000,  CRC(076efdc8) SHA1(bef0a1d8f0e7486ee5dc7407ce5c96854cefa5cf))
3139ROM_END
31403365/*Deal 'Em was a conversion kit designed to make early MPU4 machines into video games by replacing the top glass
31413366and reel assembly with this kit and a supplied monitor.
31423367The real Deal 'Em ran on Summit Coin hardware, and was made by someone else.
r10315r10316
31923417GAME( 199?,  quidgrid2, quidgrid, mpu4_vid, mpu4,     quidgrid, ROT0, "Barcrest",      "Ten Quid Grid (v2.4)",                                    GAME_NOT_WORKING )
31933418GAME( 199?,  quidgrid2d,quidgrid, mpu4_vid, mpu4,     quidgrid, ROT0, "Barcrest",      "Ten Quid Grid (v2.4, Datapak)",                           GAME_NOT_WORKING )
31943419
3195/* Games below are newer BwB games and use their own BIOS ROMs */
3420/* Games below are newer BwB games and use their own BIOS ROMs and hardware setups*/
31963421GAME( 199?,  vgpoker,   0,        vgpoker,  mpu4,     0,        ROT0, "BwB",         "Vegas Poker (prototype, release 2)",                        GAME_NOT_WORKING )
3197GAME( 199?,  prizeinv,  0,        mpu4_vid, mpu4,     0,        ROT0, "BwB",         "Prize Space Invaders (20\" v1.1)",                           GAME_NOT_WORKING )
3198GAME( 199?,  blox,      0,        mpu4_vid, mpu4,     0,        ROT0, "BwB",         "Blox (v2.0)",                                          GAME_NOT_WORKING )
3199GAME( 199?,  bloxd,     blox,     mpu4_vid, mpu4,     0,        ROT0, "BwB",         "Blox (v2.0, Datapak)",                                    GAME_NOT_WORKING )
3422GAME( 199?,  prizeinv,  0,        bwbvid, mpu4,     0,        ROT0, "BwB",         "Prize Space Invaders (20\" v1.1)",                           GAME_NOT_WORKING )
3423GAME( 199?,  blox,      0,        bwbvid, mpu4,     0,        ROT0, "BwB",         "Blox (v2.0)",                                          GAME_NOT_WORKING )
3424GAME( 199?,  bloxd,     blox,     bwbvid, mpu4,     0,        ROT0, "BwB",         "Blox (v2.0, Datapak)",                                    GAME_NOT_WORKING )
3425GAME( 1996,  renoreel,  0,        bwbvid5,  mpu4,     0,      ROT0, "BwB",         "Reno Reels (20p/10GBP Cash, release A)",                              GAME_NOT_WORKING )
3426GAME( 199?,  redhtpkr,  0,        bwbvid,   mpu4,     0,       ROT0, "BwB",         "Red Hot Poker (20p/10GBP Cash, release 3)",                           GAME_NOT_WORKING )
3427GAME( 199?,  bwbtetrs,  0,        bwbvid,   mpu4,     0,       ROT0, "BwB",         "BwB Tetris v 2.2",                           GAME_NOT_WORKING )
src/mame/drivers/midvunit.c
r10315r10316
161161      if (which < 0 || which > 2)
162162         logerror("adc_w: unexpected which = %02X\n", which + 4);
163163      adc_data = input_port_read_safe(space->machine, adcnames[which], 0);
164      timer_set(space->machine, attotime::from_msec(1), NULL, 0, adc_ready);
164      space->machine->scheduler().timer_set(attotime::from_msec(1), FUNC(adc_ready));
165165   }
166166   else
167167      logerror("adc_w without enabling writes!\n");
src/mame/drivers/firebeat.c
r10315r10316
22152215static void init_keyboard(running_machine *machine)
22162216{
22172217   // set keyboard timer
2218   keyboard_timer = timer_alloc(machine, keyboard_timer_callback, NULL);
2218   keyboard_timer = machine->scheduler().timer_alloc(FUNC(keyboard_timer_callback));
22192219   timer_adjust_periodic(keyboard_timer, attotime::from_msec(10), 0, attotime::from_msec(10));
22202220}
22212221
src/mame/drivers/clayshoo.c
r10315r10316
132132static void create_analog_timers( running_machine *machine )
133133{
134134   clayshoo_state *state = machine->driver_data<clayshoo_state>();
135   state->analog_timer_1 = timer_alloc(machine, reset_analog_bit, NULL);
136   state->analog_timer_2 = timer_alloc(machine, reset_analog_bit, NULL);
135   state->analog_timer_1 = machine->scheduler().timer_alloc(FUNC(reset_analog_bit));
136   state->analog_timer_2 = machine->scheduler().timer_alloc(FUNC(reset_analog_bit));
137137}
138138
139139
src/mame/drivers/bigevglf.c
r10315r10316
8383}
8484static WRITE8_HANDLER( beg_fromsound_w )   /* write to D800 sets bit 1 in status */
8585{
86   timer_call_after_resynch(space->machine, NULL, (cpu_get_pc(space->cpu) << 16) | data, from_sound_latch_callback);
86   space->machine->scheduler().synchronize(FUNC(from_sound_latch_callback), (cpu_get_pc(space->cpu) << 16) | data);
8787}
8888
8989static READ8_HANDLER( beg_fromsound_r )
9090{
9191   bigevglf_state *state = space->machine->driver_data<bigevglf_state>();
9292   /* set a timer to force synchronization after the read */
93   timer_call_after_resynch(space->machine, NULL, 0, NULL);
93   space->machine->scheduler().synchronize();
9494   return state->from_sound;
9595}
9696
r10315r10316
9999   bigevglf_state *state = space->machine->driver_data<bigevglf_state>();
100100   UINT8 ret = state->sound_state;
101101   /* set a timer to force synchronization after the read */
102   timer_call_after_resynch(space->machine, NULL, 0, NULL);
102   space->machine->scheduler().synchronize();
103103   state->sound_state &= ~2; /* read from port 21 clears bit 1 in status */
104104   return ret;
105105}
r10315r10316
108108{
109109   bigevglf_state *state = space->machine->driver_data<bigevglf_state>();
110110   /* set a timer to force synchronization after the read */
111   timer_call_after_resynch(space->machine, NULL, 0, NULL);
111   space->machine->scheduler().synchronize();
112112   return state->sound_state;
113113}
114114
r10315r10316
127127{
128128   bigevglf_state *state = space->machine->driver_data<bigevglf_state>();
129129   state->for_sound = data;
130   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
130   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
131131}
132132
133133static READ8_HANDLER( sound_command_r )   /* read from D800 sets bit 0 in status */
r10315r10316
165165/* do this on a timer to let the CPUs synchronize */
166166static WRITE8_HANDLER( beg13_a_clr_w )
167167{
168   timer_call_after_resynch(space->machine, NULL, (0 << 8) | 0, deferred_ls74_w);
168   space->machine->scheduler().synchronize(FUNC(deferred_ls74_w), (0 << 8) | 0);
169169}
170170
171171static WRITE8_HANDLER( beg13_b_clr_w )
172172{
173   timer_call_after_resynch(space->machine, NULL, (1 << 8) | 0, deferred_ls74_w);
173   space->machine->scheduler().synchronize(FUNC(deferred_ls74_w), (1 << 8) | 0);
174174}
175175
176176static WRITE8_HANDLER( beg13_a_set_w )
177177{
178   timer_call_after_resynch(space->machine, NULL, (0 << 8) | 1, deferred_ls74_w);
178   space->machine->scheduler().synchronize(FUNC(deferred_ls74_w), (0 << 8) | 1);
179179}
180180
181181static WRITE8_HANDLER( beg13_b_set_w )
182182{
183   timer_call_after_resynch(space->machine, NULL, (1 << 8) | 1, deferred_ls74_w);
183   space->machine->scheduler().synchronize(FUNC(deferred_ls74_w), (1 << 8) | 1);
184184}
185185
186186static READ8_HANDLER( beg_status_r )
r10315r10316
197197
198198*/
199199   /* set a timer to force synchronization after the read */
200   timer_call_after_resynch(space->machine, NULL, 0, NULL);
200   space->machine->scheduler().synchronize();
201201   return (state->beg13_ls74[0] << 0) | (state->beg13_ls74[1] << 1);
202202}
203203
src/mame/drivers/turbo.c
r10315r10316
727727{
728728   /* the port C handshaking signals control the sub CPU IRQ, */
729729   /* so we have to sync whenever we access this PPI */
730   timer_call_after_resynch(device->machine, NULL, ((offset & 3) << 8) | (data & 0xff), delayed_ppi8255_w);
730   device->machine->scheduler().synchronize(FUNC(delayed_ppi8255_w), ((offset & 3) << 8) | (data & 0xff));
731731}
732732
733733
src/mame/drivers/cvs.c
r10315r10316
321321static void start_393hz_timer(running_machine *machine)
322322{
323323   cvs_state *state = machine->driver_data<cvs_state>();
324   state->cvs_393hz_timer = timer_alloc(machine, cvs_393hz_timer_cb, NULL);
324   state->cvs_393hz_timer = machine->scheduler().timer_alloc(FUNC(cvs_393hz_timer_cb));
325325   timer_adjust_periodic(state->cvs_393hz_timer, attotime::from_hz(30*393), 0, attotime::from_hz(30*393));
326326}
327327
src/mame/drivers/trvquest.c
r10315r10316
160160   /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is
161161       cleared by the irq handler. Therefore, I wait a bit before triggering the irq to
162162       leave time for the program to see the flag change. */
163   timer_set(device->machine, attotime::from_usec(50), NULL, state, via_irq_delayed);
163   device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(via_irq_delayed), state);
164164}
165165
166166
src/mame/drivers/magmax.c
r10315r10316
8383static MACHINE_START( magmax )
8484{
8585   /* Create interrupt timer */
86   interrupt_timer = timer_alloc(machine, scanline_callback, NULL);
86   interrupt_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
8787
8888   /* Set up save state */
8989   state_save_register_global(machine, sound_latch);
src/mame/drivers/alg.c
r10315r10316
9898   alg_state *state = machine->driver_data<alg_state>();
9999   state->laserdisc = machine->device("laserdisc");
100100
101   state->serial_timer = timer_alloc(machine, response_timer, NULL);
101   state->serial_timer = machine->scheduler().timer_alloc(FUNC(response_timer));
102102   state->serial_timer_active = FALSE;
103103}
104104
src/mame/drivers/bombjack.c
r10315r10316
110110static WRITE8_HANDLER( bombjack_soundlatch_w )
111111{
112112   /* make all the CPUs synchronize, and only AFTER that write the new command to the latch */
113   timer_call_after_resynch(space->machine, NULL, data, soundlatch_callback);
113   space->machine->scheduler().synchronize(FUNC(soundlatch_callback), data);
114114}
115115
116116static READ8_HANDLER( bombjack_soundlatch_r )
src/mame/drivers/trucocl.c
r10315r10316
7676
7777   dac_data_w( device, rom[dac_address+cur_dac_address_index] );
7878
79   timer_set( device->machine, attotime::from_hz( 16000 ), NULL, 0, dac_irq );
79   device->machine->scheduler().timer_set( attotime::from_hz( 16000 ), FUNC(dac_irq ));
8080}
8181
8282static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/gcpinbal.c
r10315r10316
6464{
6565   /* Unsure of actual sequence */
6666
67   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(500), NULL, 0, gcpinbal_interrupt1);
68//  timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(1000), NULL, 0, gcpinbal_interrupt3);
67   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(500), FUNC(gcpinbal_interrupt1));
68//  device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(1000), FUNC(gcpinbal_interrupt3));
6969   cpu_set_input_line(device, 4, HOLD_LINE);
7070}
7171
src/mame/drivers/40love.c
r10315r10316
237237static WRITE8_HANDLER( sound_command_w )
238238{
239239   soundlatch_w(space, 0, data);
240   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
240   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
241241}
242242
243243static WRITE8_HANDLER( nmi_disable_w )
src/mame/drivers/galaga.c
r10315r10316
880880static MACHINE_START( galaga )
881881{
882882   /* create the interrupt timer */
883   cpu3_interrupt_timer = timer_alloc(machine, cpu3_interrupt_callback, NULL);
883   cpu3_interrupt_timer = machine->scheduler().timer_alloc(FUNC(cpu3_interrupt_callback));
884884   custom_mod = 0;
885885   state_save_register_global(machine, custom_mod);
886886}
src/mame/drivers/panicr.c
r10315r10316
216216static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect )
217217{
218218   UINT8 *spriteram = machine->generic.spriteram.u8;
219   int offs,fx,fy,x,y,color,sprite;
219   int offs,flipx,flipy,x,y,color,sprite;
220220
221221   for (offs = 0; offs<0x1000; offs+=16)
222222   {
223
224      fx = 0;
225      fy = spriteram[offs+1] & 0x80;
223      flipx = 0;
224      flipy = spriteram[offs+1] & 0x80;
226225      y = spriteram[offs+2];
227226      x = spriteram[offs+3];
227      if (spriteram[offs+1] & 0x40) x -= 0x100;
228228
229229      color = spriteram[offs+1] & 0x0f;
230
231230      sprite = spriteram[offs+0]+(scrollram[0x0c]<<8);
232231
233232      drawgfx_transmask(bitmap,cliprect,machine->gfx[2],
234233            sprite,
235            color,fx,fy,x,y,
234            color,flipx,flipy,x,y,
236235            colortable_get_transpen_mask(machine->colortable, machine->gfx[2], color, 0));
237236   }
238237}
src/mame/drivers/othunder.c
r10315r10316
385385       The ADC60808 clock is 512kHz. Conversion takes between 0 and 8 clock
386386       cycles, so would end in a maximum of 15.625us. We'll use 10. */
387387
388   timer_set(space->machine, attotime::from_usec(10), NULL,0, ad_interrupt);
388   space->machine->scheduler().timer_set(attotime::from_usec(10), FUNC(ad_interrupt));
389389}
390390
391391
src/mame/drivers/ladyfrog.c
r10315r10316
8787static WRITE8_HANDLER( sound_command_w )
8888{
8989   soundlatch_w(space, 0, data);
90   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
90   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
9191}
9292
9393static WRITE8_HANDLER( nmi_disable_w )
src/mame/drivers/bfmsys85.c
r10315r10316
220220{
221221   int i;
222222   int  changed = mmtr_latch ^ data;
223   UINT64 cycles  = downcast<cpu_device *>(space->cpu)->total_cycles();
224223
225224   mmtr_latch = data;
226225
227226   for (i=0; i<8; i++)
228   if ( changed & (1 << i) )   Mechmtr_update(i, cycles, data & (1 << i) );
227   if ( changed & (1 << i) )   MechMtr_update(i, data & (1 << i) );
229228
230229   if ( data ) generic_pulse_irq_line(space->machine->device("maincpu"), M6809_FIRQ_LINE);
231230}
src/mame/drivers/esripsys.c
r10315r10316
207207
208208static WRITE8_HANDLER( frame_w )
209209{
210   timer_call_after_resynch(space->machine, NULL, 0, delayed_bank_swap);
210   space->machine->scheduler().synchronize(FUNC(delayed_bank_swap));
211211   esripsys_frame_vbl = 1;
212212}
213213
src/mame/drivers/thayers.c
r10315r10316
6464
6565   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_IRQ0, HOLD_LINE);
6666
67   timer_set(space->machine, attotime::from_usec(8250), NULL, 0, intrq_tick);
67   space->machine->scheduler().timer_set(attotime::from_usec(8250), FUNC(intrq_tick));
6868}
6969
7070static READ8_HANDLER( irqstate_r )
r10315r10316
459459      case 0:
460460      case 1:
461461         // phoneme timing response
462         timer_set(space->machine, attotime::from_usec(phoneme_time), NULL, 0, ssi263_phoneme_tick);
462         space->machine->scheduler().timer_set(attotime::from_usec(phoneme_time), FUNC(ssi263_phoneme_tick));
463463         break;
464464      case 2:
465465         // frame timing response
466         timer_set(space->machine, attotime::from_usec(frame_time), NULL, 0, ssi263_phoneme_tick);
466         space->machine->scheduler().timer_set(attotime::from_usec(frame_time), FUNC(ssi263_phoneme_tick));
467467         break;
468468      case 3:
469469         // disable A/_R output
src/mame/drivers/zr107.c
r10315r10316
677677   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
678678
679679   cputag_set_input_line(machine, "audiocpu", line, ASSERT_LINE);
680   timer_set(machine, attotime::from_usec(1), NULL, line, irq_off);
680   machine->scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off), line);
681681}
682682
683683static const k056800_interface zr107_k056800_interface =
src/mame/drivers/ksys573.c
r10315r10316
10511051   state->atapi_data_len = 0;
10521052   state->atapi_cdata_wait = 0;
10531053
1054   state->atapi_timer = timer_alloc(machine, atapi_xfer_end, NULL);
1054   state->atapi_timer = machine->scheduler().timer_alloc(FUNC(atapi_xfer_end));
10551055   timer_adjust_oneshot(state->atapi_timer, attotime::never, 0);
10561056
10571057   for( i = 0; i < 2; i++ )
r10315r10316
15891589
15901590   for (i = 0; i < 3; i++)
15911591   {
1592      state->m_p_timer_root[i] = timer_alloc(machine, root_finished, NULL);
1592      state->m_p_timer_root[i] = machine->scheduler().timer_alloc(FUNC(root_finished));
15931593   }
15941594
15951595   state_save_register_global( machine, state->m_n_security_control );
src/mame/drivers/sbrkout.c
r10315r10316
8888   sbrkout_state *state = machine->driver_data<sbrkout_state>();
8989   UINT8 *videoram = state->videoram;
9090   memory_set_bankptr(machine, "bank1", &videoram[0x380]);
91   state->scanline_timer = timer_alloc(machine, scanline_callback, NULL);
92   state->pot_timer = timer_alloc(machine, pot_trigger_callback, NULL);
91   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
92   state->pot_timer = machine->scheduler().timer_alloc(FUNC(pot_trigger_callback));
9393
9494   state_save_register_global(machine, state->sync2_value);
9595   state_save_register_global_array(machine, state->pot_mask);
src/mame/drivers/wink.c
r10315r10316
9898{
9999   cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
100100   //sync with sound cpu (but it still loses some soundlatches...)
101   //timer_call_after_resynch(space->machine, NULL, 0, NULL);
101   //space->machine->scheduler().synchronize();
102102}
103103
104104static ADDRESS_MAP_START( wink_map, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/2mindril.c
r10315r10316
213213   /*---- ---- ---- -x-- lamp*/
214214   if (data & 1)
215215   {
216      //timer_set(space->machine,  attotime::from_seconds(2), NULL, 0x100, shutter_req );
216      //space->machine->scheduler().timer_set(attotime::from_seconds(2), FUNC(shutter_req ), 0x100);
217217      state->shutter_sensor = 0x100;
218218   }
219219   else if (data & 2)
220220   {
221      //timer_set( space->machine, attotime::from_seconds(2), NULL, 0x200, shutter_req );
221      //space->machine->scheduler().timer_set( attotime::from_seconds(2), FUNC(shutter_req ), 0x200);
222222      state->shutter_sensor = 0x200;
223223   }
224224
225225   if (data & 0x1000 || data & 0x4000)
226226   {
227      //timer_set( space->machine, attotime::from_seconds(2), NULL, 0x800, defender_req );
227      //space->machine->scheduler().timer_set( attotime::from_seconds(2), FUNC(defender_req ), 0x800);
228228      state->defender_sensor = 0x800;
229229   }
230230   else if (data & 0x2000 || data & 0x8000)
231231   {
232      //timer_set( space->machine, attotime::from_seconds(2), NULL, 0x400, defender_req );
232      //space->machine->scheduler().timer_set( attotime::from_seconds(2), FUNC(defender_req ), 0x400);
233233      state->defender_sensor = 0x400;
234234   }
235235}
src/mame/drivers/taitogn.c
r10315r10316
884884   znsec_init(0, tt10);
885885   znsec_init(1, tt16);
886886   psx_sio_install_handler(machine, 0, sio_pad_handler);
887   state->dip_timer = timer_alloc( machine, dip_timer_fired, NULL );
887   state->dip_timer = machine->scheduler().timer_alloc( FUNC(dip_timer_fired), NULL );
888888
889889   memset(state->cis, 0xff, 512);
890890   if (get_disk_handle(machine, "card") != NULL)
src/mame/drivers/gunbustr.c
r10315r10316
6363
6464static INTERRUPT_GEN( gunbustr_interrupt )
6565{
66   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000-500), NULL, 0, gunbustr_interrupt5);
66   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000-500), FUNC(gunbustr_interrupt5));
6767   cpu_set_input_line(device, 4, HOLD_LINE);
6868}
6969
r10315r10316
184184static WRITE32_HANDLER( gunbustr_gun_w )
185185{
186186   /* 10000 cycle delay is arbitrary */
187   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), NULL, 0, gunbustr_interrupt5);
187   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), FUNC(gunbustr_interrupt5));
188188}
189189
190190
src/mame/drivers/taito_z.c
r10315r10316
965965   state->sci_int6 = !state->sci_int6;
966966
967967   if (state->sci_int6)
968      timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), NULL, 0, taitoz_interrupt6);
968      device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), FUNC(taitoz_interrupt6));
969969
970970   cpu_set_input_line(device, 4, HOLD_LINE);
971971}
r10315r10316
983983   state->dblaxle_int6 = !state->dblaxle_int6;
984984
985985   if (state->dblaxle_int6)
986      timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), NULL, 0, taitoz_interrupt6);
986      device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), FUNC(taitoz_interrupt6));
987987
988988   cpu_set_input_line(device, 4, HOLD_LINE);
989989}
r10315r10316
991991static INTERRUPT_GEN( dblaxle_cpub_interrupt )
992992{
993993   // Unsure how many int6's per frame
994   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), NULL,  0, taitoz_interrupt6);
994   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000 - 500), FUNC(taitoz_interrupt6));
995995   cpu_set_input_line(device, 4, HOLD_LINE);
996996}
997997
r10315r10316
12081208       but we don't want CPUA to have an int6 before int4 is over (?)
12091209    */
12101210
1211   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), NULL, 0, taitoz_interrupt6);
1211   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), FUNC(taitoz_interrupt6));
12121212}
12131213
12141214
r10315r10316
12931293       Four lightgun interrupts happen before the collected coords
12941294       are moved to shared ram where CPUA can use them. */
12951295
1296   timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), NULL, 0, taitoz_cpub_interrupt5);
1296   space->machine->scheduler().timer_set(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(10000), FUNC(taitoz_cpub_interrupt5));
12971297}
12981298
12991299static WRITE16_HANDLER( spacegun_gun_output_w )
src/mame/drivers/msisaac.c
r10315r10316
3434static WRITE8_HANDLER( sound_command_w )
3535{
3636   soundlatch_w(space, 0, data);
37   timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
37   space->machine->scheduler().synchronize(FUNC(nmi_callback), data);
3838}
3939
4040static WRITE8_HANDLER( nmi_disable_w )
src/mame/drivers/cojag.c
r10315r10316
595595   cojag_state *state = machine->driver_data<cojag_state>();
596596   /* if a command is still pending, and we haven't maxed out our timer, set a new one */
597597   if (state->gpu_command_pending && param < 1000)
598      timer_set(machine, attotime::from_usec(50), NULL, ++param, gpu_sync_timer);
598      machine->scheduler().timer_set(attotime::from_usec(50), FUNC(gpu_sync_timer), ++param);
599599}
600600
601601
r10315r10316
610610   jaguar_gpu_resume(space->machine);
611611
612612   /* start the sync timer going, and note that there is a command pending */
613   timer_call_after_resynch(space->machine, NULL, 0, gpu_sync_timer);
613   space->machine->scheduler().synchronize(FUNC(gpu_sync_timer));
614614   state->gpu_command_pending = 1;
615615}
616616
src/mame/drivers/mappy.c
r10315r10316
772772                  // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
773773
774774   if (!namcoio_read_reset_line(namcoio_1))      /* give the cpu a tiny bit of time to write the command before processing it */
775      timer_set(device->machine, attotime::from_usec(50), NULL, 0, superpac_io_run);
775      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(superpac_io_run));
776776
777777   if (!namcoio_read_reset_line(namcoio_2))      /* give the cpu a tiny bit of time to write the command before processing it */
778      timer_set(device->machine, attotime::from_usec(50), NULL, 1, superpac_io_run);
778      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(superpac_io_run), 1);
779779}
780780
781781static TIMER_CALLBACK( pacnpal_io_run )
r10315r10316
803803                  // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
804804
805805   if (!namcoio_read_reset_line(namcoio_1))      /* give the cpu a tiny bit of time to write the command before processing it */
806      timer_set(device->machine, attotime::from_usec(50), NULL, 0, pacnpal_io_run);
806      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(pacnpal_io_run));
807807
808808   if (!namcoio_read_reset_line(namcoio_2))      /* give the cpu a tiny bit of time to write the command before processing it */
809      timer_set(device->machine, attotime::from_usec(50), NULL, 1, pacnpal_io_run);
809      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(pacnpal_io_run), 1);
810810}
811811
812812static TIMER_CALLBACK( phozon_io_run )
r10315r10316
834834                  // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
835835
836836   if (!namcoio_read_reset_line(namcoio_1))      /* give the cpu a tiny bit of time to write the command before processing it */
837      timer_set(device->machine, attotime::from_usec(50), NULL, 0, phozon_io_run);
837      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(phozon_io_run));
838838
839839   if (!namcoio_read_reset_line(namcoio_2))      /* give the cpu a tiny bit of time to write the command before processing it */
840      timer_set(device->machine, attotime::from_usec(50), NULL, 1, phozon_io_run);
840      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(phozon_io_run), 1);
841841}
842842
843843static TIMER_CALLBACK( mappy_io_run )
r10315r10316
865865                  // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
866866
867867   if (!namcoio_read_reset_line(namcoio_1))      /* give the cpu a tiny bit of time to write the command before processing it */
868      timer_set(device->machine, attotime::from_usec(50), NULL, 0, mappy_io_run);
868      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(mappy_io_run));
869869
870870   if (!namcoio_read_reset_line(namcoio_2))      /* give the cpu a tiny bit of time to write the command before processing it */
871      timer_set(device->machine, attotime::from_usec(50), NULL, 1, mappy_io_run);
871      device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(mappy_io_run), 1);
872872}
873873
874874
src/mame/drivers/aristmk5.c
r10315r10316
231231   // reset the DAC to centerline
232232   //dac_signed_data_w(machine->device("dac"), 0x80);
233233
234   mk5_2KHz_timer = timer_alloc(machine, mk5_2KHz_callback, 0);
234   mk5_2KHz_timer = machine->scheduler().timer_alloc(FUNC(mk5_2KHz_callback));
235235}
236236
237237static MACHINE_RESET( aristmk5 )
src/mame/drivers/equites.c
r10315r10316
414414static SOUND_START(equites)
415415{
416416   equites_state *state = machine->driver_data<equites_state>();
417   state->nmi_timer = timer_alloc(machine, equites_nmi_callback, NULL);
417   state->nmi_timer = machine->scheduler().timer_alloc(FUNC(equites_nmi_callback));
418418
419   state->adjuster_timer = timer_alloc(machine, equites_frq_adjuster_callback, NULL);
419   state->adjuster_timer = machine->scheduler().timer_alloc(FUNC(equites_frq_adjuster_callback));
420420   timer_adjust_periodic(state->adjuster_timer, attotime::from_hz(60), 0, attotime::from_hz(60));
421421}
422422
src/mame/drivers/ssfindo.c
r10315r10316
692692static DRIVER_INIT(ssfindo)
693693{
694694   flashType=0;
695   PS7500timer0 = timer_alloc(machine, PS7500_Timer0_callback, NULL);
696   PS7500timer1 = timer_alloc(machine, PS7500_Timer1_callback, NULL);
695   PS7500timer0 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer0_callback));
696   PS7500timer1 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer1_callback));
697697}
698698
699699static DRIVER_INIT(ppcar)
700700{
701701   flashType=1;
702   PS7500timer0 = timer_alloc(machine, PS7500_Timer0_callback, NULL);
703   PS7500timer1 = timer_alloc(machine, PS7500_Timer1_callback, NULL);
702   PS7500timer0 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer0_callback));
703   PS7500timer1 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer1_callback));
704704}
705705
706706GAME( 1999, ssfindo, 0,        ssfindo,  ssfindo,  ssfindo,   ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND )
src/mame/drivers/firetrk.c
r10315r10316
7272   if (scanline > 262)
7373      scanline = 0;
7474
75   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, periodic_callback);
75   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(periodic_callback), scanline);
7676}
7777
7878
r10315r10316
172172{
173173   set_service_mode(machine, 0);
174174
175   timer_call_after_resynch(machine, NULL, 0, periodic_callback);
175   machine->scheduler().synchronize(FUNC(periodic_callback));
176176}
177177
178178
src/mame/drivers/peplus.c
r10315r10316
334334    xt = x_val * (vis_area.max_x - vis_area.min_x) / 1024 + vis_area.min_x;
335335    yt = y_val * (vis_area.max_y - vis_area.min_y) / 1024 + vis_area.min_y;
336336
337     timer_set(device->machine, device->machine->primary_screen->time_until_pos(yt, xt), (void *) device, 0, assert_lp_cb);
337     device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(yt, xt), FUNC(assert_lp_cb), 0, device);
338338}
339339
340340static WRITE_LINE_DEVICE_HANDLER(crtc_vsync)
src/mame/drivers/konamigx.c
r10315r10316
37563756   snd020_hack = 0;
37573757   resume_trigger = 0;
37583758
3759   dmadelay_timer = timer_alloc(machine, dmaend_callback, NULL);
3759   dmadelay_timer = machine->scheduler().timer_alloc(FUNC(dmaend_callback));
37603760
37613761   i = match = 0;
37623762   while ((gameDefs[i].cfgport != -1) && (!match))
src/mame/drivers/parodius.c
r10315r10316
139139   parodius_state *state = space->machine->driver_data<parodius_state>();
140140
141141   cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
142   timer_set(space->machine, attotime::from_usec(50), NULL, 0, nmi_callback);   /* kludge until the K053260 is emulated correctly */
142   space->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(nmi_callback));   /* kludge until the K053260 is emulated correctly */
143143}
144144
145145/********************************************/
src/mame/drivers/combatsc.c
r10315r10316
689689   state->page[0] = MEM + 0x4000;
690690   state->page[1] = MEM + 0x6000;
691691
692   state->interleave_timer = timer_alloc(machine, NULL, NULL);
692   state->interleave_timer = machine->scheduler().timer_alloc(FUNC(NULL));
693693
694694   state->audiocpu = machine->device<cpu_device>("audiocpu");
695695   state->k007121_1 = machine->device("k007121_1");
src/mame/drivers/gpworld.c
r10315r10316
422422
423423   /* The time the IRQ line stays high is set just long enough to happen after the NMI - hacky? */
424424   cpu_set_input_line(device, 0, ASSERT_LINE);
425   timer_set(device->machine, attotime::from_usec(100), NULL, 0, irq_stop);
425   device->machine->scheduler().timer_set(attotime::from_usec(100), FUNC(irq_stop));
426426}
427427
428428static const gfx_layout gpworld_tile_layout =
src/mame/drivers/tubep.c
r10315r10316
349349static MACHINE_START( tubep )
350350{
351351   /* Create interrupt timer */
352   interrupt_timer = timer_alloc(machine, tubep_scanline_callback, NULL);
352   interrupt_timer = machine->scheduler().timer_alloc(FUNC(tubep_scanline_callback));
353353
354354   tubep_setup_save_state(machine);
355355}
r10315r10316
512512static MACHINE_START( rjammer )
513513{
514514   /* Create interrupt timer */
515   interrupt_timer = timer_alloc(machine, rjammer_scanline_callback, NULL);
515   interrupt_timer = machine->scheduler().timer_alloc(FUNC(rjammer_scanline_callback));
516516
517517   tubep_setup_save_state(machine);
518518}
src/mame/drivers/mw18w.c
r0r10316
1/* Midway's 18 Wheeler hardware, game number 653
2
3driver todo:
4- discrete sound
5- hook up lamps (and sensors)
6- lots of external artwork
7
8To diagnose game, turn on service mode and:
9- test RAM/ROM, leds, lamps:   reset with shifter in neutral
10- test sound and misc input:   turn on DSW 7 and reset with shifter in neutral
11- test accelerator:            reset with shifter in 1st gear
12- test steering wheel:         reset with shifter in 2nd gear
13
14*/
15
16#include "emu.h"
17#include "cpu/z80/z80.h"
18
19#include "18w.lh"
20
21
22static WRITE8_HANDLER( mw18w_sound0_w )
23{
24   // sound write (airhorn, brake, crash) plus motor speed for backdrop, and coin counter
25   coin_counter_w(space->machine, 0, data&1);
26}
27
28static WRITE8_HANDLER( mw18w_sound1_w )
29{
30   // sound write (bell, engine) plus lamp dim control for backdrop lamp
31   ;
32}
33
34static WRITE8_HANDLER( mw18w_lamps_w )
35{
36   ;
37}
38
39static WRITE8_HANDLER( mw18w_led_display_w )
40{
41   // d0-3: 7448 (BCD to LED segment)
42   const UINT8 ls48_map[16] =
43      { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 };
44
45   // d4-7: 7442 (BCD to decimal) -> pick digit panel
46   if ((data&0xf0)>0x90) return;
47   output_set_digit_value(data>>4, ls48_map[data&0xf]);
48}
49
50static WRITE8_HANDLER( mw18w_irq0_clear_w )
51{
52   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
53}
54
55static CUSTOM_INPUT( mw18w_sensors_r )
56{
57   // d7: off road
58   // d6: in dock area
59   return 0xff;
60}
61
62
63
64
65static ADDRESS_MAP_START( mw18w_map, ADDRESS_SPACE_PROGRAM, 8 )
66   AM_RANGE(0x0000, 0x1fff) AM_ROM
67   AM_RANGE(0x2000, 0x23ff) AM_RAM
68ADDRESS_MAP_END
69
70static ADDRESS_MAP_START( mw18w_portmap, ADDRESS_SPACE_IO, 8 )
71   ADDRESS_MAP_UNMAP_HIGH
72   ADDRESS_MAP_GLOBAL_MASK(0xff)
73   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(mw18w_sound0_w)
74   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") AM_WRITE(mw18w_sound1_w)
75   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_WRITE(mw18w_lamps_w)
76   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW") AM_WRITE(mw18w_led_display_w)
77   AM_RANGE(0x04, 0x04) AM_READ_PORT("IN4")
78   AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
79   AM_RANGE(0x07, 0x07) AM_WRITE(mw18w_irq0_clear_w)
80ADDRESS_MAP_END
81
82static const UINT32 mw18w_controller_table[] =
83{
84   // same encoder as sspeedr
85   0x3f, 0x3e, 0x3c, 0x3d, 0x39, 0x38, 0x3a, 0x3b,
86   0x33, 0x32, 0x30, 0x31, 0x35, 0x34, 0x36, 0x37,
87   0x27, 0x26, 0x24, 0x25, 0x21, 0x20, 0x22, 0x23,
88   0x2b, 0x2a, 0x28, 0x29, 0x2d, 0x2c, 0x2e, 0x2f,
89   0x0f, 0x0e, 0x0c, 0x0d, 0x09, 0x08, 0x0a, 0x0b,
90   0x03, 0x02, 0x00, 0x01, 0x05, 0x04, 0x06, 0x07,
91   0x17, 0x16, 0x14, 0x15, 0x11, 0x10, 0x12, 0x13,
92   0x1b, 0x1a, 0x18, 0x19, 0x1d, 0x1c, 0x1e, 0x1f
93};
94
95static INPUT_PORTS_START( mw18w )
96   PORT_START("IN0")
97   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
98   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
99   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
100   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )   // left/right sw.
101   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
102   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
103   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mw18w_sensors_r, NULL)
104
105   PORT_START("IN1")
106   PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_REMAP_TABLE(mw18w_controller_table + 0x20) PORT_SENSITIVITY(100) PORT_KEYDELTA(1)   // accelerate
107   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Shifter 1st Gear")
108   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Shifter 3rd Gear")
109   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Shifter 2nd Gear")
110
111   PORT_START("IN2")
112   PORT_BIT( 0x3f, 0x1f, IPT_PADDLE ) PORT_REMAP_TABLE(mw18w_controller_table) PORT_SENSITIVITY(100) PORT_KEYDELTA(1)         // steering wheel
113   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )   // brake
114   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Shifter Reverse")
115
116   PORT_START("DSW")
117   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW:1,2")
118   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
119   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
120   PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
121   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
122   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW:5,6")
123   PORT_DIPSETTING(    0x00, "60 seconds" )
124   PORT_DIPSETTING(    0x10, "70 seconds" )
125   PORT_DIPSETTING(    0x20, "80 seconds" )
126   PORT_DIPSETTING(    0x30, "90 seconds" )
127
128   PORT_DIPNAME( 0x0c, 0x00, "Extended Time" ) PORT_DIPLOCATION("SW:3,4")
129   PORT_DIPSETTING(    0x00, "20 seconds at 4000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x00) // @ 60 seconds
130   PORT_DIPSETTING(    0x04, "30 seconds at 8000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x00)
131   PORT_DIPSETTING(    0x08, "15 seconds at 8000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x00)
132   PORT_DIPSETTING(    0x0c, "30 seconds at 10000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x00)
133   PORT_DIPSETTING(    0x00, "20 seconds at 6000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x10) // @ 70 seconds
134   PORT_DIPSETTING(    0x04, "30 seconds at 9000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x10)
135   PORT_DIPSETTING(    0x08, "20 seconds at 9000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x10)
136   PORT_DIPSETTING(    0x0c, "30 seconds at 12000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x10)
137   PORT_DIPSETTING(    0x00, "20 seconds at 8000" )  PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x20) // @ 80 seconds
138   PORT_DIPSETTING(    0x04, "30 seconds at 12000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x20)
139   PORT_DIPSETTING(    0x08, "20 seconds at 12000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x20)
140   PORT_DIPSETTING(    0x0c, "30 seconds at 16000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x20)
141   PORT_DIPSETTING(    0x00, "20 seconds at 10000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x30) // @ 90 seconds
142   PORT_DIPSETTING(    0x04, "30 seconds at 15000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x30)
143   PORT_DIPSETTING(    0x08, "20 seconds at 15000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x30)
144   PORT_DIPSETTING(    0x0c, "30 seconds at 20000" ) PORT_CONDITION("DSW", 0x30, PORTCOND_EQUALS, 0x30)
145
146   PORT_DIPNAME( 0x40, 0x40, "I/O Test" ) PORT_DIPLOCATION("SW:7")
147   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
148   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
149   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW:8" )
150
151   PORT_START("IN4")
152   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )      // n/c
153   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )      // n/c
154   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
155   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )      // for both coin chutes
156   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
157INPUT_PORTS_END
158
159
160
161
162static MACHINE_CONFIG_START( mw18w, driver_device )
163   /* basic machine hardware */
164   MCFG_CPU_ADD("maincpu", Z80, XTAL_19_968MHz/8)
165   MCFG_CPU_PERIODIC_INT(irq0_line_assert,960.516)   // 555 IC
166   MCFG_CPU_PROGRAM_MAP(mw18w_map)
167   MCFG_CPU_IO_MAP(mw18w_portmap)
168
169   /* no video! */
170
171   /* sound hardware */
172   // MCFG_SPEAKER_STANDARD_MONO("mono")
173MACHINE_CONFIG_END
174
175
176ROM_START(18w)
177   ROM_REGION(0x10000, "maincpu", 0)
178   ROM_LOAD( "18w_b1.rom1", 0x0000, 0x0800, CRC(200c5beb) SHA1(994d67a89f18df9716c5dd4dd60f6e7eeb880f1b))
179   ROM_LOAD( "18w_a2.rom2", 0x0800, 0x0800, CRC(efbadee8) SHA1(834eaf8ca50544123de7529b90b828cf46b1c001))
180   ROM_LOAD( "18w_b3.rom3", 0x1000, 0x0800, CRC(214606f6) SHA1(9a9dc20259b4462661c6be410d98d2be54657a0e))
181   ROM_LOAD( "18w_a4.rom4", 0x1800, 0x0800, CRC(e88ad6a9) SHA1(ac010aa7e0288197ff9342801522623b64dd2a47))
182ROM_END
183
184ROM_START(18w2)
185   ROM_REGION(0x10000, "maincpu", 0)
186   ROM_LOAD( "18w_b1.rom1", 0x0000, 0x0800, CRC(cbc0fb2c) SHA1(66b14f0d76baebbd64e8ed107e536ad811d55273))
187   ROM_LOAD( "18w_b2.rom2", 0x0800, 0x0800, CRC(efbadee8) SHA1(834eaf8ca50544123de7529b90b828cf46b1c001))
188   ROM_LOAD( "18w_b3.rom3", 0x1000, 0x0800, CRC(214606f6) SHA1(9a9dc20259b4462661c6be410d98d2be54657a0e))
189   ROM_LOAD( "18w_b4.rom4", 0x1800, 0x0800, CRC(e88ad6a9) SHA1(ac010aa7e0288197ff9342801522623b64dd2a47))
190ROM_END
191
192
193GAMEL( 1979, 18w,  0,   mw18w, mw18w, 0, ROT0, "Midway", "18 Wheeler (set 1)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_MECHANICAL, layout_18w )
194GAMEL( 1979, 18w2, 18w, mw18w, mw18w, 0, ROT0, "Midway", "18 Wheeler (set 2)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_MECHANICAL, layout_18w )
src/mame/drivers/hng64.c
r10315r10316
16611661   }
16621662
16631663   cpu_set_input_line(device, 0, ASSERT_LINE);
1664   timer_set(device->machine, attotime::from_usec(50), NULL, 0, irq_stop);
1664   device->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(irq_stop));
16651665}
16661666
16671667
src/mame/drivers/cidelsa.c
r10315r10316
471471{
472472   /* reset the CPU */
473473   m_reset = 0;
474   timer_set(&m_machine, attotime::from_msec(200), NULL, 0, set_cpu_mode);
474   m_machine.scheduler().timer_set(attotime::from_msec(200), FUNC(set_cpu_mode));
475475}
476476
477477/* Machine Drivers */
src/mame/drivers/vendetta.c
r10315r10316
212212   vendetta_state *state = space->machine->driver_data<vendetta_state>();
213213   cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
214214
215   timer_set(space->machine, attotime::from_usec(25), NULL, 0, z80_nmi_callback);
215   space->machine->scheduler().timer_set(attotime::from_usec(25), FUNC(z80_nmi_callback));
216216}
217217
218218static WRITE8_HANDLER( z80_irq_w )
src/mame/drivers/segas16b.c
r10315r10316
11301130
11311131   /* if we have a fake i8751 handler, disable the actual 8751, otherwise crank the interleave */
11321132   if (state->i8751_vblank_hook != NULL)
1133      timer_call_after_resynch(machine, NULL, 0, suspend_i8751);
1133      machine->scheduler().synchronize(FUNC(suspend_i8751));
11341134   else
1135      timer_call_after_resynch(machine, NULL, 0, boost_interleave);
1135      machine->scheduler().synchronize(FUNC(boost_interleave));
11361136
11371137   /* configure sprite banks */
11381138   for (i = 0; i < 16; i++)
src/mame/drivers/marineb.c
r10315r10316
5959   state->marineb_active_low_flipscreen = 0;
6060
6161   /* we must start with NMI interrupts disabled */
62   timer_call_after_resynch(machine, NULL, 0, interrupt_disable);
62   machine->scheduler().synchronize(FUNC(interrupt_disable));
6363}
6464
6565static MACHINE_RESET( springer )
src/mame/drivers/taito_f3.c
r10315r10316
363363static INTERRUPT_GEN( f3_interrupt2 )
364364{
365365   cpu_set_input_line(device, 2, HOLD_LINE);   // vblank
366   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(10000), NULL, 0, f3_interrupt3);
366   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(10000), FUNC(f3_interrupt3));
367367}
368368
369369static SOUND_RESET( f3 )
src/mame/drivers/jpmsys5.c
r10315r10316
577577static MACHINE_START( jpmsys5v )
578578{
579579   memory_set_bankptr(machine, "bank1", machine->region("maincpu")->base());
580   touch_timer = timer_alloc(machine, touch_cb, NULL);
580   touch_timer = machine->scheduler().timer_alloc(FUNC(touch_cb));
581581}
582582
583583static MACHINE_RESET( jpmsys5v )
src/mame/drivers/champbas.c
r10315r10316
582582   state->audiocpu = machine->device("audiocpu");
583583
584584   // FIXME
585   timer_pulse(machine, attotime::from_hz(75), NULL, 0, exctsccr_fm_callback); /* updates fm */
585   machine->scheduler().timer_pulse(attotime::from_hz(75), FUNC(exctsccr_fm_callback)); /* updates fm */
586586
587587   MACHINE_START_CALL(champbas);
588588}
src/mame/drivers/m107.c
r10315r10316
5656static MACHINE_START( m107 )
5757{
5858   m107_state *state = machine->driver_data<m107_state>();
59   state->scanline_timer = timer_alloc(machine, m107_scanline_interrupt, NULL);
59   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(m107_scanline_interrupt));
6060}
6161
6262static MACHINE_RESET( m107 )
r10315r10316
132132
133133static WRITE16_HANDLER( m107_soundlatch_w )
134134{
135   timer_call_after_resynch(space->machine, NULL, V30_ASSERT, setvector_callback);
135   space->machine->scheduler().synchronize(FUNC(setvector_callback), V30_ASSERT);
136136   soundlatch_w(space, 0, data & 0xff);
137137//      logerror("soundlatch_w %02x\n",data);
138138}
r10315r10316
151151
152152static WRITE16_HANDLER( m107_sound_irq_ack_w )
153153{
154   timer_call_after_resynch(space->machine, NULL, V30_CLEAR,setvector_callback);
154   space->machine->scheduler().synchronize(FUNC(setvector_callback), V30_CLEAR);
155155}
156156
157157static WRITE16_HANDLER( m107_sound_status_w )
r10315r10316
805805static void sound_irq(device_t *device, int state)
806806{
807807   if (state)
808      timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT,setvector_callback);
808      device->machine->scheduler().synchronize(FUNC(setvector_callback), YM2151_ASSERT);
809809   else
810      timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR,setvector_callback);
810      device->machine->scheduler().synchronize(FUNC(setvector_callback), YM2151_CLEAR);
811811}
812812
813813static const ym2151_interface ym2151_config =
src/mame/drivers/cball.c
r10315r10316
8080   if (scanline >= 262)
8181      scanline = 16;
8282
83   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, interrupt_callback);
83   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline);
8484}
8585
8686
r10315r10316
9292
9393static MACHINE_RESET( cball )
9494{
95   timer_set(machine, machine->primary_screen->time_until_pos(16), NULL, 16, interrupt_callback);
95   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(16), FUNC(interrupt_callback), 16);
9696}
9797
9898
src/mame/drivers/cave.c
r10315r10316
102102      cpu_set_input_line(state->maincpu, state->irq_level, CLEAR_LINE);
103103}
104104
105static TIMER_CALLBACK( cave_vblank_start )
106{
107   cave_state *state = machine->driver_data<cave_state>();
108   state->vblank_irq = 1;
109   update_irq_state(machine);
110   cave_get_sprite_info(machine);
111   state->agallet_vblank_irq = 1;
112}
113
114105static TIMER_CALLBACK( cave_vblank_end )
115106{
116107   cave_state *state = machine->driver_data<cave_state>();
r10315r10316
122113   state->agallet_vblank_irq = 0;
123114}
124115
116static TIMER_DEVICE_CALLBACK( cave_vblank_start )
117{
118   cave_state *state = timer.machine->driver_data<cave_state>();
119   state->vblank_irq = 1;
120   update_irq_state(timer.machine);
121   cave_get_sprite_info(timer.machine);
122   state->agallet_vblank_irq = 1;
123   timer.machine->scheduler().timer_set(attotime::from_usec(2000), FUNC(cave_vblank_end));
124}
125
125126/* Called once/frame to generate the VBLANK interrupt */
126127static INTERRUPT_GEN( cave_interrupt )
127128{
128129   cave_state *state = device->machine->driver_data<cave_state>();
129   timer_set(device->machine, attotime::from_usec(17376 - state->time_vblank_irq), NULL, 0, cave_vblank_start);
130   timer_set(device->machine, attotime::from_usec(17376 - state->time_vblank_irq + 2000), NULL, 0, cave_vblank_end);
130   state->int_timer->adjust(attotime::from_usec(17376 - state->time_vblank_irq));
131131}
132132
133133/* Called by the YMZ280B to set the IRQ state */
r10315r10316
10341034
10351035***************************************************************************/
10361036
1037
1038static ADDRESS_MAP_START( oki_map, 0, 8 )
1039   AM_RANGE(0x00000, 0x1ffff) AM_ROMBANK("bank3")
1040   AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK("bank4")
1041ADDRESS_MAP_END
1042
1043static ADDRESS_MAP_START( oki2_map, 0, 8 )
1044   AM_RANGE(0x00000, 0x1ffff) AM_ROMBANK("bank5")
1045   AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK("bank6")
1046ADDRESS_MAP_END
1047
1048
10371049/***************************************************************************
10381050                                Hotdog Storm
10391051***************************************************************************/
r10315r10316
10481060
10491061static WRITE8_HANDLER( hotdogst_okibank_w )
10501062{
1051   UINT8 *RAM = space->machine->region("oki")->base();
10521063   int bank1 = (data >> 0) & 0x3;
10531064   int bank2 = (data >> 4) & 0x3;
1054   memcpy(RAM + 0x20000 * 0, RAM + 0x40000 + 0x20000 * bank1, 0x20000);
1055   memcpy(RAM + 0x20000 * 1, RAM + 0x40000 + 0x20000 * bank2, 0x20000);
1065   memory_set_bank(space->machine, "bank3", bank1);
1066   memory_set_bank(space->machine, "bank4", bank2);
10561067}
10571068
10581069static ADDRESS_MAP_START( hotdogst_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
r10315r10316
11171128
11181129static WRITE8_HANDLER( metmqstr_okibank0_w )
11191130{
1120   UINT8 *ROM = space->machine->region("oki1")->base();
11211131   int bank1 = (data >> 0) & 0x7;
11221132   int bank2 = (data >> 4) & 0x7;
1123   memcpy(ROM + 0x20000 * 0, ROM + 0x40000 + 0x20000 * bank1, 0x20000);
1124   memcpy(ROM + 0x20000 * 1, ROM + 0x40000 + 0x20000 * bank2, 0x20000);
1133   memory_set_bank(space->machine, "bank3", bank1);
1134   memory_set_bank(space->machine, "bank4", bank2);
11251135}
11261136
11271137static WRITE8_HANDLER( metmqstr_okibank1_w )
11281138{
1129   UINT8 *ROM = space->machine->region("oki2")->base();
11301139   int bank1 = (data >> 0) & 0x7;
11311140   int bank2 = (data >> 4) & 0x7;
1132   memcpy(ROM + 0x20000 * 0, ROM + 0x40000 + 0x20000 * bank1, 0x20000);
1133   memcpy(ROM + 0x20000 * 1, ROM + 0x40000 + 0x20000 * bank2, 0x20000);
1141   memory_set_bank(space->machine, "bank5", bank1);
1142   memory_set_bank(space->machine, "bank6", bank2);
11341143}
11351144
11361145static ADDRESS_MAP_START( metmqstr_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
r10315r10316
12111220
12121221static WRITE8_HANDLER( sailormn_okibank0_w )
12131222{
1214   UINT8 *RAM = space->machine->region("oki1")->base();
12151223   int bank1 = (data >> 0) & 0xf;
12161224   int bank2 = (data >> 4) & 0xf;
1217   memcpy(RAM + 0x20000 * 0, RAM + 0x40000 + 0x20000 * bank1, 0x20000);
1218   memcpy(RAM + 0x20000 * 1, RAM + 0x40000 + 0x20000 * bank2, 0x20000);
1225   memory_set_bank(space->machine, "bank3", bank1);
1226   memory_set_bank(space->machine, "bank4", bank2);
12191227}
12201228
12211229static WRITE8_HANDLER( sailormn_okibank1_w )
12221230{
1223   UINT8 *RAM = space->machine->region("oki2")->base();
12241231   int bank1 = (data >> 0) & 0xf;
12251232   int bank2 = (data >> 4) & 0xf;
1226   memcpy(RAM + 0x20000 * 0, RAM + 0x40000 + 0x20000 * bank1, 0x20000);
1227   memcpy(RAM + 0x20000 * 1, RAM + 0x40000 + 0x20000 * bank2, 0x20000);
1233   memory_set_bank(space->machine, "bank5", bank1);
1234   memory_set_bank(space->machine, "bank6", bank2);
12281235}
12291236
12301237static ADDRESS_MAP_START( sailormn_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
r10315r10316
18591866   MCFG_MACHINE_RESET(cave)
18601867   MCFG_EEPROM_93C46_ADD("eeprom")
18611868
1869   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
1870
18621871   /* video hardware */
18631872   MCFG_SCREEN_ADD("screen", RASTER)
18641873   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
19001909   MCFG_MACHINE_RESET(cave)
19011910   MCFG_EEPROM_93C46_ADD("eeprom")
19021911
1912   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
1913
19031914   /* video hardware */
19041915   MCFG_SCREEN_ADD("screen", RASTER)
19051916   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
19451956   MCFG_MACHINE_RESET(cave)
19461957   MCFG_EEPROM_93C46_ADD("eeprom")
19471958
1959   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
1960
19481961   /* video hardware */
19491962   MCFG_SCREEN_ADD("screen", RASTER)
19501963   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
19902003   MCFG_MACHINE_RESET(cave)
19912004   MCFG_EEPROM_93C46_ADD("eeprom")
19922005
2006   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2007
19932008   /* video hardware */
19942009   MCFG_SCREEN_ADD("screen", RASTER)
19952010   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
20292044   MCFG_MACHINE_START(cave)
20302045   MCFG_MACHINE_RESET(cave)
20312046
2047   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2048
20322049   /* video hardware */
20332050   MCFG_SCREEN_ADD("screen", RASTER)
20342051   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
20692086   MCFG_MACHINE_RESET(cave)
20702087   MCFG_EEPROM_93C46_ADD("eeprom")
20712088
2089   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2090
20722091   /* video hardware */
20732092   MCFG_SCREEN_ADD("screen", RASTER)
20742093   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
21122131   MCFG_MACHINE_RESET(cave)
21132132   MCFG_EEPROM_93C46_ADD("eeprom")
21142133
2134   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2135
21152136   /* video hardware */
21162137   MCFG_SCREEN_ADD("screen", RASTER)
21172138   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
21442165   MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
21452166   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
21462167   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
2168   MCFG_DEVICE_ADDRESS_MAP(0, oki_map)
21472169MACHINE_CONFIG_END
21482170
21492171
r10315r10316
21622184   MCFG_MACHINE_RESET(cave)
21632185   MCFG_EEPROM_ADD("eeprom", eeprom_interface_93C46_8bit)
21642186
2187   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2188
21652189   /* video hardware */
21662190   MCFG_SCREEN_ADD("screen", RASTER)
21672191   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
22152239   MCFG_MACHINE_RESET(cave)
22162240   MCFG_EEPROM_93C46_ADD("eeprom")
22172241
2242   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2243
22182244   /* video hardware */
22192245   MCFG_SCREEN_ADD("screen", RASTER)
22202246   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
22472273   MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
22482274   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 2.0)
22492275   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 2.0)
2276   MCFG_DEVICE_ADDRESS_MAP(0, oki_map)
22502277MACHINE_CONFIG_END
22512278
22522279
r10315r10316
22712298   MCFG_MACHINE_RESET(cave)   /* start with the watchdog armed */
22722299   MCFG_EEPROM_93C46_ADD("eeprom")
22732300
2301   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2302
22742303   /* video hardware */
22752304   MCFG_SCREEN_ADD("screen", RASTER)
22762305   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
22972326   MCFG_OKIM6295_ADD("oki1", XTAL_32MHz / 16 , OKIM6295_PIN7_HIGH)
22982327   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
22992328   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
2329   MCFG_DEVICE_ADDRESS_MAP(0, oki_map)
23002330
23012331   MCFG_OKIM6295_ADD("oki2", XTAL_32MHz / 16 , OKIM6295_PIN7_HIGH)
23022332   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
23032333   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
2334   MCFG_DEVICE_ADDRESS_MAP(0, oki2_map)
23042335MACHINE_CONFIG_END
23052336
23062337
r10315r10316
23232354   MCFG_MACHINE_RESET(cave)
23242355   MCFG_EEPROM_ADD("eeprom", eeprom_interface_93C46_pacslot)
23252356
2357   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2358
23262359   /* video hardware */
23272360   MCFG_SCREEN_ADD("screen", RASTER)
23282361   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
23492382   MCFG_OKIM6295_ADD("oki2", XTAL_28MHz / 28, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
23502383   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
23512384   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
2352
23532385MACHINE_CONFIG_END
23542386
23552387
r10315r10316
23792411   MCFG_MACHINE_RESET(cave)
23802412   MCFG_EEPROM_93C46_ADD("eeprom")
23812413
2414   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2415
23822416   /* video hardware */
23832417   MCFG_SCREEN_ADD("screen", RASTER)
23842418   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
24412475   MCFG_MACHINE_RESET(cave)
24422476   MCFG_EEPROM_93C46_ADD("eeprom")
24432477
2478   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2479
24442480   /* video hardware */
24452481   MCFG_SCREEN_ADD("screen", RASTER)
24462482   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
24662502   MCFG_OKIM6295_ADD("oki1", 2112000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
24672503   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
24682504   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
2505   MCFG_DEVICE_ADDRESS_MAP(0, oki_map)
24692506
24702507   MCFG_OKIM6295_ADD("oki2", 2112000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
24712508   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
24722509   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
2510   MCFG_DEVICE_ADDRESS_MAP(0, oki2_map)
24732511MACHINE_CONFIG_END
24742512
24752513
r10315r10316
24922530   MCFG_MACHINE_RESET(cave)
24932531   MCFG_EEPROM_93C46_ADD("eeprom")
24942532
2533   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2534
24952535   /* video hardware */
24962536   MCFG_SCREEN_ADD("screen", RASTER)
24972537   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
25322572   MCFG_MACHINE_START(cave)
25332573   MCFG_EEPROM_93C46_ADD("eeprom")
25342574
2575   MCFG_TIMER_ADD("int_timer", cave_vblank_start)
2576
25352577   /* video hardware */
25362578   MCFG_SCREEN_ADD("screen", RASTER)
25372579   MCFG_SCREEN_REFRESH_RATE(15625/271.5)
r10315r10316
26942736   ROM_LOAD( "bp962a.u65", 0x200000, 0x100000, CRC(135fcf9a) SHA1(2e8c89c2627bbdef160d96724d07883fb2fa1a57) ) \
26952737   ROM_CONTINUE(           0x200000, 0x100000             ) \
26962738   \
2697   ROM_REGION( 0x240000, "oki1", 0 ) \
2698   ROM_LOAD( "bp962a.u48", 0x040000, 0x200000, CRC(ae00a1ce) SHA1(5e8c74df0ac77efb3080406870856f958be14f79) ) \
2739   ROM_REGION( 0x200000, "oki1", 0 ) \
2740   ROM_LOAD( "bp962a.u48", 0x000000, 0x200000, CRC(ae00a1ce) SHA1(5e8c74df0ac77efb3080406870856f958be14f79) ) \
26992741   \
2700   ROM_REGION( 0x240000, "oki2", 0 )   \
2701   ROM_LOAD( "bp962a.u47", 0x040000, 0x200000, CRC(6d4e9737) SHA1(81c7ecdfc2d38d0b35e26745866f6672f566f936) ) \
2742   ROM_REGION( 0x200000, "oki2", 0 )   \
2743   ROM_LOAD( "bp962a.u47", 0x000000, 0x200000, CRC(6d4e9737) SHA1(81c7ecdfc2d38d0b35e26745866f6672f566f936) ) \
27022744
27032745/* the regions differ only in the EEPROM, hence the macro above - all EEPROMs are Factory Defaulted */
27042746ROM_START( agallet )
r10315r10316
34323474   ROM_REGION( 0x80000, "layer2", 0 )   /* Layer 2 */
34333475   ROM_LOAD( "mp5u64", 0x00000, 0x80000, CRC(9b26458c) SHA1(acef62422fa3f92e6ca1eba0ee6fb914cd1ee190) )
34343476
3435   ROM_REGION( 0xc0000, "oki", 0 )   /* Samples */
3436   /* Leave the 0x40000 bytes addressable by the chip empty */
3437   ROM_LOAD( "mp1u65", 0x40000, 0x80000, CRC(4868be1b) SHA1(32b8234b19fdbe07fa5057fa7965e36807e35e77) )   // 1xxxxxxxxxxxxxxxxxx = 0xFF, 4 x 0x20000
3477   ROM_REGION( 0x80000, "oki", 0 )   /* Samples */
3478   ROM_LOAD( "mp1u65", 0x00000, 0x80000, CRC(4868be1b) SHA1(32b8234b19fdbe07fa5057fa7965e36807e35e77) )   // 1xxxxxxxxxxxxxxxxxx = 0xFF, 4 x 0x20000
34383479
34393480   ROM_REGION16_BE( 0x80, "eeprom", 0 )
34403481   ROM_LOAD16_WORD( "eeprom-hotdogst.bin", 0x0000, 0x0080, CRC(12b4f934) SHA1(5b28d8fbd78869db78ce49e541a9d65558841966) )
r10315r10316
35663607   ROM_REGION( 0x200000, "layer1", 0 ) \
35673608   ROM_LOAD( "bp943a-0.u63", 0x000000, 0x200000, CRC(c1fed98a) SHA1(c276505f80a49b129862966a19db507f97153e45) ) \
35683609   \
3569   ROM_REGION( 0x0c0000, "oki", 0 ) \
3570   ROM_LOAD( "bp943a-4.u64", 0x040000, 0x080000, CRC(3fc7f29a) SHA1(feb21b918243c0a03dfa4a80cc80b86be4f62680) ) \
3610   ROM_REGION( 0x080000, "oki", 0 ) \
3611   ROM_LOAD( "bp943a-4.u64", 0x000000, 0x080000, CRC(3fc7f29a) SHA1(feb21b918243c0a03dfa4a80cc80b86be4f62680) ) \
35713612
35723613/* the regions differ only in the EEPROM, hence the macro above - all EEPROMs are Factory Defaulted */
35733614ROM_START( mazinger )
r10315r10316
36583699   ROM_LOAD( "bp947a.u46", 0x000000, 0x100000, CRC(0f9c906e) SHA1(03872e8be28637df66373bddb04ed91de4f9db75) )   // FIRST AND SECOND HALF IDENTICAL
36593700   ROM_CONTINUE(           0x000000, 0x100000             )
36603701
3661   ROM_REGION( 0x140000, "oki1", 0 )   /* OKIM6295 #1 Samples */
3662   /* Leave the 0x40000 bytes addressable by the chip empty */
3663   ROM_LOAD( "bp947a.u42", 0x040000, 0x100000, CRC(2ce8ff2a) SHA1(8ef8c5b7d4a0e60c980c2962e75f7977faafa311) )   // FIRST AND SECOND HALF IDENTICAL
3664   ROM_CONTINUE(           0x040000, 0x100000             )
3702   ROM_REGION( 0x100000, "oki1", 0 )   /* OKIM6295 #1 Samples */
3703   ROM_LOAD( "bp947a.u42", 0x000000, 0x100000, CRC(2ce8ff2a) SHA1(8ef8c5b7d4a0e60c980c2962e75f7977faafa311) )   // FIRST AND SECOND HALF IDENTICAL
3704   ROM_CONTINUE(           0x000000, 0x100000             )
36653705
3666   ROM_REGION( 0x140000, "oki2", 0 )   /* OKIM6295 #2 Samples */
3667   /* Leave the 0x40000 bytes addressable by the chip empty */
3668   ROM_LOAD( "bp947a.u37", 0x040000, 0x100000, CRC(c3077c8f) SHA1(0a76316a81b7de78279b859549eb5161a721ac71) )   // FIRST AND SECOND HALF IDENTICAL
3669   ROM_CONTINUE(           0x040000, 0x100000             )
3706   ROM_REGION( 0x100000, "oki2", 0 )   /* OKIM6295 #2 Samples */
3707   ROM_LOAD( "bp947a.u37", 0x000000, 0x100000, CRC(c3077c8f) SHA1(0a76316a81b7de78279b859549eb5161a721ac71) )   // FIRST AND SECOND HALF IDENTICAL
3708   ROM_CONTINUE(           0x000000, 0x100000             )
36703709ROM_END
36713710
36723711ROM_START( nmaster )
r10315r10316
36973736   ROM_LOAD( "bp947a.u46", 0x000000, 0x100000, CRC(0f9c906e) SHA1(03872e8be28637df66373bddb04ed91de4f9db75) )   // FIRST AND SECOND HALF IDENTICAL
36983737   ROM_CONTINUE(           0x000000, 0x100000             )
36993738
3700   ROM_REGION( 0x140000, "oki1", 0 )   /* OKIM6295 #1 Samples */
3701   /* Leave the 0x40000 bytes addressable by the chip empty */
3702   ROM_LOAD( "bp947a.u42", 0x040000, 0x100000, CRC(2ce8ff2a) SHA1(8ef8c5b7d4a0e60c980c2962e75f7977faafa311) )   // FIRST AND SECOND HALF IDENTICAL
3703   ROM_CONTINUE(           0x040000, 0x100000             )
3739   ROM_REGION( 0x100000, "oki1", 0 )   /* OKIM6295 #1 Samples */
3740   ROM_LOAD( "bp947a.u42", 0x000000, 0x100000, CRC(2ce8ff2a) SHA1(8ef8c5b7d4a0e60c980c2962e75f7977faafa311) )   // FIRST AND SECOND HALF IDENTICAL
3741   ROM_CONTINUE(           0x000000, 0x100000             )
37043742
3705   ROM_REGION( 0x140000, "oki2", 0 )   /* OKIM6295 #2 Samples */
3706   /* Leave the 0x40000 bytes addressable by the chip empty */
3707   ROM_LOAD( "bp947a.u37", 0x040000, 0x100000, CRC(c3077c8f) SHA1(0a76316a81b7de78279b859549eb5161a721ac71) )   // FIRST AND SECOND HALF IDENTICAL
3708   ROM_CONTINUE(           0x040000, 0x100000             )
3743   ROM_REGION( 0x100000, "oki2", 0 )   /* OKIM6295 #2 Samples */
3744   ROM_LOAD( "bp947a.u37", 0x000000, 0x100000, CRC(c3077c8f) SHA1(0a76316a81b7de78279b859549eb5161a721ac71) )   // FIRST AND SECOND HALF IDENTICAL
3745   ROM_CONTINUE(           0x000000, 0x100000             )
37093746ROM_END
37103747
37113748
r10315r10316
40914128   ROM_LOAD( "bpsm.u63", 0xe00000, 0x100000, CRC(d57a56b4) SHA1(e039b336887b66eba4e0630a3cb04cbd8fe14073) ) \
40924129   ROM_CONTINUE(         0xe00000, 0x100000             ) \
40934130   \
4094   ROM_REGION( 0x240000, "oki1", 0 ) \
4095   ROM_LOAD( "bpsm.u48", 0x040000, 0x200000, CRC(498e4ed1) SHA1(28d45a41702d9e5af4e214c1800b2e513ec84d51) ) \
4131   ROM_REGION( 0x200000, "oki1", 0 ) \
4132   ROM_LOAD( "bpsm.u48", 0x000000, 0x200000, CRC(498e4ed1) SHA1(28d45a41702d9e5af4e214c1800b2e513ec84d51) ) \
40964133   \
4097   ROM_REGION( 0x240000, "oki2", 0 ) \
4098   ROM_LOAD( "bpsm.u47", 0x040000, 0x080000, CRC(0f2901b9) SHA1(ebd3e9e39e8d2bc91688dac19b99548a28b4733c) ) \
4099   ROM_RELOAD(           0x0c0000, 0x080000             ) \
4100   ROM_RELOAD(           0x140000, 0x080000             ) \
4101   ROM_RELOAD(           0x1c0000, 0x080000             ) \
4134   ROM_REGION( 0x200000, "oki2", 0 ) \
4135   ROM_LOAD( "bpsm.u47", 0x000000, 0x080000, CRC(0f2901b9) SHA1(ebd3e9e39e8d2bc91688dac19b99548a28b4733c) ) \
4136   ROM_RELOAD(           0x080000, 0x080000             ) \
4137   ROM_RELOAD(           0x100000, 0x080000             ) \
4138   ROM_RELOAD(           0x180000, 0x080000             ) \
41024139
41034140/* the regions differ only in the EEPROM, hence the macro above - all EEPROMs are Factory Defaulted */
41044141ROM_START( sailormn )
r10315r10316
41764213   ROM_LOAD( "bpsm.u63", 0xe00000, 0x100000, CRC(d57a56b4) SHA1(e039b336887b66eba4e0630a3cb04cbd8fe14073) ) \
41774214   ROM_CONTINUE(         0xe00000, 0x100000             ) \
41784215   \
4179   ROM_REGION( 0x240000, "oki1", 0 ) \
4180   ROM_LOAD( "bpsm.u48", 0x040000, 0x200000, CRC(498e4ed1) SHA1(28d45a41702d9e5af4e214c1800b2e513ec84d51) ) \
4216   ROM_REGION( 0x200000, "oki1", 0 ) \
4217   ROM_LOAD( "bpsm.u48", 0x000000, 0x200000, CRC(498e4ed1) SHA1(28d45a41702d9e5af4e214c1800b2e513ec84d51) ) \
41814218   \
4182   ROM_REGION( 0x240000, "oki2", 0 ) \
4183   ROM_LOAD( "bpsm.u47", 0x040000, 0x080000, CRC(0f2901b9) SHA1(ebd3e9e39e8d2bc91688dac19b99548a28b4733c) ) \
4184   ROM_RELOAD(           0x0c0000, 0x080000             ) \
4185   ROM_RELOAD(           0x140000, 0x080000             ) \
4186   ROM_RELOAD(           0x1c0000, 0x080000             ) \
4219   ROM_REGION( 0x200000, "oki2", 0 ) \
4220   ROM_LOAD( "bpsm.u47", 0x000000, 0x080000, CRC(0f2901b9) SHA1(ebd3e9e39e8d2bc91688dac19b99548a28b4733c) ) \
4221   ROM_RELOAD(           0x080000, 0x080000             ) \
4222   ROM_RELOAD(           0x100000, 0x080000             ) \
4223   ROM_RELOAD(           0x180000, 0x080000             ) \
41874224
41884225/* the regions differ only in the EEPROM, hence the macro above - all EEPROMs are Factory Defaulted */
41894226ROM_START( sailormno )
r10315r10316
43674404   memory_configure_bank(machine, "bank1", 0, 0x02, &ROM[0x00000], 0x4000);
43684405   memory_configure_bank(machine, "bank1", 2, 0x1e, &ROM[0x10000], 0x4000);
43694406
4407   ROM = machine->region("oki1")->base();
4408   memory_configure_bank(machine, "bank3", 0, 0x10, &ROM[0x00000], 0x20000);
4409   memory_configure_bank(machine, "bank4", 0, 0x10, &ROM[0x00000], 0x20000);
4410
4411   ROM = machine->region("oki2")->base();
4412   memory_configure_bank(machine, "bank5", 0, 0x10, &ROM[0x00000], 0x20000);
4413   memory_configure_bank(machine, "bank6", 0, 0x10, &ROM[0x00000], 0x20000);
4414
43704415   sailormn_unpack_tiles(machine, "layer2");
43714416
43724417   unpack_sprites(machine);
r10315r10316
44584503   memory_configure_bank(machine, "bank2", 0, 0x2, &ROM[0x00000], 0x4000);
44594504   memory_configure_bank(machine, "bank2", 2, 0xe, &ROM[0x10000], 0x4000);
44604505
4506   ROM = machine->region("oki")->base();
4507   memory_configure_bank(machine, "bank3", 0, 4, &ROM[0x00000], 0x20000);
4508   memory_configure_bank(machine, "bank4", 0, 4, &ROM[0x00000], 0x20000);
4509
44614510   unpack_sprites(machine);
44624511   state->spritetype[0] = 2;   // Normal sprites with different position handling
44634512   state->time_vblank_irq = 2000;   /**/
r10315r10316
44764525   memory_configure_bank(machine, "bank2", 0, 2, &ROM[0x00000], 0x4000);
44774526   memory_configure_bank(machine, "bank2", 2, 6, &ROM[0x10000], 0x4000);
44784527
4528   ROM = machine->region("oki")->base();
4529   memory_configure_bank(machine, "bank3", 0, 4, &ROM[0x00000], 0x20000);
4530   memory_configure_bank(machine, "bank4", 0, 4, &ROM[0x00000], 0x20000);
4531
44794532   /* decrypt sprites */
44804533   buffer = auto_alloc_array(machine, UINT8, len);
44814534   {
r10315r10316
45064559   memory_configure_bank(machine, "bank1", 0, 0x2, &ROM[0x00000], 0x4000);
45074560   memory_configure_bank(machine, "bank1", 2, 0xe, &ROM[0x10000], 0x4000);
45084561
4562   ROM = machine->region("oki1")->base();
4563   memory_configure_bank(machine, "bank3", 0, 8, &ROM[0x00000], 0x20000);
4564   memory_configure_bank(machine, "bank4", 0, 8, &ROM[0x00000], 0x20000);
4565
4566   ROM = machine->region("oki2")->base();
4567   memory_configure_bank(machine, "bank5", 0, 8, &ROM[0x00000], 0x20000);
4568   memory_configure_bank(machine, "bank6", 0, 8, &ROM[0x00000], 0x20000);
4569
45094570   unpack_sprites(machine);
45104571   state->spritetype[0] = 2;   // Normal sprites with different position handling
45114572   state->kludge = 3;
r10315r10316
45754636   memory_configure_bank(machine, "bank1", 0, 0x02, &ROM[0x00000], 0x4000);
45764637   memory_configure_bank(machine, "bank1", 2, 0x1e, &ROM[0x10000], 0x4000);
45774638
4639   ROM = machine->region("oki1")->base();
4640   memory_configure_bank(machine, "bank3", 0, 0x10, &ROM[0x00000], 0x20000);
4641   memory_configure_bank(machine, "bank4", 0, 0x10, &ROM[0x00000], 0x20000);
4642
4643   ROM = machine->region("oki2")->base();
4644   memory_configure_bank(machine, "bank5", 0, 0x10, &ROM[0x00000], 0x20000);
4645   memory_configure_bank(machine, "bank6", 0, 0x10, &ROM[0x00000], 0x20000);
4646
45784647   /* decrypt sprites */
45794648   buffer = auto_alloc_array(machine, UINT8, len);
45804649   {
r10315r10316
46454714
46464715***************************************************************************/
46474716
4648GAME( 1994, pwrinst2,   0,        pwrinst2, metmqstr, pwrinst2, ROT0,   "Atlus",                                  "Power Instinct 2 (US, Ver. 94/04/08)",                   0 )
4649GAME( 1994, pwrinst2j,  pwrinst2, pwrinst2, metmqstr, pwrinst2j,ROT0,   "Atlus",                                  "Gouketsuji Ichizoku 2 (Japan, Ver. 94/04/08)",           0 )
4717GAME( 1994, pwrinst2,   0,        pwrinst2, metmqstr, pwrinst2, ROT0,   "Atlus",                                  "Power Instinct 2 (US, Ver. 94/04/08)",         GAME_SUPPORTS_SAVE )
4718GAME( 1994, pwrinst2j,  pwrinst2, pwrinst2, metmqstr, pwrinst2j,ROT0,   "Atlus",                                  "Gouketsuji Ichizoku 2 (Japan, Ver. 94/04/08)", GAME_SUPPORTS_SAVE )
46504719
46514720// The EEPROM determines the region, program roms are the same between sets
4652GAME( 1994, mazinger,   0,        mazinger, cave,     mazinger, ROT90,  "Banpresto / Dynamic Pl. Toei Animation", "Mazinger Z (World)",                                     0 )
4653GAME( 1994, mazingerj,  mazinger, mazinger, cave,     mazinger, ROT90,  "Banpresto / Dynamic Pl. Toei Animation", "Mazinger Z (Japan)",                                     0 )
4721GAME( 1994, mazinger,   0,        mazinger, cave,     mazinger, ROT90,  "Banpresto / Dynamic Pl. Toei Animation", "Mazinger Z (World)", GAME_SUPPORTS_SAVE )
4722GAME( 1994, mazingerj,  mazinger, mazinger, cave,     mazinger, ROT90,  "Banpresto / Dynamic Pl. Toei Animation", "Mazinger Z (Japan)", GAME_SUPPORTS_SAVE )
46544723
4655GAME( 1995, donpachi,   0,        donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (US)",                                          0 )
4656GAME( 1995, donpachij,  donpachi, donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (Japan)",                                       0 )
4657GAME( 1995, donpachikr, donpachi, donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (Korea)",                                       0 )
4658GAME( 1995, donpachihk, donpachi, donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (Hong Kong)",                                   0 )
4724GAME( 1995, donpachi,   0,        donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (US)",        GAME_SUPPORTS_SAVE )
4725GAME( 1995, donpachij,  donpachi, donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (Japan)",     GAME_SUPPORTS_SAVE )
4726GAME( 1995, donpachikr, donpachi, donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (Korea)",     GAME_SUPPORTS_SAVE )
4727GAME( 1995, donpachihk, donpachi, donpachi, cave,     donpachi, ROT270, "Cave (Atlus license)",                   "DonPachi (Hong Kong)", GAME_SUPPORTS_SAVE )
46594728
4660GAME( 1995, metmqstr,   0,        metmqstr, metmqstr, metmqstr, ROT0,   "Banpresto / Pandorabox",                 "Metamoqester (International)",                           0 )
4661GAME( 1995, nmaster,    metmqstr, metmqstr, metmqstr, metmqstr, ROT0,   "Banpresto / Pandorabox",                 "Oni - The Ninja Master (Japan)",                         0 )
4729GAME( 1995, metmqstr,   0,        metmqstr, metmqstr, metmqstr, ROT0,   "Banpresto / Pandorabox",                 "Metamoqester (International)",   GAME_SUPPORTS_SAVE )
4730GAME( 1995, nmaster,    metmqstr, metmqstr, metmqstr, metmqstr, ROT0,   "Banpresto / Pandorabox",                 "Oni - The Ninja Master (Japan)", GAME_SUPPORTS_SAVE )
46624731
4663GAME( 1995, plegends,   0,        pwrinst2, metmqstr, pwrinst2j,ROT0,   "Atlus",                                  "Gogetsuji Legends (US, Ver. 95/06/20)",                  0 )
4664GAME( 1995, plegendsj,  plegends, pwrinst2, metmqstr, pwrinst2j,ROT0,   "Atlus",                                  "Gouketsuji Gaiden -  Saikyou Densetsu (Japan, Ver. 95/06/20)", 0 )
4732GAME( 1995, plegends,   0,        pwrinst2, metmqstr, pwrinst2j,ROT0,   "Atlus",                                  "Gogetsuji Legends (US, Ver. 95/06/20)",                       GAME_SUPPORTS_SAVE )
4733GAME( 1995, plegendsj,  plegends, pwrinst2, metmqstr, pwrinst2j,ROT0,   "Atlus",                                  "Gouketsuji Gaiden - Saikyou Densetsu (Japan, Ver. 95/06/20)", GAME_SUPPORTS_SAVE )
46654734
46664735// The EEPROM determines the region, program roms are the same between sets
4667GAME( 1995, sailormn,   0,        sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Europe)",    0 )
4668GAME( 1995, sailormnu,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, USA)",       0 )
4669GAME( 1995, sailormnj,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Japan)",     0 )
4670GAME( 1995, sailormnk,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Korea)",     0 )
4671GAME( 1995, sailormnt,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Taiwan)",    0 )
4672GAME( 1995, sailormnh,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Hong Kong)", 0 )
4673GAME( 1995, sailormno,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Europe)",     0 )
4674GAME( 1995, sailormnou, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, USA)",        0 )
4675GAME( 1995, sailormnoj, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Japan)",      0 )
4676GAME( 1995, sailormnok, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Korea)",      0 )
4677GAME( 1995, sailormnot, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Taiwan)",     0 )
4678GAME( 1995, sailormnoh, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Hong Kong)",   0 )
4736GAME( 1995, sailormn,   0,        sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Europe)",    GAME_SUPPORTS_SAVE )
4737GAME( 1995, sailormnu,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, USA)",       GAME_SUPPORTS_SAVE )
4738GAME( 1995, sailormnj,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Japan)",     GAME_SUPPORTS_SAVE )
4739GAME( 1995, sailormnk,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Korea)",     GAME_SUPPORTS_SAVE )
4740GAME( 1995, sailormnt,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Taiwan)",    GAME_SUPPORTS_SAVE )
4741GAME( 1995, sailormnh,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Hong Kong)", GAME_SUPPORTS_SAVE )
4742GAME( 1995, sailormno,  sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Europe)",     GAME_SUPPORTS_SAVE )
4743GAME( 1995, sailormnou, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, USA)",        GAME_SUPPORTS_SAVE )
4744GAME( 1995, sailormnoj, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Japan)",      GAME_SUPPORTS_SAVE )
4745GAME( 1995, sailormnok, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Korea)",      GAME_SUPPORTS_SAVE )
4746GAME( 1995, sailormnot, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Taiwan)",     GAME_SUPPORTS_SAVE )
4747GAME( 1995, sailormnoh, sailormn, sailormn, cave,     sailormn, ROT0,   "Banpresto",                              "Pretty Soldier Sailor Moon (Ver. 95/03/22, Hong Kong)",   GAME_SUPPORTS_SAVE )
46794748
46804749// The EEPROM determines the region, program roms are the same between sets
4681GAME( 1996, agallet,    0,        sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Europe)", 0 )
4682GAME( 1996, agalletu,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (USA)", 0 )
4683GAME( 1996, agalletj,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Japan)", 0 )
4684GAME( 1996, agalletk,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Korea)", 0 )
4685GAME( 1996, agallett,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Taiwan)", 0 )
4686GAME( 1996, agalleth,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Hong Kong)",                               0 )
4750GAME( 1996, agallet,    0,        sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Europe)",    GAME_SUPPORTS_SAVE )
4751GAME( 1996, agalletu,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (USA)",       GAME_SUPPORTS_SAVE )
4752GAME( 1996, agalletj,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Akuu Gallet (Japan)",    GAME_SUPPORTS_SAVE )
4753GAME( 1996, agalletk,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Korea)",     GAME_SUPPORTS_SAVE )
4754GAME( 1996, agallett,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Taiwan)",    GAME_SUPPORTS_SAVE )
4755GAME( 1996, agalleth,   agallet,  sailormn, cave,     agallet,  ROT270, "Banpresto / Gazelle",                    "Air Gallet (Hong Kong)", GAME_SUPPORTS_SAVE )
46874756
4688GAME( 1996, hotdogst,   0,        hotdogst, cave,     hotdogst, ROT90,  "Marble",                                 "Hotdog Storm (International)",                         0 )
4757GAME( 1996, hotdogst,   0,        hotdogst, cave,     hotdogst, ROT90,  "Marble",                                 "Hotdog Storm (International)", GAME_SUPPORTS_SAVE )
46894758
4690GAME( 1996, pacslot,    0,        pacslot,  pacslot,  tjumpman, ROT0,   "Namco",                                  "Pac-Slot",                                             0 )
4759GAME( 1996, pacslot,    0,        pacslot,  pacslot,  tjumpman, ROT0,   "Namco",                                  "Pac-Slot", GAME_SUPPORTS_SAVE )
46914760
4692GAME( 1997, ddonpach,   0,        ddonpach, cave,     ddonpach, ROT270, "Cave (Atlus license)",                   "DoDonPachi (International, Master Ver. 97/02/05)",     0 )
4693GAME( 1997, ddonpachj,  ddonpach, ddonpach, cave,     ddonpach, ROT270, "Cave (Atlus license)",                   "DoDonPachi (Japan, Master Ver. 97/02/05)",             0 )
4761GAME( 1997, ddonpach,   0,        ddonpach, cave,     ddonpach, ROT270, "Cave (Atlus license)",                   "DoDonPachi (International, Master Ver. 97/02/05)", GAME_SUPPORTS_SAVE )
4762GAME( 1997, ddonpachj,  ddonpach, ddonpach, cave,     ddonpach, ROT270, "Cave (Atlus license)",                   "DoDonPachi (Japan, Master Ver. 97/02/05)",         GAME_SUPPORTS_SAVE )
46944763
4695GAME( 1998, dfeveron,   feversos, dfeveron, cave,     dfeveron, ROT270, "Cave (Nihon System license)",            "Dangun Feveron (Japan, Ver. 98/09/17)",                0 )
4696GAME( 1998, feversos,   0,        dfeveron, cave,     feversos, ROT270, "Cave (Nihon System license)",            "Fever SOS (International, Ver. 98/09/25)",             0 )
4764GAME( 1998, dfeveron,   feversos, dfeveron, cave,     dfeveron, ROT270, "Cave (Nihon System license)",            "Dangun Feveron (Japan, Ver. 98/09/17)",    GAME_SUPPORTS_SAVE )
4765GAME( 1998, feversos,   0,        dfeveron, cave,     feversos, ROT270, "Cave (Nihon System license)",            "Fever SOS (International, Ver. 98/09/25)", GAME_SUPPORTS_SAVE )
46974766
4698GAME( 1998, esprade,    0,        esprade,  cave,     esprade,  ROT270, "Cave (Atlus license)",                   "ESP Ra.De. (International, Ver. 98/04/22)",            0 )
4699GAME( 1998, espradej,   esprade,  esprade,  cave,     esprade,  ROT270, "Cave (Atlus license)",                   "ESP Ra.De. (Japan, Ver. 98/04/21)",                    0 )
4700GAME( 1998, espradejo,  esprade,  esprade,  cave,     esprade,  ROT270, "Cave (Atlus license)",                   "ESP Ra.De. (Japan, Ver. 98/04/14)",                    0 )
4767GAME( 1998, esprade,    0,        esprade,  cave,     esprade,  ROT270, "Cave (Atlus license)",                   "ESP Ra.De. (International, Ver. 98/04/22)", GAME_SUPPORTS_SAVE )
4768GAME( 1998, espradej,   esprade,  esprade,  cave,     esprade,  ROT270, "Cave (Atlus license)",                   "ESP Ra.De. (Japan, Ver. 98/04/21)",         GAME_SUPPORTS_SAVE )
4769GAME( 1998, espradejo,  esprade,  esprade,  cave,     esprade,  ROT270, "Cave (Atlus license)",                   "ESP Ra.De. (Japan, Ver. 98/04/14)",         GAME_SUPPORTS_SAVE )
47014770
4702GAME( 1998, uopoko,     0,        uopoko,   cave,     uopoko,   ROT0,   "Cave (Jaleco license)",                  "Puzzle Uo Poko (International)",                       0 )
4703GAME( 1998, uopokoj,    uopoko,   uopoko,   cave,     uopoko,   ROT0,   "Cave (Jaleco license)",                  "Puzzle Uo Poko (Japan)",                               0 )
4771GAME( 1998, uopoko,     0,        uopoko,   cave,     uopoko,   ROT0,   "Cave (Jaleco license)",                  "Puzzle Uo Poko (International)", GAME_SUPPORTS_SAVE )
4772GAME( 1998, uopokoj,    uopoko,   uopoko,   cave,     uopoko,   ROT0,   "Cave (Jaleco license)",                  "Puzzle Uo Poko (Japan)",         GAME_SUPPORTS_SAVE )
47044773
4705GAME( 1999, guwange,    0,        guwange,  guwange,  guwange,  ROT270, "Cave (Atlus license)",                   "Guwange (Japan, Master Ver. 99/06/24)",                0 )
4774GAME( 1999, guwange,    0,        guwange,  guwange,  guwange,  ROT270, "Cave (Atlus license)",                   "Guwange (Japan, Master Ver. 99/06/24)", GAME_SUPPORTS_SAVE )
47064775
4707GAME( 1999, gaia,       0,        gaia,     gaia,     gaia,     ROT0,   "Noise Factory",                          "Gaia Crusaders",                                      GAME_IMPERFECT_SOUND ) // cuts out occasionally
4776GAME( 1999, gaia,       0,        gaia,     gaia,     gaia,     ROT0,   "Noise Factory",                          "Gaia Crusaders", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) // cuts out occasionally
47084777
4709GAME( 2001, theroes,    0,        gaia,     theroes,  gaia,     ROT0,   "Primetek Investments",                   "Thunder Heroes",                                       GAME_IMPERFECT_SOUND ) // cuts out occasionally
4778GAME( 2001, theroes,    0,        gaia,     theroes,  gaia,     ROT0,   "Primetek Investments",                   "Thunder Heroes",   GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) // cuts out occasionally
47104779
4711GAME( 1999, korokoro,   0,        korokoro, korokoro, korokoro, ROT0,   "Takumi",                                 "Koro Koro Quest (Japan)",                              0 )
4780GAME( 1999, korokoro,   0,        korokoro, korokoro, korokoro, ROT0,   "Takumi",                                 "Koro Koro Quest (Japan)", GAME_SUPPORTS_SAVE )
47124781
4713GAME( 1999, crusherm,   0,        crusherm, korokoro, korokoro, ROT0,   "Takumi",                                 "Crusher Makochan (Japan)",                             0 )
4782GAME( 1999, crusherm,   0,        crusherm, korokoro, korokoro, ROT0,   "Takumi",                                 "Crusher Makochan (Japan)", GAME_SUPPORTS_SAVE )
47144783
4715GAME( 1999, tjumpman,   0,        tjumpman, tjumpman, tjumpman, ROT0,   "Namco",                                  "Tobikose! Jumpman",                                    0 )
4784GAME( 1999, tjumpman,   0,        tjumpman, tjumpman, tjumpman, ROT0,   "Namco",                                  "Tobikose! Jumpman", GAME_SUPPORTS_SAVE )
src/mame/drivers/dec8.c
r10315r10316
131131   case 0: /* High byte - SECIRQ is trigged on activating this latch */
132132      state->i8751_value = (state->i8751_value & 0xff) | (data << 8);
133133      cpu_set_input_line(state->mcu, MCS51_INT1_LINE, ASSERT_LINE);
134      timer_set(space->machine, state->mcu->clocks_to_attotime(64), NULL, 0, dec8_i8751_timer_callback); // 64 clocks not confirmed
134      space->machine->scheduler().timer_set(state->mcu->clocks_to_attotime(64), FUNC(dec8_i8751_timer_callback)); // 64 clocks not confirmed
135135      break;
136136   case 1: /* Low byte */
137137      state->i8751_value = (state->i8751_value & 0xff00) | data;
src/mame/drivers/fuukifg3.c
r10315r10316
487487{
488488   fuuki32_state *state = machine->driver_data<fuuki32_state>();
489489   cpu_set_input_line(state->maincpu, 1, HOLD_LINE);
490   timer_set(machine, machine->primary_screen->time_until_pos(248), NULL, 0, level_1_interrupt_callback);
490   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(248), FUNC(level_1_interrupt_callback));
491491}
492492
493493
r10315r10316
495495{
496496   fuuki32_state *state = machine->driver_data<fuuki32_state>();
497497   cpu_set_input_line(state->maincpu, 3, HOLD_LINE);   // VBlank IRQ
498   timer_set(machine, machine->primary_screen->time_until_vblank_start(), NULL, 0, vblank_interrupt_callback);
498   machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_start(), FUNC(vblank_interrupt_callback));
499499}
500500
501501
r10315r10316
518518   state->maincpu = machine->device("maincpu");
519519   state->audiocpu = machine->device("soundcpu");
520520
521   state->raster_interrupt_timer = timer_alloc(machine, raster_interrupt_callback, NULL);
521   state->raster_interrupt_timer = machine->scheduler().timer_alloc(FUNC(raster_interrupt_callback));
522522
523523   state_save_register_global_array(machine, state->spr_buffered_tilebank);
524524   state_save_register_global_array(machine, state->shared_ram);
r10315r10316
530530   fuuki32_state *state = machine->driver_data<fuuki32_state>();
531531   const rectangle &visarea = machine->primary_screen->visible_area();
532532
533   timer_set(machine, machine->primary_screen->time_until_pos(248), NULL, 0, level_1_interrupt_callback);
534   timer_set(machine, machine->primary_screen->time_until_vblank_start(), NULL, 0, vblank_interrupt_callback);
533   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(248), FUNC(level_1_interrupt_callback));
534   machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_start(), FUNC(vblank_interrupt_callback));
535535   timer_adjust_oneshot(state->raster_interrupt_timer, machine->primary_screen->time_until_pos(0, visarea.max_x + 1), 0);
536536}
537537
src/mame/drivers/rabbit.c
r10315r10316
633633            if (!blt_amount)
634634            {
635635               if(BLITLOG) mame_printf_debug("end of blit list\n");
636               timer_set(machine, attotime::from_usec(500), NULL,0,rabbit_blit_done);
636               machine->scheduler().timer_set(attotime::from_usec(500), FUNC(rabbit_blit_done));
637637               return;
638638            }
639639
src/mame/drivers/asuka.c
r10315r10316
238238
239239static INTERRUPT_GEN( cadash_interrupt )
240240{
241   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(500), NULL, 0, cadash_interrupt5);
241   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(500), FUNC(cadash_interrupt5));
242242   cpu_set_input_line(device, 4, HOLD_LINE);  /* interrupt vector 4 */
243243}
244244
src/mame/drivers/rollerg.c
r10315r10316
7272{
7373   rollerg_state *state = space->machine->driver_data<rollerg_state>();
7474   cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
75   timer_set(space->machine, attotime::from_usec(50), NULL, 0, nmi_callback);   /* kludge until the K053260 is emulated correctly */
75   space->machine->scheduler().timer_set(attotime::from_usec(50), FUNC(nmi_callback));   /* kludge until the K053260 is emulated correctly */
7676}
7777
7878static READ8_HANDLER( pip_r )
src/mame/drivers/wolfpack.c
r10315r10316
2020   if (scanline >= 262)
2121      scanline = 0;
2222
23   timer_set(machine, machine->primary_screen->time_until_pos(scanline), NULL, scanline, periodic_callback);
23   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(scanline), FUNC(periodic_callback), scanline);
2424}
2525
2626
2727static MACHINE_RESET( wolfpack )
2828{
29   timer_set(machine, machine->primary_screen->time_until_pos(0), NULL, 0, periodic_callback);
29   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(0), FUNC(periodic_callback));
3030}
3131
3232
src/mame/drivers/nmk16.c
r10315r10316
39873987   MCFG_OKIM6295_ADD("oki1", 8000000/8, OKIM6295_PIN7_HIGH) /* 1 Mhz, pin 7 high */
39883988   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
39893989
3990   MCFG_NMK112_ADD("nmk112", nmk16_nmk112_intf)
39913990MACHINE_CONFIG_END
39923991
39933992static MACHINE_CONFIG_START( strahl, driver_device )
src/mame/drivers/m10.c
r10315r10316
520520   if (param == 0)
521521   {
522522      cpu_set_input_line(state->maincpu, 0, ASSERT_LINE);
523      timer_set(machine, machine->primary_screen->time_until_pos(IREMM10_VBSTART + 16), NULL, 1, interrupt_callback);
523      machine->scheduler().timer_set(machine->primary_screen->time_until_pos(IREMM10_VBSTART + 16), FUNC(interrupt_callback), 1);
524524   }
525525   if (param == 1)
526526   {
527527      cpu_set_input_line(state->maincpu, 0, ASSERT_LINE);
528      timer_set(machine, machine->primary_screen->time_until_pos(IREMM10_VBSTART + 24), NULL, 2, interrupt_callback);
528      machine->scheduler().timer_set(machine->primary_screen->time_until_pos(IREMM10_VBSTART + 24), FUNC(interrupt_callback), 2);
529529   }
530530   if (param == -1)
531531      cpu_set_input_line(state->maincpu, 0, CLEAR_LINE);
r10315r10316
536536static INTERRUPT_GEN( m11_interrupt )
537537{
538538   cpu_set_input_line(device, 0, ASSERT_LINE);
539   //timer_set(device->machine, machine->primary_screen->time_until_pos(IREMM10_VBEND), NULL, -1, interrupt_callback);
539   //device->machine->scheduler().timer_set(machine->primary_screen->time_until_pos(IREMM10_VBEND), FUNC(interrupt_callback), -1);
540540}
541541
542542static INTERRUPT_GEN( m10_interrupt )
r10315r10316
548548static INTERRUPT_GEN( m15_interrupt )
549549{
550550   cpu_set_input_line(device, 0, ASSERT_LINE);
551   timer_set(device->machine, device->machine->primary_screen->time_until_pos(IREMM10_VBSTART + 1, 80), NULL, -1, interrupt_callback);
551   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(IREMM10_VBSTART + 1, 80), FUNC(interrupt_callback), -1);
552552}
553553
554554/*************************************
src/osd/osdmini/minimain.c
r10315r10316
179179   primlist.release_lock();
180180
181181   // after 5 seconds, exit
182   if (timer_get_time(&machine()) > attotime::from_seconds(5))
182   if (machine().time() > attotime::from_seconds(5))
183183      machine().schedule_exit();
184184}
185185
src/emu/debug/debugcpu.c
r10315r10316
19061906   if (global->execution_state != EXECUTION_STATE_STOPPED && (m_flags & (DEBUG_FLAG_STOP_TIME | DEBUG_FLAG_STOP_PC | DEBUG_FLAG_LIVE_BP)) != 0)
19071907   {
19081908      // see if we hit a target time
1909      if ((m_flags & DEBUG_FLAG_STOP_TIME) != 0 && timer_get_time(&machine) >= m_stoptime)
1909      if ((m_flags & DEBUG_FLAG_STOP_TIME) != 0 && machine.time() >= m_stoptime)
19101910      {
1911         debug_console_printf(&machine, "Stopped at time interval %.1g\n", timer_get_time(&machine).as_double());
1911         debug_console_printf(&machine, "Stopped at time interval %.1g\n", machine.time().as_double());
19121912         global->execution_state = EXECUTION_STATE_STOPPED;
19131913      }
19141914
r10315r10316
22222222
22232223   assert(m_exec != NULL);
22242224
2225   m_stoptime = timer_get_time(m_device.machine) + attotime::from_msec(milliseconds);
2225   m_stoptime = m_device.machine->time() + attotime::from_msec(milliseconds);
22262226   m_flags |= DEBUG_FLAG_STOP_TIME;
22272227   global->execution_state = EXECUTION_STATE_RUNNING;
22282228}
src/emu/cpu/h83002/h8_8.c
r10315r10316
241241   h8->direct = &h8->program->direct();
242242   h8->io = device->space(AS_IO);
243243
244   h8->timer[0] = timer_alloc(h8->device->machine, h8_timer_0_cb, h8);
245   h8->timer[1] = timer_alloc(h8->device->machine, h8_timer_1_cb, h8);
246   h8->timer[2] = timer_alloc(h8->device->machine, h8_timer_2_cb, h8);
247   h8->timer[3] = timer_alloc(h8->device->machine, h8_timer_3_cb, h8);
244   h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_0_cb), h8);
245   h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_1_cb), h8);
246   h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_2_cb), h8);
247   h8->timer[3] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_3_cb), h8);
248248
249249   state_save_register_device_item(device, 0, h8->h8err);
250250   state_save_register_device_item_array(device, 0, h8->regs);
src/emu/cpu/h83002/h8periph.c
r10315r10316
766766
767767void h8_3007_itu_init(h83xx_state *h8)
768768{
769   h8->timer[0] = timer_alloc(h8->device->machine, h8itu_3007_timer_0_cb, h8);
770   h8->timer[1] = timer_alloc(h8->device->machine, h8itu_3007_timer_1_cb, h8);
771   h8->timer[2] = timer_alloc(h8->device->machine, h8itu_3007_timer_2_cb, h8);
769   h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_0_cb), h8);
770   h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_1_cb), h8);
771   h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_2_cb), h8);
772772
773773   h8_itu_reset(h8);
774774}
775775
776776void h8_itu_init(h83xx_state *h8)
777777{
778   h8->timer[0] = timer_alloc(h8->device->machine, h8itu_timer_0_cb, h8);
779   h8->timer[1] = timer_alloc(h8->device->machine, h8itu_timer_1_cb, h8);
780   h8->timer[2] = timer_alloc(h8->device->machine, h8itu_timer_2_cb, h8);
781   h8->timer[3] = timer_alloc(h8->device->machine, h8itu_timer_3_cb, h8);
782   h8->timer[4] = timer_alloc(h8->device->machine, h8itu_timer_4_cb, h8);
778   h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_0_cb), h8);
779   h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_1_cb), h8);
780   h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_2_cb), h8);
781   h8->timer[3] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_3_cb), h8);
782   h8->timer[4] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_4_cb), h8);
783783
784784   h8_itu_reset(h8);
785785}
src/emu/cpu/tms34010/tms34010.c
r10315r10316
652652   }
653653
654654   /* allocate a scanline timer and set it to go off at the start */
655   tms->scantimer = timer_alloc(device->machine, scanline_callback, tms);
655   tms->scantimer = device->machine->scheduler().timer_alloc(FUNC(scanline_callback), tms);
656656   timer_adjust_oneshot(tms->scantimer, attotime::zero, 0);
657657
658658   /* allocate the shiftreg */
r10315r10316
12001200
12011201         /* NMI issued? */
12021202         if (data & 0x0100)
1203            timer_call_after_resynch(tms->device->machine, tms, 0, internal_interrupt_callback);
1203            tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms);
12041204         break;
12051205
12061206      case REG_HSTCTLL:
r10315r10316
12351235
12361236         /* input interrupt? (should really be state-based, but the functions don't exist!) */
12371237         if (!(oldreg & 0x0008) && (newreg & 0x0008))
1238            timer_call_after_resynch(tms->device->machine, tms, TMS34010_HI, internal_interrupt_callback);
1238            tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms);
12391239         else if ((oldreg & 0x0008) && !(newreg & 0x0008))
12401240            IOREG(tms, REG_INTPEND) &= ~TMS34010_HI;
12411241         break;
r10315r10316
13511351
13521352         /* NMI issued? */
13531353         if (data & 0x0100)
1354            timer_call_after_resynch(tms->device->machine, tms, 0, internal_interrupt_callback);
1354            tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms);
13551355         break;
13561356
13571357      case REG020_HSTCTLL:
r10315r10316
13861386
13871387         /* input interrupt? (should really be state-based, but the functions don't exist!) */
13881388         if (!(oldreg & 0x0008) && (newreg & 0x0008))
1389            timer_call_after_resynch(tms->device->machine, tms, TMS34010_HI, internal_interrupt_callback);
1389            tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms);
13901390         else if ((oldreg & 0x0008) && !(newreg & 0x0008))
13911391            IOREG(tms, REG020_INTPEND) &= ~TMS34010_HI;
13921392         break;
src/emu/cpu/mcs48/mcs48.c
r10315r10316
12151215void upi41_master_w(device_t *_device, UINT8 a0, UINT8 data)
12161216{
12171217   legacy_cpu_device *device = downcast<legacy_cpu_device *>(_device);
1218   timer_call_after_resynch(device->machine, (void *)device, (a0 << 8) | data, master_callback);
1218   device->machine->scheduler().synchronize(FUNC(master_callback), (a0 << 8) | data, (void *)device);
12191219}
12201220
12211221
src/emu/cpu/m37710/m37710.c
r10315r10316
906906   cpustate->destination = 0;
907907
908908   for (i = 0; i < 8; i++)
909      cpustate->timers[i] = timer_alloc(device->machine, m37710_timer_cb, cpustate);
909      cpustate->timers[i] = device->machine->scheduler().timer_alloc(FUNC(m37710_timer_cb), cpustate);
910910
911911   state_save_register_device_item(device, 0, cpustate->a);
912912   state_save_register_device_item(device, 0, cpustate->b);
src/emu/cpu/sc61860/sc61860.c
r10315r10316
104104{
105105   sc61860_state *cpustate = get_safe_token(device);
106106   cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config();
107   timer_pulse(device->machine, attotime::from_hz(500), cpustate, 0, sc61860_2ms_tick);
107   device->machine->scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate);
108108   cpustate->device = device;
109109   cpustate->program = device->space(AS_PROGRAM);
110110   cpustate->direct = &cpustate->program->direct();
src/emu/cpu/tlcs90/tlcs90.c
r10315r10316
27252725   // Timers
27262726
27272727   for (i = 0; i < 4; i++)
2728      cpustate->timer[i] = timer_alloc(device->machine, t90_timer_callback, cpustate);
2728      cpustate->timer[i] = device->machine->scheduler().timer_alloc(FUNC(t90_timer_callback), cpustate);
27292729
2730   cpustate->timer[4] = timer_alloc(device->machine, t90_timer4_callback, cpustate);
2730   cpustate->timer[4] = device->machine->scheduler().timer_alloc(FUNC(t90_timer4_callback), cpustate);
27312731}
27322732
27332733static ADDRESS_MAP_START(tmp90840_mem, ADDRESS_SPACE_PROGRAM, 8)
src/emu/cpu/e132xs/e132xs.c
r10315r10316
15461546   cpustate->program = device->space(AS_PROGRAM);
15471547   cpustate->direct = &cpustate->program->direct();
15481548   cpustate->io = device->space(AS_IO);
1549   cpustate->timer = timer_alloc(device->machine, e132xs_timer_callback, (void *)device);
1549   cpustate->timer = device->machine->scheduler().timer_alloc(FUNC(e132xs_timer_callback), (void *)device);
15501550   cpustate->clock_scale_mask = scale_mask;
15511551}
15521552
src/emu/cpu/cop400/cop400.c
r10315r10316
886886
887887   /* allocate serial timer */
888888
889   cpustate->serial_timer = timer_alloc(device->machine, serial_tick, cpustate);
889   cpustate->serial_timer = device->machine->scheduler().timer_alloc(FUNC(serial_tick), cpustate);
890890   timer_adjust_periodic(cpustate->serial_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
891891
892892   /* allocate counter timer */
893893
894894   if (has_counter)
895895   {
896      cpustate->counter_timer = timer_alloc(device->machine, counter_tick, cpustate);
896      cpustate->counter_timer = device->machine->scheduler().timer_alloc(FUNC(counter_tick), cpustate);
897897      timer_adjust_periodic(cpustate->counter_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16 / 4));
898898   }
899899
r10315r10316
901901
902902   if (has_inil)
903903   {
904      cpustate->inil_timer = timer_alloc(device->machine, inil_tick, cpustate);
904      cpustate->inil_timer = device->machine->scheduler().timer_alloc(FUNC(inil_tick), cpustate);
905905      timer_adjust_periodic(cpustate->inil_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
906906   }
907907
r10315r10316
909909
910910   if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED)
911911   {
912      cpustate->microbus_timer = timer_alloc(device->machine, microbus_tick, cpustate);
912      cpustate->microbus_timer = device->machine->scheduler().timer_alloc(FUNC(microbus_tick), cpustate);
913913      timer_adjust_periodic(cpustate->microbus_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
914914   }
915915
src/emu/cpu/powerpc/ppccom.c
r10315r10316
328328
329329   /* allocate a timer for the compare interrupt */
330330   if ((cap & PPCCAP_OEA) && (ppc->tb_divisor))
331      ppc->decrementer_int_timer = timer_alloc(device->machine, decrementer_int_callback, ppc);
331      ppc->decrementer_int_timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_int_callback), ppc);
332332
333333   /* and for the 4XX interrupts if needed */
334334   if (cap & PPCCAP_4XX)
335335   {
336      ppc->fit_timer = timer_alloc(device->machine, ppc4xx_fit_callback, ppc);
337      ppc->pit_timer = timer_alloc(device->machine, ppc4xx_pit_callback, ppc);
338      ppc->spu.timer = timer_alloc(device->machine, ppc4xx_spu_callback, ppc);
336      ppc->fit_timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_fit_callback), ppc);
337      ppc->pit_timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_pit_callback), ppc);
338      ppc->spu.timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_spu_callback), ppc);
339339   }
340340
341341   /* register for save states */
src/emu/cpu/powerpc/ppc.c
r10315r10316
947947   // !!! why is rfci here !!!
948948   ppc.optable19[51] = ppc_rfci;
949949
950   ppc.spu.rx_timer = timer_alloc(device->machine, ppc403_spu_rx_callback, NULL);
951   ppc.spu.tx_timer = timer_alloc(device->machine, ppc403_spu_tx_callback, NULL);
950   ppc.spu.rx_timer = device->machine->scheduler().timer_alloc(FUNC(ppc403_spu_rx_callback));
951   ppc.spu.tx_timer = device->machine->scheduler().timer_alloc(FUNC(ppc403_spu_tx_callback));
952952
953953   ppc.read8 = ppc403_read8;
954954   ppc.read16 = ppc403_read16;
src/emu/cpu/lr35902/lr35902.c
r10315r10316
4747#define FLAG_C  0x10
4848
4949#define CYCLES_PASSED(X)      cpustate->w.icount -= ((X) / (cpustate->w.gb_speed));   \
50               if ( cpustate->w.timer_fired_func ) {         \
51                  cpustate->w.timer_fired_func( cpustate->w.device, X );      \
50               if ( cpustate->w.timer_expired_func ) {         \
51                  cpustate->w.timer_expired_func( cpustate->w.device, X );      \
5252               }
5353
5454typedef struct {
r10315r10316
6969   address_space *program;
7070   int icount;
7171   /* Timer stuff */
72   lr35902_timer_fired_func timer_fired_func;
72   lr35902_timer_fired_func timer_expired_func;
7373   /* Fetch & execute related */
7474   int      execution_state;
7575   UINT8   op;
r10315r10316
210210   cpustate->w.HL = 0x0000;
211211   cpustate->w.SP = 0x0000;
212212   cpustate->w.PC = 0x0000;
213   cpustate->w.timer_fired_func = NULL;
213   cpustate->w.timer_expired_func = NULL;
214214   cpustate->w.features = LR35902_FEATURE_HALT_BUG;
215215   if (cpustate->w.config)
216216   {
r10315r10316
222222         cpustate->w.SP = cpustate->w.config->regs[4];
223223         cpustate->w.PC = cpustate->w.config->regs[5];
224224      }
225      cpustate->w.timer_fired_func = cpustate->w.config->timer_fired_func;
225      cpustate->w.timer_expired_func = cpustate->w.config->timer_expired_func;
226226      cpustate->w.features = cpustate->w.config->features;
227227   }
228228   cpustate->w.enable = 0;
src/emu/cpu/lr35902/lr35902.h
r10315r10316
1111{
1212   const UINT16   *regs;
1313   UINT8         features;
14   lr35902_timer_fired_func timer_fired_func;
14   lr35902_timer_fired_func timer_expired_func;
1515};
1616
1717enum
src/emu/cpu/sh2/sh2comn.c
r10315r10316
923923   const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config();
924924   int i;
925925
926   sh2->timer = timer_alloc(device->machine, sh2_timer_callback, sh2);
926   sh2->timer = device->machine->scheduler().timer_alloc(FUNC(sh2_timer_callback), sh2);
927927   timer_adjust_oneshot(sh2->timer, attotime::never, 0);
928928
929   sh2->dma_current_active_timer[0] = timer_alloc(device->machine, sh2_dma_current_active_callback, sh2);
929   sh2->dma_current_active_timer[0] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
930930   timer_adjust_oneshot(sh2->dma_current_active_timer[0], attotime::never, 0);
931931
932   sh2->dma_current_active_timer[1] = timer_alloc(device->machine, sh2_dma_current_active_callback, sh2);
932   sh2->dma_current_active_timer[1] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
933933   timer_adjust_oneshot(sh2->dma_current_active_timer[1], attotime::never, 0);
934934
935935
src/emu/cpu/mn10200/mn10200.c
r10315r10316
295295
296296   for (tmr = 0; tmr < NUM_TIMERS_8BIT; tmr++)
297297   {
298      cpustate->timer_timers[tmr] = timer_alloc(device->machine, simple_timer_cb, cpustate);
298      cpustate->timer_timers[tmr] = device->machine->scheduler().timer_alloc(FUNC(simple_timer_cb), cpustate);
299299      timer_adjust_oneshot(cpustate->timer_timers[tmr], attotime::never, tmr);
300300   }
301301}
src/emu/cpu/mb88xx/mb88xx.c
r10315r10316
149149   cpustate->data = device->space(AS_DATA);
150150   cpustate->io = device->space(AS_IO);
151151
152   cpustate->serial = timer_alloc(device->machine, serial_timer, (void *)device);
152   cpustate->serial = device->machine->scheduler().timer_alloc(FUNC(serial_timer), (void *)device);
153153
154154   state_save_register_device_item(device, 0, cpustate->PC);
155155   state_save_register_device_item(device, 0, cpustate->PA);
src/emu/cpu/sh4/sh4comn.c
r10315r10316
11601160
11611161   for (i=0; i<3; i++)
11621162   {
1163      sh4->timer[i] = timer_alloc(device->machine, sh4_timer_callback, sh4);
1163      sh4->timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_timer_callback), sh4);
11641164      timer_adjust_oneshot(sh4->timer[i], attotime::never, i);
11651165   }
11661166
11671167   for (i=0; i<4; i++)
11681168   {
1169      sh4->dma_timer[i] = timer_alloc(device->machine, sh4_dmac_callback, sh4);
1169      sh4->dma_timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_dmac_callback), sh4);
11701170      timer_adjust_oneshot(sh4->dma_timer[i], attotime::never, i);
11711171   }
11721172
1173   sh4->refresh_timer = timer_alloc(device->machine, sh4_refresh_timer_callback, sh4);
1173   sh4->refresh_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_refresh_timer_callback), sh4);
11741174   timer_adjust_oneshot(sh4->refresh_timer, attotime::never, 0);
11751175   sh4->refresh_timer_base = 0;
11761176
1177   sh4->rtc_timer = timer_alloc(device->machine, sh4_rtc_timer_callback, sh4);
1177   sh4->rtc_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_rtc_timer_callback), sh4);
11781178   timer_adjust_oneshot(sh4->rtc_timer, attotime::never, 0);
11791179
11801180   sh4->m = auto_alloc_array(device->machine, UINT32, 16384);
src/emu/cpu/nec/v25.c
r10315r10316
430430   nec_state->config = config;
431431
432432   for (int i = 0; i < 4; i++)
433      nec_state->timers[i] = timer_alloc(device->machine, v25_timer_callback, nec_state);
433      nec_state->timers[i] = device->machine->scheduler().timer_alloc(FUNC(v25_timer_callback), nec_state);
434434
435435   state_save_register_device_item_array(device, 0, nec_state->ram.w);
436436   state_save_register_device_item_array(device, 0, nec_state->intp_state);
src/emu/cpu/mips/mips3com.c
r10315r10316
105105   mips->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, 2 * mips->tlbentries + 2, 0);
106106
107107   /* allocate a timer for the compare interrupt */
108   mips->compare_int_timer = timer_alloc(device->machine, compare_int_callback, (void *)device);
108   mips->compare_int_timer = device->machine->scheduler().timer_alloc(FUNC(compare_int_callback), (void *)device);
109109
110110   /* reset the state */
111111   mips3com_reset(mips);
src/emu/cpu/tms9900/99xxcore.h
r10315r10316
12981298   cpustate->io = device->space(AS_IO);
12991299
13001300#if (TMS99XX_MODEL == TMS9995_ID)
1301   cpustate->timer = timer_alloc(device->machine, decrementer_callback, cpustate);
1301   cpustate->timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_callback), cpustate);
13021302#endif
13031303
13041304   cpustate->idle_callback = param ? param->idle_callback : NULL;
src/emu/cpu/hd61700/hd61700.c
r10315r10316
168168{
169169   m_program = this->space(AS_PROGRAM);
170170
171   m_sec_timer = device_timer_alloc(*this, SEC_TIMER);
171   m_sec_timer = timer_alloc(SEC_TIMER);
172172   timer_adjust_periodic(m_sec_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
173173
174174   // save state
src/emu/cpu/z8/z8.c
r10315r10316
669669   cpustate->io = device->space(AS_IO);
670670
671671   /* allocate timers */
672   cpustate->t0_timer = timer_alloc(device->machine, t0_tick, cpustate);
673   cpustate->t1_timer = timer_alloc(device->machine, t1_tick, cpustate);
672   cpustate->t0_timer = device->machine->scheduler().timer_alloc(FUNC(t0_tick), cpustate);
673   cpustate->t1_timer = device->machine->scheduler().timer_alloc(FUNC(t1_tick), cpustate);
674674
675675   /* register for state saving */
676676   state_save_register_device_item(device, 0, cpustate->pc);
src/emu/cpu/m6800/m6800.c
r10315r10316
12011201   cpustate->io = device->space(AS_IO);
12021202
12031203   cpustate->clock = device->clock() / 4;
1204   cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
1204   cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate);
12051205
12061206   state_register(cpustate, "m6801");
12071207
r10315r10316
12511251   cpustate->io = device->space(AS_IO);
12521252
12531253   cpustate->clock = device->clock() / 4;
1254   cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
1254   cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate);
12551255
12561256   state_register(cpustate, "m6803");
12571257
r10315r10316
13091309   cpustate->io = device->space(AS_IO);
13101310
13111311   cpustate->clock = device->clock() / 4;
1312   cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
1312   cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate);
13131313
13141314   state_register(cpustate, "hd63701");
13151315}
src/emu/video/pc_vga.c
r10315r10316
781781         int clock=vga.monitor.get_clock();
782782         int lines=vga.monitor.get_lines();
783783         int columns=vga.monitor.get_columns();
784         int diff = (((timer_get_time(space->machine) - vga.monitor.start_time) * clock).seconds)
784         int diff = (((space->machine->time() - vga.monitor.start_time) * clock).seconds)
785785            %(lines*columns);
786786         if (diff<columns*vga.monitor.get_sync_lines()) data|=8;
787787         diff=diff/lines;
r10315r10316
791791      if (vga.monitor.retrace)
792792      {
793793         data |= 1;
794         if ((timer_get_time(space->machine) - vga.monitor.start_time) > attotime::from_usec(300))
794         if ((space->machine->time() - vga.monitor.start_time) > attotime::from_usec(300))
795795         {
796796            data |= 8;
797797            vga.monitor.retrace=0;
r10315r10316
799799      }
800800      else
801801      {
802         if ((timer_get_time(space->machine) - vga.monitor.start_time) > attotime::from_msec(15))
802         if ((space->machine->time() - vga.monitor.start_time) > attotime::from_msec(15))
803803            vga.monitor.retrace=1;
804         vga.monitor.start_time=timer_get_time(space->machine);
804         vga.monitor.start_time=space->machine->time();
805805      }
806806#else
807807      // not working with ps2m30
r10315r10316
10561056         vga_cpu_interface(space->machine);
10571057
10581058         if (vga.sequencer.index == 0)
1059            vga.monitor.start_time = timer_get_time(space->machine);
1059            vga.monitor.start_time = space->machine->time();
10601060      }
10611061      break;
10621062   case 6:
r10315r10316
13251325   vga.monitor.get_columns = ega_get_crtc_columns;
13261326   vga.monitor.get_sync_lines = vga_get_crtc_sync_lines;
13271327   vga.monitor.get_sync_columns = vga_get_crtc_sync_columns;
1328   timer_pulse(machine, attotime::from_hz(60), NULL, 0, vga_timer);
1328   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer));
13291329   pc_video_start(machine, pc_ega_choosevideomode, 0);
13301330}
13311331
r10315r10316
13401340   vga.monitor.get_columns=vga_get_crtc_columns;
13411341   vga.monitor.get_sync_lines=vga_get_crtc_sync_lines;
13421342   vga.monitor.get_sync_columns=vga_get_crtc_sync_columns;
1343   timer_pulse(machine, attotime::from_hz(60), NULL, 0, vga_timer);
1343   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer));
13441344   pc_video_start(machine, pc_vga_choosevideomode, 0);
13451345}
13461346
src/emu/video/tms34061.c
r10315r10316
119119   tms34061.regs[TMS34061_VERCOUNTER]   = 0x0000;
120120
121121   /* start vertical interrupt timer */
122   tms34061.timer = timer_alloc(machine, tms34061_interrupt, NULL);
122   tms34061.timer = machine->scheduler().timer_alloc(FUNC(tms34061_interrupt));
123123}
124124
125125
src/emu/video/mc6845.c
r10315r10316
208208   mc6845_t *mc6845 = get_safe_token(device);
209209
210210   if (mc6845->intf->on_update_addr_changed)
211      timer_set(device->machine, attotime::zero, (void *) device, (mc6845->update_addr << 8) | strobe, on_update_address_cb);
211      device->machine->scheduler().timer_set(attotime::zero, FUNC(on_update_address_cb), (mc6845->update_addr << 8) | strobe, (void *) device);
212212   else
213213      fatalerror("M6845: transparent memory mode without handler\n");
214214}
r10315r10316
889889         mc6845->screen = NULL;
890890
891891      /* create the timers */
892      mc6845->line_timer = timer_alloc(device->machine, line_timer_cb, (void *)device);
892      mc6845->line_timer = device->machine->scheduler().timer_alloc(FUNC(line_timer_cb), (void *)device);
893893
894      mc6845->de_off_timer = timer_alloc(device->machine, de_off_timer_cb, (void *)device);
895      mc6845->upd_adr_timer = timer_alloc(device->machine, upd_adr_timer_cb, (void *)device);
894      mc6845->de_off_timer = device->machine->scheduler().timer_alloc(FUNC(de_off_timer_cb), (void *)device);
895      mc6845->upd_adr_timer = device->machine->scheduler().timer_alloc(FUNC(upd_adr_timer_cb), (void *)device);
896896
897      mc6845->cur_on_timer = timer_alloc(device->machine, cur_on_timer_cb, (void *)device);
898      mc6845->cur_off_timer = timer_alloc(device->machine, cur_off_timer_cb, (void *)device);
897      mc6845->cur_on_timer = device->machine->scheduler().timer_alloc(FUNC(cur_on_timer_cb), (void *)device);
898      mc6845->cur_off_timer = device->machine->scheduler().timer_alloc(FUNC(cur_off_timer_cb), (void *)device);
899899
900      mc6845->hsync_on_timer = timer_alloc(device->machine, hsync_on_timer_cb, (void *)device);
901      mc6845->hsync_off_timer = timer_alloc(device->machine, hsync_off_timer_cb, (void *)device);
900      mc6845->hsync_on_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_on_timer_cb), (void *)device);
901      mc6845->hsync_off_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_off_timer_cb), (void *)device);
902902   }
903903
904   mc6845->light_pen_latch_timer = timer_alloc(device->machine, light_pen_latch_timer_cb, (void *)device);
904   mc6845->light_pen_latch_timer = device->machine->scheduler().timer_alloc(FUNC(light_pen_latch_timer_cb), (void *)device);
905905
906906   /* Use some large startup values */
907907   mc6845->horiz_char_total = 0xff;
src/emu/video/voodoo.c
r10315r10316
523523   }
524524
525525   /* allocate a VBLANK timer */
526   f->vblank_timer = timer_alloc(v->device->machine, vblank_callback, v);
526   f->vblank_timer = v->device->machine->scheduler().timer_alloc(FUNC(vblank_callback), v);
527527   f->vblank = FALSE;
528528
529529   /* initialize the memory FIFO */
r10315r10316
911911   /* reset the last_op_time to now and start processing the next command */
912912   if (v->pci.op_pending)
913913   {
914      v->pci.op_end_time = timer_get_time(v->device->machine);
914      v->pci.op_end_time = v->device->machine->time();
915915      flush_fifos(v, v->pci.op_end_time);
916916   }
917917
918918   /* we may be able to unstall now */
919919   if (v->pci.stall_state != NOT_STALLED)
920      check_stalled_cpu(v, timer_get_time(v->device->machine));
920      check_stalled_cpu(v, v->device->machine->time());
921921
922922   /* periodically log rasterizer info */
923923   v->stats.swaps++;
r10315r10316
10161016   if (v->pci.op_pending)
10171017   {
10181018      if (LOG_VBLANK_SWAP) logerror("---- vblank flush begin\n");
1019      flush_fifos(v, timer_get_time(machine));
1019      flush_fifos(v, machine->time());
10201020      if (LOG_VBLANK_SWAP) logerror("---- vblank flush end\n");
10211021   }
10221022
r10315r10316
10341034      swap_buffers(v);
10351035
10361036   /* set a timer for the next off state */
1037   timer_set(machine, v->screen->time_until_pos(0), v, 0, vblank_off_callback);
1037   machine->scheduler().timer_set(v->screen->time_until_pos(0), FUNC(vblank_off_callback), 0, v);
10381038
10391039   /* set internal state and call the client */
10401040   v->fbi.vblank = TRUE;
r10315r10316
20032003      if (cycles > 0)
20042004      {
20052005         v->pci.op_pending = TRUE;
2006         v->pci.op_end_time = timer_get_time(v->device->machine) + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle);
2006         v->pci.op_end_time = v->device->machine->time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle);
20072007
20082008         if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index,
2009            timer_get_time(v->device->machine).seconds, (UINT32)(timer_get_time(v->device->machine).attoseconds >> 32), (UINT32)timer_get_time(v->device->machine).attoseconds,
2009            v->device->machine->time().seconds, (UINT32)(v->device->machine->time().attoseconds >> 32), (UINT32)v->device->machine->time().attoseconds,
20102010            v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds);
20112011      }
20122012   }
r10315r10316
20232023
20242024static TIMER_CALLBACK( stall_cpu_callback )
20252025{
2026   check_stalled_cpu((voodoo_state *)ptr, timer_get_time(machine));
2026   check_stalled_cpu((voodoo_state *)ptr, machine->time());
20272027}
20282028
20292029
r10315r10316
34643464
34653465   /* if we have something pending, flush the FIFOs up to the current time */
34663466   if (v->pci.op_pending)
3467      flush_fifos(v, timer_get_time(device->machine));
3467      flush_fifos(v, device->machine->time());
34683468
34693469   /* special handling for registers */
34703470   if ((offset & 0xc00000/4) == 0)
r10315r10316
35443544      if (cycles)
35453545      {
35463546         v->pci.op_pending = TRUE;
3547         v->pci.op_end_time = timer_get_time(device->machine) + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle);
3547         v->pci.op_end_time = device->machine->time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle);
35483548
35493549         if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index,
3550            timer_get_time(device->machine).seconds, (UINT32)(timer_get_time(device->machine).attoseconds >> 32), (UINT32)timer_get_time(device->machine).attoseconds,
3550            device->machine->time().seconds, (UINT32)(device->machine->time().attoseconds >> 32), (UINT32)device->machine->time().attoseconds,
35513551            v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds);
35523552      }
35533553      g_profiler.stop();
r10315r10316
35973597         fifo_items(&v->fbi.fifo) >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(v->reg[fbiInit0].u))
35983598      {
35993599         if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", v->index);
3600         stall_cpu(v, STALLED_UNTIL_FIFO_LWM, timer_get_time(device->machine));
3600         stall_cpu(v, STALLED_UNTIL_FIFO_LWM, device->machine->time());
36013601      }
36023602   }
36033603
r10315r10316
36063606      fifo_space(&v->pci.fifo) <= 2 * FBIINIT0_PCI_FIFO_LWM(v->reg[fbiInit0].u))
36073607   {
36083608      if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", v->index);
3609      stall_cpu(v, STALLED_UNTIL_FIFO_LWM, timer_get_time(device->machine));
3609      stall_cpu(v, STALLED_UNTIL_FIFO_LWM, device->machine->time());
36103610   }
36113611
36123612   /* if we weren't ready, and this is a non-FIFO access, stall until the FIFOs are clear */
36133613   if (stall)
36143614   {
36153615      if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n", v->index);
3616      stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, timer_get_time(device->machine));
3616      stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, device->machine->time());
36173617   }
36183618
36193619   g_profiler.stop();
r10315r10316
38913891
38923892   /* if we have something pending, flush the FIFOs up to the current time */
38933893   if (v->pci.op_pending)
3894      flush_fifos(v, timer_get_time(device->machine));
3894      flush_fifos(v, device->machine->time());
38953895
38963896   /* target the appropriate location */
38973897   if (!(offset & (0xc00000/4)))
r10315r10316
39793979
39803980   /* if we have something pending, flush the FIFOs up to the current time */
39813981   if (v->pci.op_pending)
3982      flush_fifos(v, timer_get_time(device->machine));
3982      flush_fifos(v, device->machine->time());
39833983
39843984   if (offset < 0x80000/4)
39853985      result = banshee_io_r(device, offset, mem_mask);
r10315r10316
40134013
40144014   /* if we have something pending, flush the FIFOs up to the current time */
40154015   if (v->pci.op_pending)
4016      flush_fifos(v, timer_get_time(device->machine));
4016      flush_fifos(v, device->machine->time());
40174017
40184018   if (offset < v->fbi.lfb_base)
40194019   {
r10315r10316
42744274
42754275   /* if we have something pending, flush the FIFOs up to the current time */
42764276   if (v->pci.op_pending)
4277      flush_fifos(v, timer_get_time(device->machine));
4277      flush_fifos(v, device->machine->time());
42784278
42794279   if (offset < 0x80000/4)
42804280      banshee_io_w(device, offset, data, mem_mask);
r10315r10316
43074307
43084308   /* if we have something pending, flush the FIFOs up to the current time */
43094309   if (v->pci.op_pending)
4310      flush_fifos(v, timer_get_time(device->machine));
4310      flush_fifos(v, device->machine->time());
43114311
43124312   if (offset < v->fbi.lfb_base)
43134313   {
r10315r10316
45954595   v->pci.fifo.size = 64*2;
45964596   v->pci.fifo.in = v->pci.fifo.out = 0;
45974597   v->pci.stall_state = NOT_STALLED;
4598   v->pci.continue_timer = timer_alloc(v->device->machine, stall_cpu_callback, v);
4598   v->pci.continue_timer = v->device->machine->scheduler().timer_alloc(FUNC(stall_cpu_callback), v);
45994599
46004600   /* allocate memory */
46014601   tmumem0 = config->tmumem0;
src/emu/uimenu.c
r10315r10316
24382438   prevtime = (attotime *)state;
24392439
24402440   /* if the time has rolled over another second, regenerate */
2441   curtime = timer_get_time(machine);
2441   curtime = machine->time();
24422442   if (prevtime->seconds != curtime.seconds)
24432443   {
24442444      ui_menu_reset(menu, UI_MENU_RESET_SELECT_FIRST);
src/emu/video.c
r10315r10316
180180   // if no screens, create a periodic timer to drive updates
181181   if (machine.primary_screen == NULL)
182182   {
183      m_screenless_frame_timer = timer_alloc(&machine, &screenless_update_callback, this);
183      m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(&screenless_update_callback), this);
184184      timer_adjust_periodic(m_screenless_frame_timer, screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD);
185185   }
186186}
r10315r10316
240240   debugint_update_during_game(&m_machine);
241241
242242   // if we're throttling, synchronize before rendering
243   attotime current_time = timer_get_time(&m_machine);
243   attotime current_time = m_machine.time();
244244   if (!debug && !skipped_it && effective_throttle())
245245      update_throttle(current_time);
246246
r10315r10316
403403
404404   // reset the state
405405   m_movie_frame = 0;
406   m_movie_next_frame_time = timer_get_time(&m_machine);
406   m_movie_next_frame_time = m_machine.time();
407407
408408   // start up an AVI recording
409409   if (format == MF_AVI)
r10315r10316
576576
577577void video_manager::postload()
578578{
579   m_movie_next_frame_time = timer_get_time(&m_machine);
579   m_movie_next_frame_time = m_machine.time();
580580}
581581
582582
r10315r10316
12291229
12301230   // start the profiler and get the current time
12311231   g_profiler.start(PROFILER_MOVIE_REC);
1232   attotime curtime = timer_get_time(&m_machine);
1232   attotime curtime = m_machine.time();
12331233
12341234   // create the bitmap
12351235   create_snapshot_bitmap(NULL);
src/emu/inptport.c
r10315r10316
15361536         /* interpolate if appropriate and if time has passed since the last update */
15371537         if (analog->interpolate && !(analog->field->flags & ANALOG_FLAG_RESET) && portdata->last_delta_nsec != 0)
15381538         {
1539            attoseconds_t nsec_since_last = (timer_get_time(port->machine) - portdata->last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND;
1539            attoseconds_t nsec_since_last = (port->machine->time() - portdata->last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND;
15401540            value = analog->previous + ((INT64)(analog->accum - analog->previous) * nsec_since_last / portdata->last_delta_nsec);
15411541         }
15421542
r10315r10316
24652465   input_port_private *portdata = machine->input_port_data;
24662466   const input_field_config *mouse_field = NULL;
24672467   int ui_visible = ui_is_menu_active();
2468   attotime curtime = timer_get_time(machine);
2468   attotime curtime = machine->time();
24692469   const input_port_config *port;
24702470   render_target *mouse_target;
24712471   INT32 mouse_target_x;
r10315r10316
49254925static void setup_keybuffer(running_machine *machine)
49264926{
49274927   input_port_private *portdata = machine->input_port_data;
4928   portdata->inputx_timer = timer_alloc(machine, inputx_timerproc, NULL);
4928   portdata->inputx_timer = machine->scheduler().timer_alloc(FUNC(inputx_timerproc));
49294929   portdata->keybuffer = auto_alloc_clear(machine, key_buffer);
49304930   machine->add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer);
49314931}
src/emu/devintrf.c
r10315r10316
672672
673673
674674//-------------------------------------------------
675//  timer_alloc - allocate a timer for our device
676//  callback
677//-------------------------------------------------
678
679emu_timer *device_t::timer_alloc(device_timer_id id, void *ptr)
680{
681   return m_machine.scheduler().timer_alloc(*this, id, ptr);
682}
683
684
685//-------------------------------------------------
686//  timer_set - set a temporary timer that will
687//  call our device callback
688//-------------------------------------------------
689
690void device_t::timer_set(attotime duration, device_timer_id id, int param, void *ptr)
691{
692   m_machine.scheduler().timer_set(duration, *this, id, param, ptr);
693}
694
695
696//-------------------------------------------------
675697//  find_interfaces - locate fast interfaces
676698//-------------------------------------------------
677699
src/emu/devintrf.h
r10315r10316
430430   void set_clock_scale(double clockscale);
431431   attotime clocks_to_attotime(UINT64 clocks) const;
432432   UINT64 attotime_to_clocks(attotime duration) const;
433   void timer_fired(emu_timer &timer, device_timer_id id, int param, void *ptr) { device_timer(timer, id, param, ptr); }
433   
434   // timer interfaces
435   emu_timer *timer_alloc(device_timer_id id = 0, void *ptr = NULL);
436   void timer_set(attotime duration, device_timer_id id = 0, int param = 0, void *ptr = NULL);
437   void synchronize(device_timer_id id = 0, int param = 0, void *ptr = NULL) { timer_set(attotime::zero, id, param, ptr); }
438   void timer_expired(emu_timer &timer, device_timer_id id, int param, void *ptr) { device_timer(timer, id, param, ptr); }
434439
435440   // debugging
436441   device_debug *debug() const { return m_debug; }
src/emu/emu.h
r10315r10316
8585#include "disound.h"
8686#include "dinvram.h"
8787#include "didisasm.h"
88#include "schedule.h"
8889#include "timer.h"
89#include "schedule.h"
9090
9191// I/O
9292#include "input.h"
src/emu/machine.c
r10315r10316
154154     sample_rate(options_get_int(&options, OPTION_SAMPLERATE)),
155155     debug_flags(0),
156156      ui_active(false),
157     mame_data(NULL),
158     timer_data(NULL),
159157     state_data(NULL),
160158     memory_data(NULL),
161159     palette_data(NULL),
162160     tilemap_data(NULL),
163     streams_data(NULL),
164     devices_data(NULL),
165161     romload_data(NULL),
166162     input_data(NULL),
167163     input_port_data(NULL),
r10315r10316
274270   m_render = auto_alloc(this, render_manager(*this));
275271   generic_machine_init(this);
276272   generic_sound_init(this);
273   
274   m_scheduler.register_for_save();
277275
278   // initialize the timers and allocate a soft_reset timer
279   // this must be done before cpu_init so that CPU's can allocate timers
280   timer_init(this);
281   m_soft_reset_timer = timer_alloc(this, static_soft_reset, NULL);
276   // allocate a soft_reset timer
277   m_soft_reset_timer = m_scheduler.timer_alloc(MFUNC(timer_expired, running_machine, soft_reset), this);
282278
283279   // init the osd layer
284280   m_osd.init(*this);
r10315r10316
288284   ui_init(this);
289285
290286   // initialize the base time (needed for doing record/playback)
291   time(&m_base_time);
287   ::time(&m_base_time);
292288
293289   // initialize the input system and input ports for the game
294290   // this must be done before memory_init in order to allow specifying
r10315r10316
386382      ui_display_startup_screens(this, firstrun, !settingsloaded);
387383
388384      // perform a soft reset -- this takes us to the running phase
389      soft_reset();
385      soft_reset(*this);
390386
391387      // run the CPUs until a reset or exit
392388      m_hard_reset_pending = false;
r10315r10316
466462   m_scheduler.eat_all_cycles();
467463
468464   // if we're autosaving on exit, schedule a save as well
469   if (options_get_bool(&m_options, OPTION_AUTOSAVE) && (m_game.flags & GAME_SUPPORTS_SAVE) && timer_get_time(this) > attotime::zero)
465   if (options_get_bool(&m_options, OPTION_AUTOSAVE) && (m_game.flags & GAME_SUPPORTS_SAVE) && this->time() > attotime::zero)
470466      schedule_save("auto");
471467}
472468
r10315r10316
550546
551547   // note the start time and set a timer for the next timeslice to actually schedule it
552548   m_saveload_schedule = SLS_SAVE;
553   m_saveload_schedule_time = timer_get_time(this);
549   m_saveload_schedule_time = this->time();
554550
555551   // we can't be paused since we need to clear out anonymous timers
556552   resume();
r10315r10316
569565
570566   // note the start time and set a timer for the next timeslice to actually schedule it
571567   m_saveload_schedule = SLS_LOAD;
572   m_saveload_schedule_time = timer_get_time(this);
568   m_saveload_schedule_time = this->time();
573569
574570   // we can't be paused since we need to clear out anonymous timers
575571   resume();
r10315r10316
735731
736732void running_machine::current_datetime(system_time &systime)
737733{
738   systime.set(m_base_time + timer_get_time(this).seconds);
734   systime.set(m_base_time + this->time().seconds);
739735}
740736
741737
r10315r10316
783779
784780   // if there are anonymous timers, we can't save just yet, and we can't load yet either
785781   // because the timers might overwrite data we have loaded
786   if (timer_count_anonymous(this) > 0)
782   if (m_scheduler.can_save())
787783   {
788784      // if more than a second has passed, we're probably screwed
789      if ((timer_get_time(this) - m_saveload_schedule_time) > attotime::from_seconds(1))
785      if ((this->time() - m_saveload_schedule_time) > attotime::from_seconds(1))
790786      {
791787         popmessage("Unable to %s due to pending anonymous timers. See error.log for details.", opname);
792788         goto cancel;
r10315r10316
856852//  of the system
857853//-------------------------------------------------
858854
859TIMER_CALLBACK( running_machine::static_soft_reset ) { machine->soft_reset(); }
860
861void running_machine::soft_reset()
855void running_machine::soft_reset(running_machine &machine, int param)
862856{
863857   logerror("Soft reset\n");
864858
r10315r10316
870864
871865   // now we're running
872866   m_current_phase = MACHINE_PHASE_RUNNING;
873
874   // allow 0-time queued callbacks to run before any CPUs execute
875   timer_execute_timers(this);
876867}
877868
878869
src/emu/sound/cdp1869.c
r10315r10316
427427   m_out_char_ram_func = m_config.out_char_ram_func;
428428
429429   // allocate timers
430   m_prd_timer = device_timer_alloc(*this);
430   m_prd_timer = timer_alloc();
431431   update_prd_changed_timer();
432432
433433   // initialize palette
src/emu/sound/ym2413.c
r10315r10316
19401940   {
19411941      cymfile = fopen("2413_.cym","wb");
19421942      if (cymfile)
1943         timer_pulse ( device->machine, attotime::from_hz(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
1943         device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/
19441944      else
19451945         logerror("Could not create file 2413_.cym\n");
19461946   }
src/emu/sound/tms5110.c
r10315r10316
10481048   }
10491049
10501050   tms->state = CTL_STATE_INPUT; /* most probably not defined */
1051   tms->romclk_hack_timer = timer_alloc(device->machine, romclk_hack_timer_cb, (void *) device);
1051   tms->romclk_hack_timer = device->machine->scheduler().timer_alloc(FUNC(romclk_hack_timer_cb), (void *) device);
10521052
10531053   register_for_save_states(tms);
10541054}
r10315r10316
14211421   tms->device = device;
14221422   tms->clock = device->clock();
14231423
1424   tms->romclk_timer = timer_alloc(device->machine, tmsprom_step, device);
1424   tms->romclk_timer = device->machine->scheduler().timer_alloc(FUNC(tmsprom_step), device);
14251425   timer_adjust_periodic(tms->romclk_timer, attotime::zero, 0, attotime::from_hz(tms->clock));
14261426
14271427   tms->bit = 0;
src/emu/sound/2612intf.c
r10315r10316
108108
109109   /* FM init */
110110   /* Timer Handler set */
111   info->timer[0] = timer_alloc(device->machine, timer_callback_2612_0, info);
112   info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info);
111   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2612_0), info);
112   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2612_1), info);
113113
114114   /* stream system initialize */
115115   info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2612_stream_update);
src/emu/sound/3526intf.c
r10315r10316
105105   ym3526_set_irq_handler   (info->chip, IRQHandler, info);
106106   ym3526_set_update_handler(info->chip, _stream_update, info);
107107
108   info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
109   info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
108   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
109   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
110110}
111111
112112static DEVICE_STOP( ym3526 )
src/emu/sound/k054539.c
r10315r10316
470470      // One or more of the registers must be the timer period
471471      // And anyway, this particular frequency is probably wrong
472472      // 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise
473      timer_pulse(device->machine, attotime::from_hz(480), info, 0, k054539_irq);
473      device->machine->scheduler().timer_pulse(attotime::from_hz(480), FUNC(k054539_irq), 0, info);
474474
475475   info->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock(), info, k054539_update);
476476
src/emu/sound/msm5205.c
r10315r10316
188188
189189   /* stream system initialize */
190190   voice->stream = device->machine->sound().stream_alloc(*device,0,1,device->clock(),voice,MSM5205_update);
191   voice->timer = timer_alloc(device->machine, MSM5205_vclk_callback, voice);
191   voice->timer = device->machine->scheduler().timer_alloc(FUNC(MSM5205_vclk_callback), voice);
192192
193193   /* initialize */
194194   DEVICE_RESET_CALL(msm5205);
src/emu/sound/3812intf.c
r10315r10316
106106   ym3812_set_irq_handler   (info->chip, IRQHandler, info);
107107   ym3812_set_update_handler(info->chip, _stream_update, info);
108108
109   info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
110   info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
109   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
110   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
111111}
112112
113113static DEVICE_STOP( ym3812 )
src/emu/sound/ymz280b.c
r10315r10316
116116static TIMER_CALLBACK( update_irq_state_timer_6 );
117117static TIMER_CALLBACK( update_irq_state_timer_7 );
118118
119static const timer_fired_func update_irq_state_cb[] =
119static const timer_expired_func update_irq_state_cb[] =
120120{
121121   update_irq_state_timer_0,
122122   update_irq_state_timer_1,
r10315r10316
205205      struct YMZ280BVoice *voice = &chip->voice[j];
206206      update_step(chip, voice);
207207      if(voice->irq_schedule)
208         timer_set(machine, attotime::zero, chip, 0, update_irq_state_cb[j]);
208         machine->scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[j]), 0, chip);
209209   }
210210}
211211
r10315r10316
581581            voice->playing = 0;
582582
583583            /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */
584            timer_set(chip->device->machine, attotime::zero, chip, 0, update_irq_state_cb[v]);
584            chip->device->machine->scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[v]), 0, chip);
585585            voice->irq_schedule = 1;
586586         }
587587      }
src/emu/sound/mos6560.c
r10315r10316
145145      if(VERBOSE_LEVEL >= N) \
146146      { \
147147         if( M ) \
148            logerror("%11.6f: %-24s", timer_get_time(device->machine).as_double(), (char*) M ); \
148            logerror("%11.6f: %-24s", device->machine->time().as_double(), (char*) M ); \
149149         logerror A; \
150150      } \
151151   } while (0)
r10315r10316
460460      break;
461461   case 6:                     /*lightpen horizontal */
462462   case 7:                     /*lightpen vertical */
463      if (LIGHTPEN_BUTTON && ((timer_get_time(device->machine).as_double() - mos6560->lightpenreadtime) * MOS656X_VRETRACERATE >= 1))
463      if (LIGHTPEN_BUTTON && ((device->machine->time().as_double() - mos6560->lightpenreadtime) * MOS656X_VRETRACERATE >= 1))
464464      {
465465         /* only 1 update each frame */
466466         /* and diode must recognize light */
r10315r10316
469469            mos6560->reg[6] = MOS656X_X_VALUE;
470470            mos6560->reg[7] = MOS656X_Y_VALUE;
471471         }
472         mos6560->lightpenreadtime = timer_get_time(device->machine).as_double();
472         mos6560->lightpenreadtime = device->machine->time().as_double();
473473      }
474474      val = mos6560->reg[offset];
475475      break;
src/emu/sound/ymf262.c
r10315r10316
22682268   {
22692269      cymfile = fopen("ymf262_.cym","wb");
22702270      if (cymfile)
2271         timer_pulse ( device->machine, attotime::from_hz(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
2271         device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/
22722272      else
22732273         logerror("Could not create ymf262_.cym file\n");
22742274   }
src/emu/sound/aica.c
r10315r10316
517517      }
518518   }
519519
520   AICA->timerA = timer_alloc(device->machine, timerA_cb, AICA);
521   AICA->timerB = timer_alloc(device->machine, timerB_cb, AICA);
522   AICA->timerC = timer_alloc(device->machine, timerC_cb, AICA);
520   AICA->timerA = device->machine->scheduler().timer_alloc(FUNC(timerA_cb), AICA);
521   AICA->timerB = device->machine->scheduler().timer_alloc(FUNC(timerB_cb), AICA);
522   AICA->timerC = device->machine->scheduler().timer_alloc(FUNC(timerC_cb), AICA);
523523
524524   for(i=0;i<0x400;++i)
525525   {
src/emu/sound/k056800.c
r10315r10316
146146
147147   k056800->irq_cb = intf->irq_cb;
148148
149   k056800->sound_cpu_timer = timer_alloc(device->machine, k056800_sound_cpu_timer_tick, k056800);
149   k056800->sound_cpu_timer = device->machine->scheduler().timer_alloc(FUNC(k056800_sound_cpu_timer_tick), k056800);
150150   timer_adjust_periodic(k056800->sound_cpu_timer, timer_period, 0, timer_period);
151151
152152   state_save_register_device_item_array(device, 0, k056800->host_reg);
src/emu/sound/upd7759.c
r10315r10316
655655   /* compute the ROM base or allocate a timer */
656656   chip->rom = chip->rombase = *device->region();
657657   if (chip->rom == NULL)
658      chip->timer = timer_alloc(device->machine, upd7759_slave_update, chip);
658      chip->timer = device->machine->scheduler().timer_alloc(FUNC(upd7759_slave_update), chip);
659659
660660   /* set the DRQ callback */
661661   chip->drqcallback = intf->drqcallback;
src/emu/sound/ymf271.c
r10315r10316
17521752
17531753static void ymf271_init(device_t *device, YMF271Chip *chip, UINT8 *rom, void (*cb)(device_t *,int), const devcb_read8 *ext_read, const devcb_write8 *ext_write)
17541754{
1755   chip->timA = timer_alloc(device->machine, ymf271_timer_a_tick, chip);
1756   chip->timB = timer_alloc(device->machine, ymf271_timer_b_tick, chip);
1755   chip->timA = device->machine->scheduler().timer_alloc(FUNC(ymf271_timer_a_tick), chip);
1756   chip->timB = device->machine->scheduler().timer_alloc(FUNC(ymf271_timer_b_tick), chip);
17571757
17581758   chip->rom = rom;
17591759   chip->irq_callback = cb;
src/emu/sound/pokey.c
r10315r10316
651651   chip->clockmult = DIV_64;
652652   chip->KBCODE = 0x09;       /* Atari 800 'no key' */
653653   chip->SKCTL = SK_RESET;    /* let the RNG run after reset */
654   chip->rtimer = timer_alloc(device->machine,  NULL, NULL);
654   chip->rtimer = device->machine->scheduler().timer_alloc(FUNC(NULL));
655655
656   chip->timer[0] = timer_alloc(device->machine, pokey_timer_expire, chip);
657   chip->timer[1] = timer_alloc(device->machine, pokey_timer_expire, chip);
658   chip->timer[2] = timer_alloc(device->machine, pokey_timer_expire, chip);
656   chip->timer[0] = device->machine->scheduler().timer_alloc(FUNC(pokey_timer_expire), chip);
657   chip->timer[1] = device->machine->scheduler().timer_alloc(FUNC(pokey_timer_expire), chip);
658   chip->timer[2] = device->machine->scheduler().timer_alloc(FUNC(pokey_timer_expire), chip);
659659
660660   for (i=0; i<8; i++)
661661   {
662      chip->ptimer[i] = timer_alloc(device->machine, pokey_pot_trigger, chip);
662      chip->ptimer[i] = device->machine->scheduler().timer_alloc(FUNC(pokey_pot_trigger), chip);
663663      devcb_resolve_read8(&chip->pot_r[i], &chip->intf.pot_r[i], device);
664664   }
665665   devcb_resolve_read8(&chip->allpot_r, &chip->intf.allpot_r, device);
r10315r10316
11411141         * loaders from Ballblazer and Escape from Fractalus
11421142         * The real times are unknown
11431143         */
1144        timer_set(device->machine, attotime::from_usec(200), p, 0, pokey_serout_ready_cb);
1144        device->machine->scheduler().timer_set(attotime::from_usec(200), FUNC(pokey_serout_ready_cb), 0, p);
11451145        /* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */
1146        timer_set(device->machine, attotime::from_usec(2000), p, 0, pokey_serout_complete);
1146        device->machine->scheduler().timer_set(attotime::from_usec(2000), FUNC(pokey_serout_complete), 0, p);
11471147        break;
11481148
11491149    case IRQEN_C:
r10315r10316
13381338void pokey_serin_ready(device_t *device, int after)
13391339{
13401340   pokey_state *p = get_safe_token(device);
1341   timer_set(device->machine, p->clock_period * after, p, 0, pokey_serin_ready_cb);
1341   device->machine->scheduler().timer_set(p->clock_period * after, FUNC(pokey_serin_ready_cb), 0, p);
13421342}
13431343
13441344void pokey_break_w(device_t *device, int shift)
src/emu/sound/sp0250.c
r10315r10316
208208   if (sp->drq != NULL)
209209   {
210210      sp->drq(sp->device, ASSERT_LINE);
211      timer_pulse(device->machine, attotime::from_hz(device->clock()) * CLOCK_DIVIDER, sp, 0, sp0250_timer_tick);
211      device->machine->scheduler().timer_pulse(attotime::from_hz(device->clock()) * CLOCK_DIVIDER, FUNC(sp0250_timer_tick), 0, sp);
212212   }
213213
214214   sp->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() / CLOCK_DIVIDER, sp, sp0250_update);
src/emu/sound/speaker.c
r10315r10316
159159   for (i = 0; i < FILTER_LENGTH; i++)
160160      sp->composed_volume[i] = 0;
161161   sp->composed_sample_index = 0;
162   sp->last_update_time = timer_get_time(device->machine);
162   sp->last_update_time = device->machine->time();
163163   sp->channel_sample_period = HZ_TO_ATTOSECONDS(device->machine->sample_rate);
164164   sp->channel_sample_period_secfrac = ATTOSECONDS_TO_DOUBLE(sp->channel_sample_period);
165165   sp->interm_sample_period = sp->channel_sample_period / RATE_MULTIPLIER;
r10315r10316
275275      new_level = sp->num_levels - 1;
276276
277277   volume = sp->levels[sp->level];
278   time = timer_get_time(device->machine);
278   time = device->machine->time();
279279
280280   if (time < sp->channel_next_sample_time)
281281   {
src/emu/sound/ym2151.c
r10315r10316
824824   if (chip->irq_enable & 0x04)
825825   {
826826      chip->status |= 1;
827      timer_set(machine, attotime::zero,chip,0,irqAon_callback);
827      machine->scheduler().timer_set(attotime::zero, FUNC(irqAon_callback), 0, chip);
828828   }
829829   if (chip->irq_enable & 0x80)
830830      chip->csm_req = 2;      /* request KEY ON / KEY OFF sequence */
r10315r10316
837837   if (chip->irq_enable & 0x08)
838838   {
839839      chip->status |= 2;
840      timer_set(machine, attotime::zero,chip,0,irqBon_callback);
840      machine->scheduler().timer_set(attotime::zero, FUNC(irqBon_callback), 0, chip);
841841   }
842842}
843843#if 0
r10315r10316
10981098         {
10991099#ifdef USE_MAME_TIMERS
11001100            chip->status &= ~1;
1101            timer_set(chip->device->machine, attotime::zero,chip,0,irqAoff_callback);
1101            chip->device->machine->scheduler().timer_set(attotime::zero, FUNC(irqAoff_callback), 0, chip);
11021102#else
11031103            int oldstate = chip->status & 3;
11041104            chip->status &= ~1;
r10315r10316
11101110         {
11111111#ifdef USE_MAME_TIMERS
11121112            chip->status &= ~2;
1113            timer_set(chip->device->machine, attotime::zero,chip,0,irqBoff_callback);
1113            chip->device->machine->scheduler().timer_set(attotime::zero, FUNC(irqBoff_callback), 0, chip);
11141114#else
11151115            int oldstate = chip->status & 3;
11161116            chip->status &= ~2;
r10315r10316
15331533
15341534#ifdef USE_MAME_TIMERS
15351535/* this must be done _before_ a call to ym2151_reset_chip() */
1536   PSG->timer_A = timer_alloc(device->machine, timer_callback_a, PSG);
1537   PSG->timer_B = timer_alloc(device->machine, timer_callback_b, PSG);
1536   PSG->timer_A = device->machine->scheduler().timer_alloc(FUNC(timer_callback_a), PSG);
1537   PSG->timer_B = device->machine->scheduler().timer_alloc(FUNC(timer_callback_b), PSG);
15381538#else
15391539   PSG->tim_A      = 0;
15401540   PSG->tim_B      = 0;
r10315r10316
15461546   {
15471547      cymfile = fopen("2151_.cym","wb");
15481548      if (cymfile)
1549         timer_pulse ( device->machine, attotime::from_hz(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
1549         device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/
15501550      else
15511551         logerror("Could not create file 2151_.cym\n");
15521552   }
src/emu/sound/scsp.c
r10315r10316
547547      scsp->SCSPRAM += intf->roffset;
548548   }
549549
550   scsp->timerA = timer_alloc(device->machine, timerA_cb, scsp);
551   scsp->timerB = timer_alloc(device->machine, timerB_cb, scsp);
552   scsp->timerC = timer_alloc(device->machine, timerC_cb, scsp);
550   scsp->timerA = device->machine->scheduler().timer_alloc(FUNC(timerA_cb), scsp);
551   scsp->timerB = device->machine->scheduler().timer_alloc(FUNC(timerB_cb), scsp);
552   scsp->timerC = device->machine->scheduler().timer_alloc(FUNC(timerC_cb), scsp);
553553
554554   for(i=0;i<0x400;++i)
555555   {
src/emu/sound/2610intf.c
r10315r10316
156156   assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip");
157157
158158   /* Timer Handler set */
159   info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
160   info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
159   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
160   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
161161
162162   /* stream system initialize */
163163   info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,(type == YM2610) ? ym2610_stream_update : ym2610b_stream_update);
src/emu/sound/fmopl.c
r10315r10316
17441744   {
17451745      cymfile = fopen("3812_.cym","wb");
17461746      if (cymfile)
1747         timer_pulse ( device->machine, attotime::from_hz(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
1747         device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/
17481748      else
17491749         logerror("Could not create file 3812_.cym\n");
17501750   }
src/emu/sound/ics2115.c
r10315r10316
4747void ics2115_device::device_start()
4848{
4949    m_rom = *region();
50    m_timer[0].timer = timer_alloc(machine, timer_cb_0, this);
51    m_timer[1].timer = timer_alloc(machine, timer_cb_1, this);
50    m_timer[0].timer = machine->scheduler().timer_alloc(FUNC(timer_cb_0), this);
51    m_timer[1].timer = machine->scheduler().timer_alloc(FUNC(timer_cb_1), this);
5252    m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 33075);
5353
5454    //Exact formula as per patent 5809466
src/emu/sound/fm.h
r10315r10316
4242#if FM_BUSY_FLAG_SUPPORT
4343#define TIME_TYPE               attotime
4444#define UNDEFINED_TIME            attotime::zero
45#define FM_GET_TIME_NOW(machine)         timer_get_time(machine)
45#define FM_GET_TIME_NOW(machine)         machine->time()
4646#define ADD_TIMES(t1, t2)         ((t1) + (t2))
4747#define COMPARE_TIMES(t1, t2)      (((t1) == (t2)) ? 0 : ((t1) < (t2)) ? -1 : 1)
4848#define MULTIPLY_TIME_BY_INT(t,i)   ((t) * (i))
src/emu/sound/bsmt2000.c
r10315r10316
245245
246246void bsmt2000_device::device_reset()
247247{
248   device_timer_call_after_resynch(*this, TIMER_ID_RESET);
248   synchronize(TIMER_ID_RESET);
249249}
250250
251251
r10315r10316
312312
313313void bsmt2000_device::write_reg(UINT16 data)
314314{
315   device_timer_call_after_resynch(*this, TIMER_ID_REG_WRITE, data);
315   synchronize(TIMER_ID_REG_WRITE, data);
316316}
317317
318318
r10315r10316
323323
324324void bsmt2000_device::write_data(UINT16 data)
325325{
326   device_timer_call_after_resynch(*this, TIMER_ID_DATA_WRITE, data);
326   synchronize(TIMER_ID_DATA_WRITE, data);
327327
328328   // boost the interleave on a write so that the caller detects the status more accurately
329329   m_machine.scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(10));
src/emu/sound/2608intf.c
r10315r10316
152152   assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip");
153153
154154   /* Timer Handler set */
155   info->timer[0] = timer_alloc(device->machine, timer_callback_2608_0, info);
156   info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info);
155   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2608_0), info);
156   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2608_1), info);
157157
158158   /* stream system initialize */
159159   info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2608_stream_update);
src/emu/sound/cdp1864.c
r10315r10316
449449   cdp1864->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, cdp1864, cdp1864_stream_update);
450450
451451   /* create the timers */
452   cdp1864->int_timer = timer_alloc(device->machine, cdp1864_int_tick, (void *)device);
453   cdp1864->efx_timer = timer_alloc(device->machine, cdp1864_efx_tick, (void *)device);
454   cdp1864->dma_timer = timer_alloc(device->machine, cdp1864_dma_tick, (void *)device);
452   cdp1864->int_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_int_tick), (void *)device);
453   cdp1864->efx_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_efx_tick), (void *)device);
454   cdp1864->dma_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_dma_tick), (void *)device);
455455
456456   /* register for state saving */
457457   state_save_register_device_item(device, 0, cdp1864->disp);
src/emu/sound/ymf278b.c
r10315r10316
666666{
667667   chip->rom = *device->region();
668668   chip->irq_callback = cb;
669   chip->timer_a = timer_alloc(device->machine, ymf278b_timer_a_tick, chip);
670   chip->timer_b = timer_alloc(device->machine, ymf278b_timer_b_tick, chip);
669   chip->timer_a = device->machine->scheduler().timer_alloc(FUNC(ymf278b_timer_a_tick), chip);
670   chip->timer_b = device->machine->scheduler().timer_alloc(FUNC(ymf278b_timer_b_tick), chip);
671671   chip->irq_line = CLEAR_LINE;
672672   chip->clock = device->clock();
673673}
src/emu/sound/k053260.c
r10315r10316
258258
259259   /* setup SH1 timer if necessary */
260260   if ( ic->intf->irq )
261      timer_pulse( device->machine, attotime::from_hz(device->clock()) * 32, NULL, 0, ic->intf->irq );
261      device->machine->scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, FUNC(ic->intf->irq ));
262262}
263263
264264INLINE void check_bounds( k053260_state *ic, int channel )
src/emu/sound/k053260.h
r10315r10316
1414typedef struct _k053260_interface k053260_interface;
1515struct _k053260_interface {
1616   const char *rgnoverride;
17   timer_fired_func irq;         /* called on SH1 complete cycle ( clock / 32 ) */
17   timer_expired_func irq;         /* called on SH1 complete cycle ( clock / 32 ) */
1818};
1919
2020
src/emu/sound/8950intf.c
r10315r10316
139139   y8950_set_irq_handler   (info->chip, IRQHandler, info);
140140   y8950_set_update_handler(info->chip, _stream_update, info);
141141
142   info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
143   info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
142   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
143   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
144144}
145145
146146static DEVICE_STOP( y8950 )
src/emu/sound/asc.c
r10315r10316
133133
134134   memset(m_regs, 0, sizeof(m_regs));
135135
136   m_sync_timer = timer_alloc(this->machine, sync_timer_cb, this);
136   m_sync_timer = this->machine->scheduler().timer_alloc(FUNC(sync_timer_cb), this);
137137
138138   state_save_register_device_item(this, 0, m_fifo_a_rdptr);
139139   state_save_register_device_item(this, 0, m_fifo_b_rdptr);
src/emu/sound/2203intf.c
r10315r10316
134134   assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip");
135135
136136   /* Timer Handler set */
137   info->timer[0] = timer_alloc(device->machine, timer_callback_2203_0, info);
138   info->timer[1] = timer_alloc(device->machine, timer_callback_2203_1, info);
137   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2203_0), info);
138   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2203_1), info);
139139
140140   /* stream system initialize */
141141   info->stream = device->machine->sound().stream_alloc(*device,0,1,rate,info,ym2203_stream_update);
src/emu/sound/tms5220.c
r10315r10316
16961696         tms->io_ready = 0;
16971697         update_ready_state(tms);
16981698         /* How long does /READY stay inactive, when /RS is pulled low? I believe its almost always ~16 clocks (25 usec at 800khz as shown on the datasheet) */
1699         timer_set(tms->device->machine, attotime::from_hz(device->clock()/16), tms, 1, io_ready_cb); // this should take around 10-16 (closer to ~11?) cycles to complete
1699         tms->device->machine->scheduler().timer_set(attotime::from_hz(device->clock()/16), FUNC(io_ready_cb), 1, tms); // this should take around 10-16 (closer to ~11?) cycles to complete
17001700      }
17011701   }
17021702}
r10315r10316
17591759            SET RATE (5220C only): ? cycles (probably ~16)
17601760            */
17611761         // TODO: actually HANDLE the timing differences! currently just assuming always 16 cycles
1762         timer_set(tms->device->machine, attotime::from_hz(device->clock()/16), tms, 1, io_ready_cb); // this should take around 10-16 (closer to ~15) cycles to complete for fifo writes, TODO: but actually depends on what command is written if in command mode
1762         tms->device->machine->scheduler().timer_set(attotime::from_hz(device->clock()/16), FUNC(io_ready_cb), 1, tms); // this should take around 10-16 (closer to ~15) cycles to complete for fifo writes, TODO: but actually depends on what command is written if in command mode
17631763      }
17641764   }
17651765}
src/emu/sound/es5503.c
r10315r10316
259259      chip->oscillators[osc].irqpend = 0;
260260      chip->oscillators[osc].accumulator = 0;
261261
262      chip->oscillators[osc].timer = timer_alloc(device->machine, es5503_timer_cb, &chip->oscillators[osc]);
262      chip->oscillators[osc].timer = device->machine->scheduler().timer_alloc(FUNC(es5503_timer_cb), &chip->oscillators[osc]);
263263      chip->oscillators[osc].chip = (void *)chip;
264264   }
265265
src/emu/sound/262intf.c
r10315r10316
9595   ymf262_set_irq_handler   (info->chip, IRQHandler_262, info);
9696   ymf262_set_update_handler(info->chip, _stream_update, info);
9797
98   info->timer[0] = timer_alloc(device->machine, timer_callback_262_0, info);
99   info->timer[1] = timer_alloc(device->machine, timer_callback_262_1, info);
98   info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_262_0), info);
99   info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_262_1), info);
100100}
101101
102102static DEVICE_STOP( ymf262 )
src/emu/machine.h
r10315r10316
187187class debug_view_manager;
188188class osd_interface;
189189
190typedef struct _mame_private mame_private;
191typedef struct _cpuexec_private cpuexec_private;
192typedef struct _timer_private timer_private;
193190typedef struct _state_private state_private;
194191typedef struct _memory_private memory_private;
195192typedef struct _palette_private palette_private;
196193typedef struct _tilemap_private tilemap_private;
197typedef struct _streams_private streams_private;
198typedef struct _devices_private devices_private;
199194typedef struct _romload_private romload_private;
200195typedef struct _input_private input_private;
201196typedef struct _input_port_private input_port_private;
r10315r10316
364359   device_scheduler &scheduler() { return m_scheduler; }
365360   osd_interface &osd() const { return m_osd; }
366361   screen_device *first_screen() const { return primary_screen; }
362   attotime time() const { return m_scheduler.time(); }
367363
368364   // immediate operations
369365   int run(bool firstrun);
r10315r10316
381377   void schedule_save(const char *filename);
382378   void schedule_load(const char *filename);
383379
384   // time
380   // date & time
385381   void base_datetime(system_time &systime);
386382   void current_datetime(system_time &systime);
387383
r10315r10316
444440   generic_pointers      generic;         // generic pointers
445441
446442   // internal core information
447   mame_private *         mame_data;         // internal data from mame.c
448   timer_private *         timer_data;         // internal data from timer.c
449443   state_private *         state_data;         // internal data from state.c
450444   memory_private *      memory_data;      // internal data from memory.c
451445   palette_private *      palette_data;      // internal data from palette.c
452446   tilemap_private *      tilemap_data;      // internal data from tilemap.c
453   streams_private *      streams_data;      // internal data from streams.c
454   devices_private *      devices_data;      // internal data from devices.c
455447   romload_private *      romload_data;      // internal data from romload.c
456448   input_private *         input_data;         // internal data from input.c
457449   input_port_private *   input_port_data;   // internal data from inptport.c
r10315r10316
472464   void set_saveload_filename(const char *filename);
473465   void fill_systime(system_time &systime, time_t t);
474466   void handle_saveload();
467   void soft_reset(running_machine &machine, int param = 0);
475468
476   static TIMER_CALLBACK( static_soft_reset );
477   void soft_reset();
478
479469   static void logfile_callback(running_machine &machine, const char *buffer);
480470
481471   // notifier callbacks
src/emu/schedule.c
r10315r10316
5050
5151#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
5252
53#define TEMPLOG   0
5453
5554
56
5755//**************************************************************************
5856//  CONSTANTS
5957//**************************************************************************
r10315r10316
6967
7068
7169//**************************************************************************
72//  MACROS
70//  EMU TIMER
7371//**************************************************************************
7472
75// these are macros to ensure inlining in device_scheduler::timeslice
76#define ATTOTIME_LT(a,b)      ((a).seconds < (b).seconds || ((a).seconds == (b).seconds && (a).attoseconds < (b).attoseconds))
77#define ATTOTIME_NORMALIZE(a)   do { if ((a).attoseconds >= ATTOSECONDS_PER_SECOND) { (a).seconds++; (a).attoseconds -= ATTOSECONDS_PER_SECOND; } } while (0)
73//-------------------------------------------------
74//  emu_timer - constructor
75//-------------------------------------------------
7876
77emu_timer::emu_timer()
78   : m_machine(NULL),
79     m_next(NULL),
80     m_prev(NULL),
81     m_callback(NULL),
82     m_param(0),
83     m_ptr(NULL),
84     m_func(NULL),
85     m_enabled(false),
86     m_temporary(false),
87     m_period(attotime::zero),
88     m_start(attotime::zero),
89     m_expire(attotime::never),
90     m_device(NULL),
91     m_id(0)
92{
93}
7994
8095
96//-------------------------------------------------
97//  init - completely initialize the state when
98//  re-allocated as a non-device timer
99//-------------------------------------------------
100
101emu_timer &emu_timer::init(running_machine &machine, timer_expired_func callback, const char *name, void *ptr, bool temporary)
102{
103   // ensure the entire timer state is clean
104   m_machine = &machine;
105   m_next = NULL;
106   m_prev = NULL;
107   m_callback = callback;
108   m_param = 0;
109   m_ptr = ptr;
110   m_func = (name != NULL) ? name : "?";
111   m_enabled = false;
112   m_temporary = temporary;
113   m_period = attotime::never;
114   m_start = machine.time();
115   m_expire = attotime::never;
116   m_device = NULL;
117   m_id = 0;
118
119   // if we're not temporary, register ourselves with the save state system
120   if (!m_temporary)
121      register_save();
122   
123   // insert into the list
124   machine.scheduler().timer_list_insert(*this);
125   return *this;
126}
127
128
129//-------------------------------------------------
130//  init - completely initialize the state when
131//  re-allocated as a device timer
132//-------------------------------------------------
133
134emu_timer &emu_timer::init(device_t &device, device_timer_id id, void *ptr, bool temporary)
135{
136   // ensure the entire timer state is clean
137   m_machine = device.machine;
138   m_next = NULL;
139   m_prev = NULL;
140   m_callback = NULL;
141   m_param = 0;
142   m_ptr = ptr;
143   m_func = NULL;
144   m_enabled = false;
145   m_temporary = temporary;
146   m_period = attotime::never;
147   m_start = machine().time();
148   m_expire = attotime::never;
149   m_device = &device;
150   m_id = id;
151
152   // if we're not temporary, register ourselves with the save state system
153   if (!m_temporary)
154      register_save();
155   
156   // insert into the list
157   machine().scheduler().timer_list_insert(*this);
158   return *this;
159}
160
161
162//-------------------------------------------------
163//  release - release us from the global list
164//  management when deallocating
165//-------------------------------------------------
166
167emu_timer &emu_timer::release()
168{
169   // unhook us from the global list
170   machine().scheduler().timer_list_remove(*this);
171   return *this;
172}
173
174
175//-------------------------------------------------
176//  enable - enable/disable a timer
177//-------------------------------------------------
178
179bool emu_timer::enable(bool enable)
180{
181   // reschedule only if the state has changed
182   bool old = m_enabled;
183   if (old != enable)
184   {
185      // set the enable flag
186      m_enabled = enable;
187
188      // remove the timer and insert back into the list
189      machine().scheduler().timer_list_remove(*this);
190      machine().scheduler().timer_list_insert(*this);
191   }
192   return old;
193}
194
195
196//-------------------------------------------------
197//  adjust - adjust the time when this timer will
198//  fire and specify a period for subsequent
199//  firings
200//-------------------------------------------------
201
202void emu_timer::adjust(attotime start_delay, INT32 param, attotime period)
203{
204   // if this is the callback timer, mark it modified
205   device_scheduler &scheduler = machine().scheduler();
206   if (scheduler.m_callback_timer == this)
207      scheduler.m_callback_timer_modified = true;
208
209   // compute the time of the next firing and insert into the list
210   m_param = param;
211   m_enabled = true;
212
213   // clamp negative times to 0
214   if (start_delay.seconds < 0)
215      start_delay = attotime::zero;
216
217   // set the start and expire times
218   m_start = scheduler.time();
219   m_expire = m_start + start_delay;
220   m_period = period;
221
222   // remove and re-insert the timer in its new order
223   scheduler.timer_list_remove(*this);
224   scheduler.timer_list_insert(*this);
225
226   // if this was inserted as the head, abort the current timeslice and resync
227   if (this == scheduler.first_timer())
228      scheduler.abort_timeslice();
229}
230
231
232//-------------------------------------------------
233//  elapsed - return the amount of time since the
234//  timer was started
235//-------------------------------------------------
236
237attotime emu_timer::elapsed() const
238{
239   return machine().time() - m_start;
240}
241
242
243//-------------------------------------------------
244//  remaining - return the amount of time
245//  remaining until the timer expires
246//-------------------------------------------------
247
248attotime emu_timer::remaining() const
249{
250   return m_expire - machine().time();
251}
252
253
254//-------------------------------------------------
255//  timer_register_save - register ourself with
256//  the save state system
257//-------------------------------------------------
258
259void emu_timer::register_save()
260{
261   // determine our instance number and name
262   int index = 0;
263   astring name;
264   
265   // for non-device timers, it is an index based on the callback function name
266   if (m_device == NULL)
267   {
268      name = m_func;
269      for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != NULL; curtimer = curtimer->next())
270         if (!curtimer->m_temporary && curtimer->m_device == NULL && strcmp(curtimer->m_func, m_func) == 0)
271            index++;
272   }
273   
274   // for device timers, it is an index based on the device and timer ID
275   else
276   {
277      name.printf("%s/%d", m_device->tag(), m_id);
278      for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != NULL; curtimer = curtimer->next())
279         if (!curtimer->m_temporary && curtimer->m_device != NULL && curtimer->m_device == m_device && curtimer->m_id == m_id)
280            index++;
281   }
282
283   // save the bits
284   state_save_register_item(m_machine, "timer", name, index, m_param);
285   state_save_register_item(m_machine, "timer", name, index, m_enabled);
286   state_save_register_item(m_machine, "timer", name, index, m_period.seconds);
287   state_save_register_item(m_machine, "timer", name, index, m_period.attoseconds);
288   state_save_register_item(m_machine, "timer", name, index, m_start.seconds);
289   state_save_register_item(m_machine, "timer", name, index, m_start.attoseconds);
290   state_save_register_item(m_machine, "timer", name, index, m_expire.seconds);
291   state_save_register_item(m_machine, "timer", name, index, m_expire.attoseconds);
292}
293
294
295//-------------------------------------------------
296//  schedule_next_period - schedule the next
297//  period
298//-------------------------------------------------
299
300void emu_timer::schedule_next_period()
301{
302   // advance by one period
303   m_start = m_expire;
304   m_expire += m_period;
305
306   // remove and re-insert us
307   device_scheduler &scheduler = machine().scheduler();
308   scheduler.timer_list_remove(*this);
309   scheduler.timer_list_insert(*this);
310}
311
312
313
81314//**************************************************************************
82//  CORE CPU EXECUTION
315//  DEVICE SCHEDULER
83316//**************************************************************************
84317
85318//-------------------------------------------------
r10315r10316
88321
89322device_scheduler::device_scheduler(running_machine &machine) :
90323   m_machine(machine),
91   m_quantum_set(false),
92324   m_executing_device(NULL),
93   m_execute_list(NULL)
325   m_execute_list(NULL),
326   m_basetime(attotime::zero),
327   m_timer_list(NULL),
328   m_timer_allocator(machine.m_respool),
329   m_callback_timer(NULL),
330   m_callback_timer_modified(false),
331   m_callback_timer_expire_time(attotime::zero),
332   m_quantum_list(machine.m_respool),
333   m_quantum_allocator(machine.m_respool),
334   m_quantum_minimum(ATTOSECONDS_IN_NSEC(1) / 1000)
94335{
336   // append a single never-expiring timer so there is always one in the list
337   m_timer_list = &m_timer_allocator.alloc()->init(m_machine, NULL, NULL, NULL, true);
338   m_timer_list->adjust(attotime::never);
95339}
96340
97341
342// remove me once save state registration is embedded
343void device_scheduler::register_for_save()
344{
345   // register global states
346   state_save_register_item(&m_machine, "timer", NULL, 0, m_basetime.seconds);
347   state_save_register_item(&m_machine, "timer", NULL, 0, m_basetime.attoseconds);
348   state_save_register_postload(&m_machine, &state_postload_stub<device_scheduler, &device_scheduler::postload>, this);
349}
350
351
98352//-------------------------------------------------
99353//  device_scheduler - destructor
100354//-------------------------------------------------
101355
102356device_scheduler::~device_scheduler()
103357{
358   // remove all timers
359   while (m_timer_list != NULL)
360      m_timer_allocator.reclaim(m_timer_list->release());
104361}
105362
106363
107364//-------------------------------------------------
365//  time - return the current time
366//-------------------------------------------------
367
368attotime device_scheduler::time() const
369{
370   // if we're currently in a callback, use the timer's expiration time as a base
371   if (m_callback_timer != NULL)
372      return m_callback_timer_expire_time;
373
374   // if we're executing as a particular CPU, use its local time as a base
375   // otherwise, return the global base time
376   return (m_executing_device != NULL) ? m_executing_device->local_time() : m_basetime;
377}
378
379
380//-------------------------------------------------
381//  can_save - return true if it's safe to save
382//  (i.e., no temporary timers outstanding)
383//-------------------------------------------------
384
385bool device_scheduler::can_save() const
386{
387   // if any live temporary timers exit, fail
388   for (emu_timer *timer = m_timer_list; timer != NULL; timer = timer->next())
389      if (timer->m_temporary)
390         return false;
391
392   // otherwise, we're good
393   return true;
394}
395
396
397//-------------------------------------------------
108398//  timeslice - execute all devices for a single
109399//  timeslice
110400//-------------------------------------------------
r10315r10316
112402void device_scheduler::timeslice()
113403{
114404   bool call_debugger = ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0);
115   timer_execution_state *timerexec = timer_get_execution_state(&m_machine);
116if (TEMPLOG) printf("Timeslice start\n");
117405
118406   // build the execution list if we don't have one yet
119407   if (m_execute_list == NULL)
120408      rebuild_execute_list();
121409
410   // execute timers
411   execute_timers();
412
122413   // loop until we hit the next timer
123   while (ATTOTIME_LT(timerexec->basetime, timerexec->nextfire))
414   while (m_basetime < m_timer_list->m_expire)
124415   {
125if (TEMPLOG)
126{
127   void timer_print_first_timer(running_machine *machine);
128   printf("Timeslice loop: basetime=%15.6f\n", timerexec->basetime.as_double());
129   timer_print_first_timer(&m_machine);
130}
131
132
133416      // by default, assume our target is the end of the next quantum
134      attotime target;
135      target.seconds = timerexec->basetime.seconds;
136      target.attoseconds = timerexec->basetime.attoseconds + timerexec->curquantum;
137      ATTOTIME_NORMALIZE(target);
417      attotime target = m_basetime + attotime(0, m_quantum_list.first()->m_actual);
138418
139419      // however, if the next timer is going to fire before then, override
140      assert((timerexec->nextfire - target).seconds <= 0);
141      if (ATTOTIME_LT(timerexec->nextfire, target))
142         target = timerexec->nextfire;
420      if (m_timer_list->m_expire < target)
421         target = m_timer_list->m_expire;
143422
144423      LOG(("------------------\n"));
145424      LOG(("cpu_timeslice: target = %s\n", target.as_string()));
r10315r10316
148427      UINT32 suspendchanged = 0;
149428      for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
150429      {
151         suspendchanged |= (exec->m_suspend ^ exec->m_nextsuspend);
430         suspendchanged |= exec->m_suspend ^ exec->m_nextsuspend;
152431         exec->m_suspend = exec->m_nextsuspend;
153432         exec->m_nextsuspend &= ~SUSPEND_REASON_TIMESLICE;
154433         exec->m_eatcycles = exec->m_nexteatcycles;
r10315r10316
185464                  // note that this global variable cycles_stolen can be modified
186465                  // via the call to cpu_execute
187466                  exec->m_cycles_stolen = 0;
188if (TEMPLOG) printf("Executing %s for %d cycles\n", exec->device().tag(), ran);
189467                  m_executing_device = exec;
190468                  *exec->m_icountptr = exec->m_cycles_running;
191469                  if (!call_debugger)
r10315r10316
204482                  ran -= exec->m_cycles_stolen;
205483                  g_profiler.stop();
206484               }
207else
208if (TEMPLOG) printf("Skipping %s for %d cycles\n", exec->device().tag(), ran);
209485
210486               // account for these cycles
211487               exec->m_totalcycles += ran;
212488
213489               // update the local time for this CPU
214               attoseconds_t actualdelta = exec->m_attoseconds_per_cycle * ran;
215               exec->m_localtime.attoseconds += actualdelta;
216               ATTOTIME_NORMALIZE(exec->m_localtime);
490               exec->m_localtime += attotime(0, exec->m_attoseconds_per_cycle * ran);
217491               LOG(("         %d ran, %d total, time = %s\n", ran, (INT32)exec->m_totalcycles, exec->m_localtime.as_string()));
218492
219               // if the new local CPU time is less than our target, move the target up
220               if (ATTOTIME_LT(exec->m_localtime, target))
493               // if the new local CPU time is less than our target, move the target up, but not before the base
494               if (exec->m_localtime < target)
221495               {
222496                  assert(exec->m_localtime < target);
223                  target = exec->m_localtime;
224
225                  // however, if this puts us before the base, clamp to the base as a minimum
226                  if (ATTOTIME_LT(target, timerexec->basetime))
227                  {
228                     assert(target < timerexec->basetime);
229                     target = timerexec->basetime;
230                  }
497                  target = max(exec->m_localtime, m_basetime);
231498                  LOG(("         (new target)\n"));
232499               }
233500            }
r10315r10316
236503      m_executing_device = NULL;
237504
238505      // update the base time
239      timerexec->basetime = target;
506      m_basetime = target;
240507   }
241if (TEMPLOG) printf("Timeslice end\n");
508}
242509
243   // execute timers
244   timer_execute_timers(&m_machine);
510
511//-------------------------------------------------
512//  abort_timeslice - abort execution for the
513//  current timeslice
514//-------------------------------------------------
515
516void device_scheduler::abort_timeslice()
517{
518   if (m_executing_device != NULL)
519      m_executing_device->abort_timeslice();
245520}
246521
247522
248523//-------------------------------------------------
524//  trigger - generate a global trigger
525//-------------------------------------------------
526
527void device_scheduler::trigger(int trigid, attotime after)
528{
529   // ensure we have a list of executing devices
530   if (m_execute_list == NULL)
531      rebuild_execute_list();
532
533   // if we have a non-zero time, schedule a timer
534   if (after != attotime::zero)
535      timer_set(after, MFUNC(timer_expired, device_scheduler, timed_trigger), trigid, this);
536
537   // send the trigger to everyone who cares
538   else
539      for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
540         exec->trigger(trigid);
541}
542
543
544//-------------------------------------------------
249545//  boost_interleave - temporarily boosts the
250546//  interleave factor
251547//-------------------------------------------------
r10315r10316
255551   // ignore timeslices > 1 second
256552   if (timeslice_time.seconds > 0)
257553      return;
258   timer_add_scheduling_quantum(&m_machine, timeslice_time.attoseconds, boost_duration);
554   add_scheduling_quantum(timeslice_time, boost_duration);
259555}
260556
261557
262558//-------------------------------------------------
263//  eat_all_cycles - eat a ton of cycles on all
264//  CPUs to force a quick exit
559//  timer_alloc - allocate a global non-device
560//  timer and return a pointer
265561//-------------------------------------------------
266562
267void device_scheduler::eat_all_cycles()
563emu_timer *device_scheduler::timer_alloc(timer_expired_func callback, const char *name, void *ptr)
268564{
269   for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
270      exec->eat_cycles(1000000000);
565   return &m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, false);
271566}
272567
273568
569//-------------------------------------------------
570//  timer_set - allocate an anonymous non-device
571//  timer and set it to go off after the given
572//  amount of time
573//-------------------------------------------------
274574
275//**************************************************************************
276//  GLOBAL HELPERS
277//**************************************************************************
575void device_scheduler::timer_set(attotime duration, timer_expired_func callback, const char *name, int param, void *ptr)
576{
577   m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, true).adjust(duration, param);
578}
278579
580
279581//-------------------------------------------------
280//  cpuexec_abort_timeslice - abort execution
281//  for the current timeslice
582//  timer_pulse - allocate an anonymous non-device
583//  timer and set it to go off at the given
584//  frequency
282585//-------------------------------------------------
283586
284void device_scheduler::abort_timeslice()
587void device_scheduler::timer_pulse(attotime period, timer_expired_func callback, const char *name, int param, void *ptr)
285588{
286   if (m_executing_device != NULL)
287      m_executing_device->abort_timeslice();
589   m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, true).adjust(period, param, period);
288590}
289591
290592
291593//-------------------------------------------------
292//  trigger - generate a global trigger
594//  timer_alloc - allocate a global device timer
595//  and return a pointer
293596//-------------------------------------------------
294597
295void device_scheduler::trigger(int trigid, attotime after)
598emu_timer *device_scheduler::timer_alloc(device_t &device, device_timer_id id, void *ptr)
296599{
297   // ensure we have a list of executing devices
298   if (m_execute_list == NULL)
299      rebuild_execute_list();
600   return &m_timer_allocator.alloc()->init(device, id, ptr, false);
601}
300602
301   // if we have a non-zero time, schedule a timer
302   if (after.attoseconds != 0 || after.seconds != 0)
303      timer_set(&m_machine, after, (void *)this, trigid, static_timed_trigger);
304603
305   // send the trigger to everyone who cares
306   else
307      for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
308         exec->trigger(trigid);
604//-------------------------------------------------
605//  timer_set - allocate an anonymous device timer
606//  and set it to go off after the given amount of
607//  time
608//-------------------------------------------------
609
610void device_scheduler::timer_set(attotime duration, device_t &device, device_timer_id id, int param, void *ptr)
611{
612   m_timer_allocator.alloc()->init(device, id, ptr, true).adjust(duration, param);
309613}
310614
311615
312616//-------------------------------------------------
313//  static_timed_trigger - generate a trigger
314//  after a given amount of time
617//  eat_all_cycles - eat a ton of cycles on all
618//  CPUs to force a quick exit
315619//-------------------------------------------------
316620
317TIMER_CALLBACK( device_scheduler::static_timed_trigger )
621void device_scheduler::eat_all_cycles()
318622{
319   reinterpret_cast<device_scheduler *>(ptr)->trigger(param);
623   for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
624      exec->eat_cycles(1000000000);
320625}
321626
322627
323628//-------------------------------------------------
629//  timed_trigger - generate a trigger after a
630//  given amount of time
631//-------------------------------------------------
632
633void device_scheduler::timed_trigger(running_machine &machine, INT32 param)
634{
635   trigger(param);
636}
637
638
639//-------------------------------------------------
640//  postload - after loading a save state
641//-------------------------------------------------
642
643void device_scheduler::postload()
644{
645   // remove all timers and make a private list of permanent ones
646   simple_list<emu_timer> private_list;
647   while (m_timer_list != NULL)
648   {
649      emu_timer &timer = *m_timer_list;
650
651      // temporary timers go away entirely
652      if (timer.m_temporary)
653         m_timer_allocator.reclaim(timer.release());
654
655      // permanent ones get added to our private list
656      else
657         private_list.append(timer_list_remove(timer));
658   }
659
660   // now re-insert them; this effectively re-sorts them by time
661   emu_timer *timer;
662   while ((timer = private_list.detach_head()) != NULL)
663      timer_list_insert(*timer);
664}
665
666
667//-------------------------------------------------
324668//  compute_perfect_interleave - compute the
325669//  "perfect" interleave interval
326670//-------------------------------------------------
r10315r10316
335679   device_execute_interface *first = m_execute_list;
336680   if (first != NULL)
337681   {
682      // start with a huge time factor and find the 2nd smallest cycle time
338683      attoseconds_t smallest = first->minimum_quantum();
339684      attoseconds_t perfect = ATTOSECONDS_PER_SECOND - 1;
340
341      // start with a huge time factor and find the 2nd smallest cycle time
342685      for (device_execute_interface *exec = first->m_nextexec; exec != NULL; exec = exec->m_nextexec)
343686      {
687         // find the 2nd smallest cycle interval
344688         attoseconds_t curquantum = exec->minimum_quantum();
345
346         // find the 2nd smallest cycle interval
347689         if (curquantum < smallest)
348690         {
349691            perfect = smallest;
r10315r10316
353695            perfect = curquantum;
354696      }
355697
356      // adjust the final value
357      timer_set_minimum_quantum(&m_machine, perfect);
358
359      LOG(("Perfect interleave = %.9f, smallest = %.9f\n", ATTOSECONDS_TO_DOUBLE(perfect), ATTOSECONDS_TO_DOUBLE(smallest)));
698      // if this is a new minimum quantum, apply it
699      if (m_quantum_minimum != perfect)
700      {
701         // adjust all the actuals; this doesn't affect the current
702         m_quantum_minimum = perfect;
703         for (quantum_slot *quant = m_quantum_list.first(); quant != NULL; quant = quant->next())
704            quant->m_actual = MAX(quant->m_requested, m_quantum_minimum);
705      }
360706   }
361707}
362708
r10315r10316
370716void device_scheduler::rebuild_execute_list()
371717{
372718   // if we haven't yet set a scheduling quantum, do it now
373   if (!m_quantum_set)
719   if (m_quantum_list.first() == NULL)
374720   {
375721      // set the core scheduling quantum
376722      attotime min_quantum = m_machine.config->m_minimum_quantum;
r10315r10316
393739         min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum);
394740      }
395741
742      // make sure it's no higher than 60Hz
743      min_quantum = min(min_quantum, attotime::from_hz(60));
744
396745      // inform the timer system of our decision
397      assert(min_quantum.seconds == 0);
398      timer_add_scheduling_quantum(&m_machine, min_quantum.attoseconds, attotime::never);
399if (TEMPLOG) printf("Setting quantum: %08X%08X\n", (UINT32)(min_quantum.attoseconds >> 32), (UINT32)min_quantum.attoseconds);
400      m_quantum_set = true;
746      add_scheduling_quantum(min_quantum, attotime::never);
401747   }
402748
403749   // start with an empty list
r10315r10316
428774
429775   // append the suspend list to the end of the active list
430776   *active_tailptr = suspend_list;
431if (TEMPLOG)
777}
778
779
780//-------------------------------------------------
781//  timer_list_insert - insert a new timer into
782//  the list at the appropriate location
783//-------------------------------------------------
784
785emu_timer &device_scheduler::timer_list_insert(emu_timer &timer)
432786{
433   printf("Execute list:");
434   for (exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
435      printf(" %s", exec->device().tag());
436   printf("\n");
787   // disabled timers sort to the end
788   attotime expire = timer.m_enabled ? timer.m_expire : attotime::never;
789
790   // loop over the timer list
791   emu_timer *prevtimer = NULL;
792   for (emu_timer *curtimer = m_timer_list; curtimer != NULL; prevtimer = curtimer, curtimer = curtimer->next())
793   {
794      // if the current list entry expires after us, we should be inserted before it
795      if (curtimer->m_expire > expire)
796      {
797         // link the new guy in before the current list entry
798         timer.m_prev = curtimer->m_prev;
799         timer.m_next = curtimer;
800
801         if (curtimer->m_prev != NULL)
802            curtimer->m_prev->m_next = &timer;
803         else
804            m_timer_list = &timer;
805
806         curtimer->m_prev = &timer;
807         return timer;
808      }
809   }
810
811   // need to insert after the last one
812   if (prevtimer != NULL)
813      prevtimer->m_next = &timer;
814   else
815      m_timer_list = &timer;
816
817   timer.m_prev = prevtimer;
818   timer.m_next = NULL;
819   return timer;
437820}
821
822
823//-------------------------------------------------
824//  timer_list_remove - remove a timer from the
825//  linked list
826//-------------------------------------------------
827
828emu_timer &device_scheduler::timer_list_remove(emu_timer &timer)
829{
830   // remove it from the list
831   if (timer.m_prev != NULL)
832      timer.m_prev->m_next = timer.m_next;
833   else
834      m_timer_list = timer.m_next;
835
836   if (timer.m_next != NULL)
837      timer.m_next->m_prev = timer.m_prev;
838
839   return timer;
438840}
841
842
843//-------------------------------------------------
844//  execute_timers - execute timers and update
845//  scheduling quanta
846//-------------------------------------------------
847
848void device_scheduler::execute_timers()
849{
850   // if the current quantum has expired, find a new one
851   while (m_basetime >= m_quantum_list.first()->m_expire)
852      m_quantum_allocator.reclaim(m_quantum_list.detach_head());
853
854   LOG(("timer_set_global_time: new=%s head->expire=%s\n", m_basetime.as_string(), m_timer_list->m_expire.as_string()));
855
856   // now process any timers that are overdue
857   while (m_timer_list->m_expire <= m_basetime)
858   {
859      // if this is a one-shot timer, disable it now
860      emu_timer &timer = *m_timer_list;
861      bool was_enabled = timer.m_enabled;
862      if (timer.m_period == attotime::zero || timer.m_period == attotime::never)
863         timer.m_enabled = false;
864
865      // set the global state of which callback we're in
866      m_callback_timer_modified = false;
867      m_callback_timer = &timer;
868      m_callback_timer_expire_time = timer.m_expire;
869
870      // call the callback
871      if (was_enabled)
872      {
873         g_profiler.start(PROFILER_TIMER_CALLBACK);
874
875         if (timer.m_device != NULL)
876            timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr);
877         else if (timer.m_callback != NULL)
878            (*timer.m_callback)(&m_machine, timer.m_ptr, timer.m_param);
879
880         g_profiler.stop();
881      }
882
883      // clear the callback timer global
884      m_callback_timer = NULL;
885
886      // reset or remove the timer, but only if it wasn't modified during the callback
887      if (!m_callback_timer_modified)
888      {
889         // if the timer is temporary, remove it now
890         if (timer.m_temporary)
891            m_timer_allocator.reclaim(timer.release());
892
893         // otherwise, reschedule it
894         else
895            timer.schedule_next_period();
896      }
897   }
898}
899
900
901//-------------------------------------------------
902//  add_scheduling_quantum - add a scheduling
903//  quantum; the smallest active one is the one
904//  that is in use
905//-------------------------------------------------
906
907void device_scheduler::add_scheduling_quantum(attotime quantum, attotime duration)
908{
909   assert(quantum.seconds == 0);
910   
911   attotime curtime = time();
912   attotime expire = curtime + duration;
913
914   // figure out where to insert ourselves, expiring any quanta that are out-of-date
915   quantum_slot *insert_after = NULL;
916   quantum_slot *next;
917   for (quantum_slot *quant = m_quantum_list.first(); quant != NULL; quant = next)
918   {
919      // if this quantum is expired, nuke it
920      next = quant->next();
921      if (curtime >= quant->m_expire)
922         m_quantum_allocator.reclaim(m_quantum_list.detach(*quant));
923   
924      // if this quantum is shorter than us, we need to be inserted afterwards
925      else if (quant->m_requested <= quantum.attoseconds)
926         insert_after = quant;
927   }
928   
929   // if we found an exact match, just take the maximum expiry time
930   if (insert_after != NULL && insert_after->m_requested == quantum.attoseconds)
931      insert_after->m_expire = max(insert_after->m_expire, expire);
932   
933   // otherwise, allocate a new quantum and insert it after the one we picked
934   else
935   {
936      quantum_slot &quant = *m_quantum_allocator.alloc();
937      quant.m_requested = quantum.attoseconds;
938      quant.m_actual = MAX(quantum.attoseconds, m_quantum_minimum);
939      quant.m_expire = expire;
940      m_quantum_list.insert_after(quant, insert_after);
941   }
942}
943
944
945/***************************************************************************
946//  DEBUGGING
947***************************************************************************/
948
949#if 0
950//-------------------------------------------------
951//  timer_logtimers - log all the timers
952//-------------------------------------------------
953
954static void timer_logtimers(running_machine *machine)
955{
956   emu_timer *t;
957
958   logerror("===============\n");
959   logerror("TIMER LOG START\n");
960   logerror("===============\n");
961
962   logerror("Enqueued timers:\n");
963   for (t = global->activelist; t; t = t->next)
964      logerror("  Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n",
965         t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->file, t->line, t->func);
966
967   logerror("Free timers:\n");
968   for (t = global->freelist; t; t = t->next)
969      logerror("  Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n",
970         t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->file, t->line, t->func);
971
972   logerror("==============\n");
973   logerror("TIMER LOG STOP\n");
974   logerror("==============\n");
975}
976
977
978void timer_print_first_timer(running_machine *machine)
979{
980   emu_timer *t = global->activelist;
981   printf("  Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s)\n",
982      t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->func);
983}
984
985
986#endif
No newline at end of file
src/emu/imagedev/cassette.c
r10315r10316
7171static void cassette_update(device_t *device)
7272{
7373   dev_cassette_t   *cassette = get_safe_token( device );
74   double cur_time = timer_get_time(device->machine).as_double();
74   double cur_time = device->machine->time().as_double();
7575
7676   if (cassette_is_motor_on(device))
7777   {
r10315r10316
187187   position = cassette->position;
188188
189189   if (cassette_is_motor_on(device))
190      position += timer_get_time(device->machine).as_double() - cassette->position_time;
190      position += device->machine->time().as_double() - cassette->position_time;
191191   return position;
192192}
193193
r10315r10316
302302
303303   /* reset the position */
304304   cassette->position = 0.0;
305   cassette->position_time = timer_get_time(device->machine).as_double();
305   cassette->position_time = device->machine->time().as_double();
306306
307307   return IMAGE_INIT_PASS;
308308
src/emu/imagedev/flopdrv.c
r10315r10316
214214   pDrive->flags = 0;
215215   pDrive->index_pulse_callback = NULL;
216216   pDrive->ready_state_change_callback = NULL;
217   pDrive->index_timer = timer_alloc(img->machine, floppy_drive_index_callback, (void *) img);
217   pDrive->index_timer = img->machine->scheduler().timer_alloc(FUNC(floppy_drive_index_callback), (void *) img);
218218   pDrive->idx = 0;
219219
220220   floppy_drive_set_geometry(img, ((floppy_config*)img->baseconfig().static_config())->floppy_type);
r10315r10316
674674   else
675675      next_wpt = CLEAR_LINE;
676676
677   timer_set(image.device().machine, attotime::from_msec(250), flopimg, next_wpt, set_wpt);
677   image.device().machine->scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), next_wpt, flopimg);
678678
679679   return retVal;
680680}
r10315r10316
702702   devcb_call_write_line(&flopimg->out_wpt_func, flopimg->wpt);
703703
704704   /* set timer for disk eject */
705   timer_set(image.device().machine, attotime::from_msec(250), flopimg, ASSERT_LINE, set_wpt);
705   image.device().machine->scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), ASSERT_LINE, flopimg);
706706}
707707
708708device_t *floppy_get_device(running_machine *machine,int drive)
src/emu/imagedev/bitbngr.c
r10315r10316
344344
345345   /* output config */
346346   bi->build_count = 0;
347   bi->bitbanger_output_timer = timer_alloc(device->machine, bitbanger_output_timer, (void *) device);
347   bi->bitbanger_output_timer = device->machine->scheduler().timer_alloc(FUNC(bitbanger_output_timer), (void *) device);
348348
349349   /* input config */
350   bi->bitbanger_input_timer = timer_alloc(device->machine, bitbanger_input_timer, (void *) device );
350   bi->bitbanger_input_timer = device->machine->scheduler().timer_alloc(FUNC(bitbanger_input_timer), (void *) device );
351351   bi->idle_delay = attotime::from_seconds(1);
352352   bi->input_buffer_size = 0;
353353   bi->input_buffer_cursor = 0;
r10315r10316
453453      timer_adjust_periodic(bi->bitbanger_output_timer, one_point_five_baud, 0, bi->current_baud);
454454   }
455455
456   //fprintf(stderr,"%s, %d\n", timer_get_time(device->machine).as_string(9), value);
456   //fprintf(stderr,"%s, %d\n", device->machine->time().as_string(9), value);
457457   bi->output_value = value;
458458}
459459
src/emu/imagedev/snapquik.c
r10315r10316
132132   snapquick_token *token = get_token(device);
133133
134134   /* allocate a timer */
135   token->timer = timer_alloc(device->machine, process_snapshot_or_quickload, (void *) dynamic_cast<device_image_interface *>(device));
135   token->timer = device->machine->scheduler().timer_alloc(FUNC(process_snapshot_or_quickload), (void *) dynamic_cast<device_image_interface *>(device));
136136
137137}
138138
src/emu/schedule.h
r10315r10316
5151//  MACROS
5252//**************************************************************************
5353
54// this macro wraps a function 'x' and can be used to pass a function followed by its name
55#define FUNC(x) x, #x
56
57// this macro wraps a member function 'x' from class 'c' using a templatized stub of type 's'
58#define MFUNC(s,c,x) s##_stub<c, &c::x>, #c "::" #x
59
60
5461// these must be macros because we are included before the running_machine
5562#define cpuexec_describe_context(mach)            (mach)->describe_context()
5663#define cpuexec_boost_interleave(mach, slice, dur)   (mach)->scheduler().boost_interleave(slice, dur)
5764#define cpuexec_trigger(mach, trigid)            (mach)->scheduler().trigger(trigid)
5865#define cpuexec_triggertime(mach, trigid, dur)      (mach)->scheduler().trigger(trigid, dur)
5966
67// macro for the RC time constant on a 74LS123 with C > 1000pF
68// R is in ohms, C is in farads
69#define TIME_OF_74LS123(r,c)         (0.45 * (double)(r) * (double)(c))
6070
71// macros for the RC time constant on a 555 timer IC
72// R is in ohms, C is in farads
73#define PERIOD_OF_555_MONOSTABLE_NSEC(r,c)   ((attoseconds_t)(1100000000 * (double)(r) * (double)(c)))
74#define PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c)   ((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c)))
75#define PERIOD_OF_555_MONOSTABLE(r,c)      attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c))
76#define PERIOD_OF_555_ASTABLE(r1,r2,c)      attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c))
6177
78#define TIMER_CALLBACK(name)         void name(running_machine *machine, void *ptr, int param)
79
80
81
6282//**************************************************************************
6383//  TYPE DEFINITIONS
6484//**************************************************************************
6585
86// timer callbacks look like this
87typedef void (*timer_expired_func)(running_machine *machine, void *ptr, INT32 param);
88
89// stub for when the ptr parameter points to a class
90template<class T, void (T::*func)(running_machine &machine, INT32 param)>
91void timer_expired_stub(running_machine *machine, void *ptr, INT32 param)
92{
93   T *target = reinterpret_cast<T *>(ptr);
94   (target->*func)(*machine, param);
95}
96
97
98// ======================> emu_timer
99
100class emu_timer
101{
102   friend class device_scheduler;
103   friend class simple_list<emu_timer>;
104   friend class fixed_allocator<emu_timer>;
105
106   // construction/destruction
107   emu_timer();
108
109   // allocation and re-use
110   emu_timer &init(running_machine &machine, timer_expired_func callback, const char *name, void *ptr, bool temporary);
111   emu_timer &init(device_t &device, device_timer_id id, void *ptr, bool temporary);
112   emu_timer &release();
113
114public:
115   // getters
116   emu_timer *next() const { return m_next; }
117   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
118   bool enabled() const { return m_enabled; }
119   int param() const { return m_param; }
120   void *ptr() const { return m_ptr; }
121
122   // setters
123   bool enable(bool enable = true);
124   void set_param(int param) { m_param = param; }
125   void set_ptr(void *ptr) { m_ptr = ptr; }
126
127   // control
128   void reset(attotime duration) { adjust(duration, m_param, m_period); }
129   void adjust(attotime duration, INT32 param = 0, attotime periodicity = attotime::never);
130
131   // timing queries
132   attotime elapsed() const;
133   attotime remaining() const;
134   attotime start() const { return m_start; }
135   attotime expire() const { return m_expire; }
136
137private:
138   // internal helpers
139   void register_save();
140   void schedule_next_period();
141
142   // internal state
143   running_machine *   m_machine;      // reference to the owning machine
144   emu_timer *         m_next;         // next timer in order in the list
145   emu_timer *         m_prev;         // previous timer in order in the list
146   timer_expired_func   m_callback;      // callback function
147   INT32            m_param;      // integer parameter
148   void *            m_ptr;         // pointer parameter
149   const char *      m_func;         // string name of the callback function
150   bool            m_enabled;      // is the timer enabled?
151   bool            m_temporary;   // is the timer temporary?
152   attotime         m_period;      // the repeat frequency of the timer
153   attotime         m_start;      // time when the timer was started
154   attotime         m_expire;      // time when the timer will expire
155   device_t *         m_device;      // for device timers, a pointer to the device
156   device_timer_id      m_id;         // for device timers, the ID of the timer
157};
158
159
66160// ======================> device_scheduler
67161
68162class device_scheduler
69163{
70164   friend class device_execute_interface;
165   friend class emu_timer;
71166
72167public:
168   // construction/destruction
73169   device_scheduler(running_machine &machine);
74170   ~device_scheduler();
171   void register_for_save();
75172
173   // getters
174   attotime time() const;
175   emu_timer *first_timer() const { return m_timer_list; }
176   device_execute_interface *currently_executing() const { return m_executing_device; }
177   bool can_save() const;
178
179   // execution
76180   void timeslice();
77
181   void abort_timeslice();
78182   void trigger(int trigid, attotime after = attotime::zero);
79
80183   void boost_interleave(attotime timeslice_time, attotime boost_duration);
81   void abort_timeslice();
184   
185   // timers, specified by callback/name
186   emu_timer *timer_alloc(timer_expired_func callback, const char *name, void *ptr = NULL);
187   void timer_set(attotime duration, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL);
188   void timer_pulse(attotime period, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL);
189   void synchronize(timer_expired_func callback = NULL, const char *name = NULL, int param = 0, void *ptr = NULL) { timer_set(attotime::zero, callback, name, param, ptr); }
82190
83   device_execute_interface *currently_executing() const { return m_executing_device; }
191   // timers, specified by device/id; generally devices should use the device_t methods instead
192   emu_timer *timer_alloc(device_t &device, device_timer_id id = 0, void *ptr = NULL);
193   void timer_set(attotime duration, device_t &device, device_timer_id id = 0, int param = 0, void *ptr = NULL);
84194
85   // for timer system only!
86   attotime override_local_time(attotime default_time);
87
88195   // for emergencies only!
89196   void eat_all_cycles();
90197
91198private:
199   // callbacks
200   void timed_trigger(running_machine &machine, INT32 param);
201   void postload();
202   
203   // scheduling helpers
92204   void compute_perfect_interleave();
93205   void rebuild_execute_list();
206   void add_scheduling_quantum(attotime quantum, attotime duration);
207   
208   // timer helpers
209   emu_timer &timer_list_insert(emu_timer &timer);
210   emu_timer &timer_list_remove(emu_timer &timer);
211   void execute_timers();
94212
95   static TIMER_CALLBACK( static_timed_trigger );
213   // internal state
214   running_machine &         m_machine;               // reference to our machine
215   device_execute_interface *   m_executing_device;         // pointer to currently executing device
216   device_execute_interface *   m_execute_list;            // list of devices to be executed
217   attotime               m_basetime;               // global basetime; everything moves forward from here
96218
97   running_machine &         m_machine;            // reference to our owner
98   bool                  m_quantum_set;         // have we set the scheduling quantum yet?
99   device_execute_interface *   m_executing_device;      // pointer to currently executing device
100   device_execute_interface *   m_execute_list;         // list of devices to be executed
219   // list of active timers
220   emu_timer *               m_timer_list;            // head of the active list
221   fixed_allocator<emu_timer>   m_timer_allocator;         // allocator for timers
222
223   // other internal states
224   emu_timer *               m_callback_timer;         // pointer to the current callback timer
225   bool                  m_callback_timer_modified;    // true if the current callback timer was modified
226   attotime               m_callback_timer_expire_time; // the original expiration time
227
228   // scheduling quanta
229   class quantum_slot
230   {
231      friend class simple_list<quantum_slot>;
232
233   public:
234      quantum_slot *next() const { return m_next; }
235   
236      quantum_slot *         m_next;
237      attoseconds_t         m_actual;               // actual duration of the quantum
238      attoseconds_t         m_requested;            // duration of the requested quantum
239      attotime            m_expire;               // absolute expiration time of this quantum
240   };
241   simple_list<quantum_slot>    m_quantum_list;            // list of active quanta
242   fixed_allocator<quantum_slot> m_quantum_allocator;      // allocator for quanta
243   attoseconds_t            m_quantum_minimum;         // duration of minimum quantum
101244};
102245
103246
104#endif   /* __SCHEDULE_H__ */
247
248
249// temporary stuff
250inline void timer_adjust_oneshot(emu_timer *which, attotime duration, INT32 param) { which->adjust(duration, param); }
251inline void timer_adjust_periodic(emu_timer *which, attotime start_delay, INT32 param, attotime period) { which->adjust(start_delay, param, period); }
252
253inline void timer_reset(emu_timer *which, attotime duration) { which->reset(duration); }
254inline int timer_enable(emu_timer *which, int enable) { return which->enable(enable); }
255inline int timer_enabled(emu_timer *which) { return which->enabled(); }
256inline int timer_get_param(emu_timer *which) { return which->param(); }
257inline void timer_set_param(emu_timer *which, int param) { which->set_param(param); }
258inline void *timer_get_ptr(emu_timer *which) { return which->ptr(); }
259inline void timer_set_ptr(emu_timer *which, void *ptr) { which->set_ptr(ptr); }
260
261inline attotime timer_timeelapsed(emu_timer *which) { return which->elapsed(); }
262inline attotime timer_timeleft(emu_timer *which) { return which->remaining(); }
263inline attotime timer_starttime(emu_timer *which) { return which->start(); }
264inline attotime timer_firetime(emu_timer *which) { return which->expire(); }
265
266#endif   // __SCHEDULE_H__ */
src/emu/audio/generic.c
r10315r10316
8787
8888INLINE void latch_w(address_space *space, int which, UINT16 value)
8989{
90   timer_call_after_resynch(space->machine, NULL, which | (value << 8), latch_callback);
90   space->machine->scheduler().synchronize(FUNC(latch_callback), which | (value << 8));
9191}
9292
9393
src/emu/devimage.c
r10315r10316
500500   }
501501   else {
502502      /* do we need to reset the CPU? only schedule it if load/create is successful */
503      if (timer_get_time(device().machine) > attotime::zero && m_image_config.is_reset_on_load())
503      if (device().machine->time() > attotime::zero && m_image_config.is_reset_on_load())
504504         device().machine->schedule_hard_reset();
505505      else
506506      {
src/emu/devcpu.h
r10315r10316
4646#ifndef __DEVCPU_H__
4747#define __DEVCPU_H__
4848
49#include "devlegcy.h"
4950
51
5052//**************************************************************************
5153//  CONSTANTS
5254//**************************************************************************
src/emu/watchdog.c
r10315r10316
3939void watchdog_init(running_machine *machine)
4040{
4141   /* allocate a timer for the watchdog */
42   watchdog_timer = timer_alloc(machine, watchdog_callback, NULL);
42   watchdog_timer = machine->scheduler().timer_alloc(FUNC(watchdog_callback));
4343
4444   machine->add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset);
4545
src/emu/machine/mc68901.c
r10315r10316
801801   m_timer_clock = m_config.timer_clock;
802802 
803803   /* create the timers */
804   m_timer[TIMER_A] = device_timer_alloc(*this, TIMER_A);
805   m_timer[TIMER_B] = device_timer_alloc(*this, TIMER_B);
806   m_timer[TIMER_C] = device_timer_alloc(*this, TIMER_C);
807   m_timer[TIMER_D] = device_timer_alloc(*this, TIMER_D);
804   m_timer[TIMER_A] = timer_alloc(TIMER_A);
805   m_timer[TIMER_B] = timer_alloc(TIMER_B);
806   m_timer[TIMER_C] = timer_alloc(TIMER_C);
807   m_timer[TIMER_D] = timer_alloc(TIMER_D);
808808 
809809   if (m_config.rx_clock > 0)
810810   {
811      m_rx_timer = device_timer_alloc(*this, TIMER_RX);
811      m_rx_timer = timer_alloc(TIMER_RX);
812812      timer_adjust_periodic(m_rx_timer, attotime::zero, 0, attotime::from_hz(m_config.rx_clock));
813813   }
814814 
815815   if (m_config.tx_clock > 0)
816816   {
817      m_tx_timer = device_timer_alloc(*this, TIMER_TX);
817      m_tx_timer = timer_alloc(TIMER_TX);
818818      timer_adjust_periodic(m_tx_timer, attotime::zero, 0, attotime::from_hz(m_config.tx_clock));
819819   }
820820 
src/emu/machine/timekpr.c
r10315r10316
227227   state_save_register_device_item( this, 0, m_century );
228228   state_save_register_device_item_pointer( this, 0, m_data, m_size );
229229
230   timer = timer_alloc( &m_machine, timekeeper_tick_callback, (void *)this );
230   timer = m_machine.scheduler().timer_alloc( FUNC(timekeeper_tick_callback), (void *)this );
231231   duration = attotime::from_seconds(1);
232232   timer_adjust_periodic( timer, duration, 0, duration );
233233}
src/emu/machine/6526cia.c
r10315r10316
200200   for (int t = 0; t < (sizeof(m_timer) / sizeof(m_timer[0])); t++)
201201   {
202202      cia_timer *timer = &m_timer[t];
203      timer->m_timer = timer_alloc(&m_machine, timer_proc, (void*)this);
203      timer->m_timer = m_machine.scheduler().timer_alloc(FUNC(timer_proc), (void*)this);
204204      timer->m_cia = this;
205205      timer->m_irq = 0x01 << t;
206206   }
r10315r10316
208208   /* setup TOD timer, if appropriate */
209209   if (m_config.m_tod_clock != 0)
210210   {
211      timer_pulse(&m_machine, attotime::from_hz(m_config.m_tod_clock), (void *)this, 0, clock_tod_callback);
211      m_machine.scheduler().timer_pulse(attotime::from_hz(m_config.m_tod_clock), FUNC(clock_tod_callback), 0, (void *)this);
212212   }
213213
214214   /* state save support */
src/emu/machine/74123.c
r10315r10316
106106
107107void ttl74123_device::device_start()
108108{
109   m_timer = timer_alloc(&m_machine, clear_callback, (void *)this);
109   m_timer = m_machine.scheduler().timer_alloc(FUNC(clear_callback), (void *)this);
110110
111111   /* start with the defaults */
112112   m_a = m_config.m_a;
r10315r10316
202202{
203203   int output = timer_running();
204204
205   timer_set( &m_machine, attotime::zero, (void *)this, output, output_callback );
205   m_machine.scheduler().timer_set( attotime::zero, FUNC(output_callback ), output, (void *)this);
206206
207207   if (LOG) logerror("74123 %s:  Output: %d\n", tag(), output);
208208}
src/emu/machine/idectrl.c
r10315r10316
258258
259259   /* set a timer */
260260   if (buffer_ready)
261      timer_set(ide->device->machine, time, ide, 0, delayed_interrupt_buffer_ready);
261      ide->device->machine->scheduler().timer_set(time, FUNC(delayed_interrupt_buffer_ready), 0, ide);
262262   else
263      timer_set(ide->device->machine, time, ide, 0, delayed_interrupt);
263      ide->device->machine->scheduler().timer_set(time, FUNC(delayed_interrupt), 0, ide);
264264}
265265
266266
r10315r10316
625625   ide->status &= ~IDE_STATUS_DRIVE_READY;
626626
627627   /* just set a timer and mark ourselves error */
628   timer_set(ide->device->machine, TIME_SECURITY_ERROR, ide, 0, security_error_done);
628   ide->device->machine->scheduler().timer_set(TIME_SECURITY_ERROR, FUNC(security_error_done), 0, ide);
629629}
630630
631631
r10315r10316
806806         seek_time = TIME_SEEK_MULTISECTOR;
807807
808808      ide->cur_lba = new_lba;
809      timer_set(ide->device->machine, seek_time, ide, 0, read_sector_done_callback);
809      ide->device->machine->scheduler().timer_set(seek_time, FUNC(read_sector_done_callback), 0, ide);
810810   }
811811   else
812      timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, read_sector_done_callback);
812      ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide);
813813}
814814
815815
r10315r10316
825825         read_sector_done(ide);
826826      else
827827         /* just set a timer */
828         timer_set(ide->device->machine, attotime::from_usec(1), ide, 0, read_sector_done_callback);
828         ide->device->machine->scheduler().timer_set(attotime::from_usec(1), FUNC(read_sector_done_callback), 0, ide);
829829   }
830830   else
831831      /* just set a timer */
832      timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, read_sector_done_callback);
832      ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide);
833833}
834834
835835
r10315r10316
862862      else
863863      {
864864         /* set a timer to do the write */
865         timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, write_sector_done_callback);
865         ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide);
866866      }
867867   }
868868   else
869869   {
870870      /* set a timer to do the write */
871      timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, write_sector_done_callback);
871      ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide);
872872   }
873873}
874874
r10315r10316
18361836   }
18371837
18381838   /* create a timer for timing status */
1839   ide->last_status_timer = timer_alloc(device->machine, NULL, NULL);
1840   ide->reset_timer = timer_alloc(device->machine, reset_callback, (void *)device);
1839   ide->last_status_timer = device->machine->scheduler().timer_alloc(FUNC(NULL));
1840   ide->reset_timer = device->machine->scheduler().timer_alloc(FUNC(reset_callback), (void *)device);
18411841
18421842   /* register ide states */
18431843   state_save_register_device_item(device, 0, ide->adapter_control);
src/emu/machine/68681.c
r10315r10316
710710   duart68681->duart_config = (const duart68681_config *)device->baseconfig().static_config();
711711   duart68681->device = device;
712712
713   duart68681->channel[0].tx_timer = timer_alloc(device->machine, tx_timer_callback, (void*)device);
714   duart68681->channel[1].tx_timer = timer_alloc(device->machine, tx_timer_callback, (void*)device);
715   duart68681->duart_timer = timer_alloc(device->machine, duart_timer_callback, (void*)device);
713   duart68681->channel[0].tx_timer = device->machine->scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device);
714   duart68681->channel[1].tx_timer = device->machine->scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device);
715   duart68681->duart_timer = device->machine->scheduler().timer_alloc(FUNC(duart_timer_callback), (void*)device);
716716
717717   state_save_register_device_item(device, 0, duart68681->ACR);
718718   state_save_register_device_item(device, 0, duart68681->IMR);
src/emu/machine/6532riot.c
r10315r10316
238238   if ((offset & 0x14) == 0x14)
239239   {
240240      static const UINT8 timershift[4] = { 0, 3, 6, 10 };
241      attotime curtime = timer_get_time(&m_machine);
241      attotime curtime = m_machine.time();
242242      INT64 target;
243243
244244      /* A0-A1 contain the timer divisor */
r10315r10316
534534   devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);
535535
536536   /* allocate timers */
537   m_timer = timer_alloc(&m_machine, timer_end_callback, (void *)this);
537   m_timer = m_machine.scheduler().timer_alloc(FUNC(timer_end_callback), (void *)this);
538538
539539   /* register for save states */
540540   state_save_register_device_item(this, 0, m_port[0].m_in);
src/emu/machine/6522via.c
r10315r10316
169169   }
170170    else
171171    {
172        val = 0xffff - time_to_cycles(timer_get_time(&m_machine) - m_time1);
172        val = 0xffff - time_to_cycles(m_machine.time() - m_time1);
173173   }
174174
175175   return val;
r10315r10316
217217    m_t1lh = 0xb5; /* ports are not written by kernel! */
218218    m_t2ll = 0xff; /* taken from vice */
219219    m_t2lh = 0xff;
220    m_time2 = m_time1 = timer_get_time(&m_machine);
221    m_t1 = device_timer_alloc(*this, TIMER_T1);
222    m_t2 = device_timer_alloc(*this, TIMER_T2);
223    m_shift_timer = device_timer_alloc(*this, TIMER_SHIFT);
220    m_time2 = m_time1 = m_machine.time();
221    m_t1 = timer_alloc(TIMER_T1);
222    m_t2 = timer_alloc(TIMER_T2);
223    m_shift_timer = timer_alloc(TIMER_SHIFT);
224224
225225   /* Default clock is from CPU1 */
226226   if (clock() == 0)
r10315r10316
441441                  m_out_b |= 0x80;
442442              }
443443              m_t1_active = 0;
444              m_time1 = timer_get_time(&m_machine);
444              m_time1 = m_machine.time();
445445          }
446446          if (m_ddr_b)
447447         {
r10315r10316
458458      // t2 timeout
459459      case TIMER_T2:
460460          m_t2_active = 0;
461          m_time2 = timer_get_time(&m_machine);
461          m_time2 = m_machine.time();
462462
463463          if (!(m_ifr & INT_T2))
464464          {
r10315r10316
605605            }
606606         else
607607            {
608            val = (0x10000 - (time_to_cycles(timer_get_time(&m_machine) - m_time2) & 0xffff) - 1) & 0xff;
608            val = (0x10000 - (time_to_cycles(m_machine.time() - m_time2) & 0xffff) - 1) & 0xff;
609609            }
610610      }
611611      break;
r10315r10316
623623            }
624624         else
625625            {
626            val = (0x10000 - (time_to_cycles(timer_get_time(&m_machine) - m_time2) & 0xffff) - 1) >> 8;
626            val = (0x10000 - (time_to_cycles(m_machine.time() - m_time2) & 0xffff) - 1) >> 8;
627627            }
628628      }
629629      break;
r10315r10316
825825      {
826826         timer_adjust_oneshot(m_t2, cycles_to_time(TIMER2_VALUE), 0);
827827         m_t2_active = 1;
828         m_time2 = timer_get_time(&m_machine);
828         m_time2 = m_machine.time();
829829      }
830830      break;
831831
src/emu/machine/ldpr8210.c
r10315r10316
340340static void pr8210_init(laserdisc_state *ld)
341341{
342342   astring tempstring;
343   attotime curtime = timer_get_time(ld->device->machine);
343   attotime curtime = ld->device->machine->time();
344344   ldplayer_data *player = ld->player;
345345
346346   /* reset our state */
r10315r10316
380380
381381   /* signal VSYNC and set a timer to turn it off */
382382   player->vsync = TRUE;
383   timer_set(ld->device->machine, ld->screen->scan_period() * 4, ld, 0, vsync_off);
383   ld->device->machine->scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld);
384384
385385   /* also set a timer to fetch the VBI data when it is ready */
386   timer_set(ld->device->machine, ld->screen->time_until_pos(19*2), ld, 0, vbi_data_fetch);
386   ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld);
387387}
388388
389389
r10315r10316
451451   /* handle rising edge */
452452   if (prev != ASSERT_LINE && data == ASSERT_LINE)
453453   {
454      attotime curtime = timer_get_time(ld->device->machine);
454      attotime curtime = ld->device->machine->time();
455455      attotime delta, overalldelta;
456456      int longpulse;
457457
r10315r10316
840840
841841   /* on the falling edge of bit 5, start the slow timer */
842842   if (!(data & 0x20) && (prev & 0x20))
843      player->slowtrg = timer_get_time(space->machine);
843      player->slowtrg = space->machine->time();
844844
845845   /* bit 6 when low triggers an IRQ on the MCU */
846846   if (player->cpu != NULL)
r10315r10316
11191119      if (LOG_SIMUTREK)
11201120         printf("%3d:VSYNC IRQ\n", ld->screen->vpos());
11211121      cpu_set_input_line(player->simutrek.cpu, MCS48_INPUT_IRQ, ASSERT_LINE);
1122      timer_set(ld->device->machine, ld->screen->scan_period(), ld, 0, irq_off);
1122      ld->device->machine->scheduler().timer_set(ld->screen->scan_period(), FUNC(irq_off), 0, ld);
11231123   }
11241124}
11251125
r10315r10316
11641164
11651165static void simutrek_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data)
11661166{
1167   timer_call_after_resynch(ld->device->machine, ld, data, simutrek_latched_data_w);
1167   ld->device->machine->scheduler().synchronize(FUNC(simutrek_latched_data_w), data, ld);
11681168   if (LOG_SIMUTREK)
11691169      printf("%03d:**** Simutrek Command = %02X\n", ld->screen->vpos(), data);
11701170}
src/emu/machine/ds2401.c
r10315r10316
153153   state_save_register_item(machine,  "ds2401", NULL, which, c->rx );
154154   state_save_register_item(machine,  "ds2401", NULL, which, c->tx );
155155
156   c->timer = timer_alloc(machine, ds2401_tick , NULL);
157   c->reset_timer = timer_alloc(machine, ds2401_reset , NULL);
156   c->timer = machine->scheduler().timer_alloc(FUNC(ds2401_tick ));
157   c->reset_timer = machine->scheduler().timer_alloc(FUNC(ds2401_reset ));
158158}
159159
160160void ds2401_write( running_machine *machine, int which, int data )
src/emu/machine/6840ptm.c
r10315r10316
132132   }
133133
134134
135   m_timer[0] = timer_alloc(&m_machine, ptm6840_timer1_cb, (void *)this);
136   m_timer[1] = timer_alloc(&m_machine, ptm6840_timer2_cb, (void *)this);
137   m_timer[2] = timer_alloc(&m_machine, ptm6840_timer3_cb, (void *)this);
135   m_timer[0] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer1_cb), (void *)this);
136   m_timer[1] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer2_cb), (void *)this);
137   m_timer[2] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer3_cb), (void *)this);
138138
139139   for (int i = 0; i < 3; i++)
140140   {
src/emu/machine/am53cf96.c
r10315r10316
159159         case 3:   // reset SCSI bus
160160            scsi_regs[REG_INTSTATE] = 4;   // command sent OK
161161            xfer_state = 0;
162            timer_set( space->machine, attotime::from_hz( 16384 ), NULL, 0, am53cf96_irq );
162            space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq ));
163163            break;
164164         case 0x42:     // select with ATN steps
165            timer_set( space->machine, attotime::from_hz( 16384 ), NULL, 0, am53cf96_irq );
165            space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq ));
166166            if ((fifo[1] == 0) || (fifo[1] == 0x48) || (fifo[1] == 0x4b))
167167            {
168168               scsi_regs[REG_INTSTATE] = 6;
r10315r10316
192192         case 0x10:   // information transfer (must not change xfer_state)
193193         case 0x11:   // second phase of information transfer
194194         case 0x12:   // message accepted
195            timer_set( space->machine, attotime::from_hz( 16384 ), NULL, 0, am53cf96_irq );
195            space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq ));
196196            scsi_regs[REG_INTSTATE] = 6;   // command sent OK
197197            break;
198198         default:
src/emu/machine/z80dma.c
r10315r10316
238238   devcb_resolve_write8(&m_out_iorq_func, &m_config.m_out_iorq_func, this);
239239
240240   // allocate timer
241   m_timer = timer_alloc(&m_machine, static_timerproc, (void *)this);
241   m_timer = m_machine.scheduler().timer_alloc(FUNC(static_timerproc), (void *)this);
242242
243243   // register for state saving
244244   state_save_register_device_item_array(this, 0, m_regs);
r10315r10316
876876void z80dma_device::rdy_w(int state)
877877{
878878   if (LOG) logerror("Z80DMA '%s' RDY: %d Active High: %d\n", tag(), state, READY_ACTIVE_HIGH);
879   timer_call_after_resynch(&m_machine, (void *)this, state, static_rdy_write_callback);
879   m_machine.scheduler().synchronize(FUNC(static_rdy_write_callback), state, (void *)this);
880880}
881881
882882
src/emu/machine/pc16552d.c
r10315r10316
400400   duart[chip].ch[1].pending_interrupt = 0;
401401
402402   // allocate transmit timers
403   duart[chip].ch[0].tx_fifo_timer = timer_alloc(machine, tx_fifo_timer_callback, NULL);
403   duart[chip].ch[0].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback));
404404   timer_adjust_oneshot(duart[chip].ch[0].tx_fifo_timer, attotime::never, (chip * 2) + 0);
405405
406   duart[chip].ch[1].tx_fifo_timer = timer_alloc(machine, tx_fifo_timer_callback, NULL);
406   duart[chip].ch[1].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback));
407407   timer_adjust_oneshot(duart[chip].ch[1].tx_fifo_timer, attotime::never, (chip * 2) + 1);
408408}
409409
src/emu/machine/generic.c
r10315r10316
621621
622622   cpu_device *cpudevice = downcast<cpu_device *>(device);
623623   attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles());
624   timer_set(device->machine, target_time - timer_get_time(device->machine), (void *)device, irqline, irq_pulse_clear);
624   device->machine->scheduler().timer_set(target_time - device->machine->time(), FUNC(irq_pulse_clear), irqline, (void *)device);
625625}
626626
627627
r10315r10316
638638
639639   cpu_device *cpudevice = downcast<cpu_device *>(device);
640640   attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles());
641   timer_set(device->machine, target_time - timer_get_time(device->machine), (void *)device, irqline, irq_pulse_clear);
641   device->machine->scheduler().timer_set(target_time - device->machine->time(), FUNC(irq_pulse_clear), irqline, (void *)device);
642642}
643643
644644
r10315r10316
664664
665665   /* make sure there are no queued interrupts */
666666   if (enabled == 0)
667      timer_call_after_resynch(device->machine, (void *)cpudevice, 0, clear_all_lines);
667      device->machine->scheduler().synchronize(FUNC(clear_all_lines), 0, (void *)cpudevice);
668668}
669669
670670
src/emu/machine/8257dma.c
r10315r10316
137137   }
138138
139139   /* set initial values */
140   m_timer = device_timer_alloc(*this, TIMER_OPERATION);
141   m_msbflip_timer = device_timer_alloc(*this, TIMER_MSBFLIP);
140   m_timer = timer_alloc(TIMER_OPERATION);
141   m_msbflip_timer = timer_alloc(TIMER_MSBFLIP);
142142
143143   /* register for state saving */
144144   state_save_register_device_item_array(this, 0, m_address);
r10315r10316
449449{
450450   int param = (channel << 1) | (state ? 1 : 0);
451451
452   device_timer_call_after_resynch(*this, TIMER_DRQ_SYNC, param);
452   synchronize(TIMER_DRQ_SYNC, param);
453453}
454454
455455WRITE_LINE_DEVICE_HANDLER( i8257_hlda_w ) { }
src/emu/machine/tmp68301.c
r10315r10316
110110{
111111   int i;
112112   for (i = 0; i < 3; i++)
113      tmp68301_timer[i] = timer_alloc(machine, tmp68301_timer_callback, NULL);
113      tmp68301_timer[i] = machine->scheduler().timer_alloc(FUNC(tmp68301_timer_callback));
114114}
115115
116116MACHINE_RESET( tmp68301 )
src/emu/machine/z80sti.c
r10315r10316
244244   devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
245245
246246   // create the counter timers
247   m_timer[TIMER_A] = timer_alloc(&m_machine, static_timer_count, (void *)this);
248   m_timer[TIMER_B] = timer_alloc(&m_machine, static_timer_count, (void *)this);
249   m_timer[TIMER_C] = timer_alloc(&m_machine, static_timer_count, (void *)this);
250   m_timer[TIMER_D] = timer_alloc(&m_machine, static_timer_count, (void *)this);
247   m_timer[TIMER_A] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
248   m_timer[TIMER_B] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
249   m_timer[TIMER_C] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
250   m_timer[TIMER_D] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
251251
252252   // create serial receive clock timer
253253   if (m_config.m_rx_clock > 0)
254254   {
255      m_rx_timer = timer_alloc(&m_machine, static_rx_tick, (void *)this);
255      m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(static_rx_tick), (void *)this);
256256      timer_adjust_periodic(m_rx_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock));
257257   }
258258
259259   // create serial transmit clock timer
260260   if (m_config.m_tx_clock > 0)
261261   {
262      m_tx_timer = timer_alloc(&m_machine, static_tx_tick, (void *)this);
262      m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(static_tx_tick), (void *)this);
263263      timer_adjust_periodic(m_tx_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock));
264264   }
265265
src/emu/machine/ldvp931.c
r10315r10316
233233
234234   /* set the ERP signal to 1 to indicate start of frame, and set a timer to turn it off */
235235   ld->player->daticerp = 1;
236   timer_set(ld->device->machine, ld->screen->time_until_pos(15*2), ld, 0, erp_off);
236   ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(15*2), FUNC(erp_off), 0, ld);
237237}
238238
239239
r10315r10316
245245static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime)
246246{
247247   /* set the first VBI timer to go at the start of line 16 */
248   timer_set(ld->device->machine, ld->screen->time_until_pos(16*2), ld, LASERDISC_CODE_LINE16 << 2, vbi_data_fetch);
248   ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(16*2), FUNC(vbi_data_fetch), LASERDISC_CODE_LINE16 << 2, ld);
249249
250250   /* play forward by default */
251251   return fieldnum;
r10315r10316
260260static void vp931_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data)
261261{
262262   /* set a timer to synchronize execution before sending the data */
263   timer_call_after_resynch(ld->device->machine, ld, data, deferred_data_w);
263   ld->device->machine->scheduler().synchronize(FUNC(deferred_data_w), data, ld);
264264}
265265
266266
r10315r10316
335335   if (which == 0)
336336   {
337337      cpu_set_input_line(player->cpu, MCS48_INPUT_IRQ, ASSERT_LINE);
338      timer_set(machine, attotime::from_nsec(5580), ld, 0, irq_off);
338      machine->scheduler().timer_set(attotime::from_nsec(5580), FUNC(irq_off), 0, ld);
339339   }
340340
341341   /* clock the data strobe on each subsequent callback */
r10315r10316
343343   {
344344      player->daticval = code >> (8 * (3 - which));
345345      player->datastrobe = 1;
346      timer_set(machine, attotime::from_nsec(5000), ld, 0, datastrobe_off);
346      machine->scheduler().timer_set(attotime::from_nsec(5000), FUNC(datastrobe_off), 0, ld);
347347   }
348348
349349   /* determine the next bit to fetch and reprime ourself */
r10315r10316
353353      line++;
354354   }
355355   if (line <= LASERDISC_CODE_LINE18 + 1)
356      timer_set(machine, ld->screen->time_until_pos(line*2, which * 2 * ld->screen->width() / 4), ld, (line << 2) | which, vbi_data_fetch);
356      machine->scheduler().timer_set(ld->screen->time_until_pos(line*2, which * 2 * ld->screen->width() / 4), FUNC(vbi_data_fetch), (line << 2), ld);
357357}
358358
359359
src/emu/machine/f3853.c
r10315r10316
134134      }
135135   }
136136
137   m_timer = timer_alloc(&m_machine, f3853_timer_callback, (void *)this );
137   m_timer = m_machine.scheduler().timer_alloc(FUNC(f3853_timer_callback), (void *)this );
138138
139139   state_save_register_device_item(this, 0, m_high );
140140   state_save_register_device_item(this, 0, m_low );
src/emu/machine/k056230.c
r10315r10316
128128               {
129129                  cpu_set_input_line(m_cpu, INPUT_LINE_IRQ2, ASSERT_LINE);
130130               }
131               timer_set(&m_machine, attotime::from_usec(10), (void*)this, 0, network_irq_clear_callback);
131               m_machine.scheduler().timer_set(attotime::from_usec(10), FUNC(network_irq_clear_callback), 0, (void*)this);
132132            }
133133         }
134134//          else
src/emu/machine/6850acia.c
r10315r10316
116116   m_tx_clock = m_config.m_tx_clock;
117117   m_tx_counter = 0;
118118   m_rx_counter = 0;
119   m_rx_timer = timer_alloc(&m_machine, receive_event_callback, (void *)this);
120   m_tx_timer = timer_alloc(&m_machine, transmit_event_callback, (void *)this);
119   m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(receive_event_callback), (void *)this);
120   m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(transmit_event_callback), (void *)this);
121121   m_first_reset = 1;
122122   m_status_read = 0;
123123   m_brk = 0;
src/emu/machine/mb3773.c
r10315r10316
105105
106106void mb3773_device::device_start()
107107{
108   m_watchdog_timer = timer_alloc( &m_machine, watchdog_timeout, this );
108   m_watchdog_timer = m_machine.scheduler().timer_alloc( FUNC(watchdog_timeout), this );
109109   reset_timer();
110110
111111   state_save_register_device_item( this, 0, m_ck );
src/emu/machine/z80dart.c
r10315r10316
293293   if (m_config.m_rx_clock_a != 0)
294294   {
295295      // allocate channel A receive timer
296      m_rxca_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[CHANNEL_A]);
296      m_rxca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_A]);
297297      timer_adjust_periodic(m_rxca_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_a));
298298   }
299299
300300   if (m_config.m_tx_clock_a != 0)
301301   {
302302      // allocate channel A transmit timer
303      m_txca_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[CHANNEL_A]);
303      m_txca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_A]);
304304      timer_adjust_periodic(m_txca_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_a));
305305   }
306306
307307   if (m_config.m_rx_clock_b != 0)
308308   {
309309      // allocate channel B receive timer
310      m_rxcb_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[CHANNEL_B]);
310      m_rxcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_B]);
311311      timer_adjust_periodic(m_rxcb_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_b));
312312   }
313313
314314   if (m_config.m_tx_clock_b != 0)
315315   {
316316      // allocate channel B transmit timer
317      m_txcb_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[CHANNEL_B]);
317      m_txcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_B]);
318318      timer_adjust_periodic(m_txcb_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_b));
319319   }
320320
src/emu/machine/wd33c93.c
r10315r10316
352352      }
353353
354354      /* queue up a service request out in the future */
355      timer_set( machine, attotime::from_usec(50), NULL, 0, wd33c93_service_request );
355      machine->scheduler().timer_set( attotime::from_usec(50), FUNC(wd33c93_service_request ));
356356   }
357357   else
358358   {
r10315r10316
424424         scsi_data.busphase = PHS_MESS_IN;
425425
426426         /* queue up a service request out in the future */
427         timer_set( machine, attotime::from_msec(50), NULL, 0, wd33c93_service_request );
427         machine->scheduler().timer_set( attotime::from_msec(50), FUNC(wd33c93_service_request ));
428428      }
429429   }
430430   else
r10315r10316
454454   scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
455455
456456   /* the command will be completed once the data is transferred */
457   timer_set( machine, attotime::from_msec(1), NULL, 0, wd33c93_deassert_cip );
457   machine->scheduler().timer_set( attotime::from_msec(1), FUNC(wd33c93_deassert_cip ));
458458}
459459
460460/* Command handlers */
r10315r10316
795795   }
796796
797797   /* allocate a timer for commands */
798   scsi_data.cmd_timer = timer_alloc(machine, wd33c93_complete_cb, NULL);
798   scsi_data.cmd_timer = machine->scheduler().timer_alloc(FUNC(wd33c93_complete_cb));
799799
800800   scsi_data.temp_input = auto_alloc_array( machine, UINT8, TEMP_INPUT_LEN );
801801
src/emu/machine/pic8259.c
r10315r10316
406406
407407   assert(intf != NULL);
408408
409   pic8259->timer = timer_alloc( device->machine, pic8259_timerproc, (void *)device );
409   pic8259->timer = device->machine->scheduler().timer_alloc( FUNC(pic8259_timerproc), (void *)device );
410410
411411   /* resolve callbacks */
412412   devcb_resolve_write_line(&pic8259->out_int_func, &intf->out_int_func, device);
src/emu/machine/ldcore.c
r10315r10316
292292   device_t *device = (device_t *)param;
293293   laserdisc_state *ld = get_safe_token(device);
294294   ldcore_data *ldcore = ld->core;
295   attotime curtime = timer_get_time(screen.machine);
295   attotime curtime = screen.machine->time();
296296
297297   /* update current track based on slider speed */
298298   update_slider_pos(ldcore, curtime);
r10315r10316
305305         (*ldcore->intf.vsync)(ld, &ldcore->metadata[ldcore->fieldnum], ldcore->fieldnum, curtime);
306306
307307      /* set a timer to begin fetching the next frame just before the VBI data would be fetched */
308      timer_set(screen.machine, screen.time_until_pos(16*2), ld, 0, perform_player_update);
308      screen.machine->scheduler().timer_set(screen.time_until_pos(16*2), FUNC(perform_player_update), 0, ld);
309309   }
310310}
311311
r10315r10316
319319{
320320   laserdisc_state *ld = (laserdisc_state *)ptr;
321321   ldcore_data *ldcore = ld->core;
322   attotime curtime = timer_get_time(machine);
322   attotime curtime = machine->time();
323323
324324   /* wait for previous read and decode to finish */
325325   process_track_data(ld->device);
r10315r10316
554554   ldcore_data *ldcore = ld->core;
555555   attotime vsyncperiod = ld->screen->frame_period();
556556
557   update_slider_pos(ldcore, timer_get_time(ld->device->machine));
557   update_slider_pos(ldcore, ld->device->machine->time());
558558
559559   /* if 0, set the time to 0 */
560560   if (tracks_per_vsync == 0)
r10315r10316
582582{
583583   ldcore_data *ldcore = ld->core;
584584
585   update_slider_pos(ldcore, timer_get_time(ld->device->machine));
585   update_slider_pos(ldcore, ld->device->machine->time());
586586   add_and_clamp_track(ldcore, numtracks);
587587   if (LOG_SLIDER)
588588      printf("Advance by %d\n", numtracks);
r10315r10316
599599   ldcore_data *ldcore = ld->core;
600600
601601   /* update the slider position first */
602   update_slider_pos(ldcore, timer_get_time(ld->device->machine));
602   update_slider_pos(ldcore, ld->device->machine->time());
603603
604604   /* return the status */
605605   if (ldcore->curtrack == 1)
r10315r10316
15491549static DEVICE_RESET( laserdisc )
15501550{
15511551   laserdisc_state *ld = get_safe_token(device);
1552   attotime curtime = timer_get_time(device->machine);
1552   attotime curtime = device->machine->time();
15531553   ldcore_data *ldcore = ld->core;
15541554   int pltype, line;
15551555
src/emu/machine/intelfsh.c
r10315r10316
268268
269269void intelfsh_device::device_start()
270270{
271   m_timer = device_timer_alloc(*this);
271   m_timer = timer_alloc();
272272
273273   state_save_register_device_item( this, 0, m_status );
274274   state_save_register_device_item( this, 0, m_flash_mode );
src/emu/machine/at28c16.c
r10315r10316
129129
130130void at28c16_device::device_start()
131131{
132   m_write_timer = timer_alloc( &m_machine,  write_finished, this );
132   m_write_timer = m_machine.scheduler().timer_alloc( FUNC(write_finished), this );
133133
134134   state_save_register_device_item( this, 0, m_a9_12v );
135135   state_save_register_device_item( this, 0, m_oe_12v );
src/emu/machine/ins8250.c
r10315r10316
434434      case 5:
435435
436436#if 0
437         if (ins8250->send.active && (timer_get_time(machine)-ins8250->send.time>uart_byte_time(n)))
437         if (ins8250->send.active && (machine->time()-ins8250->send.time>uart_byte_time(n)))
438438         {
439439            // currently polling is enough for pc1512
440440            ins8250->lsr |= 0x40; /* set TSRE */
src/emu/machine/s3c24xx.c
r10315r10316
31683168{
31693169   s3c24xx_t *s3c24xx = get_token( device);
31703170   s3c24xx->iface = (const s3c24xx_interface *)device->baseconfig().static_config();
3171   for (int i = 0; i < 5; i++) s3c24xx->pwm.timer[i] = timer_alloc( device->machine, s3c24xx_pwm_timer_exp, (void*)device);
3172   for (int i = 0; i < 4; i++) s3c24xx->dma[i].timer = timer_alloc( device->machine, s3c24xx_dma_timer_exp, (void*)device);
3173   s3c24xx->iic.timer = timer_alloc( device->machine, s3c24xx_iic_timer_exp, (void*)device);
3174   s3c24xx->iis.timer = timer_alloc( device->machine, s3c24xx_iis_timer_exp, (void*)device);
3175   s3c24xx->lcd.timer = timer_alloc( device->machine, s3c24xx_lcd_timer_exp, (void*)device);
3176   s3c24xx->rtc.timer_tick_count = timer_alloc( device->machine, s3c24xx_rtc_timer_tick_count_exp, (void*)device);
3177   s3c24xx->rtc.timer_update = timer_alloc( device->machine, s3c24xx_rtc_timer_update_exp, (void*)device);
3178   s3c24xx->wdt.timer = timer_alloc( device->machine, s3c24xx_wdt_timer_exp, (void*)device);
3171   for (int i = 0; i < 5; i++) s3c24xx->pwm.timer[i] = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_pwm_timer_exp), (void*)device);
3172   for (int i = 0; i < 4; i++) s3c24xx->dma[i].timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_dma_timer_exp), (void*)device);
3173   s3c24xx->iic.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_iic_timer_exp), (void*)device);
3174   s3c24xx->iis.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_iis_timer_exp), (void*)device);
3175   s3c24xx->lcd.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_lcd_timer_exp), (void*)device);
3176   s3c24xx->rtc.timer_tick_count = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_tick_count_exp), (void*)device);
3177   s3c24xx->rtc.timer_update = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_update_exp), (void*)device);
3178   s3c24xx->wdt.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_wdt_timer_exp), (void*)device);
31793179   timer_adjust_periodic( s3c24xx->rtc.timer_update, attotime::from_msec( 1000), 0, attotime::from_msec( 1000));
31803180   s3c24xx_rtc_init( device);
31813181}
src/emu/machine/8042kbdc.c
r10315r10316
279279   kbdc8042.inport = 0xa0;
280280   at_8042_set_outport(machine, 0xfe, 1);
281281
282   timer_pulse(machine, attotime::from_hz(60), NULL, 0, kbdc8042_time);
282   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(kbdc8042_time));
283283}
284284
285285static void at_8042_receive(running_machine *machine, UINT8 data)
src/emu/machine/latch8.c
r10315r10316
105105   assert(offset == 0);
106106
107107   if (latch8->intf->nosync != 0xff)
108      timer_call_after_resynch(device->machine, (void *)device, (0xFF << 8) | data, latch8_timerproc);
108      device->machine->scheduler().synchronize(FUNC(latch8_timerproc), (0xFF << 8) | data, (void *)device);
109109   else
110110      update(device, data, 0xFF);
111111}
r10315r10316
165165   if (latch8->intf->nosync & mask)
166166      update(device, masked_data, mask);
167167   else
168      timer_call_after_resynch(device->machine, (void *) device, (mask << 8) | masked_data, latch8_timerproc);
168      device->machine->scheduler().synchronize(FUNC(latch8_timerproc), (mask << 8) | masked_data, (void *) device);
169169}
170170
171171WRITE8_DEVICE_HANDLER( latch8_bit0_w ) { latch8_bitx_w(device, 0, offset, data); }
src/emu/machine/8237dma.c
r10315r10316
124124      devcb_resolve_write_line(&m_chan[i].m_out_dack_func, &m_config.m_out_dack_func[i], this);
125125   }
126126
127   m_timer = timer_alloc(&m_machine, i8237_timerproc_callback, (void *)this);
127   m_timer = m_machine.scheduler().timer_alloc(FUNC(i8237_timerproc_callback), (void *)this);
128128}
129129
130130
src/emu/machine/cdp1852.c
r10315r10316
165165   if (device->clock() > 0)
166166   {
167167      /* create the scan timer */
168      cdp1852->scan_timer = timer_alloc(device->machine, cdp1852_scan_tick, (void *)device);
168      cdp1852->scan_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1852_scan_tick), (void *)device);
169169      timer_adjust_periodic(cdp1852->scan_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
170170   }
171171
src/emu/machine/z80sio.c
r10315r10316
524524{
525525   m_device = device;
526526   m_index = index;
527   m_receive_timer = timer_alloc(&m_device->m_machine, static_serial_callback, this);
527   m_receive_timer = device->machine->scheduler().timer_alloc(FUNC(static_serial_callback), this);
528528}
529529
530530
r10315r10316
713713
714714void z80sio_device::sio_channel::set_cts(int state)
715715{
716   timer_call_after_resynch(&m_device->m_machine, this, (SIO_RR0_CTS << 1) + (state != 0), static_change_input_line);
716   m_device->machine->scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_CTS << 1) + (state != 0), this);
717717}
718718
719719
r10315r10316
723723
724724void z80sio_device::sio_channel::set_dcd(int state)
725725{
726   timer_call_after_resynch(&m_device->m_machine, this, (SIO_RR0_DCD << 1) + (state != 0), static_change_input_line);
726   m_device->machine->scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_DCD << 1) + (state != 0), this);
727727}
728728
729729
src/emu/machine/microtch.c
r10315r10316
159159   microtouch.tx_callback = tx_cb;
160160   microtouch.touch_callback = touch_cb;
161161
162   microtouch.timer = timer_alloc(machine, microtouch_timer_callback, NULL);
162   microtouch.timer = machine->scheduler().timer_alloc(FUNC(microtouch_timer_callback));
163163   timer_adjust_periodic(microtouch.timer, attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
164164
165165   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.reset_done);
src/emu/machine/z80ctc.c
r10315r10316
336336   if (write_line != NULL)
337337      devcb_resolve_write_line(&m_zc, write_line, m_device);
338338   m_notimer = notimer;
339   m_timer = timer_alloc(&m_device->m_machine, static_timer_callback, this);
339   m_timer = m_device->machine->scheduler().timer_alloc(FUNC(static_timer_callback), this);
340340
341341   // register for save states
342342    state_save_register_device_item(m_device, m_index, m_mode);
src/emu/machine/pit8253.c
r10315r10316
614614   {
615615      attotime next_fire_time = timer->last_updated + cycles_to_output * attotime::from_hz( timer->clockin );
616616
617      timer_adjust_oneshot(timer->updatetimer, next_fire_time - timer_get_time(device->machine), timer->index );
617      timer_adjust_oneshot(timer->updatetimer, next_fire_time - device->machine->time(), timer->index );
618618   }
619619
620620    LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x, cycles_to_output = %04x\n",
r10315r10316
654654{
655655   /* With the 82C54's maximum clockin of 10MHz, 64 bits is nearly 60,000
656656       years of time. Should be enough for now. */
657   attotime now =   timer_get_time(device->machine);
657   attotime now =   device->machine->time();
658658   attotime elapsed_time = now - timer->last_updated;
659659   INT64 elapsed_cycles =   elapsed_time.as_double() * timer->clockin;
660660
r10315r10316
916916
917917      update(device, timer);
918918
919      if ( timer_get_time(device->machine) > timer->last_updated && timer->clockin != 0 )
919      if ( device->machine->time() > timer->last_updated && timer->clockin != 0 )
920920      {
921921         middle_of_a_cycle = 1;
922922      }
r10315r10316
10811081
10821082      /* initialize timer */
10831083      timer->clockin = pit8253->config->timer[timerno].clockin;
1084      timer->updatetimer = timer_alloc(device->machine, update_timer_cb, (void *)device);
1084      timer->updatetimer = device->machine->scheduler().timer_alloc(FUNC(update_timer_cb), (void *)device);
10851085      timer_adjust_oneshot(timer->updatetimer, attotime::never, timerno);
10861086
10871087      /* resolve callbacks */
r10315r10316
11491149      timer->null_count = 1;
11501150      timer->cycles_to_output = CYCLES_NEVER;
11511151
1152      timer->last_updated = timer_get_time(device->machine);
1152      timer->last_updated = device->machine->time();
11531153
11541154      update(device, timer);
11551155   }
src/emu/machine/ds2404.c
r10315r10316
129129   m_rtc[3] = (current_time >> 16) & 0xff;
130130   m_rtc[4] = (current_time >> 24) & 0xff;
131131
132   emu_timer *timer = timer_alloc(&m_machine, ds2404_tick_callback, (void *)this);
132   emu_timer *timer = m_machine.scheduler().timer_alloc(FUNC(ds2404_tick_callback), (void *)this);
133133   timer_adjust_periodic(timer, attotime::from_hz(256), 0, attotime::from_hz(256));
134134}
135135
src/emu/machine/ldv1000.c
r10315r10316
257257
258258   /* signal VSYNC and set a timer to turn it off */
259259   player->vsync = TRUE;
260   timer_set(ld->device->machine, ld->screen->scan_period() * 4, ld, 0, vsync_off);
260   ld->device->machine->scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld);
261261
262262   /* also set a timer to fetch the VBI data when it is ready */
263   timer_set(ld->device->machine, ld->screen->time_until_pos(19*2), ld, 0, vbi_data_fetch);
263   ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld);
264264
265265   /* boost interleave for the first 1ms to improve communications */
266266   cpuexec_boost_interleave(ld->device->machine, attotime::zero, attotime::from_msec(1));
src/emu/machine/mc146818.c
r10315r10316
183183
184184void mc146818_device::device_start()
185185{
186   m_last_refresh = timer_get_time(&m_machine);
187   emu_timer *timer = device_timer_alloc(*this);
186   m_last_refresh = m_machine.time();
187   emu_timer *timer = timer_alloc();
188188   if (m_config.m_type == mc146818_device_config::MC146818_UTC) {
189189      // hack: for apollo we increase the update frequency to stay in sync with real time
190190      timer_adjust_periodic(timer, attotime::from_hz(2), 0, attotime::from_hz(2));
r10315r10316
327327   }
328328
329329   m_updated = true;  /* clock has been updated */
330   m_last_refresh = timer_get_time(&m_machine);
330   m_last_refresh = m_machine.time();
331331}
332332
333333
r10315r10316
436436      switch (m_index % MC146818_DATA_SIZE) {
437437      case 0xa:
438438         data = m_data[m_index  % MC146818_DATA_SIZE];
439         if ((timer_get_time(space.machine) - m_last_refresh) < attotime::from_hz(32768))
439         if ((space.machine->time() - m_last_refresh) < attotime::from_hz(32768))
440440            data |= 0x80;
441441#if 0
442442         /* for pc1512 bios realtime clock test */
src/emu/machine/rtc65271.c
r10315r10316
522522      state->regs[reg_A] |= reg_A_UIP;
523523
524524      /* schedule end of update cycle */
525      timer_set(device->machine, UPDATE_CYCLE_TIME, (void *)device, 0, rtc_end_update_callback);
525      device->machine->scheduler().timer_set(UPDATE_CYCLE_TIME, FUNC(rtc_end_update_callback), 0, (void *)device);
526526   }
527527}
528528
r10315r10316
688688   rtc65271_config *config = (rtc65271_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
689689   rtc65271_state *state = get_safe_token(device);
690690
691   state->update_timer = timer_alloc(device->machine, rtc_begin_update_callback, (void *)device);
691   state->update_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)device);
692692   timer_adjust_periodic(state->update_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
693   state->SQW_timer = timer_alloc(device->machine, rtc_SQW_callback, (void *)device);
693   state->SQW_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)device);
694694   state->interrupt_callback = config->interrupt_callback;
695695
696696   state_save_register_device_item_array(device, 0, state->regs);
src/emu/diexec.c
r10315r10316
442442   suspend_until_trigger(TRIGGER_SUSPENDTIME + timetrig, true);
443443
444444   // then set a timer for it
445   timer_set(device().machine, duration, this, TRIGGER_SUSPENDTIME + timetrig, static_timed_trigger_callback);
445   device().machine->scheduler().timer_set(duration, FUNC(static_timed_trigger_callback), TRIGGER_SUSPENDTIME + timetrig, this);
446446   timetrig = (timetrig + 1) % 256;
447447}
448448
r10315r10316
558558
559559   // allocate timers if we need them
560560   if (m_execute_config.m_vblank_interrupts_per_frame > 1)
561      m_partial_frame_timer = timer_alloc(device().machine, static_trigger_partial_frame_interrupt, (void *)this);
561      m_partial_frame_timer = device().machine->scheduler().timer_alloc(FUNC(static_trigger_partial_frame_interrupt), (void *)this);
562562   if (m_execute_config.m_timed_interrupt_period != attotime::zero)
563      m_timedint_timer = timer_alloc(device().machine, static_trigger_periodic_interrupt, (void *)this);
563      m_timedint_timer = device().machine->scheduler().timer_alloc(FUNC(static_trigger_periodic_interrupt), (void *)this);
564564
565565   // register for save states
566566   state_save_register_device_item(&m_device, 0, m_suspend);
r10315r10316
917917
918918      // if this is the first one, set the timer
919919      if (event_index == 0)
920         timer_call_after_resynch(m_execute->device().machine, (void *)this, 0, static_empty_event_queue);
920         m_execute->device().machine->scheduler().synchronize(FUNC(static_empty_event_queue), 0, (void *)this);
921921   }
922922}
923923
src/emu/emucore.h
r10315r10316
428428      m_tail = tail;
429429      m_count += count;
430430   }
431   
432   T &insert_after(T &object, T *insert_after)
433   {
434      if (insert_after == NULL)
435         return prepend(object);
436      object.m_next = insert_after->m_next;
437      insert_after->m_next = &object;
438      m_count++;
439      return object;
440   }
431441
432442   T *detach_head()
433443   {
src/emu/screen.c
r10315r10316
341341   m_container->set_user_settings(settings);
342342
343343   // allocate the VBLANK timers
344   m_vblank_begin_timer = timer_alloc(machine, static_vblank_begin_callback, (void *)this);
345   m_vblank_end_timer = timer_alloc(machine, static_vblank_end_callback, (void *)this);
344   m_vblank_begin_timer = machine->scheduler().timer_alloc(FUNC(static_vblank_begin_callback), (void *)this);
345   m_vblank_end_timer = machine->scheduler().timer_alloc(FUNC(static_vblank_end_callback), (void *)this);
346346
347347   // allocate a timer to reset partial updates
348   m_scanline0_timer = timer_alloc(machine, static_scanline0_callback, (void *)this);
348   m_scanline0_timer = machine->scheduler().timer_alloc(FUNC(static_scanline0_callback), (void *)this);
349349
350350   // allocate a timer to generate per-scanline updates
351351   if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
352      m_scanline_timer = timer_alloc(machine, static_scanline_update_callback, (void *)this);
352      m_scanline_timer = machine->scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this);
353353
354354   // configure the screen with the default parameters
355355   configure(m_config.m_width, m_config.m_height, m_config.m_visarea, m_config.m_refresh);
r10315r10316
467467void screen_device::reset_origin(int beamy, int beamx)
468468{
469469   // compute the effective VBLANK start/end times
470   attotime curtime = timer_get_time(machine);
470   attotime curtime = machine->time();
471471   m_vblank_end_time = curtime - attotime(0, beamy * m_scantime + beamx * m_pixeltime);
472472   m_vblank_start_time = m_vblank_end_time - attotime(0, m_vblank_period);
473473
r10315r10316
667667
668668int screen_device::vpos() const
669669{
670   attoseconds_t delta = (timer_get_time(machine) - m_vblank_start_time).as_attoseconds();
670   attoseconds_t delta = (machine->time() - m_vblank_start_time).as_attoseconds();
671671   int vpos;
672672
673673   // round to the nearest pixel
r10315r10316
688688
689689int screen_device::hpos() const
690690{
691   attoseconds_t delta = (timer_get_time(machine) - m_vblank_start_time).as_attoseconds();
691   attoseconds_t delta = (machine->time() - m_vblank_start_time).as_attoseconds();
692692
693693   // round to the nearest pixel
694694   delta += m_pixeltime / 2;
r10315r10316
724724   attoseconds_t targetdelta = (attoseconds_t)vpos * m_scantime + (attoseconds_t)hpos * m_pixeltime;
725725
726726   // if we're past that time (within 1/2 of a pixel), head to the next frame
727   attoseconds_t curdelta = (timer_get_time(machine) - m_vblank_start_time).as_attoseconds();
727   attoseconds_t curdelta = (machine->time() - m_vblank_start_time).as_attoseconds();
728728   if (targetdelta <= curdelta + m_pixeltime / 2)
729729      targetdelta += m_frame_period;
730730   while (targetdelta <= curdelta)
r10315r10316
748748   attotime target_time = m_vblank_end_time;
749749   if (!vblank())
750750      target_time += attotime(0, m_frame_period);
751   return target_time - timer_get_time(machine);
751   return target_time - machine->time();
752752}
753753
754754
r10315r10316
787787void screen_device::vblank_begin_callback()
788788{
789789   // reset the starting VBLANK time
790   m_vblank_start_time = timer_get_time(machine);
790   m_vblank_start_time = machine->time();
791791   m_vblank_end_time = m_vblank_start_time + attotime(0, m_vblank_period);
792792
793793   // call the screen specific callbacks
src/emu/screen.h
r10315r10316
166166   // beam positioning and state
167167   int vpos() const;
168168   int hpos() const;
169   bool vblank() const { return (timer_get_time(machine) < m_vblank_end_time); }
169   bool vblank() const { return (machine->time() < m_vblank_end_time); }
170170   bool hblank() const { int curpos = hpos(); return (curpos < m_visarea.min_x || curpos > m_visarea.max_x); }
171171
172172   // timing
src/emu/sound.c
r10315r10316
258258void sound_stream::update()
259259{
260260   // determine the number of samples since the start of this second
261   attotime time = timer_get_time(m_device.machine);
261   attotime time = m_device.machine->time();
262262   INT32 update_sampindex = INT32(time.attoseconds / m_attoseconds_per_sample);
263263
264264   // if we're ahead of the last update, then adjust upwards
r10315r10316
766766
767767sound_manager::sound_manager(running_machine &machine)
768768   : m_machine(machine),
769     m_update_timer(timer_alloc(&machine, update_static, this)),
769     m_update_timer(machine.scheduler().timer_alloc(FUNC(update_static), this)),
770770     m_finalmix_leftover(0),
771771     m_finalmix(NULL),
772772     m_leftmix(NULL),
r10315r10316
10451045   }
10461046
10471047   // see if we ticked over to the next second
1048   attotime curtime = timer_get_time(&m_machine);
1048   attotime curtime = m_machine.time();
10491049   bool second_tick = false;
10501050   if (curtime.seconds != m_last_update.seconds)
10511051   {
src/emu/timer.c
r10315r10316
22
33    timer.c
44
5    Functions needed to generate timing and synchronization between several
6    CPUs.
5    Timer devices.
76
8    Copyright Nicola Salmoria and the MAME Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
7****************************************************************************
108
9    Copyright Aaron Giles
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
1138***************************************************************************/
1239
1340#include "emu.h"
r10315r10316
1542
1643
1744/***************************************************************************
18    DEBUGGING
45//  DEBUGGING
1946***************************************************************************/
2047
2148#define VERBOSE 0
r10315r10316
2552
2653
2754/***************************************************************************
28    CONSTANTS
55//  DEVICE DEFINITIONS
2956***************************************************************************/
3057
31#define MAX_TIMERS            256
32#define MAX_QUANTA            16
33
34#define DEFAULT_MINIMUM_QUANTUM   ATTOSECONDS_IN_MSEC(100)
35
36
37
38/***************************************************************************
39    DEVICE DEFINITIONS
40***************************************************************************/
41
4258const device_type TIMER = timer_device_config::static_alloc_device_config;
4359
4460
4561
46/***************************************************************************
47    TYPE DEFINITIONS
48***************************************************************************/
4962
50class emu_timer
51{
52public:
53   running_machine *      machine;      /* pointer to the owning machine */
54   emu_timer *            next;         /* next timer in order in the list */
55   emu_timer *            prev;         /* previous timer in order in the list */
56   timer_fired_func      callback;      /* callback function */
57   INT32               param;         /* integer parameter */
58   void *               ptr;         /* pointer parameter */
59   const char *         file;         /* file that created the timer */
60   int                line;         /* line number that created the timer */
61   const char *         func;         /* string name of the callback function */
62   UINT8               enabled;      /* is the timer enabled? */
63   UINT8               temporary;      /* is the timer temporary? */
64   attotime            period;         /* the repeat frequency of the timer */
65   attotime            start;         /* time when the timer was started */
66   attotime            expire;         /* time when the timer will expire */
67   device_t *            device;         /* for device timers, a pointer to the device */
68   device_timer_id            id;            /* for device timers, the ID of the timer */
69};
70
71
72/* a single minimum quantum */
73typedef struct _quantum_slot quantum_slot;
74struct _quantum_slot
75{
76   attoseconds_t         actual;         /* actual duration of the quantum */
77   attoseconds_t         requested;      /* duration of the requested quantum */
78   attotime            expire;         /* absolute expiration time of this quantum */
79};
80
81
82/* global private data */
83/* In mame.h: typedef struct _timer_private timer_private; */
84struct _timer_private
85{
86   /* list of active timers */
87   emu_timer            timers[MAX_TIMERS]; /* actual timers */
88   emu_timer *            activelist;         /* head of the active list */
89   emu_timer *            freelist;         /* head of the free list */
90   emu_timer *            freelist_tail;      /* tail of the free list */
91
92   /* execution state */
93   timer_execution_state   exec;            /* current global execution state */
94
95   /* other internal states */
96   emu_timer *            callback_timer;      /* pointer to the current callback timer */
97   UINT8               callback_timer_modified; /* TRUE if the current callback timer was modified */
98   attotime            callback_timer_expire_time; /* the original expiration time */
99
100   /* scheduling quanta */
101   quantum_slot         quantum_list[MAX_QUANTA]; /* list of scheduling quanta */
102   quantum_slot *         quantum_current;   /* current minimum quantum */
103   attoseconds_t         quantum_minimum;   /* duration of minimum quantum */
104};
105
106
107
108/***************************************************************************
109    FUNCTION PROTOTYPES
110***************************************************************************/
111
112static STATE_POSTLOAD( timer_postload );
113static void timer_logtimers(running_machine *machine);
114static void timer_remove(emu_timer *which);
115
116
117
118/***************************************************************************
119    INLINE FUNCTIONS
120***************************************************************************/
121
122/*-------------------------------------------------
123    get_current_time - return the current time
124-------------------------------------------------*/
125
126INLINE attotime get_current_time(running_machine *machine)
127{
128   timer_private *global = machine->timer_data;
129
130   /* if we're currently in a callback, use the timer's expiration time as a base */
131   if (global->callback_timer != NULL)
132      return global->callback_timer_expire_time;
133
134   /* if we're executing as a particular CPU, use its local time as a base */
135   /* otherwise, return the global base time */
136   device_execute_interface *execdevice = machine->scheduler().currently_executing();
137   return (execdevice != NULL) ? execdevice->local_time() : global->exec.basetime;
138}
139
140
141/*-------------------------------------------------
142    timer_new - allocate a new timer
143-------------------------------------------------*/
144
145INLINE emu_timer *timer_new(running_machine *machine)
146{
147   timer_private *global = machine->timer_data;
148   emu_timer *timer;
149
150   /* if nothing remains available, fatal error -- we should never hit this */
151   if (global->freelist == NULL)
152   {
153      timer_logtimers(machine);
154      fatalerror("Out of timers!");
155   }
156
157   /* pull an entry from the free list */
158   timer = global->freelist;
159   global->freelist = timer->next;
160   if (global->freelist == NULL)
161      global->freelist_tail = NULL;
162
163   /* set up the machine */
164   timer->machine = machine;
165   return timer;
166}
167
168
169/*-------------------------------------------------
170    timer_list_insert - insert a new timer into
171    the list at the appropriate location
172-------------------------------------------------*/
173
174INLINE void timer_list_insert(emu_timer *timer)
175{
176   attotime expire = timer->enabled ? timer->expire : attotime::never;
177   timer_private *global = timer->machine->timer_data;
178   emu_timer *t, *lt = NULL;
179
180   /* sanity checks for the debug build */
181   #ifdef MAME_DEBUG
182   {
183      int tnum = 0;
184
185      /* loop over the timer list */
186      for (t = global->activelist; t; t = t->next, tnum++)
187      {
188         if (t == timer)
189            fatalerror("This timer is already inserted in the list!");
190         if (tnum == MAX_TIMERS-1)
191            fatalerror("Timer list is full!");
192      }
193   }
194   #endif
195
196   /* loop over the timer list */
197   for (t = global->activelist; t != NULL; lt = t, t = t->next)
198   {
199      /* if the current list entry expires after us, we should be inserted before it */
200      if (t->expire > expire)
201      {
202         /* link the new guy in before the current list entry */
203         timer->prev = t->prev;
204         timer->next = t;
205
206         if (t->prev != NULL)
207            t->prev->next = timer;
208         else
209         {
210            global->activelist = timer;
211            global->exec.nextfire = timer->expire;
212         }
213         t->prev = timer;
214         return;
215      }
216   }
217
218   /* need to insert after the last one */
219   if (lt != NULL)
220      lt->next = timer;
221   else
222   {
223      global->activelist = timer;
224      global->exec.nextfire = timer->expire;
225   }
226   timer->prev = lt;
227   timer->next = NULL;
228}
229
230
231/*-------------------------------------------------
232    timer_list_remove - remove a timer from the
233    linked list
234-------------------------------------------------*/
235
236INLINE void timer_list_remove(emu_timer *timer)
237{
238   timer_private *global = timer->machine->timer_data;
239
240   /* sanity checks for the debug build */
241   #ifdef MAME_DEBUG
242   {
243      emu_timer *t;
244
245      /* loop over the timer list */
246      for (t = global->activelist; t && t != timer; t = t->next) ;
247      if (t == NULL)
248         fatalerror("timer (%s from %s:%d) not found in list", timer->func, timer->file, timer->line);
249   }
250   #endif
251
252   /* remove it from the list */
253   if (timer->prev != NULL)
254      timer->prev->next = timer->next;
255   else
256   {
257      global->activelist = timer->next;
258      if (global->activelist != NULL)
259         global->exec.nextfire = global->activelist->expire;
260   }
261   if (timer->next != NULL)
262      timer->next->prev = timer->prev;
263}
264
265
266
267/***************************************************************************
268    INITIALIZATION
269***************************************************************************/
270
271/*-------------------------------------------------
272    timer_init - initialize the timer system
273-------------------------------------------------*/
274
275void timer_init(running_machine *machine)
276{
277   timer_private *global;
278   int i;
279
280   /* allocate global data */
281   global = machine->timer_data = auto_alloc_clear(machine, timer_private);
282
283   /* we need to wait until the first call to timer_cyclestorun before using real CPU times */
284   global->exec.basetime = attotime::zero;
285   global->exec.nextfire = attotime::never;
286   global->exec.curquantum = DEFAULT_MINIMUM_QUANTUM;
287   global->callback_timer = NULL;
288   global->callback_timer_modified = FALSE;
289
290   /* register with the save state system */
291   state_save_register_item(machine, "timer", NULL, 0, global->exec.basetime.seconds);
292   state_save_register_item(machine, "timer", NULL, 0, global->exec.basetime.attoseconds);
293   state_save_register_postload(machine, timer_postload, NULL);
294
295   /* initialize the lists */
296   global->activelist = NULL;
297   global->freelist = &global->timers[0];
298   for (i = 0; i < MAX_TIMERS-1; i++)
299      global->timers[i].next = &global->timers[i+1];
300   global->timers[MAX_TIMERS-1].next = NULL;
301   global->freelist_tail = &global->timers[MAX_TIMERS-1];
302
303   /* reset the quanta */
304   global->quantum_list[0].requested = DEFAULT_MINIMUM_QUANTUM;
305   global->quantum_list[0].actual = DEFAULT_MINIMUM_QUANTUM;
306   global->quantum_list[0].expire = attotime::never;
307   global->quantum_current = &global->quantum_list[0];
308   global->quantum_minimum = ATTOSECONDS_IN_NSEC(1) / 1000;
309}
310
311
312/*-------------------------------------------------
313    timer_destructor - destruct a timer from a
314    pool callback
315-------------------------------------------------*/
316
317void timer_destructor(void *ptr, size_t size)
318{
319   timer_remove((emu_timer *)ptr);
320}
321
322
323
324/***************************************************************************
325    SCHEDULING HELPERS
326***************************************************************************/
327
328/*-------------------------------------------------
329    timer_get_execution_state - return a pointer
330    to the execution state
331-------------------------------------------------*/
332
333timer_execution_state *timer_get_execution_state(running_machine *machine)
334{
335   timer_private *global = machine->timer_data;
336   return &global->exec;
337}
338
339
340/*-------------------------------------------------
341    timer_execute_timers - execute timers and
342    update scheduling quanta
343-------------------------------------------------*/
344
345void timer_execute_timers(running_machine *machine)
346{
347   timer_private *global = machine->timer_data;
348   emu_timer *timer;
349
350   /* if the current quantum has expired, find a new one */
351   if (global->exec.basetime >= global->quantum_current->expire)
352   {
353      int curr;
354
355      global->quantum_current->requested = 0;
356      global->quantum_current = &global->quantum_list[0];
357      for (curr = 1; curr < ARRAY_LENGTH(global->quantum_list); curr++)
358         if (global->quantum_list[curr].requested != 0 && global->quantum_list[curr].requested < global->quantum_current->requested)
359            global->quantum_current = &global->quantum_list[curr];
360      global->exec.curquantum = global->quantum_current->actual;
361   }
362
363   LOG(("timer_set_global_time: new=%s head->expire=%s\n", global->exec.basetime.as_string(), global->activelist->expire.as_string()));
364
365   /* now process any timers that are overdue */
366   while (global->activelist->expire <= global->exec.basetime)
367   {
368      int was_enabled = global->activelist->enabled;
369
370      /* if this is a one-shot timer, disable it now */
371      timer = global->activelist;
372      if (timer->period == attotime::zero || timer->period == attotime::never)
373         timer->enabled = FALSE;
374
375      /* set the global state of which callback we're in */
376      global->callback_timer_modified = FALSE;
377      global->callback_timer = timer;
378      global->callback_timer_expire_time = timer->expire;
379
380      /* call the callback */
381      if (was_enabled)
382      {
383         if (timer->device != NULL)
384            timer->device->timer_fired(*timer, timer->id, timer->param, timer->ptr);
385         else if (timer->callback != NULL)
386         {
387            LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, timer->expire.as_string()));
388            g_profiler.start(PROFILER_TIMER_CALLBACK);
389            (*timer->callback)(machine, timer->ptr, timer->param);
390            g_profiler.stop();
391         }
392      }
393
394      /* clear the callback timer global */
395      global->callback_timer = NULL;
396
397      /* reset or remove the timer, but only if it wasn't modified during the callback */
398      if (!global->callback_timer_modified)
399      {
400         /* if the timer is temporary, remove it now */
401         if (timer->temporary)
402            timer_remove(timer);
403
404         /* otherwise, reschedule it */
405         else
406         {
407            timer->start = timer->expire;
408            timer->expire += timer->period;
409
410            timer_list_remove(timer);
411            timer_list_insert(timer);
412         }
413      }
414   }
415}
416
417
418/*-------------------------------------------------
419    timer_add_scheduling_quantum - add a
420    scheduling quantum; the smallest active one
421    is the one that is in use
422-------------------------------------------------*/
423
424void timer_add_scheduling_quantum(running_machine *machine, attoseconds_t quantum, attotime duration)
425{
426   timer_private *global = machine->timer_data;
427   attotime curtime = timer_get_time(machine);
428   attotime expire = curtime + duration;
429   int curr, blank = -1;
430
431   /* a 0 request (minimum) needs to be non-zero to occupy a slot */
432   if (quantum == 0)
433      quantum = 1;
434
435   /* find an equal-duration slot or an empty slot */
436   for (curr = 1; curr < ARRAY_LENGTH(global->quantum_list); curr++)
437   {
438      quantum_slot *slot = &global->quantum_list[curr];
439
440      /* look for a matching quantum and extend it */
441      if (slot->requested == quantum)
442      {
443         slot->expire = max(slot->expire, expire);
444         return;
445      }
446
447      /* remember any empty slots in case of no match */
448      if (slot->requested == 0)
449      {
450         if (blank == -1)
451            blank = curr;
452      }
453
454      /* otherwise, expire any expired slots */
455      else if (curtime >= slot->expire)
456         slot->requested = 0;
457   }
458
459   /* fatal error if no slots left */
460   assert_always(blank != -1, "Out of scheduling quantum slots!");
461
462   /* fill in the item */
463   global->quantum_list[blank].requested = quantum;
464   global->quantum_list[blank].actual = MAX(global->quantum_list[blank].requested, global->quantum_minimum);
465   global->quantum_list[blank].expire = expire;
466
467   /* update the minimum */
468   if (quantum < global->quantum_current->requested)
469   {
470      global->quantum_current = &global->quantum_list[blank];
471      global->exec.curquantum = global->quantum_current->actual;
472   }
473}
474
475
476/*-------------------------------------------------
477    timer_set_minimum_quantum - control the
478    minimum useful quantum (used by cpuexec only)
479-------------------------------------------------*/
480
481void timer_set_minimum_quantum(running_machine *machine, attoseconds_t quantum)
482{
483   timer_private *global = machine->timer_data;
484   int curr;
485
486   /* do nothing if nothing changed */
487   if (global->quantum_minimum == quantum)
488      return;
489   global->quantum_minimum = quantum;
490
491   /* adjust all the actuals; this doesn't affect the current */
492   for (curr = 0; curr < ARRAY_LENGTH(global->quantum_list); curr++)
493      if (global->quantum_list[curr].requested != 0)
494         global->quantum_list[curr].actual = MAX(global->quantum_list[curr].requested, global->quantum_minimum);
495
496   /* ensure that the live current quantum is up to date */
497   global->exec.curquantum = global->quantum_current->actual;
498}
499
500
501
502/***************************************************************************
503    SAVE/RESTORE HELPERS
504***************************************************************************/
505
506/*-------------------------------------------------
507    timer_register_save - register ourself with
508    the save state system
509-------------------------------------------------*/
510
511static void timer_register_save(emu_timer *timer)
512{
513   timer_private *global = timer->machine->timer_data;
514   int count = 0;
515   emu_timer *t;
516
517   /* find other timers that match our func name */
518   for (t = global->activelist; t; t = t->next)
519      if (!strcmp(t->func, timer->func))
520         count++;
521
522   /* use different instances to differentiate the bits */
523   state_save_register_item(timer->machine, "timer", timer->func, count, timer->param);
524   state_save_register_item(timer->machine, "timer", timer->func, count, timer->enabled);
525   state_save_register_item(timer->machine, "timer", timer->func, count, timer->period.seconds);
526   state_save_register_item(timer->machine, "timer", timer->func, count, timer->period.attoseconds);
527   state_save_register_item(timer->machine, "timer", timer->func, count, timer->start.seconds);
528   state_save_register_item(timer->machine, "timer", timer->func, count, timer->start.attoseconds);
529   state_save_register_item(timer->machine, "timer", timer->func, count, timer->expire.seconds);
530   state_save_register_item(timer->machine, "timer", timer->func, count, timer->expire.attoseconds);
531   if (timer->device != NULL)
532      state_save_register_item(timer->machine, "timer", timer->func, count, timer->id);
533}
534
535
536/*-------------------------------------------------
537    timer_postload - after loading a save state
538-------------------------------------------------*/
539
540static STATE_POSTLOAD( timer_postload )
541{
542   timer_private *global = machine->timer_data;
543   emu_timer *privlist = NULL;
544   emu_timer *t;
545
546   /* remove all timers and make a private list */
547   while (global->activelist != NULL)
548   {
549      t = global->activelist;
550
551      /* temporary timers go away entirely */
552      if (t->temporary)
553         timer_remove(t);
554
555      /* permanent ones get added to our private list */
556      else
557      {
558         timer_list_remove(t);
559         t->next = privlist;
560         privlist = t;
561      }
562   }
563
564   /* now add them all back in; this effectively re-sorts them by time */
565   while (privlist != NULL)
566   {
567      t = privlist;
568      privlist = t->next;
569      timer_list_insert(t);
570   }
571}
572
573
574/*-------------------------------------------------
575    timer_count_anonymous - count the number of
576    anonymous (non-saveable) timers
577-------------------------------------------------*/
578
579int timer_count_anonymous(running_machine *machine)
580{
581   timer_private *global = machine->timer_data;
582   emu_timer *t;
583   int count = 0;
584
585   logerror("timer_count_anonymous:\n");
586   for (t = global->activelist; t; t = t->next)
587      if (t->temporary && t != global->callback_timer)
588      {
589         count++;
590         logerror("  Temp. timer %p, file %s:%d[%s]\n", (void *) t, t->file, t->line, t->func);
591      }
592   logerror("%d temporary timers found\n", count);
593
594   return count;
595}
596
597
598
599/***************************************************************************
600    CORE TIMER ALLOCATION
601***************************************************************************/
602
603/*-------------------------------------------------
604    timer_alloc - allocate a permament timer that
605    isn't primed yet
606-------------------------------------------------*/
607
608INLINE emu_timer *_timer_alloc_common(running_machine *machine, device_t *device, device_timer_id id, timer_fired_func callback, void *ptr, const char *file, int line, const char *func, int temp)
609{
610   attotime time = get_current_time(machine);
611   emu_timer *timer = timer_new(machine);
612
613   /* fill in the record */
614   timer->callback = callback;
615   timer->ptr = ptr;
616   timer->param = 0;
617   timer->enabled = FALSE;
618   timer->temporary = temp;
619   timer->period = attotime::zero;
620   timer->file = file;
621   timer->line = line;
622   timer->func = func;
623   timer->device = device;
624   timer->id = id;
625
626   /* compute the time of the next firing and insert into the list */
627   timer->start = time;
628   timer->expire = attotime::never;
629   timer_list_insert(timer);
630
631   /* if we're not temporary, register ourselves with the save state system */
632   if (!temp)
633   {
634      if (!state_save_registration_allowed(machine))
635         fatalerror("timer_alloc() called after save state registration closed! (file %s, line %d)\n", file, line);
636      timer_register_save(timer);
637   }
638
639   /* return a handle */
640   return timer;
641}
642
643emu_timer *_timer_alloc_internal(running_machine *machine, timer_fired_func callback, void *ptr, const char *file, int line, const char *func)
644{
645   return _timer_alloc_common(machine, NULL, 0, callback, ptr, file, line, func, FALSE);
646}
647
648emu_timer *device_timer_alloc(device_t &device, UINT32 id, void *ptr)
649{
650   return _timer_alloc_common(device.machine, &device, id, NULL, ptr, __FILE__, __LINE__, device.tag(), FALSE);
651}
652
653
654/*-------------------------------------------------
655    timer_remove - remove a timer from the
656    system
657-------------------------------------------------*/
658
659static void timer_remove(emu_timer *which)
660{
661   timer_private *global = which->machine->timer_data;
662
663   /* if this is a callback timer, note that */
664   if (which == global->callback_timer)
665      global->callback_timer_modified = TRUE;
666
667   /* remove it from the list */
668   timer_list_remove(which);
669
670   /* free it up by adding it back to the free list */
671   if (global->freelist_tail)
672      global->freelist_tail->next = which;
673   else
674      global->freelist = which;
675   which->next = NULL;
676   global->freelist_tail = which;
677}
678
679
680
681/***************************************************************************
682    CORE TIMER ADJUSTMENT
683***************************************************************************/
684
685/*-------------------------------------------------
686    timer_adjust_oneshot - adjust the time when this timer
687    will fire and disable any periodic firings
688-------------------------------------------------*/
689
690void timer_adjust_oneshot(emu_timer *which, attotime duration, INT32 param)
691{
692   timer_adjust_periodic(which, duration, param, attotime::never);
693}
694
695
696/*-------------------------------------------------
697    timer_adjust_periodic - adjust the time when
698    this timer will fire and specify a period for
699    subsequent firings
700-------------------------------------------------*/
701
702void timer_adjust_periodic(emu_timer *which, attotime start_delay, INT32 param, attotime period)
703{
704   timer_private *global = which->machine->timer_data;
705   attotime time = get_current_time(which->machine);
706
707   /* if this is the callback timer, mark it modified */
708   if (which == global->callback_timer)
709      global->callback_timer_modified = TRUE;
710
711   /* compute the time of the next firing and insert into the list */
712   which->param = param;
713   which->enabled = TRUE;
714
715   /* clamp negative times to 0 */
716   if (start_delay.seconds < 0)
717      start_delay = attotime::zero;
718
719   /* set the start and expire times */
720   which->start = time;
721   which->expire = time + start_delay;
722   which->period = period;
723
724   /* remove and re-insert the timer in its new order */
725   timer_list_remove(which);
726   timer_list_insert(which);
727
728   /* if this was inserted as the head, abort the current timeslice and resync */
729   LOG(("timer_adjust_oneshot %s.%s:%d to expire @ %s\n", which->file, which->func, which->line, which->expire.as_string()));
730   if (which == global->activelist)
731      which->machine->scheduler().abort_timeslice();
732}
733
734
735
736/***************************************************************************
737    SIMPLIFIED ANONYMOUS TIMER MANAGEMENT
738***************************************************************************/
739
740void device_timer_call_after_resynch(device_t &device, device_timer_id id, INT32 param, void *ptr)
741{
742   emu_timer *timer = _timer_alloc_common(device.machine, &device, id, NULL, ptr, __FILE__, __LINE__, device.tag(), TRUE);
743   timer_adjust_oneshot(timer, attotime::zero, param);
744}
745
746
747/*-------------------------------------------------
748    timer_pulse - allocate a pulse timer, which
749    repeatedly calls the callback using the given
750    period
751-------------------------------------------------*/
752
753void _timer_pulse_internal(running_machine *machine, attotime period, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func)
754{
755   emu_timer *timer = _timer_alloc_common(machine, NULL, 0, callback, ptr, file, line, func, FALSE);
756   timer_adjust_periodic(timer, period, param, period);
757}
758
759
760/*-------------------------------------------------
761    timer_set - allocate a one-shot timer, which
762    calls the callback after the given duration
763-------------------------------------------------*/
764
765void _timer_set_internal(running_machine *machine, attotime duration, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func)
766{
767   emu_timer *timer = _timer_alloc_common(machine, NULL, 0, callback, ptr, file, line, func, TRUE);
768   timer_adjust_oneshot(timer, duration, param);
769}
770
771
772
773/***************************************************************************
774    MISCELLANEOUS CONTROLS
775***************************************************************************/
776
777/*-------------------------------------------------
778    timer_reset - reset the timing on a timer
779-------------------------------------------------*/
780
781void timer_reset(emu_timer *which, attotime duration)
782{
783   timer_adjust_periodic(which, duration, which->param, which->period);
784}
785
786
787/*-------------------------------------------------
788    timer_enable - enable/disable a timer
789-------------------------------------------------*/
790
791int timer_enable(emu_timer *which, int enable)
792{
793   int old = which->enabled;
794
795   /* reschedule only if the state has changed */
796   if (old != enable)
797   {
798      /* set the enable flag */
799      which->enabled = enable;
800
801      /* remove the timer and insert back into the list */
802      timer_list_remove(which);
803      timer_list_insert(which);
804   }
805
806   return old;
807}
808
809
810/*-------------------------------------------------
811    timer_enabled - determine if a timer is
812    enabled
813-------------------------------------------------*/
814
815int timer_enabled(emu_timer *which)
816{
817   return which->enabled;
818}
819
820
821/*-------------------------------------------------
822    timer_get_param - returns the callback
823    parameter of a timer
824-------------------------------------------------*/
825
826int timer_get_param(emu_timer *which)
827{
828   return which->param;
829}
830
831
832/*-------------------------------------------------
833    timer_set_param - changes the callback
834    parameter of a timer
835-------------------------------------------------*/
836
837void timer_set_param(emu_timer *which, int param)
838{
839   which->param = param;
840}
841
842
843/*-------------------------------------------------
844    timer_get_ptr - returns the callback pointer
845    of a timer
846-------------------------------------------------*/
847
848void *timer_get_ptr(emu_timer *which)
849{
850   return which->ptr;
851}
852
853
854/*-------------------------------------------------
855    timer_set_ptr - changes the callback pointer
856    of a timer
857-------------------------------------------------*/
858
859void timer_set_ptr(emu_timer *which, void *ptr)
860{
861   which->ptr = ptr;
862}
863
864
865
866/***************************************************************************
867    TIMING FUNCTIONS
868***************************************************************************/
869
870/*-------------------------------------------------
871    timer_timeelapsed - return the time since the
872    last trigger
873-------------------------------------------------*/
874
875attotime timer_timeelapsed(emu_timer *which)
876{
877   return get_current_time(which->machine) - which->start;
878}
879
880
881/*-------------------------------------------------
882    timer_timeleft - return the time until the
883    next trigger
884-------------------------------------------------*/
885
886attotime timer_timeleft(emu_timer *which)
887{
888   return which->expire - get_current_time(which->machine);
889}
890
891
892/*-------------------------------------------------
893    timer_get_time - return the current time
894-------------------------------------------------*/
895
896attotime timer_get_time(running_machine *machine)
897{
898   return get_current_time(machine);
899}
900
901
902/*-------------------------------------------------
903    timer_starttime - return the time when this
904    timer started counting
905-------------------------------------------------*/
906
907attotime timer_starttime(emu_timer *which)
908{
909   return which->start;
910}
911
912
913/*-------------------------------------------------
914    timer_firetime - return the time when this
915    timer will fire next
916-------------------------------------------------*/
917
918attotime timer_firetime(emu_timer *which)
919{
920   return which->expire;
921}
922
923
924
925/***************************************************************************
926    DEBUGGING
927***************************************************************************/
928
929/*-------------------------------------------------
930    timer_logtimers - log all the timers
931-------------------------------------------------*/
932
933static void timer_logtimers(running_machine *machine)
934{
935   timer_private *global = machine->timer_data;
936   emu_timer *t;
937
938   logerror("===============\n");
939   logerror("TIMER LOG START\n");
940   logerror("===============\n");
941
942   logerror("Enqueued timers:\n");
943   for (t = global->activelist; t; t = t->next)
944      logerror("  Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n",
945         t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->file, t->line, t->func);
946
947   logerror("Free timers:\n");
948   for (t = global->freelist; t; t = t->next)
949      logerror("  Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n",
950         t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->file, t->line, t->func);
951
952   logerror("==============\n");
953   logerror("TIMER LOG STOP\n");
954   logerror("==============\n");
955}
956
957
958void timer_print_first_timer(running_machine *machine)
959{
960   timer_private *global = machine->timer_data;
961   emu_timer *t = global->activelist;
962   printf("  Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s)\n",
963      t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->func);
964}
965
966
96763//**************************************************************************
96864//  TIMER DEVICE CONFIGURATION
96965//**************************************************************************
r10315r10316
1187283      m_screen = downcast<screen_device *>(machine->device(m_config.m_screen));
1188284
1189285   // allocate the timer
1190   m_timer = timer_alloc(machine, (m_config.m_type == timer_device_config::TIMER_TYPE_SCANLINE) ? static_scanline_timer_callback : static_periodic_timer_callback, (void *)this);
286   m_timer = timer_alloc();
1191287
1192288   // register for save states
1193289   state_save_register_device_item(this, 0, m_first_time);
r10315r10316
1235331}
1236332
1237333
1238/*-------------------------------------------------
1239    periodic_timer_callback - calls the timer
1240    device specific callback
1241-------------------------------------------------*/
334//-------------------------------------------------
335//  device_timer - handle timer expiration events
336//-------------------------------------------------
1242337
1243void timer_device::periodic_timer_callback(int param)
338void timer_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
1244339{
1245   if (m_config.m_callback != NULL)
1246      (*m_config.m_callback)(*this, m_ptr, param);
1247}
340   switch (m_config.m_type)
341   {
342      // general periodic timers just call through
343      case timer_device_config::TIMER_TYPE_GENERIC:
344      case timer_device_config::TIMER_TYPE_PERIODIC:
345         if (m_config.m_type != timer_device_config::TIMER_TYPE_SCANLINE)
346         {
347            if (m_config.m_callback != NULL)
348               (*m_config.m_callback)(*this, m_ptr, param);
349         }
350         break;
1248351
1249352
1250/*-------------------------------------------------
1251    scanline_timer_device_timer_callback -
1252    manages the scanline based timer's state
1253-------------------------------------------------*/
353      // scanline timers have to do some additiona bookkeeping
354      case timer_device_config::TIMER_TYPE_SCANLINE:
355      {
356         // by default, we fire at the first position
357         int next_vpos = m_config.m_first_vpos;
1254358
1255void timer_device::scanline_timer_callback(int scanline)
1256{
1257   // by default, we fire at the first position
1258   int next_vpos = m_config.m_first_vpos;
359         // the first time through we just go with the default position
360         if (!m_first_time)
361         {
362            // call the real callback
363            int vpos = m_screen->vpos();
364            (*m_config.m_callback)(*this, m_ptr, vpos);
1259365
1260   // the first time through we just go with the default position
1261   if (!m_first_time)
1262   {
1263      // call the real callback
1264      int vpos = m_screen->vpos();
1265      (*m_config.m_callback)(*this, m_ptr, vpos);
366            // advance by the increment only if we will still be within the screen bounds
367              if (m_config.m_increment != 0 && (vpos + m_config.m_increment) < m_screen->height())
368               next_vpos = vpos + m_config.m_increment;
369         }
370         m_first_time = false;
1266371
1267      // advance by the increment only if we will still be within the screen bounds
1268        if (m_config.m_increment != 0 && (vpos + m_config.m_increment) < m_screen->height())
1269         next_vpos = vpos + m_config.m_increment;
372         // adjust the timer
373         timer_adjust_oneshot(m_timer, m_screen->time_until_pos(next_vpos), 0);
374         break;
375      }
1270376   }
1271   m_first_time = false;
1272
1273   // adjust the timer
1274   timer_adjust_oneshot(m_timer, m_screen->time_until_pos(next_vpos), 0);
1275377}
src/emu/timer.h
r10315r10316
22
33    timer.h
44
5    Functions needed to generate timing and synchronization between several
6    CPUs.
5    Timer devices.
76
8    Copyright Nicola Salmoria and the MAME Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
7****************************************************************************
108
9    Copyright Aaron Giles
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
1138***************************************************************************/
1239
1340#pragma once
r10315r10316
1946#ifndef __TIMER_H__
2047#define __TIMER_H__
2148
22#include "devlegcy.h"
2349
2450
25/***************************************************************************
26    MACROS
27***************************************************************************/
51//**************************************************************************
52//  MACROS
53//**************************************************************************
2854
29/* macro for the RC time constant on a 74LS123 with C > 1000pF */
30/* R is in ohms, C is in farads */
31#define TIME_OF_74LS123(r,c)         (0.45 * (double)(r) * (double)(c))
32
33/* macros for the RC time constant on a 555 timer IC */
34/* R is in ohms, C is in farads */
35#define PERIOD_OF_555_MONOSTABLE_NSEC(r,c)   ((attoseconds_t)(1100000000 * (double)(r) * (double)(c)))
36#define PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c)   ((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c)))
37#define PERIOD_OF_555_MONOSTABLE(r,c)      attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c))
38#define PERIOD_OF_555_ASTABLE(r1,r2,c)      attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c))
39
40/* macros that map all allocations to provide file/line/functions to the callee */
41#define timer_alloc(m,c,ptr)         _timer_alloc_internal(m, c, ptr, __FILE__, __LINE__, #c)
42#define timer_pulse(m,e,ptr,p,c)      _timer_pulse_internal(m, e, ptr, p, c, __FILE__, __LINE__, #c)
43#define timer_set(m,d,ptr,p,c)         _timer_set_internal(m, d, ptr, p, c, __FILE__, __LINE__, #c)
44#define timer_call_after_resynch(m,ptr,p,c) _timer_set_internal(m, attotime::zero, ptr, p, c, __FILE__, __LINE__, #c)
45
46/* macros for a timer callback functions */
47#define TIMER_CALLBACK(name)         void name(running_machine *machine, void *ptr, int param)
55// macros for a timer callback functions
4856#define TIMER_DEVICE_CALLBACK(name)      void name(timer_device &timer, void *ptr, INT32 param)
4957
5058
5159
52/***************************************************************************
53    TYPE DEFINITIONS
54***************************************************************************/
5560
56// forward declarations
57class emu_timer;
58class timer_device;
59
60
61// a timer callback looks like this
62typedef void (*timer_fired_func)(running_machine *machine, void *ptr, INT32 param);
63typedef void (*timer_device_fired_func)(timer_device &timer, void *ptr, INT32 param);
64
65
66struct timer_execution_state
67{
68   attotime            nextfire;      /* time that the head of the timer list will fire */
69   attotime            basetime;      /* global basetime; everything moves forward from here */
70   attoseconds_t         curquantum;      /* current quantum of execution */
71};
72
73
74
7561//**************************************************************************
7662//  TIMER DEVICE CONFIGURATION MACROS
7763//**************************************************************************
r10315r10316
10591
10692
10793
108/***************************************************************************
109    FUNCTION PROTOTYPES
110***************************************************************************/
94//**************************************************************************
95//  TYPE DEFINITIONS
96//**************************************************************************
11197
98// forward declarations
99class emu_timer;
100class timer_device;
112101
113/* ----- initialization ----- */
102// a timer callback looks like this
103typedef void (*timer_device_fired_func)(timer_device &timer, void *ptr, INT32 param);
114104
115/* initialize the timer system */
116void timer_init(running_machine *machine);
117105
118/* destruct a timer from a pool callback */
119void timer_destructor(void *ptr, size_t size);
120
121
122
123/* ----- scheduling helpers ----- */
124
125/* return a pointer to the execution state */
126timer_execution_state *timer_get_execution_state(running_machine *machine);
127
128/* execute timers and update scheduling quanta */
129void timer_execute_timers(running_machine *machine);
130
131/* add a scheduling quantum; the smallest active one is the one that is in use */
132void timer_add_scheduling_quantum(running_machine *machine, attoseconds_t quantum, attotime duration);
133
134/* control the minimum useful quantum (used by cpuexec only) */
135void timer_set_minimum_quantum(running_machine *machine, attoseconds_t quantum);
136
137
138
139/* ----- save/restore helpers ----- */
140
141/* count the number of anonymous (non-saveable) timers */
142int timer_count_anonymous(running_machine *machine);
143
144
145
146/* ----- core timer management ----- */
147
148/* allocate a permament timer that isn't primed yet */
149emu_timer *_timer_alloc_internal(running_machine *machine, timer_fired_func callback, void *param, const char *file, int line, const char *func);
150
151/* allocate a permament device timer that isn't primed yet */
152emu_timer *device_timer_alloc(device_t &device, device_timer_id id = 0, void *ptr = NULL);
153
154/* adjust the time when this timer will fire and disable any periodic firings */
155void timer_adjust_oneshot(emu_timer *which, attotime duration, INT32 param);
156
157/* adjust the time when this timer will fire and specify a period for subsequent firings */
158void timer_adjust_periodic(emu_timer *which, attotime start_delay, INT32 param, attotime period);
159
160
161
162/* ----- anonymous timer management ----- */
163
164/* request a one-shot temporary timer for a device */
165void device_timer_call_after_resynch(device_t &device, device_timer_id id = 0, INT32 param = 0, void *ptr = NULL);
166
167/* allocate a one-shot timer, which calls the callback after the given duration */
168void _timer_set_internal(running_machine *machine, attotime duration, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func);
169
170/* allocate a pulse timer, which repeatedly calls the callback using the given period */
171void _timer_pulse_internal(running_machine *machine, attotime period, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func);
172
173
174
175/* ----- miscellaneous controls ----- */
176
177/* reset the timing on a timer */
178void timer_reset(emu_timer *which, attotime duration);
179
180/* enable/disable a timer */
181int timer_enable(emu_timer *which, int enable);
182
183/* determine if a timer is enabled */
184int timer_enabled(emu_timer *which);
185
186/* returns the callback parameter of a timer */
187int timer_get_param(emu_timer *which);
188
189/* changes the callback parameter of a timer */
190void timer_set_param(emu_timer *which, int param);
191
192/* returns the callback pointer of a timer */
193void *timer_get_ptr(emu_timer *which);
194
195/* changes the callback pointer of a timer */
196void timer_set_ptr(emu_timer *which, void *ptr);
197
198
199
200/* ----- timing functions ----- */
201
202/* return the time since the last trigger */
203attotime timer_timeelapsed(emu_timer *which);
204
205/* return the time until the next trigger */
206attotime timer_timeleft(emu_timer *which);
207
208/* return the current time */
209attotime timer_get_time(running_machine *machine);
210
211/* return the time when this timer started counting */
212attotime timer_starttime(emu_timer *which);
213
214/* return the time when this timer will fire next */
215attotime timer_firetime(emu_timer *which);
216
217
218
219106// ======================> timer_device_config
220107
221108class timer_device_config : public device_config
222109{
223110   friend class timer_device;
224
111   
225112   // construction/destruction
226113   timer_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
227114
r10315r10316
268155};
269156
270157
271
272158// ======================> timer_device
273159
274160class timer_device : public device_t
r10315r10316
280166
281167public:
282168   // property getters
283   int param() const { return timer_get_param(m_timer); }
169   int param() const { return m_timer->param(); }
284170   void *ptr() const { return m_ptr; }
285   bool enabled() const { return (timer_enabled(m_timer) != 0); }
171   bool enabled() const { return m_timer->enabled(); }
286172
287173   // property setters
288   void set_param(int param) { assert(m_config.m_type == timer_device_config::TIMER_TYPE_GENERIC); timer_set_param(m_timer, param); }
174   void set_param(int param) { assert(m_config.m_type == timer_device_config::TIMER_TYPE_GENERIC); m_timer->set_param(param); }
289175   void set_ptr(void *ptr) { m_ptr = ptr; }
290   void enable(bool enable = true) { timer_enable(m_timer, enable); }
176   void enable(bool enable = true) { m_timer->enable(enable); }
291177
292178   // adjustments
293179   void reset() { adjust(attotime::never, 0, attotime::never); }
294   void adjust(attotime duration, INT32 param = 0, attotime period = attotime::never) { assert(m_config.m_type == timer_device_config::TIMER_TYPE_GENERIC); timer_adjust_periodic(m_timer, duration, param, period); }
180   void adjust(attotime duration, INT32 param = 0, attotime period = attotime::never) { assert(m_config.m_type == timer_device_config::TIMER_TYPE_GENERIC); m_timer->adjust(duration, param, period); }
295181
296182   // timing information
297   attotime time_elapsed() const { return timer_timeelapsed(m_timer); }
298   attotime time_left() const { return timer_timeleft(m_timer); }
299   attotime start_time() const { return timer_starttime(m_timer); }
300   attotime fire_time() const { return timer_firetime(m_timer); }
183   attotime time_elapsed() const { return m_timer->elapsed(); }
184   attotime time_left() const { return m_timer->remaining(); }
185   attotime start_time() const { return m_timer->start(); }
186   attotime fire_time() const { return m_timer->expire(); }
301187
302188private:
303189   // device-level overrides
304190   virtual void device_start();
305191   virtual void device_reset();
192   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
306193
307   // internal helpers
308   static TIMER_CALLBACK( static_periodic_timer_callback ) { reinterpret_cast<timer_device *>(ptr)->periodic_timer_callback(param); }
309   void periodic_timer_callback(int param);
310
311   static TIMER_CALLBACK( static_scanline_timer_callback ) { reinterpret_cast<timer_device *>(ptr)->scanline_timer_callback(param); }
312   void scanline_timer_callback(int scanline);
313
314194   // internal state
315   const timer_device_config &m_config;
316   emu_timer *      m_timer;         // the backing timer
317   void *         m_ptr;            // the pointer parameter passed to the timer callback
195   const timer_device_config &   m_config;
196   emu_timer *               m_timer;         // the backing timer
197   void *                  m_ptr;            // the pointer parameter passed to the timer callback
318198
319199   // scanline timers only
320   screen_device *m_screen;      // pointer to the screen
321   bool         m_first_time;      // indicates that the system is starting
200   screen_device *            m_screen;         // pointer to the screen
201   bool                  m_first_time;      // indicates that the system is starting
322202};
323203
324204
325// device type definition
205
206//**************************************************************************
207//  GLOBAL VARIABLES
208//**************************************************************************
209
326210extern const device_type TIMER;
327211
328212
src/mess/devices/sonydriv.c
r10315r10316
332332         /* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */
333333         if (cur_image)
334334         {
335            result = ((int) (timer_get_time(device->machine).as_double() / 60.0 * sony_rpm(f, &cur_image->device()) * 60.0 * 2.0)) & 1;
335            result = ((int) (device->machine->time().as_double() / 60.0 * sony_rpm(f, &cur_image->device()) * 60.0 * 2.0)) & 1;
336336         }
337337         break;
338338      case 0x0f:   /* 400k/800k: Drive installed: 0=drive connected, 1=drive not connected */
src/mess/devices/microdrv.c
r10315r10316
200200   mdv->right = auto_alloc_array(device->machine, UINT8, MDV_IMAGE_LENGTH / 2);
201201
202202   // allocate timers
203   mdv->bit_timer = timer_alloc(device->machine, bit_timer_tick, (void *) device);
203   mdv->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_timer_tick), (void *) device);
204204   timer_adjust_periodic(mdv->bit_timer, attotime::zero, 0, attotime::from_hz(MDV_BITRATE));
205205   timer_enable(mdv->bit_timer, 0);
206206}
src/mess/devices/xmodem.c
r10315r10316
305305   state->image = NULL;
306306   state->conf = (xmodem_config*) device->baseconfig().static_config();
307307   state->machine = device->machine;
308   state->timer = timer_alloc(device->machine,  xmodem_nak_cb, state );
308   state->timer = device->machine->scheduler().timer_alloc(FUNC(xmodem_nak_cb), state );
309309}
310310
311311static DEVICE_RESET( xmodem )
src/mess/devices/kermit.c
r10315r10316
646646   state->image = NULL;
647647   state->conf = (kermit_config*) device->baseconfig().static_config();
648648   state->machine = device->machine;
649   state->resend = timer_alloc(device->machine,  kermit_resend_cb, state );
649   state->resend = device->machine->scheduler().timer_alloc(FUNC(kermit_resend_cb), state );
650650   kermit_reset( state );
651651}
652652
src/mess/devices/cococart.c
r10315r10316
110110
111111   for( i=0; i<TIMER_POOL; i++ )
112112   {
113      cococart->cart_line.timer[i]      = timer_alloc(device->machine, cart_timer_callback, (void *) device);
114      cococart->nmi_line.timer[i]       = timer_alloc(device->machine, nmi_timer_callback, (void *) device);
115      cococart->halt_line.timer[i]      = timer_alloc(device->machine, halt_timer_callback, (void *) device);
113      cococart->cart_line.timer[i]      = device->machine->scheduler().timer_alloc(FUNC(cart_timer_callback), (void *) device);
114      cococart->nmi_line.timer[i]       = device->machine->scheduler().timer_alloc(FUNC(nmi_timer_callback), (void *) device);
115      cococart->halt_line.timer[i]      = device->machine->scheduler().timer_alloc(FUNC(halt_timer_callback), (void *) device);
116116   }
117117   
118118   cococart->cart_line.timer_index     = 0;
src/mess/tools/messtest/testmess.c
r10315r10316
604604
605605static void command_wait(running_machine *machine)
606606{
607   attotime current_time = timer_get_time(machine);
607   attotime current_time = machine->time();
608608
609609   if (state == STATE_READY)
610610   {
r10315r10316
648648static void command_rawinput(running_machine *machine)
649649{
650650   //int parts;
651   attotime current_time = timer_get_time(machine);
651   attotime current_time = machine->time();
652652   static const char *position;
653653#if 0
654654   int i;
r10315r10316
10831083{
10841084   /* at the end of our test */
10851085   state = STATE_DONE;
1086   final_time = timer_get_time(machine);
1086   final_time = machine->time();
10871087   machine->schedule_exit();
10881088}
10891089
r10315r10316
11421142   }
11431143
11441144   /* have we hit the time limit? */
1145   current_time = timer_get_time(machine);
1145   current_time = machine->time();
11461146   time_limit = (current_testcase.time_limit != attotime::zero) ? current_testcase.time_limit
11471147      : attotime::from_seconds(600);
11481148   if (current_time > time_limit)
src/mess/tools/messtest/core.c
r10315r10316
629629   if ((msgtype == MSG_FAILURE) && (state != STATE_ABORTED))
630630   {
631631      state = STATE_ABORTED;
632      final_time = timer_get_time(machine);
632      final_time = machine->time();
633633      if (final_time > 0.0)
634634         dump_screenshot();
635635   }
src/mess/audio/t6721.c
r10315r10316
8888      if(VERBOSE_LEVEL >= N) \
8989      { \
9090         if( M ) \
91            logerror("%11.6f: %-24s", timer_get_time(device->machine).as_double(), (char*) M ); \
91            logerror("%11.6f: %-24s", device->machine->time().as_double(), (char*) M ); \
9292         logerror A; \
9393      } \
9494   } while(0)
r10315r10316
237237{
238238   t6721_state *t6721 = get_safe_token(device);
239239
240   t6721->timer = timer_alloc(device->machine, t6721_speech_timer, t6721);
240   t6721->timer = device->machine->scheduler().timer_alloc(FUNC(t6721_speech_timer), t6721);
241241
242242   state_save_register_device_item_array(device, 0, t6721->sample_data);
243243   state_save_register_device_item_array(device, 0, t6721->data);
src/mess/audio/svision.c
r10315r10316
8383WRITE8_DEVICE_HANDLER( svision_sounddma_w )
8484{
8585   svision_sound_state *state = get_safe_token(device);
86   logerror("%.6f svision snddma write %04x %02x\n", timer_get_time(device->machine).as_double(),offset+0x18,data);
86   logerror("%.6f svision snddma write %04x %02x\n", device->machine->time().as_double(),offset+0x18,data);
8787   state->dma.reg[offset] = data;
8888   switch (offset)
8989   {
r10315r10316
113113WRITE8_DEVICE_HANDLER( svision_noise_w )
114114{
115115   svision_sound_state *state = get_safe_token(device);
116   //  logerror("%.6f svision noise write %04x %02x\n",timer_get_time(machine),offset+0x28,data);
116   //  logerror("%.6f svision noise write %04x %02x\n",machine->time(),offset+0x28,data);
117117   state->noise.reg[offset]=data;
118118   switch (offset)
119119   {
src/mess/audio/lynx.c
r10315r10316
225225void lynx_audio_write(device_t *device, int offset, UINT8 data)
226226{
227227   lynx_sound_state *state = get_safe_token(device);
228//  logerror("%.6f audio write %.2x %.2x\n", timer_get_time(machine), offset, data);
228//  logerror("%.6f audio write %.2x %.2x\n", machine->time(), offset, data);
229229    LYNX_AUDIO *channel=state->audio+((offset>>3)&3);
230230    state->mixer_channel->update();
231231    switch (offset) {
src/mess/audio/ted7360.c
r10315r10316
420420      if(VERBOSE_LEVEL >= N) \
421421      { \
422422         if( M ) \
423            logerror("%11.6f: %-24s", timer_get_time(device->machine).as_double(), (char*) M ); \
423            logerror("%11.6f: %-24s", device->machine->time().as_double(), (char*) M ); \
424424         logerror A; \
425425      } \
426426   } while(0)
r10315r10316
549549static int ted7360_rastercolumn( device_t *device )
550550{
551551   ted7360_state *ted7360 = get_safe_token(device);
552   return (int) ((timer_get_time(device->machine).as_double() - ted7360->rastertime) * TED7360_VRETRACERATE * ted7360->lines * 57 * 8 + 0.5);
552   return (int) ((device->machine->time().as_double() - ted7360->rastertime) * TED7360_VRETRACERATE * ted7360->lines * 57 * 8 + 0.5);
553553}
554554
555555static TIMER_CALLBACK(ted7360_timer_timeout)
r10315r10316
11831183   ted7360_state *ted7360 = get_safe_token(device);
11841184
11851185   ted7360->rasterline++;
1186   ted7360->rastertime = timer_get_time(device->machine).as_double();
1186   ted7360->rastertime = device->machine->time().as_double();
11871187   if (ted7360->rasterline >= ted7360->lines)
11881188   {
11891189      ted7360->rasterline = 0;
r10315r10316
14041404
14051405   ted7360->keyboard_cb = intf->keyb_cb;
14061406
1407   ted7360->timer1 = timer_alloc(device->machine, ted7360_timer_timeout, ted7360);
1408   ted7360->timer2 = timer_alloc(device->machine, ted7360_timer_timeout, ted7360);
1409   ted7360->timer3 = timer_alloc(device->machine, ted7360_timer_timeout, ted7360);
1407   ted7360->timer1 = device->machine->scheduler().timer_alloc(FUNC(ted7360_timer_timeout), ted7360);
1408   ted7360->timer2 = device->machine->scheduler().timer_alloc(FUNC(ted7360_timer_timeout), ted7360);
1409   ted7360->timer3 = device->machine->scheduler().timer_alloc(FUNC(ted7360_timer_timeout), ted7360);
14101410
14111411   ted7360_sound_start(device);
14121412
src/mess/audio/upd1771.c
r10315r10316
349349    /* resolve callbacks */
350350    devcb_resolve_write_line( &state->ack_out_func, &intf->ack_callback, device );
351351
352    state->timer = timer_alloc( device->machine, upd1771c_callback, (void *)device );
352    state->timer = device->machine->scheduler().timer_alloc(FUNC(upd1771c_callback), (void *)device );
353353
354354    state->channel = device->machine->sound().stream_alloc( *device, 0, 1, sample_rate, state, upd1771c_update );
355355
src/mess/audio/mea8000.c
r10315r10316
507507      if (mea8000->bufpos == 4)
508508      {
509509         /* we have a successor */
510         LOG(( "%f mea8000_timer_expire: new frame\n", timer_get_time(machine).as_double() ));
510         LOG(( "%f mea8000_timer_expire: new frame\n", machine->time().as_double() ));
511511         mea8000_decode_frame(mea8000);
512512         mea8000_start_frame(mea8000);
513513      }
514514      else if (mea8000->cont)
515515      {
516516         /* repeat mode */
517         LOG(( "%f mea8000_timer_expire: repeat frame\n", timer_get_time(machine).as_double() ));
517         LOG(( "%f mea8000_timer_expire: repeat frame\n", machine->time().as_double() ));
518518         mea8000_start_frame(mea8000);
519519      }
520520      /* slow stop */
521521      else if (mea8000->state == MEA8000_STARTED)
522522      {
523523         mea8000->ampl = 0;
524         LOG(( "%f mea8000_timer_expire: fade frame\n", timer_get_time(machine).as_double() ));
524         LOG(( "%f mea8000_timer_expire: fade frame\n", machine->time().as_double() ));
525525         mea8000_start_frame(mea8000);
526526         mea8000->state = MEA8000_SLOWING;
527527      }
528528      else if (mea8000->state == MEA8000_SLOWING)
529529      {
530         LOG(( "%f mea8000_timer_expire: stop frame\n", timer_get_time(machine).as_double() ));
530         LOG(( "%f mea8000_timer_expire: stop frame\n", machine->time().as_double() ));
531531         mea8000_stop_frame(machine, mea8000);
532532      }
533533      mea8000_update_req(device);
r10315r10316
555555   case 1:
556556      /* ready to accept next frame */
557557#if 0
558      LOG(( "$%04x %f: mea8000_r ready=%i\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(machine).as_double(), mea8000_accept_byte( mea8000 ) ));
558      LOG(( "$%04x %f: mea8000_r ready=%i\n", cpu_get_previouspc( device->machine->firstcpu ), machine->time().as_double(), mea8000_accept_byte( mea8000 ) ));
559559#endif
560560      return mea8000_accept_byte(mea8000) << 7;
561561
r10315r10316
576576      {
577577         /* got pitch byte before first frame */
578578         mea8000->pitch = 2 * data;
579         LOG(( "$%04x %f: mea8000_w pitch %i\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mea8000->pitch ));
579         LOG(( "$%04x %f: mea8000_w pitch %i\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mea8000->pitch ));
580580         mea8000->state = MEA8000_WAIT_FIRST;
581581         mea8000->bufpos = 0;
582582      }
583583      else if (mea8000->bufpos == 4)
584584      {
585585         /* overflow */
586         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), data ));
586         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), data ));
587587      }
588588      else
589589      {
590590         /* enqueue frame byte */
591         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(),
591         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(),
592592               data, mea8000->bufpos ));
593593         mea8000->buf[mea8000->bufpos] = data;
594594         mea8000->bufpos++;
r10315r10316
622622         mea8000_stop_frame(device->machine, mea8000);
623623
624624      LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n",
625            cpu_get_previouspc(device->machine->firstcpu), timer_get_time(device->machine).as_double(), data,
625            cpu_get_previouspc(device->machine->firstcpu), device->machine->time().as_double(), data,
626626            stop, mea8000->cont, mea8000->roe ));
627627
628628      mea8000_update_req(device);
r10315r10316
670670
671671   mea8000_init_tables(device->machine);
672672
673   mea8000->timer = timer_alloc( device->machine, mea8000_timer_expire , (void*)device );
673   mea8000->timer = device->machine->scheduler().timer_alloc(FUNC(mea8000_timer_expire), (void*)device );
674674
675675   state_save_register_item( device->machine, "mea8000", device->tag(), 0, mea8000->state );
676676   state_save_register_item_array( device->machine, "mea8000", device->tag(), 0, mea8000->buf );
src/mess/audio/dave.c
r10315r10316
155155   dave->one_khz_state = 0;
156156   dave->fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
157157   dave->one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
158   timer_pulse(device->machine, attotime::from_hz(1000), (void *) device, 0, dave_1khz_callback);
158   device->machine->scheduler().timer_pulse(attotime::from_hz(1000), FUNC(dave_1khz_callback), 0, (void *) device);
159159
160160   for (i=0; i<3; i++)
161161   {
src/mess/machine/kr2376.c
r10315r10316
359359   change_output_lines(device);
360360
361361   /* create the timers */
362   kr2376->scan_timer = timer_alloc(device->machine, kr2376_scan_tick, (void *)device);
362   kr2376->scan_timer = device->machine->scheduler().timer_alloc(FUNC(kr2376_scan_tick), (void *)device);
363363   timer_adjust_periodic(kr2376->scan_timer, attotime::zero, 0, attotime::from_hz(kr2376->intf->clock));
364364
365365   /* register for state saving */
src/mess/machine/pdp1.c
r10315r10316
312312
313313   machine->add_notifier(MACHINE_NOTIFY_EXIT, pdp1_machine_stop);
314314
315   state->tape_reader.timer = timer_alloc(machine, reader_callback, NULL);
316   state->tape_puncher.timer = timer_alloc(machine, puncher_callback, NULL);
317   state->typewriter.tyo_timer = timer_alloc(machine, tyo_callback, NULL);
318   state->dpy_timer = timer_alloc(machine, dpy_callback, NULL);
315   state->tape_reader.timer = machine->scheduler().timer_alloc(FUNC(reader_callback));
316   state->tape_puncher.timer = machine->scheduler().timer_alloc(FUNC(puncher_callback));
317   state->typewriter.tyo_timer = machine->scheduler().timer_alloc(FUNC(tyo_callback));
318   state->dpy_timer = machine->scheduler().timer_alloc(FUNC(dpy_callback));
319319}
320320
321321
r10315r10316
10271027
10281028static void parallel_drum_init(pdp1_state *state)
10291029{
1030   state->parallel_drum.rotation_timer = timer_alloc(machine, NULL, NULL);
1030   state->parallel_drum.rotation_timer = machine->scheduler().timer_alloc();
10311031   timer_adjust_periodic(state->parallel_drum.rotation_timer, PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
10321032
1033   state->parallel_drum.il_timer = timer_alloc(machine, il_timer_callback, NULL);
1033   state->parallel_drum.il_timer = machine->scheduler().timer_alloc(FUNC(il_timer_callback));
10341034   parallel_drum_set_il(0);
10351035}
10361036#endif
src/mess/machine/applefdc.c
r10315r10316
196196
197197   memset(fdc, 0, sizeof(*fdc));
198198   fdc->type = type;
199   fdc->motor_timer = timer_alloc(device->machine, iwm_turnmotor_onoff, (void *) device);
199   fdc->motor_timer = device->machine->scheduler().timer_alloc(FUNC(iwm_turnmotor_onoff), (void *) device);
200200   fdc->lines = 0x00;
201201   fdc->mode = 0x1F;   /* default value needed by Lisa 2 - no, I don't know if it is true */
202202   fdc->swim_mode = SWIM_MODE_IWM;
src/mess/machine/hp48.c
r10315r10316
117117{
118118   hp48_state *state = machine->driver_data<hp48_state>();
119119   LOG_SERIAL(( "%f hp48_rs232_byte_recv_cb: end of receive, data=%02x\n",
120           timer_get_time(machine).as_double(), param ));
120           machine->time().as_double(), param ));
121121
122122   state->io[0x14] = param & 0xf; /* receive zone */
123123   state->io[0x15] = param >> 4;
r10315r10316
136136{
137137   hp48_state *state = machine->driver_data<hp48_state>();
138138   LOG_SERIAL(( "%f hp48_rs232_start_recv_byte: start receiving, data=%02x\n",
139           timer_get_time(machine).as_double(), data ));
139           machine->time().as_double(), data ));
140140
141141   state->io[0x11] |= 2;  /* set byte receiving */
142142
r10315r10316
147147   }
148148
149149   /* schedule end of reception */
150   timer_set( machine, RS232_DELAY, NULL, data, hp48_rs232_byte_recv_cb );
150   machine->scheduler().timer_set( RS232_DELAY, FUNC(hp48_rs232_byte_recv_cb), data);
151151}
152152
153153
r10315r10316
159159   device_image_interface *kermit = dynamic_cast<device_image_interface *>(machine->device("rs232_k"));
160160
161161   LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n",
162           timer_get_time(machine).as_double(), param ));
162           machine->time().as_double(), param ));
163163
164164   state->io[0x12] &= ~3; /* clear byte sending and buffer full */
165165
r10315r10316
184184   UINT8 data = HP48_IO_8(0x16); /* byte to send */
185185
186186   LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n",
187           cpu_get_previouspc(machine->device("maincpu")), timer_get_time(machine).as_double(), data ));
187           cpu_get_previouspc(machine->device("maincpu")), machine->time().as_double(), data ));
188188
189189   /* set byte sending and send buffer full */
190190   state->io[0x12] |= 3;
191191
192192   /* schedule transmission */
193   timer_set( machine, RS232_DELAY, NULL, data, hp48_rs232_byte_sent_cb );
193   machine->scheduler().timer_set( RS232_DELAY, FUNC(hp48_rs232_byte_sent_cb), data);
194194}
195195
196196
r10315r10316
202202   UINT8 data = chardev_in( state->chardev );
203203
204204   LOG_SERIAL(( "%f hp48_chardev_byte_recv_cb: end of receive, data=%02x\n",
205           timer_get_time(machine).as_double(), data ));
205           machine->time().as_double(), data ));
206206
207207   state->io[0x14] = data & 0xf; /* receive zone */
208208   state->io[0x15] = data >> 4;
r10315r10316
222222   if ( status != CHARDEV_OK ) return;
223223
224224   LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n",
225           timer_get_time(machine).as_double() ));
225           machine->time().as_double() ));
226226
227227   state->io[0x11] |= 2;  /* set byte receiving */
228228
r10315r10316
233233   }
234234
235235   /* schedule end of reception */
236   timer_set( machine, RS232_DELAY, NULL, 0, hp48_chardev_byte_recv_cb );
236   machine->scheduler().timer_set( RS232_DELAY, FUNC(hp48_chardev_byte_recv_cb));
237237}
238238
239239static void hp48_chardev_ready_to_send( running_machine *machine )
r10315r10316
262262{
263263   hp48_state *state = device->machine->driver_data<hp48_state>();
264264   LOG(( "%05x %f hp48_reg_out: %03x\n",
265         cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), out ));
265         cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), out ));
266266
267267   /* bits 0-8: keyboard lines */
268268   state->out = out & 0x1ff;
r10315r10316
300300{
301301   int in = hp48_get_in( device->machine );
302302   LOG(( "%05x %f hp48_reg_in: %04x\n",
303         cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), in ));
303         cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), in ));
304304   return in;
305305}
306306
r10315r10316
313313   /* interrupt on raising edge */
314314   if ( in && !state->kdn )
315315   {
316      LOG(( "%f hp48_update_kdn: interrupt\n", timer_get_time(machine).as_double() ));
316      LOG(( "%f hp48_update_kdn: interrupt\n", machine->time().as_double() ));
317317      state->io[0x19] |= 8;                                              /* service request */
318318      hp48_pulse_irq( machine, SATURN_WAKEUP_LINE );
319319      hp48_pulse_irq( machine, SATURN_IRQ_LINE );
r10315r10316
330330   if ( input_port_read( machine, "ON" ) )
331331   {
332332      LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n",
333            timer_get_time(machine).as_double() ));
333            machine->time().as_double() ));
334334      state->io[0x19] |= 8;                                          /* set service request */
335335      hp48_pulse_irq( machine, SATURN_WAKEUP_LINE );
336336      hp48_pulse_irq( machine, SATURN_NMI_LINE );
r10315r10316
345345void hp48_rsi( device_t *device )
346346{
347347   hp48_state *state = device->machine->driver_data<hp48_state>();
348   LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double() ));
348   LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double() ));
349349
350350   /* enables interrupts on key repeat
351351       (normally, there is only one interrupt, when the key is pressed)
r10315r10316
389389{
390390   hp48_state *state = space->machine->driver_data<hp48_state>();
391391   LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n",
392         cpu_get_previouspc(space->cpu), timer_get_time(space->machine).as_double(), offset, data ));
392         cpu_get_previouspc(space->cpu), space->machine->time().as_double(), offset, data ));
393393
394394   switch( offset )
395395   {
r10315r10316
438438      if ( data & 1 )
439439      {
440440         LOG(( "%f hp48_io_w: software interrupt requested\n",
441               timer_get_time(space->machine).as_double() ));
441               space->machine->time().as_double() ));
442442         hp48_pulse_irq( space->machine, SATURN_IRQ_LINE );
443443         data &= ~1;
444444      }
r10315r10316
608608   }
609609
610610   LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n",
611         cpu_get_previouspc(space->cpu), timer_get_time(space->machine).as_double(), offset, data ));
611         cpu_get_previouspc(space->cpu), space->machine->time().as_double(), offset, data ));
612612   return data;
613613}
614614
r10315r10316
622622   offset &= 0x7e;
623623   if ( state->bank_switch != offset )
624624   {
625      LOG(( "%05x %f hp48_bank_r: off=%03x\n", cpu_get_previouspc(space->cpu), timer_get_time(space->machine).as_double(), offset ));
625      LOG(( "%05x %f hp48_bank_r: off=%03x\n", cpu_get_previouspc(space->cpu), space->machine->time().as_double(), offset ));
626626      state->bank_switch = offset;
627627      hp48_apply_modules( space->machine, NULL );
628628   }
r10315r10316
854854/* RESET opcode */
855855void hp48_mem_reset( device_t *device )
856856{
857   LOG(( "%05x %f hp48_mem_reset\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double() ));
857   LOG(( "%05x %f hp48_mem_reset\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double() ));
858858   hp48_reset_modules( device->machine );
859859}
860860
r10315r10316
865865   hp48_state *state = device->machine->driver_data<hp48_state>();
866866   int i;
867867
868   LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), v ));
868   LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), v ));
869869
870870   /* find the highest priority unconfigured module (except non-configurable NCE1)... */
871871   for ( i = 0; i < 5; i++ )
r10315r10316
897897{
898898   hp48_state *state = device->machine->driver_data<hp48_state>();
899899   int i;
900   LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), v ));
900   LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), v ));
901901
902902   /* find the highest priority fully configured module at address v (except NCE1)... */
903903   for ( i = 0; i < 5; i++ )
r10315r10316
941941   }
942942
943943   LOG(( "%05x %f hp48_mem_id = %02x\n",
944         cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), data ));
944         cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), data ));
945945
946946   return data; /* everything is configured */
947947}
r10315r10316
12081208   state->modules[5].data     = rom;
12091209
12101210   /* timers */
1211   timer_pulse(machine,  attotime::from_hz( 16 ),   NULL, 0, hp48_timer1_cb );
1212   timer_pulse(machine,  attotime::from_hz( 8192 ), NULL, 0, hp48_timer2_cb );
1211   machine->scheduler().timer_pulse(attotime::from_hz( 16 ), FUNC(hp48_timer1_cb));
1212   machine->scheduler().timer_pulse(attotime::from_hz( 8192 ), FUNC(hp48_timer2_cb));
12131213
12141214   /* 1ms keyboard polling */
1215   timer_pulse(machine,  attotime::from_msec( 1 ), NULL, 0, hp48_kbd_cb );
1215   machine->scheduler().timer_pulse(attotime::from_msec( 1 ), FUNC(hp48_kbd_cb));
12161216
12171217   /* save state */
12181218   state_save_register_global(machine,  state->out );
src/mess/machine/upd765.c
r10315r10316
23212321   fdc->intf = (const upd765_interface*)device->baseconfig().static_config();
23222322
23232323   fdc->version = (UPD765_VERSION)device_type;
2324   fdc->timer = timer_alloc(device->machine, upd765_timer_callback, (void*)device);
2325   fdc->seek_timer = timer_alloc(device->machine, upd765_seek_timer_callback, (void*)device);
2326   fdc->command_timer = timer_alloc(device->machine, upd765_continue_command, (void*)device);
2324   fdc->timer = device->machine->scheduler().timer_alloc(FUNC(upd765_timer_callback), (void*)device);
2325   fdc->seek_timer = device->machine->scheduler().timer_alloc(FUNC(upd765_seek_timer_callback), (void*)device);
2326   fdc->command_timer = device->machine->scheduler().timer_alloc(FUNC(upd765_continue_command), (void*)device);
23272327
23282328   fdc->upd765_flags &= UPD765_FDD_READY;
23292329   fdc->data_buffer = auto_alloc_array(device->machine, char, 32*1024);
src/mess/machine/c65.c
r10315r10316
2323      if(VERBOSE_LEVEL >= N) \
2424      { \
2525         if( M ) \
26            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
26            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
2727         logerror A; \
2828      } \
2929   } while (0)
r10315r10316
524524   switch (state->fdc.state)
525525   {
526526   case FDC_CMD_MOTOR_SPIN_UP:
527      if (timer_get_time(machine) - state->fdc.time)
527      if (machine->time() - state->fdc.time)
528528      {
529529         state->fdc.state = 0;
530530         state->fdc.status &= ~FDC_BUSY;
r10315r10316
550550      case 0x20: // wait for motor spin up
551551         state->fdc.status &= ~(FDC_IRQ|FDC_LOST|FDC_CRC|FDC_RNF);
552552         state->fdc.status |= FDC_BUSY;
553         state->fdc.time = timer_get_time(machine);
553         state->fdc.time = machine->time();
554554         state->fdc.state = FDC_CMD_MOTOR_SPIN_UP;
555555         break;
556556      case 0: // cancel
src/mess/machine/dai.c
r10315r10316
149149   state->tms5501 = machine->device("tms5501");
150150
151151   memory_configure_bank(machine, "bank2", 0, 4, machine->region("maincpu")->base() + 0x010000, 0x1000);
152   timer_set(machine, attotime::zero, NULL, 0, dai_bootstrap_callback);
153   timer_pulse(machine, attotime::from_hz(100),NULL,0,dai_timer);   /* timer for tms5501 */
152   machine->scheduler().timer_set(attotime::zero, FUNC(dai_bootstrap_callback));
153   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(dai_timer));   /* timer for tms5501 */
154154}
155155
156156MACHINE_RESET( dai )
src/mess/machine/teleprinter.c
r10315r10316
287287
288288   devcb_resolve_write8(&term->teleprinter_keyboard_func, &intf->teleprinter_keyboard_func, device);
289289
290   timer_pulse(device->machine, attotime::from_hz(240), (void*)device, 0, keyboard_callback);
290   device->machine->scheduler().timer_pulse(attotime::from_hz(240), FUNC(keyboard_callback), 0, (void*)device);
291291}
292292
293293/*-------------------------------------------------
src/mess/machine/cbmb.c
r10315r10316
2727      if(VERBOSE_LEVEL >= N) \
2828      { \
2929         if( M ) \
30            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
30            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
3131         logerror A; \
3232      } \
3333   } while (0)
r10315r10316
313313   state->chargen = machine->region("maincpu")->base() + 0x100000;
314314   /*    memset(c64_memory, 0, 0xfd00); */
315315
316   timer_pulse(machine, attotime::from_msec(10), NULL, 0, cbmb_frame_interrupt);
316   machine->scheduler().timer_pulse(attotime::from_msec(10), FUNC(cbmb_frame_interrupt));
317317
318318   state->p500 = 0;
319319   state->cbm700 = 0;
r10315r10316
483483//  vic2_frame_interrupt (device);
484484
485485   /* for p500, check if lightpen has been chosen as input: if so, enable crosshair (but c64-like inputs for p500 are not working atm) */
486   timer_set(machine, attotime::zero, NULL, 0, p500_lightpen_tick);
486   machine->scheduler().timer_set(attotime::zero, FUNC(p500_lightpen_tick));
487487
488488   set_led_status(machine, 1, input_port_read(machine, "SPECIAL") & 0x04 ? 1 : 0);      /* Shift Lock */
489489}
src/mess/machine/mbee.c
r10315r10316
541541{
542542   machine_reset_common(machine);
543543   memory_set_bank(machine, "boot", 1);
544   timer_set(machine, attotime::from_usec(4), NULL, 0, mbee_reset);
544   machine->scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
545545}
546546
547547MACHINE_RESET( mbee56 )
548548{
549549   machine_reset_common_disk(machine);
550550   memory_set_bank(machine, "boot", 1);
551   timer_set(machine, attotime::from_usec(4), NULL, 0, mbee_reset);
551   machine->scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
552552}
553553
554554MACHINE_RESET( mbee64 )
r10315r10316
578578   state->mbee256_q_pos = 0;
579579   mbee256_50_w(mem,0,0); // set banks to default
580580   memory_set_bank(machine, "boot", 8); // boot time
581   timer_set(machine, attotime::from_usec(4), NULL, 0, mbee_reset);
581   machine->scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
582582}
583583
584584MACHINE_RESET( mbeett )
r10315r10316
590590   state->mbee256_q_pos = 0;
591591   machine_reset_common(machine);
592592   memory_set_bank(machine, "boot", 1);
593   timer_set(machine, attotime::from_usec(4), NULL, 0, mbee_reset);
593   machine->scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
594594}
595595
596596INTERRUPT_GEN( mbee_interrupt )
r10315r10316
757757   memory_configure_bank(machine, "bank8l", 0, 1, &RAM[0x0000], 0x0000); // rom
758758   memory_configure_bank(machine, "bank8h", 0, 1, &RAM[0x0800], 0x0000); // rom
759759
760   timer_pulse(machine, attotime::from_hz(1),NULL,0,mbee_rtc_irq);   /* timer for rtc */
761   timer_pulse(machine, attotime::from_hz(25),NULL,0,mbee256_kbd);   /* timer for kbd */
760   machine->scheduler().timer_pulse(attotime::from_hz(1), FUNC(mbee_rtc_irq));   /* timer for rtc */
761   machine->scheduler().timer_pulse(attotime::from_hz(25), FUNC(mbee256_kbd));   /* timer for kbd */
762762
763763   state->size = 0x8000;
764764}
r10315r10316
778778   memory_set_bank(machine, "pak", 5);
779779   memory_set_bank(machine, "telcom", 0);
780780
781   timer_pulse(machine, attotime::from_hz(1),NULL,0,mbee_rtc_irq);   /* timer for rtc */
782   timer_pulse(machine, attotime::from_hz(25),NULL,0,mbee256_kbd);   /* timer for kbd */
781   machine->scheduler().timer_pulse(attotime::from_hz(1), FUNC(mbee_rtc_irq));   /* timer for rtc */
782   machine->scheduler().timer_pulse(attotime::from_hz(25), FUNC(mbee256_kbd));   /* timer for kbd */
783783
784784   state->size = 0x8000;
785785}
src/mess/machine/pokemini.c
r10315r10316
15681568   memset( state->pm_reg, 0, sizeof(state->pm_reg) );
15691569
15701570   /* Set up timers */
1571   state->timers.seconds_timer = timer_alloc(machine,  pokemini_seconds_timer_callback , NULL );
1571   state->timers.seconds_timer = machine->scheduler().timer_alloc(FUNC(pokemini_seconds_timer_callback));
15721572   timer_adjust_periodic( state->timers.seconds_timer, attotime::zero, 0, attotime::from_seconds( 1 ) );
15731573
1574   state->timers.hz256_timer = timer_alloc(machine,  pokemini_256hz_timer_callback , NULL );
1574   state->timers.hz256_timer = machine->scheduler().timer_alloc(FUNC(pokemini_256hz_timer_callback));
15751575   timer_adjust_periodic( state->timers.hz256_timer, attotime::zero, 0, attotime::from_hz( 256 ) );
15761576
1577   state->timers.timer1 = timer_alloc(machine,  pokemini_timer1_callback , NULL );
1578   state->timers.timer1_hi = timer_alloc(machine,  pokemini_timer1_hi_callback, NULL );
1579   state->timers.timer2 = timer_alloc(machine,  pokemini_timer2_callback , NULL );
1580   state->timers.timer2_hi = timer_alloc(machine,  pokemini_timer2_hi_callback, NULL );
1581   state->timers.timer3 = timer_alloc(machine,  pokemini_timer3_callback , NULL );
1582   state->timers.timer3_hi = timer_alloc(machine,  pokemini_timer3_hi_callback, NULL );
1577   state->timers.timer1 = machine->scheduler().timer_alloc(FUNC(pokemini_timer1_callback));
1578   state->timers.timer1_hi = machine->scheduler().timer_alloc(FUNC(pokemini_timer1_hi_callback));
1579   state->timers.timer2 = machine->scheduler().timer_alloc(FUNC(pokemini_timer2_callback));
1580   state->timers.timer2_hi = machine->scheduler().timer_alloc(FUNC(pokemini_timer2_hi_callback));
1581   state->timers.timer3 = machine->scheduler().timer_alloc(FUNC(pokemini_timer3_callback));
1582   state->timers.timer3_hi = machine->scheduler().timer_alloc(FUNC(pokemini_timer3_hi_callback));
15831583
15841584   /* Set up the PRC */
15851585   state->prc.max_frame_count = 2;
1586   state->prc.count_timer = timer_alloc(machine,  pokemini_prc_counter_callback, NULL );
1586   state->prc.count_timer = machine->scheduler().timer_alloc(FUNC(pokemini_prc_counter_callback));
15871587   timer_adjust_periodic( state->prc.count_timer, attotime::zero, 0, machine->device<cpu_device>("maincpu")->cycles_to_attotime(55640 / 65) );
15881588}
15891589
src/mess/machine/pc1350.c
r10315r10316
126126   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
127127
128128   state->power = 1;
129   timer_set(machine, attotime::from_seconds(1), NULL, 0, pc1350_power_up);
129   machine->scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1350_power_up));
130130
131131   memory_install_readwrite_bank(space, 0x6000, 0x6fff, 0, 0, "bank1");
132132   memory_set_bankptr(machine, "bank1", &ram_get_ptr(machine->device(RAM_TAG))[0x0000]);
src/mess/machine/mos6530.c
r10315r10316
179179   if (offset & 0x04)
180180   {
181181      static const UINT8 timershift[4] = { 0, 3, 6, 10 };
182      attotime curtime = timer_get_time(device->machine);
182      attotime curtime = device->machine->time();
183183      INT64 target;
184184
185185      /* A0-A1 contain the timer divisor */
r10315r10316
394394   devcb_resolve_write8(&miot->port[1].out_port_func, &intf->out_pb_func, device);
395395
396396   /* allocate timers */
397   miot->timer = timer_alloc(device->machine, timer_end_callback, (void *)device);
397   miot->timer = device->machine->scheduler().timer_alloc(FUNC(timer_end_callback), (void *)device);
398398
399399   /* register for save states */
400400   state_save_register_device_item(device, 0, miot->port[0].in);
src/mess/machine/ti99/ti_fdc.c
r10315r10316
344344   peb_callback_if *topeb = (peb_callback_if *)device->baseconfig().static_config();
345345   devcb_resolve_write_line(&card->lines.ready, &topeb->ready, device);
346346
347   card->motor_on_timer = timer_alloc(device->machine, motor_on_timer_callback, (void *)device);
347   card->motor_on_timer = device->machine->scheduler().timer_alloc(FUNC(motor_on_timer_callback), (void *)device);
348348
349349   astring *region = new astring();
350350   astring_assemble_3(region, device->tag(), ":", fdc_region);
src/mess/machine/ti99/speech8.c
r10315r10316
153153         logerror("time to ready: %f -> %d\n", time_to_ready.as_double(), (int) cycles_to_ready);
154154
155155         cpu_adjust_icount(device->machine->device("maincpu"),-cycles_to_ready);
156         timer_set(device->machine, attotime::zero, NULL, 0, NULL);
156         device->machine->scheduler().timer_set(attotime::zero, FUNC(NULL));
157157      }
158158      tms5220_data_w(spsys->vsp, offset, data);
159159   }
src/mess/machine/ti99/hfdc.c
r10315r10316
654654   devcb_resolve_write_line(&card->lines.inta, &topeb->inta, device);
655655   // The HFDC does not use READY; it has on-board RAM for DMA
656656
657   card->motor_on_timer = timer_alloc(device->machine, motor_on_timer_callback, (void *)device);
657   card->motor_on_timer = device->machine->scheduler().timer_alloc(FUNC(motor_on_timer_callback), (void *)device);
658658   card->ram = NULL;
659659   card->ram_offset[0] = 0x2000; // static bank
660660   card->controller = device->subdevice("smc92x4");
src/mess/machine/ti99/bwg.c
r10315r10316
482482   peb_callback_if *topeb = (peb_callback_if *)device->baseconfig().static_config();
483483   devcb_resolve_write_line(&card->lines.ready, &topeb->ready, device);
484484
485   card->motor_on_timer = timer_alloc(device->machine, motor_on_timer_callback, (void *)device);
485   card->motor_on_timer = device->machine->scheduler().timer_alloc(FUNC(motor_on_timer_callback), (void *)device);
486486   card->controller = device->subdevice("wd1773");
487487   card->clock = device->subdevice("mm58274c");
488488   astring *region = new astring();
src/mess/machine/ti99/handset.c
r10315r10316
341341static DEVICE_START( ti99_handset )
342342{
343343   ti99_handset_state *handset = get_safe_token(device);
344   handset->timer = timer_alloc(device->machine, ti99_handset_ack_callback, (void *)device);
344   handset->timer = device->machine->scheduler().timer_alloc(FUNC(ti99_handset_ack_callback), (void *)device);
345345}
346346
347347static DEVICE_RESET( ti99_handset )
src/mess/machine/ti99/spchsyn.c
r10315r10316
162162         logerror("time to ready: %f -> %d\n", time_to_ready.as_double(), (int) cycles_to_ready);
163163
164164         cpu_adjust_icount(device->machine->device("maincpu"),-cycles_to_ready);
165         timer_set(device->machine, attotime::zero, NULL, 0, NULL);
165         device->machine->scheduler().timer_set(attotime::zero, FUNC(NULL));
166166      }
167167      tms5220_data_w(adapter->vsp, offset, data);
168168   }
src/mess/machine/rp5c15.c
r10315r10316
108108   int pulse_count;
109109   int pulse1_state;
110110   int pulse16_state;
111   void (*timer_fired_func)(int state);
111   void (*timer_expired_func)(int state);
112112   void (*alarm_callback)(running_machine *machine, int state);
113113   const rp5c15_intf* intf;
114114   emu_timer* timer;
r10315r10316
193193   rtc->test = 0x00;
194194   rtc->pulse_count = 0;
195195
196   rtc->timer = timer_alloc(device->machine, rtc_alarm_pulse, (void*)device);
196   rtc->timer = device->machine->scheduler().timer_alloc(FUNC(rtc_alarm_pulse), (void*)device);
197197   timer_adjust_periodic(rtc->timer, attotime::zero, 0, attotime::from_hz(32));
198198}
199199
src/mess/machine/coco.c
r10315r10316
10701070   coco_state *state = machine->driver_data<coco_state>();
10711071   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, halt_line);
10721072   if (halt_line == CLEAR_LINE)
1073      timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), NULL, 0, state->recalc_interrupts);
1073      machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(state->recalc_interrupts));
10741074}
10751075#endif
10761076
r10315r10316
11031103      val = val * 4160.0 + 592.0;
11041104   }
11051105
1106   return (timer_get_time(machine) + (COCO_CPU_SPEED * val));
1106   return (machine->time() + (COCO_CPU_SPEED * val));
11071107}
11081108
11091109static void coco_hiresjoy_w( running_machine *machine, int data, UINT8 port )
r10315r10316
11271127
11281128static int coco_hiresjoy_readone( running_machine *machine, attotime transitiontime )
11291129{
1130   return timer_get_time(machine) >= transitiontime;
1130   return machine->time() >= transitiontime;
11311131}
11321132
11331133static int coco_hiresjoy_rx( running_machine *machine )
r10315r10316
13361336static attotime get_relative_time( running_machine *machine, attotime absolute_time )
13371337{
13381338   attotime result;
1339   attotime now = timer_get_time(machine);
1339   attotime now = machine->time();
13401340
13411341   if (absolute_time > now)
13421342      result = absolute_time - now;
r10315r10316
22772277static void coco3_timer_init(running_machine *machine)
22782278{
22792279   coco3_state *state = machine->driver_data<coco3_state>();
2280   state->gime_timer = timer_alloc(machine, coco3_timer_proc, NULL);
2280   state->gime_timer = machine->scheduler().timer_alloc(FUNC(coco3_timer_proc));
22812281}
22822282
22832283
r10315r10316
28232823typedef struct _machine_init_interface machine_init_interface;
28242824struct _machine_init_interface
28252825{
2826   timer_fired_func recalc_interrupts_;         /* recalculate inturrupts callback */
2826   timer_expired_func recalc_interrupts_;         /* recalculate inturrupts callback */
28272827   void (*printer_out_)(running_machine *machine, int data);            /* printer output callback */
28282828};
28292829
r10315r10316
28592859   state->recalc_interrupts = init->recalc_interrupts_;
28602860
28612861   /* this timer is used to schedule keyboard updating */
2862   state->update_keyboard_timer = timer_alloc(machine, coco_update_keyboard_timerproc, NULL);
2862   state->update_keyboard_timer = machine->scheduler().timer_alloc(FUNC(coco_update_keyboard_timerproc));
28632863
28642864   /* these are the timers to delay the MUX switching */
2865   state->mux_sel1_timer = timer_alloc(machine, coco_update_sel1_timerproc, NULL);
2866   state->mux_sel2_timer = timer_alloc(machine, coco_update_sel2_timerproc, NULL);
2865   state->mux_sel1_timer = machine->scheduler().timer_alloc(FUNC(coco_update_sel1_timerproc));
2866   state->mux_sel2_timer = machine->scheduler().timer_alloc(FUNC(coco_update_sel2_timerproc));
28672867
28682868   /* setup ROM */
28692869   state->rom = machine->region("maincpu")->base();
r10315r10316
29352935   generic_coco12_dragon_init(machine, &init);
29362936
29372937   /* need to specify lightgun crosshairs */
2938   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
2938   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
29392939}
29402940
29412941MACHINE_START( dragon64 )
r10315r10316
29502950   generic_coco12_dragon_init(machine, &init);
29512951
29522952   /* need to specify lightgun crosshairs */
2953   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
2953   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
29542954}
29552955
29562956MACHINE_START( tanodr64 )
r10315r10316
29652965   generic_coco12_dragon_init(machine, &init);
29662966
29672967   /* need to specify lightgun crosshairs */
2968   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
2968   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
29692969}
29702970
29712971MACHINE_START( dgnalpha )
r10315r10316
29802980   generic_coco12_dragon_init(machine, &init);
29812981
29822982   /* need to specify lightgun crosshairs */
2983   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
2983   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
29842984}
29852985
29862986MACHINE_RESET( dgnalpha )
r10315r10316
29942994   state->dgnalpha_just_reset=1;
29952995
29962996   /* need to specify lightgun crosshairs */
2997   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
2997   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
29982998}
29992999
30003000const wd17xx_interface dgnalpha_wd17xx_interface =
r10315r10316
30193019   generic_coco12_dragon_init(machine, &init);
30203020
30213021   /* need to specify lightgun crosshairs */
3022   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
3022   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
30233023}
30243024
30253025MACHINE_START( coco2 )
r10315r10316
30343034   generic_coco12_dragon_init(machine, &init);
30353035
30363036   /* need to specify lightgun crosshairs */
3037   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
3037   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
30383038}
30393039
30403040MACHINE_RESET( coco3 )
r10315r10316
30873087   state_save_register_postload(machine, coco3_state_postload, NULL);
30883088
30893089   /* need to specify lightgun crosshairs */
3090   timer_set(machine, attotime::zero, NULL, 0, update_lightgun_timer_callback);
3090   machine->scheduler().timer_set(attotime::zero, FUNC(update_lightgun_timer_callback));
30913091}
30923092
30933093
src/mess/machine/tc8521.c
r10315r10316
387387{
388388   tc8521_t *rtc = get_token(device);
389389   memset(rtc, 0, sizeof(*rtc));
390   timer_pulse(device->machine, attotime::from_hz(32), (void *) device, 0, tc8521_timer_callback);
390   device->machine->scheduler().timer_pulse(attotime::from_hz(32), FUNC(tc8521_timer_callback), 0, (void *) device);
391391}
392392
393393
src/mess/machine/mc6854.c
r10315r10316
296296   if ( i >= 0 )
297297      mc6854->tfifo[ i ] = data | 0x100;
298298   else
299      logerror( "%f mc6854_tfifo_push: FIFO overrun\n", timer_get_time(device->machine).as_double() );
299      logerror( "%f mc6854_tfifo_push: FIFO overrun\n", device->machine->time().as_double() );
300300
301301   /* start frame, if needed */
302302   if ( ! mc6854->tstate )
303303   {
304      LOG(( "%f mc6854_tfifo_push: start frame\n", timer_get_time(device->machine).as_double() ));
304      LOG(( "%f mc6854_tfifo_push: start frame\n", device->machine->time().as_double() ));
305305      mc6854->tstate = 2;
306306      mc6854_send_bits( device, FLAG, 8, 0 );
307307   }
r10315r10316
355355      case 2: /* 8-bit address field */
356356         if ( ( data & 1 ) || ( ! AEX ) )
357357            mc6854->tstate = 3;
358         LOG(( "%f mc6854_tfifo_cb: address field $%02X\n", timer_get_time(machine).as_double(), data & 0xff ));
358         LOG(( "%f mc6854_tfifo_cb: address field $%02X\n", machine->time().as_double(), data & 0xff ));
359359         break;
360360
361361      case 3: /* 8-bit control field */
r10315r10316
365365            mc6854->tstate = 5;
366366         else
367367            mc6854->tstate = 6;
368         LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", timer_get_time(machine).as_double(), data & 0xff ));
368         LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", machine->time().as_double(), data & 0xff ));
369369         break;
370370
371371      case 4: /* 8-bit extended control field (optional) */
r10315r10316
373373            mc6854->tstate = 5;
374374         else
375375            mc6854->tstate = 6;
376         LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", timer_get_time(machine).as_double(), data & 0xff ));
376         LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", machine->time().as_double(), data & 0xff ));
377377         break;
378378
379379      case 5: /* 8-bit logical control (optional) */
380380         if ( ! ( data & 0x80 ) )
381381            mc6854->tstate = 6;
382         LOG(( "%f mc6854_tfifo_cb: logical control field $%02X\n", timer_get_time(machine).as_double(), data & 0xff ));
382         LOG(( "%f mc6854_tfifo_cb: logical control field $%02X\n", machine->time().as_double(), data & 0xff ));
383383         break;
384384
385385      case 6: /* variable-length data */
386386         blen = TWL;
387         LOG(( "%f mc6854_tfifo_cb: data field $%02X, %i bits\n", timer_get_time(machine).as_double(), data & 0xff, blen ));
387         LOG(( "%f mc6854_tfifo_cb: data field $%02X, %i bits\n", machine->time().as_double(), data & 0xff, blen ));
388388         break;
389389
390390      default:
391         LOG(( "%f mc6854_tfifo_cb: state=%i\n", timer_get_time(machine).as_double(), mc6854->tstate));
391         LOG(( "%f mc6854_tfifo_cb: state=%i\n", machine->time().as_double(), mc6854->tstate));
392392      }
393393
394394      if ( mc6854->flen < MAX_FRAME_LENGTH )
r10315r10316
401401   else
402402   {
403403      /* data underrun => abort */
404      logerror( "%f mc6854_tfifo_cb: FIFO underrun\n", timer_get_time(machine).as_double() );
404      logerror( "%f mc6854_tfifo_cb: FIFO underrun\n", machine->time().as_double() );
405405      mc6854->sr1 |= TU;
406406      mc6854->tstate = 0;
407407      mc6854_send_bits( device, 0xffff, ABTEX ? 16 : 8, 0 );
r10315r10316
413413   {
414414      int len = mc6854->flen;
415415
416      LOG(( "%f mc6854_tfifo_cb: end frame\n", timer_get_time(machine).as_double() ));
416      LOG(( "%f mc6854_tfifo_cb: end frame\n", machine->time().as_double() ));
417417      mc6854_send_bits( device, 0xdeadbeef, 16, 1 );  /* send check-sum: TODO */
418418      mc6854_send_bits( device, FLAG, 8, 0 );         /* send closing flag */
419419
420420      if ( mc6854->tfifo[ FIFO_SIZE - 1 ] & 0x100 )
421421      {
422422         /* re-open frame asap */
423         LOG(( "%f mc6854_tfifo_cb: start frame\n", timer_get_time(machine).as_double() ));
423         LOG(( "%f mc6854_tfifo_cb: start frame\n", machine->time().as_double() ));
424424         if ( TWOINTER )
425425            mc6854_send_bits( device, FLAG, 8, 0 );
426426      }
r10315r10316
467467         mc6854->rstate = 3;
468468      else
469469         mc6854->rstate = 2;
470      LOG(( "%f mc6854_rfifo_push: address field $%02X\n", timer_get_time(device->machine).as_double(), data ));
470      LOG(( "%f mc6854_rfifo_push: address field $%02X\n", device->machine->time().as_double(), data ));
471471      data |= 0x400; /* address marker */
472472      break;
473473
r10315r10316
478478         mc6854->rstate = 5;
479479      else
480480         mc6854->rstate = 6;
481      LOG(( "%f mc6854_rfifo_push: control field $%02X\n", timer_get_time(device->machine).as_double(), data ));
481      LOG(( "%f mc6854_rfifo_push: control field $%02X\n", device->machine->time().as_double(), data ));
482482      break;
483483
484484   case 4: /* 8-bit extended control field (optional) */
r10315r10316
486486         mc6854->rstate = 5;
487487      else
488488         mc6854->rstate = 6;
489      LOG(( "%f mc6854_rfifo_push: control field $%02X\n", timer_get_time(device->machine).as_double(), data ));
489      LOG(( "%f mc6854_rfifo_push: control field $%02X\n", device->machine->time().as_double(), data ));
490490      break;
491491
492492   case 5: /* 8-bit logical control (optional) */
493493      if ( ! ( data & 0x80 ) )
494494         mc6854->rstate = 6;
495      LOG(( "%f mc6854_rfifo_push: logical control field $%02X\n", timer_get_time(device->machine).as_double(), data ));
495      LOG(( "%f mc6854_rfifo_push: logical control field $%02X\n", device->machine->time().as_double(), data ));
496496      break;
497497
498498   case 6: /* variable-length data */
499499      blen = RWL;
500500      data >>= 8 - blen;
501      LOG(( "%f mc6854_rfifo_push: data field $%02X, %i bits\n", timer_get_time(device->machine).as_double(), data, blen ));
501      LOG(( "%f mc6854_rfifo_push: data field $%02X, %i bits\n", device->machine->time().as_double(), data, blen ));
502502      break;
503503   }
504504
505505   /* no further FIFO fill until FV is cleared! */
506506   if ( mc6854->sr2 & FV )
507507   {
508      LOG(( "%f mc6854_rfifo_push: field not pushed\n", timer_get_time(device->machine).as_double() ));
508      LOG(( "%f mc6854_rfifo_push: field not pushed\n", device->machine->time().as_double() ));
509509      return;
510510   }
511511
r10315r10316
525525      /* FIFO full */
526526      mc6854->sr2 |= OVRN;
527527      mc6854->rfifo[ 0 ] = data;
528      logerror( "%f mc6854_rfifo_push: FIFO overrun\n", timer_get_time(device->machine).as_double() );
528      logerror( "%f mc6854_rfifo_push: FIFO overrun\n", device->machine->time().as_double() );
529529   }
530530
531531   mc6854->rsize -= blen;
r10315r10316
605605         {
606606            /* only in-frame abort */
607607            mc6854->sr2 |= RABT;
608            LOG(( "%f mc6854_receive_bit: abort\n", timer_get_time(device->machine).as_double() ));
608            LOG(( "%f mc6854_receive_bit: abort\n", device->machine->time().as_double() ));
609609         }
610610      }
611611      else
r10315r10316
635635         if ( mc6854->rsize >= fieldlen + 24 ) /* last field */
636636            mc6854_rfifo_push( device, mc6854->rreg );
637637         mc6854_rfifo_terminate( device );
638         LOG(( "%f mc6854_receive_bit: end of frame\n", timer_get_time(device->machine).as_double() ));
638         LOG(( "%f mc6854_receive_bit: end of frame\n", device->machine->time().as_double() ));
639639      }
640640      mc6854->rones = 0;
641641      mc6854->rstate = 1;
r10315r10316
801801   case 0: /* status register 1 */
802802      mc6854_update_sr1( mc6854 );
803803      LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n",
804            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->sr1,
804            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->sr1,
805805            ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0,
806806            ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0,
807807            ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0,
r10315r10316
811811   case 1: /* status register 2 */
812812      mc6854_update_sr2( mc6854 );
813813      LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n",
814            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->sr2,
814            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->sr2,
815815            ( mc6854->sr2 & AP   ) ? 1 : 0, ( mc6854->sr2 & FV  ) ? 1 : 0,
816816            ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0,
817817            ( mc6854->sr2 & ERR  ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0,
r10315r10316
823823   {
824824      UINT8 data = mc6854_rfifo_pop( device );
825825      LOG(( "%f $%04x mc6854_r: get data $%02X\n",
826            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data ));
826            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data ));
827827      return data;
828828   }
829829
r10315r10316
844844   case 0: /* control register 1 */
845845      mc6854->cr1 = data;
846846      LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n",
847            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr1,
847            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr1,
848848            AC ? 1 : 0,
849849            RIE ? 'r' : '-', TIE ? 't' : '-',
850850            DISCONTINUE ? "discontinue," : "",
r10315r10316
881881         /* control register 3 */
882882         mc6854->cr3 = data;
883883         LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n",
884               timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr3,
884               device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr3,
885885               LCF ? (CEX ? 16 : 8) : 0,  AEX ? 1 : 0,
886886               IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0,
887887               TST ? 1 : 0, DTR ? 1 : 0
r10315r10316
900900         /* control register 2 */
901901         mc6854->cr2 = data;
902902         LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n",
903               timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr2,
903               device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr2,
904904               PSE ? 1 : 0,  TWOBYTES ? 2 : 1,  FMIDLE ? 1 : 0,
905905               FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0,
906906               data & 0x20 ? 'r' : '-',  data & 0x40 ? 't' : '-',
r10315r10316
931931      break;
932932
933933   case 2: /* transmitter data: continue data */
934      LOG(( "%f $%04xmc6854_w: push data=$%02X\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data ));
934      LOG(( "%f $%04xmc6854_w: push data=$%02X\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data ));
935935      mc6854_tfifo_push( device, data );
936936      break;
937937
r10315r10316
940940      {
941941         /* control register 4 */
942942         mc6854->cr4 = data;
943         LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr4,
943         LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6854->cr4,
944944               TWOINTER ? 2 : 1,
945945               TWL, RWL,
946946               ABT ? ( ABTEX ? "abort-ext," : "abort,") : "",
r10315r10316
955955      else
956956      {
957957         /* transmitter data: last data */
958         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data ));
958         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data ));
959959         mc6854_tfifo_push( device, data );
960960         mc6854_tfifo_terminate( device );
961961      }
r10315r10316
996996
997997   mc6854->iface = (const mc6854_interface*)device->baseconfig().static_config();
998998
999   mc6854->ttimer = timer_alloc( device->machine, mc6854_tfifo_cb , (void*) device );
999   mc6854->ttimer = device->machine->scheduler().timer_alloc(FUNC(mc6854_tfifo_cb), (void*) device );
10001000
10011001   state_save_register_item( device->machine, "mc6854", device->tag(), 0, mc6854->cr1 );
10021002   state_save_register_item( device->machine, "mc6854", device->tag(), 0, mc6854->cr2 );
src/mess/machine/gb.c
r10315r10316
248248   machine->add_notifier(MACHINE_NOTIFY_EXIT, gb_machine_stop);
249249
250250   /* Allocate the serial timer, and disable it */
251   state->gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
251   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
252252   timer_enable( state->gb_serial_timer, 0 );
253253
254254   MACHINE_START_CALL( gb_video );
r10315r10316
260260   machine->add_notifier(MACHINE_NOTIFY_EXIT, gb_machine_stop);
261261
262262   /* Allocate the serial timer, and disable it */
263   state->gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
263   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
264264   timer_enable( state->gb_serial_timer, 0 );
265265
266266   MACHINE_START_CALL( gbc_video );
r10315r10316
292292   machine->add_notifier(MACHINE_NOTIFY_EXIT, gb_machine_stop);
293293
294294   /* Allocate the serial timer, and disable it */
295   state->gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
295   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
296296   timer_enable( state->gb_serial_timer, 0 );
297297
298298   MACHINE_START_CALL( gb_video );
r10315r10316
20482048{
20492049   gb_state *state = machine->driver_data<gb_state>();
20502050   /* Allocate the serial timer, and disable it */
2051   state->gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
2051   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
20522052   timer_enable( state->gb_serial_timer, 0 );
20532053
20542054   MACHINE_START_CALL( gb_video );
src/mess/machine/gamecom.c
r10315r10316
560560DRIVER_INIT( gamecom )
561561{
562562   gamecom_state *state = machine->driver_data<gamecom_state>();
563   state->clock_timer = timer_alloc(machine,  gamecom_clock_timer_callback , NULL);
563   state->clock_timer = machine->scheduler().timer_alloc(FUNC(gamecom_clock_timer_callback));
564564}
565565
566566DEVICE_IMAGE_LOAD( gamecom_cart1 )
src/mess/machine/radio86.c
r10315r10316
180180MACHINE_RESET( radio86 )
181181{
182182   radio86_state *state = machine->driver_data<radio86_state>();
183   timer_set(machine, attotime::from_usec(10), NULL, 0, radio86_reset);
183   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(radio86_reset));
184184   memory_set_bank(machine, "bank1", 1);
185185
186186   state->keyboard_mask = 0;
src/mess/machine/ti990.c
r10315r10316
8484void ti990_hold_load(running_machine *machine)
8585{
8686   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
87   timer_set(machine, attotime::from_msec(100), NULL, 0, clear_load);
87   machine->scheduler().timer_set(attotime::from_msec(100), FUNC(clear_load));
8888}
8989
9090/*
src/mess/machine/serial.c
r10315r10316
143143   ser->form.word_length = num_data_bits;
144144   ser->form.stop_bit_count = stop_bit_count;
145145   ser->form.parity = parity_code;
146   ser->timer = timer_alloc(device->machine, serial_device_baud_rate_callback, (void *)device);
146   ser->timer = device->machine->scheduler().timer_alloc(FUNC(serial_device_baud_rate_callback), (void *)device);
147147
148148   serial_connection_init(device->machine,&ser->connection);
149149   serial_connection_set_in_callback(device->machine,&ser->connection, serial_device_in_callback);
src/mess/machine/mc6846.c
r10315r10316
117117   if ( mc6846->old_cif != cif )
118118   {
119119      LOG (( "%f: mc6846 interrupt %i (time=%i cp1=%i cp2=%i)\n",
120             timer_get_time(device->machine).as_double(), cif,
120             device->machine->time().as_double(), cif,
121121             mc6846->csr & 1, (mc6846->csr >> 1 ) & 1, (mc6846->csr >> 2 ) & 1 ));
122122      mc6846->old_cif = cif;
123123   }
r10315r10316
143143   int cto = CTO;
144144   if ( cto != mc6846->old_cto )
145145   {
146      LOG (( "%f: mc6846 CTO set to %i\n", timer_get_time(device->machine).as_double(), cto ));
146      LOG (( "%f: mc6846 CTO set to %i\n", device->machine->time().as_double(), cto ));
147147      mc6846->old_cto = cto;
148148   }
149149   if ( mc6846->iface->out_cto_func )
r10315r10316
156156{
157157   mc6846_t* mc6846 = get_safe_token( device );
158158   int delay = FACTOR * (mc6846->preset+1);
159   LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", timer_get_time(device->machine).as_double(), MODE, mc6846->preset, FACTOR ));
159   LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", device->machine->time().as_double(), MODE, mc6846->preset, FACTOR ));
160160
161161   if ( ! (mc6846->tcr & 2) )
162162   {
r10315r10316
204204   mc6846_t* mc6846 = get_safe_token( device );
205205   int delay = FACTOR * (mc6846->latch+1);
206206
207   LOG (( "%f: mc6846 timer expire called, mode=%i, latch=%i (x%i)\n", timer_get_time(device->machine).as_double(), MODE, mc6846->latch, FACTOR ));
207   LOG (( "%f: mc6846 timer expire called, mode=%i, latch=%i (x%i)\n", device->machine->time().as_double(), MODE, mc6846->latch, FACTOR ));
208208
209209   /* latch => counter */
210210   mc6846->preset = mc6846->latch;
r10315r10316
247247{
248248   device_t* device = (device_t*) ptr;
249249   mc6846_t* mc6846 = get_safe_token( device );
250   LOG (( "%f: mc6846 timer one shot called\n", timer_get_time(device->machine).as_double() ));
250   LOG (( "%f: mc6846 timer one shot called\n", device->machine->time().as_double() ));
251251
252252   /* 1 micro second after one-shot launch, we put cto to high */
253253   mc6846->cto = 1;
r10315r10316
267267   case 0:
268268   case 4:
269269      LOG (( "$%04x %f: mc6846 CSR read $%02X intr=%i (timer=%i, cp1=%i, cp2=%i)\n",
270             cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(),
270             cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(),
271271             mc6846->csr, (mc6846->csr >> 7) & 1,
272272             mc6846->csr & 1, (mc6846->csr >> 1) & 1, (mc6846->csr >> 2) & 1 ));
273273      mc6846->csr0_to_be_cleared = mc6846->csr & 1;
r10315r10316
276276      return mc6846->csr;
277277
278278   case 1:
279      LOG (( "$%04x %f: mc6846 PCR read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mc6846->pcr ));
279      LOG (( "$%04x %f: mc6846 PCR read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mc6846->pcr ));
280280      return mc6846->pcr;
281281
282282   case 2:
283      LOG (( "$%04x %f: mc6846 DDR read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mc6846->ddr ));
283      LOG (( "$%04x %f: mc6846 DDR read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mc6846->ddr ));
284284      return mc6846->ddr;
285285
286286   case 3:
287      LOG (( "$%04x %f: mc6846 PORT read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), PORT ));
287      LOG (( "$%04x %f: mc6846 PORT read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), PORT ));
288288      if ( ! (mc6846->pcr & 0x80) )
289289      {
290290         if ( mc6846->csr1_to_be_cleared )
r10315r10316
298298      return PORT;
299299
300300   case 5:
301      LOG (( "$%04x %f: mc6846 TCR read $%02X\n",cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mc6846->tcr ));
301      LOG (( "$%04x %f: mc6846 TCR read $%02X\n",cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mc6846->tcr ));
302302      return mc6846->tcr;
303303
304304   case 6:
305      LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mc6846_counter( device ) >> 8 ));
305      LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mc6846_counter( device ) >> 8 ));
306306      if ( mc6846->csr0_to_be_cleared )
307307      {
308308         mc6846->csr &= ~1;
r10315r10316
312312      return mc6846_counter( device ) >> 8;
313313
314314   case 7:
315      LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mc6846_counter( device ) & 0xff ));
315      LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mc6846_counter( device ) & 0xff ));
316316      if ( mc6846->csr0_to_be_cleared )
317317      {
318318         mc6846->csr &= ~1;
r10315r10316
353353         "latcged,pos-edge", "latcged,pos-edge,intr"
354354      };
355355      LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n",
356             cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), data,
356             cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), data,
357357             (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] ));
358358
359359   }
r10315r10316
381381   break;
382382
383383   case 2:
384      LOG (( "$%04x %f: mc6846 DDR write $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), data ));
384      LOG (( "$%04x %f: mc6846 DDR write $%02X\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), data ));
385385      if ( ! (mc6846->pcr & 0x80) )
386386      {
387387         mc6846->ddr = data;
r10315r10316
391391      break;
392392
393393   case 3:
394      LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), data,mc6846->ddr ));
394      LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), data,mc6846->ddr ));
395395      if ( ! (mc6846->pcr & 0x80) )
396396      {
397397         mc6846->pdr = data;
r10315r10316
400400         if ( mc6846->csr1_to_be_cleared && (mc6846->csr & 2) )
401401         {
402402            mc6846->csr &= ~2;
403            LOG (( "$%04x %f: mc6846 CP1 intr reset\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double() ));
403            LOG (( "$%04x %f: mc6846 CP1 intr reset\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double() ));
404404         }
405405         if ( mc6846->csr2_to_be_cleared && (mc6846->csr & 4) )
406406         {
407407            mc6846->csr &= ~4;
408            LOG (( "$%04x %f: mc6846 CP2 intr reset\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double() ));
408            LOG (( "$%04x %f: mc6846 CP2 intr reset\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double() ));
409409         }
410410         mc6846->csr1_to_be_cleared = 0;
411411         mc6846->csr2_to_be_cleared = 0;
r10315r10316
421421            "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp"
422422         };
423423      LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n",
424             cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), data,
424             cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), data,
425425             (data >> 7) & 1, (data & 0x40) ? "extern" : "sys",
426426             (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ],
427427             (data & 1) ? "enabled" : "0" ));
r10315r10316
455455
456456   case 7:
457457      mc6846->latch = ( ((UINT16) mc6846->time_MSB) << 8 ) + data;
458      LOG (( "$%04x %f: mc6846 COUNT write %i\n", cpu_get_previouspc( device->machine->firstcpu ), timer_get_time(device->machine).as_double(), mc6846->latch  ));
458      LOG (( "$%04x %f: mc6846 COUNT write %i\n", cpu_get_previouspc( device->machine->firstcpu ), device->machine->time().as_double(), mc6846->latch  ));
459459      if (!(mc6846->tcr & 0x38))
460460      {
461461         /* timer initialization */
r10315r10316
488488   if ( data == mc6846->cp1 )
489489      return;
490490   mc6846->cp1 = data;
491   LOG (( "%f: mc6846 input CP1 set to %i\n",  timer_get_time(device->machine).as_double(), data ));
491   LOG (( "%f: mc6846 input CP1 set to %i\n",  device->machine->time().as_double(), data ));
492492   if (( data &&  (mc6846->pcr & 2)) || (!data && !(mc6846->pcr & 2)))
493493   {
494494      mc6846->csr |= 2;
r10315r10316
503503   if ( data == mc6846->cp2 )
504504      return;
505505   mc6846->cp2 = data;
506   LOG (( "%f: mc6846 input CP2 set to %i\n", timer_get_time(device->machine).as_double(), data ));
506   LOG (( "%f: mc6846 input CP2 set to %i\n", device->machine->time().as_double(), data ));
507507   if (mc6846->pcr & 0x20)
508508   {
509509      if (( data &&  (mc6846->pcr & 0x10)) || (!data && !(mc6846->pcr & 0x10)))
r10315r10316
587587   mc6846_t* mc6846 = get_safe_token( device );
588588
589589   mc6846->iface = (const mc6846_interface*)device->baseconfig().static_config();
590   mc6846->interval = timer_alloc( device->machine, mc6846_timer_expire , (void*) device );
591   mc6846->one_shot = timer_alloc( device->machine, mc6846_timer_one_shot , (void*) device );
590   mc6846->interval = device->machine->scheduler().timer_alloc(FUNC(mc6846_timer_expire), (void*) device );
591   mc6846->one_shot = device->machine->scheduler().timer_alloc(FUNC(mc6846_timer_one_shot), (void*) device );
592592
593593   state_save_register_item( device->machine, "mc6846", device->tag(), 0, mc6846->csr );
594594   state_save_register_item( device->machine, "mc6846", device->tag(), 0, mc6846->pcr );
src/mess/machine/cdp1871.c
r10315r10316
174174   change_output_lines();
175175
176176   // allocate timers
177   m_scan_timer = device_timer_alloc(*this);
177   m_scan_timer = timer_alloc();
178178   timer_adjust_periodic(m_scan_timer, attotime::zero, 0, attotime::from_hz(clock()));
179179
180180   // register for state saving
src/mess/machine/thomson.c
r10315r10316
103103         if ( bitpos >= to7_k7_bitsize )
104104            bitpos = to7_k7_bitsize -1;
105105         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n",
106            cpu_get_previouspc(machine->device("maincpu")), timer_get_time(machine).as_double(), state, pos, bitpos,
106            cpu_get_previouspc(machine->device("maincpu")), machine->time().as_double(), state, pos, bitpos,
107107            to7_k7_bits[ bitpos ] ));
108108         return to7_k7_bits[ bitpos ];
109109      }
r10315r10316
124124         }
125125         k = ( chg >= 13 ) ? 1 : 0;
126126         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n",
127            cpu_get_previouspc(machine->device("maincpu")), timer_get_time(machine).as_double(), state, pos, bitpos,
127            cpu_get_previouspc(machine->device("maincpu")), machine->time().as_double(), state, pos, bitpos,
128128            k, chg ));
129129         return k;
130130      }
r10315r10316
152152   double pos = cassette_get_position(img);
153153
154154   LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n",
155          cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(img->machine).as_double(), data ? "off" : "on",
155          cpu_get_previouspc(device->machine->device("maincpu")), img->machine->time().as_double(), data ? "off" : "on",
156156          (int) (pos / TO7_BIT_LENGTH) ));
157157
158158   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
r10315r10316
203203      hbit = hbit >= 0;
204204
205205      VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n",
206         cpu_get_previouspc(machine->device("maincpu")), timer_get_time(machine).as_double(), state, pos,
206         cpu_get_previouspc(machine->device("maincpu")), machine->time().as_double(), state, pos,
207207         (int) (pos / MO5_HBIT_LENGTH), hbit ));
208208      return hbit;
209209   }
r10315r10316
228228   double pos = cassette_get_position(img);
229229
230230   LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n",
231          cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), data ? "off" : "on",
231          cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), data ? "off" : "on",
232232          (int) (pos / MO5_HBIT_LENGTH) ));
233233
234234   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
r10315r10316
268268      thom_irq &= ~(1 << line);
269269
270270   if ( !old && thom_irq )
271      LOG_IRQ(( "%f thom_set_irq: irq line up %i\n", timer_get_time(machine).as_double(), line ));
271      LOG_IRQ(( "%f thom_set_irq: irq line up %i\n", machine->time().as_double(), line ));
272272   if ( old && !thom_irq )
273      LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", timer_get_time(machine).as_double(), line ));
273      LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", machine->time().as_double(), line ));
274274
275275   cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE);
276276}
r10315r10316
287287      thom_firq &= ~(1 << line);
288288
289289   if ( !old && thom_firq )
290      LOG_IRQ(( "%f thom_set_firq: firq line up %i\n", timer_get_time(machine).as_double(), line ));
290      LOG_IRQ(( "%f thom_set_firq: firq line up %i\n", machine->time().as_double(), line ));
291291   if ( old && !thom_firq )
292      LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", timer_get_time(machine).as_double(), line ));
292      LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", machine->time().as_double(), line ));
293293
294294   cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE);
295295}
r10315r10316
644644   if ( ! to7_lightpen )
645645      return;
646646
647   LOG_VIDEO(( "%f to7_lightpen_cb: step=%i\n", timer_get_time(machine).as_double(), step ));
647   LOG_VIDEO(( "%f to7_lightpen_cb: step=%i\n", machine->time().as_double(), step ));
648648   pia6821_cb1_w( sys_pia, 1 );
649649   pia6821_cb1_w( sys_pia, 0 );
650650   to7_lightpen_step = step;
r10315r10316
661661   device_t *sys_pia = machine->device( THOM_PIA_SYS );
662662   /* INIT signal wired to system PIA 6821 */
663663
664   LOG_VIDEO(( "%f to7_set_init: init=%i\n", timer_get_time(machine).as_double(), init ));
664   LOG_VIDEO(( "%f to7_set_init: init=%i\n", machine->time().as_double(), init ));
665665   pia6821_ca1_w( sys_pia, init );
666666}
667667
r10315r10316
787787   device_t *io_pia = device->machine->device( THOM_PIA_IO );
788788
789789   pia6821_cb1_w( io_pia, state);
790   //LOG_IO (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", timer_get_time(machine).as_double(), data, ack ));
790   //LOG_IO (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", machine->time().as_double(), data, ack ));
791791}
792792
793793
r10315r10316
797797   int tx  = data & 1;
798798   int dtr = ( data & 2 ) ? 1 : 0;
799799
800   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), tx, dtr ));
800   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), tx, dtr ));
801801   if ( dtr )
802802      to7_io_line.State |=  SERIAL_STATE_DTR;
803803   else
r10315r10316
821821   else
822822      cts = !centronics_busy_r(printer);
823823
824   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), to7_io_mode(device->machine), cts, dsr, rd ));
824   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), to7_io_mode(device->machine), cts, dsr, rd ));
825825
826826   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
827827}
r10315r10316
832832{
833833   device_t *printer = device->machine->device("centronics");
834834
835   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), data ));
835   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), data ));
836836
837837   /* set 8-bit data */
838838   centronics_data_w(printer, 0, data);
r10315r10316
844844{
845845   device_t *printer = device->machine->device("centronics");
846846
847   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), data ));
847   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), data ));
848848
849849   /* send STROBE to printer */
850850   centronics_strobe_w(printer, data);
r10315r10316
857857   /* our peer's state has changed */
858858   to7_io_line.input_state = state;
859859
860   LOG_IO(( "%f to7_io_in_callback:  cts=%i dsr=%i rd=%i\n", timer_get_time(machine).as_double(), (state & SERIAL_STATE_CTS) ? 1 : 0, (state & SERIAL_STATE_DSR) ? 1 : 0, (int)get_in_data_bit( state ) ));
860   LOG_IO(( "%f to7_io_in_callback:  cts=%i dsr=%i rd=%i\n", machine->time().as_double(), (state & SERIAL_STATE_CTS) ? 1 : 0, (state & SERIAL_STATE_DSR) ? 1 : 0, (int)get_in_data_bit( state ) ));
861861}
862862
863863
r10315r10316
12461246static void to7_game_init ( running_machine *machine )
12471247{
12481248   LOG (( "to7_game_init called\n" ));
1249   to7_game_timer = timer_alloc( machine, to7_game_update_cb , NULL);
1249   to7_game_timer = machine->scheduler().timer_alloc(FUNC(to7_game_update_cb));
12501250   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
12511251   state_save_register_global( machine, to7_game_sound );
12521252   state_save_register_global( machine, to7_game_mute );
r10315r10316
13551355      /* bit 6:     parity error (ignored) */
13561356      /* bit 7:     interrupt */
13571357      LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1358           cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), to7_midi_status,
1358           cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), to7_midi_status,
13591359           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
13601360           (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
13611361           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
r10315r10316
13731373         to7_midi_status &= ~ACIA_6850_OVRN;
13741374      to7_midi_overrun = 0;
13751375      LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n",
1376           cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data ));
1376           cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data ));
13771377      to7_midi_update_irq( space->machine );
13781378      return data;
13791379   }
r10315r10316
14001400      if ( (data & 3) == 3 )
14011401      {
14021402         /* reset */
1403         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data ));
1403         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data ));
14041404         to7_midi_overrun = 0;
14051405         to7_midi_status = 2;
14061406         to7_midi_intr = 0;
r10315r10316
14171417            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
14181418            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
14191419            LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1420                 cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
1420                 cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
14211421                 data,
14221422                 bits[ (data >> 2) & 7 ],
14231423                 stop[ (data >> 2) & 7 ],
r10315r10316
14311431
14321432
14331433   case 1: /* output data */
1434      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data ));
1434      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data ));
14351435      if ( data == 0x55 )
14361436         /* cable-detect: shortcut */
14371437         chardev_fake_in( to7_midi_chardev, 0x55 );
r10315r10316
21992199   to7_io_init(machine);
22002200   to7_modem_init(machine);
22012201   to7_midi_init(machine);
2202   mo5_periodic_timer = timer_alloc( machine, mo5_periodic_cb , NULL);
2202   mo5_periodic_timer = machine->scheduler().timer_alloc(FUNC(mo5_periodic_cb));
22032203
22042204   /* memory */
22052205   thom_cart_bank = 0;
r10315r10316
22392239
22402240WRITE8_HANDLER ( to9_ieee_w )
22412241{
2242   logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data, offset );
2242   logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data, offset );
22432243}
22442244
22452245
22462246
22472247READ8_HANDLER  ( to9_ieee_r )
22482248{
2249   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), offset );
2249   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), offset );
22502250   return 0;
22512251}
22522252
r10315r10316
23722372
23732373WRITE8_HANDLER ( to9_vreg_w )
23742374{
2375   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), offset, 0xe7da + offset, data ));
2375   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), offset, 0xe7da + offset, data ));
23762376
23772377   switch ( offset )
23782378   {
r10315r10316
26702670      /* bit 7:     interrupt */
26712671
26722672      LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
2673           cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), to9_kbd_status,
2673           cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), to9_kbd_status,
26742674           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
26752675           (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0,
26762676           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
r10315r10316
26852685      else
26862686         to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF);
26872687      to9_kbd_overrun = 0;
2688      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), to9_kbd_in ));
2688      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), to9_kbd_in ));
26892689      to9_kbd_update_irq(space->machine);
26902690      return to9_kbd_in;
26912691
r10315r10316
27122712         to9_kbd_overrun = 0;
27132713         to9_kbd_status = ACIA_6850_TDRE;
27142714         to9_kbd_intr = 0;
2715         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data ));
2715         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data ));
27162716      }
27172717      else
27182718      {
r10315r10316
27262726         to9_kbd_intr = data >> 5;
27272727
27282728         LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2729              cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
2729              cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
27302730              data, to9_kbd_parity, to9_kbd_intr >> 2,
27312731              (to9_kbd_intr & 3) ? 1 : 0 ));
27322732      }
r10315r10316
27572757      case 0xFE: to9_kbd_periph = 0; break;
27582758
27592759      default:
2760         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data );
2760         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data );
27612761      }
27622762
27632763      thom_set_caps_led( space->machine, !to9_kbd_caps );
27642764
27652765      LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n",
2766            cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data,
2766            cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data,
27672767            to9_kbd_caps, to9_kbd_pad, to9_kbd_periph ));
27682768
27692769      break;
r10315r10316
27852785   {
27862786      /* overrun will be set when the current valid byte is read */
27872787      to9_kbd_overrun = 1;
2788      LOG_KBD(( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", timer_get_time(machine).as_double(), data, parity ));
2788      LOG_KBD(( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", machine->time().as_double(), data, parity ));
27892789   }
27902790   else
27912791   {
r10315r10316
27962796         to9_kbd_status &= ~ACIA_6850_PE; /* parity OK */
27972797      else
27982798         to9_kbd_status |= ACIA_6850_PE;  /* parity error */
2799      LOG_KBD(( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", timer_get_time(machine).as_double(), data, parity, to9_kbd_status ));
2799      LOG_KBD(( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", machine->time().as_double(), data, parity, to9_kbd_status ));
28002800   }
28012801   to9_kbd_update_irq(machine);
28022802}
r10315r10316
30123012static void to9_kbd_init ( running_machine *machine )
30133013{
30143014   LOG(( "to9_kbd_init called\n" ));
3015   to9_kbd_timer = timer_alloc( machine, to9_kbd_timer_cb , NULL);
3015   to9_kbd_timer = machine->scheduler().timer_alloc(FUNC(to9_kbd_timer_cb));
30163016   state_save_register_global( machine, to9_kbd_parity );
30173017   state_save_register_global( machine, to9_kbd_intr );
30183018   state_save_register_global( machine, to9_kbd_in );
r10315r10316
33573357{
33583358   attotime d;
33593359
3360   LOG_KBD(( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", timer_get_time(machine).as_double(), to8_kbd_step, to8_kbd_ack, to8_kbd_data ));
3360   LOG_KBD(( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", machine->time().as_double(), to8_kbd_step, to8_kbd_ack, to8_kbd_data ));
33613361
33623362   if( ! to8_kbd_step )
33633363   {
r10315r10316
34423442   if ( data )
34433443   {
34443444      double len = timer_timeelapsed( to8_kbd_signal).as_double() * 1000. - 2.;
3445      LOG_KBD(( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", timer_get_time(machine).as_double(), len ));
3445      LOG_KBD(( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", machine->time().as_double(), len ));
34463446      if ( to8_kbd_data == 0xfff )
34473447      {
34483448         /* end signal from CPU */
34493449         if ( len >= 0.6 && len <= 0.8 )
34503450         {
3451            LOG (( "%f to8_kbd_set_ack: INIT signal\n", timer_get_time(machine).as_double() ));
3451            LOG (( "%f to8_kbd_set_ack: INIT signal\n", machine->time().as_double() ));
34523452            to8_kbd_last_key = 0xff;
34533453            to8_kbd_key_count = 0;
34543454            to8_kbd_caps = 1;
r10315r10316
34633463            timer_adjust_oneshot(to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0);
34643464            if ( len >= 1.2 && len <= 1.4 )
34653465            {
3466               LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", timer_get_time(machine).as_double() ));
3466               LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", machine->time().as_double() ));
34673467               to8_kbd_caps = 1;
34683468            }
34693469            else if ( len >= 1.8 && len <= 2.0 )
34703470            {
3471               LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", timer_get_time(machine).as_double() ));
3471               LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", machine->time().as_double() ));
34723472               to8_kbd_caps = 0;
34733473            }
34743474         }
r10315r10316
34983498         timer_adjust_oneshot(to8_kbd_timer, attotime::from_usec( 400 ), 0);
34993499         timer_adjust_oneshot(to8_kbd_signal, attotime::never, 0);
35003500      }
3501      LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", timer_get_time(machine).as_double(), to8_kbd_data ));
3501      LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", machine->time().as_double(), to8_kbd_data ));
35023502   }
35033503}
35043504
r10315r10316
35203520
35213521static void to8_kbd_init ( running_machine *machine )
35223522{
3523   to8_kbd_timer = timer_alloc( machine, to8_kbd_timer_cb , NULL);
3524   to8_kbd_signal = timer_alloc( machine, NULL , NULL);
3523   to8_kbd_timer = machine->scheduler().timer_alloc(FUNC(to8_kbd_timer_cb));
3524   to8_kbd_signal = machine->scheduler().timer_alloc(FUNC(NULL));
35253525   state_save_register_global( machine, to8_kbd_ack );
35263526   state_save_register_global( machine, to8_kbd_data );
35273527   state_save_register_global( machine, to8_kbd_step );
r10315r10316
38393839   }
38403840
38413841   LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
3842        cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
3842        cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
38433843        offset, 0xe7e4 + offset, res, to7_lightpen ));
38443844
38453845   return res;
r10315r10316
38503850WRITE8_HANDLER ( to8_gatearray_w )
38513851{
38523852   LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
3853        cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
3853        cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
38543854        offset, 0xe7e4 + offset, data ));
38553855
38563856   switch ( offset )
r10315r10316
39313931WRITE8_HANDLER ( to8_vreg_w )
39323932{
39333933   LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
3934        cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
3934        cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
39353935        offset, 0xe7da + offset, data ));
39363936
39373937   switch ( offset )
r10315r10316
39873987{
39883988   int ktest = to8_kbd_ktest (device->machine);
39893989
3990   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), ktest ));
3990   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), ktest ));
39913991
39923992   return ktest;
39933993}
r10315r10316
45544554{
45554555   device_t *printer = device->machine->device("centronics");
45564556
4557   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), data ));
4557   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), data ));
45584558
45594559   /* centronics data */
45604560   centronics_data_w(printer, 0, data);
r10315r10316
45664566{
45674567   device_t *printer = device->machine->device("centronics");
45684568
4569   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), timer_get_time(device->machine).as_double(), data ));
4569   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(device->machine->device("maincpu")), device->machine->time().as_double(), data ));
45704570
45714571   /* centronics strobe */
45724572   centronics_strobe_w(printer, data);
r10315r10316
46174617static void mo6_game_init ( running_machine *machine )
46184618{
46194619   LOG (( "mo6_game_init called\n" ));
4620   to7_game_timer = timer_alloc( machine, mo6_game_update_cb , NULL);
4620   to7_game_timer = machine->scheduler().timer_alloc(FUNC(mo6_game_update_cb));
46214621   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
46224622   state_save_register_global( machine, to7_game_sound );
46234623   state_save_register_global( machine, to7_game_mute );
r10315r10316
47744774   }
47754775
47764776   LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
4777        cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
4777        cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
47784778        offset, 0xa7e4 + offset, res, to7_lightpen ));
47794779
47804780   return res;
r10315r10316
47854785WRITE8_HANDLER ( mo6_gatearray_w )
47864786{
47874787   LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
4788        cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
4788        cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
47894789        offset, 0xa7e4 + offset, data ));
47904790
47914791   switch ( offset )
r10315r10316
48524852WRITE8_HANDLER ( mo6_vreg_w )
48534853{
48544854   LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
4855        cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(),
4855        cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(),
48564856        offset, 0xa7da + offset, data ));
48574857
48584858   switch ( offset )
r10315r10316
49494949   to9_palette_init(machine);
49504950   to7_modem_init(machine);
49514951   to7_midi_init(machine);
4952   mo5_periodic_timer = timer_alloc( machine, mo5_periodic_cb , NULL);
4952   mo5_periodic_timer = machine->scheduler().timer_alloc(FUNC(mo5_periodic_cb));
49534953
49544954   /* memory */
49554955   thom_cart_bank = 0;
r10315r10316
50065006   if ( to7_controller_type )
50075007      return to7_floppy_r ( space, offset );
50085008
5009   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), offset );
5009   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), offset );
50105010
50115011   return 0;
50125012}
r10315r10316
50195019      to7_floppy_w ( space, offset, data );
50205020   else
50215021      logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n",
5022           cpu_get_previouspc(space->machine->device("maincpu")), timer_get_time(space->machine).as_double(), data, offset );
5022           cpu_get_previouspc(space->machine->device("maincpu")), space->machine->time().as_double(), data, offset );
50235023}
50245024
50255025
r10315r10316
51305130static void mo5nr_game_init ( running_machine* machine )
51315131{
51325132   LOG (( "mo5nr_game_init called\n" ));
5133   to7_game_timer = timer_alloc( machine, mo6_game_update_cb , NULL);
5133   to7_game_timer = machine->scheduler().timer_alloc(FUNC(mo6_game_update_cb));
51345134   timer_adjust_periodic( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
51355135   state_save_register_global( machine, to7_game_sound );
51365136   state_save_register_global( machine, to7_game_mute );
r10315r10316
52095209   to9_palette_init(machine);
52105210   to7_modem_init(machine);
52115211   to7_midi_init(machine);
5212   mo5_periodic_timer = timer_alloc( machine, mo5_periodic_cb , NULL);
5212   mo5_periodic_timer = machine->scheduler().timer_alloc(FUNC(mo5_periodic_cb));
52135213
52145214   /* memory */
52155215   thom_cart_bank = 0;
src/mess/machine/8530scc.c
r10315r10316
225225   memset(scc, 0, sizeof(*scc));
226226   scc->clock = device->clock();
227227
228   scc->channel[0].baudtimer = timer_alloc(device->machine, scc8530_baud_expire, (void *)device);
229   scc->channel[1].baudtimer = timer_alloc(device->machine, scc8530_baud_expire, (void *)device);
228   scc->channel[0].baudtimer = device->machine->scheduler().timer_alloc(FUNC(scc8530_baud_expire), (void *)device);
229   scc->channel[1].baudtimer = device->machine->scheduler().timer_alloc(FUNC(scc8530_baud_expire), (void *)device);
230230}
231231
232232
src/mess/machine/pmd85.c
r10315r10316
866866DIRECT_UPDATE_HANDLER(pmd85_opbaseoverride)
867867{
868868   if (input_port_read(machine, "RESET") & 0x01)
869      timer_set(machine, attotime::from_usec(10), NULL, 0, pmd_reset);
869      machine->scheduler().timer_set(attotime::from_usec(10), FUNC(pmd_reset));
870870   return address;
871871}
872872
r10315r10316
875875   pmd85_state *state = machine->driver_data<pmd85_state>();
876876   state->previous_level = 0;
877877   state->clk_level = state->clk_level_tape = 1;
878   state->cassette_timer = timer_alloc(machine, pmd85_cassette_timer_callback, NULL);
878   state->cassette_timer = machine->scheduler().timer_alloc(FUNC(pmd85_cassette_timer_callback));
879879   timer_adjust_periodic(state->cassette_timer, attotime::zero, 0, attotime::from_hz(2400));
880880
881881   serial_connection_init(machine, &state->cassette_serial_connection);
r10315r10316
968968   state->startup_mem_map = 1;
969969   state->update_memory(machine);
970970
971   timer_set(machine, attotime::zero, NULL, 0, setup_machine_state);
971   machine->scheduler().timer_set(attotime::zero, FUNC(setup_machine_state));
972972
973973   cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(pmd85_opbaseoverride, *machine));
974974}
src/mess/machine/kay_kbd.c
r10315r10316
510510      if (length)
511511      {
512512         kbd->control_status &= 0xfb;
513         timer_set(machine, attotime::from_msec(length), NULL, 0, kay_kbd_beepoff);
513         machine->scheduler().timer_set(attotime::from_msec(length), FUNC(kay_kbd_beepoff));
514514         beep_set_state(kbd->beeper, 1);
515515      }
516516   }
src/mess/machine/at29040a.c
r10315r10316
399399static DEVICE_START( at29c040a )
400400{
401401   at29c040a_state *feeprom = get_safe_token(device);
402   feeprom->programming_timer = timer_alloc(device->machine, at29c040a_programming_timer_callback, (void *)device);
402   feeprom->programming_timer = device->machine->scheduler().timer_alloc(FUNC(at29c040a_programming_timer_callback), (void *)device);
403403}
404404
405405static DEVICE_STOP( at29c040a )
src/mess/machine/mb89352.c
r10315r10316
165165    }
166166
167167    // allocate read timer
168    m_transfer_timer = device_timer_alloc(*this,TIMER_TRANSFER);
168    m_transfer_timer = timer_alloc(TIMER_TRANSFER);
169169}
170170
171171void mb89352_device::device_reset()
src/mess/machine/scsibus.c
r10315r10316
915915    bus->phase=SCSI_PHASE_BUS_FREE;
916916
917917    // Setup req/ack/sel timers
918    bus->req_timer=timer_alloc(device->machine, req_timer_callback, (void *)device);
919    bus->ack_timer=timer_alloc(device->machine, ack_timer_callback, (void *)device);
920   bus->sel_timer=timer_alloc(device->machine, sel_timer_callback, (void *)device);
921   bus->dataout_timer=timer_alloc(device->machine, dataout_timer_callback, (void *)device);
918    bus->req_timer=device->machine->scheduler().timer_alloc(FUNC(req_timer_callback), (void *)device);
919    bus->ack_timer=device->machine->scheduler().timer_alloc(FUNC(ack_timer_callback), (void *)device);
920   bus->sel_timer=device->machine->scheduler().timer_alloc(FUNC(sel_timer_callback), (void *)device);
921   bus->dataout_timer=device->machine->scheduler().timer_alloc(FUNC(dataout_timer_callback), (void *)device);
922922   
923923}
924924
src/mess/machine/tx0.c
r10315r10316
5555MACHINE_START( tx0 )
5656{
5757   tx0_state *state = machine->driver_data<tx0_state>();
58   state->tape_reader.timer = timer_alloc(machine, reader_callback, NULL);
59   state->tape_puncher.timer = timer_alloc(machine, puncher_callback, NULL);
60   state->typewriter.prt_timer = timer_alloc(machine, prt_callback, NULL);
61   state->dis_timer = timer_alloc(machine, dis_callback, NULL);
58   state->tape_reader.timer = machine->scheduler().timer_alloc(FUNC(reader_callback));
59   state->tape_puncher.timer = machine->scheduler().timer_alloc(FUNC(puncher_callback));
60   state->typewriter.prt_timer = machine->scheduler().timer_alloc(FUNC(prt_callback));
61   state->dis_timer = machine->scheduler().timer_alloc(FUNC(dis_callback));
6262
6363   machine->add_notifier(MACHINE_NOTIFY_EXIT, tx0_machine_stop);
6464}
src/mess/machine/c128.c
r10315r10316
6060      if(VERBOSE_LEVEL >= N) \
6161      { \
6262         if( M ) \
63            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
63            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
6464         logerror A; \
6565      } \
6666   } while (0)
r10315r10316
11801180      gfx[i] = i;
11811181
11821182   if (state->tape_on)
1183      state->datasette_timer = timer_alloc(machine, c64_tape_timer, NULL);
1183      state->datasette_timer = machine->scheduler().timer_alloc(FUNC(c64_tape_timer));
11841184}
11851185
11861186DRIVER_INIT( c128 )
src/mess/machine/ay3600.c
r10315r10316
322322
323323   /* We poll the keyboard periodically to scan the keys.  This is
324324    actually consistent with how the AY-3600 keyboard controller works. */
325   timer_pulse(machine, attotime::from_hz(60), NULL, 0, AY3600_poll);
325   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(AY3600_poll));
326326
327327   /* Set Caps Lock light to ON, since that's how we default it. */
328328   set_led_status(machine,1,1);
src/mess/machine/tms9901.c
r10315r10316
589589
590590   tms->intf = (const tms9901_interface*)device->baseconfig().static_config();
591591
592   tms->timer = timer_alloc(device->machine, decrementer_callback, (void *) device);
592   tms->timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_callback), (void *) device);
593593
594594   tms->supported_int_mask = tms->intf->supported_int_mask;
595595
src/mess/machine/c2040.c
r10315r10316
15451545   c2040->gcr = region->base() + region->bytes() - 0x800;
15461546
15471547   /* allocate data timer */
1548   c2040->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
1548   c2040->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_tick), (void *)device);
15491549
15501550   /* register for state saving */
15511551   state_save_register_device_item(device, 0, c2040->drive);
src/mess/machine/pet.c
r10315r10316
2424      if(VERBOSE_LEVEL >= N) \
2525      { \
2626         if( M ) \
27            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
27            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
2828         logerror A; \
2929      } \
3030   } while (0)
r10315r10316
716716   }
717717
718718   /* pet clock */
719   timer_pulse(machine, attotime::from_msec(10), NULL, 0, pet_interrupt);
719   machine->scheduler().timer_pulse(attotime::from_msec(10), FUNC(pet_interrupt));
720720
721721   /* datasette */
722   state->datasette1_timer = timer_alloc(machine, pet_tape1_timer, NULL);
723   state->datasette2_timer = timer_alloc(machine, pet_tape2_timer, NULL);
722   state->datasette1_timer = machine->scheduler().timer_alloc(FUNC(pet_tape1_timer));
723   state->datasette2_timer = machine->scheduler().timer_alloc(FUNC(pet_tape2_timer));
724724}
725725
726726
src/mess/machine/thomflop.c
r10315r10316
280280   else if ( offset == 8 )
281281      return to7_5p14_select;
282282   else
283      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
283      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
284284   return 0;
285285}
286286
r10315r10316
304304      case 4: drive = 2; side = 0; break;
305305      case 5: drive = 3; side = 1; break;
306306      default:
307         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data );
307         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data );
308308      }
309309
310310      wd17xx_dden_w(fdc, BIT(data, 7));
r10315r10316
317317         wd17xx_set_drive( fdc, drive );
318318         wd17xx_set_side( fdc, side );
319319         LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n",
320               timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")),
320               space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")),
321321               data, drive, side, (BIT(data, 7) ? "FM" : "MFM")));
322322      }
323323   }
324324   else
325325      logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
326            timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
326            space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
327327}
328328
329329
r10315r10316
366366   else if ( offset >= 8 && offset <= 9 )
367367      return to7_5p14sd_select;
368368   else
369      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
369      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
370370   return 0;
371371}
372372
r10315r10316
410410         mc6843_set_drive( space->machine->device("mc6843"), drive );
411411         mc6843_set_side( space->machine->device("mc6843"), side );
412412         LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n",
413               timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data, drive, side ));
413               space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data, drive, side ));
414414      }
415415   }
416416   else
417417      logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n",
418            timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
418            space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
419419}
420420
421421static void to7_5p14_index_pulse_callback( device_t *controller,device_t *image, int state )
r10315r10316
531531      to7qdd->data_size = 0;
532532   }
533533
534   VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", timer_get_time(image->machine).as_double(), state ));
534   VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", image->machine->time().as_double(), state ));
535535}
536536
537537
r10315r10316
593593      data = to7qdd->data[ to7qdd->data_idx ];
594594
595595   VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n",
596          timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")),
596          machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")),
597597          to7qdd->data_idx, to7qdd->data_size, data ));
598598
599599   to7qdd->data_idx++;
r10315r10316
634634      to7qdd->data_idx++;
635635
636636      VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n",
637         timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), data,
637         machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), data,
638638         to7qdd->start_idx, to7qdd->data_idx ));
639639
640640      /* end of tentative id field */
r10315r10316
648648         UINT8 filler = 0xff;
649649
650650         LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
651               timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
651               machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
652652
653653         floppy_drive_format_sector( to7_qdd_image(machine),
654654                      0, sector, 0, 0, sector, 128, filler );
r10315r10316
678678            int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ];
679679
680680            LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
681                  timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
681                  machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
682682
683683            floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
684684                                thom_floppy_active( machine, 1 );
r10315r10316
701701   case 0: /* MC6852 status */
702702      to7_qdd_stat_update(space->machine);
703703      VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n",
704             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), to7qdd->status,
704             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), to7qdd->status,
705705             to7qdd->status & QDD_S_IRQ  ? 1 : 0,
706706             to7qdd->status & QDD_S_PE   ? 1 : 0,
707707             to7qdd->status & QDD_S_OVR  ? 1 : 0,
r10315r10316
724724         data |= 0x40; /* disk present */
725725      if ( to7qdd->index_pulse )
726726         data |= 0x80; /* disk start */
727      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
727      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
728728      return data;
729729   }
730730
731731   default:
732      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
732      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
733733      return 0;
734734   }
735735}
r10315r10316
751751      to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data &  (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 );
752752      to7_qdd_stat_update(space->machine);
753753      VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n",
754             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
754             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
755755             data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-',
756756             data & QDD_C1_STRIPSYNC ? "strip-sync " : "",
757757             data & QDD_C1_CLRSYNC ? "clear-sync " : "",
r10315r10316
775775         parity = par[ (data >> 3) & 7 ];
776776         to7_qdd_stat_update(space->machine);
777777         VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n",
778                timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
778                space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
779779                bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2,
780780                data & QDD_C2_TSYNC ? "sync" : "ff",
781781                data & QDD_C2_EIE ? "irq-err" : "" ));
r10315r10316
793793            to7qdd->status &= ~QDD_S_NCTS;
794794         to7_qdd_stat_update(space->machine);
795795         VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n",
796                timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
796                space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
797797                data & QDD_C3_CLRTUF ? "clr-tuf " : "",
798798                data & QDD_C3_CLRCTS ? "clr-cts " : "",
799799                data & QDD_C3_SYNCLEN ? 1 : 2,
r10315r10316
805805         break;
806806
807807      case 3: /* MC6852 data out => does not seem to be used */
808         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
808         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
809809         break;
810810
811811      }
r10315r10316
813813
814814   case 8: /* set drive */
815815      to7qdd->drive = data;
816      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
816      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
817817      break;
818818
819819   case 12: /* motor pulse ? */
820820      thom_floppy_active( space->machine, 0 );
821      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
821      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
822822      break;
823823
824824   default:
825      logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
825      logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
826826   }
827827}
828828
r10315r10316
978978         thmfc1->data_raw_idx = 0;
979979   }
980980
981   VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", timer_get_time(image->machine).as_double(), state ));
981   VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", image->machine->time().as_double(), state ));
982982}
983983
984984
r10315r10316
10231023static void thmfc_floppy_cmd_complete( running_machine *machine )
10241024{
10251025   LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n",
1026          timer_get_time(machine).as_double(), thmfc1->op, thmfc1->data_idx,
1026          machine->time().as_double(), thmfc1->op, thmfc1->data_idx,
10271027          thmfc1->data_finish - 1, thmfc1->data_size - 1 ));
10281028
10291029   if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
r10315r10316
10541054   UINT8 data = thmfc1->data[ thmfc1->data_idx ];
10551055
10561056   VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n",
1057          timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")),
1057          machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")),
10581058          thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1,
10591059          data ));
10601060
r10315r10316
10971097      data = thmfc1->data[ thmfc1->data_raw_idx ];
10981098
10991099   VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n",
1100          timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")),
1100          machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")),
11011101          thmfc1->data_raw_idx, thmfc1->data_raw_size, data ));
11021102
11031103   thmfc1->data_raw_idx++;
r10315r10316
11351135      }
11361136
11371137      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n",
1138         timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), data,
1138         machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), data,
11391139         thmfc1->data_idx,thmfc1->data_raw_idx ));
11401140
11411141      if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 &&
r10315r10316
11471147         int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ];
11481148         UINT8 filler = 0xff;
11491149
1150         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
1150         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
11511151
11521152         floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler );
11531153                        thom_floppy_active( machine, 1 );
r10315r10316
11771177               (int) thmfc1->data[ i + 2 ];
11781178
11791179            LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
1180                  timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
1180                  machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), sector ));
11811181
11821182            floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 );
11831183                                thom_floppy_active( machine, 1 );
r10315r10316
11921192   else
11931193   {
11941194      thmfc1->data_raw_idx++;
1195      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), data ));
1195      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), data ));
11961196   }
11971197
11981198}
r10315r10316
12031203static void thmfc_floppy_write_byte ( running_machine *machine, UINT8 data )
12041204{
12051205   VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n",
1206      timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")),
1206      machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")),
12071207      thmfc1->data_idx, thmfc1->data_size - 1, data ));
12081208
12091209   thmfc1->data_raw_size = 0;
r10315r10316
12171217/* intelligent formatting */
12181218static void thmfc_floppy_format_byte ( running_machine *machine, UINT8 data )
12191219{
1220   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", timer_get_time(machine).as_double(), cpu_get_previouspc(machine->device("maincpu")), data ));
1220   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine->time().as_double(), cpu_get_previouspc(machine->device("maincpu")), data ));
12211221
12221222   thmfc1->data_raw_size = 0;
12231223
r10315r10316
12621262
12631263   case 0: /* STAT0 */
12641264      thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL;
1265      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), thmfc1->stat0 ));
1265      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), thmfc1->stat0 ));
12661266      return thmfc1->stat0;
12671267
12681268   case 1: /* STAT1 */
r10315r10316
12941294         data |= 0x10;
12951295      if (!floppy_wpt_r(&img->device()))
12961296         data |= 0x04;
1297      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
1297      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
12981298      return data;
12991299   }
13001300
r10315r10316
13121312   {
13131313      /* undocumented => emulate TO7 QDD controller ? */
13141314      UINT8 data = thmfc1->ipl << 7;
1315      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
1315      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
13161316      return data;
13171317   }
13181318
13191319   default:
1320      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
1320      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
13211321      return 0;
13221322   }
13231323}
r10315r10316
13351335      chrn_id id;
13361336      thmfc1->formatting = (data >> 2) & 1;
13371337      LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
1338             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
1338             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
13391339             (BIT(data, 5) ? "FM" : "MFM"),
13401340             wsync, (data >> 3) & 1,
13411341             thmfc1->formatting, data & 3 ));
r10315r10316
14261426      }
14271427
14281428      LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n",
1429             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
1429             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
14301430             thmfc1->sector_size, (data >> 1) & 7, thmfc1->side ));
14311431      break;
14321432
r10315r10316
14551455      thom_floppy_active( space->machine, 0 );
14561456
14571457      LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n",
1458             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
1458             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
14591459             thmfc1->drive, seek, motor ));
14601460
14611461      if ( seek )
r10315r10316
14861486      {
14871487         /* TODO: implement other forms of raw track writing */
14881488         LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n",
1489                timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
1489                space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
14901490      }
14911491      break;
14921492
r10315r10316
14941494   case 4: /* WCLK (unemulated) */
14951495      /* clock configuration: FF for data, 0A for synchro */
14961496      LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n",
1497             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
1497             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
14981498             (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" ));
14991499      break;
15001500
15011501   case 5: /* WSECT */
15021502      thmfc1->sector = data;
15031503      LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n",
1504             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
1504             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
15051505      break;
15061506
15071507   case 6: /* WTRCK */
15081508      thmfc1->track = data;
15091509      LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
1510             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
1510             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data,
15111511             floppy_drive_get_current_track( thmfc_floppy_image(space->machine) ) ));
15121512      break;
15131513
15141514   case 7: /* WCELL */
15151515      /* precompensation (unemulated) */
15161516      LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n",
1517             timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
1517             space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), data ));
15181518      break;
15191519
15201520   default:
15211521      logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n",
1522            timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
1522            space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
15231523   }
15241524}
15251525
r10315r10316
15651565
15661566   thmfc1 = auto_alloc(machine, struct _thmfc1);
15671567
1568   thmfc_floppy_cmd = timer_alloc( machine, thmfc_floppy_cmd_complete_cb, NULL );
1568   thmfc_floppy_cmd = machine->scheduler().timer_alloc(FUNC(thmfc_floppy_cmd_complete_cb));
15691569
15701570   state_save_register_global( machine, thmfc1->op );
15711571   state_save_register_global( machine, thmfc1->sector );
r10315r10316
16041604
16051605static TIMER_CALLBACK( ans4 )
16061606{
1607   LOG(( "%f ans4\n", timer_get_time(machine).as_double() ));
1607   LOG(( "%f ans4\n", machine->time().as_double() ));
16081608   mc6854_set_cts( machine->device("mc6854"), 0 );
16091609}
16101610
16111611static TIMER_CALLBACK( ans3 )
16121612{
1613   LOG(( "%f ans3\n", timer_get_time(machine).as_double() ));
1613   LOG(( "%f ans3\n", machine->time().as_double() ));
16141614   mc6854_set_cts( machine->device("mc6854"), 1 );
1615   timer_set( machine, attotime::from_usec( 100 ), NULL, 0, ans4 );
1615   machine->scheduler().timer_set( attotime::from_usec( 100 ), FUNC(ans4));
16161616}
16171617
16181618static TIMER_CALLBACK( ans2 )
16191619{
1620   LOG(( "%f ans2\n", timer_get_time(machine).as_double() ));
1620   LOG(( "%f ans2\n", machine->time().as_double() ));
16211621   mc6854_set_cts( machine->device("mc6854"), 0 );
1622   timer_set( machine, attotime::from_usec( 100 ), NULL, 0, ans3 );
1622   machine->scheduler().timer_set( attotime::from_usec( 100 ), FUNC(ans3));
16231623}
16241624
16251625static TIMER_CALLBACK( ans )
16261626{
1627   LOG(( "%f ans\n", timer_get_time(machine).as_double() ));
1627   LOG(( "%f ans\n", machine->time().as_double() ));
16281628   mc6854_set_cts( machine->device("mc6854"), 1 );
1629   timer_set( machine, attotime::from_usec( 100 ), NULL, 0, ans2 );
1629   machine->scheduler().timer_set( attotime::from_usec( 100 ), FUNC(ans2));
16301630}
16311631/* consigne DKBOOT
16321632
r10315r10316
16601660static void to7_network_got_frame( device_t *device, UINT8* data, int length )
16611661{
16621662   int i;
1663   LOG(( "%f to7_network_got_frame:", timer_get_time(device->machine).as_double() ));
1663   LOG(( "%f to7_network_got_frame:", device->machine->time().as_double() ));
16641664   for ( i = 0; i < length; i++ )
16651665      LOG(( " $%02X", data[i] ));
16661666   LOG(( "\n" ));
r10315r10316
16681668   if ( data[1] == 0xff )
16691669   {
16701670      LOG(( "to7_network_got_frame: %i phones %i\n", data[2], data[0] ));
1671      timer_set( device->machine, attotime::from_usec( 100 ), NULL, 0, ans  );
1671      device->machine->scheduler().timer_set( attotime::from_usec( 100 ), FUNC(ans));
16721672      mc6854_set_cts( device, 0 );
16731673   }
16741674   else if ( ! data[1] )
r10315r10316
17201720   {
17211721      /* network ID of the computer */
17221722      UINT8 id = input_port_read(space->machine, "fconfig") >> 3;
1723      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), id ));
1723      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), id ));
17241724      return id;
17251725   }
17261726
1727   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
1727   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset );
17281728   return 0;
17291729}
17301730
r10315r10316
17371737   else
17381738   {
17391739      logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n",
1740           timer_get_time(space->machine).as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
1740           space->machine->time().as_double(), cpu_get_previouspc(space->machine->device("maincpu")), offset, data );
17411741   }
17421742}
17431743
src/mess/machine/upd71071.c
r10315r10316
245245   dmac->intf = (const upd71071_intf*)device->baseconfig().static_config();
246246   for(x=0;x<4;x++)
247247   {
248      dmac->timer[x] = timer_alloc(device->machine,dma_transfer_timer,(void*)device);
248      dmac->timer[x] = device->machine->scheduler().timer_alloc(FUNC(dma_transfer_timer), (void*)device);
249249   }
250250   dmac->selected_channel = 0;
251251}
src/mess/machine/c16.c
r10315r10316
2525      if(VERBOSE_LEVEL >= N) \
2626      { \
2727         if( M ) \
28            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
28            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
2929         logerror A; \
3030      } \
3131   } while (0)
r10315r10316
598598   if (state->sidcard)
599599   {
600600      /* if we are emulating the SID card, check which memory area should be accessed */
601      timer_set(device->machine, attotime::zero, NULL, 0, c16_sidcard_tick);
601      device->machine->scheduler().timer_set(attotime::zero, FUNC(c16_sidcard_tick));
602602#if 0
603603      /* if we are emulating the SID card, check if writes to 0xd400 have been enabled */
604      timer_set(device->machine, attotime::zero, NULL, 0, c16_sidhack_tick);
604      device->machine->scheduler().timer_set(attotime::zero, FUNC(c16_sidhack_tick));
605605#endif
606606   }
607607
src/mess/machine/oric.c
r10315r10316
10811081   state->irqs = 0;
10821082   state->ram_0x0c000 = NULL;
10831083
1084    timer_pulse(machine, attotime::from_hz(4800), NULL, 0, oric_refresh_tape);
1084    machine->scheduler().timer_pulse(attotime::from_hz(4800), FUNC(oric_refresh_tape));
10851085}
10861086
10871087MACHINE_START( oric )
src/mess/machine/europc.c
r10315r10316
293293   memset(&europc_rtc,0,sizeof(europc_rtc));
294294   europc_rtc.data[0xf]=1;
295295
296   europc_rtc.timer = timer_alloc(machine, europc_rtc_timer, NULL);
296   europc_rtc.timer = machine->scheduler().timer_alloc(FUNC(europc_rtc_timer));
297297   timer_adjust_periodic(europc_rtc.timer, attotime::zero, 0, attotime(1, 0));
298298}
299299
src/mess/machine/vector06.c
r10315r10316
175175
176176MACHINE_START( vector06 )
177177{
178   timer_pulse(machine, attotime::from_hz(50), NULL, 0, reset_check_callback);
178   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(reset_check_callback));
179179}
180180
181181MACHINE_RESET( vector06 )
src/mess/machine/electron.c
r10315r10316
349349
350350   state->ula.interrupt_status = 0x82;
351351   state->ula.interrupt_control = 0x00;
352   timer_set(machine, attotime::zero, NULL, 0, setup_beep );
353   state->tape_timer = timer_alloc(machine,  electron_tape_timer_handler, NULL );
352   machine->scheduler().timer_set(attotime::zero, FUNC(setup_beep));
353   state->tape_timer = machine->scheduler().timer_alloc(FUNC(electron_tape_timer_handler));
354354   machine->add_notifier(MACHINE_NOTIFY_RESET, electron_reset);
355355}
356356
src/mess/machine/irisha.c
r10315r10316
3434
3535MACHINE_START( irisha )
3636{
37   timer_pulse(machine, attotime::from_msec(30), NULL, 0, irisha_key);
37   machine->scheduler().timer_pulse(attotime::from_msec(30), FUNC(irisha_key));
3838}
3939
4040MACHINE_RESET( irisha )
src/mess/machine/pc_hdc.c
r10315r10316
210210      error[i] = 0;
211211      dip[i] = 0xff;
212212      pc_hdc_dma8237 = NULL;
213      timer[i] = timer_alloc(machine, pc_hdc_command, NULL);
213      timer[i] = machine->scheduler().timer_alloc(FUNC(pc_hdc_command));
214214      if (!timer[i])
215215         return -1;
216216   }
src/mess/machine/fm_scsi.c
r10315r10316
8787    }
8888
8989    // allocate read timer
90    m_transfer_timer = device_timer_alloc(*this,TIMER_TRANSFER);
91    m_phase_timer = device_timer_alloc(*this,TIMER_PHASE);
90    m_transfer_timer = timer_alloc(TIMER_TRANSFER);
91    m_phase_timer = timer_alloc(TIMER_PHASE);
9292}
9393
9494void fmscsi_device::device_reset()
src/mess/machine/sorcerer.c
r10315r10316
406406MACHINE_START( sorcerer )
407407{
408408   sorcerer_state *state = machine->driver_data<sorcerer_state>();
409   state->m_cassette_timer = timer_alloc(machine, sorcerer_cassette_tc, NULL);
409   state->m_cassette_timer = machine->scheduler().timer_alloc(FUNC(sorcerer_cassette_tc));
410410#if SORCERER_USING_RS232
411   state->m_serial_timer = timer_alloc(machine, sorcerer_serial_tc, NULL);
411   state->m_serial_timer = machine->scheduler().timer_alloc(FUNC(sorcerer_serial_tc));
412412#endif
413413
414414#if SORCERER_USING_DISKS
r10315r10316
450450   state->sorcerer_fe_w(*space, 0, 0, 0xff);
451451
452452   memory_set_bank(machine, "boot", 1);
453   timer_set(machine, attotime::from_usec(10), NULL, 0, sorcerer_reset);
453   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(sorcerer_reset));
454454}
src/mess/machine/amigafdc.c
r10315r10316
139139   int id;
140140   for(id=0;id<2;id++)
141141   {
142      fdc->fdc_status[id].rev_timer = timer_alloc(device->machine, fdc_rev_proc, (void*)device);
143      fdc->fdc_status[id].dma_timer = timer_alloc(device->machine, fdc_dma_proc, (void*)device);
144      fdc->fdc_status[id].sync_timer = timer_alloc(device->machine, fdc_sync_proc, (void*)device);
142      fdc->fdc_status[id].rev_timer = device->machine->scheduler().timer_alloc(FUNC(fdc_rev_proc), (void*)device);
143      fdc->fdc_status[id].dma_timer = device->machine->scheduler().timer_alloc(FUNC(fdc_dma_proc), (void*)device);
144      fdc->fdc_status[id].sync_timer = device->machine->scheduler().timer_alloc(FUNC(fdc_sync_proc), (void*)device);
145145      floppy_install_load_proc(amiga_floppy_get_device_child(device, id), amiga_load_proc);
146146      floppy_install_unload_proc(amiga_floppy_get_device_child(device, id), amiga_unload_proc);
147147      fdc->fdc_status[id].motor_on = 0;
src/mess/machine/bk.c
r10315r10316
6868
6969MACHINE_START(bk0010)
7070{
71   timer_pulse(machine, attotime::from_hz(2400), NULL, 0, keyboard_callback);
71   machine->scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback));
7272}
7373
7474static IRQ_CALLBACK(bk0010_irq_callback)
src/mess/machine/c1541.c
r10315r10316
12271227//  c1541->track_buffer = auto_alloc_array(device->machine, UINT8, G64_BUFFER_SIZE);
12281228
12291229   /* allocate data timer */
1230   c1541->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
1230   c1541->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_tick), (void *)device);
12311231
12321232   /* register for state saving */
12331233//  state_save_register_device_item_pointer(device, 0, c1541->track_buffer, G64_BUFFER_SIZE);
src/mess/machine/amigakbd.c
r10315r10316
103103   key_buf = auto_alloc_array(machine, UINT8, KEYBOARD_BUFFER_SIZE );
104104   key_buf_pos = 0;
105105   key_cur_pos = 0;
106   kbd_timer = timer_alloc(machine, kbd_update_callback, NULL);
106   kbd_timer = machine->scheduler().timer_alloc(FUNC(kbd_update_callback));
107107   timer_reset( kbd_timer, attotime::never );
108108}
109109
src/mess/machine/matsucd.c
r10315r10316
6969   cd.cdrom = cd_get_cdrom_file( cdrom_device );
7070   cd.cdda = cdrom_device->machine->device(cdda_tag);
7171
72   cd.frame_timer = timer_alloc(cdrom_device->machine, matsu_subcode_proc, NULL);
72   cd.frame_timer = cdrom_device->machine->scheduler().timer_alloc(FUNC(matsu_subcode_proc));
7373
7474   cd.stch_signal = 1;
7575}
r10315r10316
273273      if ( cd.stch_signal != 0 )
274274      {
275275         update_status_changed( machine, 0 );
276         timer_set(machine,  attotime::from_msec(1), NULL, 0, matsucd_set_status_end );
276         machine->scheduler().timer_set(attotime::from_msec(1), FUNC(matsucd_set_status_end));
277277      }
278278   }
279279}
src/mess/machine/terminal.c
r10315r10316
523523   const terminal_interface *intf = get_interface(device);
524524
525525   devcb_resolve_write8(&term->terminal_keyboard_func, &intf->terminal_keyboard_func, device);
526   timer_pulse(device->machine, attotime::from_hz(2400), (void*)device, 0, keyboard_callback);
526   device->machine->scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback), 0, (void*)device);
527527}
528528
529529/*-------------------------------------------------
src/mess/machine/microtan.c
r10315r10316
402402        break;
403403    case 1: /* BFF1: write delayed NMI */
404404        LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data));
405        timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8), NULL, 0, microtan_pulse_nmi);
405        space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8), FUNC(microtan_pulse_nmi));
406406        break;
407407    case 2: /* BFF2: write keypad column write (what is this meant for?) */
408408        LOG(("microtan_bff2_w: %d <- %02x (keypad column)\n", offset, data));
r10315r10316
570570            break;
571571    }
572572
573   state->timer = timer_alloc(machine, microtan_read_cassette, NULL);
573   state->timer = machine->scheduler().timer_alloc(FUNC(microtan_read_cassette));
574574}
575575
576576MACHINE_RESET( microtan )
src/mess/machine/tms9902.c
r10315r10316
640640
641641   tms9902->clock_rate = tms9902->intf->clock_rate;
642642
643   tms9902->timer = timer_alloc(device->machine, decrementer_callback, (void *) device);
643   tms9902->timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_callback), (void *) device);
644644}
645645
646646
src/mess/machine/amigacrt.c
r10315r10316
102102
103103      /* trigger NMI irq */
104104      amiga_ar1_spurious = 0;
105      timer_set(machine,  machine->device<cpu_device>("maincpu")->cycles_to_attotime(28), NULL, 0, amiga_ar1_delayed_nmi );
105      machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(28), FUNC(amiga_ar1_delayed_nmi));
106106   }
107107}
108108
r10315r10316
120120      {
121121         /* trigger an NMI or spurious irq */
122122         amiga_ar1_spurious = (offset == 0x60/2) ? 0 : 1;
123         timer_set(space->machine,  space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(28), NULL, 0, amiga_ar1_delayed_nmi );
123         space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(28), FUNC(amiga_ar1_delayed_nmi));
124124      }
125125   }
126126
src/mess/machine/osborne1.c
r10315r10316
471471
472472   /* Configure the 6850 ACIA */
473473//  acia6850_config( 0, &osborne1_6850_config );
474   state->video_timer = timer_alloc(machine,  osborne1_video_callback , NULL);
474   state->video_timer = machine->scheduler().timer_alloc(FUNC(osborne1_video_callback));
475475   timer_adjust_oneshot(state->video_timer, machine->primary_screen->time_until_pos(1, 0 ), 0);
476476
477   timer_set(machine,  attotime::zero, NULL, 0, setup_osborne1 );
477   machine->scheduler().timer_set(attotime::zero, FUNC(setup_osborne1));
478478}
479479
480480
src/mess/machine/amstrad.c
r10315r10316
625625INLINE void amstrad_update_video( running_machine *machine )
626626{
627627   amstrad_state *state = machine->driver_data<amstrad_state>();
628   attotime now = timer_get_time(machine);
628   attotime now = machine->time();
629629
630630   if ( state->gate_array.draw_p )
631631   {
r10315r10316
698698INLINE void amstrad_plus_update_video( running_machine *machine )
699699{
700700   amstrad_state *state = machine->driver_data<amstrad_state>();
701   attotime now = timer_get_time(machine);
701   attotime now = machine->time();
702702
703703   if ( state->gate_array.draw_p )
704704   {
r10315r10316
957957   drvstate->gate_array.vsync = state ? 1 : 0;
958958
959959   /* Schedule a write to PC2 */
960   timer_set( device->machine, attotime::zero, NULL, 0, amstrad_pc2_low );
960   device->machine->scheduler().timer_set( attotime::zero, FUNC(amstrad_pc2_low));
961961}
962962
963963
r10315r10316
980980   drvstate->gate_array.vsync = state ? 1 : 0;
981981
982982   /* Schedule a write to PC2 */
983   timer_set( device->machine, attotime::zero, NULL, 0, amstrad_pc2_low );
983   device->machine->scheduler().timer_set( attotime::zero, FUNC(amstrad_pc2_low));
984984}
985985
986986
r10315r10316
27672767   }
27682768
27692769   /* Schedule a write to PC2 */
2770   timer_set( device->machine, attotime::zero, NULL, 0, amstrad_pc2_low );
2770   device->machine->scheduler().timer_set( attotime::zero, FUNC(amstrad_pc2_low));
27712771
27722772   return data;
27732773}
r10315r10316
31403140   state->gate_array.hsync = 0;
31413141   state->gate_array.vsync = 0;
31423142
3143   timer_set( machine, attotime::zero, NULL, 0, cb_set_resolution );
3143   machine->scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution));
31443144}
31453145
31463146
r10315r10316
31883188   amstrad_GateArray_write(machine, 0x081); // Epyx World of Sports requires upper ROM to be enabled by default
31893189
31903190   //  multiface_init();
3191   timer_set( machine, attotime::zero, NULL, 0, cb_set_resolution );
3191   machine->scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution));
31923192}
31933193
31943194MACHINE_START( gx4000 )
r10315r10316
32343234   amstrad_GateArray_write(machine, 0x081); // Epyx World of Sports requires upper ROM to be enabled by default
32353235   //  multiface_init();
32363236
3237   timer_set( machine, attotime::zero, NULL, 0, cb_set_resolution );
3237   machine->scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution));
32383238}
32393239
32403240MACHINE_START( kccomp )
r10315r10316
32923292   amstrad_common_init(machine);
32933293   amstrad_reset_machine(machine);
32943294
3295   timer_set( machine, attotime::zero, NULL, 0, cb_set_resolution );
3295   machine->scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution));
32963296}
32973297
32983298
src/mess/machine/hecdisk2.c
r10315r10316
202202
203203void hector_disc2_init( running_machine *machine)
204204{
205   DMA_timer = timer_alloc(machine, Callback_DMA_irq, 0);
206   INT_timer = timer_alloc(machine, Callback_INT_irq, 0);
205   DMA_timer = machine->scheduler().timer_alloc(FUNC(Callback_DMA_irq));
206   INT_timer = machine->scheduler().timer_alloc(FUNC(Callback_INT_irq));
207207}
208208
209209static TIMER_CALLBACK( Callback_DMA_irq )
src/mess/machine/wd17xx.c
r10315r10316
20182018    w->complete_command_delay = 12;
20192019
20202020   /* allocate timers */
2021   w->timer_cmd = timer_alloc(device->machine, wd17xx_command_callback, (void *)device);
2022   w->timer_data = timer_alloc(device->machine, wd17xx_data_callback, (void *)device);
2023   w->timer_rs = timer_alloc(device->machine, wd17xx_read_sector_callback, (void *)device);
2024   w->timer_ws = timer_alloc(device->machine, wd17xx_write_sector_callback, (void *)device);
2021   w->timer_cmd = device->machine->scheduler().timer_alloc(FUNC(wd17xx_command_callback), (void *)device);
2022   w->timer_data = device->machine->scheduler().timer_alloc(FUNC(wd17xx_data_callback), (void *)device);
2023   w->timer_rs = device->machine->scheduler().timer_alloc(FUNC(wd17xx_read_sector_callback), (void *)device);
2024   w->timer_ws = device->machine->scheduler().timer_alloc(FUNC(wd17xx_write_sector_callback), (void *)device);
20252025
20262026   /* resolve callbacks */
20272027   devcb_resolve_read_line(&w->in_dden_func, &w->intf->in_dden_func, device);
src/mess/machine/sms.c
r10315r10316
356356   }
357357
358358   /* Check if lightgun has been chosen as input: if so, enable crosshair */
359   timer_set(machine, attotime::zero, NULL, 0, lightgun_tick);
359   machine->scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
360360
361361   /* Player 1 */
362362   switch (input_port_read_safe(machine, "CTRLSEL", 0x00) & 0x0f)
r10315r10316
17051705   sms_state *state = machine->driver_data<sms_state>();
17061706
17071707   machine->add_notifier(MACHINE_NOTIFY_EXIT, sms_machine_stop);
1708   state->rapid_fire_timer = timer_alloc(machine, rapid_fire_callback , NULL);
1708   state->rapid_fire_timer = machine->scheduler().timer_alloc(FUNC(rapid_fire_callback));
17091709   timer_adjust_periodic(state->rapid_fire_timer, attotime::from_hz(10), 0, attotime::from_hz(10));
17101710
1711   state->lphaser_1_timer = timer_alloc(machine, lphaser_1_callback , NULL);
1712   state->lphaser_2_timer = timer_alloc(machine, lphaser_2_callback , NULL);
1711   state->lphaser_1_timer = machine->scheduler().timer_alloc(FUNC(lphaser_1_callback));
1712   state->lphaser_2_timer = machine->scheduler().timer_alloc(FUNC(lphaser_2_callback));
17131713
17141714   state->main_cpu = machine->device("maincpu");
17151715   state->control_cpu = machine->device("control");
r10315r10316
17201720   state->right_lcd = machine->device("right_lcd");
17211721   
17221722   /* Check if lightgun has been chosen as input: if so, enable crosshair */
1723   timer_set(machine, attotime::zero, NULL, 0, lightgun_tick);
1723   machine->scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
17241724}
17251725
17261726#ifdef MESS
src/mess/machine/poly88.c
r10315r10316
2323{
2424   poly88_state *state = space->machine->driver_data<poly88_state>();
2525   logerror("poly88_baud_rate_w %02x\n",data);
26   state->usart_timer = timer_alloc(space->machine, poly88_usart_timer_callback, NULL);
26   state->usart_timer = space->machine->scheduler().timer_alloc(FUNC(poly88_usart_timer_callback));
2727   timer_adjust_periodic(state->usart_timer, attotime::zero, 0, attotime::from_hz(300));
2828
2929}
r10315r10316
209209   poly88_state *state = machine->driver_data<poly88_state>();
210210   state->previous_level = 0;;
211211   state->clk_level = state->clk_level_tape = 1;
212   state->cassette_timer = timer_alloc(machine, poly88_cassette_timer_callback, NULL);
212   state->cassette_timer = machine->scheduler().timer_alloc(FUNC(poly88_cassette_timer_callback));
213213   timer_adjust_periodic(state->cassette_timer, attotime::zero, 0, attotime::from_hz(600));
214214
215215   serial_connection_init(machine, &state->cassette_serial_connection);
216216   serial_connection_set_in_callback(machine, &state->cassette_serial_connection, poly88_cassette_write);
217217
218   timer_pulse(machine, attotime::from_hz(24000), NULL, 0, keyboard_callback);
218   machine->scheduler().timer_pulse(attotime::from_hz(24000), FUNC(keyboard_callback));
219219}
220220
221221MACHINE_RESET(poly88)
r10315r10316
225225   state->intr = 0;
226226   state->last_code = 0;
227227
228   timer_set(machine,  attotime::zero, NULL, 0, setup_machine_state );
228   machine->scheduler().timer_set(attotime::zero, FUNC(setup_machine_state));
229229}
230230
231231INTERRUPT_GEN( poly88_interrupt )
src/mess/machine/nes_pcb.c
r10315r10316
10291029   else
10301030   {
10311031      state->mmc1_reg_write_enable = 0;
1032      timer_call_after_resynch(space->machine, NULL, 0, mmc1_resync_callback);
1032      space->machine->scheduler().synchronize(FUNC(mmc1_resync_callback));
10331033   }
10341034
10351035   if (data & 0x80)
src/mess/machine/llc.c
r10315r10316
101101
102102MACHINE_START(llc1)
103103{
104   timer_pulse(machine, attotime::from_hz(5), NULL, 0, keyboard_callback);
104   machine->scheduler().timer_pulse(attotime::from_hz(5), FUNC(keyboard_callback));
105105}
106106
107107DRIVER_INIT(llc2)
src/mess/machine/rp5c01a.c
r10315r10316
337337   devcb_resolve_write_line(&rp5c01a->out_alarm_func, &intf->out_alarm_func, device);
338338
339339   /* create the timers */
340   rp5c01a->clock_timer = timer_alloc(device->machine, clock_tick, (void *)device);
340   rp5c01a->clock_timer = device->machine->scheduler().timer_alloc(FUNC(clock_tick), (void *)device);
341341   timer_adjust_periodic(rp5c01a->clock_timer, attotime::zero, 0, attotime::from_hz(1));
342342
343   rp5c01a->alarm_timer = timer_alloc(device->machine, alarm_tick, (void *)device);
343   rp5c01a->alarm_timer = device->machine->scheduler().timer_alloc(FUNC(alarm_tick), (void *)device);
344344   timer_adjust_periodic(rp5c01a->alarm_timer, attotime::zero, 0, attotime::from_hz(16));
345345   timer_enable(rp5c01a->alarm_timer, 0);
346346
src/mess/machine/samcoupe.c
r10315r10316
229229MACHINE_START( samcoupe )
230230{
231231   samcoupe_state *state = machine->driver_data<samcoupe_state>();
232   state->mouse_reset = timer_alloc(machine, samcoupe_mouse_reset, 0);
232   state->mouse_reset = machine->scheduler().timer_alloc(FUNC(samcoupe_mouse_reset));
233233
234234   /* schedule our video updates */
235   state->video_update_timer = timer_alloc(machine, sam_video_update_callback, NULL);
235   state->video_update_timer = machine->scheduler().timer_alloc(FUNC(sam_video_update_callback));
236236   timer_adjust_oneshot(state->video_update_timer, machine->primary_screen->time_until_pos(0, 0), 0);
237237}
238238
src/mess/machine/comx35.c
r10315r10316
609609   }
610610
611611   /* allocate reset timer */
612   m_reset_timer = timer_alloc(machine, reset_tick, NULL);
612   m_reset_timer = machine->scheduler().timer_alloc(FUNC(reset_tick));
613613
614614   /* register for state saving */
615615   state_save_register_postload(machine, comx35_state_save_postload, NULL);
src/mess/machine/trs80.c
r10315r10316
908908   state->reg_load=1;
909909   state->nmi_data=0xff;
910910
911   state->cassette_data_timer = timer_alloc(machine,  cassette_data_callback, NULL );
911   state->cassette_data_timer = machine->scheduler().timer_alloc(FUNC(cassette_data_callback));
912912   timer_adjust_periodic( state->cassette_data_timer, attotime::zero, 0, attotime::from_hz(11025) );
913913   state->printer = machine->device("centronics");
914914   state->ay31015 = machine->device("tr1602");
src/mess/machine/odyssey2.c
r10315r10316
135135   odyssey2_state *state = space->machine->driver_data<odyssey2_state>();
136136   UINT8 data = state->p1;
137137
138   logerror("%.9f p1 read %.2x\n", timer_get_time(space->machine).as_double(), data);
138   logerror("%.9f p1 read %.2x\n", space->machine->time().as_double(), data);
139139   return data;
140140}
141141
r10315r10316
148148
149149   odyssey2_lum_w ( space, 0, state->p1 >> 7 );
150150
151   logerror("%.6f p1 written %.2x\n", timer_get_time(space->machine).as_double(), data);
151   logerror("%.6f p1 written %.2x\n", space->machine->time().as_double(), data);
152152}
153153
154154READ8_HANDLER( odyssey2_getp2 )
r10315r10316
183183    else
184184        state->p2 = state->p2 | 0xF0;
185185
186    logerror("%.6f p2 read %.2x\n", timer_get_time(space->machine).as_double(), state->p2);
186    logerror("%.6f p2 read %.2x\n", space->machine->time().as_double(), state->p2);
187187    return state->p2;
188188}
189189
r10315r10316
192192   odyssey2_state *state = space->machine->driver_data<odyssey2_state>();
193193    state->p2 = data;
194194
195    logerror("%.6f p2 written %.2x\n", timer_get_time(space->machine).as_double(), data);
195    logerror("%.6f p2 written %.2x\n", space->machine->time().as_double(), data);
196196}
197197
198198READ8_HANDLER( odyssey2_getbus )
r10315r10316
206206    if ((state->p2 & P2_KEYBOARD_SELECT_MASK) == 0)
207207      data &= input_port_read(space->machine, "JOY1");       /* read joystick 2 */
208208
209    logerror("%.6f bus read %.2x\n", timer_get_time(space->machine).as_double(), data);
209    logerror("%.6f bus read %.2x\n", space->machine->time().as_double(), data);
210210    return data;
211211}
212212
213213WRITE8_HANDLER( odyssey2_putbus )
214214{
215    logerror("%.6f bus written %.2x\n", timer_get_time(space->machine).as_double(), data);
215    logerror("%.6f bus written %.2x\n", space->machine->time().as_double(), data);
216216}
217217
218218///////////////////////////////////
src/mess/machine/ti85.c
r10315r10316
191191
192192   state->ti_calculator_model = TI_81;
193193
194   timer_pulse(machine, attotime::from_hz(200), NULL, 0, ti85_timer_callback);
194   machine->scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
195195
196196   memory_unmap_write(space, 0x0000, 0x3fff, 0, 0);
197197   memory_unmap_write(space, 0x4000, 0x7fff, 0, 0);
r10315r10316
232232
233233   state->ti_calculator_model = TI_82;
234234
235   timer_pulse(machine, attotime::from_hz(200), NULL, 0, ti85_timer_callback);
235   machine->scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
236236
237237   memory_unmap_write(space, 0x0000, 0x3fff, 0, 0);
238238   memory_unmap_write(space, 0x4000, 0x7fff, 0, 0);
r10315r10316
267267
268268   state->ti_calculator_model = TI_85;
269269
270   timer_pulse(machine, attotime::from_hz(200), NULL, 0, ti85_timer_callback);
270   machine->scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
271271
272272   memory_unmap_write(space, 0x0000, 0x3fff, 0, 0);
273273   memory_unmap_write(space, 0x4000, 0x7fff, 0, 0);
r10315r10316
333333
334334      state->ti_calculator_model = TI_83p;
335335
336      timer_pulse(machine, attotime::from_hz(200), NULL, 0, ti85_timer_callback);
336      machine->scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
337337   }
338338}
339339
r10315r10316
374374
375375      state->ti_calculator_model = TI_86;
376376
377      timer_pulse(machine, attotime::from_hz(200), NULL, 0, ti85_timer_callback);
377      machine->scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
378378   }
379379}
380380
src/mess/machine/64h156.c
r10315r10316
121121//  c64h156_t *c64h156 = get_safe_token(device);
122122
123123   /* allocate data timer */
124//  c64h156->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
124//  c64h156->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_tick), (void *)device);
125125
126126   /* register for state saving */
127127//  state_save_register_device_item(device, 0, c64h156->);
src/mess/machine/msm58321.c
r10315r10316
320320   devcb_resolve_write_line(&msm58321->out_busy_func, &intf->out_busy_func, device);
321321
322322   /* create busy timer */
323   msm58321->busy_timer = timer_alloc(device->machine, busy_tick, (void *)device);
323   msm58321->busy_timer = device->machine->scheduler().timer_alloc(FUNC(busy_tick), (void *)device);
324324   timer_adjust_periodic(msm58321->busy_timer, attotime::zero, 0, attotime::from_hz(2));
325325
326326   /* register for state saving */
src/mess/machine/i8155.c
r10315r10316
316316   devcb_resolve_write_line(&m_out_to_func, &m_config.out_to_func, this);
317317
318318   // allocate timers
319   m_timer = device_timer_alloc(*this);
319   m_timer = timer_alloc();
320320
321321   // register for state saving
322322   state_save_register_device_item(this, 0, m_io_m);
src/mess/machine/mm74c922.c
r10315r10316
211211   }
212212
213213   /* create the timers */
214   mm74c922->scan_timer = timer_alloc(device->machine, mm74c922_scan_tick, (void *)device);
214   mm74c922->scan_timer = device->machine->scheduler().timer_alloc(FUNC(mm74c922_scan_tick), (void *)device);
215215   timer_adjust_periodic(mm74c922->scan_timer, attotime::zero, 0, attotime::from_hz(50));
216216
217217   /* register for state saving */
src/mess/machine/compis.c
r10315r10316
426426{
427427   compis_state *state = device->machine->driver_data<compis_state>();
428428   if (LOG_INTERRUPTS)
429      logerror("(%f) **** Acknowledged interrupt vector %02X\n", timer_get_time(device->machine).as_double(), state->i186.intr.poll_status & 0x1f);
429      logerror("(%f) **** Acknowledged interrupt vector %02X\n", device->machine->time().as_double(), state->i186.intr.poll_status & 0x1f);
430430
431431   /* clear the interrupt */
432432   cpu_set_input_line(device, 0, CLEAR_LINE);
r10315r10316
542542   state->i186.intr.pending = 1;
543543   cpuexec_trigger(machine, CPU_RESUME_TRIGGER);
544544   if (LOG_OPTIMIZATION) logerror("  - trigger due to interrupt pending\n");
545   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", timer_get_time(machine).as_double(), new_vector);
545   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine->time().as_double(), new_vector);
546546}
547547
548548
r10315r10316
568568         case 0x0f:   state->i186.intr.in_service &= ~0x80;   break;
569569         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(machine->device("maincpu")), data & 0x1f);
570570      }
571      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", timer_get_time(machine).as_double(), data & 0x1f);
571      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine->time().as_double(), data & 0x1f);
572572   }
573573
574574   /* non-specific case */
r10315r10316
581581         if ((state->i186.intr.timer & 7) == i && (state->i186.intr.in_service & 0x01))
582582         {
583583            state->i186.intr.in_service &= ~0x01;
584            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", timer_get_time(machine).as_double());
584            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", machine->time().as_double());
585585            return;
586586         }
587587
r10315r10316
590590            if ((state->i186.intr.dma[j] & 7) == i && (state->i186.intr.in_service & (0x04 << j)))
591591            {
592592               state->i186.intr.in_service &= ~(0x04 << j);
593               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", timer_get_time(machine).as_double(), j);
593               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", machine->time().as_double(), j);
594594               return;
595595            }
596596
r10315r10316
599599            if ((state->i186.intr.ext[j] & 7) == i && (state->i186.intr.in_service & (0x10 << j)))
600600            {
601601               state->i186.intr.in_service &= ~(0x10 << j);
602               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", timer_get_time(machine).as_double(), j);
602               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", machine->time().as_double(), j);
603603               return;
604604            }
605605      }
r10315r10316
13241324{
13251325   compis_state *state = machine->driver_data<compis_state>();
13261326   /* create timers here so they stick around */
1327   state->i186.timer[0].int_timer = timer_alloc(machine, internal_timer_int, NULL);
1328   state->i186.timer[1].int_timer = timer_alloc(machine, internal_timer_int, NULL);
1329   state->i186.timer[2].int_timer = timer_alloc(machine, internal_timer_int, NULL);
1330   state->i186.timer[0].time_timer = timer_alloc(machine, NULL, NULL);
1331   state->i186.timer[1].time_timer = timer_alloc(machine, NULL, NULL);
1332   state->i186.timer[2].time_timer = timer_alloc(machine, NULL, NULL);
1333   state->i186.dma[0].finish_timer = timer_alloc(machine, dma_timer_callback, NULL);
1334   state->i186.dma[1].finish_timer = timer_alloc(machine, dma_timer_callback, NULL);
1327   state->i186.timer[0].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int));
1328   state->i186.timer[1].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int));
1329   state->i186.timer[2].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int));
1330   state->i186.timer[0].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
1331   state->i186.timer[1].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
1332   state->i186.timer[2].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
1333   state->i186.dma[0].finish_timer = machine->scheduler().timer_alloc(FUNC(dma_timer_callback));
1334   state->i186.dma[1].finish_timer = machine->scheduler().timer_alloc(FUNC(dma_timer_callback));
13351335}
13361336
13371337/*-------------------------------------------------------------------------*/
src/mess/machine/corvushd.c
r10315r10316
13561356   //
13571357   // Set up timers for command completion and timeout from host
13581358   //
1359   timer_set(machine, attotime::from_usec(c->delay), NULL, CALLBACK_CTH_MODE, corvus_hdc_callback);
1359   machine->scheduler().timer_set(attotime::from_usec(c->delay), FUNC(corvus_hdc_callback), CALLBACK_CTH_MODE);
13601360   timer_enable(c->timeout_timer, 0);         // We've received enough data, disable the timeout timer
13611361
13621362   c->delay = 0;                           // Reset delay for next function
r10315r10316
14551455   c->xmit_bytes = 0;                     // We don't have anything to say to the host
14561456   c->recv_bytes = 0;                     // We aren't waiting on additional data from the host
14571457
1458   c->timeout_timer = timer_alloc(machine, corvus_hdc_callback, NULL);   // Set up a timer to handle the four-second host-to-controller timeout
1458   c->timeout_timer = machine->scheduler().timer_alloc(FUNC(corvus_hdc_callback));   // Set up a timer to handle the four-second host-to-controller timeout
14591459   timer_adjust_oneshot(c->timeout_timer, attotime::from_seconds(4), CALLBACK_TIMEOUT);
14601460   timer_enable(c->timeout_timer, 0);      // Start this timer out disabled
14611461
r10315r10316
16231623      c->xmit_bytes = 0;      // We don't have anything more to say
16241624      c->recv_bytes = 0;      // No active commands
16251625
1626      timer_set(space->machine, (attotime::from_usec(INTERBYTE_DELAY)), NULL, CALLBACK_HTC_MODE, corvus_hdc_callback);
1626      space->machine->scheduler().timer_set((attotime::from_usec(INTERBYTE_DELAY)), FUNC(corvus_hdc_callback), CALLBACK_HTC_MODE);
16271627
16281628//      c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Put us in Idle, Host-to-Controller mode
16291629   } else {
16301630      //
16311631      // Not finished with this packet.  Insert an interbyte delay and then let the host continue
16321632      //
1633      timer_set(space->machine, (attotime::from_usec(INTERBYTE_DELAY)), NULL, CALLBACK_SAME_MODE, corvus_hdc_callback);
1633      space->machine->scheduler().timer_set((attotime::from_usec(INTERBYTE_DELAY)), FUNC(corvus_hdc_callback), CALLBACK_SAME_MODE);
16341634   }
16351635
16361636   return result;
r10315r10316
17041704      // Make the controller busy for a few microseconds while the command is processed
17051705      //
17061706      c->status |= CONTROLLER_BUSY;
1707      timer_set(space->machine, (attotime::from_usec(INTERBYTE_DELAY)), NULL, CALLBACK_SAME_MODE, corvus_hdc_callback);
1707      space->machine->scheduler().timer_set((attotime::from_usec(INTERBYTE_DELAY)), FUNC(corvus_hdc_callback), CALLBACK_SAME_MODE);
17081708   }
17091709}
src/mess/machine/c1551.c
r10315r10316
720720   floppy_install_load_proc(c1551->image, on_disk_change);
721721
722722   /* allocate data timer */
723   c1551->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
723   c1551->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_tick), (void *)device);
724724
725725   /* map TPI1 to host CPU memory space */
726726   address_space *program = cpu_get_address_space(device->machine->device(config->cpu_tag), ADDRESS_SPACE_PROGRAM);
src/mess/machine/wswan.c
r10315r10316
197197   state->ws_bios_bank = NULL;
198198   state->system_type = TYPE_WSWAN;
199199   machine->add_notifier(MACHINE_NOTIFY_EXIT, wswan_machine_stop );
200   state->vdp.timer = timer_alloc( machine, wswan_scanline_interrupt, &state->vdp );
200   state->vdp.timer = machine->scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &state->vdp );
201201   timer_adjust_periodic( state->vdp.timer, attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
202202
203203   wswan_setup_bios(machine);
204204
205205   /* Set up RTC timer */
206206   if ( state->rtc.present )
207      timer_pulse(machine,  attotime::from_seconds(1), NULL, 0, wswan_rtc_callback );
207      machine->scheduler().timer_pulse(attotime::from_seconds(1), FUNC(wswan_rtc_callback));
208208}
209209
210210MACHINE_START( wscolor )
r10315r10316
213213   state->ws_bios_bank = NULL;
214214   state->system_type = TYPE_WSC;
215215   machine->add_notifier(MACHINE_NOTIFY_EXIT, wswan_machine_stop );
216   state->vdp.timer = timer_alloc( machine, wswan_scanline_interrupt, &state->vdp );
216   state->vdp.timer = machine->scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &state->vdp );
217217   timer_adjust_periodic( state->vdp.timer, attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
218218
219219   wswan_setup_bios(machine);
220220
221221   /* Set up RTC timer */
222222   if ( state->rtc.present )
223      timer_pulse(machine,  attotime::from_seconds(1), NULL, 0, wswan_rtc_callback );
223      machine->scheduler().timer_pulse(attotime::from_seconds(1), FUNC(wswan_rtc_callback));
224224}
225225
226226MACHINE_RESET( wswan )
src/mess/machine/zx.c
r10315r10316
151151         if ((cassette_input(space->machine->device("cassette")) < -0.75) && state->tape_bit)
152152         {
153153            state->tape_bit = 0x00;
154            timer_set(space->machine, attotime::from_usec(362), NULL, 0, zx_tape_pulse);
154            space->machine->scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
155155         }
156156
157157         data &= ~state->tape_bit;
r10315r10316
216216         if ((cassette_input(space->machine->device("cassette")) < -0.75) && state->tape_bit)
217217         {
218218            state->tape_bit = 0x00;
219            timer_set(space->machine, attotime::from_usec(362), NULL, 0, zx_tape_pulse);
219            space->machine->scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
220220         }
221221
222222         data &= ~state->tape_bit;
r10315r10316
288288         if ((cassette_input(space->machine->device("cassette")) < -0.75) && state->tape_bit)
289289         {
290290            state->tape_bit = 0x00;
291            timer_set(space->machine, attotime::from_usec(362), NULL, 0, zx_tape_pulse);
291            space->machine->scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
292292         }
293293
294294         data &= ~state->tape_bit;
r10315r10316
364364         if ((cassette_input(space->machine->device("cassette")) < -0.75) && state->tape_bit)
365365         {
366366            state->tape_bit = 0x00;
367            timer_set(space->machine, attotime::from_usec(362), NULL, 0, zx_tape_pulse);
367            space->machine->scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
368368         }
369369
370370         data &= ~state->tape_bit;
src/mess/machine/cbm.c
r10315r10316
147147//  vic2_frame_interrupt (device);
148148
149149   /* check if lightpen has been chosen as input: if so, enable crosshair */
150   timer_set(device->machine, attotime::zero, NULL, 0, lightpen_tick);
150   device->machine->scheduler().timer_set(attotime::zero, FUNC(lightpen_tick));
151151
152152   set_led_status (device->machine, 1, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0);      /* Shift Lock */
153153   set_led_status (device->machine, 0, input_port_read(device->machine, "CTRLSEL") & 0x80 ? 1 : 0);      /* Joystick Swap */
src/mess/machine/z80ne.c
r10315r10316
405405   state_save_register_item( machine, "z80ne", NULL, 0, state->lx383_downsampler );
406406   state_save_register_item_array( machine, "z80ne", NULL, 0, state->lx383_key );
407407   state_save_register_item( machine, "z80ne", NULL, 0, state->nmi_delay_counter );
408   state->cassette_timer = timer_alloc(machine, z80ne_cassette_tc, NULL);
409   timer_pulse( machine, attotime::from_hz(1000), NULL, 0, z80ne_kbd_scan );
408   state->cassette_timer = machine->scheduler().timer_alloc(FUNC(z80ne_cassette_tc));
409   machine->scheduler().timer_pulse( attotime::from_hz(1000), FUNC(z80ne_kbd_scan));
410410}
411411
412412MACHINE_START( z80net )
src/mess/machine/pc1401.c
r10315r10316
3636void pc1401_outc(device_t *device, int data)
3737{
3838   pc1401_state *state = device->machine->driver_data<pc1401_state>();
39   //logerror("%g outc %.2x\n", timer_get_time(machine).as_double(), data);
39   //logerror("%g outc %.2x\n", machine->time().as_double(), data);
4040   state->portc = data;
4141}
4242
r10315r10316
249249      gfx[i]=i;
250250
251251   state->power = 1;
252   timer_set(machine, attotime::from_seconds(1), NULL, 0, pc1401_power_up);
252   machine->scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1401_power_up));
253253}
src/mess/machine/upd1990a.c
r10315r10316
495495   devcb_resolve_write_line(&upd1990a->out_tp_func, &intf->out_tp_func, device);
496496
497497   /* create the timers */
498   upd1990a->clock_timer = timer_alloc(device->machine, clock_tick, (void *)device);
498   upd1990a->clock_timer = device->machine->scheduler().timer_alloc(FUNC(clock_tick), (void *)device);
499499   timer_adjust_periodic(upd1990a->clock_timer, attotime::zero, 0, attotime::from_hz(1));
500500
501   upd1990a->tp_timer = timer_alloc(device->machine, tp_tick, (void *)device);
501   upd1990a->tp_timer = device->machine->scheduler().timer_alloc(FUNC(tp_tick), (void *)device);
502502
503   upd1990a->data_out_timer = timer_alloc(device->machine, data_out_tick, (void *)device);
503   upd1990a->data_out_timer = device->machine->scheduler().timer_alloc(FUNC(data_out_tick), (void *)device);
504504
505505   /* register for state saving */
506506    state_save_register_global_array(device->machine, upd1990a->time_counter);
src/mess/machine/apple2gs.c
r10315r10316
148148   seconds_t current_interval;
149149
150150   /* update clock_curtime */
151   current_interval = timer_get_time(machine).seconds;
151   current_interval = machine->time().seconds;
152152   state->clock_curtime += current_interval - state->clock_curtime_interval;
153153   state->clock_curtime_interval = current_interval;
154154
r10315r10316
18021802   state_save_register_item(machine, "SNDGLUADDR", NULL,0, state->sndglu_addr);
18031803   state_save_register_item(machine, "SNDGLUDUMMYRD", NULL,0, state->sndglu_dummy_read);
18041804
1805   state->clock_timer = timer_alloc(machine, apple2gs_clock_tick, NULL);
1805   state->clock_timer = machine->scheduler().timer_alloc(FUNC(apple2gs_clock_tick));
18061806   timer_adjust_periodic(state->clock_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
18071807
1808   state->qsecond_timer = timer_alloc(machine, apple2gs_qsecond_tick, NULL);
1808   state->qsecond_timer = machine->scheduler().timer_alloc(FUNC(apple2gs_qsecond_tick));
18091809   timer_adjust_periodic(state->qsecond_timer, attotime::from_usec(266700), 0, attotime::from_usec(266700));
18101810
1811   state->scanline_timer = timer_alloc(machine, apple2gs_scanline_tick, NULL);
1811   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(apple2gs_scanline_tick));
18121812   timer_adjust_oneshot(state->scanline_timer, attotime::never, 0);
18131813
18141814   // fire on scanline zero
src/mess/machine/x68k_hdc.c
r10315r10316
127127
128128         sasi->req = 0;
129129         sasi->status_port &= ~0x01;
130         timer_set(device->machine,attotime::from_nsec(450),sasi,0,req_delay);
130         device->machine->scheduler().timer_set(attotime::from_nsec(450), FUNC(req_delay), 0, sasi);
131131         sasi->transfer_byte_count++;
132132         if(sasi->transfer_byte_count >= sasi->transfer_byte_total)
133133         {
r10315r10316
165165         // reset REQ temporarily
166166         sasi->req = 0;
167167         sasi->status_port &= ~0x01;
168         timer_set(device->machine,attotime::from_nsec(450),sasi,0,req_delay);
168         device->machine->scheduler().timer_set(attotime::from_nsec(450), FUNC(req_delay), 0, sasi);
169169
170170         sasi->command_byte_count++;
171171         if(sasi->command_byte_count >= sasi->command_byte_total)
r10315r10316
310310            sasi->status_port |= 0x08;
311311            sasi->command_byte_count = 0;
312312            sasi->command_byte_total = 0;
313            timer_set(device->machine,attotime::from_nsec(45),sasi,0,req_delay);
313            device->machine->scheduler().timer_set(attotime::from_nsec(45), FUNC(req_delay), 0, sasi);
314314         }
315315      }
316316      break;
r10315r10316
362362         // reset REQ temporarily
363363         sasi->req = 0;
364364         sasi->status_port &= ~0x01;
365         timer_set(device->machine,attotime::from_nsec(450),sasi,0,req_delay);
365         device->machine->scheduler().timer_set(attotime::from_nsec(450), FUNC(req_delay), 0, sasi);
366366
367367         return sasi->status;
368368      }
r10315r10316
418418
419419         sasi->req = 0;
420420         sasi->status_port &= ~0x01;
421         timer_set(device->machine,attotime::from_nsec(450),sasi,0,req_delay);
421         device->machine->scheduler().timer_set(attotime::from_nsec(450), FUNC(req_delay), 0, sasi);
422422         sasi->transfer_byte_count++;
423423         if(sasi->transfer_byte_count >= sasi->transfer_byte_total)
424424         {
src/mess/machine/mac.c
r10315r10316
728728   if (mac->m_kbd_comm == TRUE)
729729   {
730730      mac->m_kbd_shift_reg = data;
731      timer_set(machine, attotime::from_msec(1), NULL, 0, kbd_clock);
731      machine->scheduler().timer_set(attotime::from_msec(1), FUNC(kbd_clock));
732732   }
733733}
734734
r10315r10316
741741      /* Mac pulls CB2 down to initiate communication */
742742      mac->m_kbd_comm = TRUE;
743743      mac->m_kbd_receive = TRUE;
744      timer_set(device->machine, attotime::from_usec(100), NULL, 0, kbd_clock);
744      device->machine->scheduler().timer_set(attotime::from_usec(100), FUNC(kbd_clock));
745745   }
746746   if (mac->m_kbd_comm == TRUE && mac->m_kbd_receive == TRUE)
747747   {
r10315r10316
30313031{
30323032   if (has_adb())
30333033   {
3034      this->adb_timer = timer_alloc(machine, mac_adb_tick, NULL);
3034      this->adb_timer = machine->scheduler().timer_alloc(FUNC(mac_adb_tick));
30353035      timer_adjust_oneshot(this->adb_timer, attotime::never, 0);
30363036
30373037      // also allocate PMU timer
30383038      if (ADB_IS_PM_CLASS)
30393039      {
3040         m_pmu_send_timer = timer_alloc(machine, mac_pmu_tick, NULL);
3040         m_pmu_send_timer = machine->scheduler().timer_alloc(FUNC(mac_pmu_tick));
30413041         timer_adjust_oneshot(this->adb_timer, attotime::never, 0);
30423042      }
30433043
30443044   }
3045   this->scanline_timer = timer_alloc(machine, mac_scanline_tick, NULL);
3045   this->scanline_timer = machine->scheduler().timer_alloc(FUNC(mac_scanline_tick));
30463046   timer_adjust_oneshot(this->scanline_timer, machine->primary_screen->time_until_pos(0, 0), 0);
30473047
3048   m_6015_timer = timer_alloc(machine, mac_6015_tick, NULL);
3048   m_6015_timer = machine->scheduler().timer_alloc(FUNC(mac_6015_tick));
30493049   timer_adjust_oneshot(m_6015_timer, attotime::never, 0);
30503050}
30513051
r10315r10316
32303230   /* setup keyboard */
32313231   keyboard_init(mac);
32323232
3233   mac->m_inquiry_timeout = timer_alloc(machine, inquiry_timeout_func, NULL);
3233   mac->m_inquiry_timeout = machine->scheduler().timer_alloc(FUNC(inquiry_timeout_func));
32343234
32353235   /* save state stuff */
32363236   state_save_register_postload(machine, mac_state_load, NULL);
src/mess/machine/pcf8593.c
r10315r10316
9090
9191   _logerror( 0, ("pcf8593_init\n"));
9292   memset( rtc, 0, sizeof(*rtc));
93   rtc->timer = timer_alloc(device->machine,  pcf8593_timer_callback , (void *) device);
93   rtc->timer = device->machine->scheduler().timer_alloc(FUNC(pcf8593_timer_callback), (void *) device);
9494   timer_adjust_periodic(rtc->timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
9595}
9696
src/mess/machine/i8271.c
r10315r10316
15461546
15471547   i8271->intf = (const i8271_interface*)device->baseconfig().static_config();
15481548
1549   i8271->data_timer = timer_alloc(device->machine, i8271_data_timer_callback, (void *)device);
1550   i8271->command_complete_timer = timer_alloc(device->machine, i8271_timed_command_complete_callback, (void *)device);
1549   i8271->data_timer = device->machine->scheduler().timer_alloc(FUNC(i8271_data_timer_callback), (void *)device);
1550   i8271->command_complete_timer = device->machine->scheduler().timer_alloc(FUNC(i8271_timed_command_complete_callback), (void *)device);
15511551   i8271->drive = 0;
15521552   i8271->pExecutionPhaseData = auto_alloc_array(device->machine, char, 0x4000);
15531553
src/mess/machine/ctronics.c
r10315r10316
176176      printer_output(centronics->printer, centronics->data);
177177
178178      /* ready to receive more data, return BUSY to low */
179      timer_set(machine, attotime::from_usec(7), ptr, FALSE, busy_callback);
179      machine->scheduler().timer_set(attotime::from_usec(7), FUNC(busy_callback), FALSE, ptr);
180180   }
181181}
182182
r10315r10316
193193   if (param == TRUE)
194194   {
195195      /* timer to turn ACK low to receive data */
196      timer_set(machine, attotime::from_usec(10), ptr, FALSE, ack_callback);
196      machine->scheduler().timer_set(attotime::from_usec(10), FUNC(ack_callback), FALSE, ptr);
197197   }
198198   else
199199   {
200200      /* timer to return ACK to high state */
201      timer_set(machine, attotime::from_usec(5), ptr, TRUE, ack_callback);
201      machine->scheduler().timer_set(attotime::from_usec(5), FUNC(ack_callback), TRUE, ptr);
202202   }
203203}
204204
r10315r10316
267267   if (centronics->strobe == TRUE && state == FALSE && centronics->busy == FALSE)
268268   {
269269      /* STROBE has gone low, data is ready */
270      timer_set(device->machine, attotime::zero, centronics, TRUE, busy_callback);
270      device->machine->scheduler().timer_set(attotime::zero, FUNC(busy_callback), TRUE, centronics);
271271   }
272272
273273   centronics->strobe = state;
src/mess/machine/amigacd.c
r10315r10316
516516   /* initialize the dmac */
517517   memset( &dmac_data, 0, sizeof( dmac_data ) );
518518
519   dmac_data.dma_timer = timer_alloc(machine, dmac_dma_proc, NULL);
520   tp6525_delayed_timer = timer_alloc(machine, tp6525_delayed_irq, NULL);
519   dmac_data.dma_timer = machine->scheduler().timer_alloc(FUNC(dmac_dma_proc));
520   tp6525_delayed_timer = machine->scheduler().timer_alloc(FUNC(tp6525_delayed_irq));
521521
522522   /* set up DMAC with autoconfig */
523523   amiga_add_autoconfig( machine, &dmac_device );
src/mess/machine/nes.c
r10315r10316
286286   state->sound = machine->device("nessound");
287287   state->cart = machine->device("cart");
288288
289   state->irq_timer = timer_alloc(machine, nes_irq_callback, NULL);
289   state->irq_timer = machine->scheduler().timer_alloc(FUNC(nes_irq_callback));
290290   nes_state_register(machine);
291291}
292292
r10315r10316
532532   int cfg = input_port_read(space->machine, "CTRLSEL");
533533
534534   /* Check if lightgun has been chosen as input: if so, enable crosshair */
535   timer_set(space->machine, attotime::zero, NULL, 0, lightgun_tick);
535   space->machine->scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
536536
537537   if ((cfg & 0x000f) >= 0x07)   // for now we treat the FC keyboard separately from other inputs!
538538   {
src/mess/machine/upd7002.c
r10315r10316
153153      if (uPD7002->status & 0x08)
154154      {
155155         // 12 bit conversion takes 10ms
156         timer_set(device->machine, attotime::from_msec(10), (void *)device, uPD7002->conversion_counter, uPD7002_conversioncomplete);
156         device->machine->scheduler().timer_set(attotime::from_msec(10), FUNC(uPD7002_conversioncomplete), uPD7002->conversion_counter, (void *)device);
157157      } else {
158158         // 8 bit conversion takes 4ms
159         timer_set(device->machine, attotime::from_msec(4), (void *)device, uPD7002->conversion_counter, uPD7002_conversioncomplete);
159         device->machine->scheduler().timer_set(attotime::from_msec(4), FUNC(uPD7002_conversioncomplete), uPD7002->conversion_counter, (void *)device);
160160      }
161161      break;
162162
src/mess/machine/at29040.c
r10315r10316
134134*/
135135void at29c040a_init(running_machine *machine,int id)
136136{
137   at29c040a[id].programming_timer = timer_alloc(machine, at29c040a_programming_timer_callback, NULL);
137   at29c040a[id].programming_timer = machine->scheduler().timer_alloc(FUNC(at29c040a_programming_timer_callback));
138138}
139139
140140/*
src/mess/machine/adc080x.c
r10315r10316
149149   adc080x->eoc = 1;
150150
151151   /* allocate cycle timer */
152   adc080x->cycle_timer = timer_alloc(device->machine, cycle_tick, (void *)device);
152   adc080x->cycle_timer = device->machine->scheduler().timer_alloc(FUNC(cycle_tick), (void *)device);
153153   timer_adjust_periodic(adc080x->cycle_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
154154
155155   /* register for state saving */
src/mess/machine/mz700.c
r10315r10316
3030      if(VERBOSE>=N) \
3131      { \
3232         if( M ) \
33            logerror("%11.6f: %-24s",timer_get_time(mac).as_double(), (const char*)M ); \
33            logerror("%11.6f: %-24s",mac->time().as_double(), (const char*)M ); \
3434         logerror A; \
3535      } \
3636   } while (0)
src/mess/machine/vectrex.c
r10315r10316
289289   {
290290      state->imager_status = param;
291291      coffset = param > 1? 3: 0;
292      timer_set (machine, attotime::from_double(rtime * state->imager_angles[0]), NULL, state->imager_colors[coffset+2], vectrex_imager_change_color);
293      timer_set (machine, attotime::from_double(rtime * state->imager_angles[1]), NULL, state->imager_colors[coffset+1], vectrex_imager_change_color);
294      timer_set (machine, attotime::from_double(rtime * state->imager_angles[2]), NULL, state->imager_colors[coffset], vectrex_imager_change_color);
292      machine->scheduler().timer_set (attotime::from_double(rtime * state->imager_angles[0]), FUNC(vectrex_imager_change_color), state->imager_colors[coffset+2]);
293      machine->scheduler().timer_set (attotime::from_double(rtime * state->imager_angles[1]), FUNC(vectrex_imager_change_color), state->imager_colors[coffset+1]);
294      machine->scheduler().timer_set (attotime::from_double(rtime * state->imager_angles[2]), FUNC(vectrex_imager_change_color), state->imager_colors[coffset]);
295295
296296      if (param == 2)
297297      {
298         timer_set (machine, attotime::from_double(rtime * 0.50), NULL, 1, vectrex_imager_eye);
298         machine->scheduler().timer_set (attotime::from_double(rtime * 0.50), FUNC(vectrex_imager_eye), 1);
299299
300300         /* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */
301301         via_0->write_ca1(1);
302302         via_0->write_ca1(0);
303303         state->imager_pinlevel |= 0x80;
304         timer_set (machine, attotime::from_double(rtime / 360.0), &state->imager_pinlevel, 0, update_level);
304         machine->scheduler().timer_set (attotime::from_double(rtime / 360.0), FUNC(update_level), 0, &state->imager_pinlevel);
305305      }
306306   }
307307}
r10315r10316
318318   if (!mcontrol && mcontrol ^ state->old_mcontrol)
319319   {
320320      state->old_mcontrol = mcontrol;
321      tmp = timer_get_time(space->machine).as_double();
321      tmp = space->machine->time().as_double();
322322      wavel = tmp - state->sl;
323323      state->sl = tmp;
324324
r10315r10316
345345   if (mcontrol && mcontrol ^ state->old_mcontrol)
346346   {
347347      state->old_mcontrol = mcontrol;
348      state->pwl = timer_get_time(space->machine).as_double() - state->sl;
348      state->pwl = space->machine->time().as_double() - state->sl;
349349   }
350350}
351351
src/mess/machine/pc_joy.c
r10315r10316
1818{
1919   UINT8 data = 0;
2020   int delta;
21   attotime new_time = timer_get_time(space->machine);
21   attotime new_time = space->machine->time();
2222   const input_port_config *joystick_port = space->machine->m_portlist.find("pc_joy");
2323
2424   if (joystick_port != NULL)
r10315r10316
4646
4747WRITE8_HANDLER ( pc_JOY_w )
4848{
49   JOY_time = timer_get_time(space->machine);
49   JOY_time = space->machine->time();
5050}
5151
5252
src/mess/machine/dc.c
r10315r10316
545545   atapi_data_len = 0;
546546   atapi_cdata_wait = 0;
547547
548   atapi_timer = timer_alloc(machine,  atapi_xfer_end , NULL);
548   atapi_timer = machine->scheduler().timer_alloc(FUNC(atapi_xfer_end));
549549   timer_adjust_oneshot(atapi_timer, attotime::never, 0);
550550
551551   gdrom_device = NULL;
src/mess/machine/lisa.c
r10315r10316
611611   state->COPS_Ready = 1;
612612
613613   /* impulsion width : +/- 20us */
614   timer_set(machine, attotime::from_usec(20), NULL, 0, read_COPS_command);
614   machine->scheduler().timer_set(attotime::from_usec(20), FUNC(read_COPS_command));
615615}
616616
617617static void reset_COPS(lisa_state *state)
r10315r10316
10441044MACHINE_START( lisa )
10451045{
10461046   lisa_state *state = machine->driver_data<lisa_state>();
1047   state->mouse_timer = timer_alloc(machine, handle_mouse, NULL);
1047   state->mouse_timer = machine->scheduler().timer_alloc(FUNC(handle_mouse));
10481048
10491049   /* read command every ms (don't know the real value) */
1050   timer_pulse(machine, attotime::from_msec(1), NULL, 0, set_COPS_ready);
1050   machine->scheduler().timer_pulse(attotime::from_msec(1), FUNC(set_COPS_ready));
10511051}
10521052
10531053MACHINE_RESET( lisa )
src/mess/machine/sym1.c
r10315r10316
295295   }
296296
297297   /* allocate a timer to refresh the led display */
298   state->led_update = timer_alloc(machine, led_refresh, NULL);
298   state->led_update = machine->scheduler().timer_alloc(FUNC(led_refresh));
299299}
300300
301301
src/mess/machine/lynx.c
r10315r10316
838838   }
839839
840840   if (0)
841      timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(state->blitter.memory_accesses*20), NULL, 0, lynx_blitter_timer);
841      machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(state->blitter.memory_accesses*20), FUNC(lynx_blitter_timer));
842842}
843843
844844
r10315r10316
958958      case 0x92:   /* Better check this with docs! */
959959         if (state->blitter.time==attotime::zero)
960960         {
961            if (space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_get_time(space->machine) - state->blitter.time) > state->blitter.memory_accesses * 20)
961            if (space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(space->machine->time() - state->blitter.time) > state->blitter.memory_accesses * 20)
962962            {
963963               state->suzy.data[offset] &= ~0x01; //state->blitter finished
964964               state->blitter.time = attotime::zero;
r10315r10316
10911091   case 0x91:
10921092      if (data & 0x01)
10931093      {
1094         state->blitter.time = timer_get_time(space->machine);
1094         state->blitter.time = space->machine->time();
10951095         lynx_blitter(space->machine);
10961096      }
10971097      break;
r10315r10316
12971297{
12981298   lynx_state *state = machine->driver_data<lynx_state>();
12991299   memset( &state->timer[which], 0, sizeof(LYNX_TIMER) );
1300   state->timer[which].timer = timer_alloc(machine,  lynx_timer_shot , NULL);
1300   state->timer[which].timer = machine->scheduler().timer_alloc(FUNC(lynx_timer_shot));
13011301}
13021302
13031303static void lynx_timer_signal_irq(running_machine *machine, int which)
r10315r10316
14791479   {
14801480      state->uart.data_to_send = state->uart.buffer;
14811481      state->uart.buffer_loaded = FALSE;
1482      timer_set(machine, attotime::from_usec(11), NULL, 0, lynx_uart_timer);
1482      machine->scheduler().timer_set(attotime::from_usec(11), FUNC(lynx_uart_timer));
14831483   }
14841484   else
14851485      state->uart.sending = FALSE;
r10315r10316
15351535         {
15361536            state->uart.sending = TRUE;
15371537            state->uart.data_to_send = data;
1538            timer_set(space->machine, attotime::from_usec(11), NULL, 0, lynx_uart_timer);
1538            space->machine->scheduler().timer_set(attotime::from_usec(11), FUNC(lynx_uart_timer));
15391539         }
15401540         break;
15411541   }
src/mess/machine/cgenie.c
r10315r10316
153153   memory_install_write8_handler(space, 0x4000, 0x4000 + ram_get_size(machine->device(RAM_TAG)) - 1, 0, 0, cgenie_videoram_w);
154154   state->videoram = ram_get_ptr(machine->device(RAM_TAG));
155155   memory_set_bankptr(machine, "bank1", ram_get_ptr(machine->device(RAM_TAG)));
156   timer_pulse(machine,  attotime::from_hz(11025), NULL, 0, handle_cassette_input );
156   machine->scheduler().timer_pulse(attotime::from_hz(11025), FUNC(handle_cassette_input));
157157}
158158
159159/*************************************
src/mess/machine/ondra.c
r10315r10316
9494
9595MACHINE_START(ondra)
9696{
97   timer_pulse(machine, attotime::from_hz(10), NULL, 0, nmi_check_callback);
97   machine->scheduler().timer_pulse(attotime::from_hz(10), FUNC(nmi_check_callback));
9898}
src/mess/machine/kaypro.c
r10315r10316
327327static WRITE_LINE_DEVICE_HANDLER( kaypro_fdc_intrq_w )
328328{
329329   if (state)
330      timer_set(device->machine, attotime::from_usec(25), NULL, 0, kaypro_timer_callback);
330      device->machine->scheduler().timer_set(attotime::from_usec(25), FUNC(kaypro_timer_callback));
331331   else
332332      cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
333333}
r10315r10316
335335static WRITE_LINE_DEVICE_HANDLER( kaypro_fdc_drq_w )
336336{
337337   if (state)
338      timer_set(device->machine, attotime::from_usec(25), NULL, 0, kaypro_timer_callback);
338      device->machine->scheduler().timer_set(attotime::from_usec(25), FUNC(kaypro_timer_callback));
339339   else
340340      cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
341341
src/mess/machine/super80.c
r10315r10316
209209{
210210   super80_state *state = machine->driver_data<super80_state>();
211211   state->super80_shared=0xff;
212   timer_set(machine, attotime::from_usec(10), NULL, 0, super80_reset);
212   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(super80_reset));
213213   memory_set_bank(machine, "boot", 1);
214214   state->z80pio = machine->device("z80pio");
215215   state->speaker = machine->device("speaker");
r10315r10316
221221{
222222   UINT8 *RAM = machine->region("maincpu")->base();
223223   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xc000);
224   timer_pulse(machine, attotime::from_hz(200000),NULL,0,super80_timer);   /* timer for keyboard and cassette */
224   machine->scheduler().timer_pulse(attotime::from_hz(200000), FUNC(super80_timer));   /* timer for keyboard and cassette */
225225}
226226
227227DRIVER_INIT( super80 )
228228{
229   timer_pulse(machine, attotime::from_hz(100),NULL,0,super80_halfspeed);   /* timer for 1MHz slowdown */
229   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(super80_halfspeed));   /* timer for 1MHz slowdown */
230230   driver_init_common(machine);
231231}
232232
src/mess/machine/pc_turbo.c
r10315r10316
4949   ti->cur_val = -1;
5050   ti->off_speed = off_speed;
5151   ti->on_speed = on_speed;
52   timer_pulse(machine, attotime::from_msec(100), ti, 0, pc_turbo_callback);
52   machine->scheduler().timer_pulse(attotime::from_msec(100), FUNC(pc_turbo_callback), 0, ti);
5353   return 0;
5454}
src/mess/machine/lviv.c
r10315r10316
4747DIRECT_UPDATE_HANDLER(lviv_directoverride)
4848{
4949   if (input_port_read(machine, "RESET") & 0x01)
50      timer_set(machine, attotime::from_usec(10), NULL, 0, lviv_reset);
50      machine->scheduler().timer_set(attotime::from_usec(10), FUNC(lviv_reset));
5151   return address;
5252}
5353
r10315r10316
248248   memory_set_bankptr(machine,"bank3", machine->region("maincpu")->base() + 0x010000);
249249   memory_set_bankptr(machine,"bank4", machine->region("maincpu")->base() + 0x010000);
250250
251   /*timer_pulse(machine, TIME_IN_NSEC(200), NULL, 0, lviv_draw_pixel);*/
251   /*machine->scheduler().timer_pulse(TIME_IN_NSEC(200), FUNC(lviv_draw_pixel));*/
252252
253253   /*memset(ram_get_ptr(machine->device(RAM_TAG)), 0, sizeof(unsigned char)*0xffff);*/
254254}
src/mess/machine/6551.c
r10315r10316
150150   memset(acia, 0, sizeof(*acia));
151151   /* transmit data reg is empty */
152152   acia->status_register |= (1<<4);
153   acia->timer = timer_alloc(device->machine, acia_6551_timer_callback, (void *) device);
153   acia->timer = device->machine->scheduler().timer_alloc(FUNC(acia_6551_timer_callback), (void *) device);
154154
155155   serial_connection_init(device->machine, &acia->connection);
156156   serial_connection_set_in_callback(device->machine, &acia->connection, acia_6551_in_callback);
src/mess/machine/ay31015.c
r10315r10316
697697   ay31015->tx_clock = ay31015->config->transmitter_clock;
698698   ay31015->rx_clock = ay31015->config->receiver_clock;
699699
700   ay31015->rx_timer = timer_alloc(device->machine, ay31015_rx_process, (void *)device );
701   ay31015->tx_timer = timer_alloc(device->machine, ay31015_tx_process, (void *)device );
700   ay31015->rx_timer = device->machine->scheduler().timer_alloc(FUNC(ay31015_rx_process), (void *)device );
701   ay31015->tx_timer = device->machine->scheduler().timer_alloc(FUNC(ay31015_tx_process), (void *)device );
702702
703703   ay31015_update_rx_timer( device );
704704   ay31015_update_tx_timer( device );
src/mess/machine/pc1403.c
r10315r10316
128128{
129129   pc1403_state *state = device->machine->driver_data<pc1403_state>();
130130    state->portc = data;
131//    logerror("%g pc %.4x outc %.2x\n", timer_get_time(device->machine).as_double(), cpu_get_pc(device->machine->device("maincpu")), data);
131//    logerror("%g pc %.4x outc %.2x\n", device->machine->time().as_double(), cpu_get_pc(device->machine->device("maincpu")), data);
132132}
133133
134134
r10315r10316
181181   for (i=0; i<128; i++) gfx[i]=i;
182182
183183   state->power = 1;
184   timer_set(machine, attotime::from_seconds(1), NULL, 0, pc1403_power_up);
184   machine->scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1403_power_up));
185185
186186   memory_set_bankptr(machine, "bank1", machine->region("user1")->base());
187187}
src/mess/machine/mc68328.c
r10315r10316
28002800
28012801    mc68328->iface = (const mc68328_interface*)device->baseconfig().static_config();
28022802
2803    mc68328->gptimer[0] = timer_alloc(device->machine, mc68328_timer1_hit, 0);
2804    mc68328->gptimer[1] = timer_alloc(device->machine, mc68328_timer2_hit, 0);
2805    mc68328->rtc = timer_alloc(device->machine, mc68328_rtc_tick, 0);
2806    mc68328->pwm = timer_alloc(device->machine, mc68328_pwm_transition, 0);
2803    mc68328->gptimer[0] = device->machine->scheduler().timer_alloc(FUNC(mc68328_timer1_hit));
2804    mc68328->gptimer[1] = device->machine->scheduler().timer_alloc(FUNC(mc68328_timer2_hit));
2805    mc68328->rtc = device->machine->scheduler().timer_alloc(FUNC(mc68328_rtc_tick));
2806    mc68328->pwm = device->machine->scheduler().timer_alloc(FUNC(mc68328_pwm_transition));
28072807
28082808    mc68328_register_state_save(device);
28092809}
src/mess/machine/pc_fdc.c
r10315r10316
118118   if (iface)
119119      memcpy(&fdc->fdc_interface, iface, sizeof(fdc->fdc_interface));
120120
121   fdc->watchdog = timer_alloc(machine,  watchdog_timeout, NULL );
121   fdc->watchdog = machine->scheduler().timer_alloc(FUNC(watchdog_timeout));
122122
123123   pc_fdc_reset(machine);
124124}
src/mess/machine/apple1.c
r10315r10316
159159
160160       A 120-Hz poll rate seems to be fast enough to ensure no
161161       keystrokes are missed. */
162   timer_pulse(machine, attotime::from_hz(120), NULL, 0, apple1_kbd_poll);
162   machine->scheduler().timer_pulse(attotime::from_hz(120), FUNC(apple1_kbd_poll));
163163}
164164
165165
r10315r10316
367367      /* The keyboard will pulse its strobe line when a key is
368368           pressed.  A 10-usec pulse is typical. */
369369      pia6821_ca1_w(pia, 1);
370      timer_set(machine, attotime::from_usec(10), NULL, 0, apple1_kbd_strobe_end);
370      machine->scheduler().timer_set(attotime::from_usec(10), FUNC(apple1_kbd_strobe_end));
371371   }
372372}
373373
r10315r10316
413413       write.  Thus the write delay depends on the cursor position and
414414       where the display is in the refresh cycle. */
415415   if (!data)
416      timer_set(device->machine, apple1_vh_dsp_time_to_ready(device->machine), NULL, 0, apple1_dsp_ready_start);
416      device->machine->scheduler().timer_set(apple1_vh_dsp_time_to_ready(device->machine), FUNC(apple1_dsp_ready_start));
417417}
418418
419419static TIMER_CALLBACK(apple1_dsp_ready_start)
r10315r10316
425425       input CB1.  The end of this pulse will tell the PIA that the
426426       display is ready for another write. */
427427   pia6821_cb1_w(pia, 0);
428   timer_set(machine, attotime::from_nsec(3500), NULL, 0, apple1_dsp_ready_end);
428   machine->scheduler().timer_set(attotime::from_nsec(3500), FUNC(apple1_dsp_ready_end));
429429}
430430
431431static TIMER_CALLBACK(apple1_dsp_ready_end)
src/mess/machine/mc6843.c
r10315r10316
215215      floppy_drive_seek( img, -1 );
216216   }
217217
218   LOG(( "%f mc6843_finish_STZ: actual=%i\n", timer_get_time(device->machine).as_double(), floppy_drive_get_current_track( img ) ));
218   LOG(( "%f mc6843_finish_STZ: actual=%i\n", device->machine->time().as_double(), floppy_drive_get_current_track( img ) ));
219219
220220   /* update state */
221221   mc6843->CTAR = 0;
r10315r10316
237237   /* seek to track */
238238   floppy_drive_seek( img, mc6843->GCR - mc6843->CTAR );
239239
240   LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", timer_get_time(device->machine).as_double(), mc6843->CTAR, mc6843->GCR, floppy_drive_get_current_track( img ) ));
240   LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", device->machine->time().as_double(), mc6843->CTAR, mc6843->GCR, floppy_drive_get_current_track( img ) ));
241241
242242   /* update state */
243243   mc6843->CTAR = mc6843->GCR;
r10315r10316
260260      if ( ( ! floppy_drive_get_next_id( img, mc6843->side, id ) ) || ( id->flags & ID_FLAG_CRC_ERROR_IN_ID_FIELD ) || ( id->N != 0 ) )
261261      {
262262         /* read address error */
263         LOG(( "%f mc6843_address_search: get_next_id failed\n", timer_get_time(device->machine).as_double() ));
263         LOG(( "%f mc6843_address_search: get_next_id failed\n", device->machine->time().as_double() ));
264264         mc6843->STRB |= 0x0a; /* set CRC error & Sector Address Undetected */
265265         mc6843_cmd_end( device );
266266         return 0;
r10315r10316
269269      if ( id->C != mc6843->LTAR )
270270      {
271271         /* track mismatch */
272         LOG(( "%f mc6843_address_search: track mismatch: logical=%i real=%i\n", timer_get_time(device->machine).as_double(), mc6843->LTAR, id->C ));
272         LOG(( "%f mc6843_address_search: track mismatch: logical=%i real=%i\n", device->machine->time().as_double(), mc6843->LTAR, id->C ));
273273         mc6843->data[0] = id->C; /* make the track number available to the CPU */
274274         mc6843->STRA |= 0x20;    /* set Track Not Equal */
275275         mc6843_cmd_end( device );
r10315r10316
279279      if ( id->R == mc6843->SAR )
280280      {
281281         /* found! */
282         LOG(( "%f mc6843_address_search: sector %i found on track %i\n", timer_get_time(device->machine).as_double(), id->R, id->C ));
282         LOG(( "%f mc6843_address_search: sector %i found on track %i\n", device->machine->time().as_double(), id->R, id->C ));
283283         if ( ! (mc6843->CMR & 0x20) )
284284         {
285285            mc6843->ISR |= 0x04; /* if no DMA, set Status Sense */
r10315r10316
293293         if ( r >= 4 )
294294         {
295295            /* time-out after 3 full revolutions */
296            LOG(( "%f mc6843_address_search: no sector %i found after 3 revolutions\n", timer_get_time(device->machine).as_double(), mc6843->SAR ));
296            LOG(( "%f mc6843_address_search: no sector %i found after 3 revolutions\n", device->machine->time().as_double(), mc6843->SAR ));
297297            mc6843->STRB |= 0x08; /* set Sector Address Undetected */
298298            mc6843_cmd_end( device );
299299            return 0;
r10315r10316
315315
316316   if ( id->flags & ID_FLAG_CRC_ERROR_IN_DATA_FIELD )
317317   {
318      LOG(( "%f mc6843_address_search_read: data CRC error\n", timer_get_time(device->machine).as_double() ));
318      LOG(( "%f mc6843_address_search_read: data CRC error\n", device->machine->time().as_double() ));
319319      mc6843->STRB |= 0x06; /* set CRC error & Data Mark Undetected */
320320      mc6843_cmd_end( device );
321321      return 0;
r10315r10316
323323
324324   if ( id->flags & ID_FLAG_DELETED_DATA )
325325   {
326      LOG(( "%f mc6843_address_search_read: deleted data\n", timer_get_time(device->machine).as_double() ));
326      LOG(( "%f mc6843_address_search_read: deleted data\n", device->machine->time().as_double() ));
327327      mc6843->STRA |= 0x02; /* set Delete Data Mark Detected */
328328   }
329329
r10315r10316
392392   mc6843_t* mc6843 = get_safe_token( device );
393393   int cmd = mc6843->CMR & 0x0f;
394394
395   LOG(( "%f mc6843_cont: timer called for cmd=%s(%i)\n", timer_get_time(device->machine).as_double(), mc6843_cmd[cmd], cmd ));
395   LOG(( "%f mc6843_cont: timer called for cmd=%s(%i)\n", device->machine->time().as_double(), mc6843_cmd[cmd], cmd ));
396396
397397   timer_adjust_oneshot( mc6843->timer_cont, attotime::never, 0 );
398398
r10315r10316
427427      int cmd = mc6843->CMR & 0x0f;
428428
429429      LOG(( "%f $%04x mc6843_r: data input cmd=%s(%i), pos=%i/%i, GCR=%i, ",
430            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ),
430            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ),
431431            mc6843_cmd[cmd], cmd, mc6843->data_idx,
432432            mc6843->data_size, mc6843->GCR ));
433433
r10315r10316
491491   case 1: /* Current-Track Address Register (CTAR) */
492492      data = mc6843->CTAR;
493493      LOG(( "%f $%04x mc6843_r: read CTAR %i (actual=%i)\n",
494            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
494            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
495495            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
496496      break;
497497
498498   case 2: /* Interrupt Status Register (ISR) */
499499      data = mc6843->ISR;
500500      LOG(( "%f $%04x mc6843_r: read ISR %02X: cmd=%scomplete settle=%scomplete sense-rq=%i STRB=%i\n",
501            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
501            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
502502            (data & 1) ? "" : "not-" , (data & 2) ? "" : "not-",
503503            (data >> 2) & 1, (data >> 3) & 1 ));
504504
r10315r10316
524524
525525      data = mc6843->STRA;
526526      LOG(( "%f $%04x mc6843_r: read STRA %02X: data-rq=%i del-dta=%i ready=%i t0=%i wp=%i trk-dif=%i idx=%i busy=%i\n",
527            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
527            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
528528            data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1,
529529            (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 ));
530530      break;
r10315r10316
533533   case 4: /* Status Register B (STRB) */
534534      data = mc6843->STRB;
535535      LOG(( "%f $%04x mc6843_r: read STRB %02X: data-err=%i CRC-err=%i dta--mrk-err=%i sect-mrk-err=%i seek-err=%i fi=%i wr-err=%i hard-err=%i\n",
536            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
536            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
537537            data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1,
538538            (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 ));
539539
r10315r10316
545545   case 7: /* Logical-Track Address Register (LTAR) */
546546      data = mc6843->LTAR;
547547      LOG(( "%f $%04x mc6843_r: read LTAR %i (actual=%i)\n",
548            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
548            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
549549            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
550550      break;
551551
r10315r10316
567567      int FWF = (mc6843->CMR >> 4) & 1;
568568
569569      LOG(( "%f $%04x mc6843_w: data output cmd=%s(%i), pos=%i/%i, GCR=%i, data=%02X\n",
570            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ),
570            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ),
571571            mc6843_cmd[cmd], cmd, mc6843->data_idx,
572572            mc6843->data_size, mc6843->GCR, data ));
573573
r10315r10316
584584            /* end of sector write */
585585            device_t* img = mc6843_floppy_image( device );
586586
587            LOG(( "%f $%04x mc6843_w: write sector %i\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->data_id ));
587            LOG(( "%f $%04x mc6843_w: write sector %i\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->data_id ));
588588
589589            floppy_drive_write_sector_data(
590590               img, mc6843->side, mc6843->data_id,
r10315r10316
648648               UINT8 track  = mc6843->data[1];
649649               UINT8 sector = mc6843->data[3];
650650               UINT8 filler = 0xe5; /* standard Thomson filler */
651               LOG(( "%f $%04x mc6843_w: address id detected track=%i sector=%i\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), track, sector));
651               LOG(( "%f $%04x mc6843_w: address id detected track=%i sector=%i\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), track, sector));
652652               floppy_drive_format_sector( img, mc6843->side, sector, track, 0, sector, 0, filler );
653653            }
654654            else
r10315r10316
678678   case 1: /* Current-Track Address Register (CTAR) */
679679      mc6843->CTAR = data & 0x7f;
680680      LOG(( "%f $%04x mc6843_w: set CTAR to %i %02X (actual=%i) \n",
681            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->CTAR, data,
681            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->CTAR, data,
682682            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
683683      break;
684684
r10315r10316
687687      int cmd = data & 15;
688688
689689      LOG(( "%f $%04x mc6843_w: set CMR to $%02X: cmd=%s(%i) FWF=%i DMA=%i ISR3-intr=%i fun-intr=%i\n",
690            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ),
690            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ),
691691            data, mc6843_cmd[cmd], cmd, (data >> 4) & 1, (data >> 5) & 1,
692692            (data >> 6) & 1, (data >> 7) & 1 ));
693693
r10315r10316
734734
735735      /* assume CLK freq = 1MHz (IBM 3740 compatibility) */
736736      LOG(( "%f $%04x mc6843_w: set SUR to $%02X: head settling time=%fms, track-to-track seek time=%f\n",
737            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ),
737            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ),
738738            data, 4.096 * (data & 15), 1.024 * ((data >> 4) & 15) ));
739739      break;
740740
741741   case 4: /* Sector Address Register (SAR) */
742742      mc6843->SAR = data & 0x1f;
743      LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->SAR, data ));
743      LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->SAR, data ));
744744      break;
745745
746746   case 5: /* General Count Register (GCR) */
747747      mc6843->GCR = data & 0x7f;
748      LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->GCR, data ));
748      LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->GCR, data ));
749749      break;
750750
751751   case 6: /* CRC Control Register (CCR) */
752752      mc6843->CCR = data & 3;
753753      LOG(( "%f $%04x mc6843_w: set CCR to %02X: CRC=%s shift=%i\n",
754            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
754            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), data,
755755            (data & 1) ? "enabled" : "disabled", (data >> 1) & 1 ));
756756      break;
757757
758758   case 7: /* Logical-Track Address Register (LTAR) */
759759      mc6843->LTAR = data & 0x7f;
760760      LOG(( "%f $%04x mc6843_w: set LTAR to %i %02X (actual=%i)\n",
761            timer_get_time(device->machine).as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->LTAR, data,
761            device->machine->time().as_double(), cpu_get_previouspc( device->machine->firstcpu ), mc6843->LTAR, data,
762762            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
763763      break;
764764
r10315r10316
809809
810810   mc6843->iface = (const mc6843_interface*)device->baseconfig().static_config();
811811
812   mc6843->timer_cont = timer_alloc( device->machine, mc6843_cont, (void*) device) ;
812   mc6843->timer_cont = device->machine->scheduler().timer_alloc(FUNC(mc6843_cont), (void*) device) ;
813813
814814   state_save_register_item( device->machine,"mc6843", device->tag(), 0, mc6843->CTAR );
815815   state_save_register_item( device->machine,"mc6843", device->tag(), 0, mc6843->CMR );
src/mess/machine/mm58274c.c
r10315r10316
471471   state_save_register_item(device->machine, "mm58274c", device->tag(), 0, mm58274c->seconds2);
472472   state_save_register_item(device->machine, "mm58274c", device->tag(), 0, mm58274c->tenths);
473473
474   mm58274c->increment_rtc = timer_alloc(device->machine, increment_rtc, ((void*)device));
474   mm58274c->increment_rtc = device->machine->scheduler().timer_alloc(FUNC(increment_rtc), ((void*)device));
475475   timer_adjust_periodic(mm58274c->increment_rtc, attotime::zero, 0, attotime::from_msec(100));
476   mm58274c->interrupt_timer = timer_alloc(device->machine, rtc_interrupt_callback, ((void*)device));
476   mm58274c->interrupt_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_interrupt_callback), ((void*)device));
477477}
478478
479479
src/mess/machine/ibmpc.c
r10315r10316
1515      if(LEVEL>=N) \
1616      { \
1717         if( M ) \
18            logerror("%11.6f: %-24s",timer_get_time(machine).as_double(),(char*)M ); \
18            logerror("%11.6f: %-24s",machine->time().as_double(),(char*)M ); \
1919         logerror A; \
2020      } \
2121   } while (0)
r10315r10316
112112void pc_rtc_init(running_machine *machine)
113113{
114114   memset(&pc_rtc,0,sizeof(pc_rtc));
115   pc_rtc.timer = timer_alloc(machine, pc_rtc_timer, NULL);
115   pc_rtc.timer = machine->scheduler().timer_alloc(FUNC(pc_rtc_timer));
116116   timer_adjust_periodic(pc_rtc.timer, attotime::zero, 0, attotime(1, 0));
117117}
118118
src/mess/machine/hec2hrp.c
r10315r10316
779779   pot0 = pot1 = 0x40;
780780   
781781   /* For Cassette synchro*/
782   Cassette_timer = timer_alloc(machine, Callback_CK, 0);
782   Cassette_timer = machine->scheduler().timer_alloc(FUNC(Callback_CK));
783783   timer_adjust_periodic(Cassette_timer, attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/
784784
785785   /* Sound sn76477*/
src/mess/machine/com8116.c
r10315r10316
154154   /* create the timers */
155155   if (com8116->out_fx4_func.target)
156156   {
157      com8116->fx4_timer = timer_alloc(device->machine, fx4_tick, (void *)device);
157      com8116->fx4_timer = device->machine->scheduler().timer_alloc(FUNC(fx4_tick), (void *)device);
158158      timer_adjust_periodic(com8116->fx4_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 4));
159159   }
160160
161   com8116->fr_timer = timer_alloc(device->machine, fr_tick, (void *)device);
162   com8116->ft_timer = timer_alloc(device->machine, ft_tick, (void *)device);
161   com8116->fr_timer = device->machine->scheduler().timer_alloc(FUNC(fr_tick), (void *)device);
162   com8116->ft_timer = device->machine->scheduler().timer_alloc(FUNC(ft_tick), (void *)device);
163163
164164   /* register for state saving */
165165    state_save_register_global(device->machine, com8116->fr);
src/mess/machine/bebox.c
r10315r10316
10881088   state->devices.dma8237_1 = NULL;
10891089   state->devices.dma8237_2 = NULL;
10901090
1091   timer_set(machine,  attotime::zero, NULL, 0, bebox_get_devices );
1091   machine->scheduler().timer_set(attotime::zero, FUNC(bebox_get_devices));
10921092
10931093   cputag_set_input_line(machine, "ppc1", INPUT_LINE_RESET, CLEAR_LINE);
10941094   cputag_set_input_line(machine, "ppc2", INPUT_LINE_RESET, ASSERT_LINE);
src/mess/machine/e0516.c
r10315r10316
215215   e0516_t *e0516 = get_safe_token(device);
216216
217217   /* create the timers */
218   e0516->clock_timer = timer_alloc(device->machine, clock_tick, (void *)device);
218   e0516->clock_timer = device->machine->scheduler().timer_alloc(FUNC(clock_tick), (void *)device);
219219   timer_adjust_periodic(e0516->clock_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 32768));
220220
221221   /* register for state saving */
src/mess/machine/6525tpi.c
r10315r10316
8686      if(VERBOSE_LEVEL >= N) \
8787      { \
8888         if( M ) \
89            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
89            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
9090         logerror A; \
9191      } \
9292   } while (0)
src/mess/machine/intv.c
r10315r10316
311311WRITE16_HANDLER( intv_ram16_w )
312312{
313313   intv_state *state = space->machine->driver_data<intv_state>();
314   //logerror("%g: WRITING TO GRAM offset = %d\n",timer_get_time(machine),offset);
314   //logerror("%g: WRITING TO GRAM offset = %d\n",machine->time(),offset);
315315   //logerror("ram16_w(%x) = %x\n",offset,data);
316316   state->ram16[offset] = data&0xffff;
317317}
r10315r10316
498498   intv_state *state = device->machine->driver_data<intv_state>();
499499   cputag_set_input_line(device->machine, "maincpu", CP1610_INT_INTRM, ASSERT_LINE);
500500   state->sr1_int_pending = 1;
501   timer_set(device->machine, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(3791), NULL, 0, intv_interrupt_complete);
501   device->machine->scheduler().timer_set(device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(3791), FUNC(intv_interrupt_complete));
502502   intv_stic_screenrefresh(device->machine);
503503}
504504
src/mess/machine/special.c
r10315r10316
126126
127127MACHINE_RESET( special )
128128{
129   timer_set(machine, attotime::from_usec(10), NULL, 0, special_reset);
129   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(special_reset));
130130   memory_set_bank(machine, "bank1", 1);
131131}
132132
r10315r10316
275275   special_state *state = machine->driver_data<special_state>();
276276   specimx_set_bank(machine, 2,0x00); // Initiali load ROM disk
277277   state->specimx_color = 0x70;
278   timer_set(machine,  attotime::zero, NULL, 0, setup_pit8253_gates );
278   machine->scheduler().timer_set(attotime::zero, FUNC(setup_pit8253_gates));
279279   device_t *fdc = machine->device("wd1793");
280280   wd17xx_set_pause_time(fdc,12);
281281   wd17xx_dden_w(fdc, 0);
src/mess/machine/mc6852.c
r10315r10316
346346   devcb_resolve_write_line(&mc6852->out_tuf_func, &intf->out_tuf_func, device);
347347
348348   /* allocate timers */
349   mc6852->rx_timer = timer_alloc(device->machine, receive_tick, (void *) device);
350   mc6852->tx_timer = timer_alloc(device->machine, transmit_tick, (void *) device);
349   mc6852->rx_timer = device->machine->scheduler().timer_alloc(FUNC(receive_tick), (void *) device);
350   mc6852->tx_timer = device->machine->scheduler().timer_alloc(FUNC(transmit_tick), (void *) device);
351351}
352352
353353/*-------------------------------------------------
src/mess/machine/mikro80.c
r10315r10316
8585MACHINE_RESET( mikro80 )
8686{
8787   mikro80_state *state = machine->driver_data<mikro80_state>();
88   timer_set(machine, attotime::from_usec(10), NULL, 0, mikro80_reset);
88   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(mikro80_reset));
8989   memory_set_bank(machine, "bank1", 1);
9090   state->keyboard_mask = 0;
9191}
src/mess/machine/rmnimbus.c
r10315r10316
202202    UINT16  oldreq;
203203
204204   if (LOG_INTERRUPTS)
205      logerror("(%f) **** Acknowledged interrupt vector %02X\n", timer_get_time(device->machine).as_double(), state->i186.intr.poll_status & 0x1f);
205      logerror("(%f) **** Acknowledged interrupt vector %02X\n", device->machine->time().as_double(), state->i186.intr.poll_status & 0x1f);
206206
207207   /* clear the interrupt */
208208   cpu_set_input_line(device, 0, CLEAR_LINE);
r10315r10316
351351   state->i186.intr.pending = 1;
352352   cpuexec_trigger(machine, CPU_RESUME_TRIGGER);
353353   if (LOG_OPTIMIZATION) logerror("  - trigger due to interrupt pending\n");
354   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", timer_get_time(machine).as_double(), new_vector);
354   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine->time().as_double(), new_vector);
355355}
356356
357357
r10315r10316
379379         case 0x0f:   state->i186.intr.in_service &= ~0x80;   break;
380380         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(machine->device(MAINCPU_TAG)), data & 0x1f);
381381      }
382      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", timer_get_time(machine).as_double(), data & 0x1f);
382      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine->time().as_double(), data & 0x1f);
383383   }
384384
385385   /* non-specific case */
r10315r10316
392392         if ((state->i186.intr.timer & 0x07) == Priority && (state->i186.intr.in_service & 0x01))
393393         {
394394            state->i186.intr.in_service &= ~0x01;
395            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", timer_get_time(machine).as_double());
395            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", machine->time().as_double());
396396            handled=1;
397397         }
398398
r10315r10316
401401            if ((state->i186.intr.dma[IntNo] & 0x07) == Priority && (state->i186.intr.in_service & (0x04 << IntNo)))
402402            {
403403               state->i186.intr.in_service &= ~(0x04 << IntNo);
404               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", timer_get_time(machine).as_double(), IntNo);
404               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", machine->time().as_double(), IntNo);
405405               handled=1;
406406            }
407407
r10315r10316
410410            if ((state->i186.intr.ext[IntNo] & 0x07) == Priority && (state->i186.intr.in_service & (0x10 << IntNo)))
411411            {
412412               state->i186.intr.in_service &= ~(0x10 << IntNo);
413               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", timer_get_time(machine).as_double(), IntNo);
413               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", machine->time().as_double(), IntNo);
414414               handled=1;
415415            }
416416      }
r10315r10316
818818   logerror("Machine reset\n");
819819
820820   /* create timers here so they stick around */
821   state->i186.timer[0].int_timer = timer_alloc(machine, internal_timer_int, NULL);
822   state->i186.timer[1].int_timer = timer_alloc(machine, internal_timer_int, NULL);
823   state->i186.timer[2].int_timer = timer_alloc(machine, internal_timer_int, NULL);
824   state->i186.timer[0].time_timer = timer_alloc(machine, NULL, NULL);
825   state->i186.timer[1].time_timer = timer_alloc(machine, NULL, NULL);
826   state->i186.timer[2].time_timer = timer_alloc(machine, NULL, NULL);
827   state->i186.dma[0].finish_timer = timer_alloc(machine, dma_timer_callback, NULL);
828   state->i186.dma[1].finish_timer = timer_alloc(machine, dma_timer_callback, NULL);
821   state->i186.timer[0].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int));
822   state->i186.timer[1].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int));
823   state->i186.timer[2].int_timer = machine->scheduler().timer_alloc(FUNC(internal_timer_int));
824   state->i186.timer[0].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
825   state->i186.timer[1].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
826   state->i186.timer[2].time_timer = machine->scheduler().timer_alloc(FUNC(NULL));
827   state->i186.dma[0].finish_timer = machine->scheduler().timer_alloc(FUNC(dma_timer_callback));
828   state->i186.dma[1].finish_timer = machine->scheduler().timer_alloc(FUNC(dma_timer_callback));
829829}
830830
831831static void nimbus_cpu_reset(running_machine *machine)
r10315r10316
12771277   /* init cpu */
12781278   nimbus_cpu_init(machine);
12791279
1280   state->keyboard.keyscan_timer=timer_alloc(machine, keyscan_callback, NULL);
1281   state->nimbus_mouse.mouse_timer=timer_alloc(machine, mouse_callback, NULL);
1280   state->keyboard.keyscan_timer=machine->scheduler().timer_alloc(FUNC(keyscan_callback));
1281   state->nimbus_mouse.mouse_timer=machine->scheduler().timer_alloc(FUNC(mouse_callback));
12821282
12831283   /* setup debug commands */
12841284   if (machine->debug_flags & DEBUG_FLAG_ENABLED)
src/mess/machine/c1571.c
r10315r10316
962962   floppy_install_load_proc(c1571->image, on_disk_change);
963963
964964   /* allocate data timer */
965   c1571->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
965   c1571->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_tick), (void *)device);
966966
967967   /* register for state saving */
968968   state_save_register_device_item(device, 0, c1571->address);
src/mess/machine/abc77.c
r10315r10316
415415   abc77->cpu = device->subdevice(I8035_TAG);
416416
417417   /* allocate reset timer */
418   abc77->reset_timer = timer_alloc(device->machine, reset_tick, (FPTR *) device);
418   abc77->reset_timer = device->machine->scheduler().timer_alloc(FUNC(reset_tick), (FPTR *) device);
419419
420420   /* register for state saving */
421421   state_save_register_device_item(device, 0, abc77->keylatch);
src/mess/machine/ut88.c
r10315r10316
6969MACHINE_RESET( ut88 )
7070{
7171   ut88_state *state = machine->driver_data<ut88_state>();
72   timer_set(machine, attotime::from_usec(10), NULL, 0, ut88_reset);
72   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(ut88_reset));
7373   memory_set_bank(machine, "bank1", 1);
7474   state->keyboard_mask = 0;
7575}
r10315r10316
164164}
165165MACHINE_START( ut88mini )
166166{
167   timer_pulse(machine, attotime::from_hz(60), NULL, 0, update_display);
167   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(update_display));
168168}
169169
170170MACHINE_RESET( ut88mini )
src/mess/machine/pc_mouse.c
r10315r10316
3030void pc_mouse_initialise(running_machine *machine)
3131{
3232   pc_mouse.head = pc_mouse.tail = 0;
33   pc_mouse.timer = timer_alloc(machine, pc_mouse_scan, NULL);
33   pc_mouse.timer = machine->scheduler().timer_alloc(FUNC(pc_mouse_scan));
3434   pc_mouse.inputs=UART8250_HANDSHAKE_IN_DSR|UART8250_HANDSHAKE_IN_CTS;
3535   pc_mouse.ins8250 = NULL;
3636}
src/mess/machine/tf20.c
r10315r10316
9999
100100   /* toggle tc on read */
101101   upd765_tc_w(device, ASSERT_LINE);
102   timer_set(device->machine, attotime::zero, device, 0, tf20_upd765_tc_reset);
102   device->machine->scheduler().timer_set(attotime::zero, FUNC(tf20_upd765_tc_reset), 0, device);
103103
104104   return 0xff;
105105}
src/mess/machine/zx8302.c
r10315r10316
350350   devcb_resolve_read_line(&m_in_raw2_func, &m_config.in_raw2_func, this);
351351
352352   // allocate timers
353   m_txd_timer = device_timer_alloc(*this, TIMER_TXD);
354   m_baudx4_timer = device_timer_alloc(*this, TIMER_BAUDX4);
355   m_rtc_timer = device_timer_alloc(*this, TIMER_RTC);
356   m_gap_timer = device_timer_alloc(*this, TIMER_GAP);
357   m_ipc_timer = device_timer_alloc(*this, TIMER_IPC);
353   m_txd_timer = timer_alloc(TIMER_TXD);
354   m_baudx4_timer = timer_alloc(TIMER_BAUDX4);
355   m_rtc_timer = timer_alloc(TIMER_RTC);
356   m_gap_timer = timer_alloc(TIMER_GAP);
357   m_ipc_timer = timer_alloc(TIMER_IPC);
358358
359359   timer_adjust_periodic(m_rtc_timer, attotime::zero, 0, attotime::from_hz(m_config.rtc_clock / 32768));
360360   timer_adjust_periodic(m_gap_timer, attotime::zero, 0, attotime::from_msec(31));
src/mess/machine/cybiko.c
r10315r10316
333333   cybiko_state *state = machine->driver_data<cybiko_state>();
334334   _logerror( 0, ("cybiko_rs232_init\n"));
335335   memset( &state->rs232, 0, sizeof( state->rs232));
336//  timer_pulse(machine,  TIME_IN_HZ( 10), NULL, 0, rs232_timer_callback);
336//  machine->scheduler().timer_pulse(TIME_IN_HZ( 10), FUNC(rs232_timer_callback));
337337}
338338
339339static void cybiko_rs232_exit( void)
src/mess/machine/apple2.c
r10315r10316
13841384            break;
13851385         case 0x04:
13861386            /* X Joystick 1 axis */
1387            result = timer_get_time(space->machine).as_double() < state->joystick_x1_time;
1387            result = space->machine->time().as_double() < state->joystick_x1_time;
13881388            break;
13891389         case 0x05:
13901390            /* Y Joystick 1 axis */
1391            result = timer_get_time(space->machine).as_double() < state->joystick_y1_time;
1391            result = space->machine->time().as_double() < state->joystick_y1_time;
13921392            break;
13931393         case 0x06:
13941394            /* X Joystick 2 axis */
1395            result = timer_get_time(space->machine).as_double() < state->joystick_x2_time;
1395            result = space->machine->time().as_double() < state->joystick_x2_time;
13961396            break;
13971397         case 0x07:
13981398            /* Y Joystick 2 axis */
1399            result = timer_get_time(space->machine).as_double() < state->joystick_y2_time;
1399            result = space->machine->time().as_double() < state->joystick_y2_time;
14001400            break;
14011401         default:
14021402            /* c060 Empty Cassette head read
r10315r10316
14241424
14251425      if (offset == 0)
14261426      {
1427         state->joystick_x1_time = timer_get_time(space->machine).as_double() + x_calibration * input_port_read(space->machine, "joystick_1_x");
1428         state->joystick_y1_time = timer_get_time(space->machine).as_double() + y_calibration * input_port_read(space->machine, "joystick_1_y");
1429         state->joystick_x2_time = timer_get_time(space->machine).as_double() + x_calibration * input_port_read(space->machine, "joystick_2_x");
1430         state->joystick_y2_time = timer_get_time(space->machine).as_double() + y_calibration * input_port_read(space->machine, "joystick_2_y");
1427         state->joystick_x1_time = space->machine->time().as_double() + x_calibration * input_port_read(space->machine, "joystick_1_x");
1428         state->joystick_y1_time = space->machine->time().as_double() + y_calibration * input_port_read(space->machine, "joystick_1_y");
1429         state->joystick_x2_time = space->machine->time().as_double() + x_calibration * input_port_read(space->machine, "joystick_2_x");
1430         state->joystick_y2_time = space->machine->time().as_double() + y_calibration * input_port_read(space->machine, "joystick_2_y");
14311431      }
14321432   }
14331433   return 0;
src/mess/machine/c64.c
r10315r10316
3434      if(VERBOSE_LEVEL >= N) \
3535      { \
3636         if( M ) \
37            logerror("%11.6f: %-24s", timer_get_time(MACHINE).as_double(), (char*) M ); \
37            logerror("%11.6f: %-24s", MACHINE->time().as_double(), (char*) M ); \
3838         logerror A; \
3939      } \
4040   } while (0)
r10315r10316
766766   }
767767
768768   if (state->tape_on)
769      state->datasette_timer = timer_alloc(machine, c64_tape_timer, NULL);
769      state->datasette_timer = machine->scheduler().timer_alloc(FUNC(c64_tape_timer));
770770
771771   // "cyberload" tape loader check the e000-ffff ram; the init ram need to return different value
772772   {
src/mess/machine/hd63450.c
r10315r10316
6666   // Initialise timers and registers
6767   for(x=0;x<4;x++)
6868   {
69      dmac->timer[x] = timer_alloc(device->machine, dma_transfer_timer, (void*)device);
69      dmac->timer[x] = device->machine->scheduler().timer_alloc(FUNC(dma_transfer_timer), (void*)device);
7070      dmac->reg[x].niv = 0x0f;  // defaults?
7171      dmac->reg[x].eiv = 0x0f;
7272      dmac->clock[x] = dmac->intf->clock[x];
src/mess/machine/pc.c
r10315r10316
5454      if(VERBOSE_PIO>=N) \
5555      { \
5656         if( M ) \
57            logerror("%11.6f: %-24s",timer_get_time(machine).as_double(),(char*)M ); \
57            logerror("%11.6f: %-24s",machine->time().as_double(),(char*)M ); \
5858         logerror A; \
5959      } \
6060   } while (0)
r10315r10316
13631363{
13641364   pc_state *st = machine->driver_data<pc_state>();
13651365   pc_fdc_init( machine, &pcjr_fdc_interface_nc );
1366   pcjr_keyb.keyb_signal_timer = timer_alloc(machine,  pcjr_keyb_signal_callback, NULL );
1367   pc_int_delay_timer = timer_alloc(machine,  pcjr_delayed_pic8259_irq, NULL );
1366   pcjr_keyb.keyb_signal_timer = machine->scheduler().timer_alloc(FUNC(pcjr_keyb_signal_callback));
1367   pc_int_delay_timer = machine->scheduler().timer_alloc(FUNC(pcjr_delayed_pic8259_irq));
13681368   st->maincpu = machine->device("maincpu" );
13691369   cpu_set_irq_callback(st->maincpu, pc_irq_callback);
13701370
src/mess/machine/pecom.c
r10315r10316
2323MACHINE_START( pecom )
2424{
2525   pecom_state *state = machine->driver_data<pecom_state>();
26   state->reset_timer = timer_alloc(machine, reset_tick, NULL);
26   state->reset_timer = machine->scheduler().timer_alloc(FUNC(reset_tick));
2727}
2828
2929MACHINE_RESET( pecom )
src/mess/machine/kb3600.c
r10315r10316
149149   devcb_resolve_write_line(&ay3600->out_ako_func, &intf->out_ako_func, device);
150150
151151   /* create the timers */
152   ay3600->scan_timer = timer_alloc(device->machine, ay3600_scan_tick, (void *)device);
152   ay3600->scan_timer = device->machine->scheduler().timer_alloc(FUNC(ay3600_scan_tick), (void *)device);
153153   timer_adjust_periodic(ay3600->scan_timer, attotime::zero, 0, attotime::from_hz(60));
154154
155155   /* register for state saving */
src/mess/machine/pce.c
r10315r10316
12691269      }
12701270   }
12711271
1272   pce_cd.data_timer = timer_alloc(machine,  pce_cd_data_timer_callback , NULL);
1272   pce_cd.data_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_data_timer_callback));
12731273   timer_adjust_oneshot(pce_cd.data_timer, attotime::never, 0);
1274   pce_cd.adpcm_dma_timer = timer_alloc(machine,  pce_cd_adpcm_dma_timer_callback , NULL);
1274   pce_cd.adpcm_dma_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_adpcm_dma_timer_callback));
12751275   timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime::never, 0);
12761276
1277   pce_cd.cdda_fadeout_timer = timer_alloc(machine,  pce_cd_cdda_fadeout_callback , NULL);
1277   pce_cd.cdda_fadeout_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_cdda_fadeout_callback));
12781278   timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::never, 0);
1279   pce_cd.cdda_fadein_timer = timer_alloc(machine,  pce_cd_cdda_fadein_callback , NULL);
1279   pce_cd.cdda_fadein_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_cdda_fadein_callback));
12801280   timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
12811281
1282   pce_cd.adpcm_fadeout_timer = timer_alloc(machine,  pce_cd_adpcm_fadeout_callback , NULL);
1282   pce_cd.adpcm_fadeout_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_adpcm_fadeout_callback));
12831283   timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::never, 0);
1284   pce_cd.adpcm_fadein_timer = timer_alloc(machine,  pce_cd_adpcm_fadein_callback , NULL);
1284   pce_cd.adpcm_fadein_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_adpcm_fadein_callback));
12851285   timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::never, 0);
12861286}
12871287
r10315r10316
15811581      if ( pce_cd.scsi_IO )
15821582      {
15831583         pce_cd.scsi_ACK = 1;
1584         timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(15), NULL, 0, pce_cd_clear_ack );
1584         machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(15), FUNC(pce_cd_clear_ack));
15851585      }
15861586   }
15871587   return data;
src/mess/machine/smc92x4.c
r10315r10316
21452145   devcb_resolve_read_line(&w->in_auxbus_func, &w->intf->in_auxbus_func, device);
21462146
21472147   /* allocate timers */
2148   /* w->timer_data = timer_alloc(device->machine, smc92x4_data_callback, (void *)device); */
2149   w->timer_rs = timer_alloc(device->machine, smc92x4_read_sector_callback, (void *)device);
2150   w->timer_ws = timer_alloc(device->machine, smc92x4_write_sector_callback, (void *)device);
2151   w->timer_track = timer_alloc(device->machine, smc92x4_track_callback, (void *)device);
2152   w->timer_seek = timer_alloc(device->machine, smc92x4_seek_callback, (void *)device);
2148   /* w->timer_data = device->machine->scheduler().timer_alloc(FUNC(smc92x4_data_callback), (void *)device); */
2149   w->timer_rs = device->machine->scheduler().timer_alloc(FUNC(smc92x4_read_sector_callback), (void *)device);
2150   w->timer_ws = device->machine->scheduler().timer_alloc(FUNC(smc92x4_write_sector_callback), (void *)device);
2151   w->timer_track = device->machine->scheduler().timer_alloc(FUNC(smc92x4_track_callback), (void *)device);
2152   w->timer_seek = device->machine->scheduler().timer_alloc(FUNC(smc92x4_seek_callback), (void *)device);
21532153
21542154   w->use_real_timing = TRUE;
21552155}
src/mess/machine/pc1251.c
r10315r10316
128128   for (i=0; i<128; i++) gfx[i]=i;
129129
130130   state->power = 1;
131   timer_set(machine, attotime::from_seconds(1), NULL, 0, pc1251_power_up);
131   machine->scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1251_power_up));
132132}
133133
src/mess/machine/i8257.c
r10315r10316
625625   }
626626
627627   /* create the DMA timer */
628   i8257->dma_timer = timer_alloc(device->machine, dma_tick, (void *)device);
628   i8257->dma_timer = device->machine->scheduler().timer_alloc(FUNC(dma_tick), (void *)device);
629629   timer_adjust_periodic(i8257->dma_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
630630
631631   /* register for state saving */
src/mess/machine/tms5501.c
r10315r10316
285285
286286   for (i = 0; i < 5; i++)
287287   {
288      tms->timer[i] = timer_alloc(device->machine, tms5501_timer_decrementer_callback, (void *) device);
288      tms->timer[i] = device->machine->scheduler().timer_alloc(FUNC(tms5501_timer_decrementer_callback), (void *) device);
289289      timer_set_param(tms->timer[i], i);
290290   }
291291
src/mess/machine/sgi.c
r10315r10316
490490
491491void sgi_mc_timer_init(running_machine *machine)
492492{
493   tMC_UpdateTimer = timer_alloc(machine,  mc_update_callback , NULL);
493   tMC_UpdateTimer = machine->scheduler().timer_alloc(FUNC(mc_update_callback));
494494   timer_adjust_periodic(tMC_UpdateTimer, attotime::from_hz(10000), 0, attotime::from_hz(10000));
495495}
496496
src/mess/machine/bbc.c
r10315r10316
20552055{
20562056   bbc_state *state = machine->driver_data<bbc_state>();
20572057   state->Master=0;
2058   state->tape_timer = timer_alloc(machine, bbc_tape_timer_cb, NULL);
2058   state->tape_timer = machine->scheduler().timer_alloc(FUNC(bbc_tape_timer_cb));
20592059}
20602060DRIVER_INIT( bbcm )
20612061{
20622062   bbc_state *state = machine->driver_data<bbc_state>();
20632063   state->Master=1;
2064   state->tape_timer = timer_alloc(machine, bbc_tape_timer_cb, NULL);
2064   state->tape_timer = machine->scheduler().timer_alloc(FUNC(bbc_tape_timer_cb));
20652065}
20662066
20672067MACHINE_START( bbca )
src/mess/machine/kc.c
r10315r10316
230230
231231static void kc_disc_interface_init(running_machine *machine)
232232{
233   timer_set(machine, attotime::zero, NULL, 0, kc85_disk_reset_timer_callback);
233   machine->scheduler().timer_set(attotime::zero, FUNC(kc85_disk_reset_timer_callback));
234234
235235   /* hold cpu at reset */
236236   cputag_set_input_line(machine, "disc", INPUT_LINE_RESET, ASSERT_LINE);
r10315r10316
403403static void   kc_cassette_init(running_machine *machine)
404404{
405405   kc_state *state = machine->driver_data<kc_state>();
406   state->cassette_timer = timer_alloc(machine, kc_cassette_timer_callback, NULL);
406   state->cassette_timer = machine->scheduler().timer_alloc(FUNC(kc_cassette_timer_callback));
407407}
408408
409409static void   kc_cassette_set_motor(running_machine *machine, int motor_state)
r10315r10316
17881788
17891789   // from keyboard init
17901790   /* 50 Hz is just a arbitrary value - used to put scan-codes into the queue for transmitting */
1791   timer_pulse(machine, attotime::from_hz(50), NULL, 0, kc_keyboard_update);
1791   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(kc_keyboard_update));
17921792
17931793   /* timer to transmit pulses to kc base unit */
1794   timer_pulse(machine, attotime::from_usec(1024), NULL, 0, kc_keyboard_transmit_timer_callback);
1794   machine->scheduler().timer_pulse(attotime::from_usec(1024), FUNC(kc_keyboard_transmit_timer_callback));
17951795
1796   timer_pulse(machine, attotime::from_hz(15625), (void *)machine->device("z80ctc"), 0, kc85_15khz_timer_callback);
1797   timer_set(machine, attotime::zero, NULL, 0, kc85_reset_timer_callback);
1796   machine->scheduler().timer_pulse(attotime::from_hz(15625), FUNC(kc85_15khz_timer_callback), 0, (void *)machine->device("z80ctc"));
1797   machine->scheduler().timer_set(attotime::zero, FUNC(kc85_reset_timer_callback));
17981798}
17991799
18001800static void   kc85_common_init(running_machine *machine)
src/mess/video/upd3301.c
r10315r10316
635635   upd3301->width = intf->width;
636636
637637   /* create the timers */
638   upd3301->vrtc_timer = timer_alloc(device->machine, vrtc_tick, (void *)device);
639   upd3301->hrtc_timer = timer_alloc(device->machine, hrtc_tick, (void *)device);
638   upd3301->vrtc_timer = device->machine->scheduler().timer_alloc(FUNC(vrtc_tick), (void *)device);
639   upd3301->hrtc_timer = device->machine->scheduler().timer_alloc(FUNC(hrtc_tick), (void *)device);
640640
641641   /* register for state saving */
642642//  state_save_register_device_item(device, 0, upd3301->);
src/mess/video/zx.c
r10315r10316
173173      for (y = state->charline_ptr; y < ARRAY_LENGTH(state->charline); y++)
174174         state->charline[y] = 0;
175175
176      timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(((32 - state->charline_ptr) << 2)), NULL, 0, zx_ula_irq);
176      machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(((32 - state->charline_ptr) << 2)), FUNC(zx_ula_irq));
177177      state->ula_irq_active++;
178178
179179      scanline = BITMAP_ADDR16(bitmap, state->ula_scanline_count, 0);
r10315r10316
203203VIDEO_START( zx )
204204{
205205   zx_state *state = machine->driver_data<zx_state>();
206   state->ula_nmi = timer_alloc(machine, zx_ula_nmi, NULL);
206   state->ula_nmi = machine->scheduler().timer_alloc(FUNC(zx_ula_nmi));
207207   state->ula_irq_active = 0;
208208   VIDEO_START_CALL(generic_bitmapped);
209209}
src/mess/video/coco6847.c
r10315r10316
15881588int m6847_get_horizontal_sync(running_machine *machine)
15891589{
15901590   attotime fire_time = timer_firetime(m6847->hs_fall_timer);
1591   return fire_time > timer_get_time(machine);
1591   return fire_time > machine->time();
15921592}
15931593
15941594
r10315r10316
15961596static void set_horizontal_sync(running_machine *machine)
15971597{
15981598   attotime fire_time = timer_firetime(m6847->hs_fall_timer);
1599   int horizontal_sync = fire_time >  timer_get_time(machine);
1599   int horizontal_sync = fire_time >  machine->time();
16001600   if (m6847->horizontal_sync_callback)
16011601      m6847->horizontal_sync_callback(machine, !horizontal_sync);
16021602}
r10315r10316
16061606int m6847_get_field_sync(running_machine *machine)
16071607{
16081608   attotime fire_time = timer_firetime(m6847->fs_fall_timer);
1609   return fire_time > timer_get_time(machine);
1609   return fire_time > machine->time();
16101610}
16111611
16121612
r10315r10316
16141614static void set_field_sync(running_machine *machine)
16151615{
16161616   attotime fire_time = timer_firetime(m6847->fs_fall_timer);
1617   int field_sync = fire_time > timer_get_time(machine);
1617   int field_sync = fire_time > machine->time();
16181618   if (m6847->field_sync_callback)
16191619      m6847->field_sync_callback(machine,field_sync);
16201620}
r10315r10316
16301630static TIMER_CALLBACK(hs_fall)
16311631{
16321632   if (LOG_HS)
1633      logerror("hs_fall(): time=%s\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION));
1633      logerror("hs_fall(): time=%s\n", machine->time().as_string(ATTOTIME_STRING_PRECISION));
16341634
16351635   set_horizontal_sync(machine);
16361636}
r10315r10316
16381638static TIMER_CALLBACK(hs_rise)
16391639{
16401640   if (LOG_HS)
1641      logerror("hs_rise(): time=%s\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION));
1641      logerror("hs_rise(): time=%s\n", machine->time().as_string(ATTOTIME_STRING_PRECISION));
16421642
16431643   timer_adjust_oneshot(m6847->hs_rise_timer,
16441644      attotime(0, m6847->scanline_period), 0);
r10315r10316
16521652static TIMER_CALLBACK(fs_fall)
16531653{
16541654   if (LOG_FS)
1655      logerror("fs_fall(): time=%s scanline=%d\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION), get_scanline());
1655      logerror("fs_fall(): time=%s scanline=%d\n", machine->time().as_string(ATTOTIME_STRING_PRECISION), get_scanline());
16561656
16571657   set_field_sync(machine);
16581658}
r10315r10316
16601660static TIMER_CALLBACK(fs_rise)
16611661{
16621662   if (LOG_FS)
1663      logerror("fs_rise(): time=%s scanline=%d\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION), get_scanline());
1663      logerror("fs_rise(): time=%s scanline=%d\n", machine->time().as_string(ATTOTIME_STRING_PRECISION), get_scanline());
16641664
16651665   /* adjust field sync falling edge timer */
16661666   timer_adjust_oneshot(m6847->fs_fall_timer,
r10315r10316
18691869   }
18701870
18711871   /* allocate timers */
1872   m6847->fs_rise_timer = timer_alloc(machine, fs_rise, NULL);
1873   m6847->fs_fall_timer = timer_alloc(machine, fs_fall, NULL);
1874   m6847->hs_rise_timer = timer_alloc(machine, hs_rise, NULL);
1875   m6847->hs_fall_timer = timer_alloc(machine, hs_fall, NULL);
1872   m6847->fs_rise_timer = machine->scheduler().timer_alloc(FUNC(fs_rise));
1873   m6847->fs_fall_timer = machine->scheduler().timer_alloc(FUNC(fs_fall));
1874   m6847->hs_rise_timer = machine->scheduler().timer_alloc(FUNC(hs_rise));
1875   m6847->hs_fall_timer = machine->scheduler().timer_alloc(FUNC(hs_fall));
18761876
18771877   /* setup dimensions */
18781878   m6847->top_border_scanlines = v->top_border_scanlines;
src/mess/video/hp48.c
r10315r10316
142142   int menu_start    = HP48_IO_20(0x30) & ~1;       /* menu bitmap address */
143143   int fg = contrast + 2;
144144
145   LOG(( "%f hp48 video_update called: ", timer_get_time(screen->machine).as_double()));
145   LOG(( "%f hp48 video_update called: ", screen->machine->time().as_double()));
146146
147147   if ( !display || refresh )
148148   {
src/mess/video/pc_vga_mess.c
r10315r10316
735735         int clock=vga.monitor.get_clock();
736736         int lines=vga.monitor.get_lines();
737737         int columns=vga.monitor.get_columns();
738         int diff = (((timer_get_time(space->machine) - vga.monitor.start_time) * clock).seconds)
738         int diff = (((space->machine->time() - vga.monitor.start_time) * clock).seconds)
739739            %(lines*columns);
740740         if (diff<columns*vga.monitor.get_sync_lines()) data|=8;
741741         diff=diff/lines;
r10315r10316
745745      if (vga.monitor.retrace)
746746      {
747747         data |= 1;
748         if ((timer_get_time(space->machine) - vga.monitor.start_time) > attotime::from_usec(300))
748         if ((space->machine->time() - vga.monitor.start_time) > attotime::from_usec(300))
749749         {
750750            data |= 8;
751751            vga.monitor.retrace=0;
r10315r10316
753753      }
754754      else
755755      {
756         if ((timer_get_time(space->machine) - vga.monitor.start_time)  > attotime::from_msec(15))
756         if ((space->machine->time() - vga.monitor.start_time)  > attotime::from_msec(15))
757757            vga.monitor.retrace=1;
758         vga.monitor.start_time=timer_get_time(space->machine);
758         vga.monitor.start_time=space->machine->time();
759759      }
760760#else
761761      // not working with ps2m30
r10315r10316
10101010         vga_cpu_interface(space->machine);
10111011
10121012         if (vga.sequencer.index == 0)
1013            vga.monitor.start_time = timer_get_time(space->machine);
1013            vga.monitor.start_time = space->machine->time();
10141014      }
10151015      break;
10161016   case 6:
r10315r10316
12791279   vga.monitor.get_columns = ega_get_crtc_columns;
12801280   vga.monitor.get_sync_lines = vga_get_crtc_sync_lines;
12811281   vga.monitor.get_sync_columns = vga_get_crtc_sync_columns;
1282   timer_pulse(machine, attotime::from_hz(60), NULL, 0, vga_timer);
1282   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer));
12831283   pc_video_start(machine, NULL, pc_ega_choosevideomode, 0);
12841284}
12851285
r10315r10316
12941294   vga.monitor.get_columns=vga_get_crtc_columns;
12951295   vga.monitor.get_sync_lines=vga_get_crtc_sync_lines;
12961296   vga.monitor.get_sync_columns=vga_get_crtc_sync_columns;
1297   timer_pulse(machine, attotime::from_hz(60), NULL, 0, vga_timer);
1297   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer));
12981298   pc_video_start(machine, NULL, pc_vga_choosevideomode, 0);
12991299}
13001300
src/mess/video/911_vdt.c
r10315r10316
259259   else
260260      vdt->cursor_address_mask = 0x7ff;   /* 2 kb of RAM */
261261
262   timer_set(device->machine, attotime::zero, vdt, 0, setup_beep);
262   device->machine->scheduler().timer_set(attotime::zero, FUNC(setup_beep), 0, vdt);
263263
264264   /* set up cursor blink clock.  2Hz frequency -> .25s half-period. */
265   /*vdt->blink_clock =*/ timer_pulse(device->machine, attotime::from_msec(250), vdt, 0, blink_callback);
265   /*vdt->blink_clock =*/ device->machine->scheduler().timer_pulse(attotime::from_msec(250), FUNC(blink_callback), 0, vdt);
266266
267267   /* alloc beep timer */
268   vdt->beep_timer = timer_alloc(device->machine, beep_callback, NULL);
268   vdt->beep_timer = device->machine->scheduler().timer_alloc(FUNC(beep_callback));
269269}
270270
271271DEVICE_GET_INFO( vdt911 )
src/mess/video/gb.c
r10315r10316
12311231MACHINE_START( gb_video )
12321232{
12331233   gb_state *state = machine->driver_data<gb_state>();
1234   state->lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc, NULL);
1234   state->lcd.lcd_timer = machine->scheduler().timer_alloc(FUNC(gb_lcd_timer_proc));
12351235}
12361236
12371237MACHINE_START( gbc_video )
12381238{
12391239   gb_state *state = machine->driver_data<gb_state>();
1240   state->lcd.lcd_timer = timer_alloc(machine, gbc_lcd_timer_proc, NULL);
1240   state->lcd.lcd_timer = machine->scheduler().timer_alloc(FUNC(gbc_lcd_timer_proc));
12411241}
12421242
12431243void gb_video_reset( running_machine *machine, int mode )
r10315r10316
13111311      memcpy( state->lcd.gb_oam->base(), mgb_oam_fingerprint, 0x100 );
13121312
13131313      /* Make sure the VBlank interrupt is set when the first instruction gets executed */
1314      timer_set(machine,  machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), NULL, 0, gb_video_init_vbl );
1314      machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(gb_video_init_vbl));
13151315
13161316      /* Initialize some video registers */
13171317      gb_video_w( space, 0x0, 0x91 );    /* LCDCONT */
src/mess/video/gamecom.c
r10315r10316
6565{
6666   gamecom_state *state = machine->driver_data<gamecom_state>();
6767   VIDEO_START_CALL( generic_bitmapped );
68   state->scanline_timer = timer_alloc( machine, gamecom_scanline, NULL );
68   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(gamecom_scanline));
6969   timer_adjust_periodic( state->scanline_timer, machine->primary_screen->time_until_pos(0, 0 ), 0, machine->primary_screen->scan_period() );
7070
7171}
src/mess/video/mz700.c
r10315r10316
2323      if(VERBOSE>=N) \
2424      { \
2525         if( M ) \
26            logerror("%11.6f: %-24s",timer_get_time(machine).as_double(),(char*)M ); \
26            logerror("%11.6f: %-24s",machine->time().as_double(),(char*)M ); \
2727         logerror A; \
2828      } \
2929   } while (0)
src/mess/video/vectrex.c
r10315r10316
252252   if (!state->ramp)
253253   {
254254      length = cputag_get_clock(machine, "maincpu") * INT_PER_CLOCK
255         * (timer_get_time(machine) - state->vector_start_time).as_double();
255         * (machine->time() - state->vector_start_time).as_double();
256256
257257      state->x_int += length * (state->analog[A_X] + state->analog[A_ZR]);
258258      state->y_int += length * (state->analog[A_Y] + state->analog[A_ZR]);
r10315r10316
265265         (*state->vector_add_point_function)(machine, state->x_int, state->y_int, state->beam_color, 2 * state->analog[A_Z]);
266266   }
267267
268   state->vector_start_time = timer_get_time(machine);
268   state->vector_start_time = machine->time();
269269
270270   if (ptr)
271271      * (UINT8 *) ptr = param;
r10315r10316
292292   state->imager_freq = 1;
293293
294294   state->vector_add_point_function = vectrex_add_point;
295   state->imager_timer = timer_alloc(machine, vectrex_imager_eye, NULL);
295   state->imager_timer = machine->scheduler().timer_alloc(FUNC(vectrex_imager_eye));
296296   timer_adjust_periodic(state->imager_timer,
297297                    attotime::from_hz(state->imager_freq),
298298                    2,
299299                    attotime::from_hz(state->imager_freq));
300300
301   state->lp_t = timer_alloc(machine, lightpen_trigger, NULL);
301   state->lp_t = machine->scheduler().timer_alloc(FUNC(lightpen_trigger));
302302
303   state->refresh = timer_alloc(machine, vectrex_refresh, NULL);
303   state->refresh = machine->scheduler().timer_alloc(FUNC(vectrex_refresh));
304304
305305   VIDEO_START_CALL(vector);
306306}
r10315r10316
317317   vectrex_state *state = machine->driver_data<vectrex_state>();
318318   device_t *dac_device = machine->device("dac");
319319
320   timer_set(machine, attotime::from_nsec(ANALOG_DELAY), &state->analog[mux], state->via_out[PORTA], update_signal);
320   machine->scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), FUNC(update_signal), state->via_out[PORTA], &state->analog[mux]);
321321
322322   if (mux == A_AUDIO)
323323      dac_data_w(dac_device, state->via_out[PORTA]);
r10315r10316
373373      if (!(data & 0x1) && (state->via_out[PORTB] & 0x1))
374374      {
375375         /* MUX has been enabled */
376         timer_set(device->machine, attotime::from_nsec(ANALOG_DELAY), NULL, 0, update_signal);
376         device->machine->scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), FUNC(update_signal));
377377      }
378378   }
379379   else
r10315r10316
402402      vectrex_multiplexer (device->machine, (data >> 1) & 0x3);
403403
404404   state->via_out[PORTB] = data;
405   timer_set(device->machine, attotime::from_nsec(ANALOG_DELAY), &state->ramp, data & 0x80, update_signal);
405   device->machine->scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), FUNC(update_signal), data & 0x80, &state->ramp);
406406}
407407
408408
r10315r10316
411411   vectrex_state *state = device->machine->driver_data<vectrex_state>();
412412   /* DAC output always goes to Y integrator */
413413   state->via_out[PORTA] = data;
414   timer_set(device->machine, attotime::from_nsec(ANALOG_DELAY), &state->analog[A_Y], data, update_signal);
414   device->machine->scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), FUNC(update_signal), data, &state->analog[A_Y]);
415415
416416   if (!(state->via_out[PORTB] & 0x1))
417417      vectrex_multiplexer (device->machine, (state->via_out[PORTB] >> 1) & 0x3);
r10315r10316
421421static WRITE8_DEVICE_HANDLER(v_via_ca2_w)
422422{
423423   if (data == 0)
424      timer_set(device->machine, attotime::from_nsec(ANALOG_DELAY), NULL, 0, vectrex_zero_integrators);
424      device->machine->scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), FUNC(vectrex_zero_integrators));
425425}
426426
427427
r10315r10316
446446            dx = abs(state->pen_x - state->x_int);
447447            dy = abs(state->pen_y - state->y_int);
448448            if (dx < 500000 && dy < 500000 && data > 0)
449               timer_set(device->machine, attotime::zero, NULL, 0, lightpen_trigger);
449               device->machine->scheduler().timer_set(attotime::zero, FUNC(lightpen_trigger));
450450         }
451451      }
452452
453      timer_set(device->machine, attotime::zero, &state->blank, data, update_signal);
453      device->machine->scheduler().timer_set(attotime::zero, FUNC(update_signal), data, &state->blank);
454454      state->cb2 = data;
455455   }
456456}
r10315r10316
490490   state->y_max = visarea.max_y << 16;
491491
492492   state->vector_add_point_function = vectrex_add_point;
493   state->refresh = timer_alloc(machine, vectrex_refresh, NULL);
493   state->refresh = machine->scheduler().timer_alloc(FUNC(vectrex_refresh));
494494
495495   VIDEO_START_CALL(vector);
496496}
src/mess/video/aim65.c
r10315r10316
131131VIDEO_START( aim65 )
132132{
133133   aim65_state *state = machine->driver_data<aim65_state>();
134   state->print_timer = timer_alloc(machine, aim65_printer_timer, NULL);
134   state->print_timer = machine->scheduler().timer_alloc(FUNC(aim65_printer_timer));
135135
136136#if 0
137137   videoram_size = 600 * 10 * 2;
src/mess/video/m6847.c
r10315r10316
13491349   mc6847_state *mc6847 = (mc6847_state *) ptr;
13501350
13511351   if (LOG_HS)
1352      logerror("hs_fall(): time=%s\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION));
1352      logerror("hs_fall(): time=%s\n", machine->time().as_string(ATTOTIME_STRING_PRECISION));
13531353
13541354   mc6847->hs = ASSERT_LINE;
13551355   devcb_call_write_line(&mc6847->out_hs_func, mc6847->hs);
r10315r10316
13601360   mc6847_state *mc6847 = (mc6847_state *) ptr;
13611361
13621362   if (LOG_HS)
1363      logerror("hs_rise(): time=%s\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION));
1363      logerror("hs_rise(): time=%s\n", machine->time().as_string(ATTOTIME_STRING_PRECISION));
13641364
13651365   timer_adjust_oneshot(mc6847->hs_rise_timer,
13661366      attotime(0, mc6847->scanline_period), 0);
r10315r10316
13781378   mc6847_state *mc6847 = (mc6847_state *) ptr;
13791379
13801380   if (LOG_FS)
1381      logerror("fs_fall(): time=%s scanline=%d\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION), get_scanline(mc6847));
1381      logerror("fs_fall(): time=%s scanline=%d\n", machine->time().as_string(ATTOTIME_STRING_PRECISION), get_scanline(mc6847));
13821382
13831383   mc6847->fs = ASSERT_LINE;
13841384   devcb_call_write_line(&mc6847->out_fs_func, mc6847->fs);
r10315r10316
13891389   mc6847_state *mc6847 = (mc6847_state *) ptr;
13901390
13911391   if (LOG_FS)
1392      logerror("fs_rise(): time=%s scanline=%d\n", timer_get_time(machine).as_string(ATTOTIME_STRING_PRECISION), get_scanline(mc6847));
1392      logerror("fs_rise(): time=%s scanline=%d\n", machine->time().as_string(ATTOTIME_STRING_PRECISION), get_scanline(mc6847));
13931393
13941394   /* adjust field sync falling edge timer */
13951395   timer_adjust_oneshot(mc6847->fs_fall_timer,
r10315r10316
18651865   }
18661866
18671867   /* allocate timers */
1868   mc6847->fs_rise_timer = timer_alloc(device->machine, fs_rise, mc6847);
1869   mc6847->fs_fall_timer = timer_alloc(device->machine, fs_fall, mc6847);
1870   mc6847->hs_rise_timer = timer_alloc(device->machine, hs_rise, mc6847);
1871   mc6847->hs_fall_timer = timer_alloc(device->machine, hs_fall, mc6847);
1868   mc6847->fs_rise_timer = device->machine->scheduler().timer_alloc(FUNC(fs_rise), mc6847);
1869   mc6847->fs_fall_timer = device->machine->scheduler().timer_alloc(FUNC(fs_fall), mc6847);
1870   mc6847->hs_rise_timer = device->machine->scheduler().timer_alloc(FUNC(hs_rise), mc6847);
1871   mc6847->hs_fall_timer = device->machine->scheduler().timer_alloc(FUNC(hs_fall), mc6847);
18721872
18731873   /* setup dimensions */
18741874   mc6847->top_border_scanlines = v->top_border_scanlines;
src/mess/video/thomson.c
r10315r10316
203203
204204void thom_set_lightpen_callback ( running_machine *machine, int nb, void (*cb) ( running_machine *machine, int step ) )
205205{
206   LOG (( "%f thom_set_lightpen_callback called\n", timer_get_time(machine).as_double()));
206   LOG (( "%f thom_set_lightpen_callback called\n", machine->time().as_double()));
207207   thom_lightpen_nb = nb;
208208   thom_lightpen_cb = cb;
209209}
r10315r10316
913913   rectangle lrect = { 0, xbleft - 1, 0, 0 };
914914   rectangle rrect = { xbright, xright - 1, 0, 0 };
915915
916   //LOG (( "%f thom: video update called\n", timer_get_time(machine).as_double()));
916   //LOG (( "%f thom: video update called\n", machine->time().as_double()));
917917
918918   /* upper border */
919919   for ( y = 0; y < THOM_BORDER_HEIGHT - thom_bheight; y++ )
r10315r10316
10251025static TIMER_CALLBACK( thom_set_init )
10261026{
10271027   int init = param;
1028   LOG (( "%f thom_set_init: %i, at line %i col %i\n", timer_get_time(machine).as_double(), init, thom_video_elapsed( machine ) / 64, thom_video_elapsed( machine ) % 64 ));
1028   LOG (( "%f thom_set_init: %i, at line %i col %i\n", machine->time().as_double(), init, thom_video_elapsed( machine ) / 64, thom_video_elapsed( machine ) % 64 ));
10291029
10301030   if ( thom_init_cb )
10311031      thom_init_cb( machine, init );
r10315r10316
10411041   UINT16 b = 0;
10421042   struct thom_vsignal l = thom_get_lightpen_vsignal( machine, 0, -1, 0 );
10431043
1044   LOG (( "%f thom: video eof called\n", timer_get_time(machine).as_double() ));
1044   LOG (( "%f thom: video eof called\n", machine->time().as_double() ));
10451045
10461046   /* floppy indicator count */
10471047   if ( thom_floppy_wcount )
r10315r10316
11531153   state_save_register_global(machine,  thom_floppy_rcount );
11541154   output_set_value( "floppy", 0 );
11551155
1156   thom_video_timer = timer_alloc(machine,  NULL , NULL);
1156   thom_video_timer = machine->scheduler().timer_alloc(FUNC(NULL));
11571157
1158   thom_scanline_timer = timer_alloc(machine,  thom_scanline_start , NULL);
1158   thom_scanline_timer = machine->scheduler().timer_alloc(FUNC(thom_scanline_start));
11591159
11601160   thom_lightpen_nb = 0;
11611161   thom_lightpen_cb = NULL;
1162   thom_lightpen_timer = timer_alloc(machine,  thom_lightpen_step , NULL);
1162   thom_lightpen_timer = machine->scheduler().timer_alloc(FUNC(thom_lightpen_step));
11631163   state_save_register_global(machine,  thom_lightpen_nb );
11641164
11651165   thom_init_cb = NULL;
1166   thom_init_timer = timer_alloc(machine,  thom_set_init , NULL);
1166   thom_init_timer = machine->scheduler().timer_alloc(FUNC(thom_set_init));
11671167
11681168   state_save_register_global(machine,  thom_bwidth );
11691169   state_save_register_global(machine,  thom_bheight );
src/mess/video/x68k.c
r10315r10316
287287      // end of HBlank period clears GPIP6 also?
288288      end_time = machine->primary_screen->time_until_pos(scan,state->crtc.hend);
289289      timer_adjust_oneshot(state->raster_irq, irq_time, scan);
290      timer_set(machine, end_time,NULL,0,x68k_crtc_raster_end);
290      machine->scheduler().timer_set(end_time, FUNC(x68k_crtc_raster_end));
291291      logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,machine->primary_screen->vpos());
292292   }
293293}
r10315r10316
448448      if(data & 0x08)  // text screen raster copy
449449      {
450450         x68k_crtc_text_copy(state, (state->crtc.reg[22] & 0xff00) >> 8,(state->crtc.reg[22] & 0x00ff));
451         timer_set(space->machine, attotime::from_msec(1), NULL, 0x02,x68k_crtc_operation_end);  // time taken to do operation is a complete guess.
451         space->machine->scheduler().timer_set(attotime::from_msec(1), FUNC(x68k_crtc_operation_end), 0x02);  // time taken to do operation is a complete guess.
452452      }
453453      if(data & 0x02)  // high-speed graphic screen clear
454454      {
455455         memset(state->gvram,0,0x40000);
456         timer_set(space->machine, attotime::from_msec(10), NULL, 0x02,x68k_crtc_operation_end);  // time taken to do operation is a complete guess.
456         space->machine->scheduler().timer_set(attotime::from_msec(10), FUNC(x68k_crtc_operation_end), 0x02);  // time taken to do operation is a complete guess.
457457      }
458458      break;
459459   }
src/mess/video/crtc_ega.c
r10315r10316
739739
740740      /* create the timers */
741741      if (crtc_ega->intf->on_de_changed != NULL)
742         crtc_ega->de_changed_timer = timer_alloc(device->machine, de_changed_timer_cb, (void *)device);
742         crtc_ega->de_changed_timer = device->machine->scheduler().timer_alloc(FUNC(de_changed_timer_cb), (void *)device);
743743
744744      if (crtc_ega->intf->on_hsync_changed != NULL)
745745      {
746         crtc_ega->hsync_on_timer = timer_alloc(device->machine, hsync_on_timer_cb, (void *)device);
747         crtc_ega->hsync_off_timer = timer_alloc(device->machine, hsync_off_timer_cb, (void *)device);
746         crtc_ega->hsync_on_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_on_timer_cb), (void *)device);
747         crtc_ega->hsync_off_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_off_timer_cb), (void *)device);
748748      }
749749
750750      if (crtc_ega->intf->on_vsync_changed != NULL)
751751      {
752         crtc_ega->vsync_on_timer = timer_alloc(device->machine, vsync_on_timer_cb, (void *)device);
753         crtc_ega->vsync_off_timer = timer_alloc(device->machine, vsync_off_timer_cb, (void *)device);
752         crtc_ega->vsync_on_timer = device->machine->scheduler().timer_alloc(FUNC(vsync_on_timer_cb), (void *)device);
753         crtc_ega->vsync_off_timer = device->machine->scheduler().timer_alloc(FUNC(vsync_off_timer_cb), (void *)device);
754754      }
755755
756756      if (crtc_ega->intf->on_vblank_changed != NULL)
757757      {
758         crtc_ega->vblank_on_timer = timer_alloc(device->machine, vblank_on_timer_cb, (void *)device);
759         crtc_ega->vblank_off_timer = timer_alloc(device->machine, vblank_off_timer_cb, (void *)device);
758         crtc_ega->vblank_on_timer = device->machine->scheduler().timer_alloc(FUNC(vblank_on_timer_cb), (void *)device);
759         crtc_ega->vblank_off_timer = device->machine->scheduler().timer_alloc(FUNC(vblank_off_timer_cb), (void *)device);
760760      }
761761   }
762762
763   crtc_ega->light_pen_latch_timer = timer_alloc(device->machine, light_pen_latch_timer_cb, (void *)device);
763   crtc_ega->light_pen_latch_timer = device->machine->scheduler().timer_alloc(FUNC(light_pen_latch_timer_cb), (void *)device);
764764
765765   /* register for state saving */
766766
src/mess/video/atarist.c
r10315r10316
10581058            m_mfp->i3_w(m_blitter_done);
10591059
10601060            int nops = BLITTER_NOPS[m_blitter_op][m_blitter_hop]; // each NOP takes 4 cycles
1061            timer_set(machine, attotime::from_hz((Y2/4)/(4*nops)), NULL, 0, atarist_blitter_tick);
1061            machine->scheduler().timer_set(attotime::from_hz((Y2/4)/(4*nops)), FUNC(atarist_blitter_tick));
10621062         }
10631063      }
10641064   }
r10315r10316
10801080
10811081void st_state::video_start()
10821082{
1083   m_shifter_timer = timer_alloc(machine, atarist_shifter_tick, NULL);
1084   m_glue_timer = timer_alloc(machine, atarist_glue_tick, NULL);
1083   m_shifter_timer = machine->scheduler().timer_alloc(FUNC(atarist_shifter_tick));
1084   m_glue_timer = machine->scheduler().timer_alloc(FUNC(atarist_glue_tick));
10851085
10861086//   timer_adjust_periodic(m_shifter_timer, machine->primary_screen->time_until_pos(0,0), 0, attotime::from_hz(Y2/4)); // 125 ns
10871087   timer_adjust_periodic(m_glue_timer, machine->primary_screen->time_until_pos(0,0), 0, attotime::from_hz(Y2/16)); // 500 ns
src/mess/video/crtc6845.c
r10315r10316
109109   int idx;
110110
111111   crtc = auto_alloc_clear(machine, struct mscrtc6845);
112   crtc->cursor_time = timer_get_time(machine).as_double();
112   crtc->cursor_time = machine->time().as_double();
113113   crtc->config = *config;
114114   mscrtc6845 = crtc;
115115
r10315r10316
152152   double neu, ftime;
153153   struct mscrtc6845_cursor cursor;
154154
155   neu = timer_get_time(machine).as_double();
155   neu = machine->time().as_double();
156156
157157   if (mscrtc6845_clocks_in_frame(crtc) == 0.0)
158158      return;
src/mess/video/oric.c
r10315r10316
3737   /* initialise flash timer */
3838   state->vh_state.flash_count = 0;
3939   state->vh_state.flash_state = 0;
40   timer_pulse(machine, attotime::from_hz(50), NULL, 0, oric_vh_timer_callback);
40   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(oric_vh_timer_callback));
4141   /* mode */
4242   oric_vh_update_attribute(machine,(1<<3)|(1<<4));
4343}
src/mess/video/upd7220.c
r10315r10316
10941094   assert(upd7220->screen != NULL);
10951095
10961096   /* create the timers */
1097   upd7220->vsync_timer = timer_alloc(device->machine, vsync_tick, (void *)device);
1098   upd7220->hsync_timer = timer_alloc(device->machine, hsync_tick, (void *)device);
1099   upd7220->blank_timer = timer_alloc(device->machine, blank_tick, (void *)device);
1097   upd7220->vsync_timer = device->machine->scheduler().timer_alloc(FUNC(vsync_tick), (void *)device);
1098   upd7220->hsync_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_tick), (void *)device);
1099   upd7220->blank_timer = device->machine->scheduler().timer_alloc(FUNC(blank_tick), (void *)device);
11001100
11011101   /* set initial values */
11021102   upd7220->fifo_ptr = -1;
src/mess/video/vic4567.c
r10315r10316
106106      if(VERBOSE_LEVEL >= N) \
107107      { \
108108         if( M ) \
109            logerror("%11.6f: %-24s", timer_get_time(device->machine).as_double(), (char*) M ); \
109            logerror("%11.6f: %-24s", device->machine->time().as_double(), (char*) M ); \
110110         logerror A; \
111111      } \
112112   } while (0)
r10315r10316
19231923      if (LIGHTPEN_BUTTON)
19241924      {
19251925         /* lightpen timer start */
1926         timer_set(machine, attotime(0, 0), vic3, 1, vic3_timer_timeout);
1926         machine->scheduler().timer_set(attotime(0, 0), FUNC(vic3_timer_timeout), 1, vic3);
19271927      }
19281928
19291929   }
src/mess/video/crt9007.c
r10315r10316
546546void crt9007_device::device_start()
547547{
548548   // allocate timers
549   m_hsync_timer = device_timer_alloc(*this, TIMER_HSYNC);
550   m_vsync_timer = device_timer_alloc(*this, TIMER_VSYNC);
551   m_vlt_timer = device_timer_alloc(*this, TIMER_VLT);
552   m_curs_timer = device_timer_alloc(*this, TIMER_CURS);
553   m_drb_timer = device_timer_alloc(*this, TIMER_DRB);
554   m_dma_timer = device_timer_alloc(*this, TIMER_DMA);
549   m_hsync_timer = timer_alloc(TIMER_HSYNC);
550   m_vsync_timer = timer_alloc(TIMER_VSYNC);
551   m_vlt_timer = timer_alloc(TIMER_VLT);
552   m_curs_timer = timer_alloc(TIMER_CURS);
553   m_drb_timer = timer_alloc(TIMER_DRB);
554   m_dma_timer = timer_alloc(TIMER_DMA);
555555
556556   // resolve callbacks
557557   devcb_resolve_write_line(&m_out_int_func, &m_config.out_int_func, this);
src/mess/video/electron.c
r10315r10316
4646      state->map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 );
4747      state->map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 );
4848   }
49   state->scanline_timer = timer_alloc( machine, electron_scanline_interrupt, NULL );
49   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(electron_scanline_interrupt));
5050   timer_adjust_periodic( state->scanline_timer,  machine->primary_screen->time_until_pos(0), 0, machine->primary_screen->scan_period() );
5151}
5252
src/mess/video/zx8301.c
r10315r10316
184184    devcb_resolve_write_line(&m_out_vsync_func, &m_config.out_vsync_func, this);
185185   
186186   // allocate timers
187   m_vsync_timer = device_timer_alloc(*this, TIMER_VSYNC);
188   m_flash_timer = device_timer_alloc(*this, TIMER_FLASH);
187   m_vsync_timer = timer_alloc(TIMER_VSYNC);
188   m_flash_timer = timer_alloc(TIMER_FLASH);
189189
190190   // adjust timer periods
191191   timer_adjust_periodic(m_vsync_timer, attotime::zero, 0, attotime::from_hz(50));
src/mess/video/vtvideo.c
r10315r10316
314314   assert(vt->gfx != NULL);
315315
316316    // LBA7 is scan line frequency update
317   timer_pulse(device->machine, attotime::from_nsec(31778), (void *) device, 0, lba7_change);
317   device->machine->scheduler().timer_pulse(attotime::from_nsec(31778), FUNC(lba7_change), 0, (void *) device);
318318}
319319
320320
src/mess/video/apple1.c
r10315r10316
378378       number of one-third-cycles elapsed, then checking the result
379379       modulo 3. */
380380
381   if (((int) (timer_get_time(machine).as_double() / CURSOR_OFF_LENGTH)) % 3 < 2)
381   if (((int) (machine->time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2)
382382      new_blink_on = 1;
383383   else
384384      new_blink_on = 0;
src/mess/video/pc_mda.c
r10315r10316
1818      if(VERBOSE_MDA>=N) \
1919      { \
2020         if( M ) \
21            logerror("%11.6f: %-24s",timer_get_time(machine).as_double(),(char*)M ); \
21            logerror("%11.6f: %-24s",machine->time().as_double(),(char*)M ); \
2222         logerror A; \
2323      } \
2424   } while (0)
src/mess/video/fmtowns.c
r10315r10316
18061806   pic8259_ir3_w(dev, 1);  // IRQ11 = VSync
18071807   if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set high\n");
18081808   state->video.towns_vblank_flag = 1;
1809   timer_set(device->machine,device->machine->primary_screen->time_until_vblank_end(),(void*)dev,0,towns_vblank_end);
1809   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_vblank_end(), FUNC(towns_vblank_end), 0, (void*)dev);
18101810   if(state->video.towns_tvram_enable)
18111811      draw_text_layer(dev->machine);
18121812   if(state->video.towns_sprite_reg[1] & 0x80)
r10315r10316
18191819
18201820   state->video.towns_vram_wplane = 0x00;
18211821   state->video.towns_sprite_page = 0;
1822   state->video.sprite_timer = timer_alloc(machine,towns_sprite_done,NULL);
1822   state->video.sprite_timer = machine->scheduler().timer_alloc(FUNC(towns_sprite_done));
18231823}
18241824
18251825VIDEO_UPDATE( towns )
src/mess/video/hd44780.c
r10315r10316
111111
112112void hd44780_device::device_start()
113113{
114   m_busy_timer = device_timer_alloc(*this, BUSY_TIMER);
115   m_blink_timer = device_timer_alloc(*this, BLINKING_TIMER);
114   m_busy_timer = timer_alloc(BUSY_TIMER);
115   m_blink_timer = timer_alloc(BLINKING_TIMER);
116116
117117   timer_adjust_periodic(m_blink_timer, attotime::from_msec(409), 0, attotime::from_msec(409));
118118
src/mess/video/vdc8563.c
r10315r10316
5959      if (VERBOSE_LEVEL >= N) \
6060      { \
6161         if (M) \
62            logerror("%11.6f: %-24s",timer_get_time(device->machine).as_double(),(char*)M ); \
62            logerror("%11.6f: %-24s",device->machine->time().as_double(),(char*)M ); \
6363         logerror A; \
6464      } \
6565   } while (0)
r10315r10316
364364{
365365   vdc8563_state *vdc8563 = get_safe_token(device);
366366   double newtime, ftime;
367   newtime = timer_get_time(device->machine).as_double();
367   newtime = device->machine->time().as_double();
368368
369369   if (vdc8563_clocks_in_frame(device) == 0.0)
370370      return;
src/mess/video/coco3.c
r10315r10316
801801   }
802802
803803   /* GIME field sync timer */
804   video->gime_fs_timer = timer_alloc(machine, gime_fs, NULL);
804   video->gime_fs_timer = machine->scheduler().timer_alloc(FUNC(gime_fs));
805805
806806   /* initialize the CoCo video code */
807807   memset(&cfg, 0, sizeof(cfg));
src/mess/video/pc_cga.c
r10315r10316
9090      if(VERBOSE_CGA>=N) \
9191      { \
9292         if( M ) \
93            logerror("%11.6f: %-24s",timer_get_time(machine).as_double(),(char*)M ); \
93            logerror("%11.6f: %-24s",machine->time().as_double(),(char*)M ); \
9494         logerror A; \
9595      } \
9696   } while (0)
src/mess/video/smsvdp.c
r10315r10316
353353   {
354354      if (vpos == vpos_limit)
355355      {
356         timer_set(machine, machine->primary_screen->time_until_pos(vpos, HINT_HPOS), smsvdp, 0, smsvdp_check_hint);
356         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(vpos, HINT_HPOS), FUNC(smsvdp_check_hint),0 ,smsvdp);
357357      }
358358      else
359359      {
r10315r10316
362362
363363      if (vpos == vpos_limit + 1)
364364      {
365         timer_set(machine, machine->primary_screen->time_until_pos(vpos, VINT_FLAG_HPOS), smsvdp, (int)STATUS_VINT, smsvdp_set_status);
366         timer_set(machine, machine->primary_screen->time_until_pos(vpos, VINT_HPOS), smsvdp, 0, smsvdp_check_vint);
365         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(vpos, VINT_FLAG_HPOS), FUNC(smsvdp_set_status), (int)STATUS_VINT, smsvdp);
366         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(vpos, VINT_HPOS), FUNC(smsvdp_check_vint), 0, smsvdp);
367367      }
368368
369369      sms_update_palette(smsvdp);
r10315r10316
395395         smsvdp->reg9copy = smsvdp->reg[0x09];
396396      }
397397
398      timer_set(machine, machine->primary_screen->time_until_pos(vpos, HINT_HPOS), smsvdp, 0, smsvdp_check_hint);
398      machine->scheduler().timer_set(machine->primary_screen->time_until_pos(vpos, HINT_HPOS), FUNC(smsvdp_check_hint),0, smsvdp);
399399
400400      sms_update_palette(smsvdp);
401401
r10315r10316
565565
566566         if (reg_num == 1)
567567         {
568            timer_set(device->machine, device->machine->primary_screen->time_until_pos(device->machine->primary_screen->vpos(), VINT_HPOS), smsvdp, 0, smsvdp_check_vint);
568            device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(device->machine->primary_screen->vpos(), VINT_HPOS), FUNC(smsvdp_check_vint),0 ,smsvdp);
569569         }
570570         smsvdp->addrmode = 0;
571571         break;
r10315r10316
706706         else if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V])
707707         {
708708            /* Too many sprites per line */
709            timer_set(machine, machine->primary_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), smsvdp, (int)STATUS_SPROVR, smsvdp_set_status);
709            machine->scheduler().timer_set(machine->primary_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), FUNC(smsvdp_set_status), (int)STATUS_SPROVR, smsvdp);
710710         }
711711         sprite_buffer_count++;
712712      }
r10315r10316
861861         }
862862      }
863863      if (sprite_col_occurred)
864         timer_set(machine, machine->primary_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), smsvdp, (int)STATUS_SPRCOL, smsvdp_set_status);
864         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), FUNC(smsvdp_set_status), (int)STATUS_SPRCOL, smsvdp);
865865   }
866866
867867   /* Fill column 0 with overscan color from reg[0x07] */
r10315r10316
913913         else if (line >= 0 && line < smsvdp->sms_frame_timing[ACTIVE_DISPLAY_V])
914914         {
915915            /* Too many sprites per line */
916            timer_set(machine, machine->primary_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), smsvdp, (int)STATUS_SPROVR, smsvdp_set_status);
916            machine->scheduler().timer_set(machine->primary_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), FUNC(smsvdp_set_status), (int)STATUS_SPROVR, smsvdp);
917917         }
918918         sprite_buffer_count++;
919919      }
r10315r10316
11251125         }
11261126      }
11271127      if (sprite_col_occurred)
1128         timer_set(machine, machine->primary_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), smsvdp, (int)STATUS_SPRCOL, smsvdp_set_status);
1128         machine->scheduler().timer_set(machine->primary_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), FUNC(smsvdp_set_status), (int)STATUS_SPRCOL, smsvdp);
11291129   }
11301130}
11311131
r10315r10316
14461446   /* Make temp bitmap for rendering */
14471447   smsvdp->tmpbitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED32);
14481448
1449   smsvdp->smsvdp_display_timer = timer_alloc(device->machine, smsvdp_display_callback, smsvdp);
1449   smsvdp->smsvdp_display_timer = device->machine->scheduler().timer_alloc(FUNC(smsvdp_display_callback), smsvdp);
14501450   timer_adjust_periodic(smsvdp->smsvdp_display_timer, screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, screen->scan_period());
14511451
14521452   state_save_register_device_item(device, 0, smsvdp->status);
src/mess/video/ef9345.c
r10315r10316
173173
174174   assert(m_screen != NULL);
175175
176   m_busy_timer = device_timer_alloc(*this, BUSY_TIMER);
177   m_blink_timer = device_timer_alloc(*this, BLINKING_TIMER);
176   m_busy_timer = timer_alloc(BUSY_TIMER);
177   m_blink_timer = timer_alloc(BLINKING_TIMER);
178178
179179   m_videoram = space(0);
180180   m_charset = region();
src/mess/video/vic6567.c
r10315r10316
175175      if(VERBOSE_LEVEL >= N) \
176176      { \
177177         if( M ) \
178            logerror("%11.6f: %-24s", timer_get_time(machine).as_double(), (char*) M ); \
178            logerror("%11.6f: %-24s", machine->time().as_double(), (char*) M ); \
179179         logerror A; \
180180      } \
181181   } while (0)
r10315r10316
10461046//          if (LIGHTPEN_BUTTON)
10471047         {
10481048            /* lightpen timer start */
1049            timer_set(machine, attotime(0, 0), vic2, 1, vic2_timer_timeout);
1049            machine->scheduler().timer_set(attotime(0, 0), FUNC(vic2_timer_timeout), 1, vic2);
10501050         }
10511051      }
10521052      else
r10315r10316
16151615   }
16161616
16171617   vic2->raster_x += 8;
1618   timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), vic2, 0, pal_timer_callback);
1618   machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(pal_timer_callback), 0, vic2);
16191619}
16201620
16211621static TIMER_CALLBACK( ntsc_timer_callback )
r10315r10316
16371637//          if (LIGHTPEN_BUTTON)
16381638         {
16391639            /* lightpen timer starten */
1640            timer_set(machine, attotime(0, 0), vic2, 1, vic2_timer_timeout);
1640            machine->scheduler().timer_set(attotime(0, 0), FUNC(vic2_timer_timeout), 1, vic2);
16411641         }
16421642      }
16431643      else
r10315r10316
21942194   }
21952195
21962196   vic2->raster_x += 8;
2197   timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), vic2, 0, ntsc_timer_callback);
2197   machine->scheduler().timer_set(machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(ntsc_timer_callback), 0, vic2);
21982198}
21992199
22002200
r10315r10316
26232623
26242624   // immediately call the timer to handle the first line
26252625   if (vic2->type == VIC6569 || vic2->type == VIC8566)
2626      timer_set(device->machine, downcast<cpu_device *>(vic2->cpu)->cycles_to_attotime(0), vic2, 0, pal_timer_callback);
2626      device->machine->scheduler().timer_set(downcast<cpu_device *>(vic2->cpu)->cycles_to_attotime(0), FUNC(pal_timer_callback), 0, vic2);
26272627   else
2628      timer_set(device->machine, downcast<cpu_device *>(vic2->cpu)->cycles_to_attotime(0), vic2, 0, ntsc_timer_callback);
2628      device->machine->scheduler().timer_set(downcast<cpu_device *>(vic2->cpu)->cycles_to_attotime(0), FUNC(ntsc_timer_callback), 0, vic2);
26292629
26302630   for (i = 0; i < 256; i++)
26312631   {
src/mess/video/odyssey2.c
r10315r10316
592592
593593   state->tmp_bitmap = auto_bitmap_alloc( machine, width, height, screen->format() );
594594
595   state->i824x_line_timer = timer_alloc(machine,  i824x_scanline_callback, NULL );
595   state->i824x_line_timer = machine->scheduler().timer_alloc(FUNC(i824x_scanline_callback));
596596   timer_adjust_periodic( state->i824x_line_timer, machine->primary_screen->time_until_pos(1, I824X_START_ACTIVE_SCAN ), 0,  machine->primary_screen->scan_period() );
597597
598   state->i824x_hblank_timer = timer_alloc(machine,  i824x_hblank_callback, NULL );
598   state->i824x_hblank_timer = machine->scheduler().timer_alloc(FUNC(i824x_hblank_callback));
599599   timer_adjust_periodic( state->i824x_hblank_timer, machine->primary_screen->time_until_pos(1, I824X_END_ACTIVE_SCAN + 18 ), 0, machine->primary_screen->scan_period() );
600600}
601601
src/mess/video/m6845.c
r10315r10316
829829
830830   m6845_remove_vsync_set_timer();
831831
832   //crtc.vsync_set_timer = timer_alloc(machine, m6845_vsync_set_timer_callback, NULL);
832   //crtc.vsync_set_timer = machine->scheduler().timer_alloc(FUNC(m6845_vsync_set_timer_callback));
833833   if (crtc_cycles_to_vsync_start!=-1)
834834   {
835835      timer_adjust_oneshot(crtc.vsync_set_timer, attotime::from_usec(crtc_cycles_to_vsync_start), 0);
r10315r10316
846846   /* get number of cycles to end of vsync */
847847   crtc_cycles_to_vsync_end = cycles;
848848
849   //crtc.vsync_clear_timer = timer_alloc(machine, m6845_vsync_clear_timer_callback, NULL);
849   //crtc.vsync_clear_timer = machine->scheduler().timer_alloc(FUNC(m6845_vsync_clear_timer_callback));
850850   if (crtc_cycles_to_vsync_end!=-1)
851851   {
852852      timer_adjust_oneshot(crtc.vsync_clear_timer, attotime::from_usec(crtc_cycles_to_vsync_end), 0);
src/mess/video/apple2.c
r10315r10316
442442   running_machine *machine = screen->machine;
443443
444444   /* calculate the state->flash value */
445   state->flash = ((timer_get_time(screen->machine) * 4).seconds & 1) ? 1 : 0;
445   state->flash = ((screen->machine->time() * 4).seconds & 1) ? 1 : 0;
446446
447447   /* read out relevant softswitch variables; to see what has changed */
448448   new_a2 = effective_a2(state);
src/mess/video/hd61830.c
r10315r10316
202202void hd61830_device::device_start()
203203{
204204   // allocate timers
205   m_busy_timer = device_timer_alloc(*this);
205   m_busy_timer = timer_alloc();
206206
207207   // resolve callbacks
208208    devcb_resolve_read8(&m_in_rd_func, &m_config.m_in_rd_func, this);
src/mess/video/galaxy.c
r10315r10316
115115   galaxy_state *state = machine->driver_data<galaxy_state>();
116116   state->gal_cnt = 0;
117117
118   state->gal_video_timer = timer_alloc(machine, gal_video, NULL);
118   state->gal_video_timer = machine->scheduler().timer_alloc(FUNC(gal_video));
119119   timer_adjust_periodic(state->gal_video_timer, attotime::zero, 0, attotime::never);
120120
121121   VIDEO_START_CALL( generic_bitmapped );
src/mess/video/cdp1861.c
r10315r10316
266266   cdp1861->bitmap = auto_bitmap_alloc(device->machine, cdp1861->screen->width(), cdp1861->screen->height(), cdp1861->screen->format());
267267
268268   /* create the timers */
269   cdp1861->int_timer = timer_alloc(device->machine, cdp1861_int_tick, (void *)device);
270   cdp1861->efx_timer = timer_alloc(device->machine, cdp1861_efx_tick, (void *)device);
271   cdp1861->dma_timer = timer_alloc(device->machine, cdp1861_dma_tick, (void *)device);
269   cdp1861->int_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1861_int_tick), (void *)device);
270   cdp1861->efx_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1861_efx_tick), (void *)device);
271   cdp1861->dma_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1861_dma_tick), (void *)device);
272272
273273   /* register for state saving */
274274   state_save_register_device_item(device, 0, cdp1861->disp);
src/mess/video/k1ge.c
r10315r10316
828828   devcb_resolve_write8( &k1ge->vblank_pin_w, &k1ge->intf->vblank_pin_w, device );
829829   devcb_resolve_write8( &k1ge->hblank_pin_w, &k1ge->intf->hblank_pin_w, device );
830830
831   k1ge->timer = timer_alloc( device->machine, k1ge_timer_callback, (void *) device );
832   k1ge->hblank_on_timer = timer_alloc( device->machine, k1ge_hblank_on_timer_callback, (void *) device );
831   k1ge->timer = device->machine->scheduler().timer_alloc(FUNC(k1ge_timer_callback), (void *) device );
832   k1ge->hblank_on_timer = device->machine->scheduler().timer_alloc(FUNC(k1ge_hblank_on_timer_callback), (void *) device );
833833   k1ge->screen = device->machine->device<screen_device>(k1ge->intf->screen_tag);
834834   k1ge->vram = device->machine->region( k1ge->intf->vram_tag )->base();
835835   k1ge->bitmap = auto_bitmap_alloc( device->machine, k1ge->screen->width(), k1ge->screen->height(), k1ge->screen->format() );
src/mess/video/fm7.c
r10315r10316
635635
636636   // set timer to disable busy flag
637637   // 1/16 us for each byte changed
638   timer_set(machine,attotime::from_usec(byte_count/16),NULL,0,fm77av_alu_task_end);
638   machine->scheduler().timer_set(attotime::from_usec(byte_count/16), FUNC(fm77av_alu_task_end));
639639}
640640
641641READ8_HANDLER( fm7_vram_r )
src/mess/video/hd44352.c
r10315r10316
109109{
110110   devcb_resolve_write_line(&m_on, &m_config.m_on, this);
111111
112   m_on_timer = device_timer_alloc(*this, ON_TIMER);
112   m_on_timer = timer_alloc(ON_TIMER);
113113   timer_adjust_periodic(m_on_timer, attotime::from_hz(m_clock/16384), 0, attotime::from_hz(m_clock/16384));
114114
115115   state_save_register_device_item( this, 0, m_control_lines);
src/mess/includes/coco.h
r10315r10316
103103   int dgnalpha_just_reset;
104104   UINT8 *bas_rom_bank;
105105   UINT8 *bottom_32k;
106   timer_fired_func recalc_interrupts;
106   timer_expired_func recalc_interrupts;
107107   int hiresjoy_ca;
108108   attotime hiresjoy_xtransitiontime;
109109   attotime hiresjoy_ytransitiontime;
src/mess/formats/mz_cas.c
r10315r10316
77#endif
88
99//#define LOG(N,M,A)
10//  if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(machine).as_double(), (const char*)M ); logerror A; }
10//  if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",machine->time().as_double(), (const char*)M ); logerror A; }
1111
1212#define LOG(N,M,A)   \
1313   if(VERBOSE>=N){ if( M )logerror("%-24s",(const char*)M ); logerror A; }
src/mess/drivers/pb1000.c
r10315r10316
497497{
498498   memory_set_bankptr(machine, "bank1", machine->region("rom")->base());
499499
500   m_kb_timer = timer_alloc(machine, keyboard_timer, NULL);
500   m_kb_timer = machine->scheduler().timer_alloc(FUNC(keyboard_timer));
501501   timer_adjust_periodic(m_kb_timer, attotime::from_hz(192), 0, attotime::from_hz(192));
502502}
503503
src/mess/drivers/dectalk.c
r10315r10316
704704#ifdef VERBOSE
705705   if (data!= 0x8000) logerror("sample output: %04X\n", data);
706706#endif
707   timer_set(machine, attotime::from_hz(10000), NULL, 0, outfifo_read_cb);
707   machine->scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb));
708708   dac_signed_data_16_w( speaker, data );
709709}
710710
r10315r10316
714714   dectalk_state *state = machine->driver_data<dectalk_state>();
715715   dectalk_clear_all_fifos(machine);
716716   state->simulate_outfifo_error = 0;
717   timer_set(machine, attotime::from_hz(10000), NULL, 0,  outfifo_read_cb);
717   machine->scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb));
718718}
719719
720720static WRITE8_DEVICE_HANDLER( dectalk_kbd_put )
src/mess/drivers/osbexec.c
r10315r10316
597597   memset( state->fontram, 0x00, 0x1000 );
598598   memset( state->vram, 0x00, 0x2000 );
599599
600   state->video_timer = timer_alloc( machine, osbexec_video_callback, NULL );
600   state->video_timer = machine->scheduler().timer_alloc(FUNC(osbexec_video_callback));
601601}
602602
603603
src/mess/drivers/tec1.c
r10315r10316
184184static MACHINE_START( tec1 )
185185{
186186   tec1_state *state = machine->driver_data<tec1_state>();
187   state->m_kbd_timer = timer_alloc(machine,  tec1_kbd_callback, NULL );
187   state->m_kbd_timer = machine->scheduler().timer_alloc(FUNC(tec1_kbd_callback));
188188   timer_adjust_periodic( state->m_kbd_timer, attotime::zero, 0, attotime::from_hz(500) );
189189}
190190
src/mess/drivers/pc6001.c
r10315r10316
20452045{
20462046   pc6001_state *state = machine->driver_data<pc6001_state>();
20472047   /* TODO: accurate timing on this */
2048   timer_pulse(machine, attotime::from_hz(250), NULL, 0, keyboard_callback);
2048   machine->scheduler().timer_pulse(attotime::from_hz(250), FUNC(keyboard_callback));
20492049
2050   timer_pulse(machine, attotime::from_hz(1200/12), NULL, 0, cassette_callback); //1200 bauds / (1 start bit -> 8 data bits -> 3 stop bits)
2050   machine->scheduler().timer_pulse(attotime::from_hz(1200/12), FUNC(cassette_callback)); //1200 bauds / (1 start bit -> 8 data bits -> 3 stop bits)
20512051
20522052   state->timer_hz_div = 3;
20532053   {
20542054      attotime period = attotime::from_hz((487.5*4)/(state->timer_hz_div+1));
2055      state->timer_irq_timer = timer_alloc(machine, audio_callback, NULL);
2055      state->timer_irq_timer = machine->scheduler().timer_alloc(FUNC(audio_callback));
20562056      timer_adjust_periodic(state->timer_irq_timer, period,  0, period);
20572057   }
20582058}
src/mess/drivers/pc88va.c
r10315r10316
935935   //pc88va_state *state = space->machine->driver_data<pc88va_state>();
936936
937937   upd765_tc_w(space->machine->device("upd765"), 1);
938   timer_set(space->machine,  attotime::from_usec(500), NULL, 0, pc8801fd_upd765_tc_to_zero );
938   space->machine->scheduler().timer_set(attotime::from_usec(500), FUNC(pc8801fd_upd765_tc_to_zero));
939939   return 0;
940940}
941941
r10315r10316
15111511   pc88va_state *state = machine->driver_data<pc88va_state>();
15121512   cpu_set_irq_callback(machine->device("maincpu"), pc88va_irq_callback);
15131513
1514   state->t3_mouse_timer = timer_alloc(machine, t3_mouse_callback, 0);
1514   state->t3_mouse_timer = machine->scheduler().timer_alloc(FUNC(t3_mouse_callback));
15151515   timer_adjust_oneshot(state->t3_mouse_timer, attotime::never, 0);
15161516}
15171517
src/mess/drivers/mycom.c
r10315r10316
513513   state->cassette = machine->device("cassette");
514514   state->fdc = machine->device("fdc");
515515   state->RAM = machine->region("maincpu")->base();
516   timer_pulse(machine, attotime::from_hz(20), NULL, 0, mycom_kbd);
516   machine->scheduler().timer_pulse(attotime::from_hz(20), FUNC(mycom_kbd));
517517}
518518
519519static MACHINE_RESET(mycom)
src/mess/drivers/x1.c
r10315r10316
23422342static MACHINE_START( x1 )
23432343{
23442344   x1_state *state = machine->driver_data<x1_state>();
2345   timer_pulse(machine, attotime::from_hz(240), NULL, 0, keyboard_callback);
2346   timer_pulse(machine, attotime::from_hz(16), NULL, 0, cmt_wind_timer);
2345   machine->scheduler().timer_pulse(attotime::from_hz(240), FUNC(keyboard_callback));
2346   machine->scheduler().timer_pulse(attotime::from_hz(16), FUNC(cmt_wind_timer));
23472347
23482348   /* set up RTC */
23492349   {
r10315r10316
23582358      state->rtc.min = ((systime.local_time.minute / 10)<<4) | ((systime.local_time.minute % 10) & 0xf);
23592359      state->rtc.sec = ((systime.local_time.second / 10)<<4) | ((systime.local_time.second % 10) & 0xf);
23602360
2361      state->rtc_timer = timer_alloc(machine, x1_rtc_increment, 0);
2361      state->rtc_timer = machine->scheduler().timer_alloc(FUNC(x1_rtc_increment));
23622362   }
23632363}
23642364
src/mess/drivers/mk1.c
r10315r10316
171171
172172static MACHINE_START( mk1 )
173173{
174   timer_pulse(machine,  attotime::from_hz(30), NULL, 0, mk1_update_leds );
174   machine->scheduler().timer_pulse(attotime::from_hz(30), FUNC(mk1_update_leds));
175175}
176176
177177
src/mess/drivers/kim1.c
r10315r10316
287287   state_save_register_item(machine, "kim1", NULL, 0, state->u2_port_b );
288288   state_save_register_item(machine, "kim1", NULL, 0, state->_311_output );
289289   state_save_register_item(machine, "kim1", NULL, 0, state->cassette_high_count );
290   timer_pulse(machine,  attotime::from_hz(60), NULL, 0, kim1_update_leds );
291   timer_pulse(machine,  attotime::from_hz(44100), NULL, 0, kim1_cassette_input );
290   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(kim1_update_leds));
291   machine->scheduler().timer_pulse(attotime::from_hz(44100), FUNC(kim1_cassette_input));
292292}
293293
294294
src/mess/drivers/glasgow.c
r10315r10316
276276   mboard_key_selector = 0;
277277   state->irq_flag = 0;
278278   state->lcd_shift_counter = 3;
279   timer_pulse(machine, attotime::from_hz(50), NULL, 0, update_nmi);
280   timer_pulse(machine, attotime::from_hz(100), NULL, 0, mboard_update_artwork);
279   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(update_nmi));
280   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(mboard_update_artwork));
281281   beep_set_frequency(speaker, 44);
282282
283283   mboard_savestate_register(machine);
r10315r10316
290290   device_t *speaker = machine->device("beep");
291291
292292   state->lcd_shift_counter = 3;
293   timer_pulse(machine, attotime::from_hz(50), NULL, 0, update_nmi32);
294   timer_pulse(machine, attotime::from_hz(100), NULL, 0, mboard_update_artwork);
293   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(update_nmi32));
294   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(mboard_update_artwork));
295295   beep_set_frequency(speaker, 44);
296296
297297   mboard_savestate_register(machine);
src/mess/drivers/tm990189.c
r10315r10316
105105static MACHINE_START( tm990_189 )
106106{
107107   tm990189_state *state = machine->driver_data<tm990189_state>();
108   state->displayena_timer = timer_alloc(machine, NULL, NULL);
108   state->displayena_timer = machine->scheduler().timer_alloc(FUNC(NULL));
109109}
110110static const TMS9928a_interface tms9918_interface =
111111{
r10315r10316
120120   tm990189_state *state = machine->driver_data<tm990189_state>();
121121   TMS9928A_configure(&tms9918_interface);
122122
123   state->displayena_timer = timer_alloc(machine, NULL, NULL);
123   state->displayena_timer = machine->scheduler().timer_alloc(FUNC(NULL));
124124
125   state->joy1x_timer = timer_alloc(machine, NULL, NULL);
126   state->joy1y_timer = timer_alloc(machine, NULL, NULL);
127   state->joy2x_timer = timer_alloc(machine, NULL, NULL);
128   state->joy2y_timer = timer_alloc(machine, NULL, NULL);
125   state->joy1x_timer = machine->scheduler().timer_alloc(FUNC(NULL));
126   state->joy1y_timer = machine->scheduler().timer_alloc(FUNC(NULL));
127   state->joy2x_timer = machine->scheduler().timer_alloc(FUNC(NULL));
128   state->joy2y_timer = machine->scheduler().timer_alloc(FUNC(NULL));
129129}
130130
131131static MACHINE_RESET( tm990_189_v )
r10315r10316
279279   tm990189_state *state = machine->driver_data<tm990189_state>();
280280   state->load_state = TRUE;
281281   field_interrupts(machine);
282   timer_set(machine, attotime::from_msec(100), NULL, 0, clear_load);
282   machine->scheduler().timer_set(attotime::from_msec(100), FUNC(clear_load));
283283}
284284
285285/*
r10315r10316
403403{
404404   tm990189_state *state = image.device().machine->driver_data<tm990189_state>();
405405   tms9902_set_dsr(image.device().machine->device("tms9902"), 1);
406   state->rs232_input_timer = timer_alloc(image.device().machine, rs232_input_callback, (void*)image);
406   state->rs232_input_timer = image.device().machine->scheduler().timer_alloc(FUNC(rs232_input_callback), (void*)image);
407407   timer_adjust_periodic(state->rs232_input_timer, attotime::zero, 0, attotime::from_msec(10));
408408
409409   return IMAGE_INIT_PASS;
src/mess/drivers/smc777.c
r10315r10316
637637   for(i=0;i<0x4000;i++)
638638      state->wram[i] = rom[i];
639639
640   timer_pulse(machine, attotime::from_hz(240/32), NULL, 0, keyboard_callback);
640   machine->scheduler().timer_pulse(attotime::from_hz(240/32), FUNC(keyboard_callback));
641641   beep_set_frequency(machine->device("beeper"),300); //guesswork
642642   beep_set_state(machine->device("beeper"),0);
643643}
src/mess/drivers/scorpion.c
r10315r10316
345345}
346346static MACHINE_START( scorpion )
347347{
348   timer_pulse(machine, attotime::from_hz(50), NULL, 0, nmi_check_callback);
348   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(nmi_check_callback));
349349}
350350
351351
src/mess/drivers/abc80.c
r10315r10316
379379   if (!state->m_key_strobe && state->m_key_data)
380380   {
381381      z80pio_pa_w(state->m_pio, 0, state->m_key_data);
382      timer_set(machine, attotime::from_msec(50), NULL, 0, keyboard_data_clear);
382      machine->scheduler().timer_set(attotime::from_msec(50), FUNC(keyboard_data_clear));
383383   }
384384}
385385
src/mess/drivers/mpf1.c
r10315r10316
366366   state->speaker = machine->device(SPEAKER_TAG);
367367   state->cassette = machine->device(CASSETTE_TAG);
368368
369   state->led_refresh_timer = timer_alloc(machine, led_refresh, 0);
369   state->led_refresh_timer = machine->scheduler().timer_alloc(FUNC(led_refresh));
370370
371371   /* register for state saving */
372372   state_save_register_global(machine, state->_break);
373373   state_save_register_global(machine, state->m1);
374374   state_save_register_global(machine, state->lednum);
375375
376   timer_pulse(machine,  attotime::from_hz(1), NULL, 0, check_halt_callback);
376   machine->scheduler().timer_pulse(attotime::from_hz(1), FUNC(check_halt_callback));
377377}
378378
379379static MACHINE_RESET( mpf1 )
src/mess/drivers/atarist.c
r10315r10316
22702270   cpu_set_irq_callback(m_maincpu, atarist_int_ack);
22712271
22722272   // allocate timers
2273   m_mouse_timer = timer_alloc(machine, st_mouse_tick, NULL);
2273   m_mouse_timer = machine->scheduler().timer_alloc(FUNC(st_mouse_tick));
22742274   timer_adjust_periodic(m_mouse_timer, attotime::zero, 0, attotime::from_hz(500));
22752275   
22762276   // register for state saving
r10315r10316
23152315   cpu_set_irq_callback(m_maincpu, atarist_int_ack);
23162316
23172317   /* allocate timers */
2318   m_dmasound_timer = timer_alloc(machine, atariste_dmasound_tick, NULL);
2319   m_microwire_timer = timer_alloc(machine, atariste_microwire_tick, NULL);
2318   m_dmasound_timer = machine->scheduler().timer_alloc(FUNC(atariste_dmasound_tick));
2319   m_microwire_timer = machine->scheduler().timer_alloc(FUNC(atariste_microwire_tick));
23202320
23212321   /* register for state saving */
23222322   state_save();
src/mess/drivers/cat.c
r10315r10316
271271   cat_state *state = machine->driver_data<cat_state>();
272272
273273   state->duart_inp = 0x0e;
274   state->keyboard_timer = timer_alloc(machine, keyboard_callback, NULL);
274   state->keyboard_timer = machine->scheduler().timer_alloc(FUNC(keyboard_callback));
275275}
276276
277277static MACHINE_RESET(cat)
r10315r10316
324324
325325static MACHINE_RESET(swyft)
326326{
327   timer_set(machine, attotime::from_usec(10), NULL, 0, swyft_reset);
327   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(swyft_reset));
328328}
329329
330330static VIDEO_START( swyft )
src/mess/drivers/sg1000.c
r10315r10316
971971   TMS9928A_configure(&tms9928a_interface);
972972
973973   /* toggle light gun crosshair */
974   timer_set(machine, attotime::zero, NULL, 0, lightgun_tick);
974   machine->scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
975975
976976   /* register for state saving */
977977   state_save_register_global(machine, m_tvdraw_data);
r10315r10316
987987   TMS9928A_configure(&tms9928a_interface);
988988
989989   /* toggle light gun crosshair */
990   timer_set(machine, attotime::zero, NULL, 0, lightgun_tick);
990   machine->scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
991991
992992   /* register for state saving */
993993   state_save_register_global(machine, m_tvdraw_data);
src/mess/drivers/ip22.c
r10315r10316
10631063static TIMER_CALLBACK(ip22_dma)
10641064{
10651065   //ip22_state *state = machine->driver_data<ip22_state>();
1066   timer_set(machine, attotime::never, NULL, 0, ip22_dma);
1066   machine->scheduler().timer_set(attotime::never, FUNC(ip22_dma));
10671067#if 0
10681068   if( state->nPBUS_DMA_Active )
10691069   {
r10315r10316
10901090            return;
10911091         }
10921092      }
1093      timer_set(machine, attotime::from_hz(44100), NULL, 0, ip22_dma);
1093      machine->scheduler().timer_set(attotime::from_hz(44100), FUNC(ip22_dma));
10941094   }
10951095#endif
10961096}
r10315r10316
11621162      verboselog(machine, 0, "    FIFO End: Rowe %04x\n", ( data & PBUS_CTRL_FIFO_END ) >> 24 );
11631163      if( ( data & PBUS_CTRL_DMASTART ) || ( data & PBUS_CTRL_LOAD_EN ) )
11641164      {
1165         timer_set(machine, attotime::from_hz(44100), NULL, 0, ip22_dma);
1165         machine->scheduler().timer_set(attotime::from_hz(44100), FUNC(ip22_dma));
11661166         state->nPBUS_DMA_Active = 1;
11671167      }
11681168      return;
r10315r10316
12111211static TIMER_CALLBACK(ip22_timer)
12121212{
12131213   sgi_mc_update();
1214   timer_set(machine, attotime::from_msec(1), NULL, 0, ip22_timer);
1214   machine->scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer));
12151215}
12161216
12171217static MACHINE_START( ip225015 )
r10315r10316
12291229   RTC_REGISTERB = 0x08;
12301230   RTC_REGISTERD = 0x80;
12311231
1232   timer_set(machine, attotime::from_msec(1), NULL, 0, ip22_timer);
1232   machine->scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer));
12331233
12341234   // set up low RAM mirror
12351235   memory_set_bankptr(machine, "bank1", state->mainram);
src/mess/drivers/a2600.c
r10315r10316
16821682   state->extra_RAM = machine->region_alloc("user2", 0x8600, ROM_REQUIRED );
16831683   memset( state->riot_ram, 0x00, 0x80 );
16841684   state->current_reset_bank_counter = 0xFF;
1685   state->dpc.oscillator = timer_alloc(machine, modeDPC_timer_callback, NULL);
1685   state->dpc.oscillator = machine->scheduler().timer_alloc(FUNC(modeDPC_timer_callback));
16861686}
16871687
16881688static MACHINE_START( a2600 )
src/mess/drivers/mk2.c
r10315r10316
104104
105105static MACHINE_START( mk2 )
106106{
107   timer_pulse(machine, attotime::from_hz(60), NULL, 0, update_leds);
107   machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(update_leds));
108108}
109109
110110static READ8_DEVICE_HANDLER( mk2_read_a )
src/mess/drivers/pcw.c
r10315r10316
177177
178178   state->timer_irq_flag = 1;
179179   pcw_update_irqs(machine);
180   timer_set(machine,attotime::from_usec(100),NULL,0,pcw_timer_pulse);
180   machine->scheduler().timer_set(attotime::from_usec(100), FUNC(pcw_timer_pulse));
181181}
182182
183183/* fdc interrupt callback. set/clear fdc int */
r10315r10316
11181118   state->roller_ram_offset = 0;
11191119
11201120   /* timer interrupt */
1121   timer_pulse(machine, attotime::from_hz(300), NULL, 0, pcw_timer_interrupt);
1121   machine->scheduler().timer_pulse(attotime::from_hz(300), FUNC(pcw_timer_interrupt));
11221122
1123   timer_set(machine, attotime::zero, NULL, 0, setup_beep);
1123   machine->scheduler().timer_set(attotime::zero, FUNC(setup_beep));
11241124
1125   state->prn_stepper = timer_alloc(machine,pcw_stepper_callback,NULL);
1126   state->prn_pins = timer_alloc(machine,pcw_pins_callback,NULL);
1125   state->prn_stepper = machine->scheduler().timer_alloc(FUNC(pcw_stepper_callback));
1126   state->prn_pins = machine->scheduler().timer_alloc(FUNC(pcw_pins_callback));
11271127}
11281128
11291129
src/mess/drivers/studio2.c
r10315r10316
605605
606606static DRIVER_INIT( studio2 )
607607{
608   timer_set(machine, attotime::zero, NULL, 0, setup_beep);
608   machine->scheduler().timer_set(attotime::zero, FUNC(setup_beep));
609609}
610610
611611/* Game Drivers */
src/mess/drivers/osi.c
r10315r10316
925925
926926static DRIVER_INIT( c1p )
927927{
928   timer_set(machine, attotime::zero, NULL, 0, setup_beep);
928   machine->scheduler().timer_set(attotime::zero, FUNC(setup_beep));
929929}
930930
931931
src/mess/drivers/mekd2.c
r10315r10316
5959   if (state)
6060      cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
6161   else
62      timer_set(device->machine, attotime::from_usec(18), NULL, 0, mekd2_trace);
62      device->machine->scheduler().timer_set(attotime::from_usec(18), FUNC(mekd2_trace));
6363}
6464
6565/***********************************************************
src/mess/drivers/a7000.c
r10315r10316
783783static MACHINE_START(a7000)
784784{
785785   a7000_state *state = machine->driver_data<a7000_state>();
786   state->IOMD_timer[0] = timer_alloc(machine, IOMD_timer0_callback, NULL);
787   state->IOMD_timer[1] = timer_alloc(machine, IOMD_timer1_callback, NULL);
788   state->flyback_timer = timer_alloc(machine, flyback_timer_callback, NULL);
786   state->IOMD_timer[0] = machine->scheduler().timer_alloc(FUNC(IOMD_timer0_callback));
787   state->IOMD_timer[1] = machine->scheduler().timer_alloc(FUNC(IOMD_timer1_callback));
788   state->flyback_timer = machine->scheduler().timer_alloc(FUNC(flyback_timer_callback));
789789
790790   state->io_id = 0xd4e7;
791791}
src/mess/drivers/tmc1800.c
r10315r10316
727727   memory_configure_bank(machine, "bank1", 0, 2, machine->region(CDP1802_TAG)->base(), 0x8000);
728728
729729   /* allocate monitor timer */
730   state->ef4_timer = timer_alloc(machine, nano_ef4_tick, NULL);
730   state->ef4_timer = machine->scheduler().timer_alloc(FUNC(nano_ef4_tick));
731731
732732   /* find devices */
733733   state->cdp1864 = machine->device(CDP1864_TAG);
r10315r10316
925925
926926static DRIVER_INIT( tmc1800 )
927927{
928   timer_set(machine, attotime::zero, NULL, 0, setup_beep);
928   machine->scheduler().timer_set(attotime::zero, FUNC(setup_beep));
929929}
930930
931931/* System Drivers */
src/mess/drivers/fmtowns.c
r10315r10316
12161216   state->towns_cd.cmd_status[2] = st2;
12171217   state->towns_cd.cmd_status[3] = st3;
12181218   // wait a bit
1219   timer_set(machine,attotime::from_msec(1),machine,0,towns_cd_status_ready);
1219   machine->scheduler().timer_set(attotime::from_msec(1), FUNC(towns_cd_status_ready), 0, machine);
12201220}
12211221
12221222static UINT8 towns_cd_get_track(running_machine* machine)
r10315r10316
14201420            break;
14211421         case 0x04:  // Play Audio Track
14221422            logerror("CD: Command 0x04: PLAY CD-DA\n");
1423            timer_set(device->machine,attotime::from_msec(1),device,0,towns_delay_cdda);
1423            device->machine->scheduler().timer_set(attotime::from_msec(1), FUNC(towns_delay_cdda), 0, device);
14241424            break;
14251425         case 0x05:  // Read TOC
14261426            logerror("CD: Command 0x05: READ TOC\n");
r10315r10316
22712271   state->towns_serial_rom = auto_alloc_array(machine,UINT8,256/8);
22722272   towns_init_serial_rom(machine);
22732273   towns_init_rtc(machine);
2274   state->towns_rtc_timer = timer_alloc(machine,rtc_second,NULL);
2275   state->towns_kb_timer = timer_alloc(machine,poll_keyboard,NULL);
2276   state->towns_mouse_timer = timer_alloc(machine,towns_mouse_timeout,NULL);
2274   state->towns_rtc_timer = machine->scheduler().timer_alloc(FUNC(rtc_second));
2275   state->towns_kb_timer = machine->scheduler().timer_alloc(FUNC(poll_keyboard));
2276   state->towns_mouse_timer = machine->scheduler().timer_alloc(FUNC(towns_mouse_timeout));
22772277
22782278   // CD-ROM init
2279   state->towns_cd.read_timer = timer_alloc(machine,towns_cdrom_read_byte,(void*)machine->device("dma_1"));
2279   state->towns_cd.read_timer = machine->scheduler().timer_alloc(FUNC(towns_cdrom_read_byte), (void*)machine->device("dma_1"));
22802280
22812281   cpu_set_irq_callback(machine->device("maincpu"), towns_irq_callback);
22822282   memory_install_ram(cputag_get_address_space(machine,"maincpu",ADDRESS_SPACE_PROGRAM),0x100000,ram_get_size(machine->device(RAM_TAG))-1,0xffffffff,0,NULL);
src/mess/drivers/newbrain.c
r10315r10316
13881388   state->cassette2 = machine->device(CASSETTE2_TAG);
13891389
13901390   /* allocate reset timer */
1391   state->reset_timer = timer_alloc(machine, reset_tick, NULL);
1391   state->reset_timer = machine->scheduler().timer_alloc(FUNC(reset_tick));
13921392   timer_adjust_oneshot(state->reset_timer, attotime::from_usec(get_reset_t()), 0);
13931393
13941394   /* allocate power up timer */
1395   state->pwrup_timer = timer_alloc(machine, pwrup_tick, NULL);
1395   state->pwrup_timer = machine->scheduler().timer_alloc(FUNC(pwrup_tick));
13961396   timer_adjust_oneshot(state->pwrup_timer, attotime::from_usec(get_pwrup_t()), 0);
13971397
13981398   /* initialize variables */
src/mess/drivers/tk80bs.c
r10315r10316
295295
296296static MACHINE_START(tk80bs)
297297{
298   timer_pulse(machine, attotime::from_hz(240/32), NULL, 0, keyboard_callback);
298   machine->scheduler().timer_pulse(attotime::from_hz(240/32), FUNC(keyboard_callback));
299299}
300300
301301static MACHINE_RESET(tk80bs)
src/mess/drivers/fk1.c
r10315r10316
390390
391391static MACHINE_START( fk1 )
392392{
393   timer_pulse(machine, attotime::from_hz(24000), NULL, 0, keyboard_callback);
394   timer_pulse(machine, attotime::from_hz(50), NULL, 0, vsync_callback);
393   machine->scheduler().timer_pulse(attotime::from_hz(24000), FUNC(keyboard_callback));
394   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(vsync_callback));
395395}
396396
397397static VIDEO_UPDATE( fk1 )
src/mess/drivers/multi8.c
r10315r10316
563563
564564static MACHINE_START(multi8)
565565{
566   timer_pulse(machine, attotime::from_hz(240/32), NULL, 0, keyboard_callback);
566   machine->scheduler().timer_pulse(attotime::from_hz(240/32), FUNC(keyboard_callback));
567567}
568568
569569static MACHINE_RESET(multi8)
src/mess/drivers/ssystem3.c
r10315r10316
7373    state->playfield.bit=0;
7474    state->playfield.started=FALSE;
7575    state->playfield.signal=signal;
76    state->playfield.time=timer_get_time(machine);
76    state->playfield.time=machine->time();
7777  }
7878  if (!signal && state->playfield.signal) {
79    attotime t=timer_get_time(machine);
79    attotime t=machine->time();
8080    state->playfield.high_time=t - state->playfield.time;
8181    state->playfield.time=t;
8282
r10315r10316
101101    }
102102
103103  } else if (signal && !state->playfield.signal) {
104    attotime t=timer_get_time(machine);
104    attotime t=machine->time();
105105    state->playfield.low_time= t - state->playfield.time;
106106    state->playfield.time=t;
107107    state->playfield.started=TRUE;
src/mess/drivers/ng_aes.c
r10315r10316
249249static void create_interrupt_timers( running_machine *machine )
250250{
251251   neogeo_state *state = machine->driver_data<neogeo_state>();
252   state->display_position_interrupt_timer = timer_alloc(machine, display_position_interrupt_callback, NULL);
253   state->display_position_vblank_timer = timer_alloc(machine, display_position_vblank_callback, NULL);
254   state->vblank_interrupt_timer = timer_alloc(machine, vblank_interrupt_callback, NULL);
252   state->display_position_interrupt_timer = machine->scheduler().timer_alloc(FUNC(display_position_interrupt_callback));
253   state->display_position_vblank_timer = machine->scheduler().timer_alloc(FUNC(display_position_vblank_callback));
254   state->vblank_interrupt_timer = machine->scheduler().timer_alloc(FUNC(vblank_interrupt_callback));
255255}
256256
257257
src/mess/drivers/bml3.c
r10315r10316
458458
459459static MACHINE_START(bml3)
460460{
461   timer_pulse(machine, attotime::from_hz(240/8), NULL, 0, keyboard_callback);
461   machine->scheduler().timer_pulse(attotime::from_hz(240/8), FUNC(keyboard_callback));
462462   beep_set_frequency(machine->device("beeper"),1200); //guesswork
463463   beep_set_state(machine->device("beeper"),0);
464464}
src/mess/drivers/junior.c
r10315r10316
189189   junior_state *state = machine->driver_data<junior_state>();
190190   state_save_register_item(machine, "junior", NULL, 0, state->port_a );
191191   state_save_register_item(machine, "junior", NULL, 0, state->port_b );
192   timer_pulse(machine,  attotime::from_hz(50), NULL, 0, junior_update_leds );
192   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(junior_update_leds));
193193}
194194
195195
src/mess/drivers/psx.c
r10315r10316
502502      if( !pad->b_ack )
503503      {
504504         pad->b_ack = 1;
505         timer_set(machine, attotime::from_usec( 2 ), NULL, n_port, psx_pad_ack );
505         machine->scheduler().timer_set(attotime::from_usec( 2 ), FUNC(psx_pad_ack) , n_port);
506506      }
507507   }
508508}
r10315r10316
618618   if( b_ack )
619619   {
620620      pad->b_ack = 0;
621      timer_set(machine, attotime::from_usec( 10 ), NULL, n_port, psx_pad_ack );
621      machine->scheduler().timer_set(attotime::from_usec( 10 ), FUNC(psx_pad_ack), n_port);
622622   }
623623}
624624
src/mess/drivers/samcoupe.c
r10315r10316
341341
342342   /* assert irq and a timer to set it off again */
343343   cpu_set_input_line(device, 0, ASSERT_LINE);
344   timer_set(device->machine, attotime::from_usec(20), NULL, src, irq_off);
344   device->machine->scheduler().timer_set(attotime::from_usec(20), FUNC(irq_off), src);
345345
346346   /* adjust STATUS register */
347347   state->status &= ~src;
src/mess/drivers/tutor.c
r10315r10316
200200static DRIVER_INIT(tutor)
201201{
202202   tutor_state *state = machine->driver_data<tutor_state>();
203   state->tape_interrupt_timer = timer_alloc(machine, tape_interrupt_handler, NULL);
203   state->tape_interrupt_timer = machine->scheduler().timer_alloc(FUNC(tape_interrupt_handler));
204204
205205   memory_configure_bank(machine, "bank1", 0, 1, machine->region("maincpu")->base() + basic_base, 0);
206206   memory_configure_bank(machine, "bank1", 1, 1, machine->region("maincpu")->base() + cartridge_base, 0);
src/mess/drivers/pockstat.c
r10315r10316
868868   int index = 0;
869869   for(index = 0; index < 3; index++)
870870   {
871      state->timer_regs.timer[index].timer = timer_alloc(machine, timer_tick, 0);
871      state->timer_regs.timer[index].timer = machine->scheduler().timer_alloc(FUNC(timer_tick));
872872      timer_adjust_oneshot(state->timer_regs.timer[index].timer, attotime::never, index);
873873   }
874874
875875   state->rtc_regs.time = 0x01000000;
876876   state->rtc_regs.date = 0x19990101;
877877
878   state->rtc_regs.timer = timer_alloc(machine, rtc_tick, 0);
878   state->rtc_regs.timer = machine->scheduler().timer_alloc(FUNC(rtc_tick));
879879   timer_adjust_oneshot(state->rtc_regs.timer, attotime::from_hz(1), index);
880880
881881   state_save_register_global(machine, state->ftlb_regs.control);
src/mess/drivers/x07.c
r10315r10316
13391339
13401340void x07_state::machine_start()
13411341{
1342   m_rsta_clear = timer_alloc(machine, rsta_clear, 0);
1343   m_rstb_clear = timer_alloc(machine, rstb_clear, 0);
1344   m_beep_stop = timer_alloc(machine, beep_stop, 0);
1345   m_k7irq = timer_alloc(machine, k7_irq, 0);
1342   m_rsta_clear = machine->scheduler().timer_alloc(FUNC(rsta_clear));
1343   m_rstb_clear = machine->scheduler().timer_alloc(FUNC(rstb_clear));
1344   m_beep_stop = machine->scheduler().timer_alloc(FUNC(beep_stop));
1345   m_k7irq = machine->scheduler().timer_alloc(FUNC(k7_irq));
13461346
13471347   /* Save State */
13481348   state_save_register_global(machine, m_sleep);
src/mess/drivers/nanos.c
r10315r10316
416416{
417417   nanos_state *state = machine->driver_data<nanos_state>();
418418   state->key_pressed = 0xff;
419   timer_pulse(machine, attotime::from_hz(24000), NULL, 0, keyboard_callback);
419   machine->scheduler().timer_pulse(attotime::from_hz(24000), FUNC(keyboard_callback));
420420}
421421
422422static MACHINE_RESET(nanos)
src/mess/drivers/c10.c
r10315r10316
5151static MACHINE_RESET(c10)
5252{
5353   memory_set_bank(machine, "boot", 1);
54   timer_set(machine, attotime::from_usec(4), NULL, 0, c10_reset);
54   machine->scheduler().timer_set(attotime::from_usec(4), FUNC(c10_reset));
5555}
5656
5757static VIDEO_START( c10 )
src/mess/drivers/fm7.c
r10315r10316
265265      {
266266         beep_set_state(space->machine->device("beeper"),1);
267267         logerror("timed beeper on\n");
268         timer_set(space->machine,attotime::from_msec(205),NULL,0,fm7_beeper_off);
268         space->machine->scheduler().timer_set(attotime::from_msec(205), FUNC(fm7_beeper_off));
269269      }
270270   }
271271   logerror("beeper state: %02x\n",data);
r10315r10316
283283   {
284284      beep_set_state(space->machine->device("beeper"),1);
285285      logerror("timed beeper on\n");
286      timer_set(space->machine,attotime::from_msec(205),NULL,0,fm7_beeper_off);
286      space->machine->scheduler().timer_set(attotime::from_msec(205), FUNC(fm7_beeper_off));
287287   }
288288   return 0xff;
289289}
r10315r10316
730730         fm77av_encoder_handle_command(state);
731731
732732      // wait 5us to set ACK flag
733      timer_set(space->machine,attotime::from_usec(5),NULL,0,fm77av_encoder_ack);
733      space->machine->scheduler().timer_set(attotime::from_usec(5), FUNC(fm77av_encoder_ack));
734734
735735      //logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,state->encoder.position);
736736   }
r10315r10316
16951695   fm7_state *state = machine->driver_data<fm7_state>();
16961696//  state->shared_ram = auto_alloc_array(machine,UINT8,0x80);
16971697   state->video_ram = auto_alloc_array(machine,UINT8,0x18000);  // 2 pages on some systems
1698   state->timer = timer_alloc(machine,fm7_timer_irq,NULL);
1699   state->subtimer = timer_alloc(machine,fm7_subtimer_irq,NULL);
1700   state->keyboard_timer = timer_alloc(machine,fm7_keyboard_poll,NULL);
1698   state->timer = machine->scheduler().timer_alloc(FUNC(fm7_timer_irq));
1699   state->subtimer = machine->scheduler().timer_alloc(FUNC(fm7_subtimer_irq));
1700   state->keyboard_timer = machine->scheduler().timer_alloc(FUNC(fm7_keyboard_poll));
17011701   if(state->type != SYS_FM7)
1702      state->fm77av_vsync_timer = timer_alloc(machine,fm77av_vsync,NULL);
1702      state->fm77av_vsync_timer = machine->scheduler().timer_alloc(FUNC(fm77av_vsync));
17031703   cpu_set_irq_callback(machine->device("maincpu"),fm7_irq_ack);
17041704   cpu_set_irq_callback(machine->device("sub"),fm7_sub_irq_ack);
17051705}
src/mess/drivers/pv1000.c
r10315r10316
334334{
335335   d65010_state *state = machine->driver_data<d65010_state>();
336336
337   state->irq_on_timer = timer_alloc( machine, d65010_irq_on_cb, NULL );
338   state->irq_off_timer = timer_alloc( machine, d65010_irq_off_cb, NULL );
337   state->irq_on_timer = machine->scheduler().timer_alloc(FUNC(d65010_irq_on_cb));
338   state->irq_off_timer = machine->scheduler().timer_alloc(FUNC(d65010_irq_off_cb));
339339   state->maincpu = machine->device( "maincpu" );
340340   state->screen = machine->device<screen_device>("screen" );
341341}
src/mess/drivers/nc.c
r10315r10316
993993   machine->add_notifier(MACHINE_NOTIFY_EXIT, nc100_machine_stop);
994994
995995   /* keyboard timer */
996   state->keyboard_timer = timer_alloc(machine, nc_keyboard_timer_callback, NULL);
996   state->keyboard_timer = machine->scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback));
997997   timer_adjust_oneshot(state->keyboard_timer, attotime::from_msec(10), 0);
998998
999999   /* dummy timer */
1000   timer_pulse(machine, attotime::from_hz(50), NULL, 0, dummy_timer_callback);
1000   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(dummy_timer_callback));
10011001
10021002   /* serial timer */
1003   state->serial_timer = timer_alloc(machine, nc_serial_timer_callback, NULL);
1003   state->serial_timer = machine->scheduler().timer_alloc(FUNC(nc_serial_timer_callback));
10041004}
10051005
10061006
r10315r10316
13921392   machine->add_notifier(MACHINE_NOTIFY_EXIT, nc200_machine_stop);
13931393
13941394   /* keyboard timer */
1395   state->keyboard_timer = timer_alloc(machine, nc_keyboard_timer_callback, NULL);
1395   state->keyboard_timer = machine->scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback));
13961396   timer_adjust_oneshot(state->keyboard_timer, attotime::from_msec(10), 0);
13971397
13981398   /* dummy timer */
1399   timer_pulse(machine, attotime::from_hz(50), NULL, 0, dummy_timer_callback);
1399   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(dummy_timer_callback));
14001400
14011401   /* serial timer */
1402   state->serial_timer = timer_alloc(machine, nc_serial_timer_callback, NULL);
1402   state->serial_timer = machine->scheduler().timer_alloc(FUNC(nc_serial_timer_callback));
14031403}
14041404
14051405/*
src/mess/drivers/okean240.c
r10315r10316
4949
5050static MACHINE_RESET(okean240)
5151{   
52   timer_set(machine, attotime::from_usec(10), NULL, 0, okean240_boot);
52   machine->scheduler().timer_set(attotime::from_usec(10), FUNC(okean240_boot));
5353   memory_set_bank(machine, "boot", 1);
5454}
5555
src/mess/drivers/ngp.c
r10315r10316
604604{
605605   ngp_state *state = machine->driver_data<ngp_state>();
606606
607   state->seconds_timer = timer_alloc( machine, ngp_seconds_callback, NULL );
607   state->seconds_timer = machine->scheduler().timer_alloc(FUNC(ngp_seconds_callback));
608608   timer_adjust_periodic( state->seconds_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1) );
609609}
610610
src/mess/drivers/z88.c
r10315r10316
299299
300300static MACHINE_START( z88 )
301301{
302   timer_pulse(machine, attotime::from_msec(5), NULL, 0, z88_rtc_timer_callback);
302   machine->scheduler().timer_pulse(attotime::from_msec(5), FUNC(z88_rtc_timer_callback));
303303}
304304
305305static MACHINE_RESET( z88 )
src/mess/drivers/pcw16.c
r10315r10316
13611361   state->interrupt_counter = 0;
13621362
13631363   /* video ints */
1364   timer_pulse(machine, attotime::from_usec(5830), NULL, 0,pcw16_timer_callback);
1364   machine->scheduler().timer_pulse(attotime::from_usec(5830), FUNC(pcw16_timer_callback));
13651365   /* rtc timer */
1366   timer_pulse(machine, attotime::from_hz(256), NULL, 0, rtc_timer_callback);
1366   machine->scheduler().timer_pulse(attotime::from_hz(256), FUNC(rtc_timer_callback));
13671367   /* keyboard timer */
1368   timer_pulse(machine, attotime::from_hz(50), NULL, 0, pcw16_keyboard_timer_callback);
1368   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(pcw16_keyboard_timer_callback));
13691369
13701370
13711371   pc_fdc_init(machine, &pcw16_fdc_interface);
src/mess/drivers/vt100.c
r10315r10316
323323
324324static MACHINE_START(vt100)
325325{
326   timer_pulse(machine, attotime::from_hz(800), NULL, 0, keyboard_callback);
326   machine->scheduler().timer_pulse(attotime::from_hz(800), FUNC(keyboard_callback));
327327}
328328
329329static MACHINE_RESET(vt100)
src/mess/drivers/prof80.c
r10315r10316
11981198   floppy_drive_set_index_pulse_callback(floppy_get_device(machine, 0), prof80_fdc_index_callback);
11991199
12001200   /* allocate floppy motor off timer */
1201   state->floppy_motor_off_timer = timer_alloc(machine, floppy_motor_off_tick, NULL);
1201   state->floppy_motor_off_timer = machine->scheduler().timer_alloc(FUNC(floppy_motor_off_tick));
12021202
12031203   /* bank switch */
12041204   prof80_bankswitch(machine);
src/mess/drivers/pasogo.c
r10315r10316
104104
105105   memset(vg230, 0, sizeof(*vg230));
106106   vg230->pmu.write_protected=TRUE;
107   timer_pulse(machine, attotime::from_hz(1), NULL, 0, vg230_timer);
107   machine->scheduler().timer_pulse(attotime::from_hz(1), FUNC(vg230_timer));
108108
109109
110110   machine->base_datetime(systime);
src/mess/drivers/x68k.c
r10315r10316
175175   state->mfp.current_irq = -1;  // No current interrupt
176176
177177#if 0
178    mfp_timer[0] = timer_alloc(machine, mfp_timer_a_callback, NULL);
179    mfp_timer[1] = timer_alloc(machine, mfp_timer_b_callback, NULL);
180    mfp_timer[2] = timer_alloc(machine, mfp_timer_c_callback, NULL);
181    mfp_timer[3] = timer_alloc(machine, mfp_timer_d_callback, NULL);
182    mfp_irq = timer_alloc(machine, mfp_update_irq, NULL);
178    mfp_timer[0] = machine->scheduler().timer_alloc(FUNC(mfp_timer_a_callback));
179    mfp_timer[1] = machine->scheduler().timer_alloc(FUNC(mfp_timer_b_callback));
180    mfp_timer[2] = machine->scheduler().timer_alloc(FUNC(mfp_timer_c_callback));
181    mfp_timer[3] = machine->scheduler().timer_alloc(FUNC(mfp_timer_d_callback));
182    mfp_irq = machine->scheduler().timer_alloc(FUNC(mfp_update_irq));
183183    timer_adjust_periodic(mfp_irq, attotime::zero, 0, attotime::from_usec(32));
184184#endif
185185}
r10315r10316
738738static void md_6button_init(running_machine* machine)
739739{
740740   x68k_state *state = machine->driver_data<x68k_state>();
741   state->mdctrl.io_timeout1 = timer_alloc(machine,md_6button_port1_timeout,NULL);
742   state->mdctrl.io_timeout2 = timer_alloc(machine,md_6button_port2_timeout,NULL);
741   state->mdctrl.io_timeout1 = machine->scheduler().timer_alloc(FUNC(md_6button_port1_timeout));
742   state->mdctrl.io_timeout2 = machine->scheduler().timer_alloc(FUNC(md_6button_port2_timeout));
743743}
744744
745745static UINT8 md_6button_r(device_t* device, int port)
r10315r10316
17291729      offset *= 2;
17301730      if(ACCESSING_BITS_0_7)
17311731         offset++;
1732      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
1732      space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), FUNC(x68k_fake_bus_error), 0xbffffc+offset);
17331733   }
17341734   return 0xff;
17351735}
r10315r10316
17471747      offset *= 2;
17481748      if(ACCESSING_BITS_0_7)
17491749         offset++;
1750      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
1750      space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), FUNC(x68k_fake_bus_error), 0xbffffc+offset);
17511751   }
17521752}
17531753
r10315r10316
17641764      offset *= 2;
17651765      if(ACCESSING_BITS_0_7)
17661766         offset++;
1767      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, offset,x68k_fake_bus_error);
1767      space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), FUNC(x68k_fake_bus_error), offset);
17681768   }
17691769   return 0xff;
17701770}
r10315r10316
17821782      offset *= 2;
17831783      if(ACCESSING_BITS_0_7)
17841784         offset++;
1785      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, offset,x68k_fake_bus_error);
1785      space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), FUNC(x68k_fake_bus_error), offset);
17861786   }
17871787}
17881788
r10315r10316
17971797      offset *= 2;
17981798      if(ACCESSING_BITS_0_7)
17991799         offset++;
1800      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1800      space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(16), FUNC(x68k_fake_bus_error), 0xeafa00+offset);
18011801//      cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,state->current_vector[2]);
18021802   }
18031803   return 0xffff;
r10315r10316
18141814      offset *= 2;
18151815      if(ACCESSING_BITS_0_7)
18161816         offset++;
1817      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1817      space->machine->scheduler().timer_set(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(16), FUNC(x68k_fake_bus_error), 0xeafa00+offset);
18181818//      cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,state->current_vector[2]);
18191819   }
18201820}
r10315r10316
26932693   // init keyboard
26942694   state->keyboard.delay = 500;  // 3*100+200
26952695   state->keyboard.repeat = 110;  // 4^2*5+30
2696   state->kb_timer = timer_alloc(machine, x68k_keyboard_poll,NULL);
2697   state->scanline_timer = timer_alloc(machine, x68k_hsync,NULL);
2698   state->raster_irq = timer_alloc(machine, x68k_crtc_raster_irq,NULL);
2699   state->vblank_irq = timer_alloc(machine, x68k_crtc_vblank_irq,NULL);
2700   state->mouse_timer = timer_alloc(machine, x68k_scc_ack,NULL);
2701   state->led_timer = timer_alloc(machine, x68k_led_callback,NULL);
2696   state->kb_timer = machine->scheduler().timer_alloc(FUNC(x68k_keyboard_poll));
2697   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(x68k_hsync));
2698   state->raster_irq = machine->scheduler().timer_alloc(FUNC(x68k_crtc_raster_irq));
2699   state->vblank_irq = machine->scheduler().timer_alloc(FUNC(x68k_crtc_vblank_irq));
2700   state->mouse_timer = machine->scheduler().timer_alloc(FUNC(x68k_scc_ack));
2701   state->led_timer = machine->scheduler().timer_alloc(FUNC(x68k_led_callback));
27022702
27032703   // Initialise timers for 6-button MD controllers
27042704   md_6button_init(machine);
src/mess/drivers/beta.c
r10315r10316
242242   /* find devices */
243243   state->speaker = machine->device(SPEAKER_TAG);
244244
245   state->led_refresh_timer = timer_alloc(machine, led_refresh, 0);
245   state->led_refresh_timer = machine->scheduler().timer_alloc(FUNC(led_refresh));
246246
247247   /* register for state saving */
248248   state_save_register_global(machine, state->eprom_oe);
src/mess/drivers/px4.c
r10315r10316
10881088   px4->alarm_int_enabled = TRUE;
10891089
10901090   /* art */
1091   px4->receive_timer = timer_alloc(machine, receive_data, NULL);
1092   px4->transmit_timer = timer_alloc(machine, transmit_data, NULL);
1091   px4->receive_timer = machine->scheduler().timer_alloc(FUNC(receive_data));
1092   px4->transmit_timer = machine->scheduler().timer_alloc(FUNC(transmit_data));
10931093
10941094   /* printer */
10951095   px4->printer = machine->device("centronics");
10961096
10971097   /* external cassette or barcode reader */
1098   px4->ext_cas_timer = timer_alloc(machine, ext_cassette_read, NULL);
1098   px4->ext_cas_timer = machine->scheduler().timer_alloc(FUNC(ext_cassette_read));
10991099   px4->ext_cas = machine->device("extcas");
11001100   px4->ear_last_state = 0;
11011101
src/mess/drivers/pc8801.c
r10315r10316
13851385
13861386static READ8_DEVICE_HANDLER( cpu_8255_c_r )
13871387{
1388   timer_call_after_resynch(device->machine, NULL, 0, 0); // force resync
1388   device->machine->scheduler().synchronize(); // force resync
13891389
13901390   return i8255_1_pc >> 4;
13911391}
13921392
13931393static WRITE8_DEVICE_HANDLER( cpu_8255_c_w )
13941394{
1395   timer_call_after_resynch(device->machine, NULL, 0, 0); // force resync
1395   device->machine->scheduler().synchronize(); // force resync
13961396
13971397   i8255_0_pc = data;
13981398}
r10315r10316
14091409
14101410static READ8_DEVICE_HANDLER( fdc_8255_c_r )
14111411{
1412   timer_call_after_resynch(device->machine, NULL, 0, 0); // force resync
1412   device->machine->scheduler().synchronize(); // force resync
14131413
14141414   return i8255_0_pc >> 4;
14151415}
14161416
14171417static WRITE8_DEVICE_HANDLER( fdc_8255_c_w )
14181418{
1419   timer_call_after_resynch(device->machine, NULL, 0, 0); // force resync
1419   device->machine->scheduler().synchronize(); // force resync
14201420
14211421   i8255_1_pc = data;
14221422}
r10315r10316
14571457
14581458   upd765_tc_w(space->machine->device("upd765"), 1);
14591459    //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha.
1460   timer_set(space->machine,  attotime::from_usec(750), NULL, 0, pc8801fd_upd765_tc_to_zero );
1460   space->machine->scheduler().timer_set(attotime::from_usec(750), FUNC(pc8801fd_upd765_tc_to_zero));
14611461   return 0xff; // value is meaningless
14621462}
14631463
r10315r10316
19431943{
19441944   cpu_set_irq_callback(machine->device("maincpu"), pc8801_irq_callback);
19451945
1946   timer_pulse(machine, attotime::from_hz(600), NULL, 0, pc8801_rtc_irq);
1946   machine->scheduler().timer_pulse(attotime::from_hz(600), FUNC(pc8801_rtc_irq));
19471947}
19481948
19491949static MACHINE_RESET( pc8801 )
src/mess/drivers/socrates.c
r10315r10316
371371         {
372372            /* write me: start talking */
373373            state->speech_running = 1;
374            timer_set(space->machine, attotime::from_seconds(4), NULL, 0, clear_speech_cb); // hack
374            space->machine->scheduler().timer_set(attotime::from_seconds(4), FUNC(clear_speech_cb)); // hack
375375         }
376376         break;
377377      case 0x90: // unknown, one of these is probably read and branch
r10315r10316
395395         if ((data&0xF) == 0) // speak
396396         {
397397            state->speech_running = 1;
398            timer_set(space->machine, attotime::from_seconds(4), NULL, 0, clear_speech_cb); // hack
398            space->machine->scheduler().timer_set(attotime::from_seconds(4), FUNC(clear_speech_cb)); // hack
399399         }
400400         else if ((data&0xF) == 8) // reset
401401         {
r10315r10316
894894{
895895   socrates_state *state = device->machine->driver_data<socrates_state>();
896896   cpu_set_input_line(device, 0, ASSERT_LINE);
897   timer_set(device->machine, downcast<cpu_device *>(device)->cycles_to_attotime(44), NULL, 0, clear_irq_cb);
897   device->machine->scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(44), FUNC(clear_irq_cb));
898898// 44 is a complete and total guess, need to properly measure how many clocks/microseconds the int line is high for.
899899   state->vblankstate = 1;
900900}
src/mess/drivers/jr200.c
r10315r10316
471471   jr200_state *state = machine->driver_data<jr200_state>();
472472   beep_set_frequency(machine->device("beeper"),0);
473473   beep_set_state(machine->device("beeper"),0);
474   state->timer_d = timer_alloc(machine, timer_d_callback, NULL);
474   state->timer_d = machine->scheduler().timer_alloc(FUNC(timer_d_callback));
475475}
476476
477477static MACHINE_RESET(jr200)
src/mess/drivers/coleco.c
r10315r10316
243243static MACHINE_START( coleco )
244244{
245245   TMS9928A_configure(&tms9928a_interface);
246   timer_pulse(machine, attotime::from_msec(20), NULL, 0, paddle_callback);
246   machine->scheduler().timer_pulse(attotime::from_msec(20), FUNC(paddle_callback));
247247}
248248
249249static MACHINE_RESET( coleco )
src/mess/drivers/snes.c
r10315r10316
547547   UINT8 ctrl2 = (input_port_read(machine, "CTRLSEL") & 0xf0) >> 4;
548548
549549   /* Check if lightgun has been chosen as input: if so, enable crosshair */
550   timer_set(machine, attotime::zero, NULL, 0, lightgun_tick);
550   machine->scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
551551
552552   switch (ctrl1)
553553   {
src/mess/drivers/gp32.c
r10315r10316
17371737static void s3c240x_machine_start( running_machine *machine)
17381738{
17391739   gp32_state *state = machine->driver_data<gp32_state>();
1740   state->s3c240x_pwm_timer[0] = timer_alloc( machine, s3c240x_pwm_timer_exp, (void *)(FPTR)0);
1741   state->s3c240x_pwm_timer[1] = timer_alloc( machine, s3c240x_pwm_timer_exp, (void *)(FPTR)1);
1742   state->s3c240x_pwm_timer[2] = timer_alloc( machine, s3c240x_pwm_timer_exp, (void *)(FPTR)2);
1743   state->s3c240x_pwm_timer[3] = timer_alloc( machine, s3c240x_pwm_timer_exp, (void *)(FPTR)3);
1744   state->s3c240x_pwm_timer[4] = timer_alloc( machine, s3c240x_pwm_timer_exp, (void *)(FPTR)4);
1745   state->s3c240x_dma_timer[0] = timer_alloc( machine, s3c240x_dma_timer_exp, (void *)(FPTR)0);
1746   state->s3c240x_dma_timer[1] = timer_alloc( machine, s3c240x_dma_timer_exp, (void *)(FPTR)1);
1747   state->s3c240x_dma_timer[2] = timer_alloc( machine, s3c240x_dma_timer_exp, (void *)(FPTR)2);
1748   state->s3c240x_dma_timer[3] = timer_alloc( machine, s3c240x_dma_timer_exp, (void *)(FPTR)3);
1749   state->s3c240x_iic_timer = timer_alloc( machine, s3c240x_iic_timer_exp, (void *)(FPTR)0);
1750   state->s3c240x_iis_timer = timer_alloc( machine, s3c240x_iis_timer_exp, (void *)(FPTR)0);
1751   state->s3c240x_lcd_timer = timer_alloc( machine, s3c240x_lcd_timer_exp, (void *)(FPTR)0);
1740   state->s3c240x_pwm_timer[0] = machine->scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)0);
1741   state->s3c240x_pwm_timer[1] = machine->scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)1);
1742   state->s3c240x_pwm_timer[2] = machine->scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)2);
1743   state->s3c240x_pwm_timer[3] = machine->scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)3);
1744   state->s3c240x_pwm_timer[4] = machine->scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)4);
1745   state->s3c240x_dma_timer[0] = machine->scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)0);
1746   state->s3c240x_dma_timer[1] = machine->scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)1);
1747   state->s3c240x_dma_timer[2] = machine->scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)2);
1748   state->s3c240x_dma_timer[3] = machine->scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)3);
1749   state->s3c240x_iic_timer = machine->scheduler().timer_alloc(FUNC(s3c240x_iic_timer_exp), (void *)(FPTR)0);
1750   state->s3c240x_iis_timer = machine->scheduler().timer_alloc(FUNC(s3c240x_iis_timer_exp), (void *)(FPTR)0);
1751   state->s3c240x_lcd_timer = machine->scheduler().timer_alloc(FUNC(s3c240x_lcd_timer_exp), (void *)(FPTR)0);
17521752   state->eeprom_data = auto_alloc_array( machine, UINT8, 0x2000);
17531753   smc_init( machine);
17541754   i2s_init( machine);
src/mess/drivers/saturn.c
r10315r10316
13981398   if(LOG_SCU) logerror("DMA transfer END\n");
13991399
14001400   /*TODO: timing of this*/
1401   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv0_ended);
1401   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended));
14021402
14031403   if(scu_add_tmp & 0x80000000)
14041404   {
r10315r10316
14991499
15001500   if(LOG_SCU) logerror("DMA transfer END\n");
15011501
1502   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv1_ended);
1502   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended));
15031503
15041504   if(scu_add_tmp & 0x80000000)
15051505   {
r10315r10316
16001600
16011601   if(LOG_SCU) logerror("DMA transfer END\n");
16021602
1603   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv2_ended);
1603   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended));
16041604
16051605   if(scu_add_tmp & 0x80000000)
16061606   {
r10315r10316
16751675
16761676   }while(job_done == 0);
16771677
1678   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv0_ended);
1678   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended));
16791679}
16801680
16811681static void dma_indirect_lv1(address_space *space)
r10315r10316
17441744
17451745   }while(job_done == 0);
17461746
1747   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv1_ended);
1747   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended));
17481748}
17491749
17501750static void dma_indirect_lv2(address_space *space)
r10315r10316
18121812
18131813   }while(job_done == 0);
18141814
1815   timer_set(space->machine, attotime::from_usec(300), NULL, 0, dma_lv2_ended);
1815   space->machine->scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended));
18161816}
18171817
18181818
r10315r10316
21682168
21692169   /*TODO: timing of this one (related to the VDP1 speed)*/
21702170   /*      (NOTE: value shouldn't be at h_sync/v_sync position (will break shienryu))*/
2171   timer_set(device->machine, device->machine->primary_screen->time_until_pos(0,0), NULL, 0, vdp1_irq);
2171   device->machine->scheduler().timer_set(device->machine->primary_screen->time_until_pos(0,0), FUNC(vdp1_irq));
21722172}
21732173
21742174static void saturn_init_driver(running_machine *machine, int rgn)
src/mess/drivers/supracan.c
r10315r10316
17781778{
17791779    supracan_state *state = machine->driver_data<supracan_state>();
17801780
1781   state->video_timer = timer_alloc( machine, supracan_video_callback, NULL );
1782    state->hbl_timer = timer_alloc( machine, supracan_hbl_callback, NULL );
1783    state->line_on_timer = timer_alloc( machine, supracan_line_on_callback, NULL );
1784    state->line_off_timer = timer_alloc( machine, supracan_line_off_callback, NULL );
1781   state->video_timer = machine->scheduler().timer_alloc(FUNC(supracan_video_callback));
1782    state->hbl_timer = machine->scheduler().timer_alloc(FUNC(supracan_hbl_callback));
1783    state->line_on_timer = machine->scheduler().timer_alloc(FUNC(supracan_line_on_callback));
1784    state->line_off_timer = machine->scheduler().timer_alloc(FUNC(supracan_line_off_callback));
17851785}
17861786
17871787
src/mess/drivers/4004clk.c
r10315r10316
137137   state->timer = 0;
138138   state->dac = machine->device("dac");
139139
140   timer_pulse(machine, attotime::from_hz(120), NULL, 0, timer_callback);
140   machine->scheduler().timer_pulse(attotime::from_hz(120), FUNC(timer_callback));
141141
142142   /* register for state saving */
143143   state_save_register_global(machine, state->timer);
src/mess/drivers/craft.c
r10315r10316
4747   craft_state(running_machine &machine, const driver_device_config_base &config)
4848      : driver_device(machine, config)
4949   {
50       timer0_timer = timer_alloc(&machine, avr8_timer0_tick, 0);
50       timer0_timer = machine.scheduler().timer_alloc(FUNC(avr8_timer0_tick));
5151      timer0_increment = 1;
5252
53       timer1_timer = timer_alloc(&machine, avr8_timer1_tick, 0);
53       timer1_timer = machine.scheduler().timer_alloc(FUNC(avr8_timer1_tick));
5454      timer1_increment = 1;
5555
56       timer2_timer = timer_alloc(&machine, avr8_timer2_tick, 0);
56       timer2_timer = machine.scheduler().timer_alloc(FUNC(avr8_timer2_tick));
5757      timer2_increment = 1;
5858   }
5959
src/mess/drivers/vg5k.c
r10315r10316
284284{
285285   cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
286286
287   timer_set(machine, attotime::from_usec(100), NULL, 0, z80_irq_clear);
287   machine->scheduler().timer_set(attotime::from_usec(100), FUNC(z80_irq_clear));
288288}
289289
290290static TIMER_DEVICE_CALLBACK( vg5k_scanline )
r10315r10316
304304   vg5k->printer = machine->device("printer");
305305   vg5k->cassette = machine->device("cassette");
306306
307   timer_pulse(machine, attotime::from_msec(20), NULL, 0, z80_irq);
307   machine->scheduler().timer_pulse(attotime::from_msec(20), FUNC(z80_irq));
308308
309309   state_save_register_global(machine, vg5k->ef9345_offset);
310310}
src/mess/drivers/intv.c
r10315r10316
370370static INTERRUPT_GEN( intv_interrupt2 )
371371{
372372   cputag_set_input_line(device->machine, "keyboard", 0, ASSERT_LINE);
373   timer_set(device->machine, device->machine->device<cpu_device>("keyboard")->cycles_to_attotime(100), NULL, 0, intv_interrupt2_complete);
373   device->machine->scheduler().timer_set(device->machine->device<cpu_device>("keyboard")->cycles_to_attotime(100), FUNC(intv_interrupt2_complete));
374374}
375375
376376static MACHINE_CONFIG_START( intv, intv_state )
src/mess/drivers/mephisto.c
r10315r10316
340340   mephisto_state *state = machine->driver_data<mephisto_state>();
341341   state->lcd_shift_counter=3;
342342
343   timer_pulse(machine, attotime::from_hz(600), NULL, 0, update_nmi);
344   timer_pulse(machine, attotime::from_hz(100), NULL, 0, mboard_update_artwork);
343   machine->scheduler().timer_pulse(attotime::from_hz(600), FUNC(update_nmi));
344   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(mboard_update_artwork));
345345
346346   mboard_savestate_register(machine);
347347}
r10315r10316
352352   state->lcd_shift_counter=3;
353353   state->led7=0xff;
354354
355   timer_pulse(machine, attotime::from_hz(450), NULL, 0, update_irq);
356   timer_pulse(machine, attotime::from_hz(100), NULL, 0, mboard_update_artwork);
355   machine->scheduler().timer_pulse(attotime::from_hz(450), FUNC(update_irq));
356   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(mboard_update_artwork));
357357
358358   mboard_savestate_register(machine);
359359}
src/mess/drivers/scv.c
r10315r10316
728728{
729729   scv_state *state = machine->driver_data<scv_state>();
730730
731   state->vb_timer = timer_alloc( machine, scv_vb_callback, NULL );
731   state->vb_timer = machine->scheduler().timer_alloc(FUNC(scv_vb_callback));
732732}
733733
734734
src/mess/drivers/supercon.c
r10315r10316
550550   state->led_update=TRUE;
551551   state->remove_led_flag=TRUE;
552552
553   state->timer_update_irq = timer_alloc(machine,update_irq,NULL);
553   state->timer_update_irq = machine->scheduler().timer_alloc(FUNC(update_irq));
554554   timer_adjust_periodic( state->timer_update_irq, attotime::zero, 0, attotime::from_hz(1000) );
555555
556   timer_pulse(machine, attotime::from_hz(20), NULL, 0, update_artwork);
556   machine->scheduler().timer_pulse(attotime::from_hz(20), FUNC(update_artwork));
557557
558558   state_save_register_global_array(machine,state->save_board);
559559   state_save_register_postload(machine,m_board_postload,NULL);
src/mess/drivers/h19.c
r10315r10316
8686
8787   UINT8 length = (offset & 0x20) ? 200 : 4;
8888   beep_set_state(state->beeper, 1);
89   timer_set(space->machine, attotime::from_msec(length), NULL, 0, h19_beepoff);
89   space->machine->scheduler().timer_set(attotime::from_msec(length), FUNC(h19_beepoff));
9090}
9191
9292static ADDRESS_MAP_START(h19_mem, ADDRESS_SPACE_PROGRAM, 8)
src/mess/drivers/avigo.c
r10315r10316
434434{
435435   /* a timer used to check status of pen */
436436   /* an interrupt is generated when the pen is pressed to the screen */
437   timer_pulse(machine, attotime::from_hz(50), NULL, 0, avigo_dummy_timer_callback);
437   machine->scheduler().timer_pulse(attotime::from_hz(50), FUNC(avigo_dummy_timer_callback));
438438}
439439
440440
src/mess/drivers/svision.c
r10315r10316
105105         svision_irq( space->machine );
106106         break;
107107      default:
108         logerror("%.6f svision read %04x %02x\n", timer_get_time(space->machine).as_double(),offset,data);
108         logerror("%.6f svision read %04x %02x\n", space->machine->time().as_double(),offset,data);
109109         break;
110110   }
111111
r10315r10316
126126      case 3:
127127         break;
128128      case 0x26: /* bits 5,6 memory management for a000? */
129         logerror("%.6f svision write %04x %02x\n", timer_get_time(space->machine).as_double(),offset,data);
129         logerror("%.6f svision write %04x %02x\n", space->machine->time().as_double(),offset,data);
130130         memory_set_bankptr(space->machine, "bank1", space->machine->region("user1")->base() + ((state->reg[0x26] & 0xe0) << 9));
131131         svision_irq( space->machine );
132132         break;
r10315r10316
154154         svision_noise_w(state->sound, offset - 0x28, data);
155155         break;
156156      default:
157         logerror("%.6f svision write %04x %02x\n", timer_get_time(space->machine).as_double(), offset, data);
157         logerror("%.6f svision write %04x %02x\n", space->machine->time().as_double(), offset, data);
158158         break;
159159   }
160160}
r10315r10316
425425static DRIVER_INIT( svision )
426426{
427427   svision_state *state = machine->driver_data<svision_state>();
428   state->svision.timer1 = timer_alloc(machine, svision_timer, NULL);
428   state->svision.timer1 = machine->scheduler().timer_alloc(FUNC(svision_timer));
429429   state->sound = machine->device("custom");
430430   state->dma_finished = svision_dma_finished(state->sound);
431431   state->pet.on = FALSE;
r10315r10316
435435static DRIVER_INIT( svisions )
436436{
437437   svision_state *state = machine->driver_data<svision_state>();
438   state->svision.timer1 = timer_alloc(machine, svision_timer, NULL);
438   state->svision.timer1 = machine->scheduler().timer_alloc(FUNC(svision_timer));
439439   state->sound = machine->device("custom");
440440   state->dma_finished = svision_dma_finished(state->sound);
441441   memory_set_bankptr(machine, "bank2", machine->region("user1")->base() + 0x1c000);
442   state->svision.timer1 = timer_alloc(machine, svision_timer, NULL);
442   state->svision.timer1 = machine->scheduler().timer_alloc(FUNC(svision_timer));
443443   state->pet.on = TRUE;
444   state->pet.timer = timer_alloc(machine, svision_pet_timer, NULL);
445   timer_pulse(machine, attotime::from_seconds(8) * 256/cputag_get_clock(machine, "maincpu"), NULL, 0, svision_pet_timer);
444   state->pet.timer = machine->scheduler().timer_alloc(FUNC(svision_pet_timer));
445   machine->scheduler().timer_pulse(attotime::from_seconds(8) * 256/cputag_get_clock(machine, "maincpu"),FUNC(svision_pet_timer),0);
446446}
447447
448448static DEVICE_IMAGE_LOAD( svision_cart )
src/mess/drivers/ti89.c
r10315r10316
461461      }
462462   }
463463
464   timer_pulse(machine, attotime::from_hz(1<<14), NULL, 0, ti68k_timer_callback);
464   machine->scheduler().timer_pulse(attotime::from_hz(1<<14), FUNC(ti68k_timer_callback));
465465
466466   logerror("HW=v%x, PC=%06x, Type=%s\n", m_hw_version, m_initial_pc, (m_flash_mem) ? "Flash" : "ROM");
467467}
src/mess/drivers/busicom.c
r10315r10316
194194
195195static MACHINE_START(busicom)
196196{
197   timer_pulse(machine, attotime::from_msec(28*2), NULL, 0, timer_callback);
197   machine->scheduler().timer_pulse(attotime::from_msec(28*2), FUNC(timer_callback));
198198}
199199
200200static MACHINE_RESET(busicom)
src/mess/drivers/micronic.c
r10315r10316
466466   /* RAM banks */
467467   memory_configure_bank(machine, "bank1", 0x02, 0x07, ram_get_ptr(machine->device(RAM_TAG)), 0x8000);
468468
469   state->rtc_periodic_irq = timer_alloc(machine, rtc_periodic_irq, 0);
469   state->rtc_periodic_irq = machine->scheduler().timer_alloc(FUNC(rtc_periodic_irq));
470470   /* register for state saving */
471471//  state_save_register_global(machine, state->);
472472}
src/mess/drivers/ptcsol.c
r10315r10316
493493static MACHINE_START( sol20 )
494494{
495495   sol20_state *state = machine->driver_data<sol20_state>();
496   state->m_cassette_timer = timer_alloc(machine, sol20_cassette_tc, NULL);
496   state->m_cassette_timer = machine->scheduler().timer_alloc(FUNC(sol20_cassette_tc));
497497}
498498
499499static MACHINE_RESET( sol20 )
r10315r10316
546546
547547   // boot-bank
548548   memory_set_bank(machine, "boot", 1);
549   timer_set(machine, attotime::from_usec(9), NULL, 0, sol20_boot);
549   machine->scheduler().timer_set(attotime::from_usec(9), FUNC(sol20_boot));
550550}
551551
552552static DRIVER_INIT( sol20 )
src/mess/drivers/ip20.c
r10315r10316
553553      }
554554   }
555555
556   timer_set(machine, attotime::from_msec(1), NULL, 0, ip20_timer);
556   machine->scheduler().timer_set(attotime::from_msec(1), FUNC(ip20_timer));
557557}
558558
559559static MACHINE_START( ip204415 )
r10315r10316
574574
575575   state->nRTC_Temp = 0;
576576
577   timer_set(machine, attotime::from_msec(1), NULL, 0, ip20_timer);
577   machine->scheduler().timer_set(attotime::from_msec(1), FUNC(ip20_timer));
578578}
579579
580580static INPUT_PORTS_START( ip204415 )
src/mess/drivers/polgar.c
r10315r10316
391391
392392static MACHINE_START( polgar )
393393{
394   // timer_pulse(machine, attotime::from_hz(60), NULL, 0, update_leds);
395   timer_pulse(machine, attotime::from_hz(600), NULL, 0, update_nmi);
396   timer_pulse(machine, attotime::from_hz(100), NULL, 0, mboard_update_artwork);
394   // machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(update_leds));
395   machine->scheduler().timer_pulse(attotime::from_hz(600), FUNC(update_nmi));
396   machine->scheduler().timer_pulse(attotime::from_hz(100), FUNC(mboard_update_artwork));
397397   mboard_savestate_register(machine);
398398}
399399
src/mess/drivers/psion.c
r10315r10316
678678      memory_set_bank(machine, "rambank", 0);
679679   }
680680
681   timer_pulse(machine, attotime::from_seconds(1), NULL, 0, nmi_timer);
681   machine->scheduler().timer_pulse(attotime::from_seconds(1), FUNC(nmi_timer));
682682
683683   state_save_register_global(machine, m_kb_counter);
684684   state_save_register_global(machine, m_enable_nmi);
src/mess/drivers/gba.c
r10315r10316
21762176   machine->add_notifier(MACHINE_NOTIFY_EXIT, gba_machine_stop);
21772177
21782178   /* create a timer to fire scanline functions */
2179   state->scan_timer = timer_alloc(machine, perform_scan, 0);
2180   state->hbl_timer = timer_alloc(machine, perform_hbl, 0);
2179   state->scan_timer = machine->scheduler().timer_alloc(FUNC(perform_scan));
2180   state->hbl_timer = machine->scheduler().timer_alloc(FUNC(perform_hbl));
21812181   timer_adjust_oneshot(state->scan_timer, machine->primary_screen->time_until_pos(0, 0), 0);
21822182
21832183   /* and one for each DMA channel */
2184   state->dma_timer[0] = timer_alloc(machine, dma_complete, 0);
2185   state->dma_timer[1] = timer_alloc(machine, dma_complete, 0);
2186   state->dma_timer[2] = timer_alloc(machine, dma_complete, 0);
2187   state->dma_timer[3] = timer_alloc(machine, dma_complete, 0);
2184   state->dma_timer[0] = machine->scheduler().timer_alloc(FUNC(dma_complete));
2185   state->dma_timer[1] = machine->scheduler().timer_alloc(FUNC(dma_complete));
2186   state->dma_timer[2] = machine->scheduler().timer_alloc(FUNC(dma_complete));
2187   state->dma_timer[3] = machine->scheduler().timer_alloc(FUNC(dma_complete));
21882188   timer_adjust_oneshot(state->dma_timer[0], attotime::never, 0);
21892189   timer_adjust_oneshot(state->dma_timer[1], attotime::never, 1);
21902190   timer_adjust_oneshot(state->dma_timer[2], attotime::never, 2);
21912191   timer_adjust_oneshot(state->dma_timer[3], attotime::never, 3);
21922192
21932193   /* also one for each timer (heh) */
2194   state->tmr_timer[0] = timer_alloc(machine, timer_expire, 0);
2195   state->tmr_timer[1] = timer_alloc(machine, timer_expire, 0);
2196   state->tmr_timer[2] = timer_alloc(machine, timer_expire, 0);
2197   state->tmr_timer[3] = timer_alloc(machine, timer_expire, 0);
2194   state->tmr_timer[0] = machine->scheduler().timer_alloc(FUNC(timer_expire));
2195   state->tmr_timer[1] = machine->scheduler().timer_alloc(FUNC(timer_expire));
2196   state->tmr_timer[2] = machine->scheduler().timer_alloc(FUNC(timer_expire));
2197   state->tmr_timer[3] = machine->scheduler().timer_alloc(FUNC(timer_expire));
21982198   timer_adjust_oneshot(state->tmr_timer[0], attotime::never, 0);
21992199   timer_adjust_oneshot(state->tmr_timer[1], attotime::never, 1);
22002200   timer_adjust_oneshot(state->tmr_timer[2], attotime::never, 2);
22012201   timer_adjust_oneshot(state->tmr_timer[3], attotime::never, 3);
22022202
22032203   /* and an IRQ handling timer */
2204   state->irq_timer = timer_alloc(machine, handle_irq, 0);
2204   state->irq_timer = machine->scheduler().timer_alloc(FUNC(handle_irq));
22052205   timer_adjust_oneshot(state->irq_timer, attotime::never, 0);
22062206
22072207   gba_video_start(machine);
src/ldplayer/ldplayer.c
r10315r10316
238238   /* set a timer to go off on the next VBLANK */
239239   vblank_scanline = machine->primary_screen->visible_area().max_y + 1;
240240   target = machine->primary_screen->time_until_pos(vblank_scanline);
241   timer_set(machine, target, NULL, 0, vsync_update);
241   machine->scheduler().timer_set(target, FUNC(vsync_update));
242242}
243243
244244
r10315r10316
261261static MACHINE_RESET( ldplayer )
262262{
263263   /* set up a timer to start playing immediately */
264   timer_set(machine, attotime::zero, NULL, 0, autoplay);
264   machine->scheduler().timer_set(attotime::zero, FUNC(autoplay));
265265
266266   /* indicate the name of the file we opened */
267267   popmessage("Opened %s\n", filename.cstr());
r10315r10316
303303   {
304304      /* assert the line and set a timer for deassertion */
305305      laserdisc_line_w(laserdisc, LASERDISC_LINE_CONTROL, ASSERT_LINE);
306      timer_set(machine, attotime::from_usec(250), ptr, 0, pr8210_bit_off_callback);
306      machine->scheduler().timer_set(attotime::from_usec(250), FUNC(pr8210_bit_off_callback), 0, ptr);
307307
308308      /* space 0 bits apart by 1msec, and 1 bits by 2msec */
309309      duration = attotime::from_msec((data & 0x80) ? 2 : 1);
r10315r10316
325325{
326326   device_t *laserdisc = machine->m_devicelist.first(LASERDISC);
327327   MACHINE_START_CALL(ldplayer);
328   pr8210_bit_timer = timer_alloc(machine, pr8210_bit_callback, (void *)laserdisc);
328   pr8210_bit_timer = machine->scheduler().timer_alloc(FUNC(pr8210_bit_callback), (void *)laserdisc);
329329}
330330
331331

Previous 15994 Revisions Next


© 1998-2018 The MESS Team