Previous 15994 Revisions Next

r10327 Monday 7th February, 2011 at 08:23:44 UTC by Miodrag Milanović
Sync with MAME
[src/emu]devintrf.c devintrf.h diexec.c emu.h emucore.h emutempl.h* image.c inptport.c machine.c machine.h mconfig.c memory.c rendlay.c schedule.c schedule.h screen.c sound.c timer.c video.c watchdog.c
[src/emu/cpu]cpu.mak
[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/m37710]m37710.c
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/mb88xx]mb88xx.c
[src/emu/cpu/mips]mips3com.c
[src/emu/cpu/mn10200]mn10200.c
[src/emu/cpu/nec]v25.c v25sfr.c
[src/emu/cpu/powerpc]ppccom.c
[src/emu/cpu/sh2]sh2comn.c
[src/emu/cpu/sh4]sh4.c sh4comn.c
[src/emu/cpu/tlcs90]tlcs90.c
[src/emu/cpu/tms34010]tms34010.c
[src/emu/cpu/tms57002]tms57002.c tms57kdec.c* tms57kpr.h*
[src/emu/cpu/tms9900]99xxcore.h
[src/emu/cpu/z8]z8.c
[src/emu/debug]express.c express.h
[src/emu/imagedev]bitbngr.c flopdrv.c snapquik.c
[src/emu/machine]6522via.c 6526cia.c 6532riot.c 6840ptm.c 6850acia.c 68681.c 74123.c 8237dma.c 8257dma.c adc083x.c at28c16.c cdp1852.c ds2401.c ds2404.c f3853.c i2cmem.c idectrl.c ins8154.c intelfsh.c k033906.c ldv1000.c ldvp931.c mb3773.c mc146818.c mc68901.c microtch.c msm6242.c pc16552d.c pic8259.c pit8253.c rtc65271.c s3c2400.c s3c2410.c s3c2440.c s3c24xx.c scsidev.c smc91c9x.c timekpr.c tmp68301.c wd33c93.c x76f041.c x76f100.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 ay8910.c cdp1864.c cdp1869.c es5503.c es5506.c gaelco.c ics2115.c k053260.c k056800.c msm5205.c pokey.c psx.c qsound.c rf5c400.c saa1099.c scsp.c sp0250.c tms5110.c upd7759.c x1_010.c ym2151.c ymf271.c ymf278b.c
[src/emu/video]hd63484.c mc6845.c resnet.c tms34061.c voodoo.c
[src/ldplayer]ldplayer.c
[src/lib/util]palette.c tagmap.c
[src/mame/audio]8080bw.c amiga.c cage.c dcs.c dkong.c exidy.c geebee.c gottlieb.c leland.c mcr.c n8080.c segag80r.c segasnd.c snes_snd.c starwars.c vicdual.c warpwarp.c williams.c
[src/mame/drivers]39in1.c acefruit.c alg.c aquarium.c aristmk5.c astinvad.c atetris.c backfire.c beaminv.c berzerk.c bfcobra.c blitz68k.c bmcbowl.c calchase.c cave.c ccastles.c chaknpop.c clayshoo.c cliffhgr.c cloud9.c combatsc.c coolpool.c cps3.c crbaloon.c crystal.c csplayh5.c cubocd32.c cvs.c darkhors.c ddenlovr.c deco32.c deco_mlc.c dribling.c dunhuang.c dynax.c enigma2.c eolithsp.c equites.c fantland.c firebeat.c fortecar.c fuukifg2.c fuukifg3.c galaga.c galaxian.c galpani2.c galpani3.c gamecstl.c gameplan.c gijoe.c gottlieb.c gridlee.c guab.c halleys.c hornet.c hyprduel.c igs011.c igs017.c itech32.c jangou.c jchan.c jedi.c jpmsys5.c kaneko16.c karnov.c kickgoal.c konamigx.c ksys573.c lgp.c lockon.c lordgun.c m107.c m72.c m92.c magmax.c megadriv.c metro.c midzeus.c missile.c moo.c mpu4.c mpu4drvr.c mquake.c mustache.c mw8080bw.c namcofl.c namcona1.c namcos10.c namcos11.c namcos12.c namcos21.c namcos23.c naomi.c nbmj9195.c neogeo.c neoprint.c nitedrvr.c niyanpai.c nmk16.c othello.c paradise.c pgm.c pipeline.c pirates.c psikyo.c r2dtank.c runaway.c sbrkout.c seattle.c segag80r.c segaorun.c segas16a.c segas16b.c segas18.c segaxbd.c segaybd.c seta.c seta2.c sigmab98.c spacefb.c ssfindo.c sslam.c ssv.c statriv2.c stv.c subsino2.c superqix.c system1.c taito_l.c taitogn.c taitowlf.c tetrisp2.c tickee.c tmaster.c tubep.c tumbleb.c unico.c vegas.c viper.c vmetal.c xexex.c xtheball.c yunsung8.c zaccaria.c zn.c
[src/mame/machine]amiga.c archimds.c arkanoid.c asic65.c atarigen.c cdi070.c cdicdic.c cdislave.c cubocd32.c dc.c dec0.c decocass.c docastle.c gaelco3d.c gaelcrpt.c harddriv.c irobot.c kaneko16.c konppc.c leland.c mcr.c mcr68.c megadriv.c meters.c micro3d.c midwayic.c mw8080bw.c n64.c namco06.c namco51.c namcos1.c namcos2.c naomibd.c pcshare.c pitnrun.c psx.c qix.c scramble.c segamsys.c slapstic.c slikshot.c snes.c starwars.c stvcd.c tait8741.c taitosj.c ticket.c twincobr.c tx1.c vertigo.c williams.c zs01.c
[src/mame/video]artmagic.c astrocde.c atari.c atarimo.c atarisy2.c avgdvg.c btoads.c changela.c dc.c dcheese.c dkong.c esripsys.c fromance.c galaxold.c gameplan.c genesis.c itech32.c jagblit.c jaguar.c konamiic.c konicdev.c leland.c lockon.c mcd212.c midvunit.c midzeus2.c mystston.c n8080.c neogeo.c phoenix.c ppu2c0x.c psx.c rpunch.c starfire.c twin16.c tx1.c victory.c ygv608.c
[src/mess/audio]mea8000.c t6721.c ted7360.c upd1771.c
[src/mess/devices]cococart.c kermit.c microdrv.c xmodem.c
[src/mess/drivers]a2600.c a7000.c ami1200.c aquarius.c atarist.c beta.c cat.c craft.c dectalk.c einstein.c fm7.c fmtowns.c gba.c gizmondo.c gp32.c hp49gp.c jr200.c lx800.c micronic.c mpf1.c nc.c newbrain.c ng_aes.c ngp.c osbexec.c pb1000.c pc6001.c pc88va.c pcw.c phunsy.c pockstat.c prof80.c psx.c ptcsol.c pv1000.c pv2000.c px4.c rt1715.c samcoupe.c saturn.c scv.c supercon.c supracan.c svision.c tec1.c tm990189.c tmc1800.c tutor.c x07.c x1.c x68k.c z88.c
[src/mess/machine]6551.c 8530scc.c abc77.c adc080x.c amigacd.c amigafdc.c amigakbd.c apple2gs.c applefdc.c at29040.c at29040a.c ay31015.c bbc.c c128.c c1541.c c1551.c c1571.c c2040.c c64.c cdp1871.c coco.c com8116.c compis.c comx35.c corvushd.c dc.c docg3.c e0516.c e05a03.c electron.c europc.c fm_scsi.c gamecom.c gb.c hd63450.c hec2hrp.c hecdisk2.c i8155.c i8257.c i8271.c ibmpc.c kb3600.c kc.c kr2376.c lisa.c lynx.c mac.c matsucd.c mbc55x.c mc68328.c mc6843.c mc6846.c mc6854.c mm58274c.c mm74c922.c mockngbd.c mos6530.c msm58321.c nes.c nes_pcb.c osborne1.c pc.c pc_fdc.c pc_hdc.c pc_mouse.c pce.c pcf8593.c pdp1.c pecom.c pet.c pf10.c pmd85.c pokemini.c poly88.c rmnimbus.c rp5c01a.c rp5c15.c samcoupe.c scsibus.c serial.c sgi.c smc92x4.c sms.c sorcerer.c sym1.c tandy1t.c tf20.c thomflop.c thomson.c tms5501.c tms9901.c tms9902.c trs80.c tx0.c upd1990a.c upd71071.c upd765.c vectrex.c wd17xx.c wswan.c z80ne.c zx.c zx8302.c
[src/mess/machine/ti99]bwg.c handset.c hfdc.c ti_fdc.c
[src/mess/video]911_vdt.c a7800.c aim65.c atarist.c cdp1861.c coco3.c coco6847.c crt9007.c crtc_ega.c ef9345.c electron.c fm7.c fmtowns.c galaxy.c gamecom.c gb.c gf4500.c hd44352.c hd44780.c hd61830.c k1ge.c m6845.c m6847.c odyssey2.c samcoupe.c smsvdp.c thomson.c upd3301.c upd7220.c vectrex.c vidbrain.c x68k.c zx8301.c
[src/osd/windows]drawgdi.c drawnone.c winmenu.c

src/mame/audio/warpwarp.c
r10326r10327
7373         * 0.639 * 15k * 1uF -> 0.9585s
7474         */
7575      attotime period = attotime::from_hz(32768) * 95850 / 100000;
76      timer_adjust_periodic(state->sound_volume_timer, period, 0, period);
76      state->sound_volume_timer->adjust(period, 0, period);
7777   }
7878   else
7979   {
r10326r10327
8686         */
8787      //attotime period = attotime::from_hz(32768) * 702900 / 100000;
8888      attotime period = attotime::from_hz(32768) * 191700 / 100000;
89      timer_adjust_periodic(state->sound_volume_timer, period, 0, period);
89      state->sound_volume_timer->adjust(period, 0, period);
9090   }
9191}
9292
r10326r10327
125125         * ...I'm sure this is off by one number of magnitude :/
126126         */
127127      attotime period = attotime::from_hz(32768) * 95850 / 100000;
128      timer_adjust_periodic(state->music_volume_timer, period, 0, period);
128      state->music_volume_timer->adjust(period, 0, period);
129129   }
130130   else
131131   {
r10326r10327
136136         */
137137      //attotime period = attotime::from_hz(32768) * 3003300 / 100000;
138138      attotime period = attotime::from_hz(32768) * 300330 / 100000;
139      timer_adjust_periodic(state->music_volume_timer, period, 0, period);
139      state->music_volume_timer->adjust(period, 0, period);
140140   }
141141
142142}
src/mame/audio/n8080.c
r10326r10327
142142
143143   update_SN76477_status(sn);
144144
145   timer_adjust_oneshot(state->sound_timer[n], expire, n);
145   state->sound_timer[n]->adjust(expire, n);
146146}
147147
148148
r10326r10327
153153
154154   update_SN76477_status(sn);
155155
156   timer_adjust_oneshot(state->sound_timer[n], attotime::never, n);
156   state->sound_timer[n]->adjust(attotime::never, n);
157157}
158158
159159
r10326r10327
443443
444444   if (state->mono_flop[2])
445445   {
446      voltage = 5 * (1 - exp(- timer_timeelapsed(state->sound_timer[2]).as_double() / 0.22));
446      voltage = 5 * (1 - exp(- state->sound_timer[2]->elapsed().as_double() / 0.22));
447447   }
448448
449449   sn76477_vco_voltage_w(sn, voltage);
src/mame/audio/cage.c
r10326r10327
520520UINT16 main_from_cage_r(address_space *space)
521521{
522522   if (LOG_COMM)
523      logerror("%s:main read data = %04X\n", cpuexec_describe_context(space->machine), soundlatch_word_r(space, 0, 0));
523      logerror("%s:main read data = %04X\n", space->machine->describe_context(), soundlatch_word_r(space, 0, 0));
524524   cage_to_cpu_ready = 0;
525525   update_control_lines(space->machine);
526526   return soundlatch_word_r(space, 0, 0xffff);
r10326r10327
540540{
541541   running_machine *machine = cage_cpu->machine;
542542   if (LOG_COMM)
543      logerror("%s:Command to CAGE = %04X\n", cpuexec_describe_context(machine), data);
543      logerror("%s:Command to CAGE = %04X\n", machine->describe_context(), data);
544544   machine->scheduler().synchronize(FUNC(deferred_cage_w), data);
545545}
546546
src/mame/audio/segasnd.c
r10326r10327
359359   space->machine->scheduler().synchronize(FUNC(delayed_usb_data_w), data);
360360
361361   /* boost the interleave so that sequences can be sent */
362   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(250));
362   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(250));
363363}
364364
365365
src/mame/audio/leland.c
r10326r10327
834834         case 0x0d:   state->i80186.intr.in_service &= ~0x20;   break;
835835         case 0x0e:   state->i80186.intr.in_service &= ~0x40;   break;
836836         case 0x0f:   state->i80186.intr.in_service &= ~0x80;   break;
837         default:   logerror("%s:ERROR - 80186 EOI with unknown vector %02X\n", cpuexec_describe_context(machine), data & 0x1f);
837         default:   logerror("%s:ERROR - 80186 EOI with unknown vector %02X\n", machine->describe_context(), data & 0x1f);
838838      }
839839      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine->time().as_double(), data & 0x1f);
840840   }
r10326r10327
906906   if (t->control & 0x0001)
907907   {
908908      int count = t->maxA ? t->maxA : 0x10000;
909      timer_adjust_oneshot(t->int_timer, attotime::from_hz(2000000) * count, which);
909      t->int_timer->adjust(attotime::from_hz(2000000) * count, which);
910910      if (LOG_TIMER) logerror("  Repriming interrupt\n");
911911   }
912912   else
913      timer_adjust_oneshot(t->int_timer, attotime::never, which);
913      t->int_timer->adjust(attotime::never, which);
914914}
915915
916916
r10326r10327
921921   /* if we have a timing timer running, adjust the count */
922922   if (t->time_timer_active)
923923   {
924      attotime current_time = timer_timeelapsed(t->time_timer);
924      attotime current_time = t->time_timer->elapsed();
925925      int net_clocks = ((current_time - t->last_time) * 2000000).as_double();
926926      t->last_time = current_time;
927927
r10326r10327
10241024            internal_timer_sync(state, which);
10251025
10261026            /* nuke the timer and force the interrupt timer to be recomputed */
1027            timer_adjust_oneshot(t->time_timer, attotime::never, which);
1027            t->time_timer->adjust(attotime::never, which);
10281028            t->time_timer_active = 0;
10291029            update_int_timer = 1;
10301030         }
r10326r10327
10331033         else if ((diff & 0x8000) && (new_control & 0x8000))
10341034         {
10351035            /* start the timing */
1036            timer_adjust_oneshot(t->time_timer, attotime::never, which);
1036            t->time_timer->adjust(attotime::never, which);
10371037            t->time_timer_active = 1;
10381038            update_int_timer = 1;
10391039         }
r10326r10327
10621062         {
10631063            int diff = t->maxA - t->count;
10641064            if (diff <= 0) diff += 0x10000;
1065            timer_adjust_oneshot(t->int_timer, attotime::from_hz(2000000) * diff, which);
1065            t->int_timer->adjust(attotime::from_hz(2000000) * diff, which);
10661066            if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which);
10671067         }
10681068         else
1069            timer_adjust_oneshot(t->int_timer, attotime::never, which);
1069            t->int_timer->adjust(attotime::never, which);
10701070      }
10711071}
10721072
r10326r10327
11531153         if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
11541154
11551155         d->finished = 0;
1156         timer_adjust_oneshot(d->finish_timer, attotime::from_hz(state->dac[dacnum].frequency) * count, which);
1156         d->finish_timer->adjust(attotime::from_hz(state->dac[dacnum].frequency) * count, which);
11571157      }
11581158   }
11591159
r10326r10327
16121612   if (ctr->timer)
16131613   {
16141614      /* determine how many 2MHz cycles are remaining */
1615      int count = (timer_timeleft(ctr->timer) * 2000000).as_double();
1615      int count = (ctr->timer->remaining() * 2000000).as_double();
16161616      ctr->count = (count < 0) ? 0 : count;
16171617   }
16181618}
r10326r10327
16961696            if (ctr->count == 0) ctr->count = 0x10000;
16971697
16981698            /* reset/start the timer */
1699            timer_adjust_oneshot(ctr->timer, attotime::never, 0);
1699            ctr->timer->adjust(attotime::never);
17001700
17011701            if (LOG_PIT) logerror("PIT counter %d set to %d (%d Hz)\n", which, ctr->count, 4000000 / ctr->count);
17021702
r10326r10327
18071807{
18081808   device_t *device = (device_t *)ptr;
18091809   leland_sound_state *state = get_safe_token(device);
1810   if (LOG_COMM) logerror("%s:Write sound command latch lo = %02X\n", cpuexec_describe_context(machine), param);
1810   if (LOG_COMM) logerror("%s:Write sound command latch lo = %02X\n", machine->describe_context(), param);
18111811   state->sound_command = (state->sound_command & 0xff00) | param;
18121812}
18131813
src/mame/audio/segag80r.c
r10326r10327
520520   if ((diff & 0x20) && !(newval & 0x20))
521521   {
522522      //mame_printf_debug("Stopping timer\n");
523      timer_adjust_oneshot(sega005_sound_timer, attotime::never, 0);
523      sega005_sound_timer->adjust(attotime::never);
524524   }
525525
526526   /* if bit 5 goes low, we start the timer again */
527527   if ((diff & 0x20) && (newval & 0x20))
528528   {
529529      //mame_printf_debug("Starting timer\n");
530      timer_adjust_periodic(sega005_sound_timer, attotime::from_hz(SEGA005_555_TIMER_FREQ), 0, attotime::from_hz(SEGA005_555_TIMER_FREQ));
530      sega005_sound_timer->adjust(attotime::from_hz(SEGA005_555_TIMER_FREQ), 0, attotime::from_hz(SEGA005_555_TIMER_FREQ));
531531   }
532532}
533533
r10326r10327
948948    */
949949   n7751_command = data & 0x07;
950950   cputag_set_input_line(device->machine, "audiocpu", 0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE);
951   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(100));
951   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
952952}
953953
954954
src/mame/audio/dcs.c
r10326r10327
15021502{
15031503   /* only boost for DCS2 boards */
15041504   if (!dcs.auto_ack && !transfer.hle_enabled)
1505      cpuexec_boost_interleave(dcs.cpu->machine, attotime::from_nsec(500), attotime::from_usec(5));
1505      dcs.cpu->machine->scheduler().boost_interleave(attotime::from_nsec(500), attotime::from_usec(5));
15061506   return dcs.latch_control;
15071507}
15081508
r10326r10327
15121512   /* going high halts the CPU */
15131513   if (state)
15141514   {
1515      logerror("%s: DCS reset = %d\n", cpuexec_describe_context(dcs.cpu->machine), state);
1515      logerror("%s: DCS reset = %d\n", dcs.cpu->machine->describe_context(), state);
15161516
15171517      /* just run through the init code again */
15181518      dcs.cpu->machine->scheduler().synchronize(FUNC(dcs_reset));
r10326r10327
15571557static void dcs_delayed_data_w(running_machine *machine, int data)
15581558{
15591559   if (LOG_DCS_IO)
1560      logerror("%s:dcs_data_w(%04X)\n", cpuexec_describe_context(machine), data);
1560      logerror("%s:dcs_data_w(%04X)\n", machine->describe_context(), data);
15611561
15621562   /* boost the interleave temporarily */
1563   cpuexec_boost_interleave(machine, attotime::from_nsec(500), attotime::from_usec(5));
1563   machine->scheduler().boost_interleave(attotime::from_nsec(500), attotime::from_usec(5));
15641564
15651565   /* set the IRQ line on the ADSP */
15661566   cpu_set_input_line(dcs.cpu, ADSP2105_IRQ2, ASSERT_LINE);
r10326r10327
16631663      delayed_ack_w();
16641664
16651665   if (LOG_DCS_IO)
1666      logerror("%s:dcs_data_r(%04X)\n", cpuexec_describe_context(dcs.cpu->machine), dcs.output_data);
1666      logerror("%s:dcs_data_r(%04X)\n", dcs.cpu->machine->describe_context(), dcs.output_data);
16671667   return dcs.output_data;
16681668}
16691669
r10326r10327
21532153         if (data == 0x001a)
21542154         {
21552155            if (LOG_DCS_TRANSFERS)
2156               logerror("%s:DCS Transfer command %04X\n", cpuexec_describe_context(machine), data);
2156               logerror("%s:DCS Transfer command %04X\n", machine->describe_context(), data);
21572157            transfer.state++;
21582158            if (transfer.hle_enabled)
21592159               return 1;
r10326r10327
21632163         else if (data == 0x002a)
21642164         {
21652165            if (LOG_DCS_TRANSFERS)
2166               logerror("%s:DCS State change %04X\n", cpuexec_describe_context(machine), data);
2166               logerror("%s:DCS State change %04X\n", machine->describe_context(), data);
21672167            transfer.dcs_state = 1;
21682168         }
21692169
r10326r10327
22892289         if (data == 0x55d0 || data == 0x55d1)
22902290         {
22912291            if (LOG_DCS_TRANSFERS)
2292               logerror("%s:DCS Transfer command %04X\n", cpuexec_describe_context(machine), data);
2292               logerror("%s:DCS Transfer command %04X\n", machine->describe_context(), data);
22932293            transfer.state++;
22942294            if (transfer.hle_enabled)
22952295               return 1;
r10326r10327
22992299         else
23002300         {
23012301            if (LOG_DCS_TRANSFERS)
2302               logerror("%s:Command: %04X\n", cpuexec_describe_context(machine), data);
2302               logerror("%s:Command: %04X\n", machine->describe_context(), data);
23032303         }
23042304         break;
23052305
src/mame/audio/gottlieb.c
r10326r10327
420420INLINE void nmi_timer_adjust(void)
421421{
422422   /* adjust timer to go off in the future based on the current rate */
423   timer_adjust_oneshot(nmi_timer, attotime::from_hz(SOUND2_CLOCK/16) * (256 * (256 - nmi_rate)), 0);
423   nmi_timer->adjust(attotime::from_hz(SOUND2_CLOCK/16) * (256 * (256 - nmi_rate)));
424424}
425425
426426
src/mame/audio/exidy.c
r10326r10327
495495
496496   if (state->tms != NULL)
497497   {
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));
498      logerror("(%f)%s:TMS5220 data write = %02X\n", device->machine->time().as_double(), device->machine->describe_context(), riot6532_porta_out_get(state->riot));
499499      tms5220_data_w(state->tms, 0, data);
500500   }
501501}
r10326r10327
505505   exidy_sound_state *state = get_safe_token(device);
506506   if (state->tms != NULL)
507507   {
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));
508      logerror("(%f)%s:TMS5220 status read = %02X\n", device->machine->time().as_double(), device->machine->describe_context(), tms5220_status_r(state->tms, 0));
509509      return tms5220_status_r(state->tms, 0);
510510   }
511511   else
r10326r10327
10161016{
10171017   exidy_sound_state *state = get_safe_token(device);
10181018
1019   if (VICTORY_LOG_SOUND) logerror("%s:!!!! Sound IRQ clear = %02X\n", cpuexec_describe_context(device->machine), data);
1019   if (VICTORY_LOG_SOUND) logerror("%s:!!!! Sound IRQ clear = %02X\n", device->machine->describe_context(), data);
10201020
10211021   if (!data) pia6821_ca1_w(state->pia1, 1);
10221022}
r10326r10327
10261026{
10271027   exidy_sound_state *state = get_safe_token(device);
10281028
1029   if (VICTORY_LOG_SOUND) logerror("%s:!!!! Sound Main ACK W = %02X\n", cpuexec_describe_context(device->machine), data);
1029   if (VICTORY_LOG_SOUND) logerror("%s:!!!! Sound Main ACK W = %02X\n", device->machine->describe_context(), data);
10301030
10311031   if (state->victory_sound_response_ack_clk && !data)
10321032      pia6821_cb1_w(state->pia1, 1);
src/mame/audio/8080bw.c
r10326r10327
815815         if (state->schaser_effect_555_time_remain != attotime::zero)
816816         {
817817            /* timer re-enabled, use up remaining 555 high time */
818            timer_adjust_oneshot(state->schaser_effect_555_timer, state->schaser_effect_555_time_remain, effect);
818            state->schaser_effect_555_timer->adjust(state->schaser_effect_555_time_remain, effect);
819819         }
820820         else if (!state->schaser_effect_555_is_low)
821821         {
822822            /* set 555 high time */
823823            attotime new_time = attotime(0, ATTOSECONDS_PER_SECOND * .8873 * schaser_effect_rc[effect]);
824            timer_adjust_oneshot(state->schaser_effect_555_timer, new_time, effect);
824            state->schaser_effect_555_timer->adjust(new_time, effect);
825825         }
826826      }
827827      else
r10326r10327
829829         /* disable effect - stops at end of low cycle */
830830         if (!state->schaser_effect_555_is_low)
831831         {
832            state->schaser_effect_555_time_remain = timer_timeleft(state->schaser_effect_555_timer);
832            state->schaser_effect_555_time_remain = state->schaser_effect_555_timer->remaining();
833833                  state->schaser_effect_555_time_remain_savable = state->schaser_effect_555_time_remain.as_double();
834            timer_adjust_oneshot(state->schaser_effect_555_timer, attotime::never, 0);
834            state->schaser_effect_555_timer->adjust(attotime::never);
835835         }
836836      }
837837      state->schaser_last_effect = effect;
r10326r10327
899899      else
900900         new_time = attotime::never;
901901   }
902   timer_adjust_oneshot(state->schaser_effect_555_timer, new_time, effect);
902   state->schaser_effect_555_timer->adjust(new_time, effect);
903903   sn76477_enable_w(state->sn, !(state->schaser_effect_555_is_low || state->schaser_explosion));
904904   sn76477_one_shot_cap_voltage_w(state->sn, !(state->schaser_effect_555_is_low || state->schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
905905}
r10326r10327
934934   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
935935
936936   state->schaser_effect_555_is_low = 0;
937   timer_adjust_oneshot(state->schaser_effect_555_timer, attotime::never, 0);
937   state->schaser_effect_555_timer->adjust(attotime::never);
938938   schaser_sh_port_1_w(space, 0, 0);
939939   schaser_sh_port_2_w(space, 0, 0);
940940   state->schaser_effect_555_time_remain = attotime::zero;
src/mame/audio/amiga.c
r10326r10327
8686{
8787   chan->curlocation = CUSTOM_REG_LONG(REG_AUD0LCH + chan->index * 8);
8888   chan->curlength = CUSTOM_REG(REG_AUD0LEN + chan->index * 8);
89   timer_adjust_oneshot(chan->irq_timer, attotime::from_hz(15750), chan->index);
89   chan->irq_timer->adjust(attotime::from_hz(15750), chan->index);
9090   LOG(("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength));
9191}
9292
src/mame/audio/mcr.c
r10326r10327
521521
522522   /* oftentimes games will write one nibble at a time; the sync on this is very */
523523   /* important, so we boost the interleave briefly while this happens */
524   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
524   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
525525}
526526
527527static READ16_DEVICE_HANDLER( csdeluxe_pia_r )
r10326r10327
659659
660660   /* oftentimes games will write one nibble at a time; the sync on this is very */
661661   /* important, so we boost the interleave briefly while this happens */
662   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(250));
662   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(250));
663663}
664664
665665
r10326r10327
763763
764764   /* oftentimes games will write one nibble at a time; the sync on this is very */
765765   /* important, so we boost the interleave briefly while this happens */
766   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
766   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
767767}
768768
769769
src/mame/audio/vicdual.c
r10326r10327
170170      if (last_croak)
171171      {
172172         /* The croak will keep playing until .429s after being disabled */
173         timer_adjust_oneshot(frogs_croak_timer, attotime::from_double(1.1 * RES_K(390) * CAP_U(1)), 0);
173         frogs_croak_timer->adjust(attotime::from_double(1.1 * RES_K(390) * CAP_U(1)));
174174      }
175175   }
176176   if (new_buzzz)
src/mame/audio/dkong.c
r10326r10327
12531253   }
12541254   else
12551255   {
1256      /* printf("%s:rom access\n",cpuexec_describe_context(device->machine)); */
1256      /* printf("%s:rom access\n",device->machine->describe_context()); */
12571257      return (state->snd_rom[0x1000 + (page & 7) * 256 + offset]);
12581258   }
12591259}
src/mame/audio/geebee.c
r10326r10327
5959         * discharge C33 (1uF) through R50 (22k) -> 0.14058s
6060         */
6161      attotime period = attotime::from_hz(32768) * 14058 / 100000;
62      timer_adjust_periodic(state->volume_timer, period, 0, period);
62      state->volume_timer->adjust(period, 0, period);
6363   }
6464   else
6565   {
r10326r10327
7171         * maybe half as fast?
7272         */
7373      attotime period = attotime::from_hz(32768) * 29060 / 100000;
74      timer_adjust_periodic(state->volume_timer, period, 0, period);
74      state->volume_timer->adjust(period, 0, period);
7575    }
7676}
7777
src/mame/audio/snes_snd.c
r10326r10327
11511151            }
11521152
11531153            spc700->enabled[i] = BIT(data, i);
1154            timer_enable(spc700->timer[i], spc700->enabled[i]);
1154            spc700->timer[i]->enable(spc700->enabled[i]);
11551155         }
11561156
11571157         if (BIT(data, 4))
r10326r10327
11861186      case 0x7:      /* Port 3 */
11871187         // mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset & 3, cpu_get_pc(space->cpu));
11881188         spc700->port_out[offset - 4] = data;
1189         cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(20));
1189         device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
11901190         break;
11911191      case 0xa:      /* Timer 0 */
11921192      case 0xb:      /* Timer 1 */
r10326r10327
13211321
13221322   /* Initialize the timers */
13231323   spc700->timer[0] = machine->scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
1324   timer_adjust_periodic(spc700->timer[0], attotime::from_hz(8000),  0, attotime::from_hz(8000));
1325   timer_enable(spc700->timer[0], 0);
1324   spc700->timer[0]->adjust(attotime::from_hz(8000),  0, attotime::from_hz(8000));
1325   spc700->timer[0]->enable(false);
13261326   spc700->timer[1] = machine->scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
1327   timer_adjust_periodic(spc700->timer[1], attotime::from_hz(8000),  1, attotime::from_hz(8000));
1328   timer_enable(spc700->timer[1], 0);
1327   spc700->timer[1]->adjust(attotime::from_hz(8000),  1, attotime::from_hz(8000));
1328   spc700->timer[1]->enable(false);
13291329   spc700->timer[2] = machine->scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
1330   timer_adjust_periodic(spc700->timer[2], attotime::from_hz(64000), 2, attotime::from_hz(64000));
1331   timer_enable(spc700->timer[2], 0);
1330   spc700->timer[2]->adjust(attotime::from_hz(64000), 2, attotime::from_hz(64000));
1331   spc700->timer[2]->enable(false);
13321332
13331333   state_register(device);
13341334   state_save_register_device_item_pointer(device, 0, spc700->ram, SNES_SPCRAM_SIZE);
src/mame/audio/williams.c
r10326r10327
674674   {
675675      cpu_set_input_line(sound_cpu, M6809_IRQ_LINE, ASSERT_LINE);
676676      williams_sound_int_state = 1;
677      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(100));
677      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
678678   }
679679}
680680
src/mame/audio/starwars.c
r10326r10327
8686   starwars_state *state = machine->driver_data<starwars_state>();
8787   riot6532_porta_in_set(state->riot, 0x40, 0x40);
8888   state->main_data = param;
89   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
89   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
9090}
9191
9292
r10326r10327
133133
134134   riot6532_porta_in_set(state->riot, 0x80, 0x80);
135135   state->sound_data = param;
136   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
136   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
137137}
138138
139139WRITE8_HANDLER( starwars_main_wr_w )
src/mame/machine/micro3d.c
r10326r10327
172172         /* Timer stopped */
173173         if (mode == 0)
174174         {
175            timer_enable(state->mc68901.timer_a, 0);
175            state->mc68901.timer_a->enable(false);
176176         }
177177         else if (mode < 8)
178178         {
r10326r10327
192192
193193            period = attotime::from_hz(4000000 / divisor) * data;
194194
195            timer_adjust_periodic(state->mc68901.timer_a, period, 0, period);
195            state->mc68901.timer_a->adjust(period, 0, period);
196196         }
197197         else
198198         {
r10326r10327
701701WRITE16_HANDLER( host_drmath_int_w )
702702{
703703   cputag_set_input_line(space->machine, "drmath", AM29000_INTR2, ASSERT_LINE);
704   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
704   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
705705}
706706
707707
src/mame/machine/cubocd32.c
r10326r10327
325325   if (cdda != NULL)
326326   {
327327      cdda_stop_audio(cdda);
328      timer_reset( state->frame_timer, attotime::never );
328      state->frame_timer->reset( );
329329   }
330330}
331331
r10326r10327
335335   if (cdda != NULL)
336336   {
337337      cdda_start_audio(cdda, lba, num_blocks);
338      timer_adjust_oneshot( state->frame_timer, attotime::from_hz( 75 ), 0 );
338      state->frame_timer->adjust( attotime::from_hz( 75 ) );
339339   }
340340}
341341
r10326r10327
350350
351351         if ( pause )
352352         {
353            timer_reset( state->frame_timer, attotime::never );
353            state->frame_timer->reset( );
354354         }
355355         else
356356         {
357            timer_adjust_oneshot( state->frame_timer, attotime::from_hz( 75 ), 0 );
357            state->frame_timer->adjust( attotime::from_hz( 75 ) );
358358         }
359359      }
360360   }
r10326r10327
417417         akiko_set_cd_status(state, 0x80000000);   /* subcode ready */
418418      }
419419
420      timer_adjust_oneshot( state->frame_timer, attotime::from_hz( 75 ), 0 );
420      state->frame_timer->adjust( attotime::from_hz( 75 ) );
421421   }
422422}
423423
r10326r10327
502502   if ( state->cdrom_readreqmask == 0 )
503503      akiko_set_cd_status(state, 0x04000000);
504504   else
505      timer_adjust_oneshot( state->dma_timer, attotime::from_usec( CD_SECTOR_TIME / state->cdrom_speed ), 0 );
505      state->dma_timer->adjust( attotime::from_usec( CD_SECTOR_TIME / state->cdrom_speed ) );
506506}
507507
508508static void akiko_start_dma(akiko_state *state)
r10326r10327
518518
519519   state->cdrom_lba_cur = state->cdrom_lba_start;
520520
521   timer_adjust_oneshot( state->dma_timer, attotime::from_usec( CD_SECTOR_TIME / state->cdrom_speed ), 0 );
521   state->dma_timer->adjust( attotime::from_usec( CD_SECTOR_TIME / state->cdrom_speed ) );
522522}
523523
524524static void akiko_setup_response( akiko_state *state, int len, UINT8 *r1 )
r10326r10327
665665
666666            if ( cmdbuf[7] == 0x80 )
667667            {
668               if (LOG_AKIKO_CD) logerror( "%s:AKIKO CD: Data read - start lba: %08x - end lba: %08x\n", cpuexec_describe_context(state->machine), startpos, endpos );
668               if (LOG_AKIKO_CD) logerror( "%s:AKIKO CD: Data read - start lba: %08x - end lba: %08x\n", state->machine->describe_context(), startpos, endpos );
669669               state->cdrom_speed = (cmdbuf[8] & 0x40) ? 2 : 1;
670670               state->cdrom_lba_start = startpos;
671671               state->cdrom_lba_end = endpos;
src/mame/machine/gaelco3d.c
r10326r10327
472472   //state_save_register_device_item(device, 0, earom->data);
473473 
474474#ifdef SHARED_MEM_DRIVER
475   timer_adjust_periodic(state->sync_timer, attotime::zero,0,attotime::from_hz(SYNC_FREQ));
475   state->sync_timer->adjust(attotime::zero,0,attotime::from_hz(SYNC_FREQ));
476476#endif
477477 
478478   state->os_shmem = osd_sharedmem_alloc(PATH_NAME, 0, sizeof(shmem_t));
src/mame/machine/asic65.c
r10326r10327
193193   if (asic65.type == ASIC65_ROMBASED)
194194   {
195195      space->machine->scheduler().synchronize(FUNC(m68k_asic65_deferred_w), data | (offset << 16));
196      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(20));
196      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
197197      return;
198198   }
199199
r10326r10327
231231   if (asic65.type == ASIC65_ROMBASED)
232232   {
233233      asic65._68full = 0;
234      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(5));
234      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(5));
235235      return asic65._68data;
236236   }
237237
r10326r10327
449449      /* bit 14 = 68FULL */
450450      /* bit 13 = XFLG */
451451      /* bit 12 = controlled by jumper */
452      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(5));
452      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(5));
453453      return (asic65.tfull << 15) | (asic65._68full << 14) | (asic65.xflg << 13) | 0x0000;
454454   }
455455   else
src/mame/machine/docastle.c
r10326r10327
5555
5656   if (offset == 8)
5757      /* awake the master CPU */
58      cpuexec_trigger(space->machine, 500);
58      space->machine->scheduler().trigger(500);
5959}
6060
6161
src/mame/machine/decocass.c
r10326r10327
21562156      newperiod = attotime::from_hz(TAPE_CLOCKRATE * absnewspeed);
21572157
21582158   /* set the new speed */
2159   timer_adjust_periodic(tape->timer, newperiod, 0, newperiod);
2159   tape->timer->adjust(newperiod, 0, newperiod);
21602160   tape->speed = newspeed;
21612161}
21622162
src/mame/machine/twincobr.c
r10326r10327
220220
221221static void toaplan0_control_w(running_machine *machine, int offset, int data)
222222{
223   LOG(("%s:Writing %08x to %08x.\n",cpuexec_describe_context(machine),data,toaplan_port_type[toaplan_main_cpu] - offset));
223   LOG(("%s:Writing %08x to %08x.\n",machine->describe_context(),data,toaplan_port_type[toaplan_main_cpu] - offset));
224224
225225   if (toaplan_main_cpu == 1) {
226226      if (data == 0x0c) { data = 0x1c; wardner_sprite_hack=0; }   /* Z80 ? */
r10326r10327
274274static void toaplan0_coin_dsp_w(address_space *space, int offset, int data)
275275{
276276   if (data > 1)
277      LOG(("%s:Writing %08x to %08x.\n",cpuexec_describe_context(space->machine),data,toaplan_port_type[toaplan_main_cpu] - offset));
277      LOG(("%s:Writing %08x to %08x.\n",space->machine->describe_context(),data,toaplan_port_type[toaplan_main_cpu] - offset));
278278   switch (data) {
279279      case 0x08: coin_counter_w(space->machine, 0,0); break;
280280      case 0x09: coin_counter_w(space->machine, 0,1); break;
src/mame/machine/konppc.c
r10326r10327
198198{
199199   if (cgboard_id < MAX_CG_BOARDS)
200200   {
201      cpuexec_trigger(space->machine, 10000);      // Remove the timeout (a part of the GTI Club FIFO test workaround)
201      space->machine->scheduler().trigger(10000);      // Remove the timeout (a part of the GTI Club FIFO test workaround)
202202      COMBINE_DATA(dsp_shared_ram[cgboard_id] + (offset + (dsp_shared_ram_bank[cgboard_id] * DSP_BANK_SIZE_WORD)));
203203   }
204204}
r10326r10327
275275      }
276276   }
277277
278//  printf("%s:cgboard_dsp_comm_w_sharc: %08X, %08X, %08X\n", cpuexec_describe_context(space->machine), data, offset, mem_mask);
278//  printf("%s:cgboard_dsp_comm_w_sharc: %08X, %08X, %08X\n", space->machine->describe_context(), data, offset, mem_mask);
279279
280280   dsp_comm_sharc[board][offset] = data;
281281}
src/mame/machine/irobot.c
r10326r10327
2525
2626#define IR_CPU_STATE(m) \
2727   logerror(\
28         "%s, scanline: %d\n", cpuexec_describe_context(m), (m)->primary_screen->vpos())
28         "%s, scanline: %d\n", m->describe_context(), (m)->primary_screen->vpos())
2929
3030
3131static void irmb_run(running_machine *machine);
src/mame/machine/leland.c
r10326r10327
372372
373373MACHINE_RESET( leland )
374374{
375   timer_adjust_oneshot(master_int_timer, machine->primary_screen->time_until_pos(8), 8);
375   master_int_timer->adjust(machine->primary_screen->time_until_pos(8), 8);
376376
377377   /* reset globals */
378378   leland_gfx_control = 0x00;
r10326r10327
422422MACHINE_RESET( ataxx )
423423{
424424   memset(extra_tram, 0, ATAXX_EXTRA_TRAM_SIZE);
425   timer_adjust_oneshot(master_int_timer, machine->primary_screen->time_until_pos(8), 8);
425   master_int_timer->adjust(machine->primary_screen->time_until_pos(8), 8);
426426
427427   /* initialize the XROM */
428428   xrom_length = machine->region("user1")->bytes();
r10326r10327
471471   scanline += 16;
472472   if (scanline > 248)
473473      scanline = 8;
474   timer_adjust_oneshot(master_int_timer, machine->primary_screen->time_until_pos(scanline), scanline);
474   master_int_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
475475}
476476
477477
r10326r10327
483483   cputag_set_input_line(machine, "master", 0, HOLD_LINE);
484484
485485   /* set a timer for the next one */
486   timer_adjust_oneshot(master_int_timer, machine->primary_screen->time_until_pos(scanline), scanline);
486   master_int_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
487487}
488488
489489
r10326r10327
598598   address = &master_base[bank_list[alternate_bank & 3]];
599599   if (bank_list[alternate_bank & 3] >= master_length)
600600   {
601      logerror("%s:Master bank %02X out of range!\n", cpuexec_describe_context(machine), alternate_bank & 3);
601      logerror("%s:Master bank %02X out of range!\n", machine->describe_context(), alternate_bank & 3);
602602      address = &master_base[bank_list[0]];
603603   }
604604   memory_set_bankptr(machine, "bank1", address);
r10326r10327
619619   address = &master_base[bank_list[alternate_bank & 7]];
620620   if (bank_list[alternate_bank & 7] >= master_length)
621621   {
622      logerror("%s:Master bank %02X out of range!\n", cpuexec_describe_context(machine), alternate_bank & 7);
622      logerror("%s:Master bank %02X out of range!\n", machine->describe_context(), alternate_bank & 7);
623623      address = &master_base[bank_list[0]];
624624   }
625625   memory_set_bankptr(machine, "bank1", address);
r10326r10327
644644   address = &master_base[bank_list[master_bank & 15]];
645645   if (bank_list[master_bank & 15] >= master_length)
646646   {
647      logerror("%s:Master bank %02X out of range!\n", cpuexec_describe_context(machine), master_bank & 15);
647      logerror("%s:Master bank %02X out of range!\n", machine->describe_context(), master_bank & 15);
648648      address = &master_base[bank_list[0]];
649649   }
650650   memory_set_bankptr(machine, "bank1", address);
r10326r10327
856856READ8_DEVICE_HANDLER( ataxx_eeprom_r )
857857{
858858   int port = input_port_read(device->machine, "IN2");
859   if (LOG_EEPROM) logerror("%s:EE read\n", cpuexec_describe_context(device->machine));
859   if (LOG_EEPROM) logerror("%s:EE read\n", device->machine->describe_context());
860860   return port;
861861}
862862
863863
864864WRITE8_DEVICE_HANDLER( ataxx_eeprom_w )
865865{
866   if (LOG_EEPROM) logerror("%s:EE write %d%d%d\n", cpuexec_describe_context(device->machine),
866   if (LOG_EEPROM) logerror("%s:EE write %d%d%d\n", device->machine->describe_context(),
867867         (data >> 6) & 1, (data >> 5) & 1, (data >> 4) & 1);
868868   eeprom_write_bit     (device, (data & 0x10) >> 4);
869869   eeprom_set_clock_line(device, (data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
r10326r10327
957957{
958958   int result = 0;
959959
960   if (LOG_KEYCARDS_FULL) logerror("  (%s:keycard_r)\n", cpuexec_describe_context(machine));
960   if (LOG_KEYCARDS_FULL) logerror("  (%s:keycard_r)\n", machine->describe_context());
961961
962962   /* if we have a valid keycard read state, we're reading from the keycard */
963963   if (keycard_state & 0x80)
r10326r10327
981981   int new_state = data & 0xb0;
982982   int new_clock = data & 0x40;
983983
984   if (LOG_KEYCARDS_FULL) logerror("  (%s:keycard_w=%02X)\n", cpuexec_describe_context(machine), data);
984   if (LOG_KEYCARDS_FULL) logerror("  (%s:keycard_w=%02X)\n", machine->describe_context(), data);
985985
986986   /* check for going active */
987987   if (!keycard_state && new_state)
r10326r10327
12441244         break;
12451245
12461246      case 0x08:   /*  */
1247         timer_adjust_oneshot(master_int_timer, space->machine->primary_screen->time_until_pos(data + 1), data + 1);
1247         master_int_timer->adjust(space->machine->primary_screen->time_until_pos(data + 1), data + 1);
12481248         break;
12491249
12501250      default:
r10326r10327
13531353    /* some bankswitching occurs here */
13541354   if (LOG_BANKSWITCHING_M)
13551355      if ((sound_port_bank ^ data) & 0x24)
1356         logerror("%s:sound_port_bank = %02X\n", cpuexec_describe_context(device->machine), data & 0x24);
1356         logerror("%s:sound_port_bank = %02X\n", device->machine->describe_context(), data & 0x24);
13571357    sound_port_bank = data & 0x24;
13581358    (*leland_update_master_bank)(device->machine);
13591359}
src/mame/machine/namco06.c
r10326r10327
136136   UINT8 result = 0xff;
137137   int devnum;
138138
139   LOG(("%s: 06XX '%s' read offset %d\n",cpuexec_describe_context(device->machine),device->tag(),offset));
139   LOG(("%s: 06XX '%s' read offset %d\n",device->machine->describe_context(),device->tag(),offset));
140140
141141   if (!(state->control & 0x10))
142142   {
143      logerror("%s: 06XX '%s' read in write mode %02x\n",cpuexec_describe_context(device->machine),device->tag(),state->control);
143      logerror("%s: 06XX '%s' read in write mode %02x\n",device->machine->describe_context(),device->tag(),state->control);
144144      return 0;
145145   }
146146
r10326r10327
157157   namco_06xx_state *state = get_safe_token(device);
158158   int devnum;
159159
160   LOG(("%s: 06XX '%s' write offset %d = %02x\n",cpuexec_describe_context(device->machine),device->tag(),offset,data));
160   LOG(("%s: 06XX '%s' write offset %d = %02x\n",device->machine->describe_context(),device->tag(),offset,data));
161161
162162   if (state->control & 0x10)
163163   {
164      logerror("%s: 06XX '%s' write in read mode %02x\n",cpuexec_describe_context(device->machine),device->tag(),state->control);
164      logerror("%s: 06XX '%s' write in read mode %02x\n",device->machine->describe_context(),device->tag(),state->control);
165165      return;
166166   }
167167
r10326r10327
174174READ8_DEVICE_HANDLER( namco_06xx_ctrl_r )
175175{
176176   namco_06xx_state *state = get_safe_token(device);
177   LOG(("%s: 06XX '%s' ctrl_r\n",cpuexec_describe_context(device->machine),device->tag()));
177   LOG(("%s: 06XX '%s' ctrl_r\n",device->machine->describe_context(),device->tag()));
178178   return state->control;
179179}
180180
r10326r10327
183183   namco_06xx_state *state = get_safe_token(device);
184184   int devnum;
185185
186   LOG(("%s: 06XX '%s' control %02x\n",cpuexec_describe_context(device->machine),device->tag(),data));
186   LOG(("%s: 06XX '%s' control %02x\n",device->machine->describe_context(),device->tag(),data));
187187
188188   state->control = data;
189189
190190   if ((state->control & 0x0f) == 0)
191191   {
192192      LOG(("disabling nmi generate timer\n"));
193      timer_adjust_oneshot(state->nmi_timer, attotime::never, 0);
193      state->nmi_timer->adjust(attotime::never);
194194   }
195195   else
196196   {
r10326r10327
200200      // inputs if a transfer terminates at the wrong time.
201201      // On the other hand, the time cannot be too short otherwise the 54XX will
202202      // not have enough time to process the incoming controls.
203      timer_adjust_periodic(state->nmi_timer, attotime::from_usec(200), 0, attotime::from_usec(200));
203      state->nmi_timer->adjust(attotime::from_usec(200), 0, attotime::from_usec(200));
204204
205205      if (state->control & 0x10)
206206         for (devnum = 0; devnum < 4; devnum++)
src/mame/machine/midwayic.c
r10326r10327
207207
208208UINT8 midway_serial_pic_r(address_space *space)
209209{
210   logerror("%s:security R = %04X\n", cpuexec_describe_context(space->machine), serial.buffer);
210   logerror("%s:security R = %04X\n", space->machine->describe_context(), serial.buffer);
211211   serial.status = 1;
212212   return serial.buffer;
213213}
r10326r10327
215215
216216void midway_serial_pic_w(address_space *space, UINT8 data)
217217{
218   logerror("%s:security W = %04X\n", cpuexec_describe_context(space->machine), data);
218   logerror("%s:security W = %04X\n", space->machine->describe_context(), data);
219219
220220   /* status seems to reflect the clock bit */
221221   serial.status = (data >> 4) & 1;
r10326r10327
307307      result = 1;
308308   }
309309
310   logerror("%s:PIC status %d\n", cpuexec_describe_context(space->machine), result);
310   logerror("%s:PIC status %d\n", space->machine->describe_context(), result);
311311   return result;
312312}
313313
r10326r10327
317317   UINT8 result = 0;
318318
319319   /* PIC data register */
320   logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", cpuexec_describe_context(space->machine), pic.index, pic.total, pic.latch);
320   logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", space->machine->describe_context(), pic.index, pic.total, pic.latch);
321321
322322   /* return the current result */
323323   if (pic.latch & 0xf00)
r10326r10327
341341
342342   /* PIC command register */
343343   if (pic.state == 0)
344      logerror("%s:PIC command %02X\n", cpuexec_describe_context(machine), data);
344      logerror("%s:PIC command %02X\n", machine->describe_context(), data);
345345   else
346      logerror("%s:PIC data %02X\n", cpuexec_describe_context(machine), data);
346      logerror("%s:PIC data %02X\n", machine->describe_context(), data);
347347
348348   /* store in the latch, along with a bit to indicate we have data */
349349   pic.latch = (data & 0x00f) | 0x480;
r10326r10327
436436               /* otherwise, flag the time as having just been written for 1/2 second */
437437               else
438438               {
439                  timer_adjust_oneshot(pic.time_write_timer, attotime::from_msec(500), 0);
439                  pic.time_write_timer->adjust(attotime::from_msec(500));
440440                  pic.time_just_written = 1;
441441                  pic.state = 0;
442442               }
r10326r10327
801801      update_ioasic_irq(machine);
802802   }
803803   if (LOG_FIFO)
804      logerror("%s:fifo_reset(%d)\n", cpuexec_describe_context(machine), state);
804      logerror("%s:fifo_reset(%d)\n", machine->describe_context(), state);
805805}
806806
807807
src/mame/machine/cdicdic.c
r10326r10327
574574    if(m_decode_addr == 0xffff)
575575    {
576576        verboselog(&m_machine, 0, "Decode stop requested, stopping playback\n" );
577        timer_adjust_oneshot(m_audio_sample_timer, attotime::never, 0);
577        m_audio_sample_timer->adjust(attotime::never);
578578        return;
579579    }
580580
r10326r10327
609609        //// Delay for Frequency * (18*28*2*size in bytes) before requesting more data
610610        verboselog(&m_machine, 0, "Data is valid, setting up a new callback\n" );
611611        m_decode_period = attotime::from_hz(CDIC_SAMPLE_BUF_FREQ(m_ram, m_decode_addr & 0x3ffe)) * (18*28*2*CDIC_SAMPLE_BUF_SIZE(m_ram, m_decode_addr & 0x3ffe));
612        timer_adjust_oneshot(m_audio_sample_timer, m_decode_period, 0);
612        m_audio_sample_timer->adjust(m_decode_period);
613613        //dmadac_enable(&dmadac[0], 2, 0);
614614    }
615615    else
r10326r10327
619619
620620        verboselog(&m_machine, 0, "Data is not valid, indicating to shut down on the next audio sample\n" );
621621        m_decode_addr = 0xffff;
622        timer_adjust_oneshot(m_audio_sample_timer, m_decode_period, 0);
622        m_audio_sample_timer->adjust(m_decode_period);
623623    }
624624}
625625
r10326r10327
785785
786786                if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == 0 && m_command != 0x23)
787787            {
788                    timer_adjust_oneshot(m_interrupt_timer, attotime::from_hz(75), 0); // 75Hz = 1x CD-ROM speed
788                    m_interrupt_timer->adjust(attotime::from_hz(75)); // 75Hz = 1x CD-ROM speed
789789            }
790790            else
791791            {
792792                    if(m_command == 0x23) // Mode 1 Reset
793793               {
794                        timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
794                        m_interrupt_timer->adjust(attotime::never);
795795               }
796796            }
797797         }
r10326r10327
800800      }
801801
802802      case 0x2e: // Abort
803            timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
803            m_interrupt_timer->adjust(attotime::never);
804804            //m_data_buffer &= ~4;
805805         break;
806806
r10326r10327
863863            m_time = next_msf << 8;
864864
865865         // the following line BREAKS 'The Apprentice', hangs when you attempt to start the game
866            //timer_adjust_oneshot(m_interrupt_timer, attotime::from_hz(75), 0);
866            //m_interrupt_timer->adjust(attotime::from_hz(75));
867867
868868         m_x_buffer |= 0x8000;
869869            //m_data_buffer |= 0x4000;
r10326r10327
896896         };
897897         lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
898898
899            timer_adjust_oneshot(m_interrupt_timer, attotime::from_hz(75), 0);
899            m_interrupt_timer->adjust(attotime::from_hz(75));
900900
901901            cdrom_read_data(m_cd, lba, buffer, CD_TRACK_RAW_DONTCARE);
902902
r10326r10327
10011001
10021002        case 0x3ffa/2: // AUDCTL
10031003        {
1004            if(timer_timeleft(m_audio_sample_timer).is_never())
1004            if(m_audio_sample_timer->remaining().is_never())
10051005            {
10061006                m_z_buffer ^= 0x0001;
10071007            }
r10326r10327
11201120            COMBINE_DATA(&m_z_buffer);
11211121            if(m_z_buffer & 0x2000)
11221122         {
1123                attotime period = timer_timeleft(m_audio_sample_timer);
1123                attotime period = m_audio_sample_timer->remaining();
11241124            if(period.is_never())
11251125            {
11261126                    m_decode_addr = m_z_buffer & 0x3a00;
11271127                    m_decode_delay = 1;
1128                    timer_adjust_oneshot(m_audio_sample_timer, attotime::from_hz(75), 0);
1128                    m_audio_sample_timer->adjust(attotime::from_hz(75));
11291129            }
11301130         }
11311131         else
11321132         {
11331133                m_decode_addr = 0xffff;
1134                timer_adjust_oneshot(m_audio_sample_timer, attotime::never, 0);
1134                m_audio_sample_timer->adjust(attotime::never);
11351135         }
11361136         break;
11371137      }
r10326r10327
11501150               //case 0x24: // Reset Mode 2
11511151               case 0x2e: // Abort
11521152               {
1153                        timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
1153                        m_interrupt_timer->adjust(attotime::never);
11541154                  dmadac_enable(&state->dmadac[0], 2, 0);
11551155                        //m_data_buffer &= 0xbfff;
11561156                  break;
11571157               }
11581158               case 0x2b: // Stop CDDA
11591159                  cdda_stop_audio(m_machine.device("cdda"));
1160                        timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
1160                        m_interrupt_timer->adjust(attotime::never);
11611161                  break;
11621162               case 0x23: // Reset Mode 1
11631163               case 0x29: // Read Mode 1
r10326r10327
11651165               case 0x28: // Play CDDA
11661166               case 0x2c: // Seek
11671167               {
1168                        attotime period = timer_timeleft(m_interrupt_timer);
1168                        attotime period = m_interrupt_timer->remaining();
11691169                  if(!period.is_never())
11701170                  {
1171                            timer_adjust_oneshot(m_interrupt_timer, period, 0);
1171                            m_interrupt_timer->adjust(period);
11721172                  }
11731173                  else
11741174                  {
11751175                            if(m_command != 0x23 && m_command != 0x24)
11761176                     {
1177                                timer_adjust_oneshot(m_interrupt_timer, attotime::from_hz(75), 0);
1177                                m_interrupt_timer->adjust(attotime::from_hz(75));
11781178                     }
11791179                  }
11801180                  break;
r10326r10327
12171217    register_globals();
12181218
12191219    m_interrupt_timer = m_machine.scheduler().timer_alloc(FUNC(trigger_readback_int));
1220    timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
1220    m_interrupt_timer->adjust(attotime::never);
12211221
12221222    m_audio_sample_timer = m_machine.scheduler().timer_alloc(FUNC(audio_sample_trigger));
1223    timer_adjust_oneshot(m_audio_sample_timer, attotime::never, 0);
1223    m_audio_sample_timer->adjust(attotime::never);
12241224
12251225    m_ram = auto_alloc_array(&m_machine, UINT16, 0x3c00/2);
12261226}
src/mame/machine/ticket.c
r10326r10327
4949   {
5050      state->status ^= state->active_bit;
5151      LOG(("Ticket Status Changed to %02X\n", state->status));
52      timer_adjust_oneshot(state->timer, attotime::from_msec(state->time_msec), 0);
52      state->timer->adjust(attotime::from_msec(state->time_msec));
5353   }
5454
5555   if (state->status == state->ticketdispensed)
r10326r10327
6969READ8_DEVICE_HANDLER( ticket_dispenser_r )
7070{
7171   ticket_state *state = get_safe_token(device);
72   LOG(("%s: Ticket Status Read = %02X\n", cpuexec_describe_context(device->machine), state->status));
72   LOG(("%s: Ticket Status Read = %02X\n", device->machine->describe_context(), state->status));
7373   return state->status;
7474}
7575
r10326r10327
9090   {
9191      if (!state->power)
9292      {
93         LOG(("%s: Ticket Power On\n", cpuexec_describe_context(device->machine)));
94         timer_adjust_oneshot(state->timer, attotime::from_msec(state->time_msec), 0);
93         LOG(("%s: Ticket Power On\n", device->machine->describe_context()));
94         state->timer->adjust(attotime::from_msec(state->time_msec));
9595         state->power = 1;
9696
9797         state->status = state->ticketnotdispensed;
r10326r10327
101101   {
102102      if (state->power)
103103      {
104         LOG(("%s: Ticket Power Off\n", cpuexec_describe_context(device->machine)));
105         timer_adjust_oneshot(state->timer, attotime::never, 0);
104         LOG(("%s: Ticket Power Off\n", device->machine->describe_context()));
105         state->timer->adjust(attotime::never);
106106         set_led_status(device->machine, 2,0);
107107         state->power = 0;
108108      }
src/mame/machine/stvcd.c
r10326r10327
377377
378378         hirqreg = rv;
379379
380//          CDROM_LOG(("%s:RW HIRQ: %04x\n", cpuexec_describe_context(Machine), rv))
380//          CDROM_LOG(("%s:RW HIRQ: %04x\n", Machine->describe_context(), rv))
381381
382382         return rv;
383383
r10326r10327
443443         return rv;
444444
445445      default:
446         CDROM_LOG(("%s:CD: RW %08x\n", cpuexec_describe_context(machine), addr))
446         CDROM_LOG(("%s:CD: RW %08x\n", machine->describe_context(), addr))
447447         return 0xffff;
448448   }
449449
r10326r10327
517517         return rv;
518518
519519      default:
520         CDROM_LOG(("%s:CD: RL %08x\n", cpuexec_describe_context(machine), addr))
520         CDROM_LOG(("%s:CD: RL %08x\n", machine->describe_context(), addr))
521521         return 0xffff;
522522   }
523523}
r10326r10327
530530   {
531531   case 0x0008:
532532   case 0x000a:
533//              CDROM_LOG(("%s:WW HIRQ: %04x & %04x => %04x\n", cpuexec_describe_context(machine), hirqreg, data, hirqreg & data))
533//              CDROM_LOG(("%s:WW HIRQ: %04x & %04x => %04x\n", machine->describe_context(), hirqreg, data, hirqreg & data))
534534      hirqreg &= data;
535535      return;
536536   case 0x000c:
r10326r10327
573573      switch (cr1 & 0xff00)
574574      {
575575      case 0x0000:
576         CDROM_LOG(("%s:CD: Get Status\n", cpuexec_describe_context(machine)))
576         CDROM_LOG(("%s:CD: Get Status\n", machine->describe_context()))
577577
578578         // values taken from a US saturn with a disc in and the lid closed
579579         hirqreg |= CMOK;
r10326r10327
585585         break;
586586
587587      case 0x0100:
588         CDROM_LOG(("%s:CD: Get Hardware Info\n", cpuexec_describe_context(machine)))
588         CDROM_LOG(("%s:CD: Get Hardware Info\n", machine->describe_context()))
589589         hirqreg |= CMOK;
590590         cr1 = cd_stat;
591591         cr2 = 0x0201;
r10326r10327
594594         break;
595595
596596      case 0x200:   // Get TOC
597         CDROM_LOG(("%s:CD: Get TOC\n", cpuexec_describe_context(machine)))
597         CDROM_LOG(("%s:CD: Get TOC\n", machine->describe_context()))
598598         cd_readTOC();
599599         cd_stat = CD_STAT_TRANS|CD_STAT_PAUSE;
600600         cr2 = 102*2;   // TOC length in words (102 entries @ 2 words/4bytes each)
r10326r10327
608608                     // bios is interested in returns in cr3 and cr4
609609                  // cr3 should be data track #
610610                  // cr4 must be > 1 and < 100 or bios gets angry.
611         CDROM_LOG(("%s:CD: Get Session Info\n", cpuexec_describe_context(machine)))
611         CDROM_LOG(("%s:CD: Get Session Info\n", machine->describe_context()))
612612         cd_readTOC();
613613         switch (cr1 & 0xff)
614614         {
r10326r10327
639639            // CR1 & 4 = don't confirm mode 2 subheader
640640            // CR1 & 8 = retry reading mode 2 sectors
641641            // CR1 & 10 = force single-speed
642         CDROM_LOG(("%s:CD: Initialize CD system\n", cpuexec_describe_context(machine)))
642         CDROM_LOG(("%s:CD: Initialize CD system\n", machine->describe_context()))
643643         hirqreg |= (CMOK|DRDY|ESEL);
644644         cd_stat = CD_STAT_PAUSE;
645645         cd_curfad = 150;
r10326r10327
653653      case 0x0600:   // end data transfer
654654            // returns # of bytes transfered (24 bits) in
655655            // low byte of cr1 (MSB) and cr2 (middle byte, LSB)
656         CDROM_LOG(("%s:CD: End data transfer (%d bytes xfer'd)\n", cpuexec_describe_context(machine), xferdnum))
656         CDROM_LOG(("%s:CD: End data transfer (%d bytes xfer'd)\n", machine->describe_context(), xferdnum))
657657
658658         // clear the "transfer" flag
659659         cd_stat &= ~CD_STAT_TRANS;
r10326r10327
730730         break;
731731
732732      case 0x1000: // Play Disk.  FAD is in lowest 7 bits of cr1 and all of cr2.
733         CDROM_LOG(("%s:CD: Play Disk\n",   cpuexec_describe_context(machine)))
733         CDROM_LOG(("%s:CD: Play Disk\n",   machine->describe_context()))
734734         cd_stat = CD_STAT_PLAY; //|0x80;    // set "cd-rom" bit?
735735         cd_curfad = ((cr1&0xff)<<16) | cr2;
736736         fadstoplay = ((cr3&0xff)<<16) | cr4;
r10326r10327
768768         break;
769769
770770      case 0x1100: // disk seek
771         CDROM_LOG(("%s:CD: Disk seek\n",   cpuexec_describe_context(machine)))
771         CDROM_LOG(("%s:CD: Disk seek\n",   machine->describe_context()))
772772         if (cr1 & 0x80)
773773         {
774774            temp = (cr1&0x7f)<<16;   // get FAD to seek to
r10326r10327
814814            // get operation
815815            parm = cr3>>8;
816816
817            CDROM_LOG(("%s:CD: Set CD Device Connection filter # %x\n",   cpuexec_describe_context(machine), parm))
817            CDROM_LOG(("%s:CD: Set CD Device Connection filter # %x\n",   machine->describe_context(), parm))
818818
819819            cddevicenum = parm;
820820
r10326r10327
840840         {
841841            UINT8 fnum = (cr3>>8)&0xff;
842842
843            CDROM_LOG(("%s:CD: Set Filter Range\n",   cpuexec_describe_context(machine)))
843            CDROM_LOG(("%s:CD: Set Filter Range\n",   machine->describe_context()))
844844
845845            filters[fnum].fad = ((cr1 & 0xff)<<16) | cr2;
846846            filters[fnum].range = ((cr3 & 0xff)<<16) | cr4;
r10326r10327
856856         {
857857            UINT8 fnum = (cr3>>8)&0xff;
858858
859            CDROM_LOG(("%s:CD: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", cpuexec_describe_context(machine), fnum, cr1&0xff, cr2, cr3&0xff, cr4))
859            CDROM_LOG(("%s:CD: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", machine->describe_context(), fnum, cr1&0xff, cr2, cr3&0xff, cr4))
860860
861861            filters[fnum].chan = cr1 & 0xff;
862862            filters[fnum].smmask = (cr2>>8)&0xff;
r10326r10327
887887               filters[fnum].mode = mode;
888888            }
889889
890            CDROM_LOG(("%s:CD: Set Filter Mode filt %x mode %x\n", cpuexec_describe_context(machine), fnum, mode))
890            CDROM_LOG(("%s:CD: Set Filter Mode filt %x mode %x\n", machine->describe_context(), fnum, mode))
891891            hirqreg |= (CMOK|ESEL|DRDY);
892892            cr2 = 0x4101;   // ctrl/adr in hi byte, track # in low byte
893893            cr3 = 0x0100|((cd_curfad>>16)&0xff);
r10326r10327
899899         {
900900            UINT8 fnum = (cr3>>8)&0xff;
901901
902            CDROM_LOG(("%s:CD: Set Filter Connection %x => mode %x parm %04x\n", cpuexec_describe_context(machine), fnum, cr1 & 0xf, cr2))
902            CDROM_LOG(("%s:CD: Set Filter Connection %x => mode %x parm %04x\n", machine->describe_context(), fnum, cr1 & 0xf, cr2))
903903
904904            // set true condition?
905905            if (cr1 & 1)
r10326r10327
919919         break;
920920
921921      case 0x4800:   // Reset Selector
922         CDROM_LOG(("%s:CD: Reset Selector\n",   cpuexec_describe_context(machine)))
922         CDROM_LOG(("%s:CD: Reset Selector\n",   machine->describe_context()))
923923         hirqreg |= (CMOK|ESEL|DRDY);
924924         cr2 = 0x4101;   // ctrl/adr in hi byte, track # in low byte
925925         cr3 = 0x0100|((cd_curfad>>16)&0xff);
r10326r10327
933933
934934         cr3 = 0x1800;
935935         cr4 = 200;
936         CDROM_LOG(("%s:CD: Get Buffer Size = %d\n", cr2, cpuexec_describe_context(machine)))
936         CDROM_LOG(("%s:CD: Get Buffer Size = %d\n", cr2, machine->describe_context()))
937937         hirqreg |= (CMOK|ESEL|DRDY);   // DRDY is probably wrong
938938         break;
939939
r10326r10327
951951               cr4 = partitions[bufnum].numblks;
952952            }
953953
954            CDROM_LOG(("%s:CD: Get Sector Number (bufno %d) = %d blocks\n",   cpuexec_describe_context(machine), bufnum, cr4))
954            CDROM_LOG(("%s:CD: Get Sector Number (bufno %d) = %d blocks\n",   machine->describe_context(), bufnum, cr4))
955955
956956            cr2 = 0;
957957            cr3 = 0;
r10326r10327
965965            UINT32 sectoffs = cr2;
966966            UINT32 numsect = cr4;
967967
968            CDROM_LOG(("%s:CD: Calculate actual size: buf %x offs %x numsect %x\n", cpuexec_describe_context(machine), bufnum, sectoffs, numsect))
968            CDROM_LOG(("%s:CD: Calculate actual size: buf %x offs %x numsect %x\n", machine->describe_context(), bufnum, sectoffs, numsect))
969969
970970            calcsize = 0;
971971            if (partitions[bufnum].size != -1)
r10326r10327
990990         break;
991991
992992      case 0x5300:   // get actual block size
993         CDROM_LOG(("%s:CD: Get actual block size\n", cpuexec_describe_context(machine)))
993         CDROM_LOG(("%s:CD: Get actual block size\n", machine->describe_context()))
994994         hirqreg |= (CMOK|ESEL);
995995         cr1 = cd_stat | ((calcsize>>16)&0xff);
996996         cr2 = (calcsize & 0xffff);
r10326r10327
999999         break;
10001000
10011001      case 0x6000:   // set sector length
1002         CDROM_LOG(("%s:CD: Set sector length\n",   cpuexec_describe_context(machine)))
1002         CDROM_LOG(("%s:CD: Set sector length\n",   machine->describe_context()))
10031003         hirqreg |= (CMOK|ESEL|EFLS|SCDQ|DRDY);
10041004
10051005         switch (cr1 & 0xff)
r10326r10327
10411041            UINT32 sectofs = cr2;
10421042            UINT32 bufnum = cr3>>8;
10431043
1044            CDROM_LOG(("%s:CD: Get sector data (SN %d SO %d BN %d)\n",   cpuexec_describe_context(machine), sectnum, sectofs, bufnum))
1044            CDROM_LOG(("%s:CD: Get sector data (SN %d SO %d BN %d)\n",   machine->describe_context(), sectnum, sectofs, bufnum))
10451045
10461046            if (bufnum >= MAX_FILTERS)
10471047            {
r10326r10327
10811081            UINT32 bufnum = cr3>>8;
10821082            INT32 i;
10831083
1084            CDROM_LOG(("%s:CD: Delete sector data (SN %d SO %d BN %d)\n",   cpuexec_describe_context(machine), sectnum, sectofs, bufnum))
1084            CDROM_LOG(("%s:CD: Delete sector data (SN %d SO %d BN %d)\n",   machine->describe_context(), sectnum, sectofs, bufnum))
10851085
10861086            if (bufnum >= MAX_FILTERS)
10871087            {
r10326r10327
11241124            UINT32 sectofs = cr2;
11251125            UINT32 bufnum = cr3>>8;
11261126
1127            CDROM_LOG(("%s:CD: Get and delete sector data (SN %d SO %d BN %d)\n",   cpuexec_describe_context(machine), sectnum, sectofs, bufnum))
1127            CDROM_LOG(("%s:CD: Get and delete sector data (SN %d SO %d BN %d)\n",   machine->describe_context(), sectnum, sectofs, bufnum))
11281128
11291129            if (bufnum >= MAX_FILTERS)
11301130            {
r10326r10327
11581158         break;
11591159
11601160      case 0x6700:   // get copy error
1161         CDROM_LOG(("%s:CD: Get copy error\n",   cpuexec_describe_context(machine)))
1161         CDROM_LOG(("%s:CD: Get copy error\n",   machine->describe_context()))
11621162         hirqreg |= (CMOK|ESEL|EFLS|SCDQ|DRDY);
11631163         break;
11641164
11651165      case 0x7000:   // change directory
1166         CDROM_LOG(("%s:CD: Change Directory\n",   cpuexec_describe_context(machine)))
1166         CDROM_LOG(("%s:CD: Change Directory\n",   machine->describe_context()))
11671167         hirqreg |= (CMOK|EFLS);
11681168
11691169         temp = (cr3&0xff)<<16;
r10326r10327
11721172         break;
11731173
11741174      case 0x7100:   // Read directory entry
1175         CDROM_LOG(("%s:CD: Read Directory Entry\n",   cpuexec_describe_context(machine)))
1175         CDROM_LOG(("%s:CD: Read Directory Entry\n",   machine->describe_context()))
11761176         hirqreg |= (CMOK|DRDY);
11771177
11781178         temp = (cr3&0xff)<<16;
r10326r10327
11831183         break;
11841184
11851185      case 0x7200:   // Get file system scope
1186         CDROM_LOG(("%s:CD: Get file system scope(PC=%x)\n",   cpuexec_describe_context(machine)))
1186         CDROM_LOG(("%s:CD: Get file system scope(PC=%x)\n",   machine->describe_context()))
11871187         hirqreg |= (CMOK|DRDY);
11881188         cr2 = numfiles;   // # of files in directory
11891189         cr3 = 0x0100;   // report directory held
r10326r10327
11911191         break;
11921192
11931193      case 0x7300:   // Get File Info
1194         CDROM_LOG(("%s:CD: Get File Info\n",   cpuexec_describe_context(machine)))
1194         CDROM_LOG(("%s:CD: Get File Info\n",   machine->describe_context()))
11951195         cd_stat |= CD_STAT_TRANS;
11961196         cd_stat &= 0xff00;      // clear top byte of return value
11971197         hirqreg |= (CMOK|DRDY);
r10326r10327
12451245         break;
12461246
12471247      case 0x7400:   // Read File
1248         CDROM_LOG(("%s:CD: Read File\n",   cpuexec_describe_context(machine)))
1248         CDROM_LOG(("%s:CD: Read File\n",   machine->describe_context()))
12491249         temp = (cr3&0xff)<<16;
12501250         temp |= cr4;
12511251
r10326r10327
12761276         break;
12771277
12781278      case 0x7500:
1279         CDROM_LOG(("%s:CD: Abort File\n",   cpuexec_describe_context(machine)))
1279         CDROM_LOG(("%s:CD: Abort File\n",   machine->describe_context()))
12801280         // bios expects "2bc" mask to work against this
12811281         hirqreg |= (CMOK|EFLS|EHST|ESEL|DCHG|PEND|BFUL|CSCT|DRDY);
12821282         cd_stat = CD_STAT_PERI|CD_STAT_PAUSE;   // force to pause
12831283         break;
12841284
12851285      case 0xe000:   // appears to be copy protection check.  needs only to return OK.
1286         CDROM_LOG(("%s:CD: Verify copy protection\n",   cpuexec_describe_context(machine)))
1286         CDROM_LOG(("%s:CD: Verify copy protection\n",   machine->describe_context()))
12871287         cd_stat = CD_STAT_PAUSE;
12881288         cr1 = cd_stat;   // necessary to pass
12891289         cr2 = 0x4;
r10326r10327
12931293         break;
12941294
12951295      case 0xe100:   // get disc region
1296         CDROM_LOG(("%s:CD: Get disc region\n",   cpuexec_describe_context(machine)))
1296         CDROM_LOG(("%s:CD: Get disc region\n",   machine->describe_context()))
12971297         cd_stat = CD_STAT_PAUSE;
12981298         cr1 = cd_stat;   // necessary to pass
12991299         cr2 = 0x4;      // (must return this value to pass bios checks)
r10326r10327
13011301         break;
13021302
13031303      default:
1304         CDROM_LOG(("%s:CD: Unknown command %04x\n", cr1,   cpuexec_describe_context(machine)))
1304         CDROM_LOG(("%s:CD: Unknown command %04x\n", cr1,   machine->describe_context()))
13051305         hirqreg |= (CMOK);
13061306         break;
13071307      }
13081308//      CDROM_LOG(("ret: %04x %04x %04x %04x %04x\n", hirqreg, cr1, cr2, cr3, cr4))
13091309      break;
13101310   default:
1311      CDROM_LOG(("%s:CD: WW %08x %04x\n", addr, data, cpuexec_describe_context(machine)))
1311      CDROM_LOG(("%s:CD: WW %08x %04x\n", addr, data, machine->describe_context()))
13121312      break;
13131313   }
13141314}
src/mame/machine/dc.c
r10326r10327
318318   // non 32-bit accesses have not yet been seen here, we need to know when they are
319319   if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
320320   {
321      mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine));
321      mame_printf_verbose("%s:Wrong mask!\n", machine->describe_context());
322322//      debugger_break(machine);
323323   }
324324
r10326r10327
342342   if ((mem_mask != U64(0x0000ffff00000000)) && (mem_mask != U64(0x000000000000ffff)) &&
343343       (mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
344344   {
345      mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine));
345      mame_printf_verbose("%s:Wrong mask!\n", machine->describe_context());
346346//      debugger_break(machine);
347347   }
348348
r10326r10327
15561556      if (dc_rtcregister[RTC3] == 0)
15571557         dc_rtcregister[reg] = old;
15581558      else
1559         timer_adjust_periodic(dc_rtc_timer, attotime::zero, 0, attotime::from_seconds(1));
1559         dc_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
15601560      break;
15611561   case RTC3:
15621562      dc_rtcregister[RTC3] &= 1;
r10326r10327
16261626   memset(maple_regs, 0, sizeof(maple_regs));
16271627   memset(dc_coin_counts, 0, sizeof(dc_coin_counts));
16281628
1629   timer_adjust_periodic(dc_rtc_timer, attotime::zero, 0, attotime::from_seconds(1));
1629   dc_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
16301630
16311631   dc_sysctrl_regs[SB_SBREV] = 0x0b;
16321632
src/mame/machine/scramble.c
r10326r10327
7171   case 0x1ca2: return 0x00;  /* I don't think it's checked */
7272   case 0x1d7e: return 0xb0;
7373   default:
74      logerror("%s: read protection\n",cpuexec_describe_context(device->machine));
74      logerror("%s: read protection\n",device->machine->describe_context());
7575      return 0;
7676   }
7777}
src/mame/machine/pitnrun.c
r10326r10327
4444WRITE8_HANDLER( pitnrun_mcu_data_w )
4545{
4646   space->machine->scheduler().synchronize(FUNC(pitnrun_mcu_real_data_w), data);
47   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(5));
47   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(5));
4848}
4949
5050READ8_HANDLER( pitnrun_mcu_status_r )
src/mame/machine/namcos1.c
r10326r10327
736736   /* unmapped bank warning */
737737   if( namcos1_active_bank[bank].bank_handler_r == unknown_r)
738738   {
739      logerror("%s:warning unknown chip selected bank %x=$%04x\n", cpuexec_describe_context(machine), bank , chip[bank] );
740//          if (chip) popmessage("%s:unknown chip selected bank %x=$%04x", cpu , cpuexec_describe_context(machine), bank , chip[bank] );
739      logerror("%s:warning unknown chip selected bank %x=$%04x\n", machine->describe_context(), bank , chip[bank] );
740//          if (chip) popmessage("%s:unknown chip selected bank %x=$%04x", cpu , machine->describe_context(), bank , chip[bank] );
741741   }
742742}
743743
src/mame/machine/n64.c
r10326r10327
430430{
431431   if (status & 0x1)
432432   {
433      //cpuexec_trigger(device->machine, 6789);
433      //device->machine->scheduler().trigger(6789);
434434
435435      cpu_set_input_line(device, INPUT_LINE_HALT, ASSERT_LINE);
436436        cpu_set_reg(device, RSP_SR, cpu_get_reg(device, RSP_SR) | RSP_STATUS_HALT);
r10326r10327
11251125
11261126   // adjust the timer
11271127   period = attotime::from_hz(DACRATE_NTSC) * ((ai_dacrate + 1) * (current->length / 4));
1128   timer_adjust_oneshot(audio_timer, period, 0);
1128   audio_timer->adjust(period);
11291129}
11301130
11311131static TIMER_CALLBACK( audio_timer_callback )
r10326r10327
11561156            }
11571157            else if (ai_status & 0x40000000)
11581158            {
1159                double secs_left = (timer_firetime(audio_timer) - space->machine->time()).as_double();
1159                double secs_left = (audio_timer->expire() - space->machine->time()).as_double();
11601160                unsigned int samples_left = secs_left * DACRATE_NTSC / (ai_dacrate + 1);
11611161                return samples_left * 4;
11621162            }
r10326r10327
20772077
20782078   cic_status = 0;
20792079
2080   timer_adjust_oneshot(audio_timer, attotime::never, 0);
2080   audio_timer->adjust(attotime::never);
20812081
20822082   cputag_set_input_line(machine, "rsp", INPUT_LINE_HALT, ASSERT_LINE);
20832083
src/mame/machine/tait8741.c
r10326r10327
277277{
278278   I8741 *st = &taito8741[num];
279279   taito8741_update(space, num);
280   LOG(("%s:8741-%d ST Read %02x\n",cpuexec_describe_context(space->machine),num,st->status));
280   LOG(("%s:8741-%d ST Read %02x\n",space->machine->describe_context(),num,st->status));
281281   return st->status;
282282}
283283
r10326r10327
287287   I8741 *st = &taito8741[num];
288288   int ret = st->toData;
289289   st->status &= 0xfe;
290   LOG(("%s:8741-%d DATA Read %02x\n",cpuexec_describe_context(space->machine),num,ret));
290   LOG(("%s:8741-%d DATA Read %02x\n",space->machine->describe_context(),num,ret));
291291
292292   /* update chip */
293293   taito8741_update(space, num);
r10326r10327
305305static void I8741_data_w(address_space *space, int num, int data)
306306{
307307   I8741 *st = &taito8741[num];
308   LOG(("%s:8741-%d DATA Write %02x\n",cpuexec_describe_context(space->machine),num,data));
308   LOG(("%s:8741-%d DATA Write %02x\n",space->machine->describe_context(),num,data));
309309   st->fromData = data;
310310   st->status |= 0x02;
311311   /* update chip */
r10326r10327
316316static void I8741_command_w(address_space *space, int num, int data)
317317{
318318   I8741 *st = &taito8741[num];
319   LOG(("%s:8741-%d CMD Write %02x\n",cpuexec_describe_context(space->machine),num,data));
319   LOG(("%s:8741-%d CMD Write %02x\n",space->machine->describe_context(),num,data));
320320   st->fromCmd = data;
321321   st->status |= 0x04;
322322   /* update chip */
r10326r10327
450450
451451   if(offset==1)
452452   {
453      LOG(("%s:8741[%d] CW %02X\n", cpuexec_describe_context(space->machine), num, data));
453      LOG(("%s:8741[%d] CW %02X\n", space->machine->describe_context(), num, data));
454454
455455      /* read pointer */
456456      mcu->cmd = data;
r10326r10327
488488   else
489489   {
490490      /* data */
491      LOG(("%s:8741[%d] DW %02X\n", cpuexec_describe_context(space->machine), num, data));
491      LOG(("%s:8741[%d] DW %02X\n", space->machine->describe_context(), num, data));
492492
493493      mcu->txd = data ^ 0x40; /* parity reverce ? */
494494      mcu->sts |= 0x02;     /* TXD busy         */
r10326r10327
517517      if(mcu->rst)
518518         mcu->rxd = input_port_read(space->machine, mcu->initReadPort); /* port in */
519519      ret = mcu->sts;
520      LOG(("%s:8741[%d]       SR %02X\n",cpuexec_describe_context(space->machine),num,ret));
520      LOG(("%s:8741[%d]       SR %02X\n",space->machine->describe_context(),num,ret));
521521   }
522522   else
523523   {
524524      /* clear status port */
525525      mcu->sts &= ~0x01; /* RD ready */
526526      ret = mcu->rxd;
527      LOG(("%s:8741[%d]       DR %02X\n",cpuexec_describe_context(space->machine),num,ret));
527      LOG(("%s:8741[%d]       DR %02X\n",space->machine->describe_context(),num,ret));
528528      mcu->rst = 0;
529529   }
530530   return ret;
src/mame/machine/megadriv.c
r10326r10327
815815//  if (regnum == 0x0a)
816816//      mame_printf_debug("Set HINT Reload Register to %d on scanline %d\n",value, genesis_scanline_counter);
817817
818//  mame_printf_debug("%s: Setting VDP Register #%02x to %02x\n",cpuexec_describe_context(machine), regnum,value);
818//  mame_printf_debug("%s: Setting VDP Register #%02x to %02x\n",machine->describe_context(), regnum,value);
819819}
820820
821821static void update_megadrive_vdp_code_and_address(void)
r10326r10327
10121012      UINT16 length;
10131013      source = (MEGADRIVE_REG15_DMASOURCE1 | (MEGADRIVE_REG16_DMASOURCE2<<8) | ((MEGADRIVE_REG17_DMASOURCE3&0xff)<<16))<<1;
10141014      length = (MEGADRIVE_REG13_DMALENGTH1 | (MEGADRIVE_REG14_DMALENGTH2<<8))<<1;
1015   //  mame_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", cpuexec_describe_context(machine), source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE, megadrive_vdp_code,MEGADRIVE_REG0F_AUTO_INC);
1015   //  mame_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", machine->describe_context(), source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE, megadrive_vdp_code,MEGADRIVE_REG0F_AUTO_INC);
10161016
10171017   }
10181018
r10326r10327
16221622   }
16231623   else
16241624   {
1625      logerror("%s: 68000 attempting to access YM2612 (read) without bus\n", cpuexec_describe_context(device->machine));
1625      logerror("%s: 68000 attempting to access YM2612 (read) without bus\n", device->machine->describe_context());
16261626      return 0;
16271627   }
16281628
r10326r10327
16401640   }
16411641   else
16421642   {
1643      logerror("%s: 68000 attempting to access YM2612 (write) without bus\n", cpuexec_describe_context(device->machine));
1643      logerror("%s: 68000 attempting to access YM2612 (write) without bus\n", device->machine->describe_context());
16441644   }
16451645}
16461646
r10326r10327
19991999      if (((megadrive_io_data_regs[portnum]&0x40)==0x00) && ((data&0x40) == 0x40))
20002000      {
20012001         io_stage[portnum]++;
2002         timer_adjust_oneshot(io_timeout[portnum], machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192), 0);
2002         io_timeout[portnum]->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192));
20032003      }
20042004
20052005   }
r10326r10327
30193019
30203020   /* if both RMD and LMD are set to OFF or pwm cycle register is one, then PWM timer ticks doesn't occur */
30213021   if(pwm_cycle == 1 || ((pwm_ctrl & 0xf) == 0))
3022      timer_adjust_oneshot(_32x_pwm_timer, attotime::never, 0);
3022      _32x_pwm_timer->adjust(attotime::never);
30233023   else
30243024   {
30253025      pwm_timer_tick = 0;
30263026      lch_fifo_state = rch_fifo_state = 0x4000;
30273027      lch_index_r = rch_index_r = 0;
30283028      lch_index_w = rch_index_w = 0;
3029      timer_adjust_oneshot(_32x_pwm_timer, attotime::from_hz((PWM_CLOCK) / (pwm_cycle - 1)), 0);
3029      _32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (pwm_cycle - 1)));
30303030   }
30313031}
30323032
r10326r10327
30713071      if(sh2_slave_pwmint_enable) { cpu_set_input_line(_32x_slave_cpu, SH2_PINT_IRQ_LEVEL,ASSERT_LINE); }
30723072   }
30733073
3074   timer_adjust_oneshot(_32x_pwm_timer, attotime::from_hz((PWM_CLOCK) / (pwm_cycle - 1)), 0);
3074   _32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (pwm_cycle - 1)));
30753075}
30763076
30773077static READ16_HANDLER( _32x_pwm_r )
r10326r10327
39833983         //printf("main cpu dmna set dmna: %d ret: %d\n", segacd_dmna, segacd_ret);
39843984         if (segacd_ram_mode==0)
39853985         {
3986            if (!timer_enabled(segacd_dmna_ret_timer))
3986            if (!segacd_dmna_ret_timer->enabled())
39873987            {
39883988               if (!segacd_dmna)
39893989               {
39903990                  //printf("main dmna\n");
39913991                  segacd_dmna = 1;
3992                  timer_adjust_oneshot(segacd_dmna_ret_timer, attotime::from_usec(100), 0);
3992                  segacd_dmna_ret_timer->adjust(attotime::from_usec(100));
39933993               }
39943994            }
39953995         }
r10326r10327
40514051
40524052         if (segacd_ram_mode==0)
40534053         {
4054            if (!timer_enabled(segacd_dmna_ret_timer))
4054            if (!segacd_dmna_ret_timer->enabled())
40554055            {
40564056               if (segacd_dmna)
40574057               {
40584058               //  printf("sub ret\n");
40594059               //  segacd_ret = 1;
40604060               //  segacd_dmna = 0;
4061                  timer_adjust_oneshot(segacd_dmna_ret_timer, attotime::from_usec(100), 0);
4061                  segacd_dmna_ret_timer->adjust(attotime::from_usec(100));
40624062               }
40634063            }
40644064         }
r10326r10327
40984098               // reset it flags etc.?
40994099               segacd_ret = 0;
41004100               segacd_dmna = 0;
4101               timer_adjust_oneshot(segacd_dmna_ret_timer, attotime::from_usec(100), 0);
4101               segacd_dmna_ret_timer->adjust(attotime::from_usec(100));
41024102            }
41034103            else
41044104            {
r10326r10327
49834983      hock_cmd = 0;
49844984   }
49854985
4986   timer_adjust_oneshot(segacd_hock_timer, attotime::from_hz(75), 0);
4986   segacd_hock_timer->adjust(attotime::from_hz(75));
49874987}
49884988
49894989
r10326r10327
50225022   memory_install_read16_handler (space, 0x0000070, 0x0000073, 0, 0, scd_hint_vector_r );
50235023
50245024   segacd_gfx_conversion_timer = machine->scheduler().timer_alloc(FUNC(segacd_gfx_conversion_timer_callback));
5025   timer_adjust_oneshot(segacd_gfx_conversion_timer, attotime::never, 0);
5025   segacd_gfx_conversion_timer->adjust(attotime::never);
50265026
50275027   segacd_dmna_ret_timer = machine->scheduler().timer_alloc(FUNC(segacd_dmna_ret_timer_callback));
5028   timer_adjust_oneshot(segacd_gfx_conversion_timer, attotime::never, 0);
5028   segacd_gfx_conversion_timer->adjust(attotime::never);
50295029
50305030   segacd_hock_timer = machine->scheduler().timer_alloc(FUNC(segacd_hock_callback));
5031   timer_adjust_oneshot(segacd_hock_timer, attotime::never, 0);
5031   segacd_hock_timer->adjust(attotime::never);
50325032
50335033   segacd_irq3_timer = machine->scheduler().timer_alloc(FUNC(segacd_irq3_timer_callback));
5034   timer_adjust_oneshot(segacd_irq3_timer, attotime::never, 0);
5034   segacd_irq3_timer->adjust(attotime::never);
50355035
50365036
50375037
r10326r10327
51125112   segacd_ram_mode = 0;
51135113   segacd_ram_mode_old = 0;
51145114
5115   timer_adjust_oneshot(segacd_dmna_ret_timer, attotime::zero, 0);
5116   timer_adjust_oneshot(segacd_hock_timer, attotime::zero, 0);
5115   segacd_dmna_ret_timer->adjust(attotime::zero);
5116   segacd_hock_timer->adjust(attotime::zero);
51175117   hock_cmd = 0;
51185118}
51195119
r10326r10327
52885288   hock_cmd = (data & 4) >> 2;
52895289
52905290   if(data & 4) // enable Hock timer
5291      timer_adjust_oneshot(segacd_hock_timer, attotime::from_hz(75), 0);
5291      segacd_hock_timer->adjust(attotime::from_hz(75));
52925292   else
5293      timer_adjust_oneshot(segacd_hock_timer, attotime::never, 0);
5293      segacd_hock_timer->adjust(attotime::never);
52945294}
52955295
52965296/* 68k <- CDD communication comms are 4-bit wide */
r10326r10327
57245724      segacd_conversion_active = 1;
57255725
57265726      // todo: proper time calculation
5727      timer_adjust_oneshot(segacd_gfx_conversion_timer, attotime::from_hz(500), 0);
5727      segacd_gfx_conversion_timer->adjust(attotime::from_hz(500));
57285728
57295729
57305730      int line;
r10326r10327
58735873      // time = reg * 30.72 us
58745874
58755875      if (segacd_irq3_timer_reg)
5876         timer_adjust_oneshot(segacd_irq3_timer, SEGACD_IRQ3_TIMER_SPEED, 0);
5876         segacd_irq3_timer->adjust(SEGACD_IRQ3_TIMER_SPEED);
58775877      else
5878         timer_adjust_oneshot(segacd_irq3_timer, attotime::never, 0);
5878         segacd_irq3_timer->adjust(attotime::never);
58795879
58805880      printf("segacd_irq3timer_w %02x\n", segacd_irq3_timer_reg);
58815881   }
r10326r10327
58865886   if (segacd_irq_mask & 0x08)
58875887      cputag_set_input_line(machine, "segacd_68k", 3, HOLD_LINE);
58885888
5889   timer_adjust_oneshot(segacd_irq3_timer, SEGACD_IRQ3_TIMER_SPEED, 0);
5889   segacd_irq3_timer->adjust(SEGACD_IRQ3_TIMER_SPEED);
58905890}
58915891
58925892
r10326r10327
89608960   if(_32x_is_connected)
89618961   {
89628962      _32x_pwm_timer = machine->scheduler().timer_alloc(FUNC(_32x_pwm_callback));
8963      timer_adjust_oneshot(_32x_pwm_timer, attotime::never, 0);
8963      _32x_pwm_timer->adjust(attotime::never);
89648964   }
89658965
89668966   sega_cd_connected = 0;
src/mame/machine/meters.c
r10326r10327
4040      meter_info[i].count     = 0;
4141      meter_info[i].on      = 0;
4242      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);
43      meter_info[i].meter_timer->reset();
4444   }
4545   number_mtr = number;
4646}
r10326r10327
104104   if ( state )
105105   {
106106      meter_info[id].on =1;
107      timer_adjust_oneshot(meter_info[id].meter_timer, attotime::from_seconds(meter_info[id].reacttime), id);
107      meter_info[id].meter_timer->adjust(attotime::from_seconds(meter_info[id].reacttime), id);
108108   }
109109   else
110110   {
111111      meter_info[id].on =0;
112      timer_adjust_oneshot(meter_info[id].meter_timer, attotime::never, id);
112      meter_info[id].meter_timer->adjust(attotime::never, id);
113113   }
114114  }
115115
src/mame/machine/qix.c
r10326r10327
375375      cputag_set_input_line(device->machine, "mcu", M68705_IRQ_LINE, ASSERT_LINE);
376376      /* temporarily boost the interleave to sync things up */
377377      /* note: I'm using 50 because 30 is not enough for space dungeon at game over */
378      cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(50));
378      device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
379379   }
380380   else
381381      cputag_set_input_line(device->machine, "mcu", M68705_IRQ_LINE, CLEAR_LINE);
src/mame/machine/snes.c
r10326r10327
107107   cpu_set_input_line(state->maincpu, G65816_LINE_NMI, ASSERT_LINE);
108108
109109   // don't happen again
110   timer_adjust_oneshot(state->nmi_timer, attotime::never, 0);
110   state->nmi_timer->adjust(attotime::never);
111111}
112112
113113static void snes_hirq_tick( running_machine *machine )
r10326r10327
121121   cpu_set_input_line(state->maincpu, G65816_LINE_IRQ, ASSERT_LINE);
122122
123123   // don't happen again
124   timer_adjust_oneshot(state->hirq_timer, attotime::never, 0);
124   state->hirq_timer->adjust(attotime::never);
125125}
126126
127127static TIMER_CALLBACK( snes_hirq_tick_callback )
r10326r10327
157157   state->io_read(cpu0space->machine);
158158   snes_ram[HVBJOY] &= 0xfe;      /* Clear busy bit */
159159
160   timer_adjust_oneshot(state->io_timer, attotime::never, 0);
160   state->io_timer->adjust(attotime::never);
161161}
162162
163163static TIMER_CALLBACK( snes_scanline_tick )
r10326r10327
205205         }
206206         else
207207         {
208            timer_adjust_oneshot(state->hirq_timer, machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert, pixel * state->htmult), 0);
208            state->hirq_timer->adjust(machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert, pixel * state->htmult));
209209         }
210210      }
211211   }
r10326r10327
221221      if (snes_ram[NMITIMEN] & 0x80)   /* NMI only signaled if this bit set */
222222      {
223223         // NMI goes off about 12 cycles after this (otherwise Chrono Trigger, NFL QB Club, etc. lock up)
224         timer_adjust_oneshot(state->nmi_timer, state->maincpu->cycles_to_attotime(12), 0);
224         state->nmi_timer->adjust(state->maincpu->cycles_to_attotime(12));
225225      }
226226
227227      /* three lines after start of vblank we update the controllers (value from snes9x) */
228      timer_adjust_oneshot(state->io_timer, machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert + 2, state->hblank_offset * state->htmult), 0);
228      state->io_timer->adjust(machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert + 2, state->hblank_offset * state->htmult));
229229   }
230230
231231   // hdma reset happens at scanline 0, H=~6
r10326r10327
245245      cpu_set_input_line(state->maincpu, G65816_LINE_NMI, CLEAR_LINE );
246246   }
247247
248   timer_adjust_oneshot(state->scanline_timer, attotime::never, 0);
249   timer_adjust_oneshot(state->hblank_timer, machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert, state->hblank_offset * state->htmult), 0);
248   state->scanline_timer->adjust(attotime::never);
249   state->hblank_timer->adjust(machine->primary_screen->time_until_pos(snes_ppu.beam.current_vert, state->hblank_offset * state->htmult));
250250
251251//  printf("%02x %d\n",snes_ram[HVBJOY],snes_ppu.beam.current_vert);
252252}
r10326r10327
261261   snes_ppu.beam.current_vert = machine->primary_screen->vpos();
262262
263263   /* make sure we halt */
264   timer_adjust_oneshot(state->hblank_timer, attotime::never, 0);
264   state->hblank_timer->adjust(attotime::never);
265265
266266   /* draw a scanline */
267267   if (snes_ppu.beam.current_vert <= snes_ppu.beam.last_visible_line)
r10326r10327
286286      nextscan = 0;
287287   }
288288
289   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(nextscan), 0);
289   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(nextscan));
290290}
291291
292292/* FIXME: multiplication should take 8 CPU cycles & division 16 CPU cycles, but
r10326r10327
616616   {
617617//      printf("816: %02x to APU @ %d (PC=%06x)\n", data, offset & 3,cpu_get_pc(space->cpu));
618618      spc_port_in(state->spc700, offset & 0x3, data);
619      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(20));
619      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
620620      return;
621621   }
622622
r10326r10327
711711         break;
712712      case WRMPYB:   /* Multiplier B */
713713         snes_ram[WRMPYB] = data;
714//          timer_adjust_oneshot(state->mult_timer, state->maincpu->cycles_to_attotime(8), 0);
714//          state->mult_timer->adjust(state->maincpu->cycles_to_attotime(8));
715715         {
716716            UINT32 c = snes_ram[WRMPYA] * snes_ram[WRMPYB];
717717            snes_ram[RDMPYL] = c & 0xff;
r10326r10327
723723         break;
724724      case WRDVDD:   /* Divisor */
725725         snes_ram[WRDVDD] = data;
726//          timer_adjust_oneshot(state->div_timer, state->maincpu->cycles_to_attotime(16), 0);
726//          state->div_timer->adjust(state->maincpu->cycles_to_attotime(16));
727727         {
728728            UINT16 value, dividend, remainder;
729729            dividend = remainder = 0;
r10326r10327
17091709
17101710   /* init timers and stop them */
17111711   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(snes_scanline_tick));
1712   timer_adjust_oneshot(state->scanline_timer, attotime::never, 0);
1712   state->scanline_timer->adjust(attotime::never);
17131713   state->hblank_timer = machine->scheduler().timer_alloc(FUNC(snes_hblank_tick));
1714   timer_adjust_oneshot(state->hblank_timer, attotime::never, 0);
1714   state->hblank_timer->adjust(attotime::never);
17151715   state->nmi_timer = machine->scheduler().timer_alloc(FUNC(snes_nmi_tick));
1716   timer_adjust_oneshot(state->nmi_timer, attotime::never, 0);
1716   state->nmi_timer->adjust(attotime::never);
17171717   state->hirq_timer = machine->scheduler().timer_alloc(FUNC(snes_hirq_tick_callback));
1718   timer_adjust_oneshot(state->hirq_timer, attotime::never, 0);
1718   state->hirq_timer->adjust(attotime::never);
17191719   state->div_timer = machine->scheduler().timer_alloc(FUNC(snes_div_callback));
1720   timer_adjust_oneshot(state->div_timer, attotime::never, 0);
1720   state->div_timer->adjust(attotime::never);
17211721   state->mult_timer = machine->scheduler().timer_alloc(FUNC(snes_mult_callback));
1722   timer_adjust_oneshot(state->mult_timer, attotime::never, 0);
1722   state->mult_timer->adjust(attotime::never);
17231723   state->io_timer = machine->scheduler().timer_alloc(FUNC(snes_update_io));
1724   timer_adjust_oneshot(state->io_timer, attotime::never, 0);
1724   state->io_timer->adjust(attotime::never);
17251725
17261726   // SNES hcounter has a 0-339 range.  hblank starts at counter 260.
17271727   // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels.
17281728   state->hblank_offset = 274;
1729   timer_adjust_oneshot(state->hblank_timer, machine->primary_screen->time_until_pos(((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC - 1 : SNES_VTOTAL_PAL - 1, state->hblank_offset), 0);
1729   state->hblank_timer->adjust(machine->primary_screen->time_until_pos(((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC - 1 : SNES_VTOTAL_PAL - 1, state->hblank_offset));
17301730}
17311731
17321732static void snes_init_ram( running_machine *machine )
src/mame/machine/taitosj.c
r10326r10327
118118   LOG(("%04x: protection write %02x\n",cpu_get_pc(space->cpu),data));
119119   space->machine->scheduler().synchronize(FUNC(taitosj_mcu_real_data_w), data);
120120   /* temporarily boost the interleave to sync things up */
121   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
121   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
122122}
123123
124124READ8_HANDLER( taitosj_mcu_status_r )
125125{
126126   taitosj_state *state = space->machine->driver_data<taitosj_state>();
127127   /* temporarily boost the interleave to sync things up */
128   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
128   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
129129
130130   /* bit 0 = the 68705 has read data from the Z80 */
131131   /* bit 1 = the 68705 has written data for the Z80 */
src/mame/machine/amiga.c
r10326r10327
400400   amiga_state *state = machine->driver_data<amiga_state>();
401401
402402   update_irqs(machine);
403   timer_reset( state->irq_timer, attotime::never);
403   state->irq_timer->reset( );
404404}
405405
406406
r10326r10327
937937   amiga_custom_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_BLIT, 0xffff);
938938
939939   /* reset the blitter timer */
940   timer_reset( state->blitter_timer, attotime::never);
940   state->blitter_timer->reset( );
941941}
942942
943943
r10326r10327
956956   /* is there another blitting in progress? */
957957   if (CUSTOM_REG(REG_DMACON) & 0x4000)
958958   {
959      logerror("%s - This program is playing tricks with the blitter\n", cpuexec_describe_context(space->machine) );
959      logerror("%s - This program is playing tricks with the blitter\n", space->machine->describe_context() );
960960      return;
961961   }
962962
r10326r10327
10021002   CUSTOM_REG(REG_DMACON) |= 0x4000;
10031003
10041004   /* set a timer */
1005   timer_adjust_oneshot( state->blitter_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime( blittime ), 0);
1005   state->blitter_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime( blittime ));
10061006}
10071007
10081008
r10326r10327
13751375
13761376         /* if 'blitter-nasty' has been turned on and we have a blit pending, reschedule it */
13771377         if ( ( data & 0x400 ) && ( CUSTOM_REG(REG_DMACON) & 0x4000 ) )
1378            timer_adjust_oneshot( state->blitter_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime( BLITTER_NASTY_DELAY ), 0);
1378            state->blitter_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime( BLITTER_NASTY_DELAY ));
13791379
13801380         break;
13811381
r10326r10327
13861386         CUSTOM_REG(offset) = data;
13871387
13881388         if ( temp & 0x8000  ) /* if we're enabling irq's, delay a bit */
1389            timer_adjust_oneshot( state->irq_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime( AMIGA_IRQ_DELAY_CYCLES ), 0);
1389            state->irq_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime( AMIGA_IRQ_DELAY_CYCLES ));
13901390         else /* if we're disabling irq's, process right away */
13911391            update_irqs(space->machine);
13921392         break;
r10326r10327
14051405         CUSTOM_REG(offset) = data;
14061406
14071407         if ( temp & 0x8000  ) /* if we're generating irq's, delay a bit */
1408            timer_adjust_oneshot( state->irq_timer, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime( AMIGA_IRQ_DELAY_CYCLES ), 0);
1408            state->irq_timer->adjust( space->machine->device<cpu_device>("maincpu")->cycles_to_attotime( AMIGA_IRQ_DELAY_CYCLES ));
14091409         else /* if we're clearing irq's, process right away */
14101410            update_irqs(space->machine);
14111411         break;
src/mame/machine/vertigo.c
r10326r10327
179179       quickly. Otherwise the main CPU gives up with sound. Boosting
180180       the interleave for a while helps. */
181181
182   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
182   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
183183}
184184
185185
src/mame/machine/pcshare.c
r10326r10327
9999   if (pc_keyb.on != on)
100100   {
101101      if (!on)
102         timer_adjust_oneshot(pc_keyb.timer, attotime::from_msec(5), 0);
102         pc_keyb.timer->adjust(attotime::from_msec(5));
103103      else {
104104         if ( pc_keyb.self_test ) {
105105            /* The self test of the keyboard takes some time. 2 msec seems to work. */
106106            /* This still needs to verified against a real keyboard. */
107            timer_adjust_oneshot(pc_keyb.timer, attotime::from_msec( 2 ), 0);
107            pc_keyb.timer->adjust(attotime::from_msec( 2 ));
108108         } else {
109            timer_reset(pc_keyb.timer, attotime::never);
109            pc_keyb.timer->reset();
110110            pc_keyb.self_test = 0;
111111         }
112112      }
src/mame/machine/atarigen.c
r10326r10327
210210void atarigen_scanline_int_set(screen_device &screen, int scanline)
211211{
212212   emu_timer *timer = get_screen_timer(screen)->scanline_interrupt_timer;
213   timer_adjust_oneshot(timer, screen.time_until_pos(scanline), 0);
213   timer->adjust(screen.time_until_pos(scanline));
214214}
215215
216216
r10326r10327
326326   atarigen_scanline_int_gen(machine->device("maincpu"));
327327
328328   /* set a new timer to go off at the same scan line next frame */
329   timer_adjust_oneshot(timer, screen.frame_period(), 0);
329   timer->adjust(screen.frame_period());
330330}
331331
332332
r10326r10327
777777
778778   /* allocate a high frequency timer until a response is generated */
779779   /* the main CPU is *very* sensistive to the timing of the response */
780   cpuexec_boost_interleave(machine, SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
780   machine->scheduler().boost_interleave(SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
781781}
782782
783783
r10326r10327
801801
802802   /* allocate a high frequency timer until a response is generated */
803803   /* the main CPU is *very* sensistive to the timing of the response */
804   cpuexec_boost_interleave(machine, SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
804   machine->scheduler().boost_interleave(SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
805805}
806806
807807
r10326r10327
896896   if (state->scanline_callback != NULL)
897897   {
898898      emu_timer *timer = get_screen_timer(screen)->scanline_timer;
899      timer_adjust_oneshot(timer, screen.time_until_pos(0), 0);
899      timer->adjust(screen.time_until_pos(0));
900900   }
901901}
902902
r10326r10327
921921      scanline += state->scanlines_per_callback;
922922      if (scanline >= screen.height())
923923         scanline = 0;
924      timer_adjust_oneshot(get_screen_timer(screen)->scanline_timer, screen.time_until_pos(scanline), scanline);
924      get_screen_timer(screen)->scanline_timer->adjust(screen.time_until_pos(scanline), scanline);
925925   }
926926}
927927
r10326r10327
960960      tilemap_set_scrollx(state->playfield2_tilemap, 0, state->atarivc_state.pf1_xscroll);
961961      tilemap_set_scrolly(state->playfield2_tilemap, 0, state->atarivc_state.pf1_yscroll);
962962   }
963   timer_adjust_oneshot(timer, screen.time_until_pos(0), 0);
963   timer->adjust(screen.time_until_pos(0));
964964
965965   /* use this for debugging the video controller values */
966966#if 0
r10326r10327
10031003   if (state->atarivc_eof_data)
10041004   {
10051005      emu_timer *timer = get_screen_timer(screen)->atarivc_eof_update_timer;
1006      timer_adjust_oneshot(timer, screen.time_until_pos(0), 0);
1006      timer->adjust(screen.time_until_pos(0));
10071007   }
10081008}
10091009
src/mame/machine/cdislave.c
r10326r10327
9393    verboselog(&m_machine, 0, "Asserting IRQ2\n" );
9494    cpu_set_input_line_vector(m_machine.device("maincpu"), M68K_IRQ_2, 26);
9595    cputag_set_input_line(&m_machine, "maincpu", M68K_IRQ_2, ASSERT_LINE);
96    timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
96    m_interrupt_timer->adjust(attotime::never);
9797}
9898
9999void cdislave_device::prepare_readback(attotime delay, UINT8 channel, UINT8 count, UINT8 data0, UINT8 data1, UINT8 data2, UINT8 data3, UINT8 cmd)
r10326r10327
106106    m_channel[channel].m_out_buf[3] = data3;
107107    m_channel[channel].m_out_cmd = cmd;
108108
109    timer_adjust_oneshot(m_interrupt_timer, delay, 0);
109    m_interrupt_timer->adjust(delay);
110110}
111111
112112void cdislave_device::perform_mouse_update()
r10326r10327
344344                        dmadac_enable(&state->dmadac[0], 2, 0);
345345                        m_in_index = 0;
346346                        m_in_count = 0;
347                        //timer_adjust_oneshot(cdic->audio_sample_timer, attotime::never, 0);
347                        //cdic->audio_sample_timer->adjust(attotime::never);
348348                        break;
349349                    case 0x83: // Unmute Audio
350350                        verboselog(&m_machine, 0, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset );
r10326r10327
475475    register_globals();
476476
477477    m_interrupt_timer = m_machine.scheduler().timer_alloc(FUNC(trigger_readback_int));
478    timer_adjust_oneshot(m_interrupt_timer, attotime::never, 0);
478    m_interrupt_timer->adjust(attotime::never);
479479}
480480
481481//-------------------------------------------------
src/mame/machine/zs01.c
r10326r10327
2121      va_start( v, s_fmt );
2222      vsprintf( buf, s_fmt, v );
2323      va_end( v );
24      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
24      logerror( "%s: %s", machine->describe_context(), buf );
2525   }
2626}
2727
src/mame/machine/namcos2.c
r10326r10327
131131   InitC148();
132132
133133   /* reset POSIRQ timer */
134   timer_adjust_oneshot(namcos2_posirq_timer, attotime::never, 0);
134   namcos2_posirq_timer->adjust(attotime::never);
135135}
136136
137137/*************************************************************/
r10326r10327
669669
670670void namcos2_adjust_posirq_timer( running_machine *machine, int scanline )
671671{
672   timer_adjust_oneshot(namcos2_posirq_timer, machine->primary_screen->time_until_pos(scanline, 80), scanline);
672   namcos2_posirq_timer->adjust(machine->primary_screen->time_until_pos(scanline, 80), scanline);
673673}
674674
675675INTERRUPT_GEN( namcos2_68k_master_vblank )
src/mame/machine/naomibd.c
r10326r10327
586586   }
587587   else
588588   {
589      //mame_printf_verbose("%s:ROM: read mask %" I64FMT "x @ %x\n", cpuexec_describe_context(machine), mem_mask, offset);
589      //mame_printf_verbose("%s:ROM: read mask %" I64FMT "x @ %x\n", machine->describe_context(), mem_mask, offset);
590590   }
591591
592592   return U64(0xffffffffffffffff);
r10326r10327
733733                  v->prot_key = data;
734734
735735                  #if NAOMIBD_PRINTF_PROTECTION
736                  printf("Protection: set up read @ %x, key %x sum %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->prot_sum, v->rom_offset, v->dma_offset, cpuexec_describe_context(device->machine));
736                  printf("Protection: set up read @ %x, key %x sum %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->prot_sum, v->rom_offset, v->dma_offset, device->machine->describe_context());
737737
738738                  v->prot_pio_count = 0;
739739                  #endif
r10326r10327
914914      }
915915      break;
916916      default:
917         mame_printf_verbose("%s: ROM: write %" I64FMT "x to %x, mask %" I64FMT "x\n", cpuexec_describe_context(device->machine), data, offset, mem_mask);
917         mame_printf_verbose("%s: ROM: write %" I64FMT "x to %x, mask %" I64FMT "x\n", device->machine->describe_context(), data, offset, mem_mask);
918918         break;
919919   }
920920}
r10326r10327
18091809   }
18101810
18111811   /* set the type */
1812   v->index = device->machine->m_devicelist.index(device->type(), device->tag());
1812   v->index = device->machine->m_devicelist.indexof(device->type(), device->tag());
18131813   v->type = config->type;
18141814
18151815   /* initialize some registers */
src/mame/machine/tx1.c
r10326r10327
173173
174174   if (SN74S516.X == 0)
175175   {
176      mame_printf_debug("%s:SN74S516 tried to divide by zero\n", cpuexec_describe_context(machine));
176      mame_printf_debug("%s:SN74S516 tried to divide by zero\n", machine->describe_context());
177177      SN74S516.ZW.Z = (INT16)0xffff;
178178      SN74S516.ZW.W = 0xffff;
179179      SN74S516.ZWfl = 0;
r10326r10327
315315         if (SN74S516.code == 0x6666)
316316         {
317317            CLEAR_SEQUENCE;
318            mame_printf_debug("%s:Code 6666: PROMADDR:%x\n", cpuexec_describe_context(machine), math.promaddr);
318            mame_printf_debug("%s:Code 6666: PROMADDR:%x\n", machine->describe_context(), math.promaddr);
319319         }
320320
321321         UPDATE_SEQUENCE;
src/mame/machine/mcr.c
r10326r10327
335335{
336336   /* watchdog counter is clocked by 7.3728MHz crystal / 16 */
337337   /* watchdog is tripped when 14-bit counter overflows => / 32768 = 14.0625Hz*/
338   timer_adjust_oneshot(ipu_watchdog_timer, attotime::from_hz(7372800 / 16 / 32768), 0);
338   ipu_watchdog_timer->adjust(attotime::from_hz(7372800 / 16 / 32768));
339339   return 0xff;
340340}
341341
src/mame/machine/arkanoid.c
r10326r10327
3636{
3737   space->machine->scheduler().synchronize(FUNC(test), data);
3838   /* boost the interleave for a few usecs to make sure it is read successfully */
39   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
39   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
4040}
4141
4242READ8_HANDLER( arkanoid_68705_port_a_r )
src/mame/machine/archimds.c
r10326r10327
111111   archimedes_request_irq_a(machine, ARCHIMEDES_IRQA_VBL);
112112
113113   // set up for next vbl
114   timer_adjust_oneshot(vbl_timer, machine->primary_screen->time_until_pos(vidc_regs[0xb4]), 0);
114   vbl_timer->adjust(machine->primary_screen->time_until_pos(vidc_regs[0xb4]));
115115}
116116
117117/* video DMA */
r10326r10327
128128      vram[vidc_vidcur] = (space->read_byte(vidc_vidstart+vidc_vidcur+vidc_vidinit));
129129
130130   if(video_dma_on)
131      timer_adjust_oneshot(vid_timer, space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]), 0);
131      vid_timer->adjust(space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]));
132132   else
133      timer_adjust_oneshot(vid_timer, attotime::never, 0);
133      vid_timer->adjust(attotime::never);
134134}
135135
136136/* audio DMA */
r10326r10327
162162
163163      if(!audio_dma_on)
164164      {
165         timer_adjust_oneshot(snd_timer, attotime::never, 0);
165         snd_timer->adjust(attotime::never);
166166         for(ch=0;ch<8;ch++)
167167            dac_signed_data_16_w(space->machine->device(dac_port[ch & 7]), 0x8000);
168168      }
r10326r10327
177177   {
178178      case 0:
179179      case 1:
180         timer_adjust_oneshot(timer[tmr], attotime::from_usec(ioc_timercnt[tmr]/8), tmr); // TODO: ARM timings are quite off there, it should be latch and not latch/8
180         timer[tmr]->adjust(attotime::from_usec(ioc_timercnt[tmr]/8), tmr); // TODO: ARM timings are quite off there, it should be latch and not latch/8
181181         break;
182182      case 2:
183183         freq = 1000000.0 / (double)(ioc_timercnt[tmr]+1);
184         timer_adjust_oneshot(timer[tmr], attotime::from_hz(freq), tmr);
184         timer[tmr]->adjust(attotime::from_hz(freq), tmr);
185185         break;
186186      case 3:
187187         freq = 1000000.0 / (double)((ioc_timercnt[tmr]+1)*16);
188         timer_adjust_oneshot(timer[tmr], attotime::from_hz(freq), tmr);
188         timer[tmr]->adjust(attotime::from_hz(freq), tmr);
189189         break;
190190   }
191191}
r10326r10327
232232   memc_pagesize = 0;
233233
234234   vbl_timer = machine->scheduler().timer_alloc(FUNC(vidc_vblank));
235   timer_adjust_oneshot(vbl_timer, attotime::never, 0);
235   vbl_timer->adjust(attotime::never);
236236
237237   timer[0] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
238238   timer[1] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
239239   timer[2] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
240240   timer[3] = machine->scheduler().timer_alloc(FUNC(ioc_timer));
241   timer_adjust_oneshot(timer[0], attotime::never, 0);
242   timer_adjust_oneshot(timer[1], attotime::never, 0);
243   timer_adjust_oneshot(timer[2], attotime::never, 0);
244   timer_adjust_oneshot(timer[3], attotime::never, 0);
241   timer[0]->adjust(attotime::never);
242   timer[1]->adjust(attotime::never);
243   timer[2]->adjust(attotime::never);
244   timer[3]->adjust(attotime::never);
245245
246246   vid_timer = machine->scheduler().timer_alloc(FUNC(vidc_video_tick));
247247   snd_timer = machine->scheduler().timer_alloc(FUNC(vidc_audio_tick));
248   timer_adjust_oneshot(snd_timer, attotime::never, 0);
248   snd_timer->adjust(attotime::never);
249249}
250250
251251READ32_HANDLER(archimedes_memc_logical_r)
r10326r10327
381381
382382static void latch_timer_cnt(int tmr)
383383{
384   double time = timer_timeelapsed(timer[tmr]).as_double();
384   double time = timer[tmr]->elapsed().as_double();
385385   time *= 2000000.0;   // find out how many 2 MHz ticks have gone by
386386   ioc_timerout[tmr] = ioc_timercnt[tmr] - (UINT32)time;
387387}
r10326r10327
490490            archimedes_request_irq_a(space->machine,ARCHIMEDES_IRQA_FORCE);
491491
492492         if(data & 0x08) //set up the VBLANK timer
493            timer_adjust_oneshot(vbl_timer, space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]), 0);
493            vbl_timer->adjust(space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]));
494494
495495         break;
496496
r10326r10327
911911            if ((data>>10)&1)
912912            {
913913               vidc_vidcur = 0;
914               timer_adjust_oneshot(vid_timer, space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]), 0);
914               vid_timer->adjust(space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]));
915915            }
916916
917917            if ((data>>11)&1)
r10326r10327
923923
924924               printf("MEMC: Starting audio DMA at %f Hz, buffer from %x to %x\n", sndhz, vidc_sndstart, vidc_sndend);
925925
926               timer_adjust_periodic(snd_timer, attotime::zero, 0, attotime::from_hz(sndhz));
926               snd_timer->adjust(attotime::zero, 0, attotime::from_hz(sndhz));
927927            }
928928
929929            break;
src/mame/machine/segamsys.c
r10326r10327
446446/* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */
447447void segae_md_sms_stop_scanline_timer(void)
448448{
449   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer,  attotime::never, 0);
449   md_sms_vdp->sms_scanline_timer->adjust(attotime::never);
450450   memset(md_sms_vdp->vram,0x00,0x4000);
451451}
452452
r10326r10327
10081008   if (chip->sms_scanline_counter<(chip->sms_total_scanlines-1))
10091009   {
10101010      chip->sms_scanline_counter++;
1011      timer_adjust_oneshot(chip->sms_scanline_timer, attotime::from_hz(chip->sms_framerate * chip->sms_total_scanlines), 0);
1011      chip->sms_scanline_timer->adjust(attotime::from_hz(chip->sms_framerate * chip->sms_total_scanlines));
10121012
10131013      if (chip->sms_scanline_counter>sms_mode_table[chip->screen_mode].sms2_height)
10141014      {
r10326r10327
11751175
11761176   chip->sms_scanline_counter = -1;
11771177   chip->yscroll = chip->regs[0x9]; // this can't change mid-frame
1178   timer_adjust_oneshot(chip->sms_scanline_timer, attotime::zero, 0);
1178   chip->sms_scanline_timer->adjust(attotime::zero);
11791179}
11801180
11811181
r10326r10327
11981198
11991199MACHINE_RESET(sms)
12001200{
1201   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime::zero, 0);
1201   md_sms_vdp->sms_scanline_timer->adjust(attotime::zero);
12021202}
12031203
12041204
r10326r10327
12341234
12351235MACHINE_RESET(systeme)
12361236{
1237   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime::zero, 0);
1238   timer_adjust_oneshot(vdp2->sms_scanline_timer, attotime::zero, 0);
1237   vdp1->sms_scanline_timer->adjust(attotime::zero);
1238   vdp2->sms_scanline_timer->adjust(attotime::zero);
12391239}
12401240
12411241MACHINE_RESET(megatech_md_sms)
12421242{
1243   timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime::zero, 0);
1243   md_sms_vdp->sms_scanline_timer->adjust(attotime::zero);
12441244}
12451245
12461246MACHINE_RESET(megatech_bios)
12471247{
1248   timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime::zero, 0);
1248   vdp1->sms_scanline_timer->adjust(attotime::zero);
12491249}
12501250
12511251VIDEO_EOF(systeme)
src/mame/machine/slikshot.c
r10326r10327
516516   }
517517
518518   /* boost the interleave whenever this is written to */
519   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
519   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
520520
521521   /* stash the new value */
522522   z80_ctrl = data;
src/mame/machine/gaelcrpt.c
r10326r10327
146146
147147      lastdecword = data;
148148
149//      logerror("%s : data1 = %4x > %4x @ %8x\n",cpuexec_describe_context(space->machine),savedata,data,lastoffset);
149//      logerror("%s : data1 = %4x > %4x @ %8x\n",space->machine->describe_context(),savedata,data,lastoffset);
150150   }
151151   return data;
152152}
src/mame/machine/harddriv.c
r10326r10327
11811181   /* it is important that all the CPUs be in sync before we continue, so spin a little */
11821182   /* while to let everyone else catch up */
11831183   cpu_spinuntil_trigger(space->cpu, DS3_TRIGGER);
1184   cpuexec_triggertime(space->machine, DS3_TRIGGER, attotime::from_usec(5));
1184   space->machine->scheduler().trigger(DS3_TRIGGER, attotime::from_usec(5));
11851185
11861186   return state->ds3_gdata;
11871187}
r10326r10327
12771277         update_ds3_irq(state);
12781278
12791279         /* once we've written data, trigger the main CPU to wake up again */
1280         cpuexec_trigger(space->machine, DS3_TRIGGER);
1280         space->machine->scheduler().trigger(DS3_TRIGGER);
12811281         break;
12821282
12831283      case 1:
src/mame/machine/psx.c
r10326r10327
137137      va_start( v, s_fmt );
138138      vsprintf( buf, s_fmt, v );
139139      va_end( v );
140      logerror( "%s: %s", cpuexec_describe_context(p_psx->machine), buf );
140      logerror( "%s: %s", p_psx->machine->describe_context(), buf );
141141   }
142142}
143143
r10326r10327
245245{
246246   psx_dma_channel *dma = &p_psx->channel[ n_channel ];
247247
248   timer_adjust_oneshot( dma->timer, attotime::from_hz(33868800) * n_ticks, n_channel);
248   dma->timer->adjust( attotime::from_hz(33868800) * n_ticks, n_channel);
249249   dma->n_ticks = n_ticks;
250250   dma->b_running = 1;
251251}
r10326r10327
254254{
255255   psx_dma_channel *dma = &p_psx->channel[ n_channel ];
256256
257   timer_adjust_oneshot( dma->timer, attotime::never, 0);
257   dma->timer->adjust( attotime::never);
258258   dma->b_running = 0;
259259}
260260
r10326r10327
656656
657657   if( ( root->n_mode & PSX_RC_STOP ) != 0 )
658658   {
659      timer_adjust_oneshot( root->timer, attotime::never, n_counter);
659      root->timer->adjust( attotime::never, n_counter);
660660   }
661661   else
662662   {
r10326r10327
670670
671671      n_duration *= root_divider( p_psx, n_counter );
672672
673      timer_adjust_oneshot( root->timer, attotime::from_hz(33868800) * n_duration, n_counter);
673      root->timer->adjust( attotime::from_hz(33868800) * n_duration, n_counter);
674674   }
675675}
676676
r10326r10327
827827      n_time = attotime::never;
828828      verboselog( p_psx, 2, "sio_timer_adjust( %d ) finished\n", n_port );
829829   }
830   timer_adjust_oneshot( sio->timer, n_time, n_port);
830   sio->timer->adjust( n_time, n_port);
831831}
832832
833833static TIMER_CALLBACK( sio_clock )
src/mame/machine/dec0.c
r10326r10327
388388      case 0x75b: i8751_return=0x70f; break;
389389   }
390390
391   if (!i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",cpuexec_describe_context(machine),data);
391   if (!i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",machine->describe_context(),data);
392392   cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE);
393393}
394394
r10326r10327
458458      /*These are activated after a shot (???)*/
459459      case 0x6ca: i8751_return = 0xff;      break;
460460      case 0x7ff: i8751_return = 0x200;     break;
461      default: logerror("%s: warning - write unknown command %02x to 8571\n",cpuexec_describe_context(machine),data);
461      default: logerror("%s: warning - write unknown command %02x to 8571\n",machine->describe_context(),data);
462462   }
463463   cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE);
464464}
r10326r10327
472472   if (GAME == 2) baddudes_i8751_write(machine, data);
473473   if (GAME == 3) birdtry_i8751_write(machine, data);
474474
475   //logerror("%s: warning - write %02x to i8751\n",cpuexec_describe_context(machine),data);
475   //logerror("%s: warning - write %02x to i8751\n",machine->describe_context(),data);
476476}
477477
478478void dec0_i8751_reset(void)
src/mame/machine/kaneko16.c
r10326r10327
21212121   if (mcu_command == 0) return;
21222122
21232123   logerror("%s : MCU executed command at %04X: %04X\n",
2124      cpuexec_describe_context(machine),calc3_mcu_command_offset,mcu_command);
2124      machine->describe_context(),calc3_mcu_command_offset,mcu_command);
21252125
21262126
21272127   if (mcu_command>0)
r10326r10327
24532453            mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128);
24542454            mame_fclose(f);
24552455         }
2456         logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2456         logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2);
24572457      }
24582458      break;
24592459
r10326r10327
24652465            mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128);
24662466            mame_fclose(f);
24672467         }
2468         logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2468         logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2);
24692469      }
24702470      break;
24712471
24722472      case 0x03:   // DSW
24732473      {
24742474         kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1");
2475         logerror("%s : MCU executed command: %04X %04X (read DSW)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2475         logerror("%s : MCU executed command: %04X %04X (read DSW)\n", machine->describe_context(), mcu_command, mcu_offset*2);
24762476      }
24772477      break;
24782478
24792479      case 0x04:   // Protection
24802480      {
2481         logerror("%s : MCU executed command: %04X %04X %04X\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data);
2481         logerror("%s : MCU executed command: %04X %04X %04X\n", machine->describe_context(), mcu_command, mcu_offset*2, mcu_data);
24822482
24832483         toxboy_handle_04_subcommand(machine, mcu_data, kaneko16_mcu_ram);
24842484
r10326r10327
24862486      break;
24872487
24882488      default:
2489         logerror("%s : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data);
2489         logerror("%s : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", machine->describe_context(), mcu_command, mcu_offset*2, mcu_data);
24902490      break;
24912491   }
24922492}
r10326r10327
25122512            mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128);
25132513            mame_fclose(f);
25142514         }
2515         logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2515         logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2);
25162516      }
25172517      break;
25182518
r10326r10327
25242524            mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128);
25252525            mame_fclose(f);
25262526         }
2527         logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2527         logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2);
25282528      }
25292529      break;
25302530
r10326r10327
25362536            mame_fwrite(f, bonkadv_mcu_43, sizeof(bonkadv_mcu_43));
25372537            mame_fclose(f);
25382538         }
2539         logerror("%s : MCU executed command: %04X %04X (restore default NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2539         logerror("%s : MCU executed command: %04X %04X (restore default NVRAM settings)\n", machine->describe_context(), mcu_command, mcu_offset*2);
25402540      }
25412541      break;
25422542
25432543      case 0x03:   // DSW
25442544      {
25452545         kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1");
2546         logerror("%s : MCU executed command: %04X %04X (read DSW)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
2546         logerror("%s : MCU executed command: %04X %04X (read DSW)\n", machine->describe_context(), mcu_command, mcu_offset*2);
25472547      }
25482548      break;
25492549
25502550      case 0x04:   // Protection
25512551      {
2552         logerror("%s : MCU executed command: %04X %04X %04X\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data);
2552         logerror("%s : MCU executed command: %04X %04X %04X\n", machine->describe_context(), mcu_command, mcu_offset*2, mcu_data);
25532553
25542554
25552555         switch(mcu_data)
r10326r10327
25712571      break;
25722572
25732573      default:
2574         logerror("%s : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data);
2574         logerror("%s : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", machine->describe_context(), mcu_command, mcu_offset*2, mcu_data);
25752575      break;
25762576   }
25772577}
r10326r10327
25942594   UINT16 mcu_offset   =   kaneko16_mcu_ram[0x0012/2] / 2;
25952595   UINT16 mcu_data      =   kaneko16_mcu_ram[0x0014/2];
25962596
2597   logerror("%s : MCU executed command: %04X %04X %04X\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data);
2597   logerror("%s : MCU executed command: %04X %04X %04X\n", machine->describe_context(), mcu_command, mcu_offset*2, mcu_data);
25982598
25992599   switch (mcu_command >> 8)
26002600   {
src/mame/machine/williams.c
r10326r10327
920920static WRITE8_DEVICE_HANDLER( tshoot_maxvol_w )
921921{
922922   /* something to do with the sound volume */
923   logerror("tshoot maxvol = %d (%s)\n", data, cpuexec_describe_context(device->machine));
923   logerror("tshoot maxvol = %d (%s)\n", data, device->machine->describe_context());
924924}
925925
926926
src/mame/machine/mcr68.c
r10326r10327
206206      m6840->control = 0x00;
207207      m6840->latch = 0xffff;
208208      m6840->count = 0xffff;
209      timer_enable(m6840->timer, FALSE);
209      m6840->timer->enable(false);
210210      m6840->timer_active = 0;
211211      m6840->period = m6840_counter_periods[i];
212212   }
r10326r10327
460460   /* counter 0 is self-updating if clocked externally */
461461   if (counter == 0 && !(m6840_state[counter].control & 0x02))
462462   {
463      timer_adjust_oneshot(m6840_state[counter].timer, attotime::never, 0);
463      m6840_state[counter].timer->adjust(attotime::never);
464464      m6840_state[counter].timer_active = 0;
465465      return;
466466   }
r10326r10327
481481   /* set the timer */
482482   total_period = period * count;
483483LOG(("reload_count(%d): period = %f  count = %d\n", counter, period.as_double(), count));
484   timer_adjust_oneshot(m6840_state[counter].timer, total_period, (count << 2) + counter);
484   m6840_state[counter].timer->adjust(total_period, (count << 2) + counter);
485485   m6840_state[counter].timer_active = 1;
486486}
487487
r10326r10327
502502      period = m6840_counter_periods[counter];
503503
504504   /* see how many are left */
505   remaining = timer_timeleft(m6840_state[counter].timer).as_attoseconds() / period.as_attoseconds();
505   remaining = m6840_state[counter].timer->remaining().as_attoseconds() / period.as_attoseconds();
506506
507507   /* adjust the count for dual byte mode */
508508   if (m6840_state[counter].control & 0x04)
r10326r10327
544544         {
545545            for (i = 0; i < 3; i++)
546546            {
547               timer_adjust_oneshot(m6840_state[i].timer, attotime::never, 0);
547               m6840_state[i].timer->adjust(attotime::never);
548548               m6840_state[i].timer_active = 0;
549549            }
550550         }
src/mame/machine/namco51.c
r10326r10327
9898
9999   data &= 0x07;
100100
101   LOG(("%s: custom 51XX write %02x\n",cpuexec_describe_context(device->machine),data));
101   LOG(("%s: custom 51XX write %02x\n",device->machine->describe_context(),data));
102102
103103   if (state->coincred_mode)
104104   {
r10326r10327
196196{
197197   namco_51xx_state *state = get_safe_token(device);
198198
199   LOG(("%s: custom 51XX read\n",cpuexec_describe_context(device->machine)));
199   LOG(("%s: custom 51XX read\n",device->machine->describe_context()));
200200
201201   if (state->mode == 0)   /* switch mode */
202202   {
src/mame/machine/starwars.c
r10326r10327
360360      M_STOP--; /* Decrease count */
361361   }
362362
363   timer_adjust_oneshot(state->math_timer, attotime::from_hz(MASTER_CLOCK) * mptime, 1);
363   state->math_timer->adjust(attotime::from_hz(MASTER_CLOCK) * mptime, 1);
364364}
365365
366366
src/mame/machine/slapstic.c
r10326r10327
11491149         fprintf(slapsticlog, "------------------------------------\n");
11501150      last_time = time;
11511151
1152      fprintf(slapsticlog, "%s: %04X B=%d ", cpuexec_describe_context(machine), offset, current_bank);
1152      fprintf(slapsticlog, "%s: %04X B=%d ", machine->describe_context(), offset, current_bank);
11531153      switch (state)
11541154      {
11551155         case DISABLED:
src/mame/machine/cdi070.c
r10326r10327
5353        case 0:
5454            compare = 0x10000 - scc68070->timers.timer0;
5555            period = attotime::from_hz(CLOCK_A/192) * compare;
56            timer_adjust_oneshot(scc68070->timers.timer0_timer, period, 0);
56            scc68070->timers.timer0_timer->adjust(period);
5757            break;
5858        default:
5959            fatalerror( "Unsupported timer channel to scc68070_set_timer_callback!" );
r10326r10327
9696   if((scc68070->uart.command_register & 3) == 1)
9797   {
9898      UINT32 div = 0x10000 >> ((scc68070->uart.clock_select >> 4) & 7);
99      timer_adjust_oneshot(scc68070->uart.rx_timer, attotime::from_hz((49152000 / div) / 8), 0);
99      scc68070->uart.rx_timer->adjust(attotime::from_hz((49152000 / div) / 8));
100100   }
101101   else
102102   {
103103      scc68070->uart.status_register &= ~USR_RXRDY;
104      timer_adjust_oneshot(scc68070->uart.rx_timer, attotime::never, 0);
104      scc68070->uart.rx_timer->adjust(attotime::never);
105105   }
106106}
107107
r10326r10327
118118         scc68070->uart.status_register |= USR_TXRDY;
119119      }
120120
121      if(timer_timeleft(scc68070->uart.tx_timer) == attotime::never)
121      if(scc68070->uart.tx_timer->remaining() == attotime::never)
122122      {
123123         UINT32 div = 0x10000 >> (scc68070->uart.clock_select & 7);
124         timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::from_hz((49152000 / div) / 8), 0);
124         scc68070->uart.tx_timer->adjust(attotime::from_hz((49152000 / div) / 8));
125125      }
126126   }
127127   else
128128   {
129      timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::never, 0);
129      scc68070->uart.tx_timer->adjust(attotime::never);
130130   }
131131}
132132
r10326r10327
176176
177177         scc68070->uart.status_register |= USR_RXRDY;
178178         UINT32 div = 0x10000 >> ((scc68070->uart.clock_select >> 4) & 7);
179         timer_adjust_oneshot(scc68070->uart.rx_timer, attotime::from_hz((49152000 / div) / 8), 0);
179         scc68070->uart.rx_timer->adjust(attotime::from_hz((49152000 / div) / 8));
180180      }
181181      else
182182      {
r10326r10327
389389         scc68070->uart.transmit_pointer--;
390390
391391         UINT32 div = 0x10000 >> (scc68070->uart.clock_select & 7);
392         timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::from_hz((49152000 / div) / 8), 0);
392         scc68070->uart.tx_timer->adjust(attotime::from_hz((49152000 / div) / 8));
393393      }
394394      else
395395      {
396         timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::never, 0);
396         scc68070->uart.tx_timer->adjust(attotime::never);
397397      }
398398   }
399399   else
400400   {
401      timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::never, 0);
401      scc68070->uart.tx_timer->adjust(attotime::never);
402402   }
403403
404404   scc68070_uart_tx_check(machine, scc68070);
r10326r10327
11441144    state_save_register_global(machine, scc68070->mmu.desc[7].base);
11451145
11461146   scc68070->timers.timer0_timer = machine->scheduler().timer_alloc(FUNC(scc68070_timer0_callback));
1147   timer_adjust_oneshot(scc68070->timers.timer0_timer, attotime::never, 0);
1147   scc68070->timers.timer0_timer->adjust(attotime::never);
11481148
11491149   scc68070->uart.rx_timer = machine->scheduler().timer_alloc(FUNC(scc68070_rx_callback));
1150   timer_adjust_oneshot(scc68070->uart.rx_timer, attotime::never, 0);
1150   scc68070->uart.rx_timer->adjust(attotime::never);
11511151
11521152   scc68070->uart.tx_timer = machine->scheduler().timer_alloc(FUNC(scc68070_tx_callback));
1153   timer_adjust_oneshot(scc68070->uart.tx_timer, attotime::never, 0);
1153   scc68070->uart.tx_timer->adjust(attotime::never);
11541154}
11551155
11561156#if ENABLE_UART_PRINTING
src/mame/machine/mw8080bw.c
r10326r10327
6868   }
6969
7070   next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_vblank);
71   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(next_vpos), 0);
71   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(next_vpos));
7272}
7373
7474
r10326r10327
8383{
8484   mw8080bw_state *state = machine->driver_data<mw8080bw_state>();
8585   int vpos = vysnc_chain_counter_to_vpos(MW8080BW_INT_TRIGGER_COUNT_1, MW8080BW_INT_TRIGGER_VBLANK_1);
86   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(vpos), 0);
86   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(vpos));
8787}
8888
8989
src/mame/video/mcd212.c
r10326r10327
15061506            }
15071507        }
15081508    }
1509    timer_adjust_oneshot(mcd212->scan_timer, machine->primary_screen->time_until_pos(( scanline + 1 ) % 302, 0), 0);
1509    mcd212->scan_timer->adjust(machine->primary_screen->time_until_pos(( scanline + 1 ) % 302, 0));
15101510}
15111511
15121512void mcd212_init(running_machine *machine, mcd212_regs_t *mcd212)
r10326r10327
16561656    mcd212_ab_init(&state->mcd212_ab);
16571657    mcd212_init(machine, &state->mcd212_regs);
16581658    state->mcd212_regs.scan_timer = machine->scheduler().timer_alloc(FUNC(mcd212_perform_scan));
1659    timer_adjust_oneshot(state->mcd212_regs.scan_timer, machine->primary_screen->time_until_pos(0, 0), 0);
1659    state->mcd212_regs.scan_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
16601660
16611661    state->lcdbitmap = downcast<screen_device *>(machine->device("lcd"))->alloc_compatible_bitmap();
16621662}
src/mame/video/mystston.c
r10326r10327
5757      scanline = FIRST_INT_VPOS;
5858
5959   /* the vertical synch chain is clocked by H256 -- this is probably not important, but oh well */
60   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(scanline - 1, INT_HPOS), scanline);
60   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline - 1, INT_HPOS), scanline);
6161}
6262
6363
r10326r10327
243243{
244244   mystston_state *state = machine->driver_data<mystston_state>();
245245
246   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS);
246   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS);
247247}
248248
249249
src/mame/video/ygv608.c
r10326r10327
14121412      UINT8 yTile = ygv608.regs.s.r0 & r0_pny;
14131413
14141414      if (yTile >= ygv608.page_y)
1415        logerror ("%s:setting pny(%d) >= page_y(%d)\n", cpuexec_describe_context(machine),
1415        logerror ("%s:setting pny(%d) >= page_y(%d)\n", machine->describe_context(),
14161416            yTile, ygv608.page_y );
14171417      yTile &= (ygv608.page_y - 1);
14181418      ygv608.regs.s.r0 &= ~r0_pny;
r10326r10327
14251425      UINT8 xTile = ygv608.regs.s.r1 & r1_pnx;
14261426
14271427      if (xTile >= ygv608.page_x)
1428        logerror ("%s:setting pnx(%d) >= page_x(%d)\n", cpuexec_describe_context(machine),
1428        logerror ("%s:setting pnx(%d) >= page_x(%d)\n", machine->describe_context(),
14291429            xTile, ygv608.page_x );
14301430      xTile &= (ygv608.page_x - 1);
14311431      ygv608.regs.s.r1 &= ~r1_pnx;
src/mame/video/artmagic.c
r10326r10327
118118   static FILE *f;
119119
120120   logerror("%s:Blit from %06X to (%d,%d) %dx%d -- %04X %04X %04X %04X %04X %04X %04X %04X\n",
121            cpuexec_describe_context(machine), offset, x, y, w, h,
121            machine->describe_context(), offset, x, y, w, h,
122122            blitter_data[0], blitter_data[1],
123123            blitter_data[2], blitter_data[3],
124124            blitter_data[4], blitter_data[5],
r10326r10327
136136
137137      fprintf(f, "----------------------\n"
138138               "%s:Blit from %06X to (%d,%d) %dx%d -- %04X %04X %04X %04X %04X %04X %04X %04X\n",
139               cpuexec_describe_context(machine), offset, x, y, w, h,
139               machine->describe_context(), offset, x, y, w, h,
140140               blitter_data[0], blitter_data[1],
141141               blitter_data[2], blitter_data[3],
142142               blitter_data[4], blitter_data[5],
src/mame/video/itech32.c
r10326r10327
479479static TIMER_CALLBACK( scanline_interrupt )
480480{
481481   /* set timer for next frame */
482   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(VIDEO_INTSCANLINE), 0);
482   scanline_timer->adjust(machine->primary_screen->time_until_pos(VIDEO_INTSCANLINE));
483483
484484   /* set the interrupt bit in the status reg */
485485   logerror("-------------- (DISPLAY INT @ %d) ----------------\n", machine->primary_screen->vpos());
r10326r10327
13471347         break;
13481348
13491349      case 0x2c/2:   /* VIDEO_INTSCANLINE */
1350         timer_adjust_oneshot(scanline_timer, space->machine->primary_screen->time_until_pos(VIDEO_INTSCANLINE), 0);
1350         scanline_timer->adjust(space->machine->primary_screen->time_until_pos(VIDEO_INTSCANLINE));
13511351         break;
13521352
13531353      case 0x32/2:   /* VIDEO_VTOTAL */
src/mame/video/dkong.c
r10326r10327
885885
886886   scanline = (scanline+1) % VTOTAL;
887887   /* come back at the next appropriate scanline */
888   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
888   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
889889}
890890
891891static void check_palette(running_machine *machine)
r10326r10327
945945   VIDEO_START_CALL(dkong_base);
946946
947947   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
948   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
948   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
949949
950950   switch (state->hardware_type)
951951   {
src/mame/video/psx.c
r10326r10327
270270      va_start( v, s_fmt );
271271      vsprintf( buf, s_fmt, v );
272272      va_end( v );
273      logerror( "%s: %s", cpuexec_describe_context(p_psxgpu->machine), buf );
273      logerror( "%s: %s", p_psxgpu->machine->describe_context(), buf );
274274   }
275275}
276276
src/mame/video/atarimo.c
r10326r10327
323323   scanline += 64;
324324   if (scanline >= machine->primary_screen->visible_area().max_y)
325325      scanline = 0;
326   timer_adjust_oneshot(force_update_timer, machine->primary_screen->time_until_pos(scanline), scanline);
326   force_update_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
327327}
328328
329329/*---------------------------------------------------------------
r10326r10327
441441
442442   /* start a timer to update a few times during refresh */
443443   force_update_timer = machine->scheduler().timer_alloc(FUNC(force_update));
444   timer_adjust_oneshot(force_update_timer,machine->primary_screen->time_until_pos(0), 0);
444   force_update_timer->adjust(machine->primary_screen->time_until_pos(0));
445445
446446   init_savestate(machine, map, mo);
447447
src/mame/video/jagblit.c
r10326r10327
195195   {
196196      if (LOG_BAD_BLITS)
197197      {
198      logerror("%s:Blit!\n", cpuexec_describe_context(machine));
198      logerror("%s:Blit!\n", machine->describe_context());
199199      logerror("  a1_base  = %08X\n", a1_base);
200200      logerror("  a2_base  = %08X\n", a2_base);
201201      }
r10326r10327
275275
276276   if (LOG_BLITS)
277277   {
278   logerror("%s:Blit!\n", cpuexec_describe_context(machine));
278   logerror("%s:Blit!\n", machine->describe_context());
279279   logerror("  a1_base  = %08X\n", a1_base);
280280   logerror("  a1_pitch = %d\n", a1_pitch);
281281   logerror("  a1_psize = %d\n", 1 << ((A1FIXED >> 3) & 7));
src/mame/video/leland.c
r10326r10327
6767   scanline = (scanline+1) % 256;
6868
6969   /* come back at the next appropriate scanline */
70   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
70   scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
7171}
7272
7373
r10326r10327
8484
8585   /* scanline timer */
8686   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
87   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(0), 0);
87   scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
8888
8989}
9090
r10326r10327
197197
198198      default:
199199         logerror("%s: Warning: Unknown video port %02x read (address=%04x)\n",
200                  cpuexec_describe_context(space->machine), offset, addr);
200                  space->machine->describe_context(), offset, addr);
201201         ret = 0;
202202         break;
203203   }
204204   state->addr = addr;
205205
206206   if (LOG_COMM && addr >= 0xf000)
207      logerror("%s:%s comm read %04X = %02X\n", cpuexec_describe_context(space->machine), num ? "slave" : "master", addr, ret);
207      logerror("%s:%s comm read %04X = %02X\n", space->machine->describe_context(), num ? "slave" : "master", addr, ret);
208208
209209   return ret;
210210}
r10326r10327
231231      space->machine->primary_screen->update_partial(scanline - 1);
232232
233233   if (LOG_COMM && addr >= 0xf000)
234      logerror("%s:%s comm write %04X = %02X\n", cpuexec_describe_context(space->machine), num ? "slave" : "master", addr, data);
234      logerror("%s:%s comm write %04X = %02X\n", space->machine->describe_context(), num ? "slave" : "master", addr, data);
235235
236236   /* based on the low 3 bits of the offset, update the destination */
237237   switch (offset & 7)
r10326r10327
283283
284284      default:
285285         logerror("%s:Warning: Unknown video port write (address=%04x value=%02x)\n",
286                  cpuexec_describe_context(space->machine), offset, addr);
286                  space->machine->describe_context(), offset, addr);
287287         break;
288288   }
289289
src/mame/video/dc.c
r10326r10327
10921092            // this should really be done for each tile!
10931093            render_to_accumulation_buffer(space->machine,fake_accumulationbuffer_bitmap,&clip);
10941094
1095            timer_adjust_oneshot(endofrender_timer_isp, attotime::from_usec(4000) , 0); // hack, make sure render takes some amount of time
1095            endofrender_timer_isp->adjust(attotime::from_usec(4000) ); // hack, make sure render takes some amount of time
10961096
10971097            /* copy the tiles to the framebuffer (really the rendering should be in this loop too) */
10981098            if (pvrta_regs[FPU_PARAM_CFG] & 0x200000)
r10326r10327
12411241
12421242   case SPG_VBLANK_INT:
12431243      /* clear pending irqs and modify them with the updated ones */
1244      timer_adjust_oneshot(vbin_timer, attotime::never, 0);
1245      timer_adjust_oneshot(vbout_timer, attotime::never, 0);
1244      vbin_timer->adjust(attotime::never);
1245      vbout_timer->adjust(attotime::never);
12461246
1247      timer_adjust_oneshot(vbin_timer, space->machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num), 0);
1248      timer_adjust_oneshot(vbout_timer, space->machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num), 0);
1247      vbin_timer->adjust(space->machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num));
1248      vbout_timer->adjust(space->machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num));
12491249      break;
12501250   /* TODO: timer adjust for SPG_HBLANK_INT too */
12511251   case TA_LIST_CONT:
r10326r10327
24512451   dc_sysctrl_regs[SB_ISTNRM] |= IST_VBL_IN; // V Blank-in interrupt
24522452   dc_update_interrupt_status(machine);
24532453
2454   timer_adjust_oneshot(vbin_timer, machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num), 0);
2454   vbin_timer->adjust(machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num));
24552455}
24562456
24572457static TIMER_CALLBACK(vbout)
r10326r10327
24592459   dc_sysctrl_regs[SB_ISTNRM] |= IST_VBL_OUT; // V Blank-out interrupt
24602460   dc_update_interrupt_status(machine);
24612461
2462   timer_adjust_oneshot(vbout_timer, machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num), 0);
2462   vbout_timer->adjust(machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num));
24632463}
24642464
24652465static TIMER_CALLBACK(hbin)
r10326r10327
24892489      next_y = spg_line_comp_val;
24902490   }
24912491
2492   timer_adjust_oneshot(hbin_timer, machine->primary_screen->time_until_pos(scanline, spg_hblank_in_irq-1), 0);
2492   hbin_timer->adjust(machine->primary_screen->time_until_pos(scanline, spg_hblank_in_irq-1));
24932493}
24942494
24952495
r10326r10327
24982498{
24992499   dc_sysctrl_regs[SB_ISTNRM] |= IST_EOR_VIDEO;// VIDEO end of render
25002500   dc_update_interrupt_status(machine);
2501   timer_adjust_oneshot(endofrender_timer_video, attotime::never, 0);
2501   endofrender_timer_video->adjust(attotime::never);
25022502}
25032503
25042504static TIMER_CALLBACK(endofrender_tsp)
r10326r10327
25062506   dc_sysctrl_regs[SB_ISTNRM] |= IST_EOR_TSP;   // TSP end of render
25072507   dc_update_interrupt_status(machine);
25082508
2509   timer_adjust_oneshot(endofrender_timer_tsp, attotime::never, 0);
2510   timer_adjust_oneshot(endofrender_timer_video, attotime::from_usec(500) , 0);
2509   endofrender_timer_tsp->adjust(attotime::never);
2510   endofrender_timer_video->adjust(attotime::from_usec(500) );
25112511}
25122512
25132513static TIMER_CALLBACK(endofrender_isp)
r10326r10327
25152515   dc_sysctrl_regs[SB_ISTNRM] |= IST_EOR_ISP;   // ISP end of render
25162516   dc_update_interrupt_status(machine);
25172517
2518   timer_adjust_oneshot(endofrender_timer_isp, attotime::never, 0);
2519   timer_adjust_oneshot(endofrender_timer_tsp, attotime::from_usec(500) , 0);
2518   endofrender_timer_isp->adjust(attotime::never);
2519   endofrender_timer_tsp->adjust(attotime::from_usec(500) );
25202520}
25212521
25222522
r10326r10327
25522552   computedilated();
25532553
25542554   vbout_timer = machine->scheduler().timer_alloc(FUNC(vbout));
2555   timer_adjust_oneshot(vbout_timer, machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num), 0);
2555   vbout_timer->adjust(machine->primary_screen->time_until_pos(spg_vblank_out_irq_line_num));
25562556
25572557   vbin_timer = machine->scheduler().timer_alloc(FUNC(vbin));
2558   timer_adjust_oneshot(vbin_timer, machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num), 0);
2558   vbin_timer->adjust(machine->primary_screen->time_until_pos(spg_vblank_in_irq_line_num));
25592559
25602560   hbin_timer = machine->scheduler().timer_alloc(FUNC(hbin));
2561   timer_adjust_oneshot(hbin_timer, machine->primary_screen->time_until_pos(0, spg_hblank_in_irq-1), 0);
2561   hbin_timer->adjust(machine->primary_screen->time_until_pos(0, spg_hblank_in_irq-1));
25622562
25632563   scanline = 0;
25642564   next_y = 0;
r10326r10327
25672567   endofrender_timer_tsp = machine->scheduler().timer_alloc(FUNC(endofrender_tsp));
25682568   endofrender_timer_video = machine->scheduler().timer_alloc(FUNC(endofrender_video));
25692569
2570   timer_adjust_oneshot(endofrender_timer_isp, attotime::never, 0);
2571   timer_adjust_oneshot(endofrender_timer_tsp, attotime::never, 0);
2572   timer_adjust_oneshot(endofrender_timer_video, attotime::never, 0);
2570   endofrender_timer_isp->adjust(attotime::never);
2571   endofrender_timer_tsp->adjust(attotime::never);
2572   endofrender_timer_video->adjust(attotime::never);
25732573
25742574   fake_accumulationbuffer_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_RGB32);
25752575
src/mame/video/midzeus2.c
r10326r10327
541541            zeus_fifo_words = 0;
542542
543543         /* set the interrupt signal to indicate we can handle more */
544         timer_adjust_oneshot(int_timer, attotime::from_nsec(500), 0);
544         int_timer->adjust(attotime::from_nsec(500));
545545         break;
546546
547547      case 0x20:
src/mame/video/gameplan.c
r10326r10327
272272   state->via_0->write_ca1(param);
273273
274274   if (param)
275      timer_adjust_oneshot(state->via_0_ca1_timer, machine->primary_screen->time_until_pos(VBSTART), 0);
275      state->via_0_ca1_timer->adjust(machine->primary_screen->time_until_pos(VBSTART));
276276   else
277      timer_adjust_oneshot(state->via_0_ca1_timer, machine->primary_screen->time_until_pos(VBEND), 1);
277      state->via_0_ca1_timer->adjust(machine->primary_screen->time_until_pos(VBEND), 1);
278278}
279279
280280
r10326r10327
326326static VIDEO_RESET( gameplan )
327327{
328328   gameplan_state *state = machine->driver_data<gameplan_state>();
329   timer_adjust_oneshot(state->via_0_ca1_timer, machine->primary_screen->time_until_pos(VBSTART), 0);
329   state->via_0_ca1_timer->adjust(machine->primary_screen->time_until_pos(VBSTART));
330330}
331331
332332
src/mame/video/btoads.c
r10326r10327
307307   }
308308
309309   else
310      logerror("%s:btoads_to_shiftreg(%08X)\n", cpuexec_describe_context(space->machine), address);
310      logerror("%s:btoads_to_shiftreg(%08X)\n", space->machine->describe_context(), address);
311311}
312312
313313
r10326r10327
332332      render_sprite_row(shiftreg, address);
333333
334334   else
335      logerror("%s:btoads_from_shiftreg(%08X)\n", cpuexec_describe_context(space->machine), address);
335      logerror("%s:btoads_from_shiftreg(%08X)\n", space->machine->describe_context(), address);
336336}
337337
338338
src/mame/video/starfire.c
r10326r10327
2121
2222   state->starfire_screen = machine->primary_screen->alloc_compatible_bitmap();
2323   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(starfire_scanline_callback));
24   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(STARFIRE_VBEND), STARFIRE_VBEND);
24   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(STARFIRE_VBEND), STARFIRE_VBEND);
2525
2626    /* register for state saving */
2727   state_save_register_global(machine, state->starfire_vidctrl);
r10326r10327
265265
266266   y++;
267267   if (y >= STARFIRE_VBSTART) y = STARFIRE_VBEND;
268   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(y), y);
268   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(y), y);
269269}
270270
271271VIDEO_UPDATE( starfire )
src/mame/video/galaxold.c
r10326r10327
17401740
17411741   int period_in_ms = 693 * (ra + 2.0 * rb) * c;
17421742
1743   timer_adjust_periodic(stars_blink_timer, attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms));
1743   stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms));
17441744}
17451745
17461746
r10326r10327
17541754
17551755static void start_stars_scroll_timer(running_machine *machine)
17561756{
1757   timer_adjust_periodic(stars_scroll_timer, machine->primary_screen->frame_period(), 0, machine->primary_screen->frame_period());
1757   stars_scroll_timer->adjust(machine->primary_screen->frame_period(), 0, machine->primary_screen->frame_period());
17581758}
17591759
17601760
src/mame/video/midvunit.c
r10326r10327
6060   if (scanline != -1)
6161   {
6262      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
63      timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(scanline + 1), scanline);
63      scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline + 1), scanline);
6464      machine->scheduler().timer_set(attotime::from_hz(25000000), FUNC(scanline_timer_cb), -1);
6565   }
6666   else
r10326r10327
448448
449449   /* update the scanline timer */
450450   if (offset == 0)
451      timer_adjust_oneshot(scanline_timer, space->machine->primary_screen->time_until_pos((data & 0x1ff) + 1, 0), data & 0x1ff);
451      scanline_timer->adjust(space->machine->primary_screen->time_until_pos((data & 0x1ff) + 1), data & 0x1ff);
452452
453453   /* if something changed, update our parameters */
454454   if (old != video_regs[offset] && video_regs[6] != 0 && video_regs[11] != 0)
src/mame/video/atarisy2.c
r10326r10327
175175   if (!(newscroll & 0x10))
176176      tilemap_set_scrolly(state->playfield_tilemap, 0, (newscroll >> 6) - space->machine->primary_screen->vpos());
177177   else
178      timer_adjust_oneshot(state->yscroll_reset_timer, space->machine->primary_screen->time_until_pos(0), newscroll >> 6);
178      state->yscroll_reset_timer->adjust(space->machine->primary_screen->time_until_pos(0), newscroll >> 6);
179179
180180   /* update the playfield banking */
181181   if (state->playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400)
src/mame/video/jaguar.c
r10326r10327
295295      return FALSE;
296296
297297   /* adjust the timer */
298   timer_adjust_oneshot(object_timer, machine->primary_screen->time_until_pos(vc / 2, hdb), vc | (hdb << 16));
298   object_timer->adjust(machine->primary_screen->time_until_pos(vc / 2, hdb), vc | (hdb << 16));
299299   return TRUE;
300300}
301301
src/mame/video/n8080.c
r10326r10327
5151   n8080_state *state = machine->driver_data<n8080_state>();
5252
5353   state->spacefev_red_cannon = 1;
54   timer_adjust_oneshot(state->cannon_timer, attotime::from_usec(550 * 68 * 10), 0);
54   state->cannon_timer->adjust(attotime::from_usec(550 * 68 * 10));
5555}
5656
5757
r10326r10327
6060   n8080_state *state = machine->driver_data<n8080_state>();
6161
6262   state->spacefev_red_cannon = 0;
63   timer_adjust_oneshot(state->cannon_timer, attotime::never, 0);
63   state->cannon_timer->adjust(attotime::never);
6464}
6565
6666
src/mame/video/astrocde.c
r10326r10327
223223{
224224   /* allocate a per-scanline timer */
225225   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
226   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(1), 1);
226   scanline_timer->adjust(machine->primary_screen->time_until_pos(1), 1);
227227
228228   /* register for save states */
229229   init_savestate(machine);
r10326r10327
238238{
239239   /* allocate a per-scanline timer */
240240   scanline_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
241   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(1), 1);
241   scanline_timer->adjust(machine->primary_screen->time_until_pos(1), 1);
242242
243243   /* allocate videoram */
244244   profpac_videoram = auto_alloc_array(machine, UINT16, 0x4000 * 4);
r10326r10327
502502   scanline++;
503503   if (scanline >= machine->primary_screen->height())
504504      scanline = 0;
505   timer_adjust_oneshot(scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
505   scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
506506}
507507
508508
src/mame/video/victory.c
r10326r10327
192192         // D5 = 5VIRQ
193193         // D4 = 5BCIRQ (3B1)
194194         // D3 = SL256
195         if (micro.timer_active && timer_timeelapsed(micro.timer) < micro.endtime)
195         if (micro.timer_active && micro.timer->elapsed() < micro.endtime)
196196            result |= 0x80;
197197         result |= (~fgcoll & 1) << 6;
198198         result |= (~vblank_irq & 1) << 5;
r10326r10327
530530
531531   if (!micro.timer)
532532   {
533      timer_adjust_oneshot(micro.timer, attotime::never, 0);
533      micro.timer->adjust(attotime::never);
534534      micro.timer_active = 1;
535535      micro.endtime = state_time;
536536   }
537   else if (timer_timeelapsed(micro.timer) > micro.endtime)
537   else if (micro.timer->elapsed() > micro.endtime)
538538   {
539      timer_adjust_oneshot(micro.timer, attotime::never, 0);
539      micro.timer->adjust(attotime::never);
540540      micro.timer_active = 1;
541541      micro.endtime = state_time;
542542   }
src/mame/video/avgdvg.c
r10326r10327
12231223
12241224      /* If halt flag was set, let CPU catch up before we make halt visible */
12251225      if (vg->halt && !(vg->state_latch & 0x10))
1226         timer_adjust_oneshot(vg_halt_timer, attotime::from_hz(MASTER_CLOCK) * cycles, 1);
1226         vg_halt_timer->adjust(attotime::from_hz(MASTER_CLOCK) * cycles, 1);
12271227
12281228      vg->state_latch = (vg->halt << 4) | (vg->state_latch & 0xf);
12291229      cycles += 8;
12301230   }
12311231
1232   timer_adjust_oneshot(vg_run_timer, attotime::from_hz(MASTER_CLOCK) * cycles, 0);
1232   vg_run_timer->adjust(attotime::from_hz(MASTER_CLOCK) * cycles);
12331233}
12341234
12351235
r10326r10327
12601260   vg_flush(space->machine);
12611261
12621262   vg_set_halt(0);
1263   timer_adjust_oneshot(vg_run_timer, attotime::zero, 0);
1263   vg_run_timer->adjust(attotime::zero);
12641264}
12651265
12661266WRITE16_HANDLER( avgdvg_go_word_w )
src/mame/video/esripsys.c
r10326r10327
7373      v = 0;
7474
7575   /* Set end of HBLANK timer */
76   timer_adjust_oneshot(hblank_end_timer, machine->primary_screen->time_until_pos(v, ESRIPSYS_HBLANK_END), v);
76   hblank_end_timer->adjust(machine->primary_screen->time_until_pos(v, ESRIPSYS_HBLANK_END), v);
7777   esripsys_hblank = 0;
7878}
7979
r10326r10327
8585      machine->primary_screen->update_partial(v - 1);
8686
8787   esripsys__12sel ^= 1;
88   timer_adjust_oneshot(hblank_start_timer, machine->primary_screen->time_until_pos(v, ESRIPSYS_HBLANK_START), 0);
88   hblank_start_timer->adjust(machine->primary_screen->time_until_pos(v, ESRIPSYS_HBLANK_START));
8989
9090   esripsys_hblank = 1;
9191}
r10326r10327
106106   /* Create and initialise the HBLANK timers */
107107   hblank_start_timer = machine->scheduler().timer_alloc(FUNC(hblank_start_callback));
108108   hblank_end_timer = machine->scheduler().timer_alloc(FUNC(hblank_end_callback));
109   timer_adjust_oneshot(hblank_start_timer, machine->primary_screen->time_until_pos(0, ESRIPSYS_HBLANK_START), 0);
109   hblank_start_timer->adjust(machine->primary_screen->time_until_pos(0, ESRIPSYS_HBLANK_START));
110110
111111   /* Create the sprite scaling table */
112112   scale_table = auto_alloc_array(machine, UINT8, 64 * 64);
src/mame/video/tx1.c
r10326r10327
3535static TIMER_CALLBACK( interrupt_callback )
3636{
3737   cputag_set_input_line_and_vector(machine, "main_cpu", 0, HOLD_LINE, 0xff);
38   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
38   interrupt_timer->adjust(machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
3939}
4040
4141
r10326r10327
11311131   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
11321132
11331133   /* /CUDISP CRTC interrupt */
1134   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
1134   interrupt_timer->adjust(machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
11351135}
11361136
11371137VIDEO_EOF( tx1 )
r10326r10327
30503050   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
30513051
30523052   /* /CUDISP CRTC interrupt */
3053   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
3053   interrupt_timer->adjust(machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
30543054}
30553055
30563056VIDEO_START( buggybjr )
r10326r10327
30643064   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
30653065
30663066   /* /CUDISP CRTC interrupt */
3067   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
3067   interrupt_timer->adjust(machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
30683068}
30693069
30703070VIDEO_EOF( buggyboy )
src/mame/video/konamiic.c
r10326r10327
25722572   addr = (code << 7) | (off1 << 2) | byte;
25732573   addr &= machine->region(K051960_memory_region)->bytes()-1;
25742574
2575//  popmessage("%s: addr %06x",cpuexec_describe_context(machine),addr);
2575//  popmessage("%s: addr %06x",machine->describe_context(),addr);
25762576
25772577   return machine->region(K051960_memory_region)->base()[addr];
25782578}
r10326r10327
31243124         | ((offset & 3) ^ 1);
31253125      addr &= machine->region(K053245_memory_region[chip])->bytes()-1;
31263126
3127//  popmessage("%s: offset %02x addr %06x",cpuexec_describe_context(machine),offset&3,addr);
3127//  popmessage("%s: offset %02x addr %06x",machine->describe_context(),offset&3,addr);
31283128
31293129      return machine->region(K053245_memory_region[chip])->base()[addr];
31303130   }
r10326r10327
31353135   }
31363136   else
31373137   {
3138//logerror("%s: read from unknown 053244 address %x\n",cpuexec_describe_context(machine),offset);
3138//logerror("%s: read from unknown 053244 address %x\n",machine->describe_context(),offset);
31393139      return 0;
31403140   }
31413141
r10326r10327
31573157//          popmessage("053244 reg 05 = %02x",data);
31583158      /* bit 2 = unknown, Parodius uses it */
31593159      /* bit 5 = unknown, Rollergames uses it */
3160//      logerror("%s: write %02x to 053244 address 5\n",cpuexec_describe_context(machine),data);
3160//      logerror("%s: write %02x to 053244 address 5\n",machine->describe_context(),data);
31613161      break;
31623162   }
31633163   case 0x06:
r10326r10327
48154815      if (K051316_bpp[chip] <= 4) addr /= 2;
48164816      addr &= machine->region(K051316_memory_region[chip])->bytes()-1;
48174817
4818//  popmessage("%s: offset %04x addr %04x",cpuexec_describe_context(machine),offset,addr);
4818//  popmessage("%s: offset %04x addr %04x",machine->describe_context(),offset,addr);
48194819
48204820      return machine->region(K051316_memory_region[chip])->base()[addr];
48214821   }
48224822   else
48234823   {
4824//logerror("%s: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n",cpuexec_describe_context(machine),offset);
4824//logerror("%s: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n",machine->describe_context(),offset);
48254825      return 0;
48264826   }
48274827}
r10326r10327
48464846static void K051316_ctrl_w(int chip,int offset,int data)
48474847{
48484848   K051316_ctrlram[chip][offset] = data;
4849//if (offset >= 0x0c) logerror("%s: write %02x to 051316 reg %x\n",cpuexec_describe_context(machine),data,offset);
4849//if (offset >= 0x0c) logerror("%s: write %02x to 051316 reg %x\n",machine->describe_context(),data,offset);
48504850}
48514851
48524852WRITE8_HANDLER( K051316_ctrl_0_w )
src/mame/video/phoenix.c
r10326r10327
333333      /* Bit 3 is 1 */
334334      return 1;
335335   default:
336      logerror("%s:Unknown protection question %02X\n", cpuexec_describe_context(field->port->machine), pleiads_protection_question);
336      logerror("%s:Unknown protection question %02X\n", field->port->machine->describe_context(), pleiads_protection_question);
337337      return 0;
338338   }
339339}
src/mame/video/lockon.c
r10326r10327
6969   if (state->main_inten)
7070      cpu_set_input_line_and_vector(state->maincpu, 0, HOLD_LINE, 0xff);
7171
72   timer_adjust_oneshot(state->cursor_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
72   state->cursor_timer->adjust(machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
7373}
7474
7575/*************************************
r10326r10327
388388      /* End of list marker */
389389      if (state->ground_ram[offs + 2] & 0x8000)
390390      {
391         timer_adjust_oneshot(state->bufend_timer, attotime::from_hz(FRAMEBUFFER_CLOCK) * (FRAMEBUFFER_MAX_X * y), 0);
391         state->bufend_timer->adjust(attotime::from_hz(FRAMEBUFFER_CLOCK) * (FRAMEBUFFER_MAX_X * y));
392392      }
393393   }
394394}
r10326r10327
922922
923923   /* Timer for the CRTC cursor pulse */
924924   state->cursor_timer = machine->scheduler().timer_alloc(FUNC(cursor_callback));
925   timer_adjust_oneshot(state->cursor_timer, machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS), 0);
925   state->cursor_timer->adjust(machine->primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
926926
927927   state_save_register_global_bitmap(machine, state->back_buffer);
928928   state_save_register_global_bitmap(machine, state->front_buffer);
src/mame/video/atari.c
r10326r10327
11341134    {
11351135      LOG(("           @cycle #%3d release WSYNC\n", cycle(machine)));
11361136        /* release the CPU if it was actually waiting for HSYNC */
1137        cpuexec_trigger(machine, TRIGGER_HSYNC);
1137        machine->scheduler().trigger(TRIGGER_HSYNC);
11381138        /* and turn off the 'wait for hsync' flag */
11391139        antic.w.wsync = 0;
11401140    }
11411141   LOG(("           @cycle #%3d release CPU\n", cycle(machine)));
11421142    /* release the CPU (held for emulating cycles stolen by ANTIC DMA) */
1143   cpuexec_trigger(machine, TRIGGER_STEAL);
1143   machine->scheduler().trigger(TRIGGER_STEAL);
11441144
11451145   /* refresh the display (translate color clocks to pixels) */
11461146    antic_linerefresh(machine);
src/mame/video/fromance.c
r10326r10327
266266   fromance_state *state = machine->driver_data<fromance_state>();
267267   cpu_set_input_line(state->subcpu, 0, HOLD_LINE);
268268   if (param != 0)
269      timer_adjust_periodic(state->crtc_timer, machine->primary_screen->frame_period() / param, 0, machine->primary_screen->frame_period() / param);
269      state->crtc_timer->adjust(machine->primary_screen->frame_period() / param, 0, machine->primary_screen->frame_period() / param);
270270}
271271
272272
r10326r10327
279279   {
280280      /* only register we know about.... */
281281      case 0x0b:
282         timer_adjust_oneshot(state->crtc_timer, space->machine->primary_screen->time_until_vblank_start(), (data > 0x80) ? 2 : 1);
282         state->crtc_timer->adjust(space->machine->primary_screen->time_until_vblank_start(), (data > 0x80) ? 2 : 1);
283283         break;
284284
285285      default:
src/mame/video/konicdev.c
r10326r10327
28372837   addr = (code << 7) | (off1 << 2) | byte;
28382838   addr &= device->machine->region(k051960->memory_region)->bytes() - 1;
28392839
2840//  popmessage("%s: addr %06x", cpuexec_describe_context(device->machine), addr);
2840//  popmessage("%s: addr %06x", device->machine->describe_context(), addr);
28412841
28422842   return device->machine->region(k051960->memory_region)->base()[addr];
28432843}
r10326r10327
34323432         | ((offset & 3) ^ 1);
34333433      addr &= machine->region(k053244->memory_region)->bytes() - 1;
34343434
3435      //  popmessage("%s: offset %02x addr %06x", cpuexec_describe_context(machine), offset & 3, addr);
3435      //  popmessage("%s: offset %02x addr %06x", machine->describe_context(), offset & 3, addr);
34363436
34373437      return machine->region(k053244->memory_region)->base()[addr];
34383438   }
r10326r10327
34433443   }
34443444   else
34453445   {
3446      //logerror("%s: read from unknown 053244 address %x\n", cpuexec_describe_context(machine), offset);
3446      //logerror("%s: read from unknown 053244 address %x\n", machine->describe_context(), offset);
34473447      return 0;
34483448   }
34493449}
r10326r10327
34613461//          popmessage("053244 reg 05 = %02x",data);
34623462      /* bit 2 = unknown, Parodius uses it */
34633463      /* bit 5 = unknown, Rollergames uses it */
3464//      logerror("%s: write %02x to 053244 address 5\n", cpuexec_describe_context(device->machine), data);
3464//      logerror("%s: write %02x to 053244 address 5\n", device->machine->describe_context(), data);
34653465      break;
34663466
34673467   case 0x06:
r10326r10327
51705170         addr /= 2;
51715171      addr &= device->machine->region(k051316->memory_region)->bytes() - 1;
51725172
5173      //  popmessage("%s: offset %04x addr %04x", cpuexec_describe_context(device->machine), offset, addr);
5173      //  popmessage("%s: offset %04x addr %04x", device->machine->describe_context(), offset, addr);
51745174
51755175      return device->machine->region(k051316->memory_region)->base()[addr];
51765176   }
51775177   else
51785178   {
5179      //logerror("%s: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n", cpuexec_describe_context(device->machine), offset);
5179      //logerror("%s: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n", device->machine->describe_context(), offset);
51805180      return 0;
51815181   }
51825182}
r10326r10327
51855185{
51865186   k051316_state *k051316= k051316_get_safe_token(device);
51875187   k051316->ctrlram[offset] = data;
5188   //if (offset >= 0x0c) logerror("%s: write %02x to 051316 reg %x\n", cpuexec_describe_context(device->machine), data, offset);
5188   //if (offset >= 0x0c) logerror("%s: write %02x to 051316 reg %x\n", device->machine->describe_context(), data, offset);
51895189}
51905190
51915191// a few games (ajax, rollerg, ultraman, etc.) can enable and disable wraparound after start
src/mame/video/neogeo.c
r10326r10327
236236   else
237237      state->auto_animation_frame_counter = state->auto_animation_frame_counter - 1;
238238
239   timer_adjust_oneshot(state->auto_animation_timer, machine->primary_screen->time_until_pos(NEOGEO_VSSTART), 0);
239   state->auto_animation_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VSSTART));
240240}
241241
242242
r10326r10327
250250static void start_auto_animation_timer( running_machine *machine )
251251{
252252   neogeo_state *state = machine->driver_data<neogeo_state>();
253   timer_adjust_oneshot(state->auto_animation_timer, machine->primary_screen->time_until_pos(NEOGEO_VSSTART), 0);
253   state->auto_animation_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VSSTART));
254254}
255255
256256
r10326r10327
657657   /* let's come back at the beginning of the next line */
658658   scanline = (scanline + 1) % NEOGEO_VTOTAL;
659659
660   timer_adjust_oneshot(state->sprite_line_timer, machine->primary_screen->time_until_pos(scanline), scanline);
660   state->sprite_line_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
661661}
662662
663663
r10326r10327
671671static void start_sprite_line_timer( running_machine *machine )
672672{
673673   neogeo_state *state = machine->driver_data<neogeo_state>();
674   timer_adjust_oneshot(state->sprite_line_timer, machine->primary_screen->time_until_pos(0), 0);
674   state->sprite_line_timer->adjust(machine->primary_screen->time_until_pos(0));
675675}
676676
677677
r10326r10327
775775
776776   ret = (v_counter << 7) | (neogeo_get_auto_animation_counter(machine) & 0x0007);
777777
778   if (VERBOSE) logerror("%s: video_control read (%04x)\n", cpuexec_describe_context(machine), ret);
778   if (VERBOSE) logerror("%s: video_control read (%04x)\n", machine->describe_context(), ret);
779779
780780   return ret;
781781}
r10326r10327
784784static void set_video_control( running_machine *machine, UINT16 data )
785785{
786786   /* this does much more than this, but I'm not sure exactly what */
787   if (VERBOSE) logerror("%s: video control write %04x\n", cpuexec_describe_context(machine), data);
787   if (VERBOSE) logerror("%s: video control write %04x\n", machine->describe_context(), data);
788788
789789   set_auto_animation_speed(machine, data >> 8);
790790   set_auto_animation_disabled(machine, data & 0x0008);
src/mame/video/ppu2c0x.c
r10326r10327
341341   if (ppu2c0x->hblank_callback_proc)
342342      (*ppu2c0x->hblank_callback_proc) (device, ppu2c0x->scanline, vblank, blanked);
343343
344   timer_adjust_oneshot(ppu2c0x->hblank_timer, attotime::never, 0);
344   ppu2c0x->hblank_timer->adjust(attotime::never);
345345}
346346
347347static TIMER_CALLBACK( nmi_callback )
r10326r10327
354354   if (ppu2c0x->nmi_callback_proc != NULL)
355355      (*ppu2c0x->nmi_callback_proc) (device, ppu_regs);
356356
357   timer_adjust_oneshot(ppu2c0x->nmi_timer, attotime::never, 0);
357   ppu2c0x->nmi_timer->adjust(attotime::never);
358358}
359359
360360static void draw_background( device_t *device, UINT8 *line_priority )
r10326r10327
867867         // a game can read the high bit of $2002 before the NMI is called (potentially resetting the bit
868868         // via a read from $2002 in the NMI handler).
869869         // B-Wings is an example game that needs this.
870         timer_adjust_oneshot(ppu2c0x->nmi_timer, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), 0);
870         ppu2c0x->nmi_timer->adjust(device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4));
871871      }
872872   }
873873
r10326r10327
895895      next_scanline = 0;
896896
897897   // Call us back when the hblank starts for this scanline
898   timer_adjust_oneshot(ppu2c0x->hblank_timer, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(86.67), 0); // ??? FIXME - hardcoding NTSC, need better calculation
898   ppu2c0x->hblank_timer->adjust(device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(86.67)); // ??? FIXME - hardcoding NTSC, need better calculation
899899
900900   // trigger again at the start of the next scanline
901   timer_adjust_oneshot(ppu2c0x->scanline_timer, device->machine->primary_screen->time_until_pos(next_scanline * ppu2c0x->scan_scale), 0);
901   ppu2c0x->scanline_timer->adjust(device->machine->primary_screen->time_until_pos(next_scanline * ppu2c0x->scan_scale));
902902}
903903
904904/*************************************
r10326r10327
13021302
13031303   /* initialize the scanline handling portion */
13041304   ppu2c0x->scanline_timer = device->machine->scheduler().timer_alloc(FUNC(scanline_callback), (void *) device);
1305   timer_adjust_oneshot(ppu2c0x->scanline_timer, device->machine->primary_screen->time_until_pos(1), 0);
1305   ppu2c0x->scanline_timer->adjust(device->machine->primary_screen->time_until_pos(1));
13061306
13071307   ppu2c0x->hblank_timer = device->machine->scheduler().timer_alloc(FUNC(hblank_callback), (void *) device);
1308   timer_adjust_oneshot(ppu2c0x->hblank_timer, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(86.67), 0); // ??? FIXME - hardcoding NTSC, need better calculation
1308   ppu2c0x->hblank_timer->adjust(device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(86.67)); // ??? FIXME - hardcoding NTSC, need better calculation
13091309
13101310   ppu2c0x->nmi_timer = device->machine->scheduler().timer_alloc(FUNC(nmi_callback), (void *) device);
1311   timer_adjust_oneshot(ppu2c0x->nmi_timer, attotime::never, 0);
1311   ppu2c0x->nmi_timer->adjust(attotime::never);
13121312
13131313   ppu2c0x->nmi_callback_proc = intf->nmi_handler;
13141314   ppu2c0x->color_base = intf->color_base;
src/mame/video/twin16.c
r10326r10327
156156
157157   // sprite system busy, maybe a dma? time is guessed, assume 4 scanlines
158158   twin16_sprite_busy = 1;
159   timer_adjust_oneshot(twin16_sprite_timer, machine->primary_screen->frame_period() / machine->primary_screen->height() * 4, 0);
159   twin16_sprite_timer->adjust(machine->primary_screen->frame_period() / machine->primary_screen->height() * 4);
160160
161161   return 0;
162162}
r10326r10327
505505   memset(twin16_sprite_buffer,0xff,0x800*sizeof(UINT16));
506506   twin16_sprite_busy = 0;
507507   twin16_sprite_timer = machine->scheduler().timer_alloc(FUNC(twin16_sprite_tick));
508   timer_adjust_oneshot(twin16_sprite_timer, attotime::never, 0);
508   twin16_sprite_timer->adjust(attotime::never);
509509
510510   /* register for savestates */
511511   state_save_register_global_array(machine, twin16_sprite_buffer);
src/mame/video/dcheese.c
r10326r10327
6666      time = machine->primary_screen->time_until_pos(effscan);
6767      if (time < machine->primary_screen->scan_period())
6868         time += machine->primary_screen->frame_period();
69      timer_adjust_oneshot(state->blitter_timer, time, 0);
69      state->blitter_timer->adjust(time);
7070   }
7171}
7272
r10326r10327
212212   if (state->blitter_xparam[8] != 0 || state->blitter_xparam[9] != 0 || state->blitter_xparam[10] != 0 || state->blitter_xparam[11] != 0 ||
213213      state->blitter_yparam[8] != 0 || state->blitter_yparam[9] != 0 || state->blitter_yparam[10] != 0 || state->blitter_yparam[11] != 0)
214214   {
215      logerror("%s:blit! (%04X)\n", cpuexec_describe_context(machine), state->blitter_color[0]);
215      logerror("%s:blit! (%04X)\n", machine->describe_context(), state->blitter_color[0]);
216216      logerror("   %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n",
217217            state->blitter_xparam[0], state->blitter_xparam[1], state->blitter_xparam[2], state->blitter_xparam[3],
218218            state->blitter_xparam[4], state->blitter_xparam[5], state->blitter_xparam[6], state->blitter_xparam[7],
src/mame/video/genesis.c
r10326r10327
366366         break;
367367
368368      default:      /* Illegal read attempt */
369         logerror("%s: VDP illegal read type %02x\n", cpuexec_describe_context(machine), vdp_code);
369         logerror("%s: VDP illegal read type %02x\n", machine->describe_context(), vdp_code);
370370         read = 0x00;
371371         break;
372372   }
r10326r10327
427427         break;
428428
429429      default:      /* Illegal write attempt */
430         logerror("%s: VDP illegal write type %02x data %04x\n", cpuexec_describe_context(machine), vdp_code, data);
430         logerror("%s: VDP illegal write type %02x data %04x\n", machine->describe_context(), vdp_code, data);
431431         break;
432432   }
433433
src/mame/video/rpunch.c
r10326r10327
8383{
8484   cputag_set_input_line(machine, "maincpu", 1, HOLD_LINE);
8585   if (param != 0)
86      timer_adjust_periodic(crtc_timer, machine->primary_screen->frame_period() / param, 0, machine->primary_screen->frame_period() / param);
86      crtc_timer->adjust(machine->primary_screen->frame_period() / param, 0, machine->primary_screen->frame_period() / param);
8787}
8888
8989
r10326r10327
171171      {
172172         /* only register we know about.... */
173173         case 0x0b:
174            timer_adjust_oneshot(crtc_timer, space->machine->primary_screen->time_until_vblank_start(), (data == 0xc0) ? 2 : 1);
174            crtc_timer->adjust(space->machine->primary_screen->time_until_vblank_start(), (data == 0xc0) ? 2 : 1);
175175            break;
176176
177177         default:
src/mame/video/changela.c
r10326r10327
3030   state->tree1_bitmap = machine->primary_screen->alloc_compatible_bitmap();
3131
3232   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(changela_scanline_callback));
33   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(30), 30);
33   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(30), 30);
3434
3535   state_save_register_global_pointer(machine, state->memory_devices, 4 * 0x800);
3636   state_save_register_global_pointer(machine, state->tree_ram, 2 * 0x20);
r10326r10327
719719
720720   sy++;
721721   if (sy > 256) sy = 30;
722   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(sy), sy);
722   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(sy), sy);
723723}
724724
725725VIDEO_UPDATE( changela )
src/mame/drivers/bfcobra.c
r10326r10327
440440      /* This debug is now wrong ! */
441441      if (DEBUG_BLITTER)
442442      {
443         mame_printf_debug("\n%s:Blitter: Running command from 0x%.5x\n\n", cpuexec_describe_context(device->machine), blitter.program.addr - 12);
443         mame_printf_debug("\n%s:Blitter: Running command from 0x%.5x\n\n", device->machine->describe_context(), blitter.program.addr - 12);
444444         mame_printf_debug("Command Reg         %.2x",   blitter.command);
445445         mame_printf_debug("      %s %s %s %s %s %s %s\n",
446446            blitter.command & CMD_RUN ? "RUN" : "     ",
src/mame/drivers/deco_mlc.c
r10326r10327
146146      //volume control todo
147147   }
148148   else
149      logerror("%s:  eprom_w %08x mask %08x\n",cpuexec_describe_context(device->machine),data,mem_mask);
149      logerror("%s:  eprom_w %08x mask %08x\n",device->machine->describe_context(),data,mem_mask);
150150}
151151
152152static WRITE32_HANDLER( avengrs_palette_w )
src/mame/drivers/segaxbd.c
r10326r10327
313313   if (irq)
314314   {
315315      cpu_set_input_line(state->maincpu, irq, ASSERT_LINE);
316      cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
316      machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
317317   }
318318}
319319
r10326r10327
418418   segas1x_state *state = device->machine->driver_data<segas1x_state>();
419419
420420   cpu_set_input_line(state->subcpu, INPUT_LINE_RESET, PULSE_LINE);
421   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(100));
421   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
422422}
423423
424424
r10326r10327
678678   segas1x_state *state = space->machine->driver_data<segas1x_state>();
679679
680680   COMBINE_DATA(&state->loffire_sync[offset]);
681   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
681   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
682682}
683683
684684
src/mame/drivers/nbmj9195.c
r10326r10327
238238            break;
239239
240240         default:
241            logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset);
241            logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", space->machine->describe_context(), offset);
242242            portdata = 0xff;
243243            break;
244244      }
r10326r10327
323323            break;
324324
325325         default:
326            logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset);
326            logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", space->machine->describe_context(), offset);
327327            portdata = 0xff;
328328            break;
329329      }
r10326r10327
371371            break;
372372
373373         default:
374            logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data);
374            logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", space->machine->describe_context(), offset, data);
375375            break;
376376      }
377377   }
r10326r10327
409409            break;
410410
411411         default:
412            logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data);
412            logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", space->machine->describe_context(), offset, data);
413413            break;
414414      }
415415   }
src/mame/drivers/sslam.c
r10326r10327
238238         state->track = 0;
239239         state->melody = 0;
240240         state->bar = 0;
241         timer_enable(state->music_timer,0);
241         state->music_timer->enable(false);
242242      }
243243      if (pattern) {
244244         logerror("Changing bar in music track to pattern %02x\n",pattern);
r10326r10327
270270               oki->write_command(0x40);
271271            oki->write_command((0x80 | data));
272272            oki->write_command(0x81);
273            timer_adjust_periodic(state->music_timer, attotime::from_msec(4), 0, attotime::from_hz(250));   /* 250Hz for smooth sequencing */
273            state->music_timer->adjust(attotime::from_msec(4), 0, attotime::from_hz(250));   /* 250Hz for smooth sequencing */
274274         }
275275      }
276276      else {
r10326r10327
290290   }
291291   else {      /* use above 0x80 to turn off channels */
292292      if (track) {
293         timer_enable(state->music_timer,0);
293         state->music_timer->enable(false);
294294         state->track = 0;
295295         state->melody = 0;
296296         state->bar = 0;
r10326r10327
306306   {
307307      sslam_state *state = device->machine->driver_data<sslam_state>();
308308
309      logerror("%s Writing %04x to Sound CPU\n",cpuexec_describe_context(device->machine),data);
309      logerror("%s Writing %04x to Sound CPU\n",device->machine->describe_context(),data);
310310      if (data >= 0x40) {
311311         if (data == 0xfe) {
312312            /* This should reset the sound MCU and stop audio playback, but here, it */
src/mame/drivers/csplayh5.c
r10326r10327
182182         break;
183183
184184      default:
185         logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset);
185         logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", space->machine->describe_context(), offset);
186186         portdata = 0xff;
187187         break;
188188   }
r10326r10327
210210         break;
211211
212212      default:
213         logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data);
213         logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", space->machine->describe_context(), offset, data);
214214         break;
215215   }
216216}
src/mame/drivers/hornet.c
r10326r10327
886886   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
887887
888888   cputag_set_input_line(machine, "audiocpu", line, ASSERT_LINE);
889    timer_adjust_oneshot(sound_irq_timer, attotime::from_usec(1), line);
889    sound_irq_timer->adjust(attotime::from_usec(1), line);
890890}
891891
892892static const k056800_interface hornet_k056800_interface =
src/mame/drivers/ccastles.c
r10326r10327
148148         break;
149149
150150   /* next one at the start of this scanline */
151   timer_adjust_oneshot(state->irq_timer, machine->primary_screen->time_until_pos(curscanline), curscanline);
151   state->irq_timer->adjust(machine->primary_screen->time_until_pos(curscanline), curscanline);
152152}
153153
154154
src/mame/drivers/jedi.c
r10326r10327
136136   scanline += 32;
137137   if (scanline > 256)
138138      scanline = 32;
139   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
139   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
140140}
141141
142142
r10326r10327
159159
160160   /* set a timer to run the interrupts */
161161   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(generate_interrupt));
162   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(32), 32);
162   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(32), 32);
163163
164164   /* configure the banks */
165165   memory_configure_bank(machine, "bank1", 0, 3, machine->region("maincpu")->base() + 0x10000, 0x4000);
src/mame/drivers/seta2.c
r10326r10327
20652065   PORT_DIPSETTING( 0x00800000, DEF_STR( On ) )
20662066INPUT_PORTS_END
20672067
2068static INPUT_PORTS_START( funcube4 )
2069        PORT_INCLUDE(funcube)
20682070
2071// Inverted this dip by default to allow game to be played
2072
2073   PORT_MODIFY("DEBUG")
2074    PORT_DIPNAME(    0x00400000, 0x00000000, "Debug 6" )
2075   PORT_DIPSETTING( 0x00000000, DEF_STR( Off ) )
2076   PORT_DIPSETTING( 0x00400000, DEF_STR( On ) )
2077INPUT_PORTS_END
2078
2079
2080
20692081/***************************************************************************
20702082
20712083
r10326r10327
28692881GAME( 2001, wschampa, wschamp,  samshoot, wschamp,  0,        ROT0, "Sammy USA Corporation", "Wing Shooting Championship V1.01",             GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
28702882GAME( 2002, trophyh,  0,        samshoot, trophyh,  0,        ROT0, "Sammy USA Corporation", "Trophy Hunting - Bear & Moose V1.0",           GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
28712883GAME( 2001, funcube2, 0,        funcube,  funcube,  funcube2, ROT0, "Namco",                 "Funcube 2 (v1.1)",                             GAME_NO_SOUND )
2872GAME( 2001, funcube4, 0,        funcube,  funcube, funcube4, ROT0, "Namco",                 "Funcube 4 (v1.0)",                             GAME_NO_SOUND )
2884GAME( 2001, funcube4, 0,        funcube,  funcube4, funcube4, ROT0, "Namco",                 "Funcube 4 (v1.0)",                             GAME_NO_SOUND )
src/mame/drivers/zn.c
r10326r10327
6666      va_start( v, s_fmt );
6767      vsprintf( buf, s_fmt, v );
6868      va_end( v );
69      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
69      logerror( "%s: %s", machine->describe_context(), buf );
7070   }
7171}
7272
r10326r10327
348348      psx_sio_install_handler( space->machine, 0, sio_dip_handler );
349349      psx_sio_input( space->machine, 0, PSX_SIO_IN_DSR, 0 );
350350
351      timer_adjust_oneshot( state->dip_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime( 100 ), 1 );
351      state->dip_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime( 100 ), 1 );
352352   }
353353
354354   verboselog( space->machine, 2, "znsecsel_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
r10326r10327
361361
362362   if( param )
363363   {
364      timer_adjust_oneshot( state->dip_timer, machine->device<cpu_device>( "maincpu" )->cycles_to_attotime(50 ), 0 );
364      state->dip_timer->adjust( machine->device<cpu_device>( "maincpu" )->cycles_to_attotime(50 ) );
365365   }
366366}
367367
src/mame/drivers/paradise.c
r10326r10327
5858static WRITE8_DEVICE_HANDLER( paradise_okibank_w )
5959{
6060   if (data & ~0x02)
61      logerror("%s: unknown oki bank bits %02X\n", cpuexec_describe_context(device->machine), data);
61      logerror("%s: unknown oki bank bits %02X\n", device->machine->describe_context(), data);
6262
6363   downcast<okim6295_device *>(device)->set_bank_base((data & 0x02) ? 0x40000 : 0);
6464}
src/mame/drivers/galpani3.c
r10326r10327
438438   UINT16 mcu_offset  = mcu_ram[0x0012/2] / 2;   /* offset in shared RAM where MCU will write */
439439   UINT16 mcu_subcmd  = mcu_ram[0x0014/2];      /* sub-command parameter, happens only for command #4 */
440440
441   logerror("%s: MCU executed command : %04X %04X\n",cpuexec_describe_context(machine),mcu_command,mcu_offset*2);
441   logerror("%s: MCU executed command : %04X %04X\n",machine->describe_context(),mcu_command,mcu_offset*2);
442442
443443   /* the only MCU commands found in program code are:
444444         0x04: protection: provide code/data,
r10326r10327
451451      case 0x03:   // DSW
452452      {
453453         mcu_ram[mcu_offset] = input_port_read(machine, "DSW");
454         logerror("%s : MCU executed command: %04X %04X (read DSW)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2);
454         logerror("%s : MCU executed command: %04X %04X (read DSW)\n", machine->describe_context(), mcu_command, mcu_offset*2);
455455      }
456456      break;
457457
src/mame/drivers/deco32.c
r10326r10327
455455      eeprom_set_cs_line(device, (data & 0x4) ? CLEAR_LINE : ASSERT_LINE);
456456      return;
457457   }
458   logerror("%s:Write control 1 %08x %08x\n",cpuexec_describe_context(device->machine),offset,data);
458   logerror("%s:Write control 1 %08x %08x\n",device->machine->describe_context(),offset,data);
459459}
460460
461461/**********************************************************************************/
src/mame/drivers/midzeus.c
r10326r10327
172172   if (bitlatch[2] && !cmos_protected)
173173      timekeeper_w(device, offset, data);
174174   else
175      logerror("%s:zeus2_timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", cpuexec_describe_context(device->machine), bitlatch[2], cmos_protected);
175      logerror("%s:zeus2_timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", device->machine->describe_context(), bitlatch[2], cmos_protected);
176176   cmos_protected = TRUE;
177177}
178178
r10326r10327
388388   {
389389      /* timer is clocked at 100ns */
390390      int which = (offset >> 4) & 1;
391      INT32 result = (timer_timeelapsed(timer[which]) * 10000000).as_double();
391      INT32 result = (timer[which]->elapsed() * 10000000).as_double();
392392      return result;
393393   }
394394
r10326r10327
413413   {
414414      int which = (offset >> 4) & 1;
415415      if (data & 0x40)
416         timer_adjust_oneshot(timer[which], attotime::never, 0);
416         timer[which]->adjust(attotime::never);
417417   }
418418   else
419419      logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(space->cpu), offset, data);
r10326r10327
507507   /* generate another interrupt on the next scanline while we are within the BEAM_DY */
508508   beamy++;
509509   if (beamy <= machine->primary_screen->visible_area().max_y && beamy <= gun_y[player] + BEAM_DY)
510      timer_adjust_oneshot(gun_timer[player], machine->primary_screen->time_until_pos(beamy, MAX(0, gun_x[player] - BEAM_DX)), player);
510      gun_timer[player]->adjust(machine->primary_screen->time_until_pos(beamy, MAX(0, gun_x[player] - BEAM_DX)), player);
511511}
512512
513513
r10326r10327
536536         };
537537         gun_x[player] = input_port_read(space->machine, names[player][0]) * (visarea.max_x + 1 - visarea.min_x) / 255 + visarea.min_x + BEAM_XOFFS;
538538         gun_y[player] = input_port_read(space->machine, names[player][1]) * (visarea.max_y + 1 - visarea.min_y) / 255 + visarea.min_y;
539         timer_adjust_oneshot(gun_timer[player], space->machine->primary_screen->time_until_pos(MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player);
539         gun_timer[player]->adjust(space->machine->primary_screen->time_until_pos(MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player);
540540      }
541541   }
542542}
src/mame/drivers/karnov.c
r10326r10327
123123   if (data == 0x401) state->i8751_return = 0x4138; /* ^Whistling wind */
124124   if (data == 0x408) state->i8751_return = 0x4276; /* ^Heavy Gates */
125125
126//  if (!state->i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
126//  if (!state->i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", machine->describe_context(), data);
127127
128128   cpu_set_input_line(state->maincpu, 6, HOLD_LINE); /* Signal main cpu task is complete */
129129   state->i8751_needs_ack = 1;
r10326r10327
159159         case 0x18:   state->i8751_return = 0x5341; break;
160160      }
161161   }
162//  else logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
162//  else logerror("%s - Unknown Write %02x intel\n", machine->describe_context(), data);
163163
164164   /* These are 68k function call addresses - different address for each power-up */
165165   if (data == 0x400) state->i8751_return = 0x594;
r10326r10327
315315      }
316316   }
317317
318   //  logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
318   //  logerror("%s - Unknown Write %02x intel\n", machine->describe_context(), data);
319319
320320   cpu_set_input_line(state->maincpu, 6, HOLD_LINE); /* Signal main cpu task is complete */
321321   state->i8751_needs_ack = 1;
src/mame/drivers/xtheball.c
r10326r10327
8888   else if (address >= 0x02000000 && address <= 0x020fffff)
8989      memcpy(shiftreg, &vram_fg[TOWORD(address & 0xff000)], TOBYTE(0x1000));
9090   else
91      logerror("%s:xtheball_to_shiftreg(%08X)\n", cpuexec_describe_context(space->machine), address);
91      logerror("%s:xtheball_to_shiftreg(%08X)\n", space->machine->describe_context(), address);
9292}
9393
9494
r10326r10327
9999   else if (address >= 0x02000000 && address <= 0x020fffff)
100100      memcpy(&vram_fg[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
101101   else
102      logerror("%s:xtheball_from_shiftreg(%08X)\n", cpuexec_describe_context(space->machine), address);
102      logerror("%s:xtheball_from_shiftreg(%08X)\n", space->machine->describe_context(), address);
103103}
104104
105105
src/mame/drivers/segaybd.c
r10326r10327
9696   cpu_set_input_line(state->suby, 6, state->timer_irq_state && state->vblank_irq_state ? ASSERT_LINE : CLEAR_LINE);
9797
9898   if (state->timer_irq_state || state->vblank_irq_state)
99      cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(50));
99      machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
100100}
101101
102102
src/mame/drivers/ddenlovr.c
r10326r10327
686686
687687#if 1
688688   logerror("%s: blit src %06x x %03x y %03x flags %02x layer %02x pen %02x penmode %02x w %03x h %03x linelen %03x flip %02x clip: ctrl %x xy %03x %03x wh %03x %03x\n",
689         cpuexec_describe_context(machine),
689         machine->describe_context(),
690690         state->ddenlovr_blit_address, state->ddenlovr_blit_x, state->ddenlovr_blit_y, data,
691691         state->ddenlovr_dest_layer, state->ddenlovr_blit_pen, state->ddenlovr_blit_pen_mode, state->ddenlovr_rect_width, state->ddenlovr_rect_height, state->ddenlovr_line_length, state->ddenlovr_blit_flip,
692692         state->ddenlovr_clip_ctrl, state->ddenlovr_clip_x, state->ddenlovr_clip_y, state->ddenlovr_clip_width, state->ddenlovr_clip_height);
r10326r10327
994994                     ;
995995            #ifdef MAME_DEBUG
996996               popmessage("unknown blitter command %02x", data);
997               logerror("%s: unknown blitter command %02x\n", cpuexec_describe_context(machine), data);
997               logerror("%s: unknown blitter command %02x\n", machine->describe_context(), data);
998998            #endif
999999         }
10001000
r10326r10327
10021002         break;
10031003
10041004      default:
1005         logerror("%s: Blitter %d reg %02x = %02x\n", cpuexec_describe_context(machine), blitter, state->ddenlovr_blit_regs[blitter], data);
1005         logerror("%s: Blitter %d reg %02x = %02x\n", machine->describe_context(), blitter, state->ddenlovr_blit_regs[blitter], data);
10061006         break;
10071007      }
10081008   }
r10326r10327
26532653
26542654   if (address >= size)
26552655   {
2656      logerror("%s: Error, Blitter address %06X out of range\n", cpuexec_describe_context(machine), address);
2656      logerror("%s: Error, Blitter address %06X out of range\n", machine->describe_context(), address);
26572657      address %= size;
26582658   }
26592659
r10326r10327
29192919   if (!BIT(state->dsw_sel, 3))   return input_port_read(device->machine, "DSW1");
29202920   if (!BIT(state->dsw_sel, 4))   return input_port_read(device->machine, "DSW5");
29212921
2922   logerror("%s: warning, unknown bits read, ddenlovr_select = %02x\n", cpuexec_describe_context(device->machine), state->dsw_sel);
2922   logerror("%s: warning, unknown bits read, ddenlovr_select = %02x\n", device->machine->describe_context(), state->dsw_sel);
29232923   return 0xff;
29242924}
29252925
src/mame/drivers/kaneko16.c
r10326r10327
400400   if (ACCESSING_BITS_0_7) {
401401      okim6295_device *oki = downcast<okim6295_device *>(device);
402402      oki->set_bank_base(0x40000 * (data & 0x7) );
403      logerror("%s:Selecting OKI bank %02X\n",cpuexec_describe_context(device->machine),data&0xff);
403      logerror("%s:Selecting OKI bank %02X\n",device->machine->describe_context(),data&0xff);
404404   }
405405}
406406
r10326r10327
544544   {
545545      okim6295_device *oki = downcast<okim6295_device *>(device);
546546      oki->set_bank_base(0x40000 * (data & 0xF));
547      logerror("%s: OKI0  bank %08X\n",cpuexec_describe_context(device->machine),data);
547      logerror("%s: OKI0  bank %08X\n",device->machine->describe_context(),data);
548548   }
549549}
550550
r10326r10327
554554   {
555555      okim6295_device *oki = downcast<okim6295_device *>(device);
556556      oki->set_bank_base(0x40000 * data );
557      logerror("%s: OKI1  bank %08X\n",cpuexec_describe_context(device->machine),data);
557      logerror("%s: OKI1  bank %08X\n",device->machine->describe_context(),data);
558558   }
559559}
560560
src/mame/drivers/namcos10.c
r10326r10327
357357{
358358   UINT32 data = nand_read2( nand_address * 2 );
359359
360   printf( "data<-%08x (%08x)\n", data, nand_address );
360/*   printf( "data<-%08x (%08x)\n", data, nand_address ); */
361361   nand_address++;
362362
363363   return data;
r10326r10327
373373   }
374374}
375375
376UINT32 block[ 0x1ff ];
377
378WRITE32_HANDLER( nand_block_w )
379{
380   COMBINE_DATA( &block[ offset ] );
381}
382
383READ32_HANDLER( nand_block_r )
384{
385   return block[ offset ];
386}
387
388WRITE32_HANDLER( watchdog_w )
389{
390}
391
376392static void memn_driver_init( running_machine *machine )
377393{
378394   UINT8 *BIOS = (UINT8 *)machine->region( "user1" )->base();
r10326r10327
387403   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f430000, 0x1f430003, 0, 0, nand_address3_w );
388404   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f440000, 0x1f440003, 0, 0, nand_address4_w );
389405   memory_install_read32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1f450000, 0x1f450003, 0, 0, nand_data_r );
406   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1fb60000, 0x1fb60003, 0, 0, watchdog_w );
407   memory_install_write32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xbf500000, 0xbf5007d7, 0, 0, nand_block_w );
408   memory_install_read32_handler( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xbf500000, 0xbf5007d7, 0, 0, nand_block_r );
390409
391410   psx_driver_init(machine);
392411}
src/mame/drivers/mpu4.c
r10326r10327
717717/* IC3, lamp data lines + alpha numeric display */
718718static WRITE8_DEVICE_HANDLER( pia_ic3_porta_w )
719719{
720   LOG_IC3(("%s: IC3 PIA Port A Set to %2x (lamp strobes 1 - 9)\n", cpuexec_describe_context(device->machine),data));
720   LOG_IC3(("%s: IC3 PIA Port A Set to %2x (lamp strobes 1 - 9)\n", device->machine->describe_context(),data));
721721
722722   if(ic23_active)
723723   {
r10326r10327
728728
729729static WRITE8_DEVICE_HANDLER( pia_ic3_portb_w )
730730{
731   LOG_IC3(("%s: IC3 PIA Port B Set to %2x  (lamp strobes 10 - 17)\n", cpuexec_describe_context(device->machine),data));
731   LOG_IC3(("%s: IC3 PIA Port B Set to %2x  (lamp strobes 10 - 17)\n", device->machine->describe_context(),data));
732732
733733   if(ic23_active)
734734   {
r10326r10327
739739
740740static WRITE_LINE_DEVICE_HANDLER( pia_ic3_ca2_w )
741741{
742   LOG_IC3(("%s: IC3 PIA Write CA2 (alpha data), %02X\n", cpuexec_describe_context(device->machine),state));
742   LOG_IC3(("%s: IC3 PIA Write CA2 (alpha data), %02X\n", device->machine->describe_context(),state));
743743
744744   alpha_data_line = state;
745745   ROC10937_draw_16seg(0);
r10326r10327
748748
749749static WRITE_LINE_DEVICE_HANDLER( pia_ic3_cb2_w )
750750{
751   LOG_IC3(("%s: IC3 PIA Write CB (alpha reset), %02X\n",cpuexec_describe_context(device->machine),state));
751   LOG_IC3(("%s: IC3 PIA Write CB (alpha reset), %02X\n",device->machine->describe_context(),state));
752752
753753   if ( state ) ROC10937_reset(0);
754754   ROC10937_draw_16seg(0);
r10326r10327
829829      {
830830         ic23_active=1;
831831         ic24_output(0);
832         timer_adjust_oneshot(ic24_timer, attotime::from_double(duration), 0);
832         ic24_timer->adjust(attotime::from_double(duration));
833833      }
834834   }
835835}
r10326r10327
923923   if ( lamp_undercurrent ) ic4_input_b |= 0x01;
924924   #endif
925925
926   LOG_IC3(("%s: IC4 PIA Read of Port B %x\n",cpuexec_describe_context(device->machine),ic4_input_b));
926   LOG_IC3(("%s: IC4 PIA Read of Port B %x\n",device->machine->describe_context(),ic4_input_b));
927927   return ic4_input_b;
928928}
929929
930930
931931static WRITE_LINE_DEVICE_HANDLER( pia_ic4_ca2_w )
932932{
933   LOG_IC3(("%s: IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", cpuexec_describe_context(device->machine),state));
933   LOG_IC3(("%s: IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", device->machine->describe_context(),state));
934934
935935   IC23GB = state;
936936   ic23_update();
r10326r10327
938938
939939static WRITE_LINE_DEVICE_HANDLER( pia_ic4_cb2_w )
940940{
941   LOG_IC3(("%s: IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", cpuexec_describe_context(device->machine),state));
941   LOG_IC3(("%s: IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", device->machine->describe_context(),state));
942942   reel_flag=state;
943943}
944944static const pia6821_interface pia_ic4_intf =
r10326r10327
982982         aux1_input &= ~0x04;
983983      }*/
984984   }
985   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",cpuexec_describe_context(device->machine)));
985   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",device->machine->describe_context()));
986986
987987   return input_port_read(device->machine, "AUX1")|aux1_input;
988988}
r10326r10327
10711071      }*/
10721072   }
10731073
1074   LOG(("%s: IC5 PIA Read of Port B (coin input AUX2)\n",cpuexec_describe_context(device->machine)));
1074   LOG(("%s: IC5 PIA Read of Port B (coin input AUX2)\n",device->machine->describe_context()));
10751075   coin_lockout_w(device->machine, 0, (pia6821_get_output_b(pia_ic5) & 0x01) );
10761076   coin_lockout_w(device->machine, 1, (pia6821_get_output_b(pia_ic5) & 0x02) );
10771077   coin_lockout_w(device->machine, 2, (pia6821_get_output_b(pia_ic5) & 0x04) );
r10326r10327
10821082
10831083static WRITE_LINE_DEVICE_HANDLER( pia_ic5_ca2_w )
10841084{
1085   LOG(("%s: IC5 PIA Write CA2 (Serial Tx) %2x\n",cpuexec_describe_context(device->machine),state));
1085   LOG(("%s: IC5 PIA Write CA2 (Serial Tx) %2x\n",device->machine->describe_context(),state));
10861086   serial_data = state;
10871087}
10881088
r10326r10327
11791179/* IC6, Reel A and B and AY registers (MODs below 4 only) */
11801180static WRITE8_DEVICE_HANDLER( pia_ic6_portb_w )
11811181{
1182   LOG(("%s: IC6 PIA Port B Set to %2x (Reel A and B)\n", cpuexec_describe_context(device->machine),data));
1182   LOG(("%s: IC6 PIA Port B Set to %2x (Reel A and B)\n", device->machine->describe_context(),data));
11831183
11841184   if (reel_mux == SEVEN_REEL)
11851185   {
r10326r10327
12091209
12101210static WRITE8_DEVICE_HANDLER( pia_ic6_porta_w )
12111211{
1212   LOG(("%s: IC6 PIA Write A %2x\n", cpuexec_describe_context(device->machine),data));
1212   LOG(("%s: IC6 PIA Write A %2x\n", device->machine->describe_context(),data));
12131213   if (mod_number <4)
12141214   {
12151215      ay_data = data;
r10326r10327
12201220
12211221static WRITE_LINE_DEVICE_HANDLER( pia_ic6_ca2_w )
12221222{
1223   LOG(("%s: IC6 PIA write CA2 %2x (AY8913 BC1)\n", cpuexec_describe_context(device->machine),state));
1223   LOG(("%s: IC6 PIA write CA2 %2x (AY8913 BC1)\n", device->machine->describe_context(),state));
12241224   if (mod_number <4)
12251225   {
12261226      if ( state ) ay8913_address |=  0x01;
r10326r10327
12321232
12331233static WRITE_LINE_DEVICE_HANDLER( pia_ic6_cb2_w )
12341234{
1235   LOG(("%s: IC6 PIA write CB2 %2x (AY8913 BCDIR)\n", cpuexec_describe_context(device->machine),state));
1235   LOG(("%s: IC6 PIA write CB2 %2x (AY8913 BCDIR)\n", device->machine->describe_context(),state));
12361236   if (mod_number <4)
12371237   {
12381238      if ( state ) ay8913_address |=  0x02;
r10326r10327
12621262/* IC7 Reel C and D, mechanical meters/Reel E and F, input strobe bit A */
12631263static WRITE8_DEVICE_HANDLER( pia_ic7_porta_w )
12641264{
1265   LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", cpuexec_describe_context(device->machine),data));
1265   LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", device->machine->describe_context(),data));
12661266   if (reel_mux == SEVEN_REEL)
12671267   {
12681268      stepper_update(5, data&0x0F);
r10326r10327
13381338
13391339static WRITE_LINE_DEVICE_HANDLER( pia_ic7_ca2_w )
13401340{
1341   LOG(("%s: IC7 PIA write CA2 %2x (input strobe bit 0 / LED A)\n", cpuexec_describe_context(device->machine),state));
1341   LOG(("%s: IC7 PIA write CA2 %2x (input strobe bit 0 / LED A)\n", device->machine->describe_context(),state));
13421342
13431343   IC23GA = state;
13441344   ic24_setup();
r10326r10327
13731373   static const char *const portnames[] = { "ORANGE1", "ORANGE2", "BLACK1", "BLACK2", "ORANGE1", "ORANGE2", "DIL1", "DIL2" };
13741374   device_t *pia_ic5 = device->machine->device("pia_ic5");
13751375
1376   LOG_IC8(("%s: IC8 PIA Read of Port A (MUX input data)\n", cpuexec_describe_context(device->machine)));
1376   LOG_IC8(("%s: IC8 PIA Read of Port A (MUX input data)\n", device->machine->describe_context()));
13771377/* The orange inputs are polled twice as often as the black ones, for reasons of efficiency.
13781378   This is achieved via connecting every input line to an AND gate, thus allowing two strobes
13791379   to represent each orange input bank (strobes are active low). */
r10326r10327
13931393//      duart.drive_sensor(data & 0x04, data & 0x01, data & 0x04, data & 0x02);
13941394   }
13951395   int i;
1396   LOG_IC8(("%s: IC8 PIA Port B Set to %2x (OUTPUT PORT, TRIACS)\n", cpuexec_describe_context(device->machine),data));
1396   LOG_IC8(("%s: IC8 PIA Port B Set to %2x (OUTPUT PORT, TRIACS)\n", device->machine->describe_context(),data));
13971397   for (i = 0; i < 8; i++)
13981398   {
13991399      output_set_indexed_value("triac", i, data & (1 << i));
r10326r10327
14021402
14031403static WRITE_LINE_DEVICE_HANDLER( pia_ic8_ca2_w )
14041404{
1405   LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", cpuexec_describe_context(device->machine), state & 0xFF));
1405   LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", device->machine->describe_context(), state & 0xFF));
14061406
14071407   IC23GC = state;
14081408   ic23_update();
r10326r10327
14111411
14121412static WRITE_LINE_DEVICE_HANDLER( pia_ic8_cb2_w )
14131413{
1414   LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", cpuexec_describe_context(device->machine), state & 0xFF));
1414   LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", device->machine->describe_context(), state & 0xFF));
14151415
14161416   if ( !alpha_clock && (state) )
14171417   {
r10326r10327
14431443static WRITE8_DEVICE_HANDLER( pia_gb_porta_w )
14441444{
14451445   device_t *msm6376 = device->machine->device("msm6376");
1446   LOG_SS(("%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", device->machine->describe_context(),data));
14471447   okim6376_w(msm6376, 0, data);
14481448}
14491449
r10326r10327
14511451{
14521452   int changed = expansion_latch^data;
14531453
1454   LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", cpuexec_describe_context(device->machine),data));
1454   LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", device->machine->describe_context(),data));
14551455
14561456   expansion_latch = data;
14571457
r10326r10327
14781478static READ8_DEVICE_HANDLER( pia_gb_portb_r )
14791479{
14801480   device_t *msm6376 = device->machine->device("msm6376");
1481   LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n",cpuexec_describe_context(device->machine)));
1481   LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n",device->machine->describe_context()));
14821482   //
14831483   // b7, 1 = OKI ready, 0 = OKI busy
14841484   // b5, vol clock
r10326r10327
14901490
14911491static WRITE_LINE_DEVICE_HANDLER( pia_gb_ca2_w )
14921492{
1493   LOG_SS(("%s: GAMEBOARD: OKI RESET data = %02X\n", cpuexec_describe_context(device->machine), state));
1493   LOG_SS(("%s: GAMEBOARD: OKI RESET data = %02X\n", device->machine->describe_context(), state));
14941494
14951495//  reset line
14961496}
src/mame/drivers/pipeline.c
r10326r10327
162162static WRITE8_DEVICE_HANDLER(protection_w)
163163{
164164   device->machine->scheduler().synchronize(FUNC(protection_deferred_w), data);
165   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(100));
165   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
166166}
167167
168168static ADDRESS_MAP_START( cpu0_mem, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/viper.c
r10326r10327
197197
198198         default:
199199         {
200            fatalerror("%s:cf_card_data_r: IDE reg %02X\n", cpuexec_describe_context(device->machine), offset & 0xf);
200            fatalerror("%s:cf_card_data_r: IDE reg %02X\n", device->machine->describe_context(), offset & 0xf);
201201         }
202202      }
203203   }
r10326r10327
218218
219219         default:
220220         {
221            fatalerror("%s:cf_card_data_w: IDE reg %02X, %04X\n", cpuexec_describe_context(device->machine), offset & 0xf, (UINT16)(data >> 16));
221            fatalerror("%s:cf_card_data_w: IDE reg %02X, %04X\n", device->machine->describe_context(), offset & 0xf, (UINT16)(data >> 16));
222222         }
223223      }
224224   }
r10326r10327
264264
265265            default:
266266            {
267               printf("%s:compact_flash_r: IDE reg %02X\n", cpuexec_describe_context(device->machine), offset & 0xf);
267               printf("%s:compact_flash_r: IDE reg %02X\n", device->machine->describe_context(), offset & 0xf);
268268            }
269269         }
270270      }
r10326r10327
280280         }
281281         else
282282         {
283            fatalerror("%s:compact_flash_r: reg %02X\n", cpuexec_describe_context(device->machine), reg);
283            fatalerror("%s:compact_flash_r: reg %02X\n", device->machine->describe_context(), reg);
284284         }
285285      }
286286   }
r10326r10327
290290static WRITE64_DEVICE_HANDLER(cf_card_w)
291291{
292292   #ifdef VIPER_DEBUG_LOG
293   printf("%s:compact_flash_w: %08X%08X, %08X, %08X%08X\n", cpuexec_describe_context(device->machine), (UINT32)(data>>32), (UINT32)(data), offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
293   printf("%s:compact_flash_w: %08X%08X, %08X, %08X%08X\n", device->machine->describe_context(), (UINT32)(data>>32), (UINT32)(data), offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
294294   #endif
295295
296296   if (ACCESSING_BITS_16_31)
r10326r10327
329329
330330            default:
331331            {
332               fatalerror("%s:compact_flash_w: IDE reg %02X, data %04X\n", cpuexec_describe_context(device->machine), offset & 0xf, (UINT16)((data >> 16) & 0xffff));
332               fatalerror("%s:compact_flash_w: IDE reg %02X, data %04X\n", device->machine->describe_context(), offset & 0xf, (UINT16)((data >> 16) & 0xffff));
333333            }
334334         }
335335      }
r10326r10327
355355            }
356356            default:
357357            {
358               fatalerror("%s:compact_flash_w: reg %02X, data %04X\n", cpuexec_describe_context(device->machine), offset, (UINT16)((data >> 16) & 0xffff));
358               fatalerror("%s:compact_flash_w: reg %02X, data %04X\n", device->machine->describe_context(), offset, (UINT16)((data >> 16) & 0xffff));
359359            }
360360         }
361361      }
src/mame/drivers/mw8080bw.c
r10326r10327
852852   /* basic machine hardware */
853853   MCFG_CPU_MODIFY("maincpu")
854854   MCFG_CPU_IO_MAP(zzzap_io_map)
855   MCFG_WATCHDOG_TIME_INIT(attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(RES_M(1), CAP_U(1)))) /* 1.1s */
855   MCFG_WATCHDOG_TIME_INIT(PERIOD_OF_555_MONOSTABLE(RES_M(1), CAP_U(1))) /* 1.1s */
856856
857857   /* add shifter */
858858   MCFG_MB14241_ADD("mb14241")
r10326r10327
966966   MCFG_CPU_MODIFY("maincpu")
967967   MCFG_CPU_IO_MAP(maze_io_map)
968968   MCFG_MACHINE_START(maze)
969   MCFG_WATCHDOG_TIME_INIT(attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
969   MCFG_WATCHDOG_TIME_INIT(PERIOD_OF_555_MONOSTABLE(RES_K(270), CAP_U(10))) /* 2.97s */
970970
971971   /* audio hardware */
972972   MCFG_FRAGMENT_ADD(maze_audio)
r10326r10327
10581058   MCFG_CPU_MODIFY("maincpu")
10591059   MCFG_CPU_IO_MAP(boothill_io_map)
10601060   MCFG_MACHINE_START(boothill)
1061   MCFG_WATCHDOG_TIME_INIT(attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
1061   MCFG_WATCHDOG_TIME_INIT(PERIOD_OF_555_MONOSTABLE(RES_K(270), CAP_U(10))) /* 2.97s */
10621062
10631063   /* add shifter */
10641064   MCFG_MB14241_ADD("mb14241")
r10326r10327
11641164   /* basic machine hardware */
11651165   MCFG_CPU_MODIFY("maincpu")
11661166   MCFG_CPU_IO_MAP(checkmat_io_map)
1167   MCFG_WATCHDOG_TIME_INIT(attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
1167   MCFG_WATCHDOG_TIME_INIT(PERIOD_OF_555_MONOSTABLE(RES_K(270), CAP_U(10))) /* 2.97s */
11681168
11691169   /* audio hardware */
11701170   MCFG_FRAGMENT_ADD(checkmat_audio)
src/mame/drivers/othello.c
r10326r10327
145145    state->n7751_command = (data & 0x07);
146146    cpu_set_input_line(state->n7751, 0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE);
147147    //cpu_set_input_line(state->n7751, 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
148    cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(100));
148    space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
149149    */
150150
151151   logerror("8a -> %x\n", data);
src/mame/drivers/igs017.c
r10326r10327
11921192   if (~input_select & 0x40)   return input_port_read(device->machine, "KEY3");
11931193   if (~input_select & 0x80)   return input_port_read(device->machine, "KEY4");
11941194
1195   logerror("%s: warning, reading key with input_select = %02x\n", cpuexec_describe_context(device->machine), input_select);
1195   logerror("%s: warning, reading key with input_select = %02x\n", device->machine->describe_context(), input_select);
11961196   return 0xff;
11971197}
11981198
r10326r10327
12711271
12721272   if (input_select == 0x1f)   return input_port_read(space->machine, "KEY0");   // in joystick mode
12731273
1274   logerror("%s: warning, reading key with input_select = %02x\n", cpuexec_describe_context(space->machine), input_select);
1274   logerror("%s: warning, reading key with input_select = %02x\n", space->machine->describe_context(), input_select);
12751275   return 0xff;
12761276}
12771277
r10326r10327
13591359
13601360   if ((input_select & 0xfc) == 0xfc)   return input_port_read(space->machine, "DSW1");
13611361
1362   logerror("%s: warning, reading key with input_select = %02x\n", cpuexec_describe_context(space->machine), input_select);
1362   logerror("%s: warning, reading key with input_select = %02x\n", space->machine->describe_context(), input_select);
13631363   return 0xff;
13641364}
13651365
src/mame/drivers/namcos12.c
r10326r10327
10641064      va_start( v, s_fmt );
10651065      vsprintf( buf, s_fmt, v );
10661066      va_end( v );
1067      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
1067      logerror( "%s: %s", machine->describe_context(), buf );
10681068   }
10691069}
10701070
src/mame/drivers/jangou.c
r10326r10327
895895
896896   /* Create a timer to feed the CVSD DAC with sample bits */
897897   state->cvsd_bit_timer = machine->scheduler().timer_alloc(FUNC(cvsd_bit_timer_callback));
898   timer_adjust_periodic(state->cvsd_bit_timer, attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024));
898   state->cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024));
899899}
900900
901901
src/mame/drivers/namcos21.c
r10326r10327
575575      {
576576         mpDspState->slaveBytesAdvertised--;
577577      }
578      if (ENABLE_LOGGING) logerror( "%s:-%04x(0x%04x)\n", cpuexec_describe_context(space->machine), data, mpDspState->slaveBytesAvailable );
578      if (ENABLE_LOGGING) logerror( "%s:-%04x(0x%04x)\n", space->machine->describe_context(), data, mpDspState->slaveBytesAvailable );
579579   }
580580   return data;
581581} /* ReadWordFromSlaveInput */
src/mame/drivers/pgm.c
r10326r10327
390390   COMBINE_DATA(&state->kov2_latchdata_68k_w);
391391
392392   generic_pulse_irq_line(state->prot, ARM7_FIRQ_LINE);
393   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(200));
393   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(200));
394394   cpu_spinuntil_time(space->cpu, state->prot->cycles_to_attotime(200)); // give the arm time to respond (just boosting the interleave doesn't help)
395395}
396396
r10326r10327
930930{
931931   pgm_state *state = space->machine->driver_data<pgm_state>();
932932   generic_pulse_irq_line(state->prot, ARM7_FIRQ_LINE);
933   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(200));
933   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(200));
934934   cpu_spinuntil_time(space->cpu, state->prot->cycles_to_attotime(200)); // give the arm time to respond (just boosting the interleave doesn't help)
935935}
936936
src/mame/drivers/gameplan.c
r10326r10327
146146   if (data == 0)
147147   {
148148      state->riot->reset();
149      cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(10));
149      device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
150150   }
151151}
152152
r10326r10327
188188
189189   cpu_set_input_line(gameplan->audiocpu, 0, state);
190190   if (state == ASSERT_LINE)
191      cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(10));
191      device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
192192}
193193
194194
src/mame/drivers/crbaloon.c
r10326r10327
7979   else
8080      ret = 0x00;
8181
82   if (LOG_PC3092) logerror("%s:  read  PC3092 = 0x%02x\n", cpuexec_describe_context(field->port->machine), ret);
82   if (LOG_PC3092) logerror("%s:  read  PC3092 = 0x%02x\n", field->port->machine->describe_context(), ret);
8383
8484   return ret;
8585}
src/mame/drivers/aquarium.c
r10326r10327
128128
129129static WRITE8_HANDLER( aquarium_oki_w )
130130{
131   logerror("%s:Writing %04x to the OKI M6295\n", cpuexec_describe_context(space->machine), aquarium_snd_bitswap(data));
131   logerror("%s:Writing %04x to the OKI M6295\n", space->machine->describe_context(), aquarium_snd_bitswap(data));
132132   okim6295_device *oki = space->machine->device<okim6295_device>("oki");
133133   oki->write(*space, offset, (aquarium_snd_bitswap(data)));
134134}
src/mame/drivers/metro.c
r10326r10327
163163{
164164   metro_state *state = device->machine->driver_data<metro_state>();
165165
166   // logerror("%s: irq callback returns %04X\n", cpuexec_describe_context(device->machine), state->irq_vectors[int_level]);
166   // logerror("%s: irq callback returns %04X\n", device->machine->describe_context(), state->irq_vectors[int_level]);
167167   return state->irq_vectors[irqline] & 0xff;
168168}
169169
r10326r10327
281281   metro_state *state = space->machine->driver_data<metro_state>();
282282   double freq = 58.0 + (0xff - (data & 0xff)) / 2.2;               /* 0xff=58Hz, 0x80=116Hz? */
283283
284   timer_adjust_periodic(state->mouja_irq_timer, attotime::zero, 0, attotime::from_hz(freq));
284   state->mouja_irq_timer->adjust(attotime::zero, 0, attotime::from_hz(freq));
285285}
286286
287287static INTERRUPT_GEN( mouja_interrupt )
r10326r10327
673673      case 2:   metro_vram_1_w(space, offs, data, mask);   break;
674674      case 3:   metro_vram_2_w(space, offs, data, mask);   break;
675675   }
676//  logerror("%s : Blitter %X] %04X <- %04X & %04X\n", cpuexec_describe_context(space->machine), tmap, offs, data, mask);
676//  logerror("%s : Blitter %X] %04X <- %04X & %04X\n", space->machine->describe_context(), tmap, offs, data, mask);
677677}
678678
679679
src/mame/drivers/zaccaria.c
r10326r10327
6969         break;
7070
7171      default:
72         logerror("%s: portsel = %02x\n", cpuexec_describe_context(device->machine), data);
72         logerror("%s: portsel = %02x\n", device->machine->describe_context(), data);
7373         break;
7474   }
7575}
src/mame/drivers/namcos23.c
r10326r10327
13301330   if (c361_scanline != 511)
13311331   {
13321332      cputag_set_input_line(machine, "maincpu", MIPS3_IRQ1, ASSERT_LINE);
1333      timer_adjust_oneshot(c361_timer, attotime::never, 0);
1333      c361_timer->adjust(attotime::never);
13341334   }
13351335}
13361336
r10326r10327
13501350      if (data == 0x1ff)
13511351      {
13521352         cputag_set_input_line(space->machine, "maincpu", MIPS3_IRQ1, CLEAR_LINE);
1353         timer_adjust_oneshot(c361_timer, attotime::never, 0);
1353         c361_timer->adjust(attotime::never);
13541354      }
13551355      else
13561356      {
1357         timer_adjust_oneshot(c361_timer, space->machine->primary_screen->time_until_pos(c361_scanline), 0);
1357         c361_timer->adjust(space->machine->primary_screen->time_until_pos(c361_scanline));
13581358      }
13591359      break;
13601360
r10326r10327
18081808      return;
18091809   case 0x17:
18101810      cputag_set_input_line(space->machine, "maincpu", MIPS3_IRQ1, CLEAR_LINE);
1811      timer_adjust_oneshot(c361_timer, attotime::never, 0);
1811      c361_timer->adjust(attotime::never);
18121812      return;
18131813   }
18141814   logerror("p3d_w %02x, %08x @ %08x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(space->cpu), (unsigned int)cpu_get_reg(space->cpu, MIPS3_R31));
r10326r10327
20412041static MACHINE_START( s23 )
20422042{
20432043   c361_timer = machine->scheduler().timer_alloc(FUNC(c361_timer_cb));
2044   timer_adjust_oneshot(c361_timer, attotime::never, 0);
2044   c361_timer->adjust(attotime::never);
20452045}
20462046
20472047static ADDRESS_MAP_START( gorgon_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mame/drivers/yunsung8.c
r10326r10327
102102   memory_set_bank(device->machine, "bank2", data & 0x07);
103103
104104   if (data != (data & (~0x27)))
105      logerror("%s: Bank %02X\n", cpuexec_describe_context(device->machine), data);
105      logerror("%s: Bank %02X\n", device->machine->describe_context(), data);
106106}
107107
108108static WRITE8_HANDLER( yunsung8_adpcm_w )
src/mame/drivers/spacefb.c
r10326r10327
141141   else
142142      next_vpos = SPACEFB_INT_TRIGGER_COUNT_1;
143143
144   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(next_vpos), 0);
144   interrupt_timer->adjust(machine->primary_screen->time_until_pos(next_vpos));
145145}
146146
147147
r10326r10327
153153
154154static void start_interrupt_timer(running_machine *machine)
155155{
156   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(SPACEFB_INT_TRIGGER_COUNT_1), 0);
156   interrupt_timer->adjust(machine->primary_screen->time_until_pos(SPACEFB_INT_TRIGGER_COUNT_1));
157157}
158158
159159
src/mame/drivers/seta.c
r10326r10327
13341334
13351335   if( max != 0 ) {
13361336      attotime period = attotime::from_hz(cputag_get_clock(machine, "maincpu")) * (16 * max);
1337      timer_adjust_oneshot( uPD71054->timer[no], period, no );
1337      uPD71054->timer[no]->adjust( period, no );
13381338   } else {
1339      timer_adjust_oneshot( uPD71054->timer[no], attotime::never, no);
1339      uPD71054->timer[no]->adjust( attotime::never, no);
13401340      logerror( "CPU #0 PC %06X: uPD71054 error, timer %d duration is 0\n",
13411341            (cpu != NULL) ? cpu_get_pc(cpu) : -1, no );
13421342   }
src/mame/drivers/naomi.c
r10326r10327
16521652   // non 32-bit accesses have not yet been seen here, we need to know when they are
16531653   if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
16541654   {
1655      mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine));
1655      mame_printf_verbose("%s:Wrong mask!\n", machine->describe_context());
16561656//      debugger_break(machine);
16571657   }
16581658
src/mame/drivers/stv.c
r10326r10327
587587            if(LOG_SMPC) logerror ("SMPC: Slave OFF\n");
588588            smpc_ram[0x5f]=0x03;
589589            stv_enable_slave_sh2 = 0;
590            cpuexec_trigger(space->machine, 1000);
590            space->machine->scheduler().trigger(1000);
591591            cputag_set_input_line(space->machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
592592            break;
593593         case 0x06:
r10326r10327
19691969static WRITE32_HANDLER( minit_w )
19701970{
19711971   logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->cpu->tag(), cpu_get_pc(space->cpu),data);
1972   cpuexec_boost_interleave(space->machine, minit_boost_timeslice, attotime::from_usec(minit_boost));
1973   cpuexec_trigger(space->machine, 1000);
1972   space->machine->scheduler().boost_interleave(minit_boost_timeslice, attotime::from_usec(minit_boost));
1973   space->machine->scheduler().trigger(1000);
19741974   sh2_set_frt_input(space->machine->device("slave"), PULSE_LINE);
19751975}
19761976
19771977static WRITE32_HANDLER( sinit_w )
19781978{
19791979   logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->cpu->tag(), cpu_get_pc(space->cpu),data);
1980   cpuexec_boost_interleave(space->machine, sinit_boost_timeslice, attotime::from_usec(sinit_boost));
1980   space->machine->scheduler().boost_interleave(sinit_boost_timeslice, attotime::from_usec(sinit_boost));
19811981   sh2_set_frt_input(space->machine->device("maincpu"), PULSE_LINE);
19821982}
19831983
r10326r10327
28482848   vblank_out_timer->adjust(machine->primary_screen->time_until_pos(0));
28492849   scan_timer->adjust(machine->primary_screen->time_until_pos(224, 352));
28502850
2851   timer_adjust_periodic(stv_rtc_timer, attotime::zero, 0, attotime::from_seconds(1));
2851   stv_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
28522852}
28532853
28542854
src/mame/drivers/gridlee.c
r10326r10327
123123{
124124   /* next interrupt after scanline 256 is scanline 64 */
125125   if (param == 256)
126        timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(64), 64);
126        irq_timer->adjust(machine->primary_screen->time_until_pos(64), 64);
127127   else
128        timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(param + 64), param + 64);
128        irq_timer->adjust(machine->primary_screen->time_until_pos(param + 64), param + 64);
129129
130130   /* IRQ starts on scanline 0, 64, 128, etc. */
131131   cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE);
132132
133133   /* it will turn off on the next HBLANK */
134    timer_adjust_oneshot(irq_off, machine->primary_screen->time_until_pos(param, BALSENTE_HBSTART), 0);
134    irq_off->adjust(machine->primary_screen->time_until_pos(param, BALSENTE_HBSTART));
135135}
136136
137137
r10326r10327
144144static TIMER_CALLBACK( firq_timer_tick )
145145{
146146   /* same time next frame */
147    timer_adjust_oneshot(firq_timer, machine->primary_screen->time_until_pos(FIRQ_SCANLINE), 0);
147    firq_timer->adjust(machine->primary_screen->time_until_pos(FIRQ_SCANLINE));
148148
149149   /* IRQ starts on scanline FIRQ_SCANLINE? */
150150   cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE);
151151
152152   /* it will turn off on the next HBLANK */
153    timer_adjust_oneshot(firq_off, machine->primary_screen->time_until_pos(FIRQ_SCANLINE, BALSENTE_HBSTART), 0);
153    firq_off->adjust(machine->primary_screen->time_until_pos(FIRQ_SCANLINE, BALSENTE_HBSTART));
154154}
155155
156156static MACHINE_START( gridlee )
r10326r10327
173173static MACHINE_RESET( gridlee )
174174{
175175   /* start timers to generate interrupts */
176    timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(0), 0);
177    timer_adjust_oneshot(firq_timer, machine->primary_screen->time_until_pos(FIRQ_SCANLINE), 0);
176    irq_timer->adjust(machine->primary_screen->time_until_pos(0));
177    firq_timer->adjust(machine->primary_screen->time_until_pos(FIRQ_SCANLINE));
178178}
179179
180180
src/mame/drivers/vmetal.c
r10326r10327
158158      es8712_set_bank_base(device, 0x000000);
159159
160160   if (data & 0xa0)
161      logerror("%s:Writing unknown bits %04x to $200000\n",cpuexec_describe_context(device->machine),data);
161      logerror("%s:Writing unknown bits %04x to $200000\n",device->machine->describe_context(),data);
162162}
163163
164164static WRITE8_DEVICE_HANDLER( vmetal_es8712_w )
r10326r10327
194194    */
195195
196196   es8712_w(device, offset, data);
197   logerror("%s:Writing %04x to ES8712 offset %02x\n", cpuexec_describe_context(device->machine), data, offset);
197   logerror("%s:Writing %04x to ES8712 offset %02x\n", device->machine->describe_context(), data, offset);
198198}
199199
200200
src/mame/drivers/missile.c
r10326r10327
427427      curv = ((curv + 32) & 0xff) & ~0x10;
428428
429429   /* next one at the start of this scanline */
430   timer_adjust_oneshot(state->irq_timer, machine->primary_screen->time_until_pos(v_to_scanline(state, curv), 0), curv);
430   state->irq_timer->adjust(machine->primary_screen->time_until_pos(v_to_scanline(state, curv)), curv);
431431}
432432
433433
r10326r10327
476476
477477   /* scanline for the next run */
478478   curv ^= 224;
479   timer_adjust_oneshot(state->cpu_timer, machine->primary_screen->time_until_pos(v_to_scanline(state, curv), 0), curv);
479   state->cpu_timer->adjust(machine->primary_screen->time_until_pos(v_to_scanline(state, curv)), curv);
480480}
481481
482482
r10326r10327
519519
520520   /* create a timer to speed/slow the CPU */
521521   state->cpu_timer = machine->scheduler().timer_alloc(FUNC(adjust_cpu_speed));
522   timer_adjust_oneshot(state->cpu_timer, machine->primary_screen->time_until_pos(v_to_scanline(state, 0), 0), 0);
522   state->cpu_timer->adjust(machine->primary_screen->time_until_pos(v_to_scanline(state, 0), 0));
523523
524524   /* create a timer for IRQs and set up the first callback */
525525   state->irq_timer = machine->scheduler().timer_alloc(FUNC(clock_irq));
src/mame/drivers/subsino2.c
r10326r10327
312312         sizes[0] = TILE_8x8;
313313         sizes[1] = TILE_8x8;
314314
315         logerror("%s: warning, unknown tilesize = %02x\n", cpuexec_describe_context(space->machine), data);
315         logerror("%s: warning, unknown tilesize = %02x\n", space->machine->describe_context(), data);
316316         popmessage("UNKNOWN TILESIZE %02X", data);
317317         break;
318318   }
r10326r10327
935935         sizes[0] = TILE_8x8;
936936         sizes[1] = TILE_8x8;
937937
938         logerror("%s: warning, unknown tilesize = %02x\n", cpuexec_describe_context(space->machine), data);
938         logerror("%s: warning, unknown tilesize = %02x\n", space->machine->describe_context(), data);
939939         popmessage("UNKNOWN TILESIZE %02X", data);
940940         break;
941941   }
src/mame/drivers/r2dtank.c
r10326r10327
142142       D5-D7 - not used */
143143   AY8910_selected = data;
144144
145if (LOG_AUDIO_COMM) logerror("%s:  CPU#1  AY8910_select_w: %x\n", cpuexec_describe_context(device->machine), data);
145if (LOG_AUDIO_COMM) logerror("%s:  CPU#1  AY8910_select_w: %x\n", device->machine->describe_context(), data);
146146}
147147
148148
src/mame/drivers/m72.c
r10326r10327
123123
124124static TIMER_CALLBACK( synch_callback )
125125{
126   //cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(8000000));
127   cpuexec_boost_interleave(machine, attotime::from_hz(MASTER_CLOCK/4/12), attotime::from_seconds(25));
126   //machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(8000000));
127   machine->scheduler().boost_interleave(attotime::from_hz(MASTER_CLOCK/4/12), attotime::from_seconds(25));
128128}
129129
130130static MACHINE_RESET( m72 )
r10326r10327
134134   state->mcu_sample_addr = 0;
135135   state->mcu_snd_cmd_latch = 0;
136136
137   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
137   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
138138   machine->scheduler().synchronize(FUNC(synch_callback));
139139}
140140
r10326r10327
142142{
143143   m72_state *state = machine->driver_data<m72_state>();
144144   state->irq_base = 0x08;
145   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
145   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
146146}
147147
148148static MACHINE_RESET( kengo )
149149{
150150   m72_state *state = machine->driver_data<m72_state>();
151   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
151   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
152152}
153153
154154static TIMER_CALLBACK( m72_scanline_interrupt )
r10326r10327
173173   /* adjust for next scanline */
174174   if (++scanline >= machine->primary_screen->height())
175175      scanline = 0;
176   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
176   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
177177}
178178
179179static TIMER_CALLBACK( kengo_scanline_interrupt )
r10326r10327
202202   /* adjust for next scanline */
203203   if (++scanline >= machine->primary_screen->height())
204204      scanline = 0;
205   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
205   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
206206}
207207
208208/***************************************************************************
src/mame/drivers/fantland.c
r10326r10327
317317   msm5205_reset_w(device, 0);
318318   state->adpcm_playing[voice] = 1;
319319   state->adpcm_nibble[voice] = 0;
320//  logerror("%s: adpcm start = %06x, stop = %06x\n", cpuexec_describe_context(device->machine), state->adpcm_addr[0][voice], state->adpcm_addr[1][voice]);
320//  logerror("%s: adpcm start = %06x, stop = %06x\n", device->machine->describe_context(), state->adpcm_addr[0][voice], state->adpcm_addr[1][voice]);
321321}
322322
323323static void borntofi_adpcm_stop( device_t *device, int voice )
src/mame/drivers/runaway.c
r10326r10327
3030   if (scanline >= 263)
3131      scanline = 16;
3232
33   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
33   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
3434}
3535
3636static MACHINE_START( runaway )
r10326r10327
4242static MACHINE_RESET( runaway )
4343{
4444   runaway_state *state = machine->driver_data<runaway_state>();
45   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(16), 16);
45   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(16), 16);
4646}
4747
4848
src/mame/drivers/tumbleb.c
r10326r10327
785785      soundlatch_w(space, 0, data & 0xff);
786786      // needed for Super Trio which reads the sound with polling
787787      // cpu_spinuntil_time(space->cpu, attotime::from_usec(100));
788      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(20));
788      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
789789
790790   }
791791}
src/mame/drivers/superqix.c
r10326r10327
385385   state->from_z80 = param;
386386   state->from_mcu_pending = 0;
387387   cputag_set_input_line(machine, "mcu", 0, HOLD_LINE);
388   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(200));
388   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(200));
389389}
390390
391391static TIMER_CALLBACK( delayed_mcu_z80_w )
src/mame/drivers/lockon.c
r10326r10327
532532   MCFG_CPU_PROGRAM_MAP(sound_prg)
533533   MCFG_CPU_IO_MAP(sound_io)
534534
535   MCFG_WATCHDOG_TIME_INIT(attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(10000, 4700, 10000e-12) * 4096))
535   MCFG_WATCHDOG_TIME_INIT(PERIOD_OF_555_ASTABLE(10000, 4700, 10000e-12) * 4096)
536536   MCFG_QUANTUM_TIME(attotime::from_hz(600))
537537
538538   MCFG_MACHINE_START(lockon)
src/mame/drivers/gijoe.c
r10326r10327
131131      gijoe_objdma(device->machine);
132132
133133      // 42.7us(clr) + 341.3us(xfer) delay at 6Mhz dotclock
134      timer_adjust_oneshot(state->dmadelay_timer, JOE_DMADELAY, 0);
134      state->dmadelay_timer->adjust(JOE_DMADELAY);
135135   }
136136
137137   // trigger V-blank interrupt
src/mame/drivers/astinvad.c
r10326r10327
216216   /* interrupts are asserted on every state change of the 128V line */
217217   cpu_set_input_line(state->maincpu, 0, ASSERT_LINE);
218218   param ^= 128;
219   timer_adjust_oneshot(state->int_timer, machine->primary_screen->time_until_pos(param), param);
219   state->int_timer->adjust(machine->primary_screen->time_until_pos(param), param);
220220
221221   /* an RC circuit turns the interrupt off after a short amount of time */
222222   machine->scheduler().timer_set(attotime::from_double(300 * 0.1e-6), FUNC(kamikaze_int_off));
r10326r10327
233233   state->samples = machine->device("samples");
234234
235235   state->int_timer = machine->scheduler().timer_alloc(FUNC(kamizake_int_gen));
236   timer_adjust_oneshot(state->int_timer, machine->primary_screen->time_until_pos(128), 128);
236   state->int_timer->adjust(machine->primary_screen->time_until_pos(128), 128);
237237
238238   state_save_register_global(machine, state->screen_flip);
239239   state_save_register_global(machine, state->screen_red);
src/mame/drivers/eolithsp.c
r10326r10327
2121{
2222   /* for debug */
2323  //if ((cpu_get_pc(space->cpu)!=eolith_speedup_address) && (eolith_vblank!=1) )
24  //    printf("%s:eolith speedup_read data %02x\n",cpuexec_describe_context(space->machine), eolith_vblank);
24  //    printf("%s:eolith speedup_read data %02x\n",space->machine->describe_context(), eolith_vblank);
2525
2626   if (cpu_get_pc(space->cpu)==eolith_speedup_address && eolith_vblank==0 && eolith_scanline < eolith_speedup_resume_scanline)
2727   {
r10326r10327
9090
9191   if (eolith_scanline==eolith_speedup_resume_scanline)
9292   {
93      cpuexec_trigger(device->machine, 1000);
93      device->machine->scheduler().trigger(1000);
9494   }
9595
9696   if (eolith_scanline==240)
src/mame/drivers/halleys.c
r10326r10327
312312
313313#if HALLEYS_DEBUG
314314if (0) {
315   logerror("%s:[%04x]", cpuexec_describe_context(machine), offset);
315   logerror("%s:[%04x]", machine->describe_context(), offset);
316316   for (ecx=0; ecx<16; ecx++) logerror(" %02x", param[ecx]);
317317   logerror("\n");
318318}
r10326r10327
10141014      else
10151015      {
10161016         blitter_busy = 1;
1017         timer_adjust_oneshot(blitter_reset_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100), 0); // free blitter if no updates in 100 cycles
1017         blitter_reset_timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100)); // free blitter if no updates in 100 cycles
10181018      }
10191019   }
10201020}
src/mame/drivers/mustache.c
r10326r10327
177177{
178178   mustache_state *state = device->machine->driver_data<mustache_state>();
179179   cpu_set_input_line(device, 0, ASSERT_LINE);
180    timer_adjust_oneshot(state->clear_irq_timer, downcast<cpu_device *>(device)->cycles_to_attotime(14288), 0);
180    state->clear_irq_timer->adjust(downcast<cpu_device *>(device)->cycles_to_attotime(14288));
181181       /* Timing here is an educated GUESS, Z80 /INT must stay high so the irq
182182          fires no less than TWICE per frame, else game doesn't work right.
183183      6000000 / 56.747 = 105732.4616 cycles per frame, we'll call it A
src/mame/drivers/segas16a.c
r10326r10327
473473
474474   cpu_set_input_line(state->n7751, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
475475   cpu_set_input_line(state->n7751, 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
476   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(100));
476   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
477477}
478478
479479
r10326r10327
887887      segaic16_set_display_enable(space->machine, 1);
888888
889889   if ((state->mcu_control ^ data) & 0x40)
890      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(10));
890      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
891891
892892   state->mcu_control = data;
893893}
r10326r10327
991991   cpu_set_input_line(device, MCS51_INT0_LINE, CLEAR_LINE);
992992
993993   /* boost interleave to ensure that the MCU can break the M68000 out of a STOP */
994   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(100));
994   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
995995}
996996
997997
src/mame/drivers/neogeo.c
r10326r10327
248248      attotime period = attotime::from_hz(NEOGEO_PIXEL_CLOCK) * (state->display_counter + 1);
249249      if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer  current y: %02x  current x: %02x   target y: %x  target x: %x\n", machine->primary_screen->vpos(), machine->primary_screen->hpos(), (state->display_counter + 1) / NEOGEO_HTOTAL, (state->display_counter + 1) % NEOGEO_HTOTAL);
250250
251      timer_adjust_oneshot(state->display_position_interrupt_timer, period, 0);
251      state->display_position_interrupt_timer->adjust(period);
252252   }
253253}
254254
r10326r10327
344344   }
345345
346346   /* set timer for next screen */
347   timer_adjust_oneshot(state->display_position_vblank_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0);
347   state->display_position_vblank_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS));
348348}
349349
350350
r10326r10327
362362   update_interrupts(machine);
363363
364364   /* set timer for next screen */
365   timer_adjust_oneshot(state->vblank_interrupt_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART), 0);
365   state->vblank_interrupt_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART));
366366}
367367
368368
r10326r10327
378378static void start_interrupt_timers( running_machine *machine )
379379{
380380   neogeo_state *state = machine->driver_data<neogeo_state>();
381   timer_adjust_oneshot(state->vblank_interrupt_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART), 0);
382   timer_adjust_oneshot(state->display_position_vblank_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0);
381   state->vblank_interrupt_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART));
382   state->display_position_vblank_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS));
383383}
384384
385385
r10326r10327
646646      audio_cpu_assert_nmi(space->machine);
647647
648648      /* boost the interleave to let the audio CPU read the command */
649      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(50));
649      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
650650
651651      if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(space->cpu), data, mem_mask);
652652   }
r10326r10327
10231023      state->led2_value = ~state->output_data;
10241024
10251025   if (falling_bits & 0xc7)
1026      logerror("%s  Unmaped LED write.  Data: %x\n", cpuexec_describe_context(machine), falling_bits);
1026      logerror("%s  Unmaped LED write.  Data: %x\n", machine->describe_context(), falling_bits);
10271027
10281028   state->output_latch = data;
10291029
src/mame/drivers/statriv2.c
r10326r10327
11091109   UINT8 result = 0x00;
11101110   if (offset == 1)
11111111      result = 0x18;
1112   mame_printf_debug("%s:ld read ($%02X) = %02X\n", cpuexec_describe_context(space->machine), 0x28 + offset, result);
1112   mame_printf_debug("%s:ld read ($%02X) = %02X\n", space->machine->describe_context(), 0x28 + offset, result);
11131113   return result;
11141114}
11151115
11161116static WRITE8_HANDLER( laserdisc_io_w )
11171117{
1118   mame_printf_debug("%s:ld write ($%02X) = %02X\n", cpuexec_describe_context(space->machine), 0x28 + offset, data);
1118   mame_printf_debug("%s:ld write ($%02X) = %02X\n", space->machine->describe_context(), 0x28 + offset, data);
11191119}
11201120
11211121static DRIVER_INIT( laserdisc )
src/mame/drivers/gottlieb.c
r10326r10327
309309{
310310   /* if we have a laserdisc, reset our philips code callback for the next line 17 */
311311   if (laserdisc != NULL)
312      timer_adjust_oneshot(laserdisc_philips_timer, machine->primary_screen->time_until_pos(17), 17);
312      laserdisc_philips_timer->adjust(machine->primary_screen->time_until_pos(17), 17);
313313}
314314
315315
r10326r10327
438438       a sequence of events that sends serial data to the player */
439439
440440   /* set a timer to clock the bits through; a total of 12 bits are clocked */
441   timer_adjust_oneshot(laserdisc_bit_timer, LASERDISC_CLOCK * 10, (12 << 16) | data);
441   laserdisc_bit_timer->adjust(LASERDISC_CLOCK * 10, (12 << 16) | data);
442442
443443   /* it also clears bit 4 of the status (will be set when transmission is complete) */
444444   laserdisc_status &= ~0x10;
r10326r10327
468468
469469   /* toggle to the next one */
470470   param = (param == 17) ? 18 : 17;
471   timer_adjust_oneshot(laserdisc_philips_timer, machine->primary_screen->time_until_pos(param * 2), param);
471   laserdisc_philips_timer->adjust(machine->primary_screen->time_until_pos(param * 2), param);
472472}
473473
474474
r10326r10327
499499
500500   /* if we're not out of bits, set a timer for the next one; else set the ready bit */
501501   if (bitsleft-- != 0)
502      timer_adjust_oneshot(laserdisc_bit_timer, duration, (bitsleft << 16) | data);
502      laserdisc_bit_timer->adjust(duration, (bitsleft << 16) | data);
503503   else
504504      laserdisc_status |= 0x10;
505505}
src/mame/drivers/moo.c
r10326r10327
134134      moo_objdma(device->machine, state->game_type);
135135
136136      // schedule DMA end interrupt (delay shortened to catch up with V-blank)
137        timer_adjust_oneshot(state->dmaend_timer, attotime::from_usec(MOO_DMADELAY), 0);
137        state->dmaend_timer->adjust(attotime::from_usec(MOO_DMADELAY));
138138   }
139139
140140   // trigger V-blank interrupt
r10326r10327
148148   moo_objdma(device->machine, state->game_type);
149149
150150   // schedule DMA end interrupt (delay shortened to catch up with V-blank)
151    timer_adjust_oneshot(state->dmaend_timer, attotime::from_usec(MOO_DMADELAY), 0);
151    state->dmaend_timer->adjust(attotime::from_usec(MOO_DMADELAY));
152152
153153   // trigger V-blank interrupt
154154   cpu_set_input_line(device, 5, HOLD_LINE);
src/mame/drivers/taito_l.c
r10326r10327
9696
9797   if (addr > 0x200)
9898   {
99      logerror("%s:Large palette ? %03x\n", cpuexec_describe_context(machine), addr);
99      logerror("%s:Large palette ? %03x\n", machine->describe_context(), addr);
100100   }
101101   else
102102   {
src/mame/drivers/tickee.c
r10326r10327
9292   int beamx, beamy;
9393
9494   /* set a timer to do this again next frame */
95   timer_adjust_oneshot(setup_gun_timer, machine->primary_screen->time_until_pos(0), 0);
95   setup_gun_timer->adjust(machine->primary_screen->time_until_pos(0));
9696
9797   /* only do work if the palette is flashed */
9898   if (tickee_control)
r10326r10327
122122{
123123   /* start a timer going on the first scanline of every frame */
124124   setup_gun_timer = machine->scheduler().timer_alloc(FUNC(setup_gun_interrupts));
125   timer_adjust_oneshot(setup_gun_timer, machine->primary_screen->time_until_pos(0), 0);
125   setup_gun_timer->adjust(machine->primary_screen->time_until_pos(0));
126126}
127127
128128
src/mame/drivers/m92.c
r10326r10327
241241static MACHINE_RESET( m92 )
242242{
243243   m92_state *state = machine->driver_data<m92_state>();
244   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
244   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
245245}
246246
247247/*****************************************************************************/
r10326r10327
268268   /* adjust for next scanline */
269269   if (++scanline >= machine->primary_screen->height())
270270      scanline = 0;
271   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
271   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
272272}
273273
274274/*****************************************************************************/
src/mame/drivers/fuukifg2.c
r10326r10327
6060   {
6161      const rectangle &visarea = space->machine->primary_screen->visible_area();
6262      attotime period = space->machine->primary_screen->frame_period();
63      timer_adjust_periodic(state->raster_interrupt_timer, space->machine->primary_screen->time_until_pos(new_data, visarea.max_x + 1), 0, period);
63      state->raster_interrupt_timer->adjust(space->machine->primary_screen->time_until_pos(new_data, visarea.max_x + 1), 0, period);
6464   }
6565}
6666
r10326r10327
7272      soundlatch_w(space,0,data & 0xff);
7373      cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
7474//      cpu_spinuntil_time(space->cpu, attotime::from_usec(50));   // Allow the other CPU to reply
75      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(50)); // Fixes glitching in rasters
75      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); // Fixes glitching in rasters
7676   }
7777}
7878
r10326r10327
418418   fuuki16_state *state = machine->driver_data<fuuki16_state>();
419419   cpu_set_input_line(state->maincpu, 5, HOLD_LINE);   // Raster Line IRQ
420420   machine->primary_screen->update_partial(machine->primary_screen->vpos());
421   timer_adjust_oneshot(state->raster_interrupt_timer, machine->primary_screen->frame_period(), 0);
421   state->raster_interrupt_timer->adjust(machine->primary_screen->frame_period());
422422}
423423
424424
r10326r10327
443443
444444   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(248), FUNC(level_1_interrupt_callback));
445445   machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_start(), FUNC(vblank_interrupt_callback));
446   timer_adjust_oneshot(state->raster_interrupt_timer, machine->primary_screen->time_until_pos(0, visarea.max_x + 1), 0);
446   state->raster_interrupt_timer->adjust(machine->primary_screen->time_until_pos(0, visarea.max_x + 1));
447447}
448448
449449
src/mame/drivers/39in1.c
r10326r10327
9595      va_start( v, s_fmt );
9696      vsprintf( buf, s_fmt, v );
9797      va_end( v );
98      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
99      //printf( "%s: %s", cpuexec_describe_context(machine), buf );
98      logerror( "%s: %s", machine->describe_context(), buf );
99      //printf( "%s: %s", machine->describe_context(), buf );
100100   }
101101}
102102
r10326r10327
253253
254254   // Shut down any transfers that are currently going on, software should be smart enough to check if a
255255   // transfer is running before starting another one on the same channel.
256   if (timer_enabled(dma_regs->timer[channel]))
256   if (dma_regs->timer[channel]->enabled())
257257   {
258      timer_adjust_oneshot(dma_regs->timer[channel], attotime::never, 0);
258      dma_regs->timer[channel]->adjust(attotime::never);
259259   }
260260
261261   // Load the next descriptor
r10326r10327
277277         break;
278278   }
279279
280   timer_adjust_oneshot(dma_regs->timer[channel], period, channel);
280   dma_regs->timer[channel]->adjust(period, channel);
281281
282282   // Interrupt as necessary
283283   if(dma_regs->dcmd[channel] & PXA255_DCMD_STARTIRQEN)
r10326r10327
627627            attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[0] - ostimer_regs->oscr);
628628
629629            //printf( "Adjusting one-shot timer to 200MHz * %08x\n", ostimer_regs->osmr[0]);
630            timer_adjust_oneshot(ostimer_regs->timer[0], period, 0);
630            ostimer_regs->timer[0]->adjust(period);
631631         }
632632         break;
633633      case PXA255_OSMR1:
r10326r10327
637637         {
638638            attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[1] - ostimer_regs->oscr);
639639
640            timer_adjust_oneshot(ostimer_regs->timer[1], period, 1);
640            ostimer_regs->timer[1]->adjust(period, 1);
641641         }
642642         break;
643643      case PXA255_OSMR2:
r10326r10327
647647         {
648648            attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[2] - ostimer_regs->oscr);
649649
650            timer_adjust_oneshot(ostimer_regs->timer[2], period, 2);
650            ostimer_regs->timer[2]->adjust(period, 2);
651651         }
652652         break;
653653      case PXA255_OSMR3:
r10326r10327
657657         {
658658            //attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[3] - ostimer_regs->oscr);
659659
660            //timer_adjust_oneshot(ostimer_regs->timer[3], period, 3);
660            //ostimer_regs->timer[3]->adjust(period, 3);
661661         }
662662         break;
663663      case PXA255_OSCR:
r10326r10327
684684            {
685685               //attotime period = attotime::from_hz(200000000) * ostimer_regs->osmr[index];
686686
687               //timer_adjust_oneshot(ostimer_regs->timer[index], period, index);
687               //ostimer_regs->timer[index]->adjust(period, index);
688688            }
689689         }
690690
r10326r10327
10901090   {
10911091      attotime period = attotime::from_hz(20000000) * (lcd_regs->dma[channel].ldcmd & 0x000fffff);
10921092
1093      timer_adjust_oneshot(lcd_regs->dma[channel].eof, period, channel);
1093      lcd_regs->dma[channel].eof->adjust(period, channel);
10941094
10951095      if(lcd_regs->dma[channel].ldcmd & PXA255_LDCMD_SOFINT)
10961096      {
r10326r10327
12631263      case PXA255_FBR0:      // 0x44000020
12641264         verboselog( space->machine, 4l, "pxa255_lcd_w: LCD Frame Branch Register 0: %08x & %08x\n", data, mem_mask );
12651265         lcd_regs->fbr[0] = data & 0xfffffff3;
1266         if(!timer_enabled(lcd_regs->dma[0].eof))
1266         if(!lcd_regs->dma[0].eof->enabled())
12671267         {
12681268            if (0) verboselog( space->machine, 3, "ch0 EOF timer is not enabled, taking branch now\n" );
12691269            pxa255_lcd_check_load_next_branch(space->machine, 0);
r10326r10327
12731273      case PXA255_FBR1:      // 0x44000024
12741274         verboselog( space->machine, 3, "pxa255_lcd_w: LCD Frame Branch Register 1: %08x & %08x\n", data, mem_mask );
12751275         lcd_regs->fbr[1] = data & 0xfffffff3;
1276         if(!timer_enabled(lcd_regs->dma[1].eof))
1276         if(!lcd_regs->dma[1].eof->enabled())
12771277         {
12781278            verboselog( space->machine, 3, "ch1 EOF timer is not enabled, taking branch now\n" );
12791279            pxa255_lcd_check_load_next_branch(space->machine, 1);
r10326r10327
12981298         break;
12991299      case PXA255_FDADR0:      // 0x44000200
13001300         verboselog( space->machine, 4, "pxa255_lcd_w: LCD DMA Frame Descriptor Address Register 0: %08x & %08x\n", data, mem_mask );
1301         if(!timer_enabled(lcd_regs->dma[0].eof))
1301         if(!lcd_regs->dma[0].eof->enabled())
13021302         {
13031303            pxa255_lcd_load_dma_descriptor(space, data & 0xfffffff0, 0);
13041304         }
r10326r10327
13191319         break;
13201320      case PXA255_FDADR1:      // 0x44000210
13211321         verboselog( space->machine, 4, "pxa255_lcd_w: LCD DMA Frame Descriptor Address Register 1: %08x & %08x\n", data, mem_mask );
1322         if(!timer_enabled(lcd_regs->dma[1].eof))
1322         if(!lcd_regs->dma[1].eof->enabled())
13231323         {
13241324            pxa255_lcd_load_dma_descriptor(space, data & 0xfffffff0, 1);
13251325         }
src/mame/drivers/fortecar.c
r10326r10327
7070
7171static READ8_DEVICE_HANDLER( ppi0_portc_r )
7272{
73//  popmessage("%s",cpuexec_describe_context(device->machine));
73//  popmessage("%s",device->machine->describe_context());
7474   return (~(eeprom_read_bit(device)<<1) & 2);
7575}
7676
src/mame/drivers/guab.c
r10326r10327
341341
342342   if (more_data)
343343   {
344      timer_adjust_oneshot(fdc_timer, attotime::from_usec(USEC_DELAY), 0);
344      fdc_timer->adjust(attotime::from_usec(USEC_DELAY));
345345   }
346346   else
347347   {
r10326r10327
426426                                             fdc.sector));
427427
428428               /* Set the data read timer */
429               timer_adjust_oneshot(fdc_timer, attotime::from_usec(USEC_DELAY), 0);
429               fdc_timer->adjust(attotime::from_usec(USEC_DELAY));
430430
431431               break;
432432            }
r10326r10327
463463            case 13:
464464            {
465465               /* Stop any operation in progress */
466               timer_reset(fdc_timer, attotime::never);
466               fdc_timer->reset();
467467               fdc.status &= ~BUSY;
468468               FDC_LOG(("Force Interrupt\n"));
469469               break;
r10326r10327
494494
495495         /* Queue an event to write the data if write command was specified */
496496         if (fdc.cmd & 0x20)
497            timer_adjust_oneshot(fdc_timer, attotime::from_usec(USEC_DELAY), 0);
497            fdc_timer->adjust(attotime::from_usec(USEC_DELAY));
498498
499499         break;
500500      }
src/mame/drivers/beaminv.c
r10326r10327
103103   next_interrupt_number = (interrupt_number + 1) % INTERRUPTS_PER_FRAME;
104104   next_vpos = interrupt_lines[next_interrupt_number];
105105
106   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(next_vpos), next_interrupt_number);
106   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(next_vpos), next_interrupt_number);
107107}
108108
109109
r10326r10327
118118{
119119   beaminv_state *state = machine->driver_data<beaminv_state>();
120120   int vpos = interrupt_lines[0];
121   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(vpos), 0);
121   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(vpos));
122122}
123123
124124
src/mame/drivers/cloud9.c
r10326r10327
118118   curscanline = (curscanline + 64) & 255;
119119
120120   /* next one at the start of this scanline */
121   timer_adjust_oneshot(state->irq_timer, machine->primary_screen->time_until_pos(curscanline), curscanline);
121   state->irq_timer->adjust(machine->primary_screen->time_until_pos(curscanline), curscanline);
122122}
123123
124124
src/mame/drivers/backfire.c
r10326r10327
242242
243243static WRITE32_DEVICE_HANDLER(backfire_eeprom_w)
244244{
245   logerror("%s:write eprom %08x (%08x) %08x\n",cpuexec_describe_context(device->machine),offset<<1,mem_mask,data);
245   logerror("%s:write eprom %08x (%08x) %08x\n",device->machine->describe_context(),offset<<1,mem_mask,data);
246246   if (ACCESSING_BITS_0_7)
247247   {
248248      eeprom_set_clock_line(device, BIT(data, 1) ? ASSERT_LINE : CLEAR_LINE);
src/mame/drivers/segas18.c
r10326r10327
205205
206206static TIMER_CALLBACK( boost_interleave )
207207{
208   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_msec(10));
208   machine->scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
209209}
210210
211211
src/mame/drivers/nitedrvr.c
r10326r10327
145145   MCFG_MACHINE_START(nitedrvr)
146146   MCFG_MACHINE_RESET(nitedrvr)
147147
148   MCFG_TIMER_ADD_PERIODIC("crash_timer", nitedrvr_crash_toggle_callback, attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(RES_K(180), 330, CAP_U(1))))
148   MCFG_TIMER_ADD_PERIODIC("crash_timer", nitedrvr_crash_toggle_callback, PERIOD_OF_555_ASTABLE(RES_K(180), 330, CAP_U(1)))
149149
150150   /* video hardware */
151151   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/crystal.c
r10326r10327
290290      attotime period = attotime::from_hz(43000000) * ((PD + 1) * (TCV + 1));
291291
292292      if (state->Timerctrl[which] & 2)
293         timer_adjust_periodic(state->Timer[which], period, 0, period);
293         state->Timer[which]->adjust(period, 0, period);
294294      else
295         timer_adjust_oneshot(state->Timer[which], period, 0);
295         state->Timer[which]->adjust(period);
296296   }
297297   COMBINE_DATA(&state->Timerctrl[which]);
298298}
r10326r10327
609609   for (i = 0; i < 4; i++)
610610   {
611611      state->Timerctrl[i] = 0;
612      timer_adjust_oneshot(state->Timer[i], attotime::never, 0);
612      state->Timer[i]->adjust(attotime::never);
613613   }
614614
615615   vr0_snd_set_areas(machine->device("vrender"), state->textureram, state->frameram);
src/mame/drivers/lgp.c
r10326r10327
329329
330330   // IRQ
331331   cpu_set_input_line(device, 0, ASSERT_LINE);
332   timer_adjust_oneshot(irq_timer, attotime::from_usec(50), 0);
332   irq_timer->adjust(attotime::from_usec(50));
333333}
334334
335335
src/mame/drivers/cliffhgr.c
r10326r10327
204204      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
205205   }
206206
207   timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(param * 2), param);
207   irq_timer->adjust(machine->primary_screen->time_until_pos(param * 2), param);
208208}
209209
210210static void vdp_interrupt(running_machine *machine, int state)
r10326r10327
224224{
225225   port_bank = 0;
226226   phillips_code = 0;
227   timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(17), 17);
227   irq_timer->adjust(machine->primary_screen->time_until_pos(17), 17);
228228}
229229
230230/********************************************************/
src/mame/drivers/galpani2.c
r10326r10327
7777
7878   kaneko16_sprite_xoffs = 0x10000 - 0x16c0 + 0xc00;
7979   kaneko16_sprite_yoffs = 0x000;
80   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(50)); //initial mcu xchk
80   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); //initial mcu xchk
8181}
8282
8383static void galpani2_write_kaneko(device_t *device)
r10326r10327
143143      if (mcu_command != 0)
144144      {
145145         logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n",
146         cpuexec_describe_context(machine),
146         machine->describe_context(),
147147         mcu_list,
148148         srcspace->read_byte(0x100020),
149149         mcu_command,
r10326r10327
166166
167167         mcu_size   =   (srcspace->read_byte(mcu_address + 8)<<8) +
168168                     (srcspace->read_byte(mcu_address + 9)<<0) ;
169         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",cpuexec_describe_context(machine),mcu_command,mcu_src,mcu_size,mcu_dst);
169         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine->describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
170170
171171         for( ; mcu_size > 0 ; mcu_size-- )
172172         {
r10326r10327
191191         mcu_size   =   (srcspace->read_byte(mcu_address + 8)<<8) +
192192                     (srcspace->read_byte(mcu_address + 9)<<0) ;
193193
194         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",cpuexec_describe_context(machine),mcu_command,mcu_src,mcu_size,mcu_dst);
194         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine->describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
195195
196196         for( ; mcu_size > 0 ; mcu_size-- )
197197         {
r10326r10327
219219         srcspace->write_byte(mcu_address+0,0xff);
220220         srcspace->write_byte(mcu_address+1,0xff);
221221
222         logerror("%s : MCU ERROR, unknown command $%02X\n",cpuexec_describe_context(machine),mcu_command);
222         logerror("%s : MCU ERROR, unknown command $%02X\n",machine->describe_context(),mcu_command);
223223      }
224224
225225      /* Erase command (so that it won't be processed again)? */
r10326r10327
230230static void galpani2_mcu_nmi2(running_machine *machine)
231231{
232232      galpani2_write_kaneko(machine->device("maincpu"));
233      //logerror("%s : MCU executes CHECKs synchro\n", cpuexec_describe_context(machine));
233      //logerror("%s : MCU executes CHECKs synchro\n", machine->describe_context());
234234}
235235
236236static WRITE8_HANDLER( galpani2_mcu_nmi1_w ) //driven by CPU1's int5 ISR
r10326r10327
276276static WRITE8_DEVICE_HANDLER( galpani2_oki1_bank_w )
277277{
278278      UINT8 *ROM = device->machine->region("oki1")->base();
279      logerror("%s : %s bank %08X\n",cpuexec_describe_context(device->machine),device->tag(),data);
279      logerror("%s : %s bank %08X\n",device->machine->describe_context(),device->tag(),data);
280280      memcpy(ROM + 0x30000, ROM + 0x40000 + 0x10000 * (~data & 0xf), 0x10000);
281281}
282282
r10326r10327
284284{
285285      okim6295_device *oki = downcast<okim6295_device *>(device);
286286      oki->set_bank_base(0x40000 * (data & 0xf) );
287      logerror("%s : %s bank %08X\n",cpuexec_describe_context(device->machine),device->tag(),data);
287      logerror("%s : %s bank %08X\n",device->machine->describe_context(),device->tag(),data);
288288}
289289
290290
src/mame/drivers/coolpool.c
r10326r10327
477477   cputag_set_input_line(machine, "dsp", 0, HOLD_LINE);   /* ???  I have no idea who should generate this! */
478478                                             /* the DSP polls the status bit so it isn't strictly */
479479                                             /* necessary to also have an IRQ */
480   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(50));
480   machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
481481}
482482
483483
src/mame/drivers/system1.c
r10326r10327
514514{
515515   /* boost interleave when communicating with the sound CPU */
516516   soundlatch_w(space, 0, data);
517   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(100));
517   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
518518}
519519
520520
r10326r10327
598598   cpu_set_input_line(device, MCS51_INT0_LINE, CLEAR_LINE);
599599
600600   /* boost interleave to ensure that the MCU can break the Z80 out of a HALT */
601   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(10));
601   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
602602}
603603
604604
r10326r10327
655655{
656656   nob_maincpu_latch = data;
657657   cputag_set_input_line(space->machine, "mcu", MCS51_INT0_LINE, ASSERT_LINE);
658   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(100));
658   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
659659}
660660
661661
src/mame/drivers/niyanpai.c
r10326r10327
107107         break;
108108
109109      default:
110         logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset);
110         logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", space->machine->describe_context(), offset);
111111         portdata = 0xff;
112112         break;
113113   }
r10326r10327
135135         break;
136136
137137      default:
138         logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data);
138         logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", space->machine->describe_context(), offset, data);
139139         break;
140140   }
141141}
src/mame/drivers/namcofl.c
r10326r10327
216216      UINT16 v = space->machine->generic.paletteram.u32[offset] >> 16;
217217      UINT16 triggerscanline=(((v>>8)&0xff)|((v&0xff)<<8))-(32+1);
218218
219      timer_adjust_oneshot(raster_interrupt_timer, space->machine->primary_screen->time_until_pos(triggerscanline), 0);
219      raster_interrupt_timer->adjust(space->machine->primary_screen->time_until_pos(triggerscanline));
220220   }
221221}
222222
r10326r10327
550550{
551551   machine->primary_screen->update_partial(machine->primary_screen->vpos());
552552   cputag_set_input_line(machine, "maincpu", I960_IRQ1, ASSERT_LINE);
553   timer_adjust_oneshot(raster_interrupt_timer, machine->primary_screen->frame_period(), 0);
553   raster_interrupt_timer->adjust(machine->primary_screen->frame_period());
554554}
555555
556556static INTERRUPT_GEN( mcu_interrupt )
src/mame/drivers/dynax.c
r10326r10327
11501150   if (!BIT(state->dsw_sel, 2))   return input_port_read(device->machine, "DSW2");
11511151   if (!BIT(state->dsw_sel, 3))   return input_port_read(device->machine, "DSW3");
11521152   if (!BIT(state->dsw_sel, 4))   return input_port_read(device->machine, "DSW4");
1153   logerror("%s: warning, unknown bits read, dsw_sel = %02x\n", cpuexec_describe_context(device->machine), state->dsw_sel);
1153   logerror("%s: warning, unknown bits read, dsw_sel = %02x\n", device->machine->describe_context(), state->dsw_sel);
11541154
11551155   return 0xff;
11561156}
r10326r10327
13751375   if (!BIT(state->dsw_sel, 2)) return input_port_read(device->machine, "DSW2");
13761376   if (!BIT(state->dsw_sel, 3)) return input_port_read(device->machine, "DSW3");
13771377   if (!BIT(state->dsw_sel, 4)) return input_port_read(device->machine, "DSW4");
1378   logerror("%s: unmapped dsw %02x read\n", cpuexec_describe_context(device->machine), state->dsw_sel);
1378   logerror("%s: unmapped dsw %02x read\n", device->machine->describe_context(), state->dsw_sel);
13791379
13801380   return 0xff;
13811381}
src/mame/drivers/sigmab98.c
r10326r10327
180180      case 0x1f:
181181         rombank = data;
182182         if (data >= 0x18)
183            logerror("%s: unknown rom bank = %02x\n", cpuexec_describe_context(space->machine), data);
183            logerror("%s: unknown rom bank = %02x\n", space->machine->describe_context(), data);
184184         else
185185            memory_set_bank(space->machine, "rombank", data);
186186         break;
187187
188188      default:
189         logerror("%s: unknown reg written: %02x = %02x\n", cpuexec_describe_context(space->machine), reg, data);
189         logerror("%s: unknown reg written: %02x = %02x\n", space->machine->describe_context(), reg, data);
190190   }
191191}
192192static READ8_HANDLER( regs_r )
r10326r10327
200200         return rombank;
201201
202202      default:
203         logerror("%s: unknown reg read: %02x\n", cpuexec_describe_context(space->machine), reg);
203         logerror("%s: unknown reg read: %02x\n", space->machine->describe_context(), reg);
204204         return 0x00;
205205   }
206206}
r10326r10327
227227               memory_set_bank(space->machine, "rambank", 1);
228228               break;
229229            default:
230               logerror("%s: unknown ram bank = %02x\n", cpuexec_describe_context(space->machine), data);
230               logerror("%s: unknown ram bank = %02x\n", space->machine->describe_context(), data);
231231         }
232232         break;
233233
234234      default:
235         logerror("%s: unknown reg2 written: %02x = %02x\n", cpuexec_describe_context(space->machine), reg2, data);
235         logerror("%s: unknown reg2 written: %02x = %02x\n", space->machine->describe_context(), reg2, data);
236236   }
237237}
238238static READ8_HANDLER( regs2_r )
r10326r10327
246246         return rambank;
247247
248248      default:
249         logerror("%s: unknown reg2 read: %02x\n", cpuexec_describe_context(space->machine), reg2);
249         logerror("%s: unknown reg2 read: %02x\n", space->machine->describe_context(), reg2);
250250         return 0x00;
251251   }
252252}
src/mame/drivers/dribling.c
r10326r10327
105105   /* bit 1 = (10) = PC1 */
106106   /* bit 0 = (32) = PC0 */
107107   state->input_mux = data & 7;
108   logerror("%s:misc_w(%02X)\n", cpuexec_describe_context(device->machine), data);
108   logerror("%s:misc_w(%02X)\n", device->machine->describe_context(), data);
109109}
110110
111111
r10326r10327
119119   /* bit 2 = folla a */
120120   /* bit 1 = folla m */
121121   /* bit 0 = folla b */
122   logerror("%s:sound_w(%02X)\n", cpuexec_describe_context(device->machine), data);
122   logerror("%s:sound_w(%02X)\n", device->machine->describe_context(), data);
123123}
124124
125125
126126static WRITE8_DEVICE_HANDLER( pb_w )
127127{
128128   /* write PB0-7 */
129   logerror("%s:pb_w(%02X)\n", cpuexec_describe_context(device->machine), data);
129   logerror("%s:pb_w(%02X)\n", device->machine->describe_context(), data);
130130}
131131
132132
src/mame/drivers/megadriv.c
r10326r10327
424424         if (((megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40))
425425         {
426426            mess_io_stage[portnum]++;
427            timer_adjust_oneshot(mess_io_timeout[portnum], machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192), 0);
427            mess_io_timeout[portnum]->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192));
428428         }
429429
430430      }
src/mame/drivers/itech32.c
r10326r10327
390390static UINT8 tms_spinning[2];
391391
392392#define START_TMS_SPINNING(n)         do { cpu_spinuntil_trigger(space->cpu, 7351 + n); tms_spinning[n] = 1; } while (0)
393#define STOP_TMS_SPINNING(machine, n)   do { cpuexec_trigger(machine, 7351 + n); tms_spinning[n] = 0; } while (0)
393#define STOP_TMS_SPINNING(machine, n)   do { machine->scheduler().trigger(7351 + n); tms_spinning[n] = 0; } while (0)
394394
395395
396396
r10326r10327
836836   if (offset == 0) COMBINE_DATA(tms1_boot);
837837   if (offset == 0x382 && tms_spinning[0]) STOP_TMS_SPINNING(space->machine, 0);
838838   if (!tms_spinning[0])
839      cpuexec_boost_interleave(space->machine, attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
839      space->machine->scheduler().boost_interleave(attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
840840}
841841
842842
r10326r10327
845845   COMBINE_DATA(&tms2_ram[offset]);
846846   if (offset == 0x382 && tms_spinning[1]) STOP_TMS_SPINNING(space->machine, 1);
847847   if (!tms_spinning[1])
848      cpuexec_boost_interleave(space->machine, attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
848      space->machine->scheduler().boost_interleave(attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
849849}
850850
851851
852852static WRITE32_HANDLER( tms1_trigger_w )
853853{
854854   COMBINE_DATA(&tms1_ram[offset]);
855   cpuexec_boost_interleave(space->machine, attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
855   space->machine->scheduler().boost_interleave(attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
856856}
857857
858858
859859static WRITE32_HANDLER( tms2_trigger_w )
860860{
861861   COMBINE_DATA(&tms2_ram[offset]);
862   cpuexec_boost_interleave(space->machine, attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
862   space->machine->scheduler().boost_interleave(attotime::from_hz(CPU020_CLOCK/256), attotime::from_usec(20));
863863}
864864
865865
src/mame/drivers/calchase.c
r10326r10327
316316
317317static void mxtc_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data)
318318{
319//  mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", cpuexec_describe_context(machine), function, reg, data);
319//  mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", machine->describe_context(), function, reg, data);
320320
321321   switch(reg)
322322   {
r10326r10327
400400
401401static void piix4_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data)
402402{
403//  mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", cpuexec_describe_context(machine), function, reg, data);
403//  mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine->describe_context(), function, reg, data);
404404   piix4_config_reg[function][reg] = data;
405405}
406406
src/mame/drivers/chaknpop.c
r10326r10327
1818
1919static WRITE8_DEVICE_HANDLER ( unknown_port_1_w )
2020{
21   //logerror("%s: write to unknow port 1: 0x%02x\n", cpuexec_describe_context(device->machine), data);
21   //logerror("%s: write to unknow port 1: 0x%02x\n", device->machine->describe_context(), data);
2222}
2323
2424static WRITE8_DEVICE_HANDLER ( unknown_port_2_w )
2525{
26   //logerror("%s: write to unknow port 2: 0x%02x\n", cpuexec_describe_context(device->machine), data);
26   //logerror("%s: write to unknow port 2: 0x%02x\n", device->machine->describe_context(), data);
2727}
2828
2929static WRITE8_HANDLER ( coinlock_w )
src/mame/drivers/vegas.c
r10326r10327
948948      if (regs[1] & 2)
949949         logerror("Unexpected value: timer %d is prescaled\n", which);
950950      if (scale != 0)
951         timer_adjust_oneshot(timer[which], TIMER_PERIOD * scale, which);
951         timer[which]->adjust(TIMER_PERIOD * scale, which);
952952   }
953953
954954   /* trigger the interrupt */
r10326r10327
10311031         {
10321032            if (nile_regs[offset] & 2)
10331033               logerror("Unexpected value: timer %d is prescaled\n", which);
1034            result = nile_regs[offset + 1] = timer_timeleft(timer[which]).as_double() * (double)SYSTEM_CLOCK;
1034            result = nile_regs[offset + 1] = timer[which]->remaining().as_double() * (double)SYSTEM_CLOCK;
10351035         }
10361036
10371037         if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", cpu_get_pc(space->cpu), which, offset*4, result);
r10326r10327
11611161            if (nile_regs[offset] & 2)
11621162               logerror("Unexpected value: timer %d is prescaled\n", which);
11631163            if (scale != 0)
1164               timer_adjust_oneshot(timer[which], TIMER_PERIOD * scale, which);
1164               timer[which]->adjust(TIMER_PERIOD * scale, which);
11651165            if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)ATTOSECONDS_TO_HZ((TIMER_PERIOD * (nile_regs[offset + 1] + 1)).attoseconds));
11661166         }
11671167
r10326r10327
11701170         {
11711171            if (nile_regs[offset] & 2)
11721172               logerror("Unexpected value: timer %d is prescaled\n", which);
1173            nile_regs[offset + 1] = timer_timeleft(timer[which]).as_double() * SYSTEM_CLOCK;
1174            timer_adjust_oneshot(timer[which], attotime::never, which);
1173            nile_regs[offset + 1] = timer[which]->remaining().as_double() * SYSTEM_CLOCK;
1174            timer[which]->adjust(attotime::never, which);
11751175         }
11761176         break;
11771177
r10326r10327
11871187         {
11881188            if (nile_regs[offset - 1] & 2)
11891189               logerror("Unexpected value: timer %d is prescaled\n", which);
1190            timer_adjust_oneshot(timer[which], TIMER_PERIOD * nile_regs[offset], which);
1190            timer[which]->adjust(TIMER_PERIOD * nile_regs[offset], which);
11911191         }
11921192         break;
11931193
src/mame/drivers/enigma2.c
r10326r10327
127127      next_counter = INT_TRIGGER_COUNT_1;
128128
129129   next_vpos = vysnc_chain_counter_to_vpos(next_counter);
130   timer_adjust_oneshot(state->interrupt_assert_timer, machine->primary_screen->time_until_pos(next_vpos), 0);
131   timer_adjust_oneshot(state->interrupt_clear_timer, machine->primary_screen->time_until_pos(vpos + 1), 0);
130   state->interrupt_assert_timer->adjust(machine->primary_screen->time_until_pos(next_vpos));
131   state->interrupt_clear_timer->adjust(machine->primary_screen->time_until_pos(vpos + 1));
132132}
133133
134134
r10326r10327
144144{
145145   enigma2_state *state = machine->driver_data<enigma2_state>();
146146   int vpos = vysnc_chain_counter_to_vpos(INT_TRIGGER_COUNT_1);
147   timer_adjust_oneshot(state->interrupt_assert_timer, machine->primary_screen->time_until_pos(vpos), 0);
147   state->interrupt_assert_timer->adjust(machine->primary_screen->time_until_pos(vpos));
148148}
149149
150150
r10326r10327
403403static WRITE8_DEVICE_HANDLER( protection_data_w )
404404{
405405   enigma2_state *state = device->machine->driver_data<enigma2_state>();
406   if (LOG_PROT) logerror("%s: Protection Data Write: %x\n", cpuexec_describe_context(device->machine), data);
406   if (LOG_PROT) logerror("%s: Protection Data Write: %x\n", device->machine->describe_context(), data);
407407   state->protection_data = data;
408408}
409409
src/mame/drivers/segaorun.c
r10326r10327
447447   cpu_set_input_line(state->maincpu, 6, state->vblank_irq_state && state->irq2_state ? ASSERT_LINE : CLEAR_LINE);
448448
449449   if (state->vblank_irq_state || state->irq2_state)
450      cpuexec_boost_interleave(machine, attotime::zero, attotime::from_usec(100));
450      machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
451451}
452452
453453
src/mame/drivers/namcona1.c
r10326r10327
641641   (void)src0;
642642/*
643643    logerror( "%s: blt(%08x,%08x,numBytes=%04x);src=%04x %04x %04x; dst=%04x %04x %04x; gfx=%04x\n",
644        cpuexec_describe_context(machine),
644        machine->describe_context(),
645645        dst_baseaddr,src_baseaddr,num_bytes,
646646        src0,src1,src2,
647647        dst0,dst1,dst2,
src/mame/drivers/acefruit.c
r10326r10327
4747
4848   vpos = ( ( vpos / 8 ) + 1 ) * 8;
4949
50   timer_adjust_oneshot( acefruit_refresh_timer, machine->primary_screen->time_until_pos(vpos), 0 );
50   acefruit_refresh_timer->adjust( machine->primary_screen->time_until_pos(vpos) );
5151}
5252
5353static VIDEO_START( acefruit )
r10326r10327
5858static INTERRUPT_GEN( acefruit_vblank )
5959{
6060   cpu_set_input_line(device, 0, HOLD_LINE );
61   timer_adjust_oneshot( acefruit_refresh_timer, attotime::zero, 0 );
61   acefruit_refresh_timer->adjust( attotime::zero );
6262}
6363
6464static VIDEO_UPDATE( acefruit )
src/mame/drivers/namcos11.c
r10326r10327
296296      va_start( v, s_fmt );
297297      vsprintf( buf, s_fmt, v );
298298      va_end( v );
299      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
299      logerror( "%s: %s", machine->describe_context(), buf );
300300   }
301301}
302302
src/mame/drivers/kickgoal.c
r10326r10327
206206static WRITE16_DEVICE_HANDLER( actionhw_snd_w )
207207{
208208   kickgoal_state *state = device->machine->driver_data<kickgoal_state>();
209   logerror("%s: Writing %04x to Sound CPU - mask %04x\n",cpuexec_describe_context(device->machine),data,mem_mask);
209   logerror("%s: Writing %04x to Sound CPU - mask %04x\n",device->machine->describe_context(),data,mem_mask);
210210
211211   if (!ACCESSING_BITS_0_7)
212212      data >>= 8;
src/mame/drivers/galaxian.c
r10326r10327
633633
634634static WRITE8_DEVICE_HANDLER( konami_portc_0_w )
635635{
636   logerror("%s:ppi0_portc_w = %02X\n", cpuexec_describe_context(device->machine), data);
636   logerror("%s:ppi0_portc_w = %02X\n", device->machine->describe_context(), data);
637637}
638638
639639
640640static WRITE8_DEVICE_HANDLER( konami_portc_1_w )
641641{
642   logerror("%s:ppi1_portc_w = %02X\n", cpuexec_describe_context(device->machine), data);
642   logerror("%s:ppi1_portc_w = %02X\n", device->machine->describe_context(), data);
643643}
644644
645645
r10326r10327
19781978   MCFG_VIDEO_UPDATE(galaxian)
19791979
19801980   /* blinking frequency is determined by 555 counter with Ra=100k, Rb=10k, C=10uF */
1981   MCFG_TIMER_ADD_PERIODIC("stars", galaxian_stars_blink_timer, attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(100000, 10000, 0.00001)))
1981   MCFG_TIMER_ADD_PERIODIC("stars", galaxian_stars_blink_timer, PERIOD_OF_555_ASTABLE(100000, 10000, 0.00001))
19821982
19831983   /* sound hardware */
19841984   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/hyprduel.c
r10326r10327
138138   hyprduel_state *state = space->machine->driver_data<hyprduel_state>();
139139   if (state->cpu_trigger == 1001)
140140   {
141      cpuexec_trigger(space->machine, 1001);
141      space->machine->scheduler().trigger(1001);
142142      state->cpu_trigger = 0;
143143   }
144144
r10326r10327
166166   hyprduel_state *state = space->machine->driver_data<hyprduel_state>();
167167   if (state->cpu_trigger == 1002)
168168   {
169      cpuexec_trigger(space->machine, 1002);
169      space->machine->scheduler().trigger(1002);
170170      state->cpu_trigger = 0;
171171   }
172172
r10326r10327
285285      case 2:   hyprduel_vram_1_w(space, offs, data, mask);   break;
286286      case 3:   hyprduel_vram_2_w(space, offs, data, mask);   break;
287287   }
288//  logerror("%s : Blitter %X] %04X <- %04X & %04X\n", cpuexec_describe_context(space->machine), tmap, offs, data, mask);
288//  logerror("%s : Blitter %X] %04X <- %04X & %04X\n", space->machine->describe_context(), tmap, offs, data, mask);
289289}
290290
291291
r10326r10327
668668   hyprduel_state *state = machine->driver_data<hyprduel_state>();
669669
670670   MACHINE_START_CALL(hyprduel);
671   timer_adjust_periodic(state->magerror_irq_timer, attotime::zero, 0, attotime::from_hz(968));      /* tempo? */
671   state->magerror_irq_timer->adjust(attotime::zero, 0, attotime::from_hz(968));      /* tempo? */
672672}
673673
674674static MACHINE_CONFIG_START( hyprduel, hyprduel_state )
src/mame/drivers/atetris.c
r10326r10327
7878   scanline += 32;
7979   if (scanline >= 256)
8080      scanline -= 256;
81   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
81   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
8282}
8383
8484
r10326r10327
133133   reset_bank(machine);
134134
135135   /* start interrupts going (32V clocked by 16V) */
136   timer_adjust_oneshot(state->interrupt_timer, machine->primary_screen->time_until_pos(48), 48);
136   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(48), 48);
137137}
138138
139139
src/mame/drivers/bmcbowl.c
r10326r10327
437437         case 0x00:   return  input_port_read(device->machine, "IN1");
438438         case 0x40:   return  input_port_read(device->machine, "IN2");
439439   }
440   logerror("%s:unknown input - %X\n",cpuexec_describe_context(device->machine),bmc_input);
440   logerror("%s:unknown input - %X\n",device->machine->describe_context(),bmc_input);
441441   return 0xff;
442442}
443443
src/mame/drivers/lordgun.c
r10326r10327
151151   if (data & ~0xfd)
152152   {
153153//      popmessage("EE: %02x", data);
154      logerror("%s: Unknown EEPROM bit written %02X\n",cpuexec_describe_context(device->machine),data);
154      logerror("%s: Unknown EEPROM bit written %02X\n",device->machine->describe_context(),data);
155155   }
156156
157157   coin_counter_w(device->machine, 0, data & 0x01);
r10326r10327
182182   if (~data & ~0xf8)
183183   {
184184//      popmessage("EE: %02x", data);
185      logerror("%s: Unknown EEPROM bit written %02X\n",cpuexec_describe_context(device->machine),data);
185      logerror("%s: Unknown EEPROM bit written %02X\n",device->machine->describe_context(),data);
186186   }
187187
188188   // bit 1? cleared during screen transitions
r10326r10327
212212      case 0x50:   return input_port_read(device->machine, "DIP3");
213213
214214      default:
215         logerror("%s: dip_r with unknown dip_sel = %02X\n",cpuexec_describe_context(device->machine),aliencha_dip_sel);
215         logerror("%s: dip_r with unknown dip_sel = %02X\n",device->machine->describe_context(),aliencha_dip_sel);
216216         return 0xff;
217217   }
218218}
r10326r10327
319319static WRITE8_DEVICE_HANDLER( lordgun_okibank_w )
320320{
321321   downcast<okim6295_device *>(device)->set_bank_base((data & 2) ? 0x40000 : 0);
322   if (data & ~3)   logerror("%s: unknown okibank bits %02x\n", cpuexec_describe_context(device->machine), data);
322   if (data & ~3)   logerror("%s: unknown okibank bits %02x\n", device->machine->describe_context(), data);
323323//  popmessage("OKI %x", data);
324324}
325325
src/mame/drivers/segag80r.c
r10326r10327
298298   address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
299299   soundlatch_w(space, 0, data);
300300   cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
301   cpuexec_boost_interleave(device->machine, attotime::zero, attotime::from_usec(50));
301   device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
302302}
303303
304304
src/mame/drivers/berzerk.c
r10326r10327
168168   next_v256 = irq_trigger_v256s[next_irq_number];
169169
170170   next_vpos = vsync_chain_counter_to_vpos(next_counter, next_v256);
171   timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(next_vpos), next_irq_number);
171   irq_timer->adjust(machine->primary_screen->time_until_pos(next_vpos), next_irq_number);
172172}
173173
174174
r10326r10327
181181static void start_irq_timer(running_machine *machine)
182182{
183183   int vpos = vsync_chain_counter_to_vpos(irq_trigger_counts[0], irq_trigger_v256s[0]);
184   timer_adjust_oneshot(irq_timer, machine->primary_screen->time_until_pos(vpos), 0);
184   irq_timer->adjust(machine->primary_screen->time_until_pos(vpos));
185185}
186186
187187
r10326r10327
245245   next_v256 = nmi_trigger_v256s[next_nmi_number];
246246
247247   next_vpos = vsync_chain_counter_to_vpos(next_counter, next_v256);
248   timer_adjust_oneshot(nmi_timer, machine->primary_screen->time_until_pos(next_vpos), next_nmi_number);
248   nmi_timer->adjust(machine->primary_screen->time_until_pos(next_vpos), next_nmi_number);
249249}
250250
251251
r10326r10327
258258static void start_nmi_timer(running_machine *machine)
259259{
260260   int vpos = vsync_chain_counter_to_vpos(nmi_trigger_counts[0], nmi_trigger_v256s[0]);
261   timer_adjust_oneshot(nmi_timer, machine->primary_screen->time_until_pos(vpos), 0);
261   nmi_timer->adjust(machine->primary_screen->time_until_pos(vpos));
262262}
263263
264264
src/mame/drivers/blitz68k.c
r10326r10327
451451   int x, y, x_size, y_size;
452452   UINT32 src;
453453
454   logerror("%s: blit x=%02x y=%02x w=%02x h=%02x addr=%02x%02x%02x pens=%02x %02x %02x %02x flag=%02x %02x %02x %02x - %02x %02x %02x %02x\n", cpuexec_describe_context(space->machine),
454   logerror("%s: blit x=%02x y=%02x w=%02x h=%02x addr=%02x%02x%02x pens=%02x %02x %02x %02x flag=%02x %02x %02x %02x - %02x %02x %02x %02x\n", space->machine->describe_context(),
455455            blit.x,  blit.y, blit.w, blit.h,
456456            blit.addr[2], blit.addr[1], blit.addr[0],
457457            blit.pen[0], blit.pen[1], blit.pen[2], blit.pen[3],
r10326r10327
645645static READ8_HANDLER( bankrob_mcu1_r )
646646{
647647   UINT8 ret = 0;   // space->machine->rand() gives "interesting" results
648   logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
648   logerror("%s: mcu1 reads %02x\n", space->machine->describe_context(), ret);
649649   return ret;
650650}
651651static READ8_HANDLER( bankrob_mcu2_r )
652652{
653653   UINT8 ret = 0;   // space->machine->rand() gives "interesting" results
654   logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
654   logerror("%s: mcu2 reads %02x\n", space->machine->describe_context(), ret);
655655   return ret;
656656}
657657
r10326r10327
667667
668668static WRITE8_HANDLER( bankrob_mcu1_w )
669669{
670   logerror("%s: mcu1 written with %02x\n", cpuexec_describe_context(space->machine), data);
670   logerror("%s: mcu1 written with %02x\n", space->machine->describe_context(), data);
671671}
672672static WRITE8_HANDLER( bankrob_mcu2_w )
673673{
674   logerror("%s: mcu2 written with %02x\n", cpuexec_describe_context(space->machine), data);
674   logerror("%s: mcu2 written with %02x\n", space->machine->describe_context(), data);
675675}
676676
677677static ADDRESS_MAP_START( bankrob_map, ADDRESS_SPACE_PROGRAM, 16 )
r10326r10327
728728static READ8_HANDLER( bankroba_mcu1_r )
729729{
730730   UINT8 ret = space->machine->rand();   // space->machine->rand() gives "interesting" results
731   logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
731   logerror("%s: mcu1 reads %02x\n", space->machine->describe_context(), ret);
732732   return ret;
733733}
734734static READ8_HANDLER( bankroba_mcu2_r )
735735{
736736   UINT8 ret = space->machine->rand();   // space->machine->rand() gives "interesting" results
737   logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
737   logerror("%s: mcu2 reads %02x\n", space->machine->describe_context(), ret);
738738   return ret;
739739}
740740
r10326r10327
749749
750750static WRITE8_HANDLER( bankroba_mcu1_w )
751751{
752   logerror("%s: mcu1 written with %02x\n", cpuexec_describe_context(space->machine), data);
752   logerror("%s: mcu1 written with %02x\n", space->machine->describe_context(), data);
753753}
754754static WRITE8_HANDLER( bankroba_mcu2_w )
755755{
756   logerror("%s: mcu2 written with %02x\n", cpuexec_describe_context(space->machine), data);
756   logerror("%s: mcu2 written with %02x\n", space->machine->describe_context(), data);
757757}
758758
759759static ADDRESS_MAP_START( bankroba_map, ADDRESS_SPACE_PROGRAM, 16 )
r10326r10327
884884static READ16_HANDLER( cjffruit_mcu_r )
885885{
886886   UINT8 ret = 0x00;   // space->machine->rand() gives "interesting" results
887   logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret);
887   logerror("%s: mcu reads %02x\n", space->machine->describe_context(), ret);
888888   return ret << 8;
889889}
890890
891891static WRITE16_HANDLER( cjffruit_mcu_w )
892892{
893   logerror("%s: mcu written with %02x\n", cpuexec_describe_context(space->machine),data >> 8);
893   logerror("%s: mcu written with %02x\n", space->machine->describe_context(),data >> 8);
894894}
895895
896896static ADDRESS_MAP_START( cjffruit_map, ADDRESS_SPACE_PROGRAM, 16 )
r10326r10327
935935static READ16_HANDLER( deucesw2_mcu_r )
936936{
937937   UINT8 ret = 0x00;   // space->machine->rand() gives "interesting" results
938   logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret);
938   logerror("%s: mcu reads %02x\n", space->machine->describe_context(), ret);
939939   return ret << 8;
940940}
941941
942942static WRITE16_HANDLER( deucesw2_mcu_w )
943943{
944   logerror("%s: mcu written with %02x\n", cpuexec_describe_context(space->machine),data >> 8);
944   logerror("%s: mcu written with %02x\n", space->machine->describe_context(),data >> 8);
945945}
946946
947947static WRITE16_HANDLER( deucesw2_leds1_w )
r10326r10327
10311031static READ8_HANDLER( dualgame_mcu1_r )
10321032{
10331033   UINT8 ret = 0;   // space->machine->rand() gives "interesting" results
1034   logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
1034   logerror("%s: mcu1 reads %02x\n", space->machine->describe_context(), ret);
10351035   return ret;
10361036}
10371037static READ8_HANDLER( dualgame_mcu2_r )
10381038{
10391039   UINT8 ret = 0;   // space->machine->rand() gives "interesting" results
1040   logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
1040   logerror("%s: mcu2 reads %02x\n", space->machine->describe_context(), ret);
10411041   return ret;
10421042}
10431043
r10326r10327
10531053
10541054static WRITE8_HANDLER( dualgame_mcu1_w )
10551055{
1056   logerror("%s: mcu1 written with %02x\n", cpuexec_describe_context(space->machine), data);
1056   logerror("%s: mcu1 written with %02x\n", space->machine->describe_context(), data);
10571057}
10581058static WRITE8_HANDLER( dualgame_mcu2_w )
10591059{
1060   logerror("%s: mcu2 written with %02x\n", cpuexec_describe_context(space->machine), data);
1060   logerror("%s: mcu2 written with %02x\n", space->machine->describe_context(), data);
10611061}
10621062
10631063static ADDRESS_MAP_START( dualgame_map, ADDRESS_SPACE_PROGRAM, 16 )
r10326r10327
11191119static READ16_HANDLER( hermit_mcu_r )
11201120{
11211121   UINT8 ret = 0x00;   // space->machine->rand() gives "interesting" results
1122   logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret);
1122   logerror("%s: mcu reads %02x\n", space->machine->describe_context(), ret);
11231123   return ret << 8;
11241124}
11251125
11261126static WRITE16_HANDLER( hermit_mcu_w )
11271127{
1128   logerror("%s: mcu written with %02x\n", cpuexec_describe_context(space->machine),data >> 8);
1128   logerror("%s: mcu written with %02x\n", space->machine->describe_context(),data >> 8);
11291129}
11301130
11311131static WRITE16_HANDLER( hermit_leds1_w )
r10326r10327
11981198static READ8_HANDLER( maxidbl_mcu1_r )
11991199{
12001200   UINT8 ret = 0;   // space->machine->rand() gives "interesting" results
1201   logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
1201   logerror("%s: mcu1 reads %02x\n", space->machine->describe_context(), ret);
12021202   return ret;
12031203}
12041204static READ8_HANDLER( maxidbl_mcu2_r )
12051205{
12061206   UINT8 ret = 0;   // space->machine->rand() gives "interesting" results
1207   logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
1207   logerror("%s: mcu2 reads %02x\n", space->machine->describe_context(), ret);
12081208   return ret;
12091209}
12101210
r10326r10327
12201220
12211221static WRITE8_HANDLER( maxidbl_mcu1_w )
12221222{
1223   logerror("%s: mcu1 written with %02x\n", cpuexec_describe_context(space->machine), data);
1223   logerror("%s: mcu1 written with %02x\n", space->machine->describe_context(), data);
12241224}
12251225static WRITE8_HANDLER( maxidbl_mcu2_w )
12261226{
1227   logerror("%s: mcu2 written with %02x\n", cpuexec_describe_context(space->machine), data);
1227   logerror("%s: mcu2 written with %02x\n", space->machine->describe_context(), data);
12281228}
12291229
12301230static ADDRESS_MAP_START( maxidbl_map, ADDRESS_SPACE_PROGRAM, 16 )
src/mame/drivers/psikyo.c
r10326r10327
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 */
9191      field->port->machine->scheduler().synchronize();
92//      logerror("%s - Read coin port during Z80 NMI\n", cpuexec_describe_context(machine));
92//      logerror("%s - Read coin port during Z80 NMI\n", machine->describe_context());
9393   }
9494
9595   return ret;
src/mame/drivers/xexex.c
r10326r10327
275275      if (state->suspension_active)
276276      {
277277         state->suspension_active = 0;
278         cpuexec_trigger(machine, state->resume_trigger);
278         machine->scheduler().trigger(state->resume_trigger);
279279      }
280280
281281      // IRQ 5 is the "object DMA end interrupt" and shouldn't be triggered
r10326r10327
291291   if (state->suspension_active)
292292   {
293293      state->suspension_active = 0;
294      cpuexec_trigger(device->machine, state->resume_trigger);
294      device->machine->scheduler().trigger(state->resume_trigger);
295295   }
296296
297297   switch (cpu_getiloops(device))
r10326r10327
309309            xexex_objdma(device->machine, 0);
310310
311311            // schedule DMA end interrupt
312            timer_adjust_oneshot(state->dmadelay_timer, XE_DMADELAY, 0);
312            state->dmadelay_timer->adjust(XE_DMADELAY);
313313         }
314314
315315         // IRQ 4 is the V-blank interrupt. It controls color, sound and
src/mame/drivers/cps3.c
r10326r10327
24222422   }
24232423   else
24242424   {
2425      //printf("%s :src %08x, dst %08x, returning %08x\n", cpuexec_describe_context(machine), src, dst, data);
2425      //printf("%s :src %08x, dst %08x, returning %08x\n", machine->describe_context(), src, dst, data);
24262426   }
24272427
24282428   /* I doubt this is endian safe.. needs checking / fixing */
src/mame/drivers/jchan.c
r10326r10327
212212   UINT16 mcu_offset  = mcu_ram[0x0012/2] / 2;   /* offset in shared RAM where MCU will write */
213213   UINT16 mcu_subcmd  = mcu_ram[0x0014/2];      /* sub-command parameter, happens only for command #4 */
214214
215   logerror("%s : MCU executed command: %04X %04X %04X ",cpuexec_describe_context(machine),mcu_command,mcu_offset*2,mcu_subcmd);
215   logerror("%s : MCU executed command: %04X %04X %04X ",machine->describe_context(),mcu_command,mcu_offset*2,mcu_subcmd);
216216
217217/*
218218    the only MCU commands found in program code are:
r10326r10327
233233      case 0x03:   // DSW
234234      {
235235         mcu_ram[mcu_offset] = input_port_read(machine, "DSW");
236         logerror("%s : MCU executed command: %04X %04X (read DSW)\n",cpuexec_describe_context(machine),mcu_command,mcu_offset*2);
236         logerror("%s : MCU executed command: %04X %04X (read DSW)\n",machine->describe_context(),mcu_command,mcu_offset*2);
237237      }
238238      break;
239239
src/mame/drivers/neoprint.c
r10326r10327
141141      audio_cpu_assert_nmi(space->machine);
142142
143143      /* boost the interleave to let the audio CPU read the command */
144      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(50));
144      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
145145
146146      //if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(space->cpu), data, mem_mask);
147147   }
src/mame/drivers/seattle.c
r10326r10327
920920
921921   /* if we're a timer, adjust the timer to fire again */
922922   if (galileo.reg[GREG_TIMER_CONTROL] & (2 << (2 * which)))
923      timer_adjust_oneshot(timer->timer, TIMER_PERIOD * timer->count, which);
923      timer->timer->adjust(TIMER_PERIOD * timer->count, which);
924924   else
925925      timer->active = timer->count = 0;
926926
r10326r10327
11001100         result = timer->count;
11011101         if (timer->active)
11021102         {
1103            UINT32 elapsed = (timer_timeelapsed(timer->timer) * SYSTEM_CLOCK).as_double();
1103            UINT32 elapsed = (timer->timer->elapsed() * SYSTEM_CLOCK).as_double();
11041104            result = (result > elapsed) ? (result - elapsed) : 0;
11051105         }
11061106
r10326r10327
12311231                  if (which != 0)
12321232                     timer->count &= 0xffffff;
12331233               }
1234               timer_adjust_oneshot(timer->timer, TIMER_PERIOD * timer->count, which);
1234               timer->timer->adjust(TIMER_PERIOD * timer->count, which);
12351235               if (LOG_TIMERS)
12361236                  logerror("Adjusted timer to fire in %f secs\n", (TIMER_PERIOD * timer->count).as_double());
12371237            }
12381238            else if (timer->active && !(data & mask))
12391239            {
1240               UINT32 elapsed = (timer_timeelapsed(timer->timer) * SYSTEM_CLOCK).as_double();
1240               UINT32 elapsed = (timer->timer->elapsed() * SYSTEM_CLOCK).as_double();
12411241               timer->active = 0;
12421242               timer->count = (timer->count > elapsed) ? (timer->count - elapsed) : 0;
1243               timer_adjust_oneshot(timer->timer, attotime::never, which);
1243               timer->timer->adjust(attotime::never, which);
12441244               if (LOG_TIMERS)
12451245                  logerror("Disabled timer\n");
12461246            }
r10326r10327
13801380
13811381         /* resume CPU execution */
13821382         if (LOG_DMA) logerror("Resuming CPU on voodoo\n");
1383         cpuexec_trigger(device->machine, 45678);
1383         device->machine->scheduler().trigger(45678);
13841384      }
13851385   }
13861386}
src/mame/drivers/tetrisp2.c
r10326r10327
7777      if (offset == 0x0c)
7878      {
7979         attotime timer = ROCKN_TIMER_BASE * (4096 - data);
80         timer_adjust_periodic(rockn_timer_l4, timer, 0, timer);
80         rockn_timer_l4->adjust(timer, 0, timer);
8181      }
8282   }
8383}
r10326r10327
9191      if (offset == 0x0c)
9292      {
9393         attotime timer = ROCKN_TIMER_BASE * (4096 - data);
94         timer_adjust_periodic(rockn_timer_sub_l4, timer, 0, timer);
94         rockn_timer_sub_l4->adjust(timer, 0, timer);
9595      }
9696   }
9797}
src/mame/drivers/tmaster.c
r10326r10327
355355
356356#ifdef MAME_DEBUG
357357#if 0
358   logerror("%s: blit w %03x, h %02x, x %03x, y %02x, src %06x, fill/addr %04x, repl/color %04x, mode %02x\n", cpuexec_describe_context(machine),
358   logerror("%s: blit w %03x, h %02x, x %03x, y %02x, src %06x, fill/addr %04x, repl/color %04x, mode %02x\n", machine->describe_context(),
359359         sw,sh,sx,sy, addr, tmaster_addr, tmaster_color, mode
360360   );
361361#endif
r10326r10327
380380      case 0x00:                     // blit with transparency
381381         if (addr > tmaster_gfx_size - sw*sh)
382382         {
383            logerror("%s: blit error, addr %06x out of bounds\n", cpuexec_describe_context(machine),addr);
383            logerror("%s: blit error, addr %06x out of bounds\n", machine->describe_context(),addr);
384384            addr = tmaster_gfx_size - sw*sh;
385385         }
386386
src/mame/drivers/ssv.c
r10326r10327
471471   ssv_state *state = device->machine->driver_data<ssv_state>();
472472
473473   if (data & ~0x7b00)
474      logerror("%s - Unknown EEPROM bit written %04X\n",cpuexec_describe_context(device->machine),data);
474      logerror("%s - Unknown EEPROM bit written %04X\n",device->machine->describe_context(),data);
475475
476476   if ( ACCESSING_BITS_8_15 )
477477   {
src/mame/drivers/mpu4drvr.c
r10326r10327
11911191    We invert the X and Y data at source due to the use of Schmitt triggers in the interface, which
11921192    clean up the pulses and flip the active phase.*/
11931193
1194   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",cpuexec_describe_context(device->machine)));
1194   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",device->machine->describe_context()));
11951195
11961196   static INT8 cur[2];
11971197
src/mame/drivers/firebeat.c
r10326r10327
580580
581581   if (reg != 0x70 && chip == 0)
582582   {
583      //printf("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", cpuexec_describe_context(machine), chip, data, offset, mem_mask);
584      //logerror("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", ccpuexec_describe_context(machine), hip, data, offset, mem_mask);
583      //printf("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", machine->describe_context(), chip, data, offset, mem_mask);
584      //logerror("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", cmachine->describe_context(), hip, data, offset, mem_mask);
585585   }
586586
587587   switch(reg)
r10326r10327
975975
976976   if (reg == ATAPI_REG_DATA)
977977   {
978//      printf("%s:ATAPI: packet write %04x\n", cpuexec_describe_context(device->machine), data);
978//      printf("%s:ATAPI: packet write %04x\n", device->machine->describe_context(), data);
979979      atapi_data[atapi_data_ptr] = data;
980980      atapi_data_ptr++;
981981
r10326r10327
22162216{
22172217   // set keyboard timer
22182218   keyboard_timer = machine->scheduler().timer_alloc(FUNC(keyboard_timer_callback));
2219   timer_adjust_periodic(keyboard_timer, attotime::from_msec(10), 0, attotime::from_msec(10));
2219   keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10));
22202220}
22212221
22222222static DRIVER_INIT(kbm)
src/mame/drivers/clayshoo.c
r10326r10327
117117
118118   state->analog_port_val = 0xff;
119119
120   timer_adjust_oneshot(state->analog_timer_1, compute_duration(space->cpu, input_port_read(space->machine, "AN1")), 0x02);
121   timer_adjust_oneshot(state->analog_timer_2, compute_duration(space->cpu, input_port_read(space->machine, "AN2")), 0x01);
120   state->analog_timer_1->adjust(compute_duration(space->cpu, input_port_read(space->machine, "AN1")), 0x02);
121   state->analog_timer_2->adjust(compute_duration(space->cpu, input_port_read(space->machine, "AN2")), 0x01);
122122}
123123
124124
src/mame/drivers/cubocd32.c
r10326r10327
402402static READ8_DEVICE_HANDLER( cd32_cia_0_portb_r )
403403{
404404   /* parallel port */
405   logerror("%s:CIA0_portb_r\n", cpuexec_describe_context(device->machine));
405   logerror("%s:CIA0_portb_r\n", device->machine->describe_context());
406406   return 0xff;
407407}
408408
409409static WRITE8_DEVICE_HANDLER( cd32_cia_0_portb_w )
410410{
411411   /* parallel port */
412   logerror("%s:CIA0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data);
412   logerror("%s:CIA0_portb_w(%02x)\n", device->machine->describe_context(), data);
413413}
414414
415415static ADDRESS_MAP_START( cd32_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mame/drivers/dunhuang.c
r10326r10327
443443   if (!(state->input & 0x04))   return input_port_read(device->machine, "DSW3");
444444   if (!(state->input & 0x08))   return input_port_read(device->machine, "DSW4");
445445   if (!(state->input & 0x10))   return input_port_read(device->machine, "DSW5");
446   logerror("%s: warning, unknown dsw bits read, state->input = %02x\n", cpuexec_describe_context(device->machine), state->input);
446   logerror("%s: warning, unknown dsw bits read, state->input = %02x\n", device->machine->describe_context(), state->input);
447447   return 0xff;
448448}
449449static READ8_HANDLER( dunhuang_input_r )
r10326r10327
454454   if (!(state->input & 0x04))   return input_port_read(space->machine, "IN2");
455455   if (!(state->input & 0x08))   return input_port_read(space->machine, "IN3");
456456   if (!(state->input & 0x10))   return input_port_read(space->machine, "IN4");
457   logerror("%s: warning, unknown input bits read, state->input = %02x\n", cpuexec_describe_context(space->machine), state->input);
457   logerror("%s: warning, unknown input bits read, state->input = %02x\n", space->machine->describe_context(), state->input);
458458   return 0xff;
459459}
460460
src/mame/drivers/cvs.c
r10326r10327
322322{
323323   cvs_state *state = machine->driver_data<cvs_state>();
324324   state->cvs_393hz_timer = machine->scheduler().timer_alloc(FUNC(cvs_393hz_timer_cb));
325   timer_adjust_periodic(state->cvs_393hz_timer, attotime::from_hz(30*393), 0, attotime::from_hz(30*393));
325   state->cvs_393hz_timer->adjust(attotime::from_hz(30*393), 0, attotime::from_hz(30*393));
326326}
327327
328328
src/mame/drivers/magmax.c
r10326r10327
7777   scanline += 128;
7878   scanline &= 255;
7979
80   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
80   interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
8181}
8282
8383static MACHINE_START( magmax )
r10326r10327
9494
9595static MACHINE_RESET( magmax )
9696{
97   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(64), 64);
97   interrupt_timer->adjust(machine->primary_screen->time_until_pos(64), 64);
9898
9999#if 0
100100   {
src/mame/drivers/alg.c
r10326r10327
131131
132132   /* if there's more to come, set another timer */
133133   if (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
134      timer_adjust_oneshot(state->serial_timer, amiga_get_serial_char_period(machine), 0);
134      state->serial_timer->adjust(amiga_get_serial_char_period(machine));
135135   else
136136      state->serial_timer_active = FALSE;
137137}
r10326r10327
144144   /* if we have data available, set a timer to read it */
145145   if (!state->serial_timer_active && laserdisc_line_r(state->laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
146146   {
147      timer_adjust_oneshot(state->serial_timer, amiga_get_serial_char_period(machine), 0);
147      state->serial_timer->adjust(amiga_get_serial_char_period(machine));
148148      state->serial_timer_active = TRUE;
149149   }
150150}
r10326r10327
160160   /* if we have data available, set a timer to read it */
161161   if (!state->serial_timer_active && laserdisc_line_r(state->laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
162162   {
163      timer_adjust_oneshot(state->serial_timer, amiga_get_serial_char_period(machine), 0);
163      state->serial_timer->adjust(amiga_get_serial_char_period(machine));
164164      state->serial_timer_active = TRUE;
165165   }
166166}
r10326r10327
245245
246246static READ8_DEVICE_HANDLER( alg_cia_0_portb_r )
247247{
248   logerror("%s:alg_cia_0_portb_r\n", cpuexec_describe_context(device->machine));
248   logerror("%s:alg_cia_0_portb_r\n", device->machine->describe_context());
249249   return 0xff;
250250}
251251
r10326r10327
253253static WRITE8_DEVICE_HANDLER( alg_cia_0_portb_w )
254254{
255255   /* parallel port */
256   logerror("%s:alg_cia_0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data);
256   logerror("%s:alg_cia_0_portb_w(%02x)\n", device->machine->describe_context(), data);
257257}
258258
259259
260260static READ8_DEVICE_HANDLER( alg_cia_1_porta_r )
261261{
262   logerror("%s:alg_cia_1_porta_r\n", cpuexec_describe_context(device->machine));
262   logerror("%s:alg_cia_1_porta_r\n", device->machine->describe_context());
263263   return 0xff;
264264}
265265
266266
267267static WRITE8_DEVICE_HANDLER( alg_cia_1_porta_w )
268268{
269   logerror("%s:alg_cia_1_porta_w(%02x)\n", cpuexec_describe_context(device->machine), data);
269   logerror("%s:alg_cia_1_porta_w(%02x)\n", device->machine->describe_context(), data);
270270}
271271
272272
src/mame/drivers/unico.c
r10326r10327
213213static WRITE32_DEVICE_HANDLER( zeropnt2_eeprom_w )
214214{
215215   if (data & ~0xfe00000)
216      logerror("%s - Unknown EEPROM bit written %04X\n",cpuexec_describe_context(device->machine),data);
216      logerror("%s - Unknown EEPROM bit written %04X\n",device->machine->describe_context(),data);
217217
218218   if ( ACCESSING_BITS_24_31 )
219219   {
src/mame/drivers/galaga.c
r10326r10327
873873      scanline = 64;
874874
875875   /* the vertical synch chain is clocked by H256 -- this is probably not important, but oh well */
876   timer_adjust_oneshot(cpu3_interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
876   cpu3_interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
877877}
878878
879879
r10326r10327
900900   /* Reset all latches */
901901   bosco_latch_reset(machine);
902902
903   timer_adjust_oneshot(cpu3_interrupt_timer, machine->primary_screen->time_until_pos(64), 64);
903   cpu3_interrupt_timer->adjust(machine->primary_screen->time_until_pos(64), 64);
904904}
905905
906906static MACHINE_RESET( battles )
src/mame/drivers/ksys573.c
r10326r10327
430430      va_start( v, s_fmt );
431431      vsprintf( buf, s_fmt, v );
432432      va_end( v );
433      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
433      logerror( "%s: %s", machine->describe_context(), buf );
434434   }
435435}
436436
r10326r10327
599599   int i, n_this;
600600   UINT8 sector_buffer[ 4096 ];
601601
602   timer_adjust_oneshot(state->atapi_timer, attotime::never, 0);
602   state->atapi_timer->adjust(attotime::never);
603603
604604//  verboselog( machine, 2, "atapi_xfer_end( %d ) atapi_xferlen = %d, atapi_xfermod=%d\n", x, atapi_xfermod, atapi_xferlen );
605605
r10326r10327
645645      atapi_regs[ATAPI_REG_COUNTLOW] = state->atapi_xferlen & 0xff;
646646      atapi_regs[ATAPI_REG_COUNTHIGH] = (state->atapi_xferlen>>8)&0xff;
647647
648      timer_adjust_oneshot(state->atapi_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (state->atapi_xferlen/2048))), 0);
648      state->atapi_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (state->atapi_xferlen/2048))));
649649   }
650650   else
651651   {
r10326r10327
878878
879879               case 0x45: // PLAY
880880                  atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_BSY;
881                  timer_adjust_oneshot( state->atapi_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime( ATAPI_CYCLES_PER_SECTOR ), 0 );
881                  state->atapi_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime( ATAPI_CYCLES_PER_SECTOR ) );
882882                  break;
883883            }
884884
r10326r10327
10521052   state->atapi_cdata_wait = 0;
10531053
10541054   state->atapi_timer = machine->scheduler().timer_alloc(FUNC(atapi_xfer_end));
1055   timer_adjust_oneshot(state->atapi_timer, attotime::never, 0);
1055   state->atapi_timer->adjust(attotime::never);
10561056
10571057   for( i = 0; i < 2; i++ )
10581058   {
r10326r10327
11241124   verboselog( machine, 2, "atapi_xfer_end: %d %d\n", state->atapi_xferlen, state->atapi_xfermod );
11251125
11261126   // set a transfer complete timer (Note: CYCLES_PER_SECTOR can't be lower than 2000 or the BIOS ends up "out of order")
1127   timer_adjust_oneshot(state->atapi_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (state->atapi_xferlen/2048))), 0);
1127   state->atapi_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (state->atapi_xferlen/2048))));
11281128}
11291129
11301130static WRITE32_HANDLER( security_w )
r10326r10327
13241324
13251325   if( ( state->m_p_n_root_mode[ n_counter ] & PSX_RC_STOP ) != 0 )
13261326   {
1327      timer_adjust_oneshot( state->m_p_timer_root[ n_counter ], attotime::never, n_counter);
1327      state->m_p_timer_root[ n_counter ]->adjust( attotime::never, n_counter);
13281328   }
13291329   else
13301330   {
r10326r10327
13381338
13391339      n_duration *= root_divider( machine, n_counter );
13401340
1341      timer_adjust_oneshot( state->m_p_timer_root[ n_counter ], attotime::from_hz(33868800) * n_duration, n_counter);
1341      state->m_p_timer_root[ n_counter ]->adjust( attotime::from_hz(33868800) * n_duration, n_counter);
13421342   }
13431343}
13441344
src/mame/drivers/sbrkout.c
r10326r10327
100100static MACHINE_RESET( sbrkout )
101101{
102102   sbrkout_state *state = machine->driver_data<sbrkout_state>();
103   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
103   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
104104}
105105
106106
r10326r10327
131131   if (scanline == machine->primary_screen->visible_area().max_y + 1)
132132   {
133133      UINT8 potvalue = input_port_read(machine, "PADDLE");
134      timer_adjust_oneshot(state->pot_timer, machine->primary_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128), 0);
134      state->pot_timer->adjust(machine->primary_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128));
135135   }
136136
137137   /* call us back in 4 scanlines */
138138   scanline += 4;
139139   if (scanline >= machine->primary_screen->height())
140140      scanline = 0;
141   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
141   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
142142}
143143
144144
src/mame/drivers/taitowlf.c
r10326r10327
146146static void mxtc_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data)
147147{
148148   taitowlf_state *state = busdevice->machine->driver_data<taitowlf_state>();
149//  mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", cpuexec_describe_context(machine), function, reg, data);
149//  mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", machine->describe_context(), function, reg, data);
150150
151151   switch(reg)
152152   {
r10326r10327
232232static void piix4_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data)
233233{
234234   taitowlf_state *state = busdevice->machine->driver_data<taitowlf_state>();
235//  mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", cpuexec_describe_context(machine), function, reg, data);
235//  mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine->describe_context(), function, reg, data);
236236   state->piix4_config_reg[function][reg] = data;
237237}
238238
src/mame/drivers/taitogn.c
r10326r10327
362362static void rf5c296_reg_w(ATTR_UNUSED running_machine *machine, UINT8 reg, UINT8 data)
363363{
364364   taitogn_state *state = machine->driver_data<taitogn_state>();
365   //  fprintf(stderr, "rf5c296_reg_w %02x, %02x (%s)\n", reg, data, cpuexec_describe_context(machine));
365   //  fprintf(stderr, "rf5c296_reg_w %02x, %02x (%s)\n", reg, data, machine->describe_context());
366366   switch (reg)
367367   {
368368      // Interrupt and General Control Register
r10326r10327
383383
384384static UINT8 rf5c296_reg_r(ATTR_UNUSED running_machine *machine, UINT8 reg)
385385{
386   //  fprintf(stderr, "rf5c296_reg_r %02x (%s)\n", reg, cpuexec_describe_context(machine));
386   //  fprintf(stderr, "rf5c296_reg_r %02x (%s)\n", reg, machine->describe_context());
387387   return 0x00;
388388}
389389
r10326r10327
586586{
587587   taitogn_state *state = space->machine->driver_data<taitogn_state>();
588588
589   //      fprintf(stderr, "gn_r %08x @ %08x (%s)\n", 0x1fb00000+4*offset, mem_mask, cpuexec_describe_context(space->machine));
589   //      fprintf(stderr, "gn_r %08x @ %08x (%s)\n", 0x1fb00000+4*offset, mem_mask, space->machine->describe_context());
590590   return state->control;
591591}
592592
r10326r10327
617617            control & 0x04 ? 'f' : '-',
618618            control & 0x02 ? '1' : '0',
619619            control & 0x01 ? '1' : '0',
620            cpuexec_describe_context(space->machine));
620            space->machine->describe_context());
621621#endif
622622
623623   if((p ^ state->control) & 0x04)
r10326r10327
786786         psx_sio_install_handler( space->machine, 0, sio_dip_handler );
787787         psx_sio_input( space->machine, 0, PSX_SIO_IN_DSR, 0 );
788788
789         timer_adjust_oneshot( state->dip_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime( 100 ), 1 );
789         state->dip_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime( 100 ), 1 );
790790        }
791791}
792792
r10326r10327
798798
799799   if( param )
800800   {
801      timer_adjust_oneshot(state->dip_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(50), 0);
801      state->dip_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(50));
802802   }
803803}
804804
src/mame/drivers/aristmk5.c
r10326r10327
7676{
7777   /* reset 2KHz timer */
7878   ioc_regs[IRQ_STATUS_A] &= 0xfe;
79   timer_adjust_oneshot(mk5_2KHz_timer, attotime::from_hz(2000), 0);
79   mk5_2KHz_timer->adjust(attotime::from_hz(2000));
8080
8181   return 0xffffffff; //value doesn't matter apparently
8282}
r10326r10327
221221{
222222   ioc_regs[4] |= 1;
223223
224   timer_adjust_oneshot(mk5_2KHz_timer, attotime::never, 0);
224   mk5_2KHz_timer->adjust(attotime::never);
225225}
226226
227227static MACHINE_START( aristmk5 )
r10326r10327
237237static MACHINE_RESET( aristmk5 )
238238{
239239   archimedes_reset(machine);
240   timer_adjust_oneshot(mk5_2KHz_timer, attotime::from_hz(2000), 0);
240   mk5_2KHz_timer->adjust(attotime::from_hz(2000));
241241
242242   ioc_regs[IRQ_STATUS_B] |= 0x40; //hack, set keyboard irq empty to be ON
243243
src/mame/drivers/darkhors.c
r10326r10327
220220static WRITE32_DEVICE_HANDLER( darkhors_eeprom_w )
221221{
222222   if (data & ~0xff000000)
223      logerror("%s: Unknown EEPROM bit written %08X\n",cpuexec_describe_context(device->machine),data);
223      logerror("%s: Unknown EEPROM bit written %08X\n",device->machine->describe_context(),data);
224224
225225   if ( ACCESSING_BITS_24_31 )
226226   {
src/mame/drivers/equites.c
r10326r10327
381381#define FRQ_ADJUSTER_TAG   "FRQ"
382382
383383// MSM5232 clock is generated by a transistor oscillator circuit, not by the pcb xtal
384// The circuit is controlled by a pot to allow adjusting the frequency
384// The circuit is controlled by a pot to allow adjusting the frequency.  All games
385// have been hand-tuned to a recording claiming to be an original recording from the
386// boards.  You can adjust this in the Slider Controls while using -cheat if needed.
387
385388#define MSM5232_MAX_CLOCK 6144000
386389#define MSM5232_MIN_CLOCK  214000   // unstable
387390
388391
392
393
389394/******************************************************************************/
390395// Sound
391396
r10326r10327
417422   state->nmi_timer = machine->scheduler().timer_alloc(FUNC(equites_nmi_callback));
418423
419424   state->adjuster_timer = machine->scheduler().timer_alloc(FUNC(equites_frq_adjuster_callback));
420   timer_adjust_periodic(state->adjuster_timer, attotime::from_hz(60), 0, attotime::from_hz(60));
425   state->adjuster_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60));
421426}
422427
423428static WRITE8_HANDLER(equites_c0f8_w)
r10326r10327
592597   {
593598      case 0: //logerror( "8155 Command register write %x, timer command = %x, interrupt enable = %x, ports = %x\n", data, (data >> 6) & 3, (data >> 4) & 3, data & 0xf );
594599         if (((data >> 6) & 3) == 3)
595            timer_adjust_periodic(state->nmi_timer, attotime::from_hz(XTAL_6_144MHz/2 / state->timer_count), 0, attotime::from_hz(XTAL_6_144MHz/2 / state->timer_count));
600            state->nmi_timer->adjust(attotime::from_hz(XTAL_6_144MHz/2 / state->timer_count), 0, attotime::from_hz(XTAL_6_144MHz/2 / state->timer_count));
596601         break;
597602      case 1: //logerror( "8155 I/O Port A write %x\n", data );
598603         state->eq8155_port_a = data;
r10326r10327
820825
821826   /* this is actually a variable resistor */
822827   PORT_START(FRQ_ADJUSTER_TAG)
823   PORT_ADJUSTER(50, "MSM5232 Clock")
828   PORT_ADJUSTER(25, "MSM5232 Clock")
824829INPUT_PORTS_END
825830
826831/******************************************************************************/
r10326r10327
846851
847852   /* this is actually a variable resistor */
848853   PORT_START(FRQ_ADJUSTER_TAG)
849   PORT_ADJUSTER(50, "MSM5232 Clock")
854   PORT_ADJUSTER(24, "MSM5232 Clock")
850855INPUT_PORTS_END
851856
852857/******************************************************************************/
r10326r10327
882887
883888   /* this is actually a variable resistor */
884889   PORT_START(FRQ_ADJUSTER_TAG)
885   PORT_ADJUSTER(50, "MSM5232 Clock")
890   PORT_ADJUSTER(33, "MSM5232 Clock")
886891INPUT_PORTS_END
887892
888893/******************************************************************************/
r10326r10327
894899   EQUITES_PLAYER_INPUT_MSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START2 )
895900
896901   PORT_START("IN1")
897//  PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
898//  PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED )
902//   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
903//   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED )
899904   PORT_BIT( 0x0300, IP_ACTIVE_HIGH, IPT_COIN1 )
900905#if EASY_TEST_MODE
901906   PORT_SERVICE( 0x0300, IP_ACTIVE_HIGH )
r10326r10327
919924
920925   /* this is actually a variable resistor */
921926   PORT_START(FRQ_ADJUSTER_TAG)
922   PORT_ADJUSTER(50, "MSM5232 Clock")
927   PORT_ADJUSTER(33, "MSM5232 Clock")
923928INPUT_PORTS_END
924929
925930/******************************************************************************/
r10326r10327
955960
956961   /* this is actually a variable resistor */
957962   PORT_START(FRQ_ADJUSTER_TAG)
958   PORT_ADJUSTER(50, "MSM5232 Clock")
963   PORT_ADJUSTER(28, "MSM5232 Clock")
959964INPUT_PORTS_END
960965
961966/******************************************************************************/
r10326r10327
10241029
10251030   /* this is actually a variable resistor */
10261031   PORT_START(FRQ_ADJUSTER_TAG)
1027   PORT_ADJUSTER(50, "MSM5232 Clock")
1032   PORT_ADJUSTER(27, "MSM5232 Clock")
10281033INPUT_PORTS_END
10291034
10301035/******************************************************************************/
src/mame/drivers/ssfindo.c
r10326r10327
266266   int val=((PS7500_IO[T0low]&0xff)|((PS7500_IO[T0high]&0xff)<<8))>>1;
267267
268268   if(val==0)
269      timer_adjust_oneshot(PS7500timer0, attotime::never, 0);
269      PS7500timer0->adjust(attotime::never);
270270   else
271      timer_adjust_periodic(PS7500timer0, attotime::from_usec(val ), 0, attotime::from_usec(val ));
271      PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val ));
272272}
273273
274274static TIMER_CALLBACK( PS7500_Timer1_callback )
r10326r10327
284284{
285285   int val=((PS7500_IO[T1low]&0xff)|((PS7500_IO[T1high]&0xff)<<8))>>1;
286286   if(val==0)
287      timer_adjust_oneshot(PS7500timer1, attotime::never, 0);
287      PS7500timer1->adjust(attotime::never);
288288   else
289      timer_adjust_periodic(PS7500timer1, attotime::from_usec(val ), 0, attotime::from_usec(val ));
289      PS7500timer1->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val ));
290290}
291291
292292static INTERRUPT_GEN( ssfindo_interrupt )
r10326r10327
303303      PS7500_IO[IOCR]         =   0x3f;
304304      PS7500_IO[VIDCR]      =   0;
305305
306      timer_adjust_oneshot( PS7500timer0, attotime::never, 0);
307      timer_adjust_oneshot( PS7500timer1, attotime::never, 0);
306      PS7500timer0->adjust( attotime::never);
307      PS7500timer1->adjust( attotime::never);
308308}
309309
310310static READ32_HANDLER(PS7500_IO_r)
src/mame/drivers/konamigx.c
r10326r10327
606606static TIMER_CALLBACK( dmaend_callback )
607607{
608608   // foul-proof (CPU0 could be deactivated while we wait)
609   if (resume_trigger && suspension_active) { suspension_active = 0; cpuexec_trigger(machine, resume_trigger); }
609   if (resume_trigger && suspension_active) { suspension_active = 0; machine->scheduler().trigger(resume_trigger); }
610610
611611   // DMA busy flag must be cleared before triggering IRQ 3
612612   gx_rdport1_3 &= ~2;
r10326r10327
635635   }
636636
637637   // simulate DMA delay
638   timer_adjust_oneshot(dmadelay_timer, attotime::from_usec(120), 0);
638   dmadelay_timer->adjust(attotime::from_usec(120));
639639}
640640
641641
642642static INTERRUPT_GEN(konamigx_vbinterrupt)
643643{
644644   // lift idle suspension
645   if (resume_trigger && suspension_active) { suspension_active = 0; cpuexec_trigger(device->machine, resume_trigger); }
645   if (resume_trigger && suspension_active) { suspension_active = 0; device->machine->scheduler().trigger(resume_trigger); }
646646
647647   // IRQ 1 is the main 60hz vblank interrupt
648648   if (gx_syncen & 0x20)
r10326r10327
662662static INTERRUPT_GEN(konamigx_vbinterrupt_type4)
663663{
664664   // lift idle suspension
665   if (resume_trigger && suspension_active) { suspension_active = 0; cpuexec_trigger(device->machine, resume_trigger); }
665   if (resume_trigger && suspension_active) { suspension_active = 0; device->machine->scheduler().trigger(resume_trigger); }
666666
667667   // IRQ 1 is the main 60hz vblank interrupt
668668   // the gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board
src/mame/drivers/combatsc.c
r10326r10327
366366      if (state->boost)
367367      {
368368         state->boost = 0;
369         timer_adjust_periodic(state->interleave_timer, attotime::zero, 0, state->audiocpu->cycles_to_attotime(80));
369         state->interleave_timer->adjust(attotime::zero, 0, state->audiocpu->cycles_to_attotime(80));
370370      }
371371      else if (status & 2)
372372      {
373373         state->boost = 1;
374         timer_adjust_oneshot(state->interleave_timer, attotime::zero, 0);
374         state->interleave_timer->adjust(attotime::zero);
375375      }
376376   }
377377
src/mame/drivers/tubep.c
r10326r10327
325325   if (scanline >= 264)
326326      scanline = 0;
327327
328   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
328   interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
329329}
330330
331331
r10326r10327
357357
358358static MACHINE_RESET( tubep )
359359{
360   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(0), 0);
360   interrupt_timer->adjust(machine->primary_screen->time_until_pos(0));
361361}
362362
363363
r10326r10327
505505   if (scanline >= 264)
506506      scanline = 0;
507507
508   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(scanline), scanline);
508   interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
509509}
510510
511511
r10326r10327
519519
520520static MACHINE_RESET( rjammer )
521521{
522   timer_adjust_oneshot(interrupt_timer, machine->primary_screen->time_until_pos(0), 0);
522   interrupt_timer->adjust(machine->primary_screen->time_until_pos(0));
523523}
524524
525525
src/mame/drivers/gamecstl.c
r10326r10327
184184
185185static void mxtc_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data)
186186{
187//  mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", cpuexec_describe_context(busdevice->machine), function, reg, data);
187//  mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", busdevice->machine->describe_context(), function, reg, data);
188188
189189   switch(reg)
190190   {
r10326r10327
268268
269269static void piix4_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data)
270270{
271//  mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", cpuexec_describe_context(busdevice->machine), function, reg, data);
271//  mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", busdevice->machine->describe_context(), function, reg, data);
272272   piix4_config_reg[function][reg] = data;
273273}
274274
src/mame/drivers/segas16b.c
r10326r10327
11101110
11111111static TIMER_CALLBACK( boost_interleave )
11121112{
1113   cpuexec_boost_interleave(machine, attotime::zero, attotime::from_msec(10));
1113   machine->scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
11141114}
11151115
11161116
src/mame/drivers/jpmsys5.c
r10326r10327
263263   }
264264   else
265265   {
266      logerror("%s: upd7759: Unknown write to %x with %x\n", cpuexec_describe_context(device->machine),  offset, data);
266      logerror("%s: upd7759: Unknown write to %x with %x\n", device->machine->describe_context(),  offset, data);
267267   }
268268}
269269
r10326r10327
351351
352352         if (++touch_data_count == 3)
353353         {
354            timer_reset(touch_timer, attotime::never);
354            touch_timer->reset();
355355            touch_state = IDLE;
356356         }
357357         else
r10326r10327
378378      /* Start sending the data to the 68000 serially */
379379      touch_data_count = 0;
380380      touch_state = START;
381      timer_adjust_periodic(touch_timer, rx_period, 0, rx_period);
381      touch_timer->adjust(rx_period, 0, rx_period);
382382   }
383383}
384384
r10326r10327
582582
583583static MACHINE_RESET( jpmsys5v )
584584{
585   timer_reset(touch_timer, attotime::never);
585   touch_timer->reset();
586586   touch_state = IDLE;
587587   a2_data_in = 1;
588588   a2_acia_dcd = 0;
src/mame/drivers/m107.c
r10326r10327
6262static MACHINE_RESET( m107 )
6363{
6464   m107_state *state = machine->driver_data<m107_state>();
65   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0), 0);
65   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0));
6666}
6767
6868/*****************************************************************************/
r10326r10327
8989   /* adjust for next scanline */
9090   if (++scanline >= machine->primary_screen->height())
9191      scanline = 0;
92   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(scanline), scanline);
92   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
9393}
9494
9595
src/mame/drivers/igs011.c
r10326r10327
865865         break;
866866   }
867867
868   logerror("%s: warning, unknown igs011_prot1_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
868   logerror("%s: warning, unknown igs011_prot1_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
869869}
870870static READ16_HANDLER( igs011_prot1_r )
871871{
r10326r10327
937937      igs011_prot2++;
938938   }
939939//  else
940//      logerror("%s: warning, unknown igs011_prot2_inc_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
940//      logerror("%s: warning, unknown igs011_prot2_inc_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
941941}
942942
943943// vbowl (33)
r10326r10327
948948      igs011_prot2--;
949949   }
950950//  else
951//      logerror("%s: warning, unknown igs011_prot2_dec_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
951//      logerror("%s: warning, unknown igs011_prot2_dec_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
952952}
953953
954954
r10326r10327
964964      igs011_prot2 = ((BIT(x,3)&BIT(x,0))<<4) | (BIT(x,2)<<3) | ((BIT(x,0)|BIT(x,1))<<2) | ((BIT(x,2)^BIT(x,4)^1)<<1) | (BIT(x,1)^1^BIT(x,3));
965965   }
966966//  else
967//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
967//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
968968}
969969
970970// lhb, xymg, lhb2
r10326r10327
979979      igs011_prot2 = (((BIT(x,0)^1)|BIT(x,1))<<2) | (BIT(x,2)<<1) | (BIT(x,0)&BIT(x,1));
980980   }
981981//  else
982//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
982//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
983983}
984984
985985// wlcc
r10326r10327
994994      igs011_prot2 = ((BIT(x,3)^BIT(x,2))<<4) | ((BIT(x,2)^BIT(x,1))<<3) | ((BIT(x,1)^BIT(x,0))<<2) | ((BIT(x,4)^BIT(x,0)^1)<<1) | (BIT(x,4)^BIT(x,3)^1);
995995   }
996996//  else
997//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
997//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
998998}
999999
10001000// vbowl
r10326r10327
10091009      igs011_prot2 = ((BIT(x,3)^BIT(x,2))<<4) | ((BIT(x,2)^BIT(x,1))<<3) | ((BIT(x,1)^BIT(x,0))<<2) | ((BIT(x,4)^BIT(x,0))<<1) | (BIT(x,4)^BIT(x,3));
10101010   }
10111011//  else
1012//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", cpuexec_describe_context(space->machine), offset, data);
1012//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine->describe_context(), offset, data);
10131013}
10141014
10151015
r10326r10327
11281128      igs012_prot_mode = igs012_prot_mode ^ 1;
11291129   }
11301130   else
1131      logerror("%s: warning, unknown igs012_prot_mode_w( %04x, %04x ), mode %x\n", cpuexec_describe_context(space->machine), offset, data, igs012_prot_mode);
1131      logerror("%s: warning, unknown igs012_prot_mode_w( %04x, %04x ), mode %x\n", space->machine->describe_context(), offset, data, igs012_prot_mode);
11321132}
11331133
11341134static WRITE16_HANDLER( igs012_prot_inc_w )
r10326r10327
11381138      igs012_prot = (igs012_prot + 1) & 0x1f;
11391139   }
11401140   else
1141      logerror("%s: warning, unknown igs012_prot_inc_w( %04x, %04x ), mode %x\n", cpuexec_describe_context(space->machine), offset, data, igs012_prot_mode);
1141      logerror("%s: warning, unknown igs012_prot_inc_w( %04x, %04x ), mode %x\n", space->machine->describe_context(), offset, data, igs012_prot_mode);
11421142}
11431143
11441144static WRITE16_HANDLER( igs012_prot_dec_inc_w )
r10326r10327
11521152      igs012_prot = (igs012_prot + 1) & 0x1f;
11531153   }
11541154   else
1155      logerror("%s: warning, unknown igs012_prot_dec_inc_w( %04x, %04x ), mode %x\n", cpuexec_describe_context(space->machine), offset, data, igs012_prot_mode);
1155      logerror("%s: warning, unknown igs012_prot_dec_inc_w( %04x, %04x ), mode %x\n", space->machine->describe_context(), offset, data, igs012_prot_mode);
11561156}
11571157
11581158static WRITE16_HANDLER( igs012_prot_dec_copy_w )
r10326r10327
11661166      igs012_prot = (igs012_prot - 1) & 0x1f;
11671167   }
11681168   else
1169      logerror("%s: warning, unknown igs012_prot_dec_copy_w( %04x, %04x ), mode %x\n", cpuexec_describe_context(space->machine), offset, data, igs012_prot_mode);
1169      logerror("%s: warning, unknown igs012_prot_dec_copy_w( %04x, %04x ), mode %x\n", space->machine->describe_context(), offset, data, igs012_prot_mode);
11701170}
11711171
11721172static WRITE16_HANDLER( igs012_prot_copy_w )
r10326r10327
11761176      igs012_prot = igs012_prot_swap;
11771177   }
11781178   else
1179      logerror("%s: warning, unknown igs012_prot_copy_w( %04x, %04x ), mode %x\n", cpuexec_describe_context(space->machine), offset, data, igs012_prot_mode);
1179      logerror("%s: warning, unknown igs012_prot_copy_w( %04x, %04x ), mode %x\n", space->machine->describe_context(), offset, data, igs012_prot_mode);
11801180}
11811181
11821182static WRITE16_HANDLER( igs012_prot_swap_w )
r10326r10327
11881188      igs012_prot_swap = (((BIT(x,3)|BIT(x,1))^1)<<3) | ((BIT(x,2)&BIT(x,1))<<2) | ((BIT(x,3)^BIT(x,0))<<1) | (BIT(x,2)^1);
11891189   }
11901190   else
1191      logerror("%s: warning, unknown igs012_prot_swap_w( %04x, %04x ), mode %x\n", cpuexec_describe_context(space->machine), offset, data, igs012_prot_mode);
1191      logerror("%s: warning, unknown igs012_prot_swap_w( %04x, %04x ), mode %x\n", space->machine->describe_context(), offset, data, igs012_prot_mode);
11921192}
11931193
11941194static READ16_HANDLER( igs012_prot_r )
r10326r10327
20762076   }
20772077
20782078   if ( data & (~0x200) )
2079      logerror("%s: warning, unknown bits written in oki bank = %02x\n", cpuexec_describe_context(device->machine), data);
2079      logerror("%s: warning, unknown bits written in oki bank = %02x\n", device->machine->describe_context(), data);
20802080
20812081//  popmessage("oki %04x",data);
20822082}
src/mame/drivers/cave.c
r10326r10327
289289static WRITE16_DEVICE_HANDLER( cave_eeprom_msb_w )
290290{
291291   if (data & ~0xfe00)
292      logerror("%s: Unknown EEPROM bit written %04X\n", cpuexec_describe_context(device->machine), data);
292      logerror("%s: Unknown EEPROM bit written %04X\n", device->machine->describe_context(), data);
293293
294294   if (ACCESSING_BITS_8_15)  // even address
295295   {
r10326r10327
333333static WRITE16_DEVICE_HANDLER( cave_eeprom_lsb_w )
334334{
335335   if (data & ~0x00ef)
336      logerror("%s: Unknown EEPROM bit written %04X\n",cpuexec_describe_context(device->machine),data);
336      logerror("%s: Unknown EEPROM bit written %04X\n",device->machine->describe_context(),data);
337337
338338   if (ACCESSING_BITS_0_7)  // odd address
339339   {
r10326r10327
368368static WRITE16_DEVICE_HANDLER( metmqstr_eeprom_msb_w )
369369{
370370   if (data & ~0xff00)
371      logerror("%s: Unknown EEPROM bit written %04X\n", cpuexec_describe_context(device->machine), data);
371      logerror("%s: Unknown EEPROM bit written %04X\n", device->machine->describe_context(), data);
372372
373373   if (ACCESSING_BITS_8_15)  // even address
374374   {
r10326r10327
684684   cave_state *state = device->machine->driver_data<cave_state>();
685685   if (data & ~0x7000)
686686   {
687      logerror("%s: Unknown EEPROM bit written %04X\n",cpuexec_describe_context(device->machine),data);
687      logerror("%s: Unknown EEPROM bit written %04X\n",device->machine->describe_context(),data);
688688      COMBINE_DATA(&state->leds[1]);
689689      show_leds(device->machine);
690690   }
r10326r10327
905905static WRITE16_DEVICE_HANDLER( tjumpman_eeprom_lsb_w )
906906{
907907   if (data & ~0x0038)
908      logerror("%s: Unknown EEPROM bit written %04X\n",cpuexec_describe_context(device->machine),data);
908      logerror("%s: Unknown EEPROM bit written %04X\n",device->machine->describe_context(),data);
909909
910910   if (ACCESSING_BITS_0_7)  // odd address
911911   {
src/mame/drivers/fuukifg3.c
r10326r10327
221221      {
222222         const rectangle &visarea = space->machine->primary_screen->visible_area();
223223         attotime period = space->machine->primary_screen->frame_period();
224         timer_adjust_periodic(state->raster_interrupt_timer, space->machine->primary_screen->time_until_pos(state->vregs[0x1c / 4] >> 16, visarea.max_x + 1), 0, period);
224         state->raster_interrupt_timer->adjust(space->machine->primary_screen->time_until_pos(state->vregs[0x1c / 4] >> 16, visarea.max_x + 1), 0, period);
225225      }
226226   }
227227}
r10326r10327
504504   fuuki32_state *state = machine->driver_data<fuuki32_state>();
505505   cpu_set_input_line(state->maincpu, 5, HOLD_LINE);   // Raster Line IRQ
506506   machine->primary_screen->update_partial(machine->primary_screen->vpos());
507   timer_adjust_oneshot(state->raster_interrupt_timer, machine->primary_screen->frame_period(), 0);
507   state->raster_interrupt_timer->adjust(machine->primary_screen->frame_period());
508508}
509509
510510
r10326r10327
532532
533533   machine->scheduler().timer_set(machine->primary_screen->time_until_pos(248), FUNC(level_1_interrupt_callback));
534534   machine->scheduler().timer_set(machine->primary_screen->time_until_vblank_start(), FUNC(vblank_interrupt_callback));
535   timer_adjust_oneshot(state->raster_interrupt_timer, machine->primary_screen->time_until_pos(0, visarea.max_x + 1), 0);
535   state->raster_interrupt_timer->adjust(machine->primary_screen->time_until_pos(0, visarea.max_x + 1));
536536}
537537
538538
src/mame/drivers/pirates.c
r10326r10327
132132//  offs_t pc;
133133   int bit;
134134
135//  logerror("%s: IN1_r\n",cpuexec_describe_context(field->port->machine));
135//  logerror("%s: IN1_r\n",field->port->machine->describe_context());
136136
137137#if 0
138138   /* Pirates protection workaround. It more complicated than this... see code at
src/mame/drivers/mquake.c
r10326r10327
6666static READ8_DEVICE_HANDLER( mquake_cia_0_portb_r )
6767{
6868   /* parallel port */
69   logerror("%s:CIA0_portb_r\n", cpuexec_describe_context(device->machine));
69   logerror("%s:CIA0_portb_r\n", device->machine->describe_context());
7070   return 0xff;
7171}
7272
7373static WRITE8_DEVICE_HANDLER( mquake_cia_0_portb_w )
7474{
7575   /* parallel port */
76   logerror("%s:CIA0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data);
76   logerror("%s:CIA0_portb_w(%02x)\n", device->machine->describe_context(), data);
7777}
7878
7979
src/mame/drivers/nmk16.c
r10326r10327
47304730   downcast<okim6295_device *>(device)->set_bank_base((data & 3) * 0x40000);
47314731
47324732   if (data & (~3))
4733      logerror("%s: invalid oki bank %02x\n", cpuexec_describe_context(device->machine), data);
4733      logerror("%s: invalid oki bank %02x\n", device->machine->describe_context(), data);
47344734
47354735//  logerror("%04x: oki bank %02x\n", cpu_get_pc(space->cpu), data);
47364736}
src/osd/windows/drawnone.c
r10326r10327
4444#include <windows.h>
4545
4646// MAME headers
47#include "emucore.h"
47#include "emu.h"
4848
4949// MAMEOS headers
5050#include "window.h"
src/osd/windows/drawgdi.c
r10326r10327
4444#include <windows.h>
4545
4646// MAME headers
47#include "emucore.h"
47#include "emu.h"
4848
4949// MAMEOS headers
5050#include "window.h"
src/osd/windows/winmenu.c
r10326r10327
4343#define WIN32_LEAN_AND_MEAN
4444#include <windows.h>
4545
46#include "emu.h"
47
4648#include "window.h"
4749
4850//============================================================
src/emu/debug/express.h
r10326r10327
132132// symbol_entry describes a symbol in a symbol table
133133class symbol_entry
134134{
135   friend class tagged_list<symbol_entry>;
135   friend class simple_list<symbol_entry>;
136136
137137protected:
138138   // symbol types
src/emu/debug/express.c
r10326r10327
5959***************************************************************************/
6060
6161#include "emucore.h"
62#include "emutempl.h"
6263#include "express.h"
6364#include <ctype.h>
6465
r10326r10327
444445void symbol_table::add(const char *name, read_write rw, UINT64 *ptr)
445446{
446447   m_symlist.remove(name);
447   m_symlist.append(name, global_alloc(integer_symbol_entry(*this, name, rw, ptr)));
448   m_symlist.append(name, *global_alloc(integer_symbol_entry(*this, name, rw, ptr)));
448449}
449450
450451
r10326r10327
455456void symbol_table::add(const char *name, UINT64 value)
456457{
457458   m_symlist.remove(name);
458   m_symlist.append(name, global_alloc(integer_symbol_entry(*this, name, value)));
459   m_symlist.append(name, *global_alloc(integer_symbol_entry(*this, name, value)));
459460}
460461
461462
r10326r10327
466467void symbol_table::add(const char *name, void *ref, getter_func getter, setter_func setter)
467468{
468469   m_symlist.remove(name);
469   m_symlist.append(name, global_alloc(integer_symbol_entry(*this, name, ref, getter, setter)));
470   m_symlist.append(name, *global_alloc(integer_symbol_entry(*this, name, ref, getter, setter)));
470471}
471472
472473
r10326r10327
477478void symbol_table::add(const char *name, void *ref, int minparams, int maxparams, execute_func execute)
478479{
479480   m_symlist.remove(name);
480   m_symlist.append(name, global_alloc(function_symbol_entry(*this, name, ref, minparams, maxparams, execute)));
481   m_symlist.append(name, *global_alloc(function_symbol_entry(*this, name, ref, minparams, maxparams, execute)));
481482}
482483
483484
src/emu/cpu/h83002/h8_8.c
r10326r10327
410410   // if "no clock source", stop
411411   if (div < 2)
412412   {
413      timer_adjust_oneshot(h8->timer[(t*2)], attotime::never, 0);
414      timer_adjust_oneshot(h8->timer[(t*2)+1], attotime::never, 0);
413      h8->timer[(t*2)]->adjust(attotime::never);
414      h8->timer[(t*2)+1]->adjust(attotime::never);
415415      return;
416416   }
417417
418418   if (h8->TCORA[t])
419419   {
420420      time = (h8->device->unscaled_clock() / dividers[div]) / (h8->TCORA[t] - h8->TCNT[t]);
421      timer_adjust_oneshot(h8->timer[(t*2)], attotime::from_hz(time), 0);
421      h8->timer[(t*2)]->adjust(attotime::from_hz(time));
422422   }
423423
424424   if (h8->TCORB[t])
425425   {
426426      time = (h8->device->unscaled_clock() / dividers[div]) / (h8->TCORB[t] - h8->TCNT[t]);
427      timer_adjust_oneshot(h8->timer[(t*2)+1], attotime::from_hz(time), 0);
427      h8->timer[(t*2)+1]->adjust(attotime::from_hz(time));
428428   }
429429}
430430
r10326r10327
433433{
434434   static const int irqbase[2] = { 19, 22 };
435435
436   timer_adjust_oneshot(h8->timer[(t*2)+sel], attotime::never, 0);
436   h8->timer[(t*2)+sel]->adjust(attotime::never);
437437
438438   h8->TCSR[t] |= ((0x40)<<sel);
439439
src/emu/cpu/h83002/h8periph.c
r10326r10327
4242
4343static void h8itu_timer_expire(h83xx_state *h8, int which)
4444{
45   timer_adjust_oneshot(h8->timer[which], attotime::never, 0);
45   h8->timer[which]->adjust(attotime::never);
4646   h8->h8TCNT[which] = 0;
4747   h8->per_regs[tsr[which]] |= 4;
4848   // interrupt on overflow ?
r10326r10327
103103      logerror("H8/3002: Timer %d is using an external clock.  Unsupported!\n", tnum);
104104   }
105105
106   timer_adjust_oneshot(h8->timer[tnum], period, 0);
106   h8->timer[tnum]->adjust(period);
107107}
108108
109109static void h8_itu_sync_timers(h83xx_state *h8, int tnum)
r10326r10327
116116
117117   // get the time per unit
118118   cycle_time = attotime::from_hz(h8->device->unscaled_clock()) * tscales[ourTCR & 3];
119   cur = timer_timeelapsed(h8->timer[tnum]);
119   cur = h8->timer[tnum]->elapsed();
120120
121121   ratio = cur.as_double() / cycle_time.as_double();
122122
r10326r10327
464464      logerror("H8/3007: Timer %d is using an external clock.  Unsupported!\n", tnum);
465465   }
466466
467   timer_adjust_oneshot(h8->timer[tnum], period, 0);
467   h8->timer[tnum]->adjust(period);
468468}
469469
470470static void h8itu_3007_timer_expire(h83xx_state *h8, int tnum)
r10326r10327
489489      else
490490      {
491491         //logerror("h8/3007 timer %d GRA match, stopping\n",tnum);
492         timer_adjust_oneshot(h8->timer[tnum], attotime::never, 0);
492         h8->timer[tnum]->adjust(attotime::never);
493493      }
494494
495495      h8->per_regs[0x64] |= 1<<tnum;
r10326r10327
511511      else
512512      {
513513         //logerror("h8/3007 timer %d GRB match, stopping\n",tnum);
514         timer_adjust_oneshot(h8->timer[tnum], attotime::never, 0);
514         h8->timer[tnum]->adjust(attotime::never);
515515      }
516516
517517      h8->per_regs[0x65] |= 1<<tnum;
r10326r10327
790790
791791   // stop all the timers
792792   for (i=0; i<5; i++)
793      timer_adjust_oneshot(h8->timer[i], attotime::never, 0);
793      h8->timer[i]->adjust(attotime::never);
794794}
src/emu/cpu/tms34010/tms34010.c
r10326r10327
653653
654654   /* allocate a scanline timer and set it to go off at the start */
655655   tms->scantimer = device->machine->scheduler().timer_alloc(FUNC(scanline_callback), tms);
656   timer_adjust_oneshot(tms->scantimer, attotime::zero, 0);
656   tms->scantimer->adjust(attotime::zero);
657657
658658   /* allocate the shiftreg */
659659   tms->shiftreg = auto_alloc_array(device->machine, UINT16, SHIFTREG_SIZE/2);
r10326r10327
10401040
10411041   /* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */
10421042   /* but helps ensure that masters are updated first before slaves */
1043   timer_adjust_oneshot(tms->scantimer, tms->screen->time_until_pos(vcount) + attotime(0, !master), vcount);
1043   tms->scantimer->adjust(tms->screen->time_until_pos(vcount) + attotime(0, !master), vcount);
10441044}
10451045
10461046
r10326r10327
12701270   }
12711271
12721272//  if (LOG_CONTROL_REGS)
1273//      logerror("%s: %s = %04X (%d)\n", cpuexec_describe_context(tms->device->machine), ioreg_name[offset], IOREG(tms, offset), tms->screen->vpos());
1273//      logerror("%s: %s = %04X (%d)\n", tms->device->machine->describe_context(), ioreg_name[offset], IOREG(tms, offset), tms->screen->vpos());
12741274}
12751275
12761276
r10326r10327
13071307   IOREG(tms, offset) = data;
13081308
13091309//  if (LOG_CONTROL_REGS)
1310//      logerror("%s: %s = %04X (%d)\n", cpuexec_describe_context(device->machine), ioreg020_name[offset], IOREG(tms, offset), tms->screen->vpos());
1310//      logerror("%s: %s = %04X (%d)\n", device->machine->describe_context(), ioreg020_name[offset], IOREG(tms, offset), tms->screen->vpos());
13111311
13121312   switch (offset)
13131313   {
r10326r10327
14661466   int result, total;
14671467
14681468//  if (LOG_CONTROL_REGS)
1469//      logerror("%s: read %s\n", cpuexec_describe_context(device->machine), ioreg_name[offset]);
1469//      logerror("%s: read %s\n", device->machine->describe_context(), ioreg_name[offset]);
14701470
14711471   switch (offset)
14721472   {
r10326r10327
14941494         /* have an IRQ handler. For this reason, we return it signalled a bit early in order */
14951495         /* to make it past these loops. */
14961496         if (SMART_IOREG(tms, VCOUNT) + 1 == SMART_IOREG(tms, DPYINT) &&
1497            timer_timeleft(tms->scantimer) < attotime::from_hz(40000000/8/3))
1497            tms->scantimer->remaining() < attotime::from_hz(40000000/8/3))
14981498            result |= TMS34010_DI;
14991499         return result;
15001500   }
r10326r10327
15091509   int result, total;
15101510
15111511//  if (LOG_CONTROL_REGS)
1512//      logerror("%s: read %s\n", cpuexec_describe_context(device->machine), ioreg_name[offset]);
1512//      logerror("%s: read %s\n", device->machine->describe_context(), ioreg_name[offset]);
15131513
15141514   switch (offset)
15151515   {
src/emu/cpu/m37710/m37710.c
r10326r10327
266266   int which = param;
267267   int curirq = M37710_LINE_TIMERA0 - which;
268268
269   timer_adjust_oneshot(cpustate->timers[which], cpustate->reload[which], param);
269   cpustate->timers[which]->adjust(cpustate->reload[which], param);
270270
271271   cpustate->m37710_regs[m37710_irq_levels[curirq]] |= 0x04;
272272   m37710_set_irq_line(cpustate, curirq, PULSE_LINE);
r10326r10327
334334               mame_printf_debug("Timer %d in timer mode, %f Hz\n", timer, 1.0 / time.as_double());
335335               #endif
336336
337               timer_adjust_oneshot(cpustate->timers[timer], time, timer);
337               cpustate->timers[timer]->adjust(time, timer);
338338               cpustate->reload[timer] = time;
339339               break;
340340
r10326r10327
369369               mame_printf_debug("Timer %d in timer mode, %f Hz\n", timer, 1.0 / time.as_double());
370370               #endif
371371
372               timer_adjust_oneshot(cpustate->timers[timer], time, timer);
372               cpustate->timers[timer]->adjust(time, timer);
373373               cpustate->reload[timer] = time;
374374               break;
375375
src/emu/cpu/cpu.mak
r10326r10327
16311631
16321632ifneq ($(filter TMS57002,$(CPUS)),)
16331633OBJDIRS += $(CPUOBJ)/tms57002
1634CPUOBJS += $(CPUOBJ)/tms57002/tms57002.o
1634CPUOBJS += $(CPUOBJ)/tms57002/tms57002.o $(CPUOBJ)/tms57002/tms57kdec.o
16351635DASMOBJS += $(CPUOBJ)/tms57002/57002dsm.o
16361636TMSMAKE += $(BUILDOUT)/tmsmake$(BUILD_EXE)
16371637endif
16381638
16391639$(CPUOBJ)/tms57002/tms57002.o:   $(CPUSRC)/tms57002/tms57002.c \
16401640                        $(CPUSRC)/tms57002/tms57002.h \
1641                        $(CPUSRC)/tms57002/tms57kpr.h \
16411642                        $(CPUOBJ)/tms57002/tms57002.inc
16421643
1644$(CPUOBJ)/tms57002/tms57kdec.o:   $(CPUSRC)/tms57002/tms57kdec.c \
1645                        $(CPUSRC)/tms57002/tms57002.h \
1646                        $(CPUSRC)/tms57002/tms57kpr.h \
1647                        $(CPUOBJ)/tms57002/tms57002.inc
1648
16431649$(CPUOBJ)/tms57002/57002dsm.o:   $(CPUSRC)/tms57002/57002dsm.c \
16441650                        $(CPUOBJ)/tms57002/tms57002.inc
16451651
src/emu/cpu/tms57002/tms57002.c
r10326r10327
11#include "emu.h"
22#include "debugger.h"
33#include "tms57002.h"
4#include "tms57kpr.h"
45
5CPU_DISASSEMBLE(tms57002);
6
7#ifdef __GNUC__
8#define noinline __attribute__((noinline))
9#else
10#define noinline /* */
11#endif
12
13enum {
14   IN_PLOAD = 0x00000001,
15   IN_CLOAD = 0x00000002,
16   SU_CVAL  = 0x00000004,
17   SU_MASK  = 0x00000018, SU_ST0 = 0x00, SU_ST1 = 0x08, SU_PRG = 0x10,
18   S_IDLE   = 0x00000020,
19   S_READ   = 0x00000040,
20   S_WRITE  = 0x00000080,
21   S_BRANCH = 0x00000100,
22   S_HOST   = 0x00000200
23};
24
25enum {
26   ST0_INCS = 0x000001,
27   ST0_DIRI = 0x000002,
28   ST0_FI   = 0x000004,
29   ST0_SIM  = 0x000008,
30   ST0_PLRI = 0x000020,
31   ST0_PBCI = 0x000040,
32   ST0_DIRO = 0x000080,
33   ST0_FO   = 0x000100,
34   ST0_SOM  = 0x000600,
35   ST0_PLRO = 0x000800,
36   ST0_PBCO = 0x001000,
37   ST0_CNS  = 0x002000,
38   ST0_WORD = 0x004000,
39   ST0_SEL  = 0x008000,
40   ST0_M    = 0x030000, ST0_M_64K = 0x000000, ST0_M_256K = 0x010000, ST0_M_1M = 0x020000,
41   ST0_SRAM = 0x200000,
42
43   ST1_AOV  = 0x000001,
44   ST1_SFAI = 0x000002,
45   ST1_SFAO = 0x000004,
46   ST1_MOVM = 0x000020,
47   ST1_MOV  = 0x000040,
48   ST1_SFMA = 0x000180, ST1_SFMA_SHIFT = 7,
49   ST1_SFMO = 0x001800, ST1_SFMO_SHIFT = 11,
50   ST1_RND  = 0x038000, ST1_RND_SHIFT = 15,
51   ST1_CRM  = 0x0C0000, ST1_CRM_SHIFT = 18, ST1_CRM_32 = 0x000000, ST1_CRM_16H = 0x040000, ST1_CRM_16L = 0x080000,
52   ST1_DBP  = 0x100000,
53   ST1_CAS  = 0x200000,
54
55   ST1_CACHE = ST1_SFAI|ST1_SFAO|ST1_MOVM|ST1_SFMA|ST1_SFMO|ST1_RND|ST1_CRM|ST1_DBP
56};
57
58enum { BR_UB, BR_CB, BR_IDLE };
59
60enum { IBS = 8192, HBS = 4096 };
61
62typedef struct {
63   unsigned short op;
64   short next;
65   unsigned char param;
66} icd;
67
68typedef struct {
69   unsigned int st1;
70   short ipc;
71   short next;
72} hcd;
73
74typedef struct {
75   short hashbase[256];
76   hcd hashnode[HBS];
77   icd inst[IBS];
78   int hused, iused;
79} cd;
80
81typedef struct {
82   int branch;
83   short hnode;
84   short ipc;
85} cstate;
86
87typedef struct {
88   INT64 macc;
89
90   UINT32 cmem[256];
91   UINT32 dmem0[256];
92   UINT32 dmem1[32];
93
94   UINT32 si[4], so[4];
95
96   UINT32 st0, st1, sti;
97   UINT32 aacc, xoa, xba, xwr, xrd, creg;
98
99   UINT8 pc, ca, id, ba0, ba1, rptc, rptc_next, sa;
100
101   UINT32 xm_adr;
102
103   UINT8 host[4], hidx, allow_update;
104
105   cd cache;
106
107   address_space *program, *data;
108   int icount;
109   int unsupported_inst_warning;
110} tms57002_t;
111
1126INLINE tms57002_t *get_safe_token(device_t *device)
1137{
1148   assert(device != NULL);
r10326r10327
1018912}
1019913#endif
1020914
1021INLINE int xmode(UINT32 opcode, char type)
1022{
1023   if(((opcode & 0x400) && (type == 'c')) || (!(opcode & 0x400) && (type == 'd'))) {
1024      if(opcode & 0x100)
1025         return 0;
1026      else if(opcode & 0x80)
1027         return 2;
1028      else
1029         return 1;
1030   } else if(opcode & 0x200)
1031      return 2;
1032
1033   return 1;
1034}
1035
1036INLINE int sfao(UINT32 st1)
1037{
1038   return st1 & ST1_SFAO ? 1 : 0;
1039}
1040
1041INLINE int dbp(UINT32 st1)
1042{
1043   return st1 & ST1_DBP ? 1 : 0;
1044}
1045
1046INLINE int crm(UINT32 st1)
1047{
1048   return (st1 & ST1_CRM) >> ST1_CRM_SHIFT;
1049}
1050
1051INLINE int sfai(UINT32 st1)
1052{
1053   return st1 & ST1_SFAI ? 1 : 0;
1054}
1055
1056INLINE int sfmo(UINT32 st1)
1057{
1058   return (st1 & ST1_SFMO) >> ST1_SFMO_SHIFT;
1059}
1060
1061INLINE int rnd(UINT32 st1)
1062{
1063   return (st1 & ST1_RND) >> ST1_RND_SHIFT;
1064}
1065
1066INLINE int movm(UINT32 st1)
1067{
1068   return st1 & ST1_MOVM ? 1 : 0;
1069}
1070
1071INLINE int sfma(UINT32 st1)
1072{
1073   return (st1 & ST1_SFMA) >> ST1_SFMA_SHIFT;
1074}
1075
1076915static void tms57002_cache_flush(tms57002_t *s)
1077916{
1078917   int i;
r10326r10327
1091930   }
1092931}
1093932
1094static void tms57002_decode_error(tms57002_t *s, UINT32 opcode)
1095{
1096   char buf[256];
1097   UINT8 opr[3];
1098   if(s->unsupported_inst_warning)
1099      return;
1100
1101   s->unsupported_inst_warning = 1;
1102   opr[0] = opcode;
1103   opr[1] = opcode >> 8;
1104   opr[2] = opcode >> 16;
1105
1106   CPU_DISASSEMBLE_NAME(tms57002)(0, buf, s->pc, opr, opr, 0);
1107   popmessage("tms57002: %s - Contact Mamedev", buf);
1108}
1109
1110static void tms57002_decode_cat1(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
1111{
1112   switch(opcode >> 18) {
1113   case 0x00: // nop
1114      break;
1115
1116#define CDEC1
1117#include "cpu/tms57002/tms57002.inc"
1118#undef CDEC1
1119
1120   default:
1121      tms57002_decode_error(s, opcode);
1122      break;
1123   }
1124}
1125
1126static void tms57002_decode_cat2_pre(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
1127{
1128   switch((opcode >> 11) & 0x7f) {
1129   case 0x00: // nop
1130      break;
1131
1132#define CDEC2A
1133#include "cpu/tms57002/tms57002.inc"
1134#undef CDEC2A
1135
1136   default:
1137      tms57002_decode_error(s, opcode);
1138      break;
1139   }
1140}
1141
1142static void tms57002_decode_cat2_post(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
1143{
1144   switch((opcode >> 11) & 0x7f) {
1145   case 0x00: // nop
1146      break;
1147
1148#define CDEC2B
1149#include "cpu/tms57002/tms57002.inc"
1150#undef CDEC2B
1151
1152   default:
1153      tms57002_decode_error(s, opcode);
1154      break;
1155   }
1156}
1157
1158static void tms57002_decode_cat3(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
1159{
1160   switch((opcode >> 11) & 0x7f) {
1161   case 0x00: // nop
1162      break;
1163
1164#define CDEC3
1165#include "cpu/tms57002/tms57002.inc"
1166#undef CDEC3
1167
1168   default:
1169      tms57002_decode_error(s, opcode);
1170      break;
1171   }
1172}
1173
1174933static void tms57002_add_one(tms57002_t *s, cstate *cs, unsigned short op, UINT8 param)
1175934{
1176935   short ipc = s->cache.iused++;
src/emu/cpu/tms57002/tms57kpr.h
r0r10327
1#ifndef TMS57KPRIVATE_H
2#define TMS57KPRIVATE_H
3
4CPU_DISASSEMBLE(tms57002);
5
6#ifdef __GNUC__
7#define noinline __attribute__((noinline))
8#else
9#define noinline /* */
10#endif
11
12enum {
13   IN_PLOAD = 0x00000001,
14   IN_CLOAD = 0x00000002,
15   SU_CVAL  = 0x00000004,
16   SU_MASK  = 0x00000018, SU_ST0 = 0x00, SU_ST1 = 0x08, SU_PRG = 0x10,
17   S_IDLE   = 0x00000020,
18   S_READ   = 0x00000040,
19   S_WRITE  = 0x00000080,
20   S_BRANCH = 0x00000100,
21   S_HOST   = 0x00000200
22};
23
24enum {
25   ST0_INCS = 0x000001,
26   ST0_DIRI = 0x000002,
27   ST0_FI   = 0x000004,
28   ST0_SIM  = 0x000008,
29   ST0_PLRI = 0x000020,
30   ST0_PBCI = 0x000040,
31   ST0_DIRO = 0x000080,
32   ST0_FO   = 0x000100,
33   ST0_SOM  = 0x000600,
34   ST0_PLRO = 0x000800,
35   ST0_PBCO = 0x001000,
36   ST0_CNS  = 0x002000,
37   ST0_WORD = 0x004000,
38   ST0_SEL  = 0x008000,
39   ST0_M    = 0x030000, ST0_M_64K = 0x000000, ST0_M_256K = 0x010000, ST0_M_1M = 0x020000,
40   ST0_SRAM = 0x200000,
41
42   ST1_AOV  = 0x000001,
43   ST1_SFAI = 0x000002,
44   ST1_SFAO = 0x000004,
45   ST1_MOVM = 0x000020,
46   ST1_MOV  = 0x000040,
47   ST1_SFMA = 0x000180, ST1_SFMA_SHIFT = 7,
48   ST1_SFMO = 0x001800, ST1_SFMO_SHIFT = 11,
49   ST1_RND  = 0x038000, ST1_RND_SHIFT = 15,
50   ST1_CRM  = 0x0C0000, ST1_CRM_SHIFT = 18, ST1_CRM_32 = 0x000000, ST1_CRM_16H = 0x040000, ST1_CRM_16L = 0x080000,
51   ST1_DBP  = 0x100000,
52   ST1_CAS  = 0x200000,
53
54   ST1_CACHE = ST1_SFAI|ST1_SFAO|ST1_MOVM|ST1_SFMA|ST1_SFMO|ST1_RND|ST1_CRM|ST1_DBP
55};
56
57enum { BR_UB, BR_CB, BR_IDLE };
58
59enum { IBS = 8192, HBS = 4096 };
60
61typedef struct {
62   unsigned short op;
63   short next;
64   unsigned char param;
65} icd;
66
67typedef struct {
68   unsigned int st1;
69   short ipc;
70   short next;
71} hcd;
72
73typedef struct {
74   short hashbase[256];
75   hcd hashnode[HBS];
76   icd inst[IBS];
77   int hused, iused;
78} cd;
79
80typedef struct {
81   int branch;
82   short hnode;
83   short ipc;
84} cstate;
85
86typedef struct {
87   INT64 macc;
88
89   UINT32 cmem[256];
90   UINT32 dmem0[256];
91   UINT32 dmem1[32];
92
93   UINT32 si[4], so[4];
94
95   UINT32 st0, st1, sti;
96   UINT32 aacc, xoa, xba, xwr, xrd, creg;
97
98   UINT8 pc, ca, id, ba0, ba1, rptc, rptc_next, sa;
99
100   UINT32 xm_adr;
101
102   UINT8 host[4], hidx, allow_update;
103
104   cd cache;
105
106   address_space *program, *data;
107   int icount;
108   int unsupported_inst_warning;
109} tms57002_t;
110
111void tms57002_decode_cat1(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs);
112void tms57002_decode_cat2_pre(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs);
113void tms57002_decode_cat3(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs);
114void tms57002_decode_cat2_post(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs);
115
116INLINE int xmode(UINT32 opcode, char type)
117{
118   if(((opcode & 0x400) && (type == 'c')) || (!(opcode & 0x400) && (type == 'd'))) {
119      if(opcode & 0x100)
120         return 0;
121      else if(opcode & 0x80)
122         return 2;
123      else
124         return 1;
125   } else if(opcode & 0x200)
126      return 2;
127
128   return 1;
129}
130
131INLINE int sfao(UINT32 st1)
132{
133   return st1 & ST1_SFAO ? 1 : 0;
134}
135
136INLINE int dbp(UINT32 st1)
137{
138   return st1 & ST1_DBP ? 1 : 0;
139}
140
141INLINE int crm(UINT32 st1)
142{
143   return (st1 & ST1_CRM) >> ST1_CRM_SHIFT;
144}
145
146INLINE int sfai(UINT32 st1)
147{
148   return st1 & ST1_SFAI ? 1 : 0;
149}
150
151INLINE int sfmo(UINT32 st1)
152{
153   return (st1 & ST1_SFMO) >> ST1_SFMO_SHIFT;
154}
155
156INLINE int rnd(UINT32 st1)
157{
158   return (st1 & ST1_RND) >> ST1_RND_SHIFT;
159}
160
161INLINE int movm(UINT32 st1)
162{
163   return st1 & ST1_MOVM ? 1 : 0;
164}
165
166INLINE int sfma(UINT32 st1)
167{
168   return (st1 & ST1_SFMA) >> ST1_SFMA_SHIFT;
169}
170
171#endif
src/emu/cpu/tms57002/tms57kdec.c
r0r10327
1#include "emu.h"
2#include "debugger.h"
3#include "tms57002.h"
4#include "tms57kpr.h"
5
6#ifdef __GNUC__
7#define noinline __attribute__((noinline))
8#else
9#define noinline /* */
10#endif
11
12static void tms57002_decode_error(tms57002_t *s, UINT32 opcode)
13{
14   char buf[256];
15   UINT8 opr[3];
16   if(s->unsupported_inst_warning)
17      return;
18
19   s->unsupported_inst_warning = 1;
20   opr[0] = opcode;
21   opr[1] = opcode >> 8;
22   opr[2] = opcode >> 16;
23
24   CPU_DISASSEMBLE_NAME(tms57002)(0, buf, s->pc, opr, opr, 0);
25   popmessage("tms57002: %s - Contact Mamedev", buf);
26}
27
28void tms57002_decode_cat1(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
29{
30   switch(opcode >> 18) {
31   case 0x00: // nop
32      break;
33
34#define CDEC1
35#include "cpu/tms57002/tms57002.inc"
36#undef CDEC1
37
38   default:
39      tms57002_decode_error(s, opcode);
40      break;
41   }
42}
43
44void tms57002_decode_cat2_pre(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
45{
46   switch((opcode >> 11) & 0x7f) {
47   case 0x00: // nop
48      break;
49
50#define CDEC2A
51#include "cpu/tms57002/tms57002.inc"
52#undef CDEC2A
53
54   default:
55      tms57002_decode_error(s, opcode);
56      break;
57   }
58}
59
60void tms57002_decode_cat2_post(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
61{
62   switch((opcode >> 11) & 0x7f) {
63   case 0x00: // nop
64      break;
65
66#define CDEC2B
67#include "cpu/tms57002/tms57002.inc"
68#undef CDEC2B
69
70   default:
71      tms57002_decode_error(s, opcode);
72      break;
73   }
74}
75
76void tms57002_decode_cat3(tms57002_t *s, UINT32 opcode, unsigned short *op, cstate *cs)
77{
78   switch((opcode >> 11) & 0x7f) {
79   case 0x00: // nop
80      break;
81
82#define CDEC3
83#include "cpu/tms57002/tms57002.inc"
84#undef CDEC3
85
86   default:
87      tms57002_decode_error(s, opcode);
88      break;
89   }
90}
91
src/emu/cpu/tlcs90/tlcs90.c
r10326r10327
23542354
23552355   period = cpustate->timer_period * prescaler;
23562356
2357   timer_adjust_periodic(cpustate->timer[i], period, i, period);
2357   cpustate->timer[i]->adjust(period, i, period);
23582358
23592359   logerror("%04X: CPU Timer %d started at %lf Hz\n", cpustate->pc.w.l, i, 1.0 / period.as_double());
23602360}
r10326r10327
23762376
23772377   period = cpustate->timer_period * prescaler;
23782378
2379   timer_adjust_periodic(cpustate->timer[4], period, 4, period);
2379   cpustate->timer[4]->adjust(period, 4, period);
23802380
23812381   logerror("%04X: CPU Timer 4 started at %lf Hz\n", cpustate->pc.w.l, 1.0 / period.as_double());
23822382}
r10326r10327
23842384
23852385static void t90_stop_timer(t90_Regs *cpustate, int i)
23862386{
2387   timer_adjust_oneshot(cpustate->timer[i], attotime::never, i);
2387   cpustate->timer[i]->adjust(attotime::never, i);
23882388   logerror("%04X: CPU Timer %d stopped\n", cpustate->pc.w.l, i);
23892389}
23902390
src/emu/cpu/e132xs/e132xs.c
r10326r10327
609609   {
610610      UINT64 clocks_until_int = cpustate->tr_clocks_per_tick - (clocks_since_base % cpustate->tr_clocks_per_tick);
611611      UINT64 cycles_until_int = (clocks_until_int << cpustate->clock_scale) + cycles_until_next_clock;
612      timer_adjust_oneshot(cpustate->timer, cpustate->device->cycles_to_attotime(cycles_until_int + 1), 1);
612      cpustate->timer->adjust(cpustate->device->cycles_to_attotime(cycles_until_int + 1), 1);
613613   }
614614
615615   /* else if the timer interrupt is enabled, configure it to fire at the appropriate time */
r10326r10327
620620      if (delta > 0x80000000)
621621      {
622622         if (!cpustate->timer_int_pending)
623            timer_adjust_oneshot(cpustate->timer, attotime::zero, 0);
623            cpustate->timer->adjust(attotime::zero);
624624      }
625625      else
626626      {
627627         UINT64 clocks_until_int = mulu_32x32(delta, cpustate->tr_clocks_per_tick);
628628         UINT64 cycles_until_int = (clocks_until_int << cpustate->clock_scale) + cycles_until_next_clock;
629         timer_adjust_oneshot(cpustate->timer, cpustate->device->cycles_to_attotime(cycles_until_int), 0);
629         cpustate->timer->adjust(cpustate->device->cycles_to_attotime(cycles_until_int));
630630      }
631631   }
632632
633633   /* otherwise, disable the timer */
634634   else
635      timer_adjust_oneshot(cpustate->timer, attotime::never, 0);
635      cpustate->timer->adjust(attotime::never);
636636}
637637
638638static TIMER_CALLBACK( e132xs_timer_callback )
src/emu/cpu/cop400/cop400.c
r10326r10327
887887   /* allocate serial timer */
888888
889889   cpustate->serial_timer = device->machine->scheduler().timer_alloc(FUNC(serial_tick), cpustate);
890   timer_adjust_periodic(cpustate->serial_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
890   cpustate->serial_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16));
891891
892892   /* allocate counter timer */
893893
894894   if (has_counter)
895895   {
896896      cpustate->counter_timer = device->machine->scheduler().timer_alloc(FUNC(counter_tick), cpustate);
897      timer_adjust_periodic(cpustate->counter_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16 / 4));
897      cpustate->counter_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16 / 4));
898898   }
899899
900900   /* allocate IN latch timer */
r10326r10327
902902   if (has_inil)
903903   {
904904      cpustate->inil_timer = device->machine->scheduler().timer_alloc(FUNC(inil_tick), cpustate);
905      timer_adjust_periodic(cpustate->inil_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
905      cpustate->inil_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16));
906906   }
907907
908908   /* allocate Microbus timer */
r10326r10327
910910   if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED)
911911   {
912912      cpustate->microbus_timer = device->machine->scheduler().timer_alloc(FUNC(microbus_tick), cpustate);
913      timer_adjust_periodic(cpustate->microbus_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
913      cpustate->microbus_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16));
914914   }
915915
916916   /* register for state saving */
src/emu/cpu/powerpc/ppccom.c
r10326r10327
193193   }
194194
195195   ppc->dec_zero_cycles = ppc->device->total_cycles() + cycles_until_done;
196   timer_adjust_oneshot(ppc->decrementer_int_timer, ppc->device->cycles_to_attotime(cycles_until_done), 0);
196   ppc->decrementer_int_timer->adjust(ppc->device->cycles_to_attotime(cycles_until_done));
197197
198198   if ((INT32)curdec >= 0 && (INT32)newdec < 0)
199199      ppc->irq_pending |= 0x02;
r10326r10327
15381538   /* advance by another full rev */
15391539   ppc->dec_zero_cycles += (UINT64)ppc->tb_divisor << 32;
15401540   cycles_until_next = ppc->dec_zero_cycles - ppc->device->total_cycles();
1541   timer_adjust_oneshot(ppc->decrementer_int_timer, ppc->device->cycles_to_attotime(cycles_until_next), 0);
1541   ppc->decrementer_int_timer->adjust(ppc->device->cycles_to_attotime(cycles_until_next));
15421542}
15431543
15441544
r10326r10327
18041804      UINT32 timebase = get_timebase(ppc);
18051805      UINT32 interval = 0x200 << (4 * ((ppc->spr[SPR4XX_TCR] & PPC4XX_TCR_FP_MASK) >> 24));
18061806      UINT32 target = (timebase + interval) & ~(interval - 1);
1807      timer_adjust_oneshot(ppc->fit_timer, ppc->device->cycles_to_attotime((target + 1 - timebase) / ppc->tb_divisor), TRUE);
1807      ppc->fit_timer->adjust(ppc->device->cycles_to_attotime((target + 1 - timebase) / ppc->tb_divisor), TRUE);
18081808   }
18091809
18101810   /* otherwise, turn ourself off */
18111811   else
1812      timer_adjust_oneshot(ppc->fit_timer, attotime::never, FALSE);
1812      ppc->fit_timer->adjust(attotime::never, FALSE);
18131813}
18141814
18151815
r10326r10327
18351835      UINT32 timebase = get_timebase(ppc);
18361836      UINT32 interval = ppc->pit_reload;
18371837      UINT32 target = timebase + interval;
1838      timer_adjust_oneshot(ppc->pit_timer, ppc->device->cycles_to_attotime((target + 1 - timebase) / ppc->tb_divisor), TRUE);
1838      ppc->pit_timer->adjust(ppc->device->cycles_to_attotime((target + 1 - timebase) / ppc->tb_divisor), TRUE);
18391839   }
18401840
18411841   /* otherwise, turn ourself off */
18421842   else
1843      timer_adjust_oneshot(ppc->pit_timer, attotime::never, FALSE);
1843      ppc->pit_timer->adjust(attotime::never, FALSE);
18441844}
18451845
18461846
r10326r10327
19121912      int divisor = ((ppc->spu.regs[SPU4XX_BAUD_DIVISOR_H] * 256 + ppc->spu.regs[SPU4XX_BAUD_DIVISOR_L]) & 0xfff) + 1;
19131913      int bpc = 7 + ((ppc->spu.regs[SPU4XX_CONTROL] & 8) >> 3) + 1 + (ppc->spu.regs[SPU4XX_CONTROL] & 1);
19141914      attotime charperiod = clockperiod * (divisor * 16 * bpc);
1915      timer_adjust_periodic(ppc->spu.timer, charperiod, 0, charperiod);
1915      ppc->spu.timer->adjust(charperiod, 0, charperiod);
19161916      if (PRINTF_SPU)
19171917         printf("ppc4xx_spu_timer_reset: baud rate = %.0f\n", ATTOSECONDS_TO_HZ(charperiod.attoseconds) * bpc);
19181918   }
19191919
19201920   /* otherwise, disable the timer */
19211921   else
1922      timer_adjust_oneshot(ppc->spu.timer, attotime::never, 0);
1922      ppc->spu.timer->adjust(attotime::never);
19231923}
19241924
19251925
src/emu/cpu/sh2/sh2comn.c
r10326r10327
7373   int max_delta = 0xfffff;
7474   UINT16 frc;
7575
76   timer_adjust_oneshot(sh2->timer, attotime::never, 0);
76   sh2->timer->adjust(attotime::never);
7777
7878   frc = sh2->frc;
7979   if(!(sh2->m[4] & OCFA)) {
r10326r10327
9999      if(divider) {
100100         max_delta <<= divider;
101101         sh2->frc_base = sh2->device->total_cycles();
102         timer_adjust_oneshot(sh2->timer, sh2->device->cycles_to_attotime(max_delta), 0);
102         sh2->timer->adjust(sh2->device->cycles_to_attotime(max_delta));
103103      } else {
104104         logerror("SH2.%s: Timer event in %d cycles of external clock", sh2->device->tag(), max_delta);
105105      }
r10326r10327
172172      {
173173      //  printf("resuming stalled dma\n");
174174         sh2->dma_timer_active[dma]=1;
175         timer_adjust_oneshot(sh2->dma_current_active_timer[dma], attotime::zero, dma);
175         sh2->dma_current_active_timer[dma]->adjust(attotime::zero, dma);
176176      }
177177   }
178178
r10326r10327
221221
222222            #ifdef USE_TIMER_FOR_DMA
223223             //schedule next DMA callback
224            timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma);
224            sh2->dma_current_active_timer[dma]->adjust(sh2->device->cycles_to_attotime(2), dma);
225225            #endif
226226
227227
r10326r10327
269269
270270            #ifdef USE_TIMER_FOR_DMA
271271             //schedule next DMA callback
272            timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma);
272            sh2->dma_current_active_timer[dma]->adjust(sh2->device->cycles_to_attotime(2), dma);
273273            #endif
274274
275275            // check: should this really be using read_word_32 / write_word_32?
r10326r10327
316316
317317            #ifdef USE_TIMER_FOR_DMA
318318             //schedule next DMA callback
319            timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma);
319            sh2->dma_current_active_timer[dma]->adjust(sh2->device->cycles_to_attotime(2), dma);
320320            #endif
321321
322322            dmadata   = sh2->program->read_dword(tempsrc);
r10326r10327
361361
362362            #ifdef USE_TIMER_FOR_DMA
363363             //schedule next DMA callback
364            timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma);
364            sh2->dma_current_active_timer[dma]->adjust(sh2->device->cycles_to_attotime(2), dma);
365365            #endif
366366
367367            dmadata = sh2->program->read_dword(tempsrc);
r10326r10327
483483            sh2->device->suspend(SUSPEND_REASON_HALT, 1 );
484484         }
485485
486         timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma);
486         sh2->dma_current_active_timer[dma]->adjust(sh2->device->cycles_to_attotime(2), dma);
487487#endif
488488
489489      }
r10326r10327
493493      if(sh2->dma_timer_active[dma])
494494      {
495495         logerror("SH2: DMA %d cancelled in-flight\n", dma);
496         //timer_adjust_oneshot(sh2->dma_complete_timer[dma], attotime::never, 0);
497         timer_adjust_oneshot(sh2->dma_current_active_timer[dma], attotime::never, 0);
496         //sh2->dma_complete_timer[dma]->adjust(attotime::never);
497         sh2->dma_current_active_timer[dma]->adjust(attotime::never);
498498
499499         sh2->dma_timer_active[dma] = 0;
500500      }
r10326r10327
924924   int i;
925925
926926   sh2->timer = device->machine->scheduler().timer_alloc(FUNC(sh2_timer_callback), sh2);
927   timer_adjust_oneshot(sh2->timer, attotime::never, 0);
927   sh2->timer->adjust(attotime::never);
928928
929929   sh2->dma_current_active_timer[0] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
930   timer_adjust_oneshot(sh2->dma_current_active_timer[0], attotime::never, 0);
930   sh2->dma_current_active_timer[0]->adjust(attotime::never);
931931
932932   sh2->dma_current_active_timer[1] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
933   timer_adjust_oneshot(sh2->dma_current_active_timer[1], attotime::never, 0);
933   sh2->dma_current_active_timer[1]->adjust(attotime::never);
934934
935935
936936   sh2->m = auto_alloc_array(device->machine, UINT32, 0x200/4);
src/emu/cpu/mn10200/mn10200.c
r10326r10327
192192            rate /= cpustate->simple_timer[tmr].base;
193193
194194            if (tmr != 8)   // HACK: timer 8 is run at 500 kHz by the Taito program for no obvious reason, which kills performance
195               timer_adjust_oneshot(cpustate->timer_timers[tmr], attotime::from_hz(rate), tmr);
195               cpustate->timer_timers[tmr]->adjust(attotime::from_hz(rate), tmr);
196196         }
197197         else
198198         {
r10326r10327
202202   }
203203   else   // disabled, so stop it
204204   {
205      timer_adjust_oneshot(cpustate->timer_timers[tmr], attotime::never, tmr);
205      cpustate->timer_timers[tmr]->adjust(attotime::never, tmr);
206206   }
207207}
208208
r10326r10327
296296   for (tmr = 0; tmr < NUM_TIMERS_8BIT; tmr++)
297297   {
298298      cpustate->timer_timers[tmr] = device->machine->scheduler().timer_alloc(FUNC(simple_timer_cb), cpustate);
299      timer_adjust_oneshot(cpustate->timer_timers[tmr], attotime::never, tmr);
299      cpustate->timer_timers[tmr]->adjust(attotime::never, tmr);
300300   }
301301}
302302
r10326r10327
319319      cpustate->simple_timer[tmr].mode = 0;
320320      cpustate->simple_timer[tmr].cur = 0;
321321      cpustate->simple_timer[tmr].base = 0;
322      timer_adjust_oneshot(cpustate->timer_timers[tmr], attotime::never, tmr);
322      cpustate->timer_timers[tmr]->adjust(attotime::never, tmr);
323323   }
324324
325325   // clear all interrupt groups
src/emu/cpu/mb88xx/mb88xx.c
r10326r10327
217217   /* if we get too many interrupts with no servicing, disable the timer
218218       until somebody does something */
219219   if (cpustate->SBcount >= SERIAL_DISABLE_THRESH)
220      timer_adjust_oneshot(cpustate->serial, attotime::never, 0);
220      cpustate->serial->adjust(attotime::never);
221221
222222   /* only read if not full; this is needed by the Namco 52xx to ensure that
223223       the program can write to S and recover the value even if serial is enabled */
r10326r10327
261261   if ((cpustate->pio ^ newpio) & 0x30)
262262   {
263263      if ((newpio & 0x30) == 0)
264         timer_adjust_oneshot(cpustate->serial, attotime::never, 0);
264         cpustate->serial->adjust(attotime::never);
265265      else if ((newpio & 0x30) == 0x20)
266         timer_adjust_periodic(cpustate->serial, attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE), 0, attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE));
266         cpustate->serial->adjust(attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE), 0, attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE));
267267      else
268268         fatalerror("mb88xx: update_pio_enable set serial enable to unsupported value %02X\n", newpio & 0x30);
269269   }
r10326r10327
625625            {
626626               /* re-enable the timer if we disabled it previously */
627627               if (cpustate->SBcount >= SERIAL_DISABLE_THRESH)
628                  timer_adjust_periodic(cpustate->serial, attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE), 0, attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE));
628                  cpustate->serial->adjust(attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE), 0, attotime::from_hz(cpustate->device->clock() / SERIAL_PRESCALE));
629629               cpustate->SBcount = 0;
630630            }
631631            cpustate->sf = 0;
src/emu/cpu/sh4/sh4.c
r10326r10327
32803280   sh4_default_exception_priorities(sh4);
32813281   memset(sh4->exception_requesting, 0, sizeof(sh4->exception_requesting));
32823282
3283   timer_adjust_oneshot(sh4->rtc_timer, attotime::from_hz(128), 0);
3283   sh4->rtc_timer->adjust(attotime::from_hz(128));
32843284   sh4->m[RCR2] = 0x09;
32853285   sh4->m[TCOR0] = 0xffffffff;
32863286   sh4->m[TCNT0] = 0xffffffff;
src/emu/cpu/sh4/sh4comn.c
r10326r10327
212212   // elapsed:total = x : ticks
213213   // x=elapsed*tics/total -> x=elapsed*(double)100000000/rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]
214214   // ticks/total=ticks / ((rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] * ticks) / 100000000)=1/((rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] / 100000000)=100000000/rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]
215   return base + (UINT32)((timer_timeelapsed(timer).as_double() * (double)hertz) / (double)divisor);
215   return base + (UINT32)((timer->elapsed().as_double() * (double)hertz) / (double)divisor);
216216}
217217
218218static void sh4_refresh_timer_recompute(sh4_state *sh4)
r10326r10327
224224   ticks = sh4->m[RTCOR]-sh4->m[RTCNT];
225225   if (ticks <= 0)
226226      ticks = 256 + ticks;
227   timer_adjust_oneshot(sh4->refresh_timer, attotime::from_hz(sh4->bus_clock) * rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] * ticks, 0);
227   sh4->refresh_timer->adjust(attotime::from_hz(sh4->bus_clock) * rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] * ticks);
228228   sh4->refresh_timer_base = sh4->m[RTCNT];
229229}
230230
r10326r10327
242242{
243243   double ret;
244244
245   ret=((timer_timeleft(timer).as_double() * (double)hertz) / (double)divisor) - 1;
245   ret=((timer->remaining().as_double() * (double)hertz) / (double)divisor) - 1;
246246   return (UINT32)ret;
247247}
248248
r10326r10327
251251   double ticks;
252252
253253   ticks = sh4->m[tcnt[which]];
254   timer_adjust_oneshot(sh4->timer[which], sh4_scale_up_mame_time(attotime::from_hz(sh4->pm_clock) * tcnt_div[sh4->m[tcr[which]] & 7], ticks), which);
254   sh4->timer[which]->adjust(sh4_scale_up_mame_time(attotime::from_hz(sh4->pm_clock) * tcnt_div[sh4->m[tcr[which]] & 7], ticks), which);
255255}
256256
257257static TIMER_CALLBACK( sh4_refresh_timer_callback )
r10326r10327
369369{
370370   sh4_state *sh4 = (sh4_state *)ptr;
371371
372   timer_adjust_oneshot(sh4->rtc_timer, attotime::from_hz(128), 0);
372   sh4->rtc_timer->adjust(attotime::from_hz(128));
373373   sh4->m[R64CNT] = (sh4->m[R64CNT]+1) & 0x7f;
374374   if (sh4->m[R64CNT] == 64)
375375   {
r10326r10327
453453   if (timermode == 1)
454454   {
455455      sh4->dma_timer_active[channel] = 1;
456      timer_adjust_oneshot(sh4->dma_timer[channel], sh4->device->cycles_to_attotime(2*count+1), channel);
456      sh4->dma_timer[channel]->adjust(sh4->device->cycles_to_attotime(2*count+1), channel);
457457   }
458458   else if (timermode == 2)
459459   {
460460      sh4->dma_timer_active[channel] = 1;
461      timer_adjust_oneshot(sh4->dma_timer[channel], attotime::zero, channel);
461      sh4->dma_timer[channel]->adjust(attotime::zero, channel);
462462   }
463463
464464   src &= AM;
r10326r10327
601601      if (sh4->dma_timer_active[channel])
602602      {
603603         logerror("SH4: DMA %d cancelled in-flight but all data transferred", channel);
604         timer_adjust_oneshot(sh4->dma_timer[channel], attotime::never, channel);
604         sh4->dma_timer[channel]->adjust(attotime::never, channel);
605605         sh4->dma_timer_active[channel] = 0;
606606      }
607607   }
r10326r10327
617617      if (sh4->dma_timer_active[s])
618618      {
619619         logerror("SH4: DMA %d cancelled due to NMI but all data transferred", s);
620         timer_adjust_oneshot(sh4->dma_timer[s], attotime::never, s);
620         sh4->dma_timer[s]->adjust(attotime::never, s);
621621         sh4->dma_timer_active[s] = 0;
622622      }
623623   }
r10326r10327
671671      }
672672      else
673673      {
674         timer_adjust_oneshot(sh4->refresh_timer, attotime::never, 0);
674         sh4->refresh_timer->adjust(attotime::never);
675675      }
676676      break;
677677
r10326r10327
717717      }
718718      if ((sh4->m[RCR2] & 8) && (~old & 8))
719719      { // 0 -> 1
720         timer_adjust_oneshot(sh4->rtc_timer, attotime::from_hz(128), 0);
720         sh4->rtc_timer->adjust(attotime::from_hz(128));
721721      }
722722      else if (~(sh4->m[RCR2]) & 8)
723723      { // 0
724         timer_adjust_oneshot(sh4->rtc_timer, attotime::never, 0);
724         sh4->rtc_timer->adjust(attotime::never);
725725      }
726726      break;
727727
r10326r10327
730730      if (old & 1)
731731         sh4->m[TCNT0] = compute_ticks_timer(sh4->timer[0], sh4->pm_clock, tcnt_div[sh4->m[TCR0] & 7]);
732732      if ((sh4->m[TSTR] & 1) == 0) {
733         timer_adjust_oneshot(sh4->timer[0], attotime::never, 0);
733         sh4->timer[0]->adjust(attotime::never);
734734      } else
735735         sh4_timer_recompute(sh4, 0);
736736
737737      if (old & 2)
738738         sh4->m[TCNT1] = compute_ticks_timer(sh4->timer[1], sh4->pm_clock, tcnt_div[sh4->m[TCR1] & 7]);
739739      if ((sh4->m[TSTR] & 2) == 0) {
740         timer_adjust_oneshot(sh4->timer[1], attotime::never, 0);
740         sh4->timer[1]->adjust(attotime::never);
741741      } else
742742         sh4_timer_recompute(sh4, 1);
743743
744744      if (old & 4)
745745         sh4->m[TCNT2] = compute_ticks_timer(sh4->timer[2], sh4->pm_clock, tcnt_div[sh4->m[TCR2] & 7]);
746746      if ((sh4->m[TSTR] & 4) == 0) {
747         timer_adjust_oneshot(sh4->timer[2], attotime::never, 0);
747         sh4->timer[2]->adjust(attotime::never);
748748      } else
749749         sh4_timer_recompute(sh4, 2);
750750      break;
r10326r10327
945945      if ((sh4->m[RTCSR] >> 3) & 7)
946946      { // activated
947947         //((double)rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] / (double)100000000)
948         //return (refresh_timer_base + (timer_timeelapsed(sh4->refresh_timer) * (double)100000000) / (double)rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]) & 0xff;
948         //return (refresh_timer_base + (sh4->refresh_timer->elapsed() * (double)100000000) / (double)rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]) & 0xff;
949949         return compute_ticks_refresh_timer(sh4->refresh_timer, sh4->bus_clock, sh4->refresh_timer_base, rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]) & 0xff;
950950      }
951951      else
r10326r10327
11611161   for (i=0; i<3; i++)
11621162   {
11631163      sh4->timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_timer_callback), sh4);
1164      timer_adjust_oneshot(sh4->timer[i], attotime::never, i);
1164      sh4->timer[i]->adjust(attotime::never, i);
11651165   }
11661166
11671167   for (i=0; i<4; i++)
11681168   {
11691169      sh4->dma_timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_dmac_callback), sh4);
1170      timer_adjust_oneshot(sh4->dma_timer[i], attotime::never, i);
1170      sh4->dma_timer[i]->adjust(attotime::never, i);
11711171   }
11721172
11731173   sh4->refresh_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_refresh_timer_callback), sh4);
1174   timer_adjust_oneshot(sh4->refresh_timer, attotime::never, 0);
1174   sh4->refresh_timer->adjust(attotime::never);
11751175   sh4->refresh_timer_base = 0;
11761176
11771177   sh4->rtc_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_rtc_timer_callback), sh4);
1178   timer_adjust_oneshot(sh4->rtc_timer, attotime::never, 0);
1178   sh4->rtc_timer->adjust(attotime::never);
11791179
11801180   sh4->m = auto_alloc_array(device->machine, UINT32, 16384);
11811181}
src/emu/cpu/nec/v25sfr.c
r10326r10327
194194            {
195195               tmp = nec_state->TM0 * nec_state->PCK * ((d & 0x40) ? 128 : 12 );
196196               time = attotime::from_hz(nec_state->device->unscaled_clock()) * tmp;
197               timer_adjust_oneshot(nec_state->timers[0], time, INTTU0);
197               nec_state->timers[0]->adjust(time, INTTU0);
198198            }
199199            else
200               timer_adjust_oneshot(nec_state->timers[0], attotime::never, 0);
200               nec_state->timers[0]->adjust(attotime::never);
201201
202202            if(d & 0x20)
203203            {
204204               tmp = nec_state->MD0 * nec_state->PCK * ((d & 0x10) ? 128 : 12 );
205205               time = attotime::from_hz(nec_state->device->unscaled_clock()) * tmp;
206               timer_adjust_oneshot(nec_state->timers[1], time, INTTU1);
206               nec_state->timers[1]->adjust(time, INTTU1);
207207            }
208208            else
209               timer_adjust_oneshot(nec_state->timers[1], attotime::never, 0);
209               nec_state->timers[1]->adjust(attotime::never);
210210         }
211211         else   /* interval mode */
212212         {
r10326r10327
214214            {
215215               tmp = nec_state->MD0 * nec_state->PCK * ((d & 0x40) ? 128 : 6 );
216216               time = attotime::from_hz(nec_state->device->unscaled_clock()) * tmp;
217               timer_adjust_periodic(nec_state->timers[0], time, INTTU0, time);
218               timer_adjust_oneshot(nec_state->timers[1], attotime::never, 0);
217               nec_state->timers[0]->adjust(time, INTTU0, time);
218               nec_state->timers[1]->adjust(attotime::never);
219219               nec_state->TM0 = nec_state->MD0;
220220            }
221221            else
222222            {
223               timer_adjust_oneshot(nec_state->timers[0], attotime::never, 0);
224               timer_adjust_oneshot(nec_state->timers[1], attotime::never, 0);
223               nec_state->timers[0]->adjust(attotime::never);
224               nec_state->timers[1]->adjust(attotime::never);
225225            }
226226         }
227227         break;
r10326r10327
231231         {
232232            tmp = nec_state->MD1 * nec_state->PCK * ((d & 0x40) ? 128 : 6 );
233233            time = attotime::from_hz(nec_state->device->unscaled_clock()) * tmp;
234            timer_adjust_periodic(nec_state->timers[2], time, INTTU2, time);
234            nec_state->timers[2]->adjust(time, INTTU2, time);
235235            nec_state->TM1 = nec_state->MD1;
236236         }
237237         else
238            timer_adjust_oneshot(nec_state->timers[2], attotime::never, 0);
238            nec_state->timers[2]->adjust(attotime::never);
239239         break;
240240      case 0x9C: /* TMIC0 */
241241         write_irqcontrol(nec_state, INTTU0, d);
r10326r10327
263263         }
264264         tmp = nec_state->PCK << nec_state->TB;
265265         time = attotime::from_hz(nec_state->device->unscaled_clock()) * tmp;
266         timer_adjust_periodic(nec_state->timers[3], time, INTTB, time);
266         nec_state->timers[3]->adjust(time, INTTB, time);
267267         logerror("        Internal RAM %sabled\n", (nec_state->RAMEN ? "en" : "dis"));
268268         logerror("        Time base set to 2^%d\n", nec_state->TB);
269269         logerror("        Clock divider set to %d\n", nec_state->PCK);
src/emu/cpu/nec/v25.c
r10326r10327
192192
193193   tmp = nec_state->PCK << nec_state->TB;
194194   time = attotime::from_hz(nec_state->device->unscaled_clock()) * tmp;
195   timer_adjust_periodic(nec_state->timers[3], time, INTTB, time);
195   nec_state->timers[3]->adjust(time, INTTB, time);
196196
197   timer_adjust_oneshot(nec_state->timers[0], attotime::never, 0);
198   timer_adjust_oneshot(nec_state->timers[1], attotime::never, 0);
199   timer_adjust_oneshot(nec_state->timers[2], attotime::never, 0);
197   nec_state->timers[0]->adjust(attotime::never);
198   nec_state->timers[1]->adjust(attotime::never);
199   nec_state->timers[2]->adjust(attotime::never);
200200
201201   SetRB(7);
202202   Sreg(PS) = 0xffff;
src/emu/cpu/mips/mips3com.c
r10326r10327
205205      UINT32 compare = mips->cpr[0][COP0_Compare];
206206      UINT32 delta = compare - count;
207207      attotime newtime = mips->device->cycles_to_attotime((UINT64)delta * 2);
208      timer_adjust_oneshot(mips->compare_int_timer, newtime, 0);
208      mips->compare_int_timer->adjust(newtime);
209209      return;
210210   }
211   timer_adjust_oneshot(mips->compare_int_timer, attotime::never, 0);
211   mips->compare_int_timer->adjust(attotime::never);
212212}
213213
214214
src/emu/cpu/tms9900/99xxcore.h
r10326r10327
933933         /* read decrementer */
934934         if (cpustate->decrementer_enabled && !(cpustate->flag & 1))
935935            /* timer mode, timer enabled */
936            return cpustate->device->attotime_to_cycles(timer_timeleft(cpustate->timer) / 16);
936            return cpustate->device->attotime_to_cycles(cpustate->timer->remaining() / 16);
937937         else
938938            /* event counter mode or timer mode, timer disabled */
939939            return cpustate->decrementer_count;
r10326r10327
997997
998998         if (cpustate->decrementer_enabled && !(cpustate->flag & 1))
999999            /* timer mode, timer enabled */
1000            value = cpustate->device->attotime_to_cycles(timer_timeleft(cpustate->timer) / 16);
1000            value = cpustate->device->attotime_to_cycles(cpustate->timer->remaining() / 16);
10011001         else
10021002            /* event counter mode or timer mode, timer disabled */
10031003            value = cpustate->decrementer_count;
r10326r10327
17671767*/
17681768static void reset_decrementer(tms99xx_state *cpustate)
17691769{
1770   timer_adjust_oneshot(cpustate->timer, attotime::never, 0);
1770   cpustate->timer->adjust(attotime::never);
17711771
17721772   /* reload count */
17731773   cpustate->decrementer_count = cpustate->decrementer_interval;
r10326r10327
17781778   if (cpustate->decrementer_enabled && ! (cpustate->flag & 1))
17791779   {   /* timer */
17801780      attotime period = cpustate->device->cycles_to_attotime(cpustate->decrementer_interval * 16L);
1781      timer_adjust_periodic(cpustate->timer, period, 0, period);
1781      cpustate->timer->adjust(period, 0, period);
17821782   }
17831783}
17841784
src/emu/cpu/hd61700/hd61700.c
r10326r10327
169169   m_program = this->space(AS_PROGRAM);
170170
171171   m_sec_timer = timer_alloc(SEC_TIMER);
172   timer_adjust_periodic(m_sec_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
172   m_sec_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
173173
174174   // save state
175175   state_save_register_device_item(this, 0, m_ppc);
src/emu/cpu/z8/z8.c
r10326r10327
353353      if (data & Z8_TMR_LOAD_T0)
354354      {
355355         cpustate->t0 = T0;
356         timer_adjust_periodic(cpustate->t0_timer, attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE0 >> 2) + 1)));
356         cpustate->t0_timer->adjust(attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE0 >> 2) + 1)));
357357      }
358358
359      timer_enable(cpustate->t0_timer, data & Z8_TMR_ENABLE_T0);
359      cpustate->t0_timer->enable(data & Z8_TMR_ENABLE_T0);
360360
361361      if (data & Z8_TMR_LOAD_T1)
362362      {
363363         cpustate->t1 = T1;
364         timer_adjust_periodic(cpustate->t1_timer, attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE1 >> 2) + 1)));
364         cpustate->t1_timer->adjust(attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE1 >> 2) + 1)));
365365      }
366366
367      timer_enable(cpustate->t1_timer, data & Z8_TMR_ENABLE_T1);
367      cpustate->t1_timer->enable(data & Z8_TMR_ENABLE_T1);
368368      break;
369369
370370   case Z8_REGISTER_P2M:
r10326r10327
613613   if (cpustate->t0 == 0)
614614   {
615615      cpustate->t0 = T0;
616      timer_adjust_periodic(cpustate->t0_timer, attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE0 >> 2) + 1)));
617      timer_enable(cpustate->t0_timer, PRE0 & Z8_PRE0_COUNT_MODULO_N);
616      cpustate->t0_timer->adjust(attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE0 >> 2) + 1)));
617      cpustate->t0_timer->enable(PRE0 & Z8_PRE0_COUNT_MODULO_N);
618618      cpustate->irq[4] = ASSERT_LINE;
619619   }
620620}
r10326r10327
628628   if (cpustate->t1 == 0)
629629   {
630630      cpustate->t1 = T1;
631      timer_adjust_periodic(cpustate->t1_timer, attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE1 >> 2) + 1)));
632      timer_enable(cpustate->t1_timer, PRE1 & Z8_PRE0_COUNT_MODULO_N);
631      cpustate->t1_timer->adjust(attotime::zero, 0, attotime::from_hz(cpustate->clock / 2 / 4 / ((PRE1 >> 2) + 1)));
632      cpustate->t1_timer->enable(PRE1 & Z8_PRE0_COUNT_MODULO_N);
633633      cpustate->irq[5] = ASSERT_LINE;
634634   }
635635}
src/emu/cpu/m6800/m6800.c
r10326r10327
735735   {
736736   case 0:
737737   case 3: // not implemented
738      timer_enable(cpustate->sci_timer, 0);
738      cpustate->sci_timer->enable(false);
739739      break;
740740
741741   case 1:
r10326r10327
743743      {
744744         int divisor = M6800_RMCR_SS[cpustate->rmcr & M6800_RMCR_SS_MASK];
745745
746         timer_adjust_periodic(cpustate->sci_timer, attotime::from_hz(cpustate->clock / divisor), 0, attotime::from_hz(cpustate->clock / divisor));
746         cpustate->sci_timer->adjust(attotime::from_hz(cpustate->clock / divisor), 0, attotime::from_hz(cpustate->clock / divisor));
747747      }
748748      break;
749749   }
src/emu/video/tms34061.c
r10326r10327
147147static TIMER_CALLBACK( tms34061_interrupt )
148148{
149149   /* set timer for next frame */
150   timer_adjust_oneshot(tms34061.timer, tms34061.screen->frame_period(), 0);
150   tms34061.timer->adjust(tms34061.screen->frame_period());
151151
152152   /* set the interrupt bit in the status reg */
153153   tms34061.regs[TMS34061_STATUS] |= 1;
r10326r10327
184184   }
185185
186186   /* log it */
187   if (VERBOSE) logerror("%s:tms34061 %s = %04x\n", cpuexec_describe_context(space->machine), regnames[regnum], tms34061.regs[regnum]);
187   if (VERBOSE) logerror("%s:tms34061 %s = %04x\n", space->machine->describe_context(), regnames[regnum], tms34061.regs[regnum]);
188188
189189   /* update the state of things */
190190   switch (regnum)
r10326r10327
196196         if (scanline < 0)
197197            scanline += tms34061.regs[TMS34061_VERTOTAL];
198198
199         timer_adjust_oneshot(tms34061.timer, tms34061.screen->time_until_pos(scanline, tms34061.regs[TMS34061_HORSTARTBLNK]), 0);
199         tms34061.timer->adjust(tms34061.screen->time_until_pos(scanline, tms34061.regs[TMS34061_HORSTARTBLNK]));
200200         break;
201201
202202      /* XY offset: set the X and Y masks */
r10326r10327
262262   }
263263
264264   /* log it */
265   if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", cpuexec_describe_context(space->machine), regnames[regnum], result);
265   if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", space->machine->describe_context(), regnames[regnum], result);
266266   return (offset & 0x02) ? (result >> 8) : result;
267267}
268268
r10326r10327
369369
370370   /* mask to the VRAM size */
371371   pixeloffs &= tms34061.vrammask;
372   if (VERBOSE) logerror("%s:tms34061 xy (%04x) = %02x/%02x\n", cpuexec_describe_context(space->machine), pixeloffs, data, tms34061.latchdata);
372   if (VERBOSE) logerror("%s:tms34061 xy (%04x) = %02x/%02x\n", space->machine->describe_context(), pixeloffs, data, tms34061.latchdata);
373373
374374   /* set the pixel data */
375375   tms34061.vram[pixeloffs] = data;
r10326r10327
425425         offs = ((row << tms34061.intf.rowshift) | col) & tms34061.vrammask;
426426         if (tms34061.regs[TMS34061_CONTROL2] & 0x0040)
427427            offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16;
428         if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", cpuexec_describe_context(space->machine), offs, data, tms34061.latchdata);
428         if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", space->machine->describe_context(), offs, data, tms34061.latchdata);
429429         if (tms34061.vram[offs] != data || tms34061.latchram[offs] != tms34061.latchdata)
430430         {
431431            tms34061.vram[offs] = data;
r10326r10327
439439         if (tms34061.regs[TMS34061_CONTROL2] & 0x0040)
440440            offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16;
441441         offs &= tms34061.vrammask;
442         if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", cpuexec_describe_context(space->machine), offs);
442         if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", space->machine->describe_context(), offs);
443443
444444         memcpy(&tms34061.vram[offs], tms34061.shiftreg, (size_t)1 << tms34061.intf.rowshift);
445445         memset(&tms34061.latchram[offs], tms34061.latchdata, (size_t)1 << tms34061.intf.rowshift);
r10326r10327
451451         if (tms34061.regs[TMS34061_CONTROL2] & 0x0040)
452452            offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16;
453453         offs &= tms34061.vrammask;
454         if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", cpuexec_describe_context(space->machine), offs);
454         if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", space->machine->describe_context(), offs);
455455
456456         tms34061.shiftreg = &tms34061.vram[offs];
457457         break;
458458
459459      /* log anything else */
460460      default:
461         logerror("%s:Unsupported TMS34061 function %d\n", cpuexec_describe_context(space->machine), func);
461         logerror("%s:Unsupported TMS34061 function %d\n", space->machine->describe_context(), func);
462462         break;
463463   }
464464}
r10326r10327
512512
513513      /* log anything else */
514514      default:
515         logerror("%s:Unsupported TMS34061 function %d\n", cpuexec_describe_context(space->machine),
515         logerror("%s:Unsupported TMS34061 function %d\n", space->machine->describe_context(),
516516               func);
517517         break;
518518   }
src/emu/video/hd63484.c
r10326r10327
10371037#if LOG_COMMANDS
10381038      int i;
10391039
1040      logerror("%s: HD63484 command %s (%04x) ", cpuexec_describe_context(device->machine), instruction_name[hd63484->fifo[0] >> 10], hd63484->fifo[0]);
1040      logerror("%s: HD63484 command %s (%04x) ", device->machine->describe_context(), instruction_name[hd63484->fifo[0] >> 10], hd63484->fifo[0]);
10411041      for (i = 1; i < hd63484->fifo_counter; i++)
10421042         logerror("%04x ", hd63484->fifo[i]);
10431043      logerror("\n");
src/emu/video/mc6845.c
r10326r10327
289289{
290290   mc6845_t *mc6845 = get_safe_token(device);
291291
292   if (LOG)  logerror("%s:M6845 reg 0x%02x = 0x%02x\n", cpuexec_describe_context(device->machine), mc6845->register_address_latch, data);
292   if (LOG)  logerror("%s:M6845 reg 0x%02x = 0x%02x\n", device->machine->describe_context(), mc6845->register_address_latch, data);
293293
294294   switch (mc6845->register_address_latch)
295295   {
r10326r10327
447447
448448INLINE void mc6845_update_counters(mc6845_t *mc6845)
449449{
450   mc6845->character_counter = timer_timeelapsed( mc6845->line_timer ).as_ticks( mc6845->clock );
450   mc6845->character_counter = mc6845->line_timer ->elapsed( ).as_ticks( mc6845->clock );
451451
452   if ( timer_enabled( mc6845->hsync_off_timer ) )
452   if ( mc6845->hsync_off_timer ->enabled( ) )
453453   {
454      mc6845->hsync_width_counter = timer_timeelapsed( mc6845->hsync_off_timer ).as_ticks( mc6845->clock );
454      mc6845->hsync_width_counter = mc6845->hsync_off_timer ->elapsed( ).as_ticks( mc6845->clock );
455455   }
456456}
457457
r10326r10327
465465      if ( mc6845->de )
466466      {
467467         /* If the upd_adr_timer was running, cancel it */
468         timer_adjust_oneshot(mc6845->upd_adr_timer,  attotime::never, 0);
468         mc6845->upd_adr_timer->adjust(attotime::never);
469469      }
470470      else
471471      {
r10326r10327
519519static void update_upd_adr_timer(mc6845_t *mc6845)
520520{
521521   if (! mc6845->de && supports_transparent[mc6845->device_type])
522      timer_adjust_oneshot(mc6845->upd_adr_timer,  mc6845->upd_time, 0);
522      mc6845->upd_adr_timer->adjust(mc6845->upd_time);
523523}
524524
525525
r10326r10327
549549   mc6845_set_cur( mc6845, TRUE );
550550
551551   /* Schedule CURSOR off signal */
552   timer_adjust_oneshot( mc6845->cur_off_timer, attotime::from_ticks( 1, mc6845->clock ), 0 );
552   mc6845->cur_off_timer->adjust( attotime::from_ticks( 1, mc6845->clock ) );
553553}
554554
555555
r10326r10327
572572   mc6845_set_hsync( mc6845, TRUE );
573573
574574   /* Schedule HSYNC off signal */
575   timer_adjust_oneshot( mc6845->hsync_off_timer, attotime::from_ticks( hsync_width, mc6845->clock ), 0 );
575   mc6845->hsync_off_timer->adjust( attotime::from_ticks( hsync_width, mc6845->clock ) );
576576}
577577
578578
r10326r10327
668668   if ( mc6845->line_enable_ff )
669669   {
670670      /* Schedule DE off signal change */
671      timer_adjust_oneshot(mc6845->de_off_timer, attotime::from_ticks( mc6845->horiz_disp, mc6845->clock ), 0);
671      mc6845->de_off_timer->adjust(attotime::from_ticks( mc6845->horiz_disp, mc6845->clock ));
672672
673673      /* Is cursor visible on this line? */
674674      if ( mc6845->cursor_state &&
r10326r10327
680680         mc6845->cursor_x = mc6845->cursor_addr - mc6845->line_address;
681681
682682         /* Schedule CURSOR ON signal */
683         timer_adjust_oneshot( mc6845->cur_on_timer, attotime::from_ticks( mc6845->cursor_x, mc6845->clock ), 0 );
683         mc6845->cur_on_timer->adjust( attotime::from_ticks( mc6845->cursor_x, mc6845->clock ) );
684684      }
685685   }
686686
687687   /* Schedule HSYNC on signal */
688   timer_adjust_oneshot( mc6845->hsync_on_timer, attotime::from_ticks( mc6845->horiz_sync_pos, mc6845->clock ), 0 );
688   mc6845->hsync_on_timer->adjust( attotime::from_ticks( mc6845->horiz_sync_pos, mc6845->clock ) );
689689
690690   /* Schedule our next callback */
691   timer_adjust_oneshot( mc6845->line_timer, attotime::from_ticks( mc6845->horiz_char_total + 1, mc6845->clock ), 0 );
691   mc6845->line_timer->adjust( attotime::from_ticks( mc6845->horiz_char_total + 1, mc6845->clock ) );
692692
693693   /* Set VSYNC and DE signals */
694694   mc6845_set_vsync( mc6845, new_vsync );
r10326r10327
730730
731731   /* compute the pixel coordinate of the NEXT character -- this is when the light pen latches */
732732   /* set the timer that will latch the display address into the light pen registers */
733   timer_adjust_oneshot(mc6845->light_pen_latch_timer, attotime::from_ticks( 1, mc6845->clock ), 0);
733   mc6845->light_pen_latch_timer->adjust(attotime::from_ticks( 1, mc6845->clock ));
734734}
735735
736736
r10326r10327
10091009         devcb_call_write_line(&mc6845->out_vsync_func, FALSE);
10101010   }
10111011
1012   if ( ! timer_enabled( mc6845->line_timer ) )
1012   if ( ! mc6845->line_timer ->enabled( ) )
10131013   {
1014      timer_adjust_oneshot( mc6845->line_timer, attotime::from_ticks( mc6845->horiz_char_total + 1, mc6845->clock ), 0 );
1014      mc6845->line_timer->adjust( attotime::from_ticks( mc6845->horiz_char_total + 1, mc6845->clock ) );
10151015   }
10161016
10171017   mc6845->light_pen_latched = FALSE;
src/emu/video/resnet.c
r10326r10327
564564         cut = 0.0;
565565         break;
566566      case RES_NET_AMP_DARLINGTON:
567         minout = 0.9;
567         minout = 0.7;
568568         cut = 0.0;
569569         break;
570570      case RES_NET_AMP_EMITTER:
r10326r10327
685685         v = vcc - v;
686686         v = MAX(0, v-0.7);
687687         v = MIN(v, vcc - 2 * 0.7);
688         v = v / (vcc-1.4);
689         v = v * vcc;
688690         break;
689691      case RES_NET_MONITOR_ELECTROHOME_G07:
690692         /* Nothing */
691693         break;
692694   }
693695
694   return (int) (v *255 / vcc + 0.4);
696   return (int) (v * 255 / vcc + 0.4);
695697}
696698
697699rgb_t *compute_res_net_all(running_machine *machine, const UINT8 *prom, const res_net_decode_info *rdi, const res_net_info *di)
src/emu/video/voodoo.c
r10326r10327
986986   /* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */
987987   if (vblank_period == attotime::zero)
988988      vblank_period = v->screen->frame_period();
989   timer_adjust_oneshot(v->fbi.vblank_timer, vblank_period, 0);
989   v->fbi.vblank_timer->adjust(vblank_period);
990990}
991991
992992
r10326r10327
20702070      if (v->pci.stall_callback)
20712071         (*v->pci.stall_callback)(v->device, FALSE);
20722072      else
2073         cpuexec_trigger(v->device->machine, v->trigger);
2073         v->device->machine->scheduler().trigger(v->trigger);
20742074   }
20752075
20762076   /* if not, set a timer for the next one */
20772077   else
20782078   {
2079      timer_adjust_oneshot(v->pci.continue_timer, v->pci.op_end_time - current_time, 0);
2079      v->pci.continue_timer->adjust(v->pci.op_end_time - current_time);
20802080   }
20812081}
20822082
r10326r10327
20972097      cpu_spinuntil_trigger(v->cpu, v->trigger);
20982098
20992099   /* set a timer to clear the stall */
2100   timer_adjust_oneshot(v->pci.continue_timer, v->pci.op_end_time - current_time, 0);
2100   v->pci.continue_timer->adjust(v->pci.op_end_time - current_time);
21012101}
21022102
21032103
r10326r10327
39673967   }
39683968
39693969   if (LOG_REGISTERS)
3970      logerror("%s:banshee_r(AGP:%s)\n", cpuexec_describe_context(v->device->machine), banshee_agp_reg_name[offset]);
3970      logerror("%s:banshee_r(AGP:%s)\n", v->device->machine->describe_context(), banshee_agp_reg_name[offset]);
39713971   return result;
39723972}
39733973
r10326r10327
39863986   else if (offset < 0x100000/4)
39873987      result = banshee_agp_r(device, offset, mem_mask);
39883988   else if (offset < 0x200000/4)
3989      logerror("%s:banshee_r(2D:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0xfffff);
3989      logerror("%s:banshee_r(2D:%X)\n", device->machine->describe_context(), (offset*4) & 0xfffff);
39903990   else if (offset < 0x600000/4)
39913991      result = register_r(v, offset & 0x1fffff/4);
39923992   else if (offset < 0x800000/4)
3993      logerror("%s:banshee_r(TEX:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0x1fffff);
3993      logerror("%s:banshee_r(TEX:%X)\n", device->machine->describe_context(), (offset*4) & 0x1fffff);
39943994   else if (offset < 0xc00000/4)
3995      logerror("%s:banshee_r(RES:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff);
3995      logerror("%s:banshee_r(RES:%X)\n", device->machine->describe_context(), (offset*4) & 0x3fffff);
39963996   else if (offset < 0x1000000/4)
3997      logerror("%s:banshee_r(YUV:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff);
3997      logerror("%s:banshee_r(YUV:%X)\n", device->machine->describe_context(), (offset*4) & 0x3fffff);
39983998   else if (offset < 0x2000000/4)
39993999   {
40004000      UINT8 temp = v->fbi.lfb_stride;
r10326r10327
40174017
40184018   if (offset < v->fbi.lfb_base)
40194019   {
4020      logerror("%s:banshee_fb_r(%X)\n", cpuexec_describe_context(device->machine), offset*4);
4020      logerror("%s:banshee_fb_r(%X)\n", device->machine->describe_context(), offset*4);
40214021      if (offset*4 <= v->fbi.mask)
40224022         result = ((UINT32 *)v->fbi.ram)[offset];
40234023   }
r10326r10327
40424042         if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att))
40434043            result = v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]];
40444044         if (LOG_REGISTERS)
4045            logerror("%s:banshee_att_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c1 & 0x1f]);
4045            logerror("%s:banshee_att_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3c1 & 0x1f]);
40464046         break;
40474047
40484048      /* Input status 0 */
r10326r10327
40554055            */
40564056         result = 0x00;
40574057         if (LOG_REGISTERS)
4058            logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset);
4058            logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset);
40594059         break;
40604060
40614061      /* Sequencer access */
r10326r10327
40634063         if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq))
40644064            result = v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]];
40654065         if (LOG_REGISTERS)
4066            logerror("%s:banshee_seq_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c4 & 0x1f]);
4066            logerror("%s:banshee_seq_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3c4 & 0x1f]);
40674067         break;
40684068
40694069      /* Feature control */
r10326r10327
40714071         result = v->banshee.vga[0x3da & 0x1f];
40724072         v->banshee.attff = 0;
40734073         if (LOG_REGISTERS)
4074            logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset);
4074            logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset);
40754075         break;
40764076
40774077      /* Miscellaneous output */
40784078      case 0x3cc:
40794079         result = v->banshee.vga[0x3c2 & 0x1f];
40804080         if (LOG_REGISTERS)
4081            logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset);
4081            logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset);
40824082         break;
40834083
40844084      /* Graphics controller access */
r10326r10327
40864086         if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc))
40874087            result = v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]];
40884088         if (LOG_REGISTERS)
4089            logerror("%s:banshee_gc_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3ce & 0x1f]);
4089            logerror("%s:banshee_gc_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3ce & 0x1f]);
40904090         break;
40914091
40924092      /* CRTC access */
r10326r10327
40944094         if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc))
40954095            result = v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]];
40964096         if (LOG_REGISTERS)
4097            logerror("%s:banshee_crtc_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3d4 & 0x1f]);
4097            logerror("%s:banshee_crtc_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3d4 & 0x1f]);
40984098         break;
40994099
41004100      /* Input status 1 */
r10326r10327
41104110            */
41114111         result = 0x04;
41124112         if (LOG_REGISTERS)
4113            logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset);
4113            logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset);
41144114         break;
41154115
41164116      default:
41174117         result = v->banshee.vga[offset];
41184118         if (LOG_REGISTERS)
4119            logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset);
4119            logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset);
41204120         break;
41214121   }
41224122   return result;
r10326r10327
41404140      case io_dacData:
41414141         result = v->fbi.clut[v->banshee.io[io_dacAddr] & 0x1ff] = v->banshee.io[offset];
41424142         if (LOG_REGISTERS)
4143            logerror("%s:banshee_dac_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.io[io_dacAddr] & 0x1ff);
4143            logerror("%s:banshee_dac_r(%X)\n", device->machine->describe_context(), v->banshee.io[io_dacAddr] & 0x1ff);
41444144         break;
41454145
41464146      case io_vgab0:   case io_vgab4:   case io_vgab8:   case io_vgabc:
r10326r10327
41604160      default:
41614161         result = v->banshee.io[offset];
41624162         if (LOG_REGISTERS)
4163            logerror("%s:banshee_io_r(%s)\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset]);
4163            logerror("%s:banshee_io_r(%s)\n", device->machine->describe_context(), banshee_io_reg_name[offset]);
41644164         break;
41654165   }
41664166
r10326r10327
41704170
41714171READ32_DEVICE_HANDLER( banshee_rom_r )
41724172{
4173   logerror("%s:banshee_rom_r(%X)\n", cpuexec_describe_context(device->machine), offset*4);
4173   logerror("%s:banshee_rom_r(%X)\n", device->machine->describe_context(), offset*4);
41744174   return 0xffffffff;
41754175}
41764176
r10326r10327
42644264   }
42654265
42664266   if (LOG_REGISTERS)
4267      logerror("%s:banshee_w(AGP:%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_agp_reg_name[offset], data, mem_mask);
4267      logerror("%s:banshee_w(AGP:%s) = %08X & %08X\n", device->machine->describe_context(), banshee_agp_reg_name[offset], data, mem_mask);
42684268}
42694269
42704270
r10326r10327
42814281   else if (offset < 0x100000/4)
42824282      banshee_agp_w(device, offset, data, mem_mask);
42834283   else if (offset < 0x200000/4)
4284      logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0xfffff, data, mem_mask);
4284      logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0xfffff, data, mem_mask);
42854285   else if (offset < 0x600000/4)
42864286      register_w(v, offset & 0x1fffff/4, data);
42874287   else if (offset < 0x800000/4)
4288      logerror("%s:banshee_w(TEX:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0x1fffff, data, mem_mask);
4288      logerror("%s:banshee_w(TEX:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0x1fffff, data, mem_mask);
42894289   else if (offset < 0xc00000/4)
4290      logerror("%s:banshee_w(RES:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff, data, mem_mask);
4290      logerror("%s:banshee_w(RES:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0x3fffff, data, mem_mask);
42914291   else if (offset < 0x1000000/4)
4292      logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff, data, mem_mask);
4292      logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0x3fffff, data, mem_mask);
42934293   else if (offset < 0x2000000/4)
42944294   {
42954295      UINT8 temp = v->fbi.lfb_stride;
r10326r10327
43194319      {
43204320         if (offset*4 <= v->fbi.mask)
43214321            COMBINE_DATA(&((UINT32 *)v->fbi.ram)[offset]);
4322         logerror("%s:banshee_fb_w(%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), offset*4, data, mem_mask);
4322         logerror("%s:banshee_fb_w(%X) = %08X & %08X\n", device->machine->describe_context(), offset*4, data, mem_mask);
43234323      }
43244324   }
43254325   else
r10326r10327
43424342         {
43434343            v->banshee.vga[0x3c1 & 0x1f] = data;
43444344            if (LOG_REGISTERS)
4345               logerror("%s:banshee_vga_w(%X) = %02X\n", cpuexec_describe_context(device->machine), 0x3c0+offset, data);
4345               logerror("%s:banshee_vga_w(%X) = %02X\n", device->machine->describe_context(), 0x3c0+offset, data);
43464346         }
43474347         else
43484348         {
43494349            if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att))
43504350               v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]] = data;
43514351            if (LOG_REGISTERS)
4352               logerror("%s:banshee_att_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c1 & 0x1f], data);
4352               logerror("%s:banshee_att_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3c1 & 0x1f], data);
43534353         }
43544354         v->banshee.attff ^= 1;
43554355         break;
r10326r10327
43594359         if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq))
43604360            v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]] = data;
43614361         if (LOG_REGISTERS)
4362            logerror("%s:banshee_seq_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c4 & 0x1f], data);
4362            logerror("%s:banshee_seq_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3c4 & 0x1f], data);
43634363         break;
43644364
43654365      /* Graphics controller access */
r10326r10327
43674367         if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc))
43684368            v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]] = data;
43694369         if (LOG_REGISTERS)
4370            logerror("%s:banshee_gc_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3ce & 0x1f], data);
4370            logerror("%s:banshee_gc_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3ce & 0x1f], data);
43714371         break;
43724372
43734373      /* CRTC access */
r10326r10327
43754375         if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc))
43764376            v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]] = data;
43774377         if (LOG_REGISTERS)
4378            logerror("%s:banshee_crtc_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3d4 & 0x1f], data);
4378            logerror("%s:banshee_crtc_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3d4 & 0x1f], data);
43794379         break;
43804380
43814381      default:
43824382         v->banshee.vga[offset] = data;
43834383         if (LOG_REGISTERS)
4384            logerror("%s:banshee_vga_w(%X) = %02X\n", cpuexec_describe_context(device->machine), 0x3c0+offset, data);
4384            logerror("%s:banshee_vga_w(%X) = %02X\n", device->machine->describe_context(), 0x3c0+offset, data);
43854385         break;
43864386   }
43874387}
r10326r10327
44034403         if ((v->banshee.io[offset] ^ old) & 0x2800)
44044404            v->fbi.clut_dirty = TRUE;
44054405         if (LOG_REGISTERS)
4406            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask);
4406            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask);
44074407         break;
44084408
44094409      case io_dacData:
r10326r10327
44144414            v->fbi.clut_dirty = TRUE;
44154415         }
44164416         if (LOG_REGISTERS)
4417            logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask);
4417            logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", device->machine->describe_context(), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask);
44184418         break;
44194419
44204420      case io_miscInit0:
44214421         COMBINE_DATA(&v->banshee.io[offset]);
44224422         v->fbi.yorigin = (data >> 18) & 0xfff;
44234423         if (LOG_REGISTERS)
4424            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask);
4424            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask);
44254425         break;
44264426
44274427      case io_vidScreenSize:
r10326r10327
44354435         v->screen->set_visible_area(0, v->fbi.width - 1, 0, v->fbi.height - 1);
44364436         adjust_vblank_timer(v);
44374437         if (LOG_REGISTERS)
4438            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask);
4438            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask);
44394439         break;
44404440
44414441      case io_lfbMemoryConfig:
44424442         v->fbi.lfb_base = (data & 0x1fff) << 10;
44434443         v->fbi.lfb_stride = ((data >> 13) & 7) + 9;
44444444         if (LOG_REGISTERS)
4445            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask);
4445            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask);
44464446         break;
44474447
44484448      case io_vgab0:   case io_vgab4:   case io_vgab8:   case io_vgabc:
r10326r10327
44614461      default:
44624462         COMBINE_DATA(&v->banshee.io[offset]);
44634463         if (LOG_REGISTERS)
4464            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask);
4464            logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask);
44654465         break;
44664466   }
44674467}
r10326r10327
45764576   }
45774577
45784578   /* set the type, and initialize the chip mask */
4579   v->index = device->machine->m_devicelist.index(device->type(), device->tag());
4579   v->index = device->machine->m_devicelist.indexof(device->type(), device->tag());
45804580   v->screen = downcast<screen_device *>(device->machine->device(config->screen));
45814581   assert_always(v->screen != NULL, "Unable to find screen attached to voodoo");
45824582   v->cpu = device->machine->device(config->cputag);
src/emu/video.c
r10326r10327
181181   if (machine.primary_screen == NULL)
182182   {
183183      m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(&screenless_update_callback), this);
184      timer_adjust_periodic(m_screenless_frame_timer, screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD);
184      m_screenless_frame_timer->adjust(screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD);
185185   }
186186}
187187
r10326r10327
10631063   // select the appropriate view in our dummy target
10641064   if (m_snap_native && screen != NULL)
10651065   {
1066      int view_index = m_machine.m_devicelist.index(SCREEN, screen->tag());
1066      int view_index = m_machine.m_devicelist.indexof(SCREEN, screen->tag());
10671067      assert(view_index != -1);
10681068      m_snap_target->set_view(view_index);
10691069   }
src/emu/inptport.c
r10326r10327
29112911            maskbits = 0;
29122912
29132913            string = TOKEN_GET_STRING(ipt);
2914            curport = portlist.append(string, global_alloc(input_port_config(string)));
2914            curport = &portlist.append(string, *global_alloc(input_port_config(string)));
29152915            curfield = NULL;
29162916            cursetting = NULL;
29172917            break;
r10326r10327
50605060   /* need to start up the timer? */
50615061   if (keybuf->begin_pos == keybuf->end_pos)
50625062   {
5063      timer_adjust_oneshot(portdata->inputx_timer, choose_delay(portdata, ch), 0);
5063      portdata->inputx_timer->adjust(choose_delay(portdata, ch));
50645064      keybuf->status_keydown = 0;
50655065   }
50665066
r10326r10327
51785178   if (keybuf->begin_pos != keybuf->end_pos)
51795179   {
51805180      delay = choose_delay(portdata, keybuf->buffer[keybuf->begin_pos]);
5181      timer_adjust_oneshot(portdata->inputx_timer, delay, 0);
5181      portdata->inputx_timer->adjust(delay);
51825182   }
51835183}
51845184
src/emu/devintrf.c
r10326r10327
115115   for (const device_config *devconfig = list.first(); devconfig != NULL; devconfig = devconfig->next())
116116   {
117117      device_t *newdevice = devconfig->alloc_device(*m_machine);
118      append(devconfig->tag(), newdevice);
118      append(devconfig->tag(), *newdevice);
119119      newdevice->find_interfaces();
120120   }
121121}
r10326r10327
156156         mame_printf_verbose("  (missing dependencies; rescheduling)\n");
157157         if (nextdevice == NULL)
158158            throw emu_fatalerror("Circular dependency in device startup; unable to start %s '%s'\n", device->name(), device->tag());
159         detach(device);
160         append(device->tag(), device);
159         detach(*device);
160         append(device->tag(), *device);
161161      }
162162   }
163163}
src/emu/devintrf.h
r10326r10327
162162   // pull the generic forms forward
163163   using super::first;
164164   using super::count;
165   using super::index;
165   using super::indexof;
166166   using super::find;
167167
168168   // provide type-specific overrides
r10326r10327
180180      return num;
181181   }
182182
183   int index(device_type type, T *object) const
183   int indexof(device_type type, T &object) const
184184   {
185185      int num = 0;
186186      for (T *cur = first(type); cur != NULL; cur = cur->typenext(), num++)
187         if (cur == object) return num;
187         if (cur == &object) return num;
188188      return -1;
189189   }
190190
191   int index(device_type type, const char *tag) const
191   int indexof(device_type type, const char *tag) const
192192   {
193193      T *object = find(tag);
194      return (object != NULL && object->type() == type) ? index(type, object) : -1;
194      return (object != NULL && object->type() == type) ? indexof(type, *object) : -1;
195195   }
196196
197197   T *find(device_type type, int index) const
r10326r10327
253253   friend class machine_config;
254254   friend class device_t;
255255   friend class device_config_interface;
256   template<class T> friend class tagged_list;
256   friend class simple_list<device_config>;
257257
258258protected:
259259   // construction/destruction
r10326r10327
376376   DISABLE_COPYING(device_t);
377377
378378   friend class device_interface;
379   template<class T> friend class tagged_list;
379   friend class simple_list<device_t>;
380380   friend class device_list;
381381
382382protected:
src/emu/emu.h
r10326r10327
5151
5252// core emulator headers -- must be first
5353#include "emucore.h"
54#include "emutempl.h"
5455#include "eminline.h"
5556#include "profiler.h"
5657
src/emu/rendlay.c
r10326r10327
198198   // screen 0 parameters
199199   for (const screen_device_config *devconfig = machine.m_config.first_screen(); devconfig != NULL; devconfig = devconfig->next_screen())
200200   {
201      int scrnum = machine.m_config.m_devicelist.index(SCREEN, devconfig->tag());
201      int scrnum = machine.m_config.m_devicelist.indexof(SCREEN, devconfig->tag());
202202
203203      // native X aspect factor
204204      sprintf(temp, "~scr%dnativexaspect~", scrnum);
src/emu/machine.c
r10326r10327
274274   m_scheduler.register_for_save();
275275
276276   // allocate a soft_reset timer
277   m_soft_reset_timer = m_scheduler.timer_alloc(MFUNC(timer_expired, running_machine, soft_reset), this);
277   m_soft_reset_timer = m_scheduler.timer_alloc(MSTUB(timer_expired, running_machine, soft_reset), this);
278278
279279   // init the osd layer
280280   m_osd.init(*this);
r10326r10327
488488
489489void running_machine::schedule_soft_reset()
490490{
491   timer_adjust_oneshot(m_soft_reset_timer, attotime::zero, 0);
491   m_soft_reset_timer->adjust(attotime::zero);
492492
493493   // we can't be paused since the timer needs to fire
494494   resume();
r10326r10327
616616      fatalerror("region_alloc called with duplicate region name \"%s\"\n", name);
617617
618618   // allocate the region
619   return m_regionlist.append(name, auto_alloc(this, memory_region(*this, name, length, flags)));
619   return &m_regionlist.append(name, *auto_alloc(this, memory_region(*this, name, length, flags)));
620620}
621621
622622
src/emu/sound/cdp1869.c
r10326r10327
267267   }
268268
269269   attotime duration = m_screen->time_until_pos(next_scanline);
270   timer_adjust_oneshot(m_prd_timer, duration, next_state);
270   m_prd_timer->adjust(duration, next_state);
271271}
272272
273273
src/emu/sound/tms5110.c
r10326r10327
12391239    if (!tms->romclk_hack_timer_started)
12401240    {
12411241       tms->romclk_hack_timer_started = TRUE;
1242      timer_adjust_periodic(tms->romclk_hack_timer, attotime::from_hz(device->clock() / 40), 0, attotime::from_hz(device->clock() / 40));
1242      tms->romclk_hack_timer->adjust(attotime::from_hz(device->clock() / 40), 0, attotime::from_hz(device->clock() / 40));
12431243   }
12441244    return tms->romclk_hack_state;
12451245}
r10326r10327
14221422   tms->clock = device->clock();
14231423
14241424   tms->romclk_timer = device->machine->scheduler().timer_alloc(FUNC(tmsprom_step), device);
1425   timer_adjust_periodic(tms->romclk_timer, attotime::zero, 0, attotime::from_hz(tms->clock));
1425   tms->romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(tms->clock));
14261426
14271427   tms->bit = 0;
14281428   tms->base_address = 0;
src/emu/sound/2612intf.c
r10326r10327
6262   ym2612_state *info = (ym2612_state *)param;
6363   if( count == 0 )
6464   {   /* Reset FM Timer */
65      timer_enable(info->timer[c], 0);
65      info->timer[c]->enable(false);
6666   }
6767   else
6868   {   /* Start FM Timer */
6969      attotime period = attotime::from_hz(clock) * count;
70      if (!timer_enable(info->timer[c], 1))
71         timer_adjust_oneshot(info->timer[c], period, 0);
70      if (!info->timer[c]->enable(1))
71         info->timer[c]->adjust(period);
7272   }
7373}
7474
src/emu/sound/3526intf.c
r10326r10327
6464   ym3526_state *info = (ym3526_state *)param;
6565   if( period == attotime::zero )
6666   {   /* Reset FM Timer */
67      timer_enable(info->timer[c], 0);
67      info->timer[c]->enable(false);
6868   }
6969   else
7070   {   /* Start FM Timer */
71      timer_adjust_oneshot(info->timer[c], period, 0);
71      info->timer[c]->adjust(period);
7272   }
7373}
7474
src/emu/sound/msm5205.c
r10326r10327
275275      if( prescaler )
276276      {
277277         attotime period = attotime::from_hz(voice->clock) * prescaler;
278         timer_adjust_periodic(voice->timer, period, 0, period);
278         voice->timer->adjust(period, 0, period);
279279      }
280280      else
281         timer_adjust_oneshot(voice->timer, attotime::never, 0);
281         voice->timer->adjust(attotime::never);
282282   }
283283
284284   if( voice->bitwidth != bitwidth )
r10326r10327
305305   voice->clock = clock;
306306
307307   period = attotime::from_hz(voice->clock) * voice->prescaler;
308   timer_adjust_periodic(voice->timer, period, 0, period);
308   voice->timer->adjust(period, 0, period);
309309}
310310
311311
src/emu/sound/qsound.c
r10326r10327
187187         break;
188188
189189      default:
190         logerror("%s: unexpected qsound write to offset %d == %02X\n", cpuexec_describe_context(device->machine), offset, data);
190         logerror("%s: unexpected qsound write to offset %d == %02X\n", device->machine->describe_context(), offset, data);
191191         break;
192192   }
193193}
src/emu/sound/3812intf.c
r10326r10327
6464   ym3812_state *info = (ym3812_state *)param;
6565   if( period == attotime::zero )
6666   {   /* Reset FM Timer */
67      timer_enable(info->timer[c], 0);
67      info->timer[c]->enable(false);
6868   }
6969   else
7070   {   /* Start FM Timer */
71      timer_adjust_oneshot(info->timer[c], period, 0);
71      info->timer[c]->adjust(period);
7272   }
7373}
7474
src/emu/sound/rf5c400.c
r10326r10327
448448
449449         default:
450450         {
451            //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", cpuexec_describe_context(device->machine), data, offset, mem_mask);
451            //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", device->machine->describe_context(), data, offset, mem_mask);
452452            break;
453453         }
454454      }
455      //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X at %08X\n", cpuexec_describe_context(device->machine), data, offset, mem_mask);
455      //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X at %08X\n", device->machine->describe_context(), data, offset, mem_mask);
456456   }
457457   else
458458   {
src/emu/sound/saa1099.c
r10326r10327
337337   if ((data & 0xff) > 0x1c)
338338   {
339339      /* Error! */
340                logerror("%s: (SAA1099 '%s') Unknown register selected\n",cpuexec_describe_context(device->machine), device->tag());
340                logerror("%s: (SAA1099 '%s') Unknown register selected\n",device->machine->describe_context(), device->tag());
341341   }
342342
343343   saa->selected_reg = data & 0x1f;
r10326r10327
423423         int i;
424424
425425         /* Synch & Reset generators */
426         logerror("%s: (SAA1099 '%s') -reg 0x1c- Chip reset\n",cpuexec_describe_context(device->machine), device->tag());
426         logerror("%s: (SAA1099 '%s') -reg 0x1c- Chip reset\n",device->machine->describe_context(), device->tag());
427427         for (i = 0; i < 6; i++)
428428         {
429429                saa->channels[i].level = 0;
r10326r10327
432432      }
433433      break;
434434   default:   /* Error! */
435      logerror("%s: (SAA1099 '%s') Unknown operation (reg:%02x, data:%02x)\n",cpuexec_describe_context(device->machine), device->tag(), reg, data);
435      logerror("%s: (SAA1099 '%s') Unknown operation (reg:%02x, data:%02x)\n",device->machine->describe_context(), device->tag(), reg, data);
436436   }
437437}
438438
src/emu/sound/aica.c
r10326r10327
722722               time = (44100 / AICA->TimPris[0]) / (255-(AICA->udata.data[0x90/2]&0xff));
723723               if (time)
724724               {
725                  timer_adjust_oneshot(AICA->timerA, attotime::from_hz(time), 0);
725                  AICA->timerA->adjust(attotime::from_hz(time));
726726               }
727727            }
728728         }
r10326r10327
741741               time = (44100 / AICA->TimPris[1]) / (255-(AICA->udata.data[0x94/2]&0xff));
742742               if (time)
743743               {
744                  timer_adjust_oneshot(AICA->timerB, attotime::from_hz(time), 0);
744                  AICA->timerB->adjust(attotime::from_hz(time));
745745               }
746746            }
747747         }
r10326r10327
760760               time = (44100 / AICA->TimPris[2]) / (255-(AICA->udata.data[0x98/2]&0xff));
761761               if (time)
762762               {
763                  timer_adjust_oneshot(AICA->timerC, attotime::from_hz(time), 0);
763                  AICA->timerC->adjust(attotime::from_hz(time));
764764               }
765765            }
766766         }
src/emu/sound/x1_010.c
r10326r10327
255255      info->smp_offset[channel] = 0;
256256      info->env_offset[channel] = 0;
257257   }
258   LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", cpuexec_describe_context(device->machine), offset, data ));
258   LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", device->machine->describe_context(), offset, data ));
259259   info->reg[offset] = data;
260260}
261261
r10326r10327
271271
272272   ret = info->HI_WORD_BUF[offset]<<8;
273273   ret += (seta_sound_r( device, offset )&0xff);
274   LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", cpuexec_describe_context(device->machine), offset, ret ));
274   LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", device->machine->describe_context(), offset, ret ));
275275   return ret;
276276}
277277
r10326r10327
280280   x1_010_state *info = get_safe_token(device);
281281   info->HI_WORD_BUF[offset] = (data>>8)&0xff;
282282   seta_sound_w( device, offset, data&0xff );
283   LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", cpuexec_describe_context(device->machine), offset, data ));
283   LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", device->machine->describe_context(), offset, data ));
284284}
285285
286286
src/emu/sound/k056800.c
r10326r10327
147147   k056800->irq_cb = intf->irq_cb;
148148
149149   k056800->sound_cpu_timer = device->machine->scheduler().timer_alloc(FUNC(k056800_sound_cpu_timer_tick), k056800);
150   timer_adjust_periodic(k056800->sound_cpu_timer, timer_period, 0, timer_period);
150   k056800->sound_cpu_timer->adjust(timer_period, 0, timer_period);
151151
152152   state_save_register_device_item_array(device, 0, k056800->host_reg);
153153   state_save_register_device_item_array(device, 0, k056800->sound_reg);
src/emu/sound/upd7759.c
r10326r10327
547547
548548   /* set a timer to go off when that is done */
549549   if (chip->state != STATE_IDLE)
550      timer_adjust_oneshot(chip->timer, chip->clock_period * chip->clocks_left, 0);
550      chip->timer->adjust(chip->clock_period * chip->clocks_left);
551551}
552552
553553
r10326r10327
582582
583583   /* turn off any timer */
584584   if (chip->timer)
585      timer_adjust_oneshot(chip->timer, attotime::never, 0);
585      chip->timer->adjust(attotime::never);
586586}
587587
588588
r10326r10327
712712
713713      /* for slave mode, start the timer going */
714714      if (chip->timer)
715         timer_adjust_oneshot(chip->timer, attotime::zero, 0);
715         chip->timer->adjust(attotime::zero);
716716   }
717717}
718718
src/emu/sound/ymf271.c
r10326r10327
14861486               //period = (double)(256.0 - chip->timerAVal ) * ( 384.0 * 4.0 / (double)CLOCK);
14871487               period = attotime::from_hz(chip->clock) * (384 * (1024 - chip->timerAVal));
14881488
1489               timer_adjust_periodic(chip->timA, period, 0, period);
1489               chip->timA->adjust(period, 0, period);
14901490            }
14911491            if (data & 0x20)
14921492            {   // timer B reset
r10326r10327
14971497
14981498               period = attotime::from_hz(chip->clock) * (384 * 16 * (256 - chip->timerBVal));
14991499
1500               timer_adjust_periodic(chip->timB, period, 0, period);
1500               chip->timB->adjust(period, 0, period);
15011501            }
15021502
15031503            break;
src/emu/sound/pokey.c
r10326r10327
465465         PROCESS_SAMPLE(chip);                              \
466466      }                                                \
467467   }                                                   \
468   timer_adjust_oneshot(chip->rtimer, attotime::never, 0)
468   chip->rtimer->adjust(attotime::never)
469469
470470#else   /* no HEAVY_MACRO_USAGE */
471471/*
r10326r10327
516516         PROCESS_CHANNEL(chip,channel);                        \
517517      }                                                \
518518   }                                                   \
519   timer_adjust_oneshot(chip->rtimer, attotime::never, 0)
519   chip->rtimer->adjust(attotime::never)
520520
521521#endif
522522
r10326r10327
781781{
782782   pokey_state *p = (pokey_state *)ptr;
783783   int pot = param;
784   LOG(("POKEY #%p POT%d triggers after %dus\n", p, pot, (int)(1000000 * timer_timeelapsed(p->ptimer[pot]).as_double())));
784   LOG(("POKEY #%p POT%d triggers after %dus\n", p, pot, (int)(1000000 * p->ptimer[pot]->elapsed().as_double())));
785785   p->ALLPOT &= ~(1 << pot);   /* set the enabled timer irq status bits */
786786}
787787
r10326r10327
810810
811811                /* final value */
812812                p->POTx[pot] = r;
813            timer_adjust_oneshot(p->ptimer[pot], AD_TIME * r, pot);
813            p->ptimer[pot]->adjust(AD_TIME * r, pot);
814814         }
815815      }
816816   }
r10326r10327
836836             */
837837         if( p->ALLPOT & (1 << pot) )
838838         {
839            data = timer_timeelapsed(p->ptimer[pot]).attoseconds / AD_TIME.attoseconds;
839            data = p->ptimer[pot]->elapsed().attoseconds / AD_TIME.attoseconds;
840840            LOG(("POKEY '%s' read POT%d (interpolated) $%02x\n", p->device->tag(), pot, data));
841841            }
842842         else
r10326r10327
846846         }
847847      }
848848      else
849         logerror("%s: warning - read '%s' POT%d\n", cpuexec_describe_context(p->device->machine), p->device->tag(), pot);
849         logerror("%s: warning - read '%s' POT%d\n", p->device->machine->describe_context(), p->device->tag(), pot);
850850      break;
851851
852852    case ALLPOT_C:
r10326r10327
886886         ****************************************************************/
887887      if( p->SKCTL & SK_RESET )
888888      {
889         adjust = timer_timeelapsed(p->rtimer).as_double() / p->clock_period.as_double();
889         adjust = p->rtimer->elapsed().as_double() / p->clock_period.as_double();
890890         p->r9 = (p->r9 + adjust) % 0x001ff;
891891         p->r17 = (p->r17 + adjust) % 0x1ffff;
892892      }
r10326r10327
908908         LOG_RAND(("POKEY '%s' adjust %u rand17[$%05x]: $%02x\n", p->device->tag(), adjust, p->r17, p->RANDOM));
909909      }
910910      if (adjust > 0)
911         timer_adjust_oneshot(p->rtimer, attotime::never, 0);
911         p->rtimer->adjust(attotime::never);
912912      data = p->RANDOM ^ 0xff;
913913      break;
914914
r10326r10327
10431043        /* first remove any existing timers */
10441044      LOG_TIMER(("POKEY '%s' STIMER $%02x\n", p->device->tag(), data));
10451045
1046      timer_adjust_oneshot(p->timer[TIMER1], attotime::never, p->timer_param[TIMER1]);
1047      timer_adjust_oneshot(p->timer[TIMER2], attotime::never, p->timer_param[TIMER2]);
1048      timer_adjust_oneshot(p->timer[TIMER4], attotime::never, p->timer_param[TIMER4]);
1046      p->timer[TIMER1]->adjust(attotime::never, p->timer_param[TIMER1]);
1047      p->timer[TIMER2]->adjust(attotime::never, p->timer_param[TIMER2]);
1048      p->timer[TIMER4]->adjust(attotime::never, p->timer_param[TIMER4]);
10491049
10501050        /* reset all counters to zero (side effect) */
10511051      p->polyadjust = 0;
r10326r10327
10631063            /* set timer #1 _and_ #2 event after timer_div clocks of joined CHAN1+CHAN2 */
10641064            p->timer_period[TIMER2] = p->clock_period * p->divisor[CHAN2];
10651065            p->timer_param[TIMER2] = IRQ_TIMR2|IRQ_TIMR1;
1066            timer_adjust_periodic(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]);
1066            p->timer[TIMER2]->adjust(p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]);
10671067         }
10681068        }
10691069        else
r10326r10327
10741074            /* set timer #1 event after timer_div clocks of CHAN1 */
10751075            p->timer_period[TIMER1] = p->clock_period * p->divisor[CHAN1];
10761076            p->timer_param[TIMER1] = IRQ_TIMR1;
1077            timer_adjust_periodic(p->timer[TIMER1], p->timer_period[TIMER1], p->timer_param[TIMER1], p->timer_period[TIMER1]);
1077            p->timer[TIMER1]->adjust(p->timer_period[TIMER1], p->timer_param[TIMER1], p->timer_period[TIMER1]);
10781078         }
10791079
10801080         if( p->divisor[CHAN2] > 4 )
r10326r10327
10831083            /* set timer #2 event after timer_div clocks of CHAN2 */
10841084            p->timer_period[TIMER2] = p->clock_period * p->divisor[CHAN2];
10851085            p->timer_param[TIMER2] = IRQ_TIMR2;
1086            timer_adjust_periodic(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]);
1086            p->timer[TIMER2]->adjust(p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]);
10871087         }
10881088        }
10891089
r10326r10327
11001100               /* set timer #4 event after timer_div clocks of CHAN4 */
11011101               p->timer_period[TIMER4] = p->clock_period * p->divisor[CHAN4];
11021102               p->timer_param[TIMER4] = IRQ_TIMR4;
1103               timer_adjust_periodic(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]);
1103               p->timer[TIMER4]->adjust(p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]);
11041104            }
11051105            }
11061106        }
r10326r10327
11121112            /* set timer #4 event after timer_div clocks of CHAN4 */
11131113            p->timer_period[TIMER4] = p->clock_period * p->divisor[CHAN4];
11141114            p->timer_param[TIMER4] = IRQ_TIMR4;
1115            timer_adjust_periodic(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]);
1115            p->timer[TIMER4]->adjust(p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]);
11161116         }
11171117        }
11181118
1119      timer_enable(p->timer[TIMER1], p->IRQEN & IRQ_TIMR1);
1120      timer_enable(p->timer[TIMER2], p->IRQEN & IRQ_TIMR2);
1121      timer_enable(p->timer[TIMER4], p->IRQEN & IRQ_TIMR4);
1119      p->timer[TIMER1]->enable(p->IRQEN & IRQ_TIMR1);
1120      p->timer[TIMER2]->enable(p->IRQEN & IRQ_TIMR2);
1121      p->timer[TIMER4]->enable(p->IRQEN & IRQ_TIMR4);
11221122        break;
11231123
11241124    case SKREST_C:
r10326r10327
11601160         /* enable/disable timers now to avoid unneeded
11611161               breaking of the CPU cores for masked timers */
11621162         if( p->timer[TIMER1] && ((p->IRQEN^data) & IRQ_TIMR1) )
1163            timer_enable(p->timer[TIMER1], data & IRQ_TIMR1);
1163            p->timer[TIMER1]->enable(data & IRQ_TIMR1);
11641164         if( p->timer[TIMER2] && ((p->IRQEN^data) & IRQ_TIMR2) )
1165            timer_enable(p->timer[TIMER2], data & IRQ_TIMR2);
1165            p->timer[TIMER2]->enable(data & IRQ_TIMR2);
11661166         if( p->timer[TIMER4] && ((p->IRQEN^data) & IRQ_TIMR4) )
1167            timer_enable(p->timer[TIMER4], data & IRQ_TIMR4);
1167            p->timer[TIMER4]->enable(data & IRQ_TIMR4);
11681168        }
11691169      /* store irq enable */
11701170      p->IRQEN = data;
r10326r10327
12081208      if( new_val < p->counter[CHAN1] )
12091209         p->counter[CHAN1] = new_val;
12101210      if( p->interrupt_cb && p->timer[TIMER1] )
1211         timer_adjust_periodic(p->timer[TIMER1], p->clock_period * new_val, p->timer_param[TIMER1], p->timer_period[TIMER1]);
1211         p->timer[TIMER1]->adjust(p->clock_period * new_val, p->timer_param[TIMER1], p->timer_period[TIMER1]);
12121212      p->audible[CHAN1] = !(
12131213         (p->AUDC[CHAN1] & VOLUME_ONLY) ||
12141214         (p->AUDC[CHAN1] & VOLUME_MASK) == 0 ||
r10326r10327
12441244      if( new_val < p->counter[CHAN2] )
12451245         p->counter[CHAN2] = new_val;
12461246      if( p->interrupt_cb && p->timer[TIMER2] )
1247         timer_adjust_periodic(p->timer[TIMER2], p->clock_period * new_val, p->timer_param[TIMER2], p->timer_period[TIMER2]);
1247         p->timer[TIMER2]->adjust(p->clock_period * new_val, p->timer_param[TIMER2], p->timer_period[TIMER2]);
12481248      p->audible[CHAN2] = !(
12491249         (p->AUDC[CHAN2] & VOLUME_ONLY) ||
12501250         (p->AUDC[CHAN2] & VOLUME_MASK) == 0 ||
r10326r10327
13091309      if( new_val < p->counter[CHAN4] )
13101310         p->counter[CHAN4] = new_val;
13111311      if( p->interrupt_cb && p->timer[TIMER4] )
1312         timer_adjust_periodic(p->timer[TIMER4], p->clock_period * new_val, p->timer_param[TIMER4], p->timer_period[TIMER4]);
1312         p->timer[TIMER4]->adjust(p->clock_period * new_val, p->timer_param[TIMER4], p->timer_period[TIMER4]);
13131313      p->audible[CHAN4] = !(
13141314         (p->AUDC[CHAN4] & VOLUME_ONLY) ||
13151315         (p->AUDC[CHAN4] & VOLUME_MASK) == 0 ||
src/emu/sound/sp0250.c
r10326r10327
226226         sp->drq(sp->device, CLEAR_LINE);
227227   }
228228   else
229      logerror("%s: overflow SP0250 FIFO\n", cpuexec_describe_context(device->machine));
229      logerror("%s: overflow SP0250 FIFO\n", device->machine->describe_context());
230230}
231231
232232
src/emu/sound/ay8910.c
r10326r10327
887887      if (psg->portAread.read)
888888         psg->regs[AY_PORTA] = devcb_call_read8(&psg->portAread, 0);
889889      else
890         logerror("%s: warning - read 8910 '%s' Port A\n",cpuexec_describe_context(psg->device->machine),psg->device->tag());
890         logerror("%s: warning - read 8910 '%s' Port A\n",psg->device->machine->describe_context(),psg->device->tag());
891891      break;
892892   case AY_PORTB:
893893      if ((psg->regs[AY_ENABLE] & 0x80) != 0)
r10326r10327
895895      if (psg->portBread.read)
896896         psg->regs[AY_PORTB] = devcb_call_read8(&psg->portBread, 0);
897897      else
898         logerror("%s: warning - read 8910 '%s' Port B\n",cpuexec_describe_context(psg->device->machine),psg->device->tag());
898         logerror("%s: warning - read 8910 '%s' Port B\n",psg->device->machine->describe_context(),psg->device->tag());
899899      break;
900900   }
901901
src/emu/sound/ym2151.c
r10326r10327
819819static TIMER_CALLBACK( timer_callback_a )
820820{
821821   YM2151 *chip = (YM2151 *)ptr;
822   timer_adjust_oneshot(chip->timer_A, chip->timer_A_time[ chip->timer_A_index ], 0);
822   chip->timer_A->adjust(chip->timer_A_time[ chip->timer_A_index ]);
823823   chip->timer_A_index_old = chip->timer_A_index;
824824   if (chip->irq_enable & 0x04)
825825   {
r10326r10327
832832static TIMER_CALLBACK( timer_callback_b )
833833{
834834   YM2151 *chip = (YM2151 *)ptr;
835   timer_adjust_oneshot(chip->timer_B, chip->timer_B_time[ chip->timer_B_index ], 0);
835   chip->timer_B->adjust(chip->timer_B_time[ chip->timer_B_index ]);
836836   chip->timer_B_index_old = chip->timer_B_index;
837837   if (chip->irq_enable & 0x08)
838838   {
r10326r10327
11231123            #ifdef USE_MAME_TIMERS
11241124            /* ASG 980324: added a real timer */
11251125            /* start timer _only_ if it wasn't already started (it will reload time value next round) */
1126               if (!timer_enable(chip->timer_B, 1))
1126               if (!chip->timer_B->enable(true))
11271127               {
1128                  timer_adjust_oneshot(chip->timer_B, chip->timer_B_time[ chip->timer_B_index ], 0);
1128                  chip->timer_B->adjust(chip->timer_B_time[ chip->timer_B_index ]);
11291129                  chip->timer_B_index_old = chip->timer_B_index;
11301130               }
11311131            #else
r10326r10327
11401140         {      /* stop timer B */
11411141            #ifdef USE_MAME_TIMERS
11421142            /* ASG 980324: added a real timer */
1143               timer_enable(chip->timer_B, 0);
1143               chip->timer_B->enable(false);
11441144            #else
11451145               chip->tim_B = 0;
11461146            #endif
r10326r10327
11511151            #ifdef USE_MAME_TIMERS
11521152            /* ASG 980324: added a real timer */
11531153            /* start timer _only_ if it wasn't already started (it will reload time value next round) */
1154               if (!timer_enable(chip->timer_A, 1))
1154               if (!chip->timer_A->enable(true))
11551155               {
1156                  timer_adjust_oneshot(chip->timer_A, chip->timer_A_time[ chip->timer_A_index ], 0);
1156                  chip->timer_A->adjust(chip->timer_A_time[ chip->timer_A_index ]);
11571157                  chip->timer_A_index_old = chip->timer_A_index;
11581158               }
11591159            #else
r10326r10327
11681168         {      /* stop timer A */
11691169            #ifdef USE_MAME_TIMERS
11701170            /* ASG 980324: added a real timer */
1171               timer_enable(chip->timer_A, 0);
1171               chip->timer_A->enable(false);
11721172            #else
11731173               chip->tim_A = 0;
11741174            #endif
r10326r10327
16171617   chip->irq_enable = 0;
16181618#ifdef USE_MAME_TIMERS
16191619   /* ASG 980324 -- reset the timers before writing to the registers */
1620   timer_enable(chip->timer_A, 0);
1621   timer_enable(chip->timer_B, 0);
1620   chip->timer_A->enable(false);
1621   chip->timer_B->enable(false);
16221622#else
16231623   chip->tim_A      = 0;
16241624   chip->tim_B      = 0;
src/emu/sound/scsp.c
r10326r10327
739739               time = (44100 / scsp->TimPris[0]) / (255-(scsp->udata.data[0x18/2]&0xff));
740740               if (time)
741741               {
742                  timer_adjust_oneshot(scsp->timerA, attotime::from_hz(time), 0);
742                  scsp->timerA->adjust(attotime::from_hz(time));
743743               }
744744            }
745745         }
r10326r10327
758758               time = (44100 / scsp->TimPris[1]) / (255-(scsp->udata.data[0x1A/2]&0xff));
759759               if (time)
760760               {
761                  timer_adjust_oneshot(scsp->timerB, attotime::from_hz(time), 0);
761                  scsp->timerB->adjust(attotime::from_hz(time));
762762               }
763763            }
764764         }
r10326r10327
777777               time = (44100 / scsp->TimPris[2]) / (255-(scsp->udata.data[0x1C/2]&0xff));
778778               if (time)
779779               {
780                  timer_adjust_oneshot(scsp->timerC, attotime::from_hz(time), 0);
780                  scsp->timerC->adjust(attotime::from_hz(time));
781781               }
782782            }
783783         }
src/emu/sound/2610intf.c
r10326r10327
9494   ym2610_state *info = (ym2610_state *)param;
9595   if( count == 0 )
9696   {   /* Reset FM Timer */
97      timer_enable(info->timer[c], 0);
97      info->timer[c]->enable(false);
9898   }
9999   else
100100   {   /* Start FM Timer */
101101      attotime period = attotime::from_hz(clock) * count;
102102
103      if (!timer_enable(info->timer[c], 1))
104         timer_adjust_oneshot(info->timer[c], period, 0);
103      if (!info->timer[c]->enable(true))
104         info->timer[c]->adjust(period);
105105   }
106106}
107107
src/emu/sound/ics2115.c
r10326r10327
125125   m_reg_select = 0;
126126    m_vmode = 0;
127127   memset(m_voice, 0, sizeof(m_voice));
128   timer_adjust_oneshot(m_timer[0].timer, attotime::never, 0);
129   timer_adjust_oneshot(m_timer[1].timer, attotime::never, 0);
128   m_timer[0].timer->adjust(attotime::never);
129   m_timer[1].timer->adjust(attotime::never);
130130   m_timer[0].period = 0;
131131   m_timer[1].period = 0;
132132   for(int i = 0; i < 32; i++) {
r10326r10327
903903      m_timer[timer].period = period;
904904      // Adjust the timer lengths
905905      if(period) // Reset the length
906         timer_adjust_periodic(m_timer[timer].timer, attotime::from_nsec(period), 0, attotime::from_nsec(period));
906         m_timer[timer].timer->adjust(attotime::from_nsec(period), 0, attotime::from_nsec(period));
907907      else // Kill the timer if length == 0
908         timer_adjust_oneshot(m_timer[timer].timer, attotime::never, 0);
908         m_timer[timer].timer->adjust(attotime::never);
909909   }
910910}
src/emu/sound/gaelco.c
r10326r10327
195195{
196196   gaelco_sound_state *info = get_safe_token(device);
197197
198   LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", cpuexec_describe_context(device->machine), offset));
198   LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", device->machine->describe_context(), offset));
199199
200200   return info->sndregs[offset];
201201}
r10326r10327
209209   gaelco_sound_state *info = get_safe_token(device);
210210   gaelco_sound_channel *channel = &info->channel[offset >> 3];
211211
212   LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", cpuexec_describe_context(device->machine), data, offset));
212   LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", device->machine->describe_context(), data, offset));
213213
214214   /* first update the stream to this point in time */
215215   info->stream->update();
src/emu/sound/2608intf.c
r10326r10327
9595   ym2608_state *info = (ym2608_state *)param;
9696   if( count == 0 )
9797   {   /* Reset FM Timer */
98      timer_enable(info->timer[c], 0);
98      info->timer[c]->enable(false);
9999   }
100100   else
101101   {   /* Start FM Timer */
102102      attotime period = attotime::from_hz(clock) * count;
103      if (!timer_enable(info->timer[c], 1))
104         timer_adjust_oneshot(info->timer[c], period, 0);
103      if (!info->timer[c]->enable(true))
104         info->timer[c]->adjust(period);
105105   }
106106}
107107
src/emu/sound/es5506.c
r10326r10327
16191619         }
16201620
16211621         if (LOG_COMMANDS && eslog)
1622            fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff);
1622            fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", machine->describe_context(), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff);
16231623         break;
16241624
16251625      case 0x01:   /* FC */
r10326r10327
16281628         if (ACCESSING_BITS_8_15)
16291629            voice->freqcount = (voice->freqcount & ~0x1fe00) | ((data & 0xff00) << 1);
16301630         if (LOG_COMMANDS && eslog)
1631            fprintf(eslog, "%s:voice %d, freq count=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->freqcount);
1631            fprintf(eslog, "%s:voice %d, freq count=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->freqcount);
16321632         break;
16331633
16341634      case 0x02:   /* STRT (hi) */
r10326r10327
16371637         if (ACCESSING_BITS_8_15)
16381638            voice->start = (voice->start & ~0x7c000000) | ((data & 0x1f00) << 18);
16391639         if (LOG_COMMANDS && eslog)
1640            fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->start);
1640            fprintf(eslog, "%s:voice %d, loop start=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->start);
16411641         break;
16421642
16431643      case 0x03:   /* STRT (lo) */
r10326r10327
16461646         if (ACCESSING_BITS_8_15)
16471647            voice->start = (voice->start & ~0x0003fc00) | ((data & 0xff00) << 2);
16481648         if (LOG_COMMANDS && eslog)
1649            fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->start);
1649            fprintf(eslog, "%s:voice %d, loop start=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->start);
16501650         break;
16511651
16521652      case 0x04:   /* END (hi) */
r10326r10327
16581658         voice->control |= CONTROL_STOP0;
16591659#endif
16601660         if (LOG_COMMANDS && eslog)
1661            fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->end);
1661            fprintf(eslog, "%s:voice %d, loop end=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->end);
16621662         break;
16631663
16641664      case 0x05:   /* END (lo) */
r10326r10327
16701670         voice->control |= CONTROL_STOP0;
16711671#endif
16721672         if (LOG_COMMANDS && eslog)
1673            fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->end);
1673            fprintf(eslog, "%s:voice %d, loop end=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->end);
16741674         break;
16751675
16761676      case 0x06:   /* K2 */
r10326r10327
16791679         if (ACCESSING_BITS_8_15)
16801680            voice->k2 = (voice->k2 & ~0xff00) | (data & 0xff00);
16811681         if (LOG_COMMANDS && eslog)
1682            fprintf(eslog, "%s:voice %d, K2=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->k2);
1682            fprintf(eslog, "%s:voice %d, K2=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->k2);
16831683         break;
16841684
16851685      case 0x07:   /* K1 */
r10326r10327
16881688         if (ACCESSING_BITS_8_15)
16891689            voice->k1 = (voice->k1 & ~0xff00) | (data & 0xff00);
16901690         if (LOG_COMMANDS && eslog)
1691            fprintf(eslog, "%s:voice %d, K1=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->k1);
1691            fprintf(eslog, "%s:voice %d, K1=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->k1);
16921692         break;
16931693
16941694      case 0x08:   /* LVOL */
16951695         if (ACCESSING_BITS_8_15)
16961696            voice->lvol = (voice->lvol & ~0xff00) | (data & 0xff00);
16971697         if (LOG_COMMANDS && eslog)
1698            fprintf(eslog, "%s:voice %d, left vol=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->lvol);
1698            fprintf(eslog, "%s:voice %d, left vol=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->lvol);
16991699         break;
17001700
17011701      case 0x09:   /* RVOL */
17021702         if (ACCESSING_BITS_8_15)
17031703            voice->rvol = (voice->rvol & ~0xff00) | (data & 0xff00);
17041704         if (LOG_COMMANDS && eslog)
1705            fprintf(eslog, "%s:voice %d, right vol=%04x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->rvol);
1705            fprintf(eslog, "%s:voice %d, right vol=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->rvol);
17061706         break;
17071707
17081708      case 0x0a:   /* ACC (hi) */
r10326r10327
17111711         if (ACCESSING_BITS_8_15)
17121712            voice->accum = (voice->accum & ~0x7c000000) | ((data & 0x1f00) << 18);
17131713         if (LOG_COMMANDS && eslog)
1714            fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->accum);
1714            fprintf(eslog, "%s:voice %d, accum=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->accum);
17151715         break;
17161716
17171717      case 0x0b:   /* ACC (lo) */
r10326r10327
17201720         if (ACCESSING_BITS_8_15)
17211721            voice->accum = (voice->accum & ~0x0003fc00) | ((data & 0xff00) << 2);
17221722         if (LOG_COMMANDS && eslog)
1723            fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->accum);
1723            fprintf(eslog, "%s:voice %d, accum=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->accum);
17241724         break;
17251725
17261726      case 0x0c:   /* unused */
r10326r10327
17691769                          ((data << 2) & (CONTROL_CA0 | CONTROL_CA1));
17701770         }
17711771         if (LOG_COMMANDS && eslog)
1772            fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->control, data, mem_mask);
1772            fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", machine->describe_context(), chip->current_page & 0x1f, voice->control, data, mem_mask);
17731773         break;
17741774
17751775      case 0x01:   /* O4(n-1) */
r10326r10327
17781778         if (ACCESSING_BITS_8_15)
17791779            voice->o4n1 = (INT16)((voice->o4n1 & ~0xff00) | (data & 0xff00));
17801780         if (LOG_COMMANDS && eslog)
1781            fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff);
1781            fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff);
17821782         break;
17831783
17841784      case 0x02:   /* O3(n-1) */
r10326r10327
17871787         if (ACCESSING_BITS_8_15)
17881788            voice->o3n1 = (INT16)((voice->o3n1 & ~0xff00) | (data & 0xff00));
17891789         if (LOG_COMMANDS && eslog)
1790            fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff);
1790            fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff);
17911791         break;
17921792
17931793      case 0x03:   /* O3(n-2) */
r10326r10327
17961796         if (ACCESSING_BITS_8_15)
17971797            voice->o3n2 = (INT16)((voice->o3n2 & ~0xff00) | (data & 0xff00));
17981798         if (LOG_COMMANDS && eslog)
1799            fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff);
1799            fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff);
18001800         break;
18011801
18021802      case 0x04:   /* O2(n-1) */
r10326r10327
18051805         if (ACCESSING_BITS_8_15)
18061806            voice->o2n1 = (INT16)((voice->o2n1 & ~0xff00) | (data & 0xff00));
18071807         if (LOG_COMMANDS && eslog)
1808            fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff);
1808            fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff);
18091809         break;
18101810
18111811      case 0x05:   /* O2(n-2) */
r10326r10327
18141814         if (ACCESSING_BITS_8_15)
18151815            voice->o2n2 = (INT16)((voice->o2n2 & ~0xff00) | (data & 0xff00));
18161816         if (LOG_COMMANDS && eslog)
1817            fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff);
1817            fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff);
18181818         break;
18191819
18201820      case 0x06:   /* O1(n-1) */
r10326r10327
18231823         if (ACCESSING_BITS_8_15)
18241824            voice->o1n1 = (INT16)((voice->o1n1 & ~0xff00) | (data & 0xff00));
18251825         if (LOG_COMMANDS && eslog)
1826            fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", cpuexec_describe_context(machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum);
1826            fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", machine->describe_context(), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum);
18271827         break;
18281828
18291829      case 0x07:
r10326r10327
19061906   es5506_state *chip = get_safe_token(device);
19071907   es5506_voice *voice = &chip->voice[chip->current_page & 0x1f];
19081908
1909//  logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", cpuexec_describe_context(machine), chip->current_page, offset, data, mem_mask);
1909//  logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", machine->describe_context(), chip->current_page, offset, data, mem_mask);
19101910
19111911   /* force an update */
19121912   chip->stream->update();
src/emu/sound/cdp1864.c
r10326r10327
107107         devcb_call_write_line(&cdp1864->out_int_func, ASSERT_LINE);
108108      }
109109
110      timer_adjust_oneshot(cdp1864->int_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_END), 0);
110      cdp1864->int_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_END));
111111   }
112112   else
113113   {
r10326r10327
116116         devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
117117      }
118118
119      timer_adjust_oneshot(cdp1864->int_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_START), 0);
119      cdp1864->int_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_START));
120120   }
121121}
122122
r10326r10327
135135   {
136136   case CDP1864_SCANLINE_EFX_TOP_START:
137137      devcb_call_write_line(&cdp1864->out_efx_func, ASSERT_LINE);
138      timer_adjust_oneshot(cdp1864->efx_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_END), 0);
138      cdp1864->efx_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_END));
139139      break;
140140
141141   case CDP1864_SCANLINE_EFX_TOP_END:
142142      devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
143      timer_adjust_oneshot(cdp1864->efx_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_START), 0);
143      cdp1864->efx_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_START));
144144      break;
145145
146146   case CDP1864_SCANLINE_EFX_BOTTOM_START:
147147      devcb_call_write_line(&cdp1864->out_efx_func, ASSERT_LINE);
148      timer_adjust_oneshot(cdp1864->efx_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_END), 0);
148      cdp1864->efx_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_END));
149149      break;
150150
151151   case CDP1864_SCANLINE_EFX_BOTTOM_END:
152152      devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
153      timer_adjust_oneshot(cdp1864->efx_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START), 0);
153      cdp1864->efx_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START));
154154      break;
155155   }
156156}
r10326r10327
176176         }
177177      }
178178
179      timer_adjust_oneshot(cdp1864->dma_timer, machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_WAIT), 0);
179      cdp1864->dma_timer->adjust(machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_WAIT));
180180
181181      cdp1864->dmaout = 0;
182182   }
r10326r10327
190190         }
191191      }
192192
193      timer_adjust_oneshot(cdp1864->dma_timer, machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_ACTIVE), 0);
193      cdp1864->dma_timer->adjust(machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
194194
195195      cdp1864->dmaout = 1;
196196   }
r10326r10327
475475{
476476   cdp1864_t *cdp1864 = get_safe_token(device);
477477
478   timer_adjust_oneshot(cdp1864->int_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_START), 0);
479   timer_adjust_oneshot(cdp1864->efx_timer, cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START), 0);
480   timer_adjust_oneshot(cdp1864->dma_timer, device->machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_START), 0);
478   cdp1864->int_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_START));
479   cdp1864->efx_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START));
480   cdp1864->dma_timer->adjust(device->machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_START));
481481
482482   cdp1864->disp = 0;
483483   cdp1864->dmaout = 0;
src/emu/sound/ymf278b.c
r10326r10327
377377      if (chip->clock != YMF278B_STD_CLOCK)
378378         period = (period * chip->clock) / YMF278B_STD_CLOCK;
379379
380      timer_adjust_periodic(chip->timer_a, period, 0, period);
380      chip->timer_a->adjust(period, 0, period);
381381   }
382382   else
383      timer_adjust_oneshot(chip->timer_a, attotime::never, 0);
383      chip->timer_a->adjust(attotime::never);
384384}
385385
386386static void ymf278b_timer_b_reset(YMF278BChip *chip)
r10326r10327
392392      if (chip->clock != YMF278B_STD_CLOCK)
393393         period = (period * chip->clock) / YMF278B_STD_CLOCK;
394394
395      timer_adjust_periodic(chip->timer_b, period, 0, period);
395      chip->timer_b->adjust(period, 0, period);
396396   }
397397   else
398      timer_adjust_oneshot(chip->timer_b, attotime::never, 0);
398      chip->timer_b->adjust(attotime::never);
399399}
400400
401401static void ymf278b_A_w(running_machine *machine, YMF278BChip *chip, UINT8 reg, UINT8 data)
r10326r10327
620620         return chip->current_irq | (chip->irq_line == ASSERT_LINE ? 0x80 : 0x00);
621621
622622      default:
623         logerror("%s: unexpected read at offset %X from ymf278b\n", cpuexec_describe_context(device->machine), offset);
623         logerror("%s: unexpected read at offset %X from ymf278b\n", device->machine->describe_context(), offset);
624624         break;
625625   }
626626   return 0xff;
r10326r10327
657657         break;
658658
659659      default:
660         logerror("%s: unexpected write at offset %X to ymf278b = %02X\n", cpuexec_describe_context(device->machine), offset, data);
660         logerror("%s: unexpected write at offset %X to ymf278b = %02X\n", device->machine->describe_context(), offset, data);
661661         break;
662662   }
663663}
src/emu/sound/k053260.c
r10326r10327
424424            ic->channels[0].pos += ( 1 << 16 );
425425
426426            if ( offs > ic->rom_size ) {
427               logerror("%s: K53260: Attempting to read past ROM size in ROM Read Mode (offs = %06x, size = %06x).\n", cpuexec_describe_context(device->machine),offs,ic->rom_size );
427               logerror("%s: K53260: Attempting to read past ROM size in ROM Read Mode (offs = %06x, size = %06x).\n", device->machine->describe_context(),offs,ic->rom_size );
428428
429429               return 0;
430430            }
src/emu/sound/psx.c
r10326r10327
2222      va_start( v, s_fmt );
2323      vsprintf( buf, s_fmt, v );
2424      va_end( v );
25      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
25      logerror( "%s: %s", machine->describe_context(), buf );
2626   }
2727}
2828
src/emu/sound/8950intf.c
r10326r10327
6161   y8950_state *info = (y8950_state *)param;
6262   if( period == attotime::zero )
6363   {   /* Reset FM Timer */
64      timer_enable(info->timer[c], 0);
64      info->timer[c]->enable(false);
6565   }
6666   else
6767   {   /* Start FM Timer */
68      timer_adjust_oneshot(info->timer[c], period, 0);
68      info->timer[c]->adjust(period);
6969   }
7070}
7171
src/emu/sound/asc.c
r10326r10327
506506
507507               if (data != 0)
508508               {
509                  timer_adjust_periodic(m_sync_timer, attotime::zero, 0, attotime::from_hz(22257/4));
509                  m_sync_timer->adjust(attotime::zero, 0, attotime::from_hz(22257/4));
510510               }
511511               else
512512               {
513                  timer_adjust_oneshot(m_sync_timer, attotime::never, 0);
513                  m_sync_timer->adjust(attotime::never);
514514               }
515515            }
516516            break;
src/emu/sound/2203intf.c
r10326r10327
8989   ym2203_state *info = (ym2203_state *)param;
9090   if( count == 0 )
9191   {   /* Reset FM Timer */
92      timer_enable(info->timer[c], 0);
92      info->timer[c]->enable(false);
9393   }
9494   else
9595   {   /* Start FM Timer */
9696      attotime period = attotime::from_hz(clock) * count;
97      if (!timer_enable(info->timer[c], 1))
98         timer_adjust_oneshot(info->timer[c], period, 0);
97      if (!info->timer[c]->enable(true))
98         info->timer[c]->adjust(period);
9999   }
100100}
101101
src/emu/sound/es5503.c
r10326r10327
446446                  // ok, we run for this long
447447                  period = attotime::from_hz(chip->output_rate) * length;
448448
449                  timer_adjust_periodic(chip->oscillators[osc].timer, period, 0, period);
449                  chip->oscillators[osc].timer->adjust(period, 0, period);
450450               }
451451            }
452452            else if (!(chip->oscillators[osc].control & 1) && (data&1))
453453            {
454454               // key off
455               timer_adjust_oneshot(chip->oscillators[osc].timer, attotime::never, 0);
455               chip->oscillators[osc].timer->adjust(attotime::never);
456456            }
457457
458458            chip->oscillators[osc].control = data;
src/emu/sound/262intf.c
r10326r10327
5454   ymf262_state *info = (ymf262_state *)param;
5555   if( period == attotime::zero )
5656   {   /* Reset FM Timer */
57      timer_enable(info->timer[timer], 0);
57      info->timer[timer]->enable(false);
5858   }
5959   else
6060   {   /* Start FM Timer */
61      timer_adjust_oneshot(info->timer[timer], period, 0);
61      info->timer[timer]->adjust(period);
6262   }
6363}
6464
src/emu/machine.h
r10326r10327
221221   DISABLE_COPYING(memory_region);
222222
223223   friend class running_machine;
224   template<class T> friend class tagged_list;
224   friend class simple_list<memory_region>;
225225   friend resource_pool_object<memory_region>::~resource_pool_object();
226226
227227   // construction/destruction
src/emu/emutempl.h
r0r10327
1/***************************************************************************
2
3    emutempl.h
4
5    Core templates for basic non-string types.
6
7****************************************************************************
8
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
38***************************************************************************/
39
40#pragma once
41
42#ifndef __EMUTEMPL_H__
43#define __EMUTEMPL_H__
44
45
46//**************************************************************************
47//  TYPE DEFINITIONS
48//**************************************************************************
49
50// ======================> simple_list
51
52// a simple_list is a singly-linked list whose 'next' pointer is owned
53// by the object
54template<class T>
55class simple_list
56{
57   // we don't support deep copying
58   DISABLE_COPYING(simple_list);
59
60public:
61   // construction/destruction
62   simple_list(resource_pool &pool = global_resource_pool) :
63      m_head(NULL),
64      m_tail(NULL),
65      m_pool(pool),
66      m_count(0) { }
67
68   virtual ~simple_list() { reset(); }
69
70   // simple getters
71   resource_pool &pool() const { return m_pool; }
72   T *first() const { return m_head; }
73   T *last() const { return m_tail; }
74   int count() const { return m_count; }
75
76   // remove (free) all objects in the list, leaving an empty list
77   void reset()
78   {
79      while (m_head != NULL)
80         remove(*m_head);
81   }
82
83   // add the given object to the head of the list
84   T &prepend(T &object)
85   {
86      object.m_next = m_head;
87      m_head = &object;
88      if (m_tail == NULL)
89         m_tail = m_head;
90      m_count++;
91      return object;
92   }
93
94   // add the given list to the head of the list
95   void prepend_list(simple_list<T> &list)
96   {
97      int count = list.count();
98      if (count == 0)
99         return;
100      T *tail = list.last();
101      T *head = list.detach_all();
102      tail->m_next = m_head;
103      m_head = head;
104      if (m_tail == NULL)
105         m_tail = tail;
106      m_count += count;
107   }
108
109   // add the given object to the tail of the list
110   T &append(T &object)
111   {
112      object.m_next = NULL;
113      if (m_tail != NULL)
114         m_tail = m_tail->m_next = &object;
115      else
116         m_tail = m_head = &object;
117      m_count++;
118      return object;
119   }
120
121   // add the given list to the tail of the list
122   void append_list(simple_list<T> &list)
123   {
124      int count = list.count();
125      if (count == 0)
126         return;
127      T *tail = list.last();
128      T *head = list.detach_all();
129      if (m_tail != NULL)
130         m_tail->m_next = head;
131      else
132         m_head = head;
133      m_tail = tail;
134      m_count += count;
135   }
136   
137   // insert the given object after a particular object (NULL means prepend)
138   T &insert_after(T &object, T *insert_after)
139   {
140      if (insert_after == NULL)
141         return prepend(object);
142      object.m_next = insert_after->m_next;
143      insert_after->m_next = &object;
144      m_count++;
145      return object;
146   }
147
148   // replace an item in the list at the same location, and remove it
149   T &replace_and_remove(T &object, T &toreplace)
150   {
151      T *prev = NULL;
152      for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
153         if (cur == &toreplace)
154         {
155            if (prev != NULL)
156               prev->m_next = &object;
157            else
158               m_head = &object;
159            if (m_tail == &toreplace)
160               m_tail = &object;
161            object.m_next = toreplace.m_next;
162            pool_free(m_pool, &toreplace);
163            return object;
164         }
165      return append(object);
166   }
167
168   // detach the head item from the list, but don't free its memory
169   T *detach_head()
170   {
171      T *result = m_head;
172      if (result != NULL)
173      {
174         m_head = result->m_next;
175         m_count--;
176         if (m_head == NULL)
177            m_tail = NULL;
178      }
179      return result;
180   }
181
182   // detach the given item from the list, but don't free its memory
183   T &detach(T &object)
184   {
185      T *prev = NULL;
186      for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
187         if (cur == &object)
188         {
189            if (prev != NULL)
190               prev->m_next = object.m_next;
191            else
192               m_head = object.m_next;
193            if (m_tail == &object)
194               m_tail = prev;
195            m_count--;
196            return object;
197         }
198      return object;
199   }
200
201   // deatch the entire list, returning the head, but don't free memory
202   T *detach_all()
203   {
204      T *result = m_head;
205      m_head = m_tail = NULL;
206      m_count = 0;
207      return result;
208   }
209
210   // remove the given object and free its memory
211   void remove(T &object)
212   {
213      detach(object);
214      pool_free(m_pool, &object);
215   }
216
217   // find an object by index in the list
218   T *find(int index) const
219   {
220      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
221         if (index-- == 0)
222            return cur;
223      return NULL;
224   }
225
226   // return the index of the given object in the list
227   int indexof(const T &object) const
228   {
229      int index = 0;
230      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
231      {
232         if (cur == &object)
233            return index;
234         index++;
235      }
236      return -1;
237   }
238
239private:
240   // internal state
241   T *            m_head;         // head of the singly-linked list
242   T *            m_tail;         // tail of the singly-linked list
243   resource_pool &   m_pool;         // resource pool where objects are freed
244   int          m_count;      // number of objects in the list
245};
246
247
248// ======================> fixed_allocator
249
250// a fixed_allocator is a simple class that maintains a free pool of objects
251template<class T>
252class fixed_allocator
253{
254   // we don't support deep copying
255   DISABLE_COPYING(fixed_allocator);
256
257public:
258   // construction/destruction
259   fixed_allocator(resource_pool &pool = global_resource_pool)
260      : m_freelist(pool) { }
261
262   // allocate a new item, either by recycling an old one, or by allocating a new one
263   T *alloc()
264   {
265      T *result = m_freelist.detach_head();
266      if (result == NULL)
267         result = m_freelist.pool().add_object(new T);
268      return result;
269   }
270
271   // reclaim an item by adding it to the free list
272   void reclaim(T *item) { if (item != NULL) m_freelist.append(*item); }
273   void reclaim(T &item) { m_freelist.append(item); }
274   
275   // reclaim all items from a list
276   void reclaim_all(simple_list<T> &list) { m_freelist.append_list(list); }
277
278private:
279   // internal state
280   simple_list<T>    m_freelist;      // list of free objects
281};
282
283
284// ======================> tagged_list
285
286// a tagged_list is a class that maintains a list of objects that can be quickly looked up by tag
287template<class T>
288class tagged_list
289{
290   // we don't support deep copying
291   DISABLE_COPYING(tagged_list);
292
293public:
294   // construction/destruction
295   tagged_list(resource_pool &pool = global_resource_pool) :
296      m_list(pool) { }
297
298   // simple getters
299   resource_pool &pool() const { return m_list.pool(); }
300   T *first() const { return m_list.first(); }
301   T *last() const { return m_list.last(); }
302   int count() const { return m_list.count(); }
303
304   // remove (free) all objects in the list, leaving an empty list
305   void reset() { m_list.reset(); m_map.reset(); }
306
307   // add the given object to the head of the list
308   T &prepend(const char *tag, T &object)
309   {
310      if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
311         throw emu_fatalerror("Error adding object named '%s'", tag);
312      return m_list.prepend(object);
313   }
314
315   // add the given object to the tail of the list
316   T &append(const char *tag, T &object)
317   {
318      if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
319         throw emu_fatalerror("Error adding object named '%s'", tag);
320      return m_list.append(object);
321   }
322
323   // insert the given object after a particular object (NULL means prepend)
324   T &insert_after(const char *tag, T &object, T *insert_after)
325   {
326      if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
327         throw emu_fatalerror("Error adding object named '%s'", tag);
328      return m_list.insert_after(object, insert_after);
329   }
330
331   // replace an item in the list at the same location, and remove it
332   T &replace_and_remove(const char *tag, T &object, T &toreplace)
333   {
334      m_map.remove(&toreplace);
335      m_list.replace_and_remove(object, toreplace);
336      if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
337         throw emu_fatalerror("Error replacing object named '%s'", tag);
338      return object;
339   }
340
341   // detach the given item from the list, but don't free its memory
342   T &detach(T &object)
343   {
344      m_map.remove(&object);
345      return m_list.detach(object);
346   }
347
348   // remove the given object and free its memory
349   void remove(T &object)
350   {
351      m_map.remove(&object);
352      return m_list.remove(object);
353   }
354
355   // find an object by index in the list
356   T *find(int index) const
357   {
358      return m_list.find(index);
359   }
360
361   // return the index of the given object in the list
362   int indexof(const T &object) const
363   {
364      return m_list.indexof(object);
365   }
366
367   // operations by tag
368   T &replace_and_remove(const char *tag, T &object) { T *existing = find(tag); return (existing == NULL) ? append(tag, object) : replace_and_remove(tag, object, *existing); }
369   void remove(const char *tag) { T *object = find(tag); if (object != NULL) remove(*object); }
370   T *find(const char *tag) const { return m_map.find_hash_only(tag); }
371   int indexof(const char *tag) const { T *object = find(tag); return (object != NULL) ? m_list.indexof(*object) : NULL; }
372
373private:
374   // internal state
375   simple_list<T>      m_list;
376   tagmap_t<T *>       m_map;
377};
378
379
380#endif   /* __EMUTEMPL_H__ */
src/emu/schedule.c
r10326r10327
532532
533533   // if we have a non-zero time, schedule a timer
534534   if (after != attotime::zero)
535      timer_set(after, MFUNC(timer_expired, device_scheduler, timed_trigger), trigid, this);
535      timer_set(after, MSTUB(timer_expired, device_scheduler, timed_trigger), trigid, this);
536536
537537   // send the trigger to everyone who cares
538538   else
src/emu/imagedev/flopdrv.c
r10326r10327
7070   int current_track;
7171
7272   /* index pulse timer */
73   void   *index_timer;
73   emu_timer   *index_timer;
7474   /* index pulse callback */
7575   void   (*index_pulse_callback)(device_t *controller,device_t *image, int state);
7676   /* rotation per minute => gives index pulse frequency */
r10326r10327
244244   if (drive->idx)
245245   {
246246      drive->idx = 0;
247      timer_adjust_oneshot((emu_timer*)drive->index_timer, attotime::from_double(ms*19/20/1000.0), 0);
247      drive->index_timer->adjust(attotime::from_double(ms*19/20/1000.0));
248248   }
249249   else
250250   {
251251      drive->idx = 1;
252      timer_adjust_oneshot((emu_timer*)drive->index_timer, attotime::from_double(ms/20/1000.0), 0);
252      drive->index_timer->adjust(attotime::from_double(ms/20/1000.0));
253253   }
254254
255255   devcb_call_write_line(&drive->out_idx_func, drive->idx);
r10326r10327
843843
844844   /* on -> off */
845845   else if (drive->mon == CLEAR_LINE && state)
846      timer_adjust_oneshot((emu_timer*)drive->index_timer, attotime::zero, 0);
846      drive->index_timer->adjust(attotime::zero);
847847
848848   drive->mon = state;
849849}
src/emu/imagedev/bitbngr.c
r10326r10327
386386      else
387387         logerror("Bitbanger: Output framing error.\n" );
388388
389      timer_reset(bi->bitbanger_output_timer, attotime::never);
389      bi->bitbanger_output_timer->reset();
390390   }
391391}
392392
r10326r10327
410410      {
411411         /* no more data, wait and try again */
412412         bi->idle_delay = min(bi->idle_delay + attotime::from_msec(100), attotime::from_seconds(1));
413         timer_adjust_oneshot(bi->bitbanger_input_timer, bi->idle_delay, 0);
413         bi->bitbanger_input_timer->adjust(bi->idle_delay);
414414
415415
416416         if( bi->mode == BITBANGER_MODEM )
r10326r10327
423423      else
424424      {
425425         bi->idle_delay = bi->current_baud;
426         timer_adjust_periodic(bi->bitbanger_input_timer, bi->idle_delay, 0, bi->idle_delay);
426         bi->bitbanger_input_timer->adjust(bi->idle_delay, 0, bi->idle_delay);
427427      }
428428   }
429429
r10326r10327
450450      bi->build_byte = 0;
451451
452452      one_point_five_baud = bi->current_baud + bi->current_baud / 2;
453      timer_adjust_periodic(bi->bitbanger_output_timer, one_point_five_baud, 0, bi->current_baud);
453      bi->bitbanger_output_timer->adjust(one_point_five_baud, 0, bi->current_baud);
454454   }
455455
456456   //fprintf(stderr,"%s, %d\n", device->machine->time().as_string(9), value);
r10326r10327
468468   bitbanger_token *bi;
469469   bi = get_token(device);
470470
471   timer_enable(bi->bitbanger_input_timer, TRUE);
472   timer_adjust_periodic(bi->bitbanger_input_timer, attotime::zero, 0, attotime::from_seconds(1));
471   bi->bitbanger_input_timer->enable(true);
472   bi->bitbanger_input_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
473473
474474   /* we don't need to do anything special */
475475   return IMAGE_INIT_PASS;
r10326r10327
486486   bitbanger_token *bi;
487487   bi = get_token(device);
488488
489   timer_enable(bi->bitbanger_input_timer, FALSE);
489   bi->bitbanger_input_timer->enable(false);
490490}
491491
492492
src/emu/imagedev/snapquik.c
r10326r10327
151151   token->load = (snapquick_load_func) reinterpret_cast<snapquick_load_func>(image.get_device_specific_call());
152152
153153   /* adjust the timer */
154   timer_adjust_oneshot(
155      token->timer,
154   
155      token->timer->adjust(
156156      attotime(config->delay_seconds, config->delay_attoseconds),
157157      0);
158158
src/emu/schedule.h
r10326r10327
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
61// these must be macros because we are included before the running_machine
62#define cpuexec_describe_context(mach)            (mach)->describe_context()
63#define cpuexec_boost_interleave(mach, slice, dur)   (mach)->scheduler().boost_interleave(slice, dur)
64#define cpuexec_trigger(mach, trigid)            (mach)->scheduler().trigger(trigid)
65#define cpuexec_triggertime(mach, trigid, dur)      (mach)->scheduler().trigger(trigid, dur)
66
6754// macro for the RC time constant on a 74LS123 with C > 1000pF
6855// R is in ohms, C is in farads
6956#define TIME_OF_74LS123(r,c)         (0.45 * (double)(r) * (double)(c))
r10326r10327
125112   void set_ptr(void *ptr) { m_ptr = ptr; }
126113
127114   // control
128   void reset(attotime duration) { adjust(duration, m_param, m_period); }
115   void reset(attotime duration = attotime::never) { adjust(duration, m_param, m_period); }
129116   void adjust(attotime duration, INT32 param = 0, attotime periodicity = attotime::never);
130117
131118   // timing queries
r10326r10327
244231};
245232
246233
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
266234#endif   // __SCHEDULE_H__ */
src/emu/image.c
r10326r10327
514514   machine_config *config = (machine_config *)owner->machine->config;
515515
516516   device_config *devconfig = type(*config, owner->subtag(tempstring,tag), &owner->baseconfig(), clock);
517   device_t *device = device_list->append(devconfig->tag(), devconfig->alloc_device(*owner->machine));
517   device_t &device = device_list->append(devconfig->tag(), *devconfig->alloc_device(*owner->machine));
518518
519   machine_config_constructor machconfig = device->machine_config_additions();
519   machine_config_constructor machconfig = device.machine_config_additions();
520520   if (machconfig != NULL)
521521    {
522522       (*machconfig)(*config, devconfig);
523523        for (const device_config *config_dev = config->m_devicelist.first(); config_dev != NULL; config_dev = config_dev->next())
524524        {
525525         if (config_dev->owner()==devconfig) {
526            device_list->append(config_dev->tag(), config_dev->alloc_device(*owner->machine));
526            device_list->append(config_dev->tag(), *config_dev->alloc_device(*owner->machine));
527527         }
528528        }
529529    }
530   config->m_devicelist.append(devconfig->tag(), devconfig);
530   config->m_devicelist.append(devconfig->tag(), *devconfig);
531531}
532532
src/emu/watchdog.c
r10326r10327
109109{
110110   /* if we're not enabled, skip it */
111111   if (!watchdog_enabled)
112      timer_adjust_oneshot(watchdog_timer, attotime::never, 0);
112      watchdog_timer->adjust(attotime::never);
113113
114114   /* VBLANK-based watchdog? */
115115   else if (machine->config->m_watchdog_vblank_count != 0)
r10326r10327
123123
124124   /* timer-based watchdog? */
125125   else if (machine->config->m_watchdog_time != attotime::zero)
126      timer_adjust_oneshot(watchdog_timer, machine->config->m_watchdog_time, 0);
126      watchdog_timer->adjust(machine->config->m_watchdog_time);
127127
128128   /* default to an obscene amount of time (3 seconds) */
129129   else
130      timer_adjust_oneshot(watchdog_timer, attotime::from_seconds(3), 0);
130      watchdog_timer->adjust(attotime::from_seconds(3));
131131}
132132
133133
src/emu/memory.c
r10326r10327
790790   {
791791      if (m_space.log_unmap() && !m_space.debugger_access())
792792         logerror("%s: unmapped %s memory read from %s & %s\n",
793                  cpuexec_describe_context(&m_space.m_machine), m_space.name(),
793                  m_space.m_machine.describe_context(), m_space.name(),
794794                  core_i64_hex_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars()),
795795                  core_i64_hex_format(mask, 2 * sizeof(_UintType)));
796796      return m_space.unmap();
r10326r10327
846846   {
847847      if (m_space.log_unmap() && !m_space.debugger_access())
848848         logerror("%s: unmapped %s memory write to %s = %s & %s\n",
849               cpuexec_describe_context(&m_space.m_machine), m_space.name(),
849               m_space.m_machine.describe_context(), m_space.name(),
850850               core_i64_hex_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars()),
851851               core_i64_hex_format(data, 2 * sizeof(_UintType)),
852852               core_i64_hex_format(mask, 2 * sizeof(_UintType)));
src/emu/machine/mc68901.c
r10326r10327
727727   case TCR_TIMER_PULSE_64:
728728   case TCR_TIMER_PULSE_100:
729729   case TCR_TIMER_PULSE_200:
730      timer_enable(m_timer[index], (value == aer));
730      m_timer[index]->enable((value == aer));
731731 
732732      if (((m_ti[index] ^ aer) == 0) && ((value ^ aer) == 1))
733733      {
r10326r10327
809809   if (m_config.rx_clock > 0)
810810   {
811811      m_rx_timer = timer_alloc(TIMER_RX);
812      timer_adjust_periodic(m_rx_timer, attotime::zero, 0, attotime::from_hz(m_config.rx_clock));
812      m_rx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.rx_clock));
813813   }
814814 
815815   if (m_config.tx_clock > 0)
816816   {
817817      m_tx_timer = timer_alloc(TIMER_TX);
818      timer_adjust_periodic(m_tx_timer, attotime::zero, 0, attotime::from_hz(m_config.tx_clock));
818      m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.tx_clock));
819819   }
820820 
821821   /* register for state saving */
r10326r10327
10661066      {
10671067      case TCR_TIMER_STOPPED:
10681068         if (LOG) logerror("MC68901 '%s' Timer A Stopped\n", tag());
1069         timer_enable(m_timer[TIMER_A], 0);
1069         m_timer[TIMER_A]->enable(false);
10701070         break;
10711071 
10721072      case TCR_TIMER_DELAY_4:
r10326r10327
10791079         {
10801080         int divisor = PRESCALER[m_tacr & 0x07];
10811081         if (LOG) logerror("MC68901 '%s' Timer A Delay Mode : %u Prescale\n", tag(), divisor);
1082         timer_adjust_periodic(m_timer[TIMER_A], attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
1082         m_timer[TIMER_A]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
10831083         }
10841084         break;
10851085 
10861086      case TCR_TIMER_EVENT:
10871087         if (LOG) logerror("MC68901 '%s' Timer A Event Count Mode\n", tag());
1088         timer_enable(m_timer[TIMER_A], 0);
1088         m_timer[TIMER_A]->enable(false);
10891089         break;
10901090 
10911091      case TCR_TIMER_PULSE_4:
r10326r10327
10981098         {
10991099         int divisor = PRESCALER[m_tacr & 0x07];
11001100         if (LOG) logerror("MC68901 '%s' Timer A Pulse Width Mode : %u Prescale\n", tag(), divisor);
1101         timer_adjust_periodic(m_timer[TIMER_A], attotime::never, 0, attotime::from_hz(m_timer_clock / divisor));
1102         timer_enable(m_timer[TIMER_A], 0);
1101         m_timer[TIMER_A]->adjust(attotime::never, 0, attotime::from_hz(m_timer_clock / divisor));
1102         m_timer[TIMER_A]->enable(false);
11031103         }
11041104         break;
11051105      }
r10326r10327
11211121      {
11221122      case TCR_TIMER_STOPPED:
11231123         if (LOG) logerror("MC68901 '%s' Timer B Stopped\n", tag());
1124         timer_enable(m_timer[TIMER_B], 0);
1124         m_timer[TIMER_B]->enable(false);
11251125         break;
11261126 
11271127      case TCR_TIMER_DELAY_4:
r10326r10327
11341134         {
11351135         int divisor = PRESCALER[m_tbcr & 0x07];
11361136         if (LOG) logerror("MC68901 '%s' Timer B Delay Mode : %u Prescale\n", tag(), divisor);
1137         timer_adjust_periodic(m_timer[TIMER_B], attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
1137         m_timer[TIMER_B]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
11381138         }
11391139         break;
11401140 
11411141      case TCR_TIMER_EVENT:
11421142         if (LOG) logerror("MC68901 '%s' Timer B Event Count Mode\n", tag());
1143         timer_enable(m_timer[TIMER_B], 0);
1143         m_timer[TIMER_B]->enable(false);
11441144         break;
11451145 
11461146      case TCR_TIMER_PULSE_4:
r10326r10327
11531153         {
11541154         int divisor = PRESCALER[m_tbcr & 0x07];
11551155         if (LOG) logerror("MC68901 '%s' Timer B Pulse Width Mode : %u Prescale\n", tag(), DIVISOR);
1156         timer_adjust_periodic(m_timer[TIMER_B], attotime::never, 0, attotime::from_hz(m_timer_clock / divisor));
1157         timer_enable(m_timer[TIMER_B], 0);
1156         m_timer[TIMER_B]->adjust(attotime::never, 0, attotime::from_hz(m_timer_clock / divisor));
1157         m_timer[TIMER_B]->enable(false);
11581158         }
11591159         break;
11601160      }
r10326r10327
11761176      {
11771177      case TCR_TIMER_STOPPED:
11781178         if (LOG) logerror("MC68901 '%s' Timer D Stopped\n", tag());
1179         timer_enable(m_timer[TIMER_D], 0);
1179         m_timer[TIMER_D]->enable(false);
11801180         break;
11811181 
11821182      case TCR_TIMER_DELAY_4:
r10326r10327
11891189         {
11901190         int divisor = PRESCALER[m_tcdcr & 0x07];
11911191         if (LOG) logerror("MC68901 '%s' Timer D Delay Mode : %u Prescale\n", tag(), divisor);
1192         timer_adjust_periodic(m_timer[TIMER_D], attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
1192         m_timer[TIMER_D]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
11931193         }
11941194         break;
11951195      }
r10326r10327
11981198      {
11991199      case TCR_TIMER_STOPPED:
12001200         if (LOG) logerror("MC68901 '%s' Timer C Stopped\n", tag());
1201         timer_enable(m_timer[TIMER_C], 0);
1201         m_timer[TIMER_C]->enable(false);
12021202         break;
12031203 
12041204      case TCR_TIMER_DELAY_4:
r10326r10327
12111211         {
12121212         int divisor = PRESCALER[(m_tcdcr >> 4) & 0x07];
12131213         if (LOG) logerror("MC68901 '%s' Timer C Delay Mode : %u Prescale\n", tag(), divisor);
1214         timer_adjust_periodic(m_timer[TIMER_C], attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
1214         m_timer[TIMER_C]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
12151215         }
12161216         break;
12171217      }
r10326r10327
12221222 
12231223      m_tdr[TIMER_A] = data;
12241224 
1225      if (!timer_enabled(m_timer[TIMER_A]))
1225      if (!m_timer[TIMER_A]->enabled())
12261226      {
12271227         m_tmc[TIMER_A] = data;
12281228      }
r10326r10327
12331233 
12341234      m_tdr[TIMER_B] = data;
12351235 
1236      if (!timer_enabled(m_timer[TIMER_B]))
1236      if (!m_timer[TIMER_B]->enabled())
12371237      {
12381238         m_tmc[TIMER_B] = data;
12391239      }
r10326r10327
12441244 
12451245      m_tdr[TIMER_C] = data;
12461246 
1247      if (!timer_enabled(m_timer[TIMER_C]))
1247      if (!m_timer[TIMER_C]->enabled())
12481248      {
12491249         m_tmc[TIMER_C] = data;
12501250      }
r10326r10327
12551255 
12561256      m_tdr[TIMER_D] = data;
12571257 
1258      if (!timer_enabled(m_timer[TIMER_D]))
1258      if (!m_timer[TIMER_D]->enabled())
12591259      {
12601260         m_tmc[TIMER_D] = data;
12611261      }
src/emu/machine/timekpr.c
r10326r10327
229229
230230   timer = m_machine.scheduler().timer_alloc( FUNC(timekeeper_tick_callback), (void *)this );
231231   duration = attotime::from_seconds(1);
232   timer_adjust_periodic( timer, duration, 0, duration );
232   timer->adjust( duration, 0, duration );
233233}
234234
235235void m48t02_device::device_start()
src/emu/machine/x76f100.c
r10326r10327
2323      va_start( v, s_fmt );
2424      vsprintf( buf, s_fmt, v );
2525      va_end( v );
26      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
26      logerror( "%s: %s", machine->describe_context(), buf );
2727   }
2828}
2929
src/emu/machine/k033906.c
r10326r10327
9191      case 0x0f:      return m_reg[0x0f];         // interrupt_line, interrupt_pin, min_gnt, max_lat
9292
9393      default:
94         fatalerror("%s: k033906_reg_r: %08X", cpuexec_describe_context(&m_machine), reg);
94         fatalerror("%s: k033906_reg_r: %08X", m_machine.describe_context(), reg);
9595   }
9696   return 0;
9797}
r10326r10327
139139         break;
140140
141141      default:
142         fatalerror("%s:K033906_w: %08X, %08X", cpuexec_describe_context(&m_machine), data, reg);
142         fatalerror("%s:K033906_w: %08X, %08X", m_machine.describe_context(), data, reg);
143143   }
144144}
145145
src/emu/machine/6526cia.c
r10326r10327
856856
857857static int is_timer_active(emu_timer *timer)
858858{
859   attotime t = timer_firetime(timer);
859   attotime t = timer->expire();
860860   return (t != attotime::never);
861861}
862862
r10326r10327
873873   /* update the timer count, if necessary */
874874   if ((new_count == -1) && is_timer_active(m_timer))
875875   {
876      UINT16 current_count = (timer_timeelapsed(m_timer) * m_clock).as_double();
876      UINT16 current_count = (m_timer->elapsed() * m_clock).as_double();
877877      m_count = m_count - MIN(m_count, current_count);
878878   }
879879
r10326r10327
888888   {
889889      /* timer is on and is connected to clock */
890890      attotime period = attotime::from_hz(m_clock) * (m_count ? m_count : 0x10000);
891      timer_adjust_oneshot(m_timer, period, which);
891      m_timer->adjust(period, which);
892892   }
893893   else
894894   {
895895      /* timer is off or not connected to clock */
896      timer_adjust_oneshot(m_timer, attotime::never, which);
896      m_timer->adjust(attotime::never, which);
897897   }
898898}
899899
r10326r10327
908908
909909   if (is_timer_active(m_timer))
910910   {
911      UINT16 current_count = (timer_timeelapsed(m_timer) * m_clock).as_double();
911      UINT16 current_count = (m_timer->elapsed() * m_clock).as_double();
912912      count = m_count - MIN(m_count, current_count);
913913   }
914914   else
src/emu/machine/74123.c
r10326r10327
173173
174174int ttl74123_device::timer_running()
175175{
176   return (timer_timeleft(m_timer) > attotime::zero) &&
177         (timer_timeleft(m_timer) != attotime::never);
176   return (m_timer->remaining() > attotime::zero) &&
177         (m_timer->remaining() != attotime::never);
178178}
179179
180180
r10326r10327
239239      /* retriggering, but not if we are called to quickly */
240240      attotime delay_time = attotime(0, ATTOSECONDS_PER_SECOND * m_config.m_cap * 220);
241241
242      if(timer_timeelapsed(m_timer) >= delay_time)
242      if(m_timer->elapsed() >= delay_time)
243243      {
244         timer_adjust_oneshot(m_timer, duration, 0);
244         m_timer->adjust(duration);
245245
246246         if (LOG) logerror("74123 %s:  Retriggering pulse.  Duration: %f\n", tag(), duration.as_double());
247247      }
r10326r10327
253253   else
254254   {
255255      /* starting */
256      timer_adjust_oneshot(m_timer, duration, 0);
256      m_timer->adjust(duration);
257257
258258      set_output();
259259
r10326r10327
325325   }
326326   else if (!data)    /* clear the output  */
327327   {
328      timer_adjust_oneshot(m_timer, attotime::zero, 0);
328      m_timer->adjust(attotime::zero);
329329
330330      if (LOG) logerror("74123 #%s:  Cleared\n", tag() );
331331   }
src/emu/machine/idectrl.c
r10326r10327
12441244
12451245   /* logit */
12461246//  if (BANK(bank, offset) != IDE_BANK0_DATA && BANK(bank, offset) != IDE_BANK0_STATUS_COMMAND && BANK(bank, offset) != IDE_BANK1_STATUS_CONTROL)
1247      LOG(("%s:IDE read at %d:%X, size=%d\n", cpuexec_describe_context(device->machine), bank, offset, size));
1247      LOG(("%s:IDE read at %d:%X, size=%d\n", device->machine->describe_context(), bank, offset, size));
12481248
12491249   switch (BANK(bank, offset))
12501250   {
r10326r10327
12791279            /* if we're at the end of the buffer, handle it */
12801280            if (ide->buffer_offset >= IDE_DISK_SECTOR_SIZE)
12811281            {
1282               LOG(("%s:IDE completed PIO read\n", cpuexec_describe_context(device->machine)));
1282               LOG(("%s:IDE completed PIO read\n", device->machine->describe_context()));
12831283               continue_read(ide);
12841284            }
12851285         }
r10326r10327
13141314      /* return the current status but don't clear interrupts */
13151315      case IDE_BANK1_STATUS_CONTROL:
13161316         result = ide->status;
1317         if (timer_timeelapsed(ide->last_status_timer) > TIME_PER_ROTATION)
1317         if (ide->last_status_timer->elapsed() > TIME_PER_ROTATION)
13181318         {
13191319            result |= IDE_STATUS_HIT_INDEX;
1320            timer_adjust_oneshot(ide->last_status_timer, attotime::never, 0);
1320            ide->last_status_timer->adjust(attotime::never);
13211321         }
13221322
13231323         /* clear interrutps only when reading the real status */
r10326r10327
13301330
13311331      /* log anything else */
13321332      default:
1333         logerror("%s:unknown IDE read at %03X, size=%d\n", cpuexec_describe_context(device->machine), offset, size);
1333         logerror("%s:unknown IDE read at %03X, size=%d\n", device->machine->describe_context(), offset, size);
13341334         break;
13351335   }
13361336
r10326r10327
13521352
13531353   /* logit */
13541354   if (BANK(bank, offset) != IDE_BANK0_DATA)
1355      LOG(("%s:IDE write to %d:%X = %08X, size=%d\n", cpuexec_describe_context(device->machine), bank, offset, data, size));
1355      LOG(("%s:IDE write to %d:%X = %08X, size=%d\n", device->machine->describe_context(), bank, offset, data, size));
13561356   //  fprintf(stderr, "ide write %03x %02x size=%d\n", offset, data, size);
13571357   switch (BANK(bank, offset))
13581358   {
r10326r10327
13891389            /* if we're at the end of the buffer, handle it */
13901390            if (ide->buffer_offset >= IDE_DISK_SECTOR_SIZE)
13911391            {
1392               LOG(("%s:IDE completed PIO write\n", cpuexec_describe_context(device->machine)));
1392               LOG(("%s:IDE completed PIO write\n", device->machine->describe_context()));
13931393               if (ide->command == IDE_COMMAND_SECURITY_UNLOCK)
13941394               {
13951395                  if (ide->user_password_enable && memcmp(ide->buffer, ide->user_password, 2 + 32) == 0)
r10326r10327
15001500         {
15011501            ide->status |= IDE_STATUS_BUSY;
15021502            ide->status &= ~IDE_STATUS_DRIVE_READY;
1503            timer_adjust_oneshot(ide->reset_timer, attotime::from_msec(5), 0);
1503            ide->reset_timer->adjust(attotime::from_msec(5));
15041504         }
15051505         break;
15061506   }
r10326r10327
15181518{
15191519   ide_state *ide = get_safe_token(device);
15201520
1521   LOG(("%s:ide_bus_master_read(%d, %d)\n", cpuexec_describe_context(device->machine), offset, size));
1521   LOG(("%s:ide_bus_master_read(%d, %d)\n", device->machine->describe_context(), offset, size));
15221522
15231523   /* command register */
15241524   if (offset == 0)
r10326r10327
15471547{
15481548   ide_state *ide = get_safe_token(device);
15491549
1550   LOG(("%s:ide_bus_master_write(%d, %d, %08X)\n", cpuexec_describe_context(device->machine), offset, size, data));
1550   LOG(("%s:ide_bus_master_write(%d, %d, %08X)\n", device->machine->describe_context(), offset, size, data));
15511551
15521552   /* command register */
15531553   if (offset == 0)
src/emu/machine/68681.c
r10326r10327
335335            duart68681->ISR &= ~INT_TXRDYA;
336336         else
337337            duart68681->ISR &= ~INT_TXRDYB;
338         timer_adjust_oneshot(duart68681->channel[ch].tx_timer, attotime::never, ch);
338         duart68681->channel[ch].tx_timer->adjust(attotime::never, ch);
339339         break;
340340      case 4: /* Reset Error Status */
341341         duart68681->channel[ch].SR &= ~(STATUS_RECEIVED_BREAK | STATUS_FRAMING_ERROR | STATUS_PARITY_ERROR | STATUS_OVERRUN_ERROR);
r10326r10327
448448      duart68681->ISR |= INT_TXRDYB;
449449
450450   duart68681_update_interrupts(duart68681);
451   timer_adjust_oneshot(duart68681->channel[ch].tx_timer, attotime::never, ch);
451   duart68681->channel[ch].tx_timer->adjust(attotime::never, ch);
452452};
453453
454454static void duart68681_write_TX(duart68681_state* duart68681, int ch, UINT8 data)
r10326r10327
468468   duart68681_update_interrupts(duart68681);
469469
470470   period = attotime::from_hz(duart68681->channel[ch].baud_rate / 10 );
471   timer_adjust_oneshot(duart68681->channel[ch].tx_timer, period, ch);
471   duart68681->channel[ch].tx_timer->adjust(period, ch);
472472
473473};
474474
r10326r10327
559559            case 0x03: /* Counter, CLK/16 */
560560               {
561561                  attotime rate = attotime::from_hz(2*device->clock()/(2*16*16*duart68681->CTR.w.l));
562                  timer_adjust_periodic(duart68681->duart_timer, rate, 0, rate);
562                  duart68681->duart_timer->adjust(rate, 0, rate);
563563               }
564564               break;
565565            case 0x06: /* Timer, CLK/1 */
566566               {
567567                  attotime rate = attotime::from_hz(2*device->clock()/(2*16*duart68681->CTR.w.l));
568                  timer_adjust_periodic(duart68681->duart_timer, rate, 0, rate);
568                  duart68681->duart_timer->adjust(rate, 0, rate);
569569               }
570570               break;
571571            case 0x07: /* Timer, CLK/16 */
r10326r10327
574574                  //attotime rate = attotime::from_hz(duart68681->clock) * (16*duart68681->CTR.w.l);
575575                  attotime rate = attotime::from_hz(2*device->clock()/(2*16*16*duart68681->CTR.w.l));
576576                  //hz = ATTOSECONDS_TO_HZ(rate.attoseconds);
577                  timer_adjust_periodic(duart68681->duart_timer, rate, 0, rate);
577                  duart68681->duart_timer->adjust(rate, 0, rate);
578578               }
579579               break;
580580         }
r10326r10327
582582      case 0x0f: /* Stop counter command */
583583         duart68681->ISR &= ~INT_COUNTER_READY;
584584         if (((duart68681->ACR >>4)& 0x07) < 4) // if in counter mode...
585         timer_adjust_oneshot(duart68681->duart_timer, attotime::never, 0); // shut down timer
585         duart68681->duart_timer->adjust(attotime::never); // shut down timer
586586         duart68681_update_interrupts(duart68681);
587587         break;
588588      default:
r10326r10327
783783      duart68681->duart_config->output_port_write(duart68681->device, duart68681->OPR ^ 0xff);
784784
785785   // reset timers
786   timer_adjust_oneshot(duart68681->channel[0].tx_timer, attotime::never, 0);
787   timer_adjust_oneshot(duart68681->channel[1].tx_timer, attotime::never, 1);
786   duart68681->channel[0].tx_timer->adjust(attotime::never);
787   duart68681->channel[1].tx_timer->adjust(attotime::never, 1);
788788}
789789
790790/*-------------------------------------------------
src/emu/machine/6532riot.c
r10326r10327
121121   }
122122   else
123123   {
124      logerror("%s:6532RIOT chip #%d: no irq callback function\n", cpuexec_describe_context(&m_machine), m_index);
124      logerror("%s:6532RIOT chip #%d: no irq callback function\n", m_machine.describe_context(), m_index);
125125   }
126126}
127127
r10326r10327
171171   /* if counting, return the number of ticks remaining */
172172   else if (m_timerstate == TIMER_COUNTING)
173173   {
174      return timer_timeleft(m_timer).as_ticks(clock()) >> m_timershift;
174      return m_timer->remaining().as_ticks(clock()) >> m_timershift;
175175   }
176176
177177   /* if finishing, return the number of ticks without the shift */
178178   else
179179   {
180      return timer_timeleft(m_timer).as_ticks(clock());
180      return m_timer->remaining().as_ticks(clock());
181181   }
182182}
183183
r10326r10327
202202   if(m_timerstate == TIMER_COUNTING)
203203   {
204204      m_timerstate = TIMER_FINISHING;
205      timer_adjust_oneshot(m_timer, attotime::from_ticks(256, clock()), 0);
205      m_timer->adjust(attotime::from_ticks(256, clock()));
206206
207207      /* signal timer IRQ as well */
208208      m_irqstate |= TIMER_FLAG;
r10326r10327
212212   /* if we finished finishing, keep spinning */
213213   else if (m_timerstate == TIMER_FINISHING)
214214   {
215      timer_adjust_oneshot(m_timer, attotime::from_ticks(256, clock()), 0);
215      m_timer->adjust(attotime::from_ticks(256, clock()));
216216   }
217217}
218218
r10326r10327
260260      /* update the timer */
261261      m_timerstate = TIMER_COUNTING;
262262      target = curtime.as_ticks(clock()) + 1 + (data << m_timershift);
263      timer_adjust_oneshot(m_timer, attotime::from_ticks(target, clock()) - curtime, 0);
263      m_timer->adjust(attotime::from_ticks(target, clock()) - curtime);
264264   }
265265
266266   /* if A4 == 0 and A2 == 1, we are writing to the edge detect control */
r10326r10327
302302         }
303303         else
304304         {
305            logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", cpuexec_describe_context(&m_machine), tag(), 'A' + (offset & 1), data);
305            logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", m_machine.describe_context(), tag(), 'A' + (offset & 1), data);
306306         }
307307      }
308308
r10326r10327
390390         }
391391         else
392392         {
393            logerror("%s:6532RIOT chip %s: Port %c is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag(), 'A' + (offset & 1));
393            logerror("%s:6532RIOT chip %s: Port %c is being read but has no handler\n", m_machine.describe_context(), tag(), 'A' + (offset & 1));
394394         }
395395
396396         /* apply the DDR to the result */
r10326r10327
522522   assert(this != NULL);
523523
524524   /* set static values */
525   m_index = m_machine.m_devicelist.index(RIOT6532, tag());
525   m_index = m_machine.m_devicelist.indexof(RIOT6532, tag());
526526
527527   /* configure the ports */
528528   devcb_resolve_read8(&m_port[0].m_in_func, &m_config.m_in_a_func, this);
r10326r10327
580580   /* reset timer states */
581581   m_timershift = 0;
582582   m_timerstate = TIMER_IDLE;
583   timer_adjust_oneshot(m_timer, attotime::never, 0);
583   m_timer->adjust(attotime::never);
584584}
src/emu/machine/6522via.c
r10326r10327
165165
166166    if(m_t1_active)
167167    {
168        val = time_to_cycles(timer_timeleft(m_t1)) - IFR_DELAY;
168        val = time_to_cycles(m_t1->remaining()) - IFR_DELAY;
169169   }
170170    else
171171    {
r10326r10327
304304   m_ifr |= data;
305305   if (TRACE_VIA)
306306    {
307      logerror("%s:6522VIA chip %s: IFR = %02X\n", cpuexec_describe_context(&m_machine), tag(), m_ifr);
307      logerror("%s:6522VIA chip %s: IFR = %02X\n", m_machine.describe_context(), tag(), m_ifr);
308308    }
309309
310310   if (m_ier & m_ifr)
r10326r10327
325325
326326   if (TRACE_VIA)
327327    {
328      logerror("%s:6522VIA chip %s: IFR = %02X\n", cpuexec_describe_context(&m_machine), tag(), m_ifr);
328      logerror("%s:6522VIA chip %s: IFR = %02X\n", m_machine.describe_context(), tag(), m_ifr);
329329    }
330330
331331   if (m_ifr & m_ier)
r10326r10327
363363      if (m_shift_counter)
364364        {
365365         if (SO_O2_CONTROL(m_acr)) {
366            timer_adjust_oneshot(m_shift_timer, cycles_to_time(2), 0);
366            m_shift_timer->adjust(cycles_to_time(2));
367367         } else {
368            timer_adjust_oneshot(m_shift_timer, cycles_to_time((m_t2ll + 2)*2), 0);
368            m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
369369         }
370370        }
371371      else
r10326r10327
432432              {
433433                  m_out_b ^= 0x80;
434434              }
435              timer_adjust_oneshot(m_t1, cycles_to_time(TIMER1_VALUE + IFR_DELAY), 0);
435              m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY));
436436          }
437437         else
438438          {
r10326r10327
492492                }
493493            else
494494                {
495               logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag());
495               logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", m_machine.describe_context(), tag());
496496                }
497497         }
498498      }
r10326r10327
522522                }
523523            else
524524                {
525               logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag());
525               logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", m_machine.describe_context(), tag());
526526                }
527527         }
528528      }
r10326r10327
558558            }
559559         else
560560            {
561            logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag());
561            logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", m_machine.describe_context(), tag());
562562            }
563563      }
564564
r10326r10327
595595      clear_int(INT_T2);
596596      if (m_t2_active)
597597        {
598         val = time_to_cycles(timer_timeleft(m_t2)) & 0xff;
598         val = time_to_cycles(m_t2->remaining()) & 0xff;
599599        }
600600      else
601601      {
r10326r10327
613613    case VIA_T2CH:
614614      if (m_t2_active)
615615        {
616         val = time_to_cycles(timer_timeleft(m_t2)) >> 8;
616         val = time_to_cycles(m_t2->remaining()) >> 8;
617617        }
618618      else
619619      {
r10326r10327
634634      clear_int(INT_SR);
635635      if (SO_O2_CONTROL(m_acr))
636636      {
637         timer_adjust_oneshot(m_shift_timer, cycles_to_time(2), 0);
637         m_shift_timer->adjust(cycles_to_time(2));
638638      }
639639      if (SO_T2_CONTROL(m_acr))
640640      {
641         timer_adjust_oneshot(m_shift_timer, cycles_to_time((m_t2ll + 2)*2), 0);
641         m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
642642      }
643643      break;
644644
r10326r10327
802802            devcb_call_write8(&m_out_b_func, 0, write_data);
803803         }
804804      }
805      timer_adjust_oneshot(m_t1, cycles_to_time(TIMER1_VALUE + IFR_DELAY), 0);
805      m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY));
806806      m_t1_active = 1;
807807      break;
808808
r10326r10327
818818
819819      if (!T2_COUNT_PB6(m_acr))
820820      {
821         timer_adjust_oneshot(m_t2, cycles_to_time(TIMER2_VALUE + IFR_DELAY), 0);
821         m_t2->adjust(cycles_to_time(TIMER2_VALUE + IFR_DELAY));
822822         m_t2_active = 1;
823823      }
824824      else
825825      {
826         timer_adjust_oneshot(m_t2, cycles_to_time(TIMER2_VALUE), 0);
826         m_t2->adjust(cycles_to_time(TIMER2_VALUE));
827827         m_t2_active = 1;
828828         m_time2 = m_machine.time();
829829      }
r10326r10327
835835      clear_int(INT_SR);
836836      if (SO_O2_CONTROL(m_acr))
837837      {
838         timer_adjust_oneshot(m_shift_timer, cycles_to_time(2), 0);
838         m_shift_timer->adjust(cycles_to_time(2));
839839      }
840840      if (SO_T2_CONTROL(m_acr))
841841      {
842         timer_adjust_oneshot(m_shift_timer, cycles_to_time((m_t2ll + 2)*2), 0);
842         m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
843843      }
844844      break;
845845
r10326r10327
848848
849849      if (TRACE_VIA)
850850        {
851         logerror("%s:6522VIA chip %s: PCR = %02X\n", cpuexec_describe_context(&m_machine), tag(), data);
851         logerror("%s:6522VIA chip %s: PCR = %02X\n", m_machine.describe_context(), tag(), data);
852852        }
853853
854854      if (CA2_FIX_OUTPUT(data) && CA2_OUTPUT_LEVEL(data) ^ m_out_ca2)
r10326r10327
887887         }
888888         if (T1_CONTINUOUS(data))
889889         {
890            timer_adjust_oneshot(m_t1, cycles_to_time(counter1 + IFR_DELAY), 0);
890            m_t1->adjust(cycles_to_time(counter1 + IFR_DELAY));
891891            m_t1_active = 1;
892892         }
893893      }
r10326r10327
942942   if (state != m_in_ca1)
943943    {
944944      if (TRACE_VIA)
945         logerror("%s:6522VIA chip %s: CA1 = %02X\n", cpuexec_describe_context(&m_machine), tag(), state);
945         logerror("%s:6522VIA chip %s: CA1 = %02X\n", m_machine.describe_context(), tag(), state);
946946
947947      if ((CA1_LOW_TO_HIGH(m_pcr) && state) || (CA1_HIGH_TO_LOW(m_pcr) && !state))
948948      {
r10326r10327
954954                }
955955            else
956956                {
957                    logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag());
957                    logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", m_machine.describe_context(), tag());
958958                }
959959         }
960960
r10326r10327
10241024                }
10251025            else
10261026                {
1027                    logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", cpuexec_describe_context(&m_machine), tag());
1027                    logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", m_machine.describe_context(), tag());
10281028                }
10291029         }
10301030         if (SO_EXT_CONTROL(m_acr) || SI_EXT_CONTROL(m_acr))
src/emu/machine/scsidev.c
r10326r10327
2828         return 0;
2929
3030      default:
31         logerror( "%s: SCSIDEV unknown command %02x\n", cpuexec_describe_context(scsiInstance->machine), command[ 0 ] );
31         logerror( "%s: SCSIDEV unknown command %02x\n", scsiInstance->machine->describe_context(), command[ 0 ] );
3232         return 0;
3333   }
3434}
r10326r10327
4343   switch( command[ 0 ] )
4444   {
4545      default:
46         logerror( "%s: SCSIDEV unknown read %02x\n", cpuexec_describe_context(scsiInstance->machine), command[ 0 ] );
46         logerror( "%s: SCSIDEV unknown read %02x\n", scsiInstance->machine->describe_context(), command[ 0 ] );
4747         break;
4848   }
4949}
r10326r10327
5858   switch( command[ 0 ] )
5959   {
6060      default:
61         logerror( "%s: SCSIDEV unknown write %02x\n", cpuexec_describe_context(scsiInstance->machine), command[ 0 ] );
61         logerror( "%s: SCSIDEV unknown write %02x\n", scsiInstance->machine->describe_context(), command[ 0 ] );
6262         break;
6363   }
6464}
src/emu/machine/ds2401.c
r10326r10327
2020      va_start( v, s_fmt );
2121      vsprintf( buf, s_fmt, v );
2222      va_end( v );
23      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
23      logerror( "%s: %s", machine->describe_context(), buf );
2424   }
2525}
2626
r10326r10327
6363   verboselog( machine, 1, "ds2401_reset(%d)\n", which );
6464
6565   c->state = STATE_RESET;
66   timer_adjust_oneshot( c->timer, attotime::never, which );
66   c->timer->adjust( attotime::never, which );
6767}
6868
6969static TIMER_CALLBACK( ds2401_tick )
r10326r10327
7777      verboselog( machine, 2, "ds2401_tick(%d) state_reset1 %d\n", which, c->rx );
7878      c->tx = 0;
7979      c->state = STATE_RESET2;
80      timer_adjust_oneshot( c->timer, c->t_pdl, which );
80      c->timer->adjust( c->t_pdl, which );
8181      break;
8282   case STATE_RESET2:
8383      verboselog( machine, 2, "ds2401_tick(%d) state_reset2 %d\n", which, c->rx );
r10326r10327
171171         break;
172172      case STATE_COMMAND:
173173         verboselog( machine, 2, "ds2401_write(%d) state_command\n", which );
174         timer_adjust_oneshot( c->timer, c->t_samp, which );
174         c->timer->adjust( c->t_samp, which );
175175         break;
176176      case STATE_READROM:
177177         if( c->bit == 0 )
r10326r10327
188188            c->byte++;
189189         }
190190         verboselog( machine, 2, "ds2401_write(%d) state_readrom %d\n", which, c->tx );
191         timer_adjust_oneshot( c->timer, c->t_rdv, which );
191         c->timer->adjust( c->t_rdv, which );
192192         break;
193193      default:
194194         verboselog( machine, 0, "ds2401_write(%d) state not handled: %d\n", which, c->state );
195195         break;
196196      }
197      timer_adjust_oneshot( c->reset_timer, c->t_rstl, which );
197      c->reset_timer->adjust( c->t_rstl, which );
198198   }
199199   else if( data == 1 && c->rx == 0 )
200200   {
r10326r10327
202202      {
203203      case STATE_RESET:
204204         c->state = STATE_RESET1;
205         timer_adjust_oneshot( c->timer, c->t_pdh, which );
205         c->timer->adjust( c->t_pdh, which );
206206         break;
207207      }
208      timer_adjust_oneshot( c->reset_timer, attotime::never, which );
208      c->reset_timer->adjust( attotime::never, which );
209209   }
210210   c->rx = data;
211211}
src/emu/machine/6840ptm.c
r10326r10327
138138
139139   for (int i = 0; i < 3; i++)
140140   {
141      timer_enable(m_timer[i], FALSE);
141      m_timer[i]->enable(false);
142142   }
143143
144144   devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);
r10326r10327
299299         duration *= m_t3_divisor;
300300      }
301301
302      timer_adjust_oneshot(m_timer[counter], duration, 0);
302      m_timer[counter]->adjust(duration);
303303   }
304304}
305305
r10326r10327
390390      PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), counter, clock));
391391   }
392392   /* See how many are left */
393   int remaining = (timer_timeleft(m_timer[counter]) * clock).as_double();
393   int remaining = (m_timer[counter]->remaining() * clock).as_double();
394394
395395   /* Adjust the count for dual byte mode */
396396   if (m_control_reg[counter] & 0x04)
r10326r10327
468468      if (!m_external_clock[idx])
469469      {
470470         m_enabled[idx] = 0;
471         timer_enable(m_timer[idx],FALSE);
471         m_timer[idx]->enable(false);
472472      }
473473   }
474474   else
475475#endif
476476   {
477477      m_enabled[idx] = 1;
478      timer_adjust_oneshot(m_timer[idx], duration, 0);
479      timer_enable(m_timer[idx], TRUE);
478      m_timer[idx]->adjust(duration);
479      m_timer[idx]->enable(true);
480480   }
481481}
482482
r10326r10327
500500
501501      case PTM_6840_STATUS:
502502      {
503         PLOG(("%s: MC6840 #%s: Status read = %04X\n", cpuexec_describe_context(&m_machine), tag(), m_status_reg));
503         PLOG(("%s: MC6840 #%s: Status read = %04X\n", m_machine.describe_context(), tag(), m_status_reg));
504504         m_status_read_since_int |= m_status_reg & 0x07;
505505         val = m_status_reg;
506506         break;
r10326r10327
522522
523523         m_lsb_buffer = result & 0xff;
524524
525         PLOG(("%s: MC6840 #%s: Counter %d read = %04X\n", cpuexec_describe_context(&m_machine), tag(), idx, result >> 8));
525         PLOG(("%s: MC6840 #%s: Counter %d read = %04X\n", m_machine.describe_context(), tag(), idx, result >> 8));
526526         val = result >> 8;
527527         break;
528528      }
r10326r10327
582582               PLOG(("MC6840 #%s : Timer reset\n", tag()));
583583               for (int i = 0; i < 3; i++)
584584               {
585                  timer_enable(m_timer[i], FALSE);
585                  m_timer[i]->enable(false);
586586                  m_enabled[i] = 0;
587587               }
588588            }
r10326r10327
633633            reload_count(idx);
634634         }
635635
636         PLOG(("%s:MC6840 #%s: Counter %d latch = %04X\n", cpuexec_describe_context(&m_machine), tag(), idx, m_latch[idx]));
636         PLOG(("%s:MC6840 #%s: Counter %d latch = %04X\n", m_machine.describe_context(), tag(), idx, m_latch[idx]));
637637         break;
638638      }
639639   }
r10326r10327
813813      if (!m_external_clock[counter])
814814      {
815815         m_enabled[counter] = 0;
816         timer_enable(m_timer[counter], FALSE);
816         m_timer[counter]->enable(false);
817817      }
818818   }
819819   else
r10326r10327
841841      }
842842
843843      m_enabled[counter] = 1;
844      timer_adjust_oneshot(m_timer[counter], duration, 0);
845      timer_enable(m_timer[counter], TRUE);
844      m_timer[counter]->adjust(duration);
845      m_timer[counter]->enable(true);
846846   }
847847}
848848
src/emu/machine/s3c2400.c
r10326r10327
2323      va_start( v, s_fmt);
2424      vsprintf( buf, s_fmt, v);
2525      va_end( v);
26      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
26      logerror( "%s: %s", machine->describe_context( ), buf);
2727   }
2828}
2929
src/emu/machine/z80dma.c
r10326r10327
607607      m_is_read = true;
608608      m_cur_cycle = (PORTA_IS_SOURCE ? PORTA_CYCLE_LEN : PORTB_CYCLE_LEN);
609609      next = attotime::from_hz(clock());
610      timer_adjust_periodic(m_timer,
610      m_timer->adjust(
611611         attotime::zero,
612612         0,
613613         // 1 byte transferred in 4 clock cycles
r10326r10327
618618      if (m_is_read)
619619      {
620620         // no transfers active right now
621         timer_reset(m_timer, attotime::never);
621         m_timer->reset();
622622      }
623623   }
624624
src/emu/machine/pc16552d.c
r10326r10327
159159   ch->pending_interrupt |= IRQ_TX_HOLDING_REG_EMPTY;
160160   check_interrupts(machine, chip, channel);
161161
162   timer_adjust_oneshot(duart[chip].ch[channel].tx_fifo_timer, attotime::never, (chip * 2) + channel);
162   duart[chip].ch[channel].tx_fifo_timer->adjust(attotime::never, (chip * 2) + channel);
163163}
164164
165165static void duart_push_tx_fifo(int chip, int channel, UINT8 data)
r10326r10327
172172
173173   period = attotime::from_hz(duart[chip].frequency) * (ch->divisor * 16 * 16 * 8);
174174
175   timer_adjust_oneshot(duart[chip].ch[channel].tx_fifo_timer, period, (chip * 2) + channel);
175   duart[chip].ch[channel].tx_fifo_timer->adjust(period, (chip * 2) + channel);
176176}
177177
178178#ifdef UNUSED_FUNCTION
r10326r10327
401401
402402   // allocate transmit timers
403403   duart[chip].ch[0].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback));
404   timer_adjust_oneshot(duart[chip].ch[0].tx_fifo_timer, attotime::never, (chip * 2) + 0);
404   duart[chip].ch[0].tx_fifo_timer->adjust(attotime::never, (chip * 2) + 0);
405405
406406   duart[chip].ch[1].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback));
407   timer_adjust_oneshot(duart[chip].ch[1].tx_fifo_timer, attotime::never, (chip * 2) + 1);
407   duart[chip].ch[1].tx_fifo_timer->adjust(attotime::never, (chip * 2) + 1);
408408}
409409
410410void pc16552d_rx_data(running_machine *machine, int chip, int channel, UINT8 data)
src/emu/machine/ins8154.c
r10326r10327
133133   {
134134      if (VERBOSE)
135135      {
136         logerror("%s: INS8154 '%s' Read from invalid offset %02x!\n", cpuexec_describe_context(&m_machine), tag(), offset);
136         logerror("%s: INS8154 '%s' Read from invalid offset %02x!\n", m_machine.describe_context(), tag(), offset);
137137      }
138138      return 0xff;
139139   }
r10326r10327
207207   {
208208      if (VERBOSE)
209209      {
210         logerror("%s: INS8154 '%s' Write %02x to invalid offset %02x!\n", cpuexec_describe_context(&m_machine), tag(), data, offset);
210         logerror("%s: INS8154 '%s' Write %02x to invalid offset %02x!\n", m_machine.describe_context(), tag(), data, offset);
211211      }
212212      return;
213213   }
r10326r10327
225225   case 0x22:
226226      if (VERBOSE)
227227      {
228         logerror("%s: INS8154 '%s' ODRA set to %02x\n", cpuexec_describe_context(&m_machine), tag(), data);
228         logerror("%s: INS8154 '%s' ODRA set to %02x\n", m_machine.describe_context(), tag(), data);
229229      }
230230
231231      m_odra = data;
r10326r10327
234234   case 0x23:
235235      if (VERBOSE)
236236      {
237         logerror("%s: INS8154 '%s' ODRB set to %02x\n", cpuexec_describe_context(&m_machine), tag(), data);
237         logerror("%s: INS8154 '%s' ODRB set to %02x\n", m_machine.describe_context(), tag(), data);
238238      }
239239
240240      m_odrb = data;
r10326r10327
243243   case 0x24:
244244      if (VERBOSE)
245245      {
246         logerror("%s: INS8154 '%s' MDR set to %02x\n", cpuexec_describe_context(&m_machine), tag(), data);
246         logerror("%s: INS8154 '%s' MDR set to %02x\n", m_machine.describe_context(), tag(), data);
247247      }
248248
249249      m_mdr = data;
src/emu/machine/x76f041.c
r10326r10327
2525      va_start( v, s_fmt );
2626      vsprintf( buf, s_fmt, v );
2727      va_end( v );
28      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
28      logerror( "%s: %s", machine->describe_context(), buf );
2929   }
3030}
3131
src/emu/machine/smc91c9x.c
r10326r10327
376376   }
377377
378378   if (LOG_ETHERNET && offset != EREG_BANK)
379      logerror("%s:smc91c9x_r(%s) = %04X & %04X\n", cpuexec_describe_context(device->machine), ethernet_regname[offset], result, mem_mask);
379      logerror("%s:smc91c9x_r(%s) = %04X & %04X\n", device->machine->describe_context(), ethernet_regname[offset], result, mem_mask);
380380   return result;
381381}
382382
r10326r10327
401401   COMBINE_DATA(&smc->reg[offset]);
402402
403403   if (LOG_ETHERNET && offset != 7)
404      logerror("%s:smc91c9x_w(%s) = %04X & %04X\n", cpuexec_describe_context(device->machine), ethernet_regname[offset], data, mem_mask);
404      logerror("%s:smc91c9x_w(%s) = %04X & %04X\n", device->machine->describe_context(), ethernet_regname[offset], data, mem_mask);
405405
406406   /* handle it */
407407   switch (offset)
src/emu/machine/8257dma.c
r10326r10327
330330   if (pending_transfer)
331331   {
332332      next = attotime::from_hz(clock() / 4 );
333      timer_adjust_periodic(m_timer,
333      m_timer->adjust(
334334         attotime::zero,
335335         0,
336336         /* 1 byte transferred in 4 clock cycles */
r10326r10327
339339   else
340340   {
341341      /* no transfers active right now */
342      timer_reset(m_timer, attotime::never);
342      m_timer->reset();
343343   }
344344
345345   /* set the halt line */
r10326r10327
349349
350350void i8257_device::i8257_prepare_msb_flip()
351351{
352   timer_adjust_oneshot(m_msbflip_timer, attotime::zero, 0);
352   m_msbflip_timer->adjust(attotime::zero);
353353}
354354
355355
src/emu/machine/tmp68301.c
r10326r10327
2323static IRQ_CALLBACK(tmp68301_irq_callback)
2424{
2525   int vector = tmp68301_irq_vector[irqline];
26//  logerror("%s: irq callback returns %04X for level %x\n",cpuexec_describe_context(machine),vector,int_level);
26//  logerror("%s: irq callback returns %04X for level %x\n",machine->describe_context(),vector,int_level);
2727   return vector;
2828}
2929
r10326r10327
3535   UINT16 ICR   =   tmp68301_regs[0x8e/2+i];   // Interrupt Controller Register (ICR7..9)
3636   UINT16 IVNR   =   tmp68301_regs[0x9a/2];      // Interrupt Vector Number Register (IVNR)
3737
38//  logerror("s: callback timer %04X, j = %d\n",cpuexec_describe_context(machine),i,tcount);
38//  logerror("s: callback timer %04X, j = %d\n",machine->describe_context(),i,tcount);
3939
4040   if   (   (TCR & 0x0004) &&   // INT
4141         !(IMR & (0x100<<i))
r10326r10327
7070   int max = 0;
7171   attotime duration = attotime::zero;
7272
73   timer_adjust_oneshot(tmp68301_timer[i],attotime::never,i);
73   tmp68301_timer[i]->adjust(attotime::never,i);
7474
7575   // timers 1&2 only
7676   switch( (TCR & 0x0030)>>4 )                  // MR2..1
r10326r10327
9595      break;
9696   }
9797
98//  logerror("%s: TMP68301 Timer %d, duration %lf, max %04X\n",cpuexec_describe_context(machine),i,duration,max);
98//  logerror("%s: TMP68301 Timer %d, duration %lf, max %04X\n",machine->describe_context(),i,duration,max);
9999
100100   if (!(TCR & 0x0002))            // CS
101101   {
102102      if (duration != attotime::zero)
103         timer_adjust_oneshot(tmp68301_timer[i],duration,i);
103         tmp68301_timer[i]->adjust(duration,i);
104104      else
105         logerror("%s: TMP68301 error, timer %d duration is 0\n",cpuexec_describe_context(machine),i);
105         logerror("%s: TMP68301 error, timer %d duration is 0\n",machine->describe_context(),i);
106106   }
107107}
108108
src/emu/machine/adc083x.c
r10326r10327
2020      va_start( v, s_fmt );
2121      vsprintf( buf, s_fmt, v );
2222      va_end( v );
23      logerror( "%s: %s", cpuexec_describe_context( machine ), buf );
23      logerror( "%s: %s", machine ->describe_context( ), buf );
2424   }
2525}
2626
src/emu/machine/i2cmem.c
r10326r10327
4747      va_start( v, s_fmt );
4848      vsprintf( buf, s_fmt, v );
4949      va_end( v );
50      logerror( "%s: I2CMEM(%s) %s", cpuexec_describe_context( device->machine ), device->tag(), buf );
50      logerror( "%s: I2CMEM(%s) %s", device->machine ->describe_context( ), device->tag(), buf );
5151   }
5252}
5353
src/emu/machine/z80sti.c
r10326r10327
253253   if (m_config.m_rx_clock > 0)
254254   {
255255      m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(static_rx_tick), (void *)this);
256      timer_adjust_periodic(m_rx_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock));
256      m_rx_timer->adjust(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   {
262262      m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(static_tx_tick), (void *)this);
263      timer_adjust_periodic(m_tx_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock));
263      m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock));
264264   }
265265
266266   // register for state saving
r10326r10327
560560         LOG(("Z80STI '%s' Timer D Prescaler: %u\n", tag(), tdc));
561561
562562         if (tcc)
563            timer_adjust_periodic(m_timer[TIMER_C], attotime::from_hz(clock() / tcc), TIMER_C, attotime::from_hz(clock() / tcc));
563            m_timer[TIMER_C]->adjust(attotime::from_hz(clock() / tcc), TIMER_C, attotime::from_hz(clock() / tcc));
564564         else
565            timer_enable(m_timer[TIMER_C], 0);
565            m_timer[TIMER_C]->enable(false);
566566
567567         if (tdc)
568            timer_adjust_periodic(m_timer[TIMER_D], attotime::from_hz(clock() / tdc), TIMER_D, attotime::from_hz(clock() / tdc));
568            m_timer[TIMER_D]->adjust(attotime::from_hz(clock() / tdc), TIMER_D, attotime::from_hz(clock() / tdc));
569569         else
570            timer_enable(m_timer[TIMER_D], 0);
570            m_timer[TIMER_D]->enable(false);
571571
572572         if (BIT(data, 7))
573573         {
r10326r10327
666666      LOG(("Z80STI '%s' Timer B Prescaler: %u\n", tag(), tbc));
667667
668668      if (tac)
669         timer_adjust_periodic(m_timer[TIMER_A], attotime::from_hz(clock() / tac), TIMER_A, attotime::from_hz(clock() / tac));
669         m_timer[TIMER_A]->adjust(attotime::from_hz(clock() / tac), TIMER_A, attotime::from_hz(clock() / tac));
670670      else
671         timer_enable(m_timer[TIMER_A], 0);
671         m_timer[TIMER_A]->enable(false);
672672
673673      if (tbc)
674         timer_adjust_periodic(m_timer[TIMER_B], attotime::from_hz(clock() / tbc), TIMER_B, attotime::from_hz(clock() / tbc));
674         m_timer[TIMER_B]->adjust(attotime::from_hz(clock() / tbc), TIMER_B, attotime::from_hz(clock() / tbc));
675675      else
676         timer_enable(m_timer[TIMER_B], 0);
676         m_timer[TIMER_B]->enable(false);
677677      }
678678      break;
679679
src/emu/machine/ldvp931.c
r10326r10327
282282   }
283283
284284   /* also boost interleave for 4 scanlines to ensure proper communications */
285   cpuexec_boost_interleave(ld->device->machine, attotime::zero, ld->screen->scan_period() * 4);
285   ld->device->machine->scheduler().boost_interleave(attotime::zero, ld->screen->scan_period() * 4);
286286   return player->tocontroller;
287287}
288288
r10326r10327
616616      (*player->data_ready_cb)(ld->device, TRUE);
617617
618618   /* also boost interleave for 4 scanlines to ensure proper communications */
619   cpuexec_boost_interleave(ld->device->machine, attotime::zero, ld->screen->scan_period() * 4);
619   ld->device->machine->scheduler().boost_interleave(attotime::zero, ld->screen->scan_period() * 4);
620620}
621621
622622
src/emu/machine/f3853.c
r10326r10327
160160   m_priority_line = FALSE;
161161   m_external_interrupt_line = TRUE;
162162
163   timer_enable(m_timer, 0);
163   m_timer->enable(false);
164164}
165165
166166
r10326r10327
190190{
191191   attotime period = (value != 0xff) ? attotime::from_hz(clock()) * (m_value_to_cycle[value]*31) : attotime::never;
192192
193   timer_adjust_oneshot(m_timer, period, 0);
193   m_timer->adjust(period);
194194}
195195
196196
src/emu/machine/msm6242.c
r10326r10327
103103      case MSM6242_REG_CF: return msm6242->reg[2];
104104   }
105105
106   logerror("%s: MSM6242 unmapped offset %02x read\n", cpuexec_describe_context(device->machine), offset);
106   logerror("%s: MSM6242 unmapped offset %02x read\n", device->machine->describe_context(), offset);
107107   return 0;
108108}
109109
r10326r10327
146146      }
147147   }
148148
149   logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", cpuexec_describe_context(device->machine), offset, data);
149   logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", device->machine->describe_context(), offset, data);
150150}
151151
152152
src/emu/machine/6850acia.c
r10326r10327
122122   m_status_read = 0;
123123   m_brk = 0;
124124
125   timer_reset(m_rx_timer, attotime::never);
126   timer_reset(m_tx_timer, attotime::never);
125   m_rx_timer->reset();
126   m_tx_timer->reset();
127127
128128   state_save_register_device_item(this, 0, m_ctrl);
129129   state_save_register_device_item(this, 0, m_status);
r10326r10327
292292         if (m_rx_clock)
293293         {
294294            attotime rx_period = attotime::from_hz(m_rx_clock) *  m_divide;
295            timer_adjust_periodic(m_rx_timer, rx_period, 0, rx_period);
295            m_rx_timer->adjust(rx_period, 0, rx_period);
296296         }
297297
298298         if (m_tx_clock)
299299         {
300300            attotime tx_period = attotime::from_hz(m_tx_clock) * m_divide;
301            timer_adjust_periodic(m_tx_timer, tx_period, 0, tx_period);
301            m_tx_timer->adjust(tx_period, 0, tx_period);
302302         }
303303      }
304304   }
r10326r10327
349349   }
350350   else
351351   {
352      logerror("%s:ACIA %p: Data write while in reset!\n", cpuexec_describe_context(&m_machine), this);
352      logerror("%s:ACIA %p: Data write while in reset!\n", m_machine.describe_context(), this);
353353   }
354354}
355355
r10326r10327
746746   if (m_rx_clock)
747747   {
748748      attotime rx_period = attotime::from_hz(m_rx_clock) * m_divide;
749      timer_adjust_periodic(m_rx_timer, rx_period, 0, rx_period);
749      m_rx_timer->adjust(rx_period, 0, rx_period);
750750   }
751751}
752752
r10326r10327
773773   if (m_tx_clock)
774774   {
775775      attotime tx_period = attotime::from_hz(m_tx_clock) * m_divide;
776      timer_adjust_periodic(m_tx_timer, tx_period, 0, tx_period);
776      m_tx_timer->adjust(tx_period, 0, tx_period);
777777   }
778778}
779779
src/emu/machine/mb3773.c
r10326r10327
151151
152152void mb3773_device::reset_timer()
153153{
154   timer_adjust_oneshot( m_watchdog_timer, attotime::from_seconds( 5 ), 0 );
154   m_watchdog_timer->adjust( attotime::from_seconds( 5 ) );
155155}
156156
157157TIMER_CALLBACK( mb3773_device::watchdog_timeout )
src/emu/machine/z80dart.c
r10326r10327
294294   {
295295      // allocate channel A receive timer
296296      m_rxca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_A]);
297      timer_adjust_periodic(m_rxca_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_a));
297      m_rxca_timer->adjust(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
303303      m_txca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_A]);
304      timer_adjust_periodic(m_txca_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_a));
304      m_txca_timer->adjust(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
310310      m_rxcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_B]);
311      timer_adjust_periodic(m_rxcb_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_b));
311      m_rxcb_timer->adjust(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
317317      m_txcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_B]);
318      timer_adjust_periodic(m_txcb_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_b));
318      m_txcb_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_b));
319319   }
320320
321321   state_save_register_device_item_array(this, 0, m_int_state);
src/emu/machine/wd33c93.c
r10326r10327
238238static void wd33c93_complete_immediate( running_machine *machine, int status )
239239{
240240   /* reset our timer */
241   timer_reset( scsi_data.cmd_timer, attotime::never );
241   scsi_data.cmd_timer->reset( );
242242
243243   /* set the new status */
244244   scsi_data.regs[WD_SCSI_STATUS] = status & 0xff;
r10326r10327
287287static void wd33c93_complete_cmd( UINT8 status )
288288{
289289   /* fire off a timer to complete the command */
290   timer_adjust_oneshot( scsi_data.cmd_timer, attotime::from_usec(1), status );
290   scsi_data.cmd_timer->adjust( attotime::from_usec(1), status );
291291}
292292
293293/* command handlers */
294294static CMD_HANDLER( wd33c93_invalid_cmd )
295295{
296   logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", cpuexec_describe_context(machine), scsi_data.regs[WD_COMMAND] );
296   logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", machine->describe_context(), scsi_data.regs[WD_COMMAND] );
297297
298298   /* complete the command */
299299   wd33c93_complete_cmd( CSR_INVALID );
src/emu/machine/s3c2410.c
r10326r10327
2323      va_start( v, s_fmt);
2424      vsprintf( buf, s_fmt, v);
2525      va_end( v);
26      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
26      logerror( "%s: %s", machine->describe_context( ), buf);
2727   }
2828}
2929
src/emu/machine/pic8259.c
r10326r10327
114114
115115INLINE void pic8259_set_timer(pic8259_t *pic8259)
116116{
117   timer_adjust_oneshot(pic8259->timer, attotime::zero, 0);
117   pic8259->timer->adjust(attotime::zero);
118118}
119119
120120
src/emu/machine/intelfsh.c
r10326r10327
600600
601601         if (m_config.m_sector_is_4k)
602602         {
603            timer_adjust_oneshot( m_timer, attotime::from_seconds( 1 ), 0 );
603            m_timer->adjust( attotime::from_seconds( 1 ) );
604604         }
605605         else
606606         {
607            timer_adjust_oneshot( m_timer, attotime::from_seconds( 16 ), 0 );
607            m_timer->adjust( attotime::from_seconds( 16 ) );
608608         }
609609      }
610610      else if( ( data & 0xff ) == 0x30 )
r10326r10327
617617            for (offs_t offs = 0; offs < 4 * 1024; offs++)
618618               m_addrspace[0]->write_byte((base & ~0xfff) + offs, 0xff);
619619            m_erase_sector = address & ((m_config.m_bits == 16) ? ~0x7ff : ~0xfff);
620            timer_adjust_oneshot( m_timer, attotime::from_msec( 125 ), 0 );
620            m_timer->adjust( attotime::from_msec( 125 ) );
621621         }
622622         else
623623         {
624624            for (offs_t offs = 0; offs < 64 * 1024; offs++)
625625               m_addrspace[0]->write_byte((base & ~0xffff) + offs, 0xff);
626626            m_erase_sector = address & ((m_config.m_bits == 16) ? ~0x7fff : ~0xffff);
627            timer_adjust_oneshot( m_timer, attotime::from_seconds( 1 ), 0 );
627            m_timer->adjust( attotime::from_seconds( 1 ) );
628628         }
629629
630630         m_status = 1 << 3;
r10326r10327
680680         m_status = 0x00;
681681         m_flash_mode = FM_READSTATUS;
682682
683         timer_adjust_oneshot( m_timer, attotime::from_seconds( 1 ), 0 );
683         m_timer->adjust( attotime::from_seconds( 1 ) );
684684         break;
685685      }
686686      else
src/emu/machine/at28c16.c
r10326r10327
233233{
234234   if( m_last_write >= 0 )
235235   {
236//      logerror( "%s: AT28C16: write( %04x, %02x ) busy\n", cpuexec_describe_context(machine), offset, data );
236//      logerror( "%s: AT28C16: write( %04x, %02x ) busy\n", machine->describe_context(), offset, data );
237237   }
238238   else if( m_oe_12v )
239239   {
240//      logerror( "%s: AT28C16: write( %04x, %02x ) erase\n", cpuexec_describe_context(machine), offset, data );
240//      logerror( "%s: AT28C16: write( %04x, %02x ) erase\n", machine->describe_context(), offset, data );
241241      if( m_last_write < 0 )
242242      {
243243         for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
r10326r10327
246246         }
247247
248248         m_last_write = 0xff;
249         timer_adjust_oneshot( m_write_timer, attotime::from_usec( 200 ), 0 );
249         m_write_timer->adjust( attotime::from_usec( 200 ) );
250250      }
251251   }
252252   else
r10326r10327
256256         offset += AT28C16_ID_BYTES;
257257      }
258258
259//      logerror( "%s: AT28C16: write( %04x, %02x )\n", cpuexec_describe_context(machine), offset, data );
259//      logerror( "%s: AT28C16: write( %04x, %02x )\n", machine->describe_context(), offset, data );
260260      if( m_last_write < 0 && m_addrspace[ 0 ]->read_byte( offset ) != data )
261261      {
262262         m_addrspace[ 0 ]->write_byte( offset, data );
263263         m_last_write = data;
264         timer_adjust_oneshot( m_write_timer, attotime::from_usec( 200 ), 0 );
264         m_write_timer->adjust( attotime::from_usec( 200 ) );
265265      }
266266   }
267267}
r10326r10327
277277   if( m_last_write >= 0 )
278278   {
279279      UINT8 data = m_last_write ^ 0x80;
280//      logerror( "%s: AT28C16: read( %04x ) write status %02x\n", cpuexec_describe_context(machine), offset, data );
280//      logerror( "%s: AT28C16: read( %04x ) write status %02x\n", machine->describe_context(), offset, data );
281281      return data;
282282   }
283283   else
r10326r10327
288288      }
289289
290290      UINT8 data = m_addrspace[ 0 ]->read_byte( offset );
291//      logerror( "%s: AT28C16: read( %04x ) data %02x\n", cpuexec_describe_context(machine), offset, data );
291//      logerror( "%s: AT28C16: read( %04x ) data %02x\n", machine->describe_context(), offset, data );
292292      return data;
293293   }
294294}
r10326r10327
304304   state &= 1;
305305   if( m_a9_12v != state )
306306   {
307//      logerror( "%s: AT28C16: set_a9_12v( %d )\n", cpuexec_describe_context(machine), state );
307//      logerror( "%s: AT28C16: set_a9_12v( %d )\n", machine->describe_context(), state );
308308      m_a9_12v = state;
309309   }
310310}
r10326r10327
320320   state &= 1;
321321   if( m_oe_12v != state )
322322   {
323//      logerror( "%s: AT28C16: set_oe_12v( %d )\n", cpuexec_describe_context(machine), state );
323//      logerror( "%s: AT28C16: set_oe_12v( %d )\n", machine->describe_context(), state );
324324      m_oe_12v = state;
325325   }
326326}
src/emu/machine/s3c2440.c
r10326r10327
2323      va_start( v, s_fmt);
2424      vsprintf( buf, s_fmt, v);
2525      va_end( v);
26      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
26      logerror( "%s: %s", machine->describe_context( ), buf);
2727   }
2828}
2929
src/emu/machine/s3c24xx.c
r10326r10327
722722   {
723723      s3c24xx_lcd_render_tpal( device);
724724   }
725   timer_adjust_oneshot( s3c24xx->lcd.timer, screen->time_until_pos( s3c24xx->lcd.vpos, s3c24xx->lcd.hpos), 0);
725   s3c24xx->lcd.timer->adjust( screen->time_until_pos( s3c24xx->lcd.vpos, s3c24xx->lcd.hpos));
726726}
727727
728728static void s3c24xx_video_start( device_t *device, running_machine *machine)
r10326r10327
917917   verboselog( device->machine, 1, "LCD start\n");
918918   s3c24xx_lcd_configure( device);
919919   s3c24xx_lcd_dma_init( device);
920   timer_adjust_oneshot( s3c24xx->lcd.timer, screen->time_until_pos( s3c24xx->lcd.vpos_min, s3c24xx->lcd.hpos_min), 0);
920   s3c24xx->lcd.timer->adjust( screen->time_until_pos( s3c24xx->lcd.vpos_min, s3c24xx->lcd.hpos_min));
921921}
922922
923923static void s3c24xx_lcd_stop( device_t *device)
924924{
925925   s3c24xx_t *s3c24xx = get_token( device);
926926   verboselog( device->machine, 1, "LCD stop\n");
927   timer_adjust_oneshot( s3c24xx->lcd.timer, attotime::never, 0);
927   s3c24xx->lcd.timer->adjust( attotime::never);
928928}
929929
930930static void s3c24xx_lcd_recalc( device_t *device)
r10326r10327
12321232   s3c24xx_t *s3c24xx = get_token( device);
12331233   double timeleft, x1, x2;
12341234   UINT32 cnto;
1235   timeleft = timer_timeleft( s3c24xx->pwm.timer[ch]).as_double();
1235   timeleft = s3c24xx->pwm.timer[ch]->remaining( ).as_double();
12361236//  printf( "timeleft %f freq %d cntb %d cmpb %d\n", timeleft, s3c24xx->pwm.freq[ch], s3c24xx->pwm.cnt[ch], s3c24xx->pwm.cmp[ch]);
12371237   x1 = 1 / ((double)s3c24xx->pwm.freq[ch] / (s3c24xx->pwm.cnt[ch]- s3c24xx->pwm.cmp[ch] + 1));
12381238   x2 = x1 / timeleft;
r10326r10327
13571357   s3c24xx->pwm.freq[timer] = freq;
13581358   if (auto_reload)
13591359   {
1360      timer_adjust_periodic( s3c24xx->pwm.timer[timer], attotime::from_hz( hz), timer, attotime::from_hz( hz));
1360      s3c24xx->pwm.timer[timer]->adjust( attotime::from_hz( hz), timer, attotime::from_hz( hz));
13611361   }
13621362   else
13631363   {
1364      timer_adjust_oneshot( s3c24xx->pwm.timer[timer], attotime::from_hz( hz), timer);
1364      s3c24xx->pwm.timer[timer]->adjust( attotime::from_hz( hz), timer);
13651365   }
13661366}
13671367
r10326r10327
13691369{
13701370   s3c24xx_t *s3c24xx = get_token( device);
13711371   verboselog( device->machine, 1, "PWM %d stop\n", timer);
1372   timer_adjust_oneshot( s3c24xx->pwm.timer[timer], attotime::never, 0);
1372   s3c24xx->pwm.timer[timer]->adjust( attotime::never);
13731373}
13741374
13751375static void s3c24xx_pwm_recalc( device_t *device, int timer)
r10326r10327
20042004   s3c24xx_t *s3c24xx = get_token( device);
20052005   double timeleft, x1, x2;
20062006   UINT32 cnt;
2007   timeleft = timer_timeleft( s3c24xx->wdt.timer).as_double();
2007   timeleft = s3c24xx->wdt.timer->remaining( ).as_double();
20082008//  printf( "timeleft %f freq %d cnt %d\n", timeleft, s3c24xx->wdt.freq, s3c24xx->wdt.cnt);
20092009   x1 = 1 / ((double)s3c24xx->wdt.freq / s3c24xx->wdt.cnt);
20102010   x2 = x1 / timeleft;
r10326r10327
20552055   freq = (double)pclk / (prescaler + 1) / clock;
20562056   hz = freq / s3c24xx->wdt.regs.wtcnt;
20572057   verboselog( device->machine, 5, "WDT pclk %d prescaler %d clock %d freq %f hz %f\n", pclk, prescaler, clock, freq, hz);
2058   timer_adjust_periodic( s3c24xx->wdt.timer, attotime::from_hz( hz), 0, attotime::from_hz( hz));
2058   s3c24xx->wdt.timer->adjust( attotime::from_hz( hz), 0, attotime::from_hz( hz));
20592059#if defined(DEVICE_S3C2410)
20602060   s3c24xx->wdt.freq = freq;
20612061   s3c24xx->wdt.cnt = s3c24xx->wdt.regs.wtcnt;
r10326r10327
20672067   s3c24xx_t *s3c24xx = get_token( device);
20682068   verboselog( device->machine, 1, "WDT stop\n");
20692069   s3c24xx->wdt.regs.wtcnt = s3c24xx_wdt_calc_current_count( device);
2070   timer_adjust_oneshot( s3c24xx->wdt.timer, attotime::never, 0);
2070   s3c24xx->wdt.timer->adjust( attotime::never);
20712071}
20722072
20732073static void s3c24xx_wdt_recalc( device_t *device)
r10326r10327
22232223      case 2 : i2c_send_byte( device, s3c24xx->iic.regs.iicds | 0x01); break;
22242224      case 3 : i2c_send_byte( device, s3c24xx->iic.regs.iicds & 0xFE); break;
22252225   }
2226   timer_adjust_oneshot( s3c24xx->iic.timer, attotime::from_usec( 1), 0);
2226   s3c24xx->iic.timer->adjust( attotime::from_usec( 1));
22272227}
22282228
22292229static void iic_stop( device_t *device)
r10326r10327
22312231   s3c24xx_t *s3c24xx = get_token( device);
22322232   verboselog( device->machine, 1, "IIC stop\n");
22332233   i2c_send_stop( device);
2234   timer_adjust_oneshot( s3c24xx->iic.timer, attotime::never, 0);
2234   s3c24xx->iic.timer->adjust( attotime::never);
22352235}
22362236
22372237static void iic_resume( device_t *device)
r10326r10327
22452245      case 2 : s3c24xx->iic.regs.iicds = i2c_receive_byte( device, BIT( s3c24xx->iic.regs.iiccon, 7)); break;
22462246      case 3 : i2c_send_byte( device, s3c24xx->iic.regs.iicds & 0xFF); break;
22472247   }
2248   timer_adjust_oneshot( s3c24xx->iic.timer, attotime::from_usec( 1), 0);
2248   s3c24xx->iic.timer->adjust( attotime::from_usec( 1));
22492249}
22502250
22512251static READ32_DEVICE_HANDLER( s3c24xx_iic_r )
r10326r10327
23832383   pclk = s3c24xx_get_pclk( device);
23842384   freq = ((double)pclk / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two?
23852385   verboselog( device->machine, 5, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", pclk, prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq);
2386   timer_adjust_periodic( s3c24xx->iis.timer, attotime::from_hz( freq), 0, attotime::from_hz( freq));
2386   s3c24xx->iis.timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq));
23872387}
23882388
23892389static void s3c24xx_iis_stop( device_t *device)
23902390{
23912391   s3c24xx_t *s3c24xx = get_token( device);
23922392   verboselog( device->machine, 1, "IIS stop\n");
2393   timer_adjust_oneshot( s3c24xx->iis.timer, attotime::never, 0);
2393   s3c24xx->iis.timer->adjust( attotime::never);
23942394}
23952395
23962396static void s3c24xx_iis_recalc( device_t *device)
r10326r10327
25002500      ttc = BITS( s3c24xx->rtc.regs.ticnt, 6, 0);
25012501      freq = 128 / (ttc + 1);
25022502//      printf( "ttc %d freq %f\n", ttc, freq);
2503      timer_adjust_periodic( s3c24xx->rtc.timer_tick_count, attotime::from_hz( freq), 0, attotime::from_hz( freq));
2503      s3c24xx->rtc.timer_tick_count->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq));
25042504   }
25052505   else
25062506   {
2507      timer_adjust_oneshot( s3c24xx->rtc.timer_tick_count, attotime::never, 0);
2507      s3c24xx->rtc.timer_tick_count->adjust( attotime::never);
25082508   }
25092509}
25102510
r10326r10327
31763176   s3c24xx->rtc.timer_tick_count = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_tick_count_exp), (void*)device);
31773177   s3c24xx->rtc.timer_update = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_update_exp), (void*)device);
31783178   s3c24xx->wdt.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_wdt_timer_exp), (void*)device);
3179   timer_adjust_periodic( s3c24xx->rtc.timer_update, attotime::from_msec( 1000), 0, attotime::from_msec( 1000));
3179   s3c24xx->rtc.timer_update->adjust( attotime::from_msec( 1000), 0, attotime::from_msec( 1000));
31803180   s3c24xx_rtc_init( device);
31813181}
31823182
src/emu/machine/8237dma.c
r10326r10327
150150   m_chan[2].m_mode = 0;
151151   m_chan[3].m_mode = 0;
152152
153   timer_adjust_periodic(m_timer, attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
153   m_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
154154}
155155
156156
r10326r10327
310310         devcb_call_write_line(&m_out_hrq_func, m_hrq);
311311         m_state = DMA8237_S0;
312312
313         timer_enable( m_timer, 1 );
313         m_timer->enable( true );
314314      }
315315      else if (m_command == 3 && (m_drq & 1))
316316      {
r10326r10327
320320      }
321321      else
322322      {
323         timer_enable( m_timer, 0 );
323         m_timer->enable( false );
324324      }
325325      break;
326326   }
r10326r10327
588588   case 8:
589589      /* DMA command register */
590590      m_command = data;
591      timer_enable( m_timer, ( m_command & 0x04 ) ? 0 : 1 );
591      m_timer->enable( ( m_command & 0x04 ) ? 0 : 1 );
592592      break;
593593
594594   case 9:
r10326r10327
598598      if ( data & 0x04 )
599599      {
600600         m_drq |= 0x01 << channel;
601         timer_enable( m_timer, ( m_command & 0x04 ) ? 0 : 1 );
601         m_timer->enable( ( m_command & 0x04 ) ? 0 : 1 );
602602      }
603603      else
604604      {
r10326r10327
673673      m_drq &= ~( 0x01 << channel );
674674   }
675675
676   timer_enable( m_timer, ( m_command & 0x04 ) ? 0 : 1 );
676   m_timer->enable( ( m_command & 0x04 ) ? 0 : 1 );
677677
678678}
679679
src/emu/machine/cdp1852.c
r10326r10327
166166   {
167167      /* create the scan timer */
168168      cdp1852->scan_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1852_scan_tick), (void *)device);
169      timer_adjust_periodic(cdp1852->scan_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
169      cdp1852->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock()));
170170   }
171171
172172   /* register for state saving */
src/emu/machine/z80sio.c
r10326r10327
548548
549549   // start the receive timer running
550550   attotime tpc = compute_time_per_character();
551   timer_adjust_periodic(m_receive_timer, tpc, 0, tpc);
551   m_receive_timer->adjust(tpc, 0, tpc);
552552}
553553
554554
r10326r10327
561561   int regnum = m_regs[0] & 7;
562562
563563   if (regnum != 0 || (regnum & 0xf8) != 0)
564      VPRINTF(("%s:sio_reg_w(%c,%d) = %02X\n", cpuexec_describe_context(&m_device->m_machine), 'A' + m_index, regnum, data));
564      VPRINTF(("%s:sio_reg_w(%c,%d) = %02X\n", m_device->m_machine.describe_context(), 'A' + m_index, regnum, data));
565565
566566   // write a new value to the selected register
567567   UINT8 old = m_regs[regnum];
r10326r10327
579579         switch (data & SIO_WR0_COMMAND_MASK)
580580         {
581581            case SIO_WR0_COMMAND_CH_RESET:
582               VPRINTF(("%s:SIO reset channel %c\n", cpuexec_describe_context(&m_device->m_machine), 'A' + m_index));
582               VPRINTF(("%s:SIO reset channel %c\n", m_device->m_machine.describe_context(), 'A' + m_index));
583583               reset();
584584               break;
585585
r10326r10327
640640         break;
641641   }
642642
643   VPRINTF(("%s:sio_reg_r(%c,%d) = %02x\n", cpuexec_describe_context(&m_device->m_machine), 'A' + m_index, regnum, m_status[regnum]));
643   VPRINTF(("%s:sio_reg_r(%c,%d) = %02x\n", m_device->m_machine.describe_context(), 'A' + m_index, regnum, m_status[regnum]));
644644
645645   return m_status[regnum];
646646}
r10326r10327
652652
653653void z80sio_device::sio_channel::data_write(UINT8 data)
654654{
655   VPRINTF(("%s:sio_data_w(%c) = %02X\n", cpuexec_describe_context(&m_device->m_machine), 'A' + m_index, data));
655   VPRINTF(("%s:sio_data_w(%c) = %02X\n", m_device->m_machine.describe_context(), 'A' + m_index, data));
656656
657657   // if tx not enabled, just ignore it
658658   if (!(m_regs[5] & SIO_WR5_TX_ENABLE))
r10326r10327
681681   // reset the receive interrupt
682682   clear_interrupt(INT_RECEIVE);
683683
684   VPRINTF(("%s:sio_data_r(%c) = %02X\n", cpuexec_describe_context(&m_device->m_machine), 'A' + m_index, m_inbuf));
684   VPRINTF(("%s:sio_data_r(%c) = %02X\n", m_device->m_machine.describe_context(), 'A' + m_index, m_inbuf));
685685
686686   return m_inbuf;
687687}
src/emu/machine/microtch.c
r10326r10327
160160   microtouch.touch_callback = touch_cb;
161161
162162   microtouch.timer = machine->scheduler().timer_alloc(FUNC(microtouch_timer_callback));
163   timer_adjust_periodic(microtouch.timer, attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
163   microtouch.timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
164164
165165   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.reset_done);
166166   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.format_tablet);
src/emu/machine/z80ctc.c
r10326r10327
355355{
356356   m_mode = RESET_ACTIVE;
357357   m_tconst = 0x100;
358   timer_adjust_oneshot(m_timer, attotime::never, 0);
358   m_timer->adjust(attotime::never);
359359   m_int_state = 0;
360360}
361361
r10326r10327
401401      VPRINTF(("CTC clock %f\n",ATTOSECONDS_TO_HZ(period.attoseconds)));
402402
403403      if (m_timer != NULL)
404         return ((int)(timer_timeleft(m_timer).as_double() / period.as_double()) + 1) & 0xff;
404         return ((int)(m_timer->remaining().as_double() / period.as_double()) + 1) & 0xff;
405405      else
406406         return 0;
407407   }
r10326r10327
437437            if (!m_notimer)
438438            {
439439               attotime curperiod = period();
440               timer_adjust_periodic(m_timer, curperiod, m_index, curperiod);
440               m_timer->adjust(curperiod, m_index, curperiod);
441441            }
442442            else
443               timer_adjust_oneshot(m_timer, attotime::never, 0);
443               m_timer->adjust(attotime::never);
444444         }
445445
446446         // else set the bit indicating that we're waiting for the appropriate trigger
r10326r10327
475475      // if we're being reset, clear out any pending timers for this channel
476476      if ((data & RESET) == RESET_ACTIVE)
477477      {
478         timer_adjust_oneshot(m_timer, attotime::never, 0);
478         m_timer->adjust(attotime::never);
479479         // note that we don't clear the interrupt state here!
480480      }
481481   }
r10326r10327
507507            {
508508               attotime curperiod = period();
509509               VPRINTF(("CTC period %s\n", curperiod.as_string()));
510               timer_adjust_periodic(m_timer, curperiod, m_index, curperiod);
510               m_timer->adjust(curperiod, m_index, curperiod);
511511            }
512512            else
513513            {
514514               VPRINTF(("CTC disabled\n"));
515               timer_adjust_oneshot(m_timer, attotime::never, 0);
515               m_timer->adjust(attotime::never);
516516            }
517517         }
518518
src/emu/machine/pit8253.c
r10326r10327
608608   timer->cycles_to_output   = cycles_to_output;
609609   if (cycles_to_output ==   CYCLES_NEVER ||   timer->clockin == 0)
610610   {
611      timer_adjust_oneshot(timer->updatetimer, attotime::never, timer->index);
611      timer->updatetimer->adjust(attotime::never, timer->index);
612612   }
613613   else
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 - device->machine->time(), timer->index );
617      timer->updatetimer->adjust(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",
r10326r10327
645645      simulate2(device, timer, elapsed_cycles);
646646   else
647647      if ( timer->clockin )
648         timer_adjust_oneshot(timer->updatetimer, attotime::from_hz( timer->clockin ), timer->index );
648         timer->updatetimer->adjust(attotime::from_hz( timer->clockin ), timer->index );
649649}
650650
651651
r10326r10327
10821082      /* initialize timer */
10831083      timer->clockin = pit8253->config->timer[timerno].clockin;
10841084      timer->updatetimer = device->machine->scheduler().timer_alloc(FUNC(update_timer_cb), (void *)device);
1085      timer_adjust_oneshot(timer->updatetimer, attotime::never, timerno);
1085      timer->updatetimer->adjust(attotime::never, timerno);
10861086
10871087      /* resolve callbacks */
10881088      devcb_resolve_read_line(&timer->in_gate_func, &pit8253->config->timer[timerno].in_gate_func, device);
src/emu/machine/ds2404.c
r10326r10327
130130   m_rtc[4] = (current_time >> 24) & 0xff;
131131
132132   emu_timer *timer = m_machine.scheduler().timer_alloc(FUNC(ds2404_tick_callback), (void *)this);
133   timer_adjust_periodic(timer, attotime::from_hz(256), 0, attotime::from_hz(256));
133   timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
134134}
135135
136136
src/emu/machine/ldv1000.c
r10326r10327
263263   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 */
266   cpuexec_boost_interleave(ld->device->machine, attotime::zero, attotime::from_msec(1));
266   ld->device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_msec(1));
267267}
268268
269269
r10326r10327
525525   laserdisc_state *ld = ldcore_get_safe_token(device->owner());
526526   ld->player->counter_start = data;
527527   if (LOG_PORT_IO)
528      printf("%s:PORTA.0=%02X\n", cpuexec_describe_context(device->machine), data);
528      printf("%s:PORTA.0=%02X\n", device->machine->describe_context(), data);
529529}
530530
531531
r10326r10327
588588   player->portc0 = data;
589589   if (LOG_PORT_IO && ((data ^ prev) & 0x0f) != 0)
590590   {
591      printf("%s:PORTC.0=%02X", cpuexec_describe_context(device->machine), data);
591      printf("%s:PORTC.0=%02X", device->machine->describe_context(), data);
592592      if (data & 0x01) printf(" PRELOAD");
593593      if (!(data & 0x02)) printf(" /MULTIJUMP");
594594      if (data & 0x04) printf(" SCANMODE");
r10326r10327
684684   player->portb1 = data;
685685   if (LOG_PORT_IO && ((data ^ prev) & 0xff) != 0)
686686   {
687      printf("%s:PORTB.1=%02X:", cpuexec_describe_context(device->machine), data);
687      printf("%s:PORTB.1=%02X:", device->machine->describe_context(), data);
688688      if (!(data & 0x01)) printf(" FOCSON");
689689      if (!(data & 0x02)) printf(" SPDLRUN");
690690      if (!(data & 0x04)) printf(" JUMPTRIG");
r10326r10327
740740   player->portc1 = data;
741741   if (LOG_PORT_IO && ((data ^ prev) & 0xcf) != 0)
742742   {
743      printf("%s:PORTC.1=%02X", cpuexec_describe_context(device->machine), data);
743      printf("%s:PORTC.1=%02X", device->machine->describe_context(), data);
744744      if (data & 0x01) printf(" AUD1");
745745      if (data & 0x02) printf(" AUD2");
746746      if (data & 0x04) printf(" AUDEN");
src/emu/machine/mc146818.c
r10326r10327
187187   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
190      timer_adjust_periodic(timer, attotime::from_hz(2), 0, attotime::from_hz(2));
190      timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
191191   } else {
192      timer_adjust_periodic(timer, attotime::from_hz(1), 0, attotime::from_hz(1));
192      timer->adjust(attotime::from_hz(1), 0, attotime::from_hz(1));
193193   }
194194   set_base_datetime();
195195}
src/emu/machine/rtc65271.c
r10326r10327
410410               {
411411                  attotime period = attotime::from_hz(SQW_freq_table[data & reg_A_RS]);
412412                  attotime half_period = period / 2;
413                  attotime elapsed = timer_timeelapsed(state->update_timer);
413                  attotime elapsed = state->update_timer->elapsed();
414414
415415                  if (half_period > elapsed)
416                     timer_adjust_oneshot(state->SQW_timer, half_period - elapsed, 0);
416                     state->SQW_timer->adjust(half_period - elapsed);
417417                  else
418                     timer_adjust_oneshot(state->SQW_timer, half_period, 0);
418                     state->SQW_timer->adjust(half_period);
419419               }
420420               else
421421               {
422422                  state->SQW_internal_state = 0;   /* right??? */
423423
424424                  /* Stop the divider used for SQW and periodic interrupts. */
425                  timer_adjust_oneshot(state->SQW_timer, attotime::never, 0);
425                  state->SQW_timer->adjust(attotime::never);
426426               }
427427            }
428428            /* The UIP bit is read-only */
r10326r10327
506506   }
507507
508508   half_period = attotime::from_hz(SQW_freq_table[state->regs[reg_A] & reg_A_RS]) / 2;
509   timer_adjust_oneshot(state->SQW_timer, half_period, 0);
509   state->SQW_timer->adjust(half_period);
510510}
511511
512512/*
r10326r10327
689689   rtc65271_state *state = get_safe_token(device);
690690
691691   state->update_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)device);
692   timer_adjust_periodic(state->update_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
692   state->update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
693693   state->SQW_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)device);
694694   state->interrupt_callback = config->interrupt_callback;
695695
src/emu/diexec.c
r10326r10327
547547void device_execute_interface::interface_pre_start()
548548{
549549   // fill in the initial states
550   int index = device().machine->m_devicelist.index(&m_device);
550   int index = device().machine->m_devicelist.indexof(m_device);
551551   m_suspend = SUSPEND_REASON_RESET;
552552   m_profiler = profile_type(index + PROFILER_DEVICE_FIRST);
553553   m_inttrigger = index + TRIGGER_INT;
r10326r10327
639639   {
640640      attotime timedint_period = m_execute_config.m_timed_interrupt_period;
641641      assert(m_timedint_timer != NULL);
642      timer_adjust_periodic(m_timedint_timer, timedint_period, 0, timedint_period);
642      m_timedint_timer->adjust(timedint_period, 0, timedint_period);
643643   }
644644}
645645
r10326r10327
742742      if (m_execute_config.m_vblank_interrupts_per_frame > 1 && !suspended(SUSPEND_REASON_DISABLE))
743743      {
744744         m_partial_frame_period = device().machine->primary_screen->frame_period() / m_execute_config.m_vblank_interrupts_per_frame;
745         timer_adjust_oneshot(m_partial_frame_timer, m_partial_frame_period, 0);
745         m_partial_frame_timer->adjust(m_partial_frame_period);
746746      }
747747   }
748748}
r10326r10327
773773
774774   // set up to retrigger if there's more interrupts to generate
775775   if (m_iloops > 1)
776      timer_adjust_oneshot(m_partial_frame_timer, m_partial_frame_period, 0);
776      m_partial_frame_timer->adjust(m_partial_frame_period);
777777}
778778
779779
src/emu/emucore.h
r10326r10327
198198inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); }
199199
200200
201// this macro wraps a function 'x' and can be used to pass a function followed by its name
202#define FUNC(x) x, #x
203
204// this macro wraps a member function 'x' from class 'c'
205#define MFUNC(c,x) &c::x, #c "::" #x
206
207// this macro wraps a member function 'x' from class 'c' using a templatized stub of type 's'
208#define MSTUB(s,c,x) s##_stub<c, &c::x>, #c "::" #x
209
210
201211// standard assertion macros
202212#undef assert
203213#undef assert_always
r10326r10327
347357
348358
349359//**************************************************************************
350//  COMMON TEMPLATES
351//**************************************************************************
352
353// ======================> simple_list
354
355template<class T>
356class simple_list
357{
358   DISABLE_COPYING(simple_list);
359
360   T *m_head;
361   T *m_tail;
362   resource_pool &m_pool;
363   int m_count;
364
365public:
366   simple_list(resource_pool &pool = global_resource_pool) :
367      m_head(NULL),
368      m_tail(NULL),
369      m_pool(pool),
370      m_count(0) { }
371
372   virtual ~simple_list() { reset(); }
373
374   resource_pool &pool() const { return m_pool; }
375
376   T *first() const { return m_head; }
377   T *last() const { return m_tail; }
378   int count() const { return m_count; }
379
380   void reset() { while (m_head != NULL) remove(*m_head); }
381
382   T &prepend(T &object)
383   {
384      object.m_next = m_head;
385      m_head = &object;
386      if (m_tail == NULL)
387         m_tail = m_head;
388      m_count++;
389      return object;
390   }
391
392   void prepend_list(simple_list<T> &list)
393   {
394      int count = list.count();
395      if (count == 0)
396         return;
397      T *tail = list.last();
398      T *head = list.detach_all();
399      tail->m_next = m_head;
400      m_head = head;
401      if (m_tail == NULL)
402         m_tail = tail;
403      m_count += count;
404   }
405
406   T &append(T &object)
407   {
408      object.m_next = NULL;
409      if (m_tail != NULL)
410         m_tail = m_tail->m_next = &object;
411      else
412         m_tail = m_head = &object;
413      m_count++;
414      return object;
415   }
416
417   void append_list(simple_list<T> &list)
418   {
419      int count = list.count();
420      if (count == 0)
421         return;
422      T *tail = list.last();
423      T *head = list.detach_all();
424      if (m_tail != NULL)
425         m_tail->m_next = head;
426      else
427         m_head = head;
428      m_tail = tail;
429      m_count += count;
430   }
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   }
441
442   T *detach_head()
443   {
444      T *result = m_head;
445      if (result != NULL)
446      {
447         m_head = result->m_next;
448         m_count--;
449         if (m_head == NULL)
450            m_tail = NULL;
451      }
452      return result;
453   }
454
455   T &detach(T &object)
456   {
457      T *prev = NULL;
458      for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
459         if (cur == &object)
460         {
461            if (prev != NULL)
462               prev->m_next = object.m_next;
463            else
464               m_head = object.m_next;
465            if (m_tail == &object)
466               m_tail = prev;
467            m_count--;
468            return object;
469         }
470      return object;
471   }
472
473   T *detach_all()
474   {
475      T *result = m_head;
476      m_head = m_tail = NULL;
477      m_count = 0;
478      return result;
479   }
480
481   void remove(T &object)
482   {
483      detach(object);
484      pool_free(m_pool, &object);
485   }
486
487   T *find(int index) const
488   {
489      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
490         if (index-- == 0)
491            return cur;
492      return NULL;
493   }
494
495   int indexof(const T &object) const
496   {
497      int index = 0;
498      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
499      {
500         if (cur == &object)
501            return index;
502         index++;
503      }
504      return -1;
505   }
506};
507
508
509// ======================> fixed_allocator
510
511template<class T>
512class fixed_allocator
513{
514   DISABLE_COPYING(fixed_allocator);
515
516public:
517   fixed_allocator(resource_pool &pool = global_resource_pool)
518      : m_pool(pool),
519        m_freelist(pool) { }
520
521   T *alloc()
522   {
523      T *result = m_freelist.detach_head();
524      if (result == NULL)
525         result = m_pool.add_object(new T);
526      return result;
527   }
528
529   void reclaim(T *item) { if (item != NULL) m_freelist.append(*item); }
530   void reclaim(T &item) { m_freelist.append(item); }
531   void reclaim_all(simple_list<T> &list) { m_freelist.append_list(list); }
532
533private:
534   resource_pool &m_pool;
535   simple_list<T> m_freelist;
536};
537
538
539// ======================> tagged_list
540
541template<class T>
542class tagged_list
543{
544   DISABLE_COPYING(tagged_list);
545
546   T *m_head;
547   T **m_tailptr;
548   tagmap_t<T *> m_map;
549   resource_pool &m_pool;
550
551public:
552   tagged_list(resource_pool &pool = global_resource_pool) :
553      m_head(NULL),
554      m_tailptr(&m_head),
555      m_pool(pool) { }
556
557   virtual ~tagged_list()
558   {
559      reset();
560   }
561
562   void reset()
563   {
564      while (m_head != NULL)
565         remove(m_head);
566   }
567
568   T *first() const { return m_head; }
569
570   int count() const
571   {
572      int num = 0;
573      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
574         num++;
575      return num;
576   }
577
578   int index(T *object) const
579   {
580      int num = 0;
581      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
582         if (cur == object)
583            return num;
584         else
585            num++;
586      return -1;
587   }
588
589   int index(const char *tag) const
590   {
591      T *object = find(tag);
592      return (object != NULL) ? index(object) : -1;
593   }
594
595   T *replace(const char *tag, T *object)
596   {
597      T *existing = find(tag);
598      if (existing == NULL)
599         return append(tag, object);
600
601      for (T **objectptr = &m_head; *objectptr != NULL; objectptr = &(*objectptr)->m_next)
602         if (*objectptr == existing)
603         {
604            *objectptr = object;
605            object->m_next = existing->m_next;
606            if (m_tailptr == &existing->m_next)
607               m_tailptr = &object->m_next;
608            m_map.remove(existing);
609            pool_free(m_pool, existing);
610            if (m_map.add_unique_hash(tag, object, false) != TMERR_NONE)
611               throw emu_fatalerror("Error replacing object named '%s'", tag);
612            break;
613         }
614      return object;
615   }
616
617   T *append(const char *tag, T *object, bool replace_if_duplicate = false)
618   {
619      if (m_map.add_unique_hash(tag, object, false) != TMERR_NONE)
620         throw emu_fatalerror("Error adding object named '%s'", tag);
621      *m_tailptr = object;
622      object->m_next = NULL;
623      m_tailptr = &object->m_next;
624      return object;
625   }
626
627   void detach(T *object)
628   {
629      for (T **objectptr = &m_head; *objectptr != NULL; objectptr = &(*objectptr)->m_next)
630         if (*objectptr == object)
631         {
632            *objectptr = object->m_next;
633            if (m_tailptr == &object->m_next)
634               m_tailptr = objectptr;
635            m_map.remove(object);
636            return;
637         }
638   }
639
640   void remove(T *object)
641   {
642      detach(object);
643      pool_free(m_pool, object);
644   }
645
646   void remove(const char *tag)
647   {
648      T *object = find(tag);
649      if (object != NULL)
650         remove(object);
651   }
652
653   T *find(const char *tag) const
654   {
655      return m_map.find_hash_only(tag);
656   }
657
658   T *find(int index) const
659   {
660      for (T *cur = m_head; cur != NULL; cur = cur->m_next)
661         if (index-- == 0)
662            return cur;
663      return NULL;
664   }
665};
666
667
668
669//**************************************************************************
670360//  FUNCTION PROTOTYPES
671361//**************************************************************************
672362
src/emu/screen.c
r10326r10327
360360
361361   // start the timer to generate per-scanline updates
362362   if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
363      timer_adjust_oneshot(m_scanline_timer, time_until_pos(0), 0);
363      m_scanline_timer->adjust(time_until_pos(0));
364364
365365   // create burn-in bitmap
366366   if (options_get_int(machine->options(), OPTION_BURNIN) > 0)
r10326r10327
447447   // if we are on scanline 0 already, reset the update timer immediately
448448   // otherwise, defer until the next scanline 0
449449   if (vpos() == 0)
450      timer_adjust_oneshot(m_scanline0_timer, attotime::zero, 0);
450      m_scanline0_timer->adjust(attotime::zero);
451451   else
452      timer_adjust_oneshot(m_scanline0_timer, time_until_pos(0), 0);
452      m_scanline0_timer->adjust(time_until_pos(0));
453453
454454   // start the VBLANK timer
455   timer_adjust_oneshot(m_vblank_begin_timer, time_until_vblank_start(), 0);
455   m_vblank_begin_timer->adjust(time_until_vblank_start());
456456
457457   // adjust speed if necessary
458458   m_machine.video().update_refresh_speed();
r10326r10327
476476   if (beamy == 0 && beamx == 0)
477477      scanline0_callback();
478478   else
479      timer_adjust_oneshot(m_scanline0_timer, time_until_pos(0), 0);
479      m_scanline0_timer->adjust(time_until_pos(0));
480480
481481   // if we are resetting relative to (visarea.max_y + 1, 0) == VBLANK start,
482482   // call the VBLANK start timer now; otherwise, adjust it for the future
483483   if (beamy == m_visarea.max_y + 1 && beamx == 0)
484484      vblank_begin_callback();
485485   else
486      timer_adjust_oneshot(m_vblank_begin_timer, time_until_vblank_start(), 0);
486      m_vblank_begin_timer->adjust(time_until_vblank_start());
487487}
488488
489489
r10326r10327
799799      machine->video().frame_update();
800800
801801   // reset the VBLANK start timer for the next frame
802   timer_adjust_oneshot(m_vblank_begin_timer, time_until_vblank_start(), 0);
802   m_vblank_begin_timer->adjust(time_until_vblank_start());
803803
804804   // if no VBLANK period, call the VBLANK end callback immedietely, otherwise reset the timer
805805   if (m_vblank_period == 0)
806806      vblank_end_callback();
807807   else
808      timer_adjust_oneshot(m_vblank_end_timer, time_until_vblank_end(), 0);
808      m_vblank_end_timer->adjust(time_until_vblank_end());
809809}
810810
811811
r10326r10327
840840   m_last_partial_scan = 0;
841841   m_partial_updates_this_frame = 0;
842842
843   timer_adjust_oneshot(m_scanline0_timer, time_until_pos(0), 0);
843   m_scanline0_timer->adjust(time_until_pos(0));
844844}
845845
846846
r10326r10327
858858   scanline++;
859859   if (scanline > m_visarea.max_y)
860860      scanline = m_visarea.min_y;
861   timer_adjust_oneshot(m_scanline_timer, time_until_pos(scanline), scanline);
861   m_scanline_timer->adjust(time_until_pos(scanline), scanline);
862862}
863863
864864
src/emu/sound.c
r10326r10327
813813   set_attenuation(options_get_int(machine.options(), OPTION_VOLUME));
814814
815815   // start the periodic update flushing timer
816   timer_adjust_periodic(m_update_timer, STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
816   m_update_timer->adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
817817}
818818
819819
src/emu/timer.c
r10326r10327
314314               start_delay = m_config.m_start_delay;
315315
316316            // allocate and start the backing timer
317            timer_adjust_periodic(m_timer, start_delay, m_config.m_param, period);
317            m_timer->adjust(start_delay, m_config.m_param, period);
318318         }
319319         break;
320320      }
r10326r10327
325325
326326         // set the timer to to fire immediately
327327         m_first_time = true;
328         timer_adjust_oneshot(m_timer, attotime::zero, m_config.m_param);
328         m_timer->adjust(attotime::zero, m_config.m_param);
329329         break;
330330   }
331331}
r10326r10327
370370         m_first_time = false;
371371
372372         // adjust the timer
373         timer_adjust_oneshot(m_timer, m_screen->time_until_pos(next_vpos), 0);
373         m_timer->adjust(m_screen->time_until_pos(next_vpos));
374374         break;
375375      }
376376   }
src/emu/mconfig.c
r10326r10327
120120{
121121   astring tempstring;
122122   const char *fulltag = owner->subtag(tempstring, tag);
123   return m_devicelist.append(fulltag, (*type)(*this, fulltag, owner, clock));
123   return &m_devicelist.append(fulltag, *(*type)(*this, fulltag, owner, clock));
124124}
125125
126126
r10326r10327
133133{
134134   astring tempstring;
135135   const char *fulltag = owner->subtag(tempstring, tag);
136   return m_devicelist.replace(fulltag, (*type)(*this, fulltag, owner, clock));
136   return &m_devicelist.replace_and_remove(fulltag, *(*type)(*this, fulltag, owner, clock));
137137}
138138
139139
src/lib/util/palette.c
r10326r10327
682682
683683void palette_normalize_range(palette_t *palette, UINT32 start, UINT32 end, int lum_min, int lum_max)
684684{
685   UINT32 ymin = 1000 * 255, ymax = 0;
686   UINT32 tmin, tmax;
685   INT32 ymin = 1000 * 255, ymax = 0;
686   INT32 tmin, tmax;
687687   UINT32 index;
688688
689689   /* clamp within range */
r10326r10327
708708   {
709709      rgb_t rgb = palette->entry_color[index];
710710      INT32 y = 299 * RGB_RED(rgb) + 587 * RGB_GREEN(rgb) + 114 * RGB_BLUE(rgb);
711      INT32 u = ((INT32)RGB_BLUE(rgb)-y /1000)*565 / 1000;
712      INT32 v = ((INT32)RGB_RED(rgb)-y / 1000)*713 / 1000;
711      INT32 u = ((INT32)RGB_BLUE(rgb)-y /1000)*492 / 1000;
712      INT32 v = ((INT32)RGB_RED(rgb)-y / 1000)*877 / 1000;
713713      INT32 target = tmin + ((y - ymin) * (tmax - tmin + 1)) / (ymax - ymin);
714      UINT8 r = rgb_clamp(target + 1403 * v / 1000);
715      UINT8 g = rgb_clamp(target -  344 * u / 1000 - 714 * v / 1000);
716      UINT8 b = rgb_clamp(target + 1770 * u / 1000);
714      UINT8 r = rgb_clamp(target + 1140 * v / 1000);
715      UINT8 g = rgb_clamp(target -  395 * u / 1000 - 581 * v / 1000);
716      UINT8 b = rgb_clamp(target + 2032 * u / 1000);
717717      palette_entry_set_color(palette, index, MAKE_RGB(r, g, b));
718718   }
719719}
src/lib/util/tagmap.c
r10326r10327
9797         next = entry->next;
9898         free(entry);
9999      }
100      map->table[hashindex] = NULL;
100101   }
101102}
102103
src/mess/devices/microdrv.c
r10326r10327
102102
103103      devcb_call_write_line(&mdv->out_comms_out_func, mdv->comms_out);
104104     
105      timer_enable(mdv->bit_timer, mdv->comms_out);
105      mdv->bit_timer->enable(mdv->comms_out);
106106   }
107107
108108   mdv->clk = state;
r10326r10327
201201
202202   // allocate timers
203203   mdv->bit_timer = device->machine->scheduler().timer_alloc(FUNC(bit_timer_tick), (void *) device);
204   timer_adjust_periodic(mdv->bit_timer, attotime::zero, 0, attotime::from_hz(MDV_BITRATE));
205   timer_enable(mdv->bit_timer, 0);
204   mdv->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(MDV_BITRATE));
205   mdv->bit_timer->enable(0);
206206}
207207
208208static DEVICE_IMAGE_LOAD( microdrive )
src/mess/devices/xmodem.c
r10326r10327
162162       The 2 sec start time is here so that the machine does not get NAK instead of
163163       ACK or EOT as the last byte of a transfer.
164164     */
165   timer_adjust_periodic( state->timer, attotime::from_seconds( 2 ), 0, attotime::from_seconds( 2 ) );
165   state->timer->adjust( attotime::from_seconds( 2 ), 0, attotime::from_seconds( 2 ) );
166166}
167167
168168/* emulated machine has read the last byte we sent */
src/mess/devices/kermit.c
r10326r10327
188188   state->posout = 1;
189189
190190   state->retries = KERMIT_MAX_RETRIES;
191   timer_adjust_periodic( state->resend, KERMIT_RETRY_DELAY, 0, KERMIT_RETRY_DELAY );
191   state->resend->adjust( KERMIT_RETRY_DELAY, 0, KERMIT_RETRY_DELAY );
192192}
193193
194194static void kermit_reset( kermit* state );
r10326r10327
402402      state->image->fseek( SEEK_SET, 0 );
403403   }
404404
405   timer_adjust_periodic( state->resend, attotime::never, 0, attotime::never );
405   state->resend->adjust( attotime::never, 0, attotime::never );
406406}
407407
408408
src/mess/devices/cococart.c
r10326r10327
197197      line->value = value;
198198
199199      if (LOG_LINE)
200         logerror("[%s]: set_line(): %s <= %s\n", cpuexec_describe_context(device->machine), line_name, line_value_string(value));
200         logerror("[%s]: set_line(): %s <= %s\n", device->machine->describe_context(), line_name, line_value_string(value));
201201
202202      /* engage in a bit of gymnastics for this odious 'Q' value */
203203      switch(line->value)
r10326r10327
270270      ? device->machine->firstcpu->cycles_to_attotime(line->delay)
271271      : attotime::zero;
272272
273   timer_adjust_oneshot(line->timer[line->timer_index], delay, (int) value);
273   line->timer[line->timer_index]->adjust(delay, (int) value);
274274   line->timer_index = (line->timer_index + 1) % TIMER_POOL;
275275}
276276
src/mess/audio/t6721.c
r10326r10327
150150               t6721->playing = 0;
151151               break;
152152            case 1: /* start */
153               timer_adjust_periodic(t6721->timer, attotime::zero, 0, attotime::from_hz(8000));
153               t6721->timer->adjust(attotime::zero, 0, attotime::from_hz(8000));
154154               t6721->playing = 1;
155155               t6721->end_of_sample = 0;
156156               t6721->sample_timeindex = 0;
r10326r10327
158158            case 2:
159159               t6721->end_of_sample = 0;
160160               /*t6721->busy = 0; */
161               timer_reset(t6721->timer, attotime::never);
161               t6721->timer->reset();
162162               t6721->playing = 0;
163163               break;
164164            case 5: /* set rate (in next nibble) */
src/mess/audio/ted7360.c
r10326r10327
562562   {
563563   case 1:
564564      // proved by digisound of several intros like eoroidpro
565      timer_adjust_oneshot(ted7360->timer1, TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER1), 1);
565      ted7360->timer1->adjust(TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER1), 1);
566566      ted7360->timer1_active = 1;
567567      ted7360_set_interrupt(machine, 0x08, ted7360);
568568      break;
569569   case 2:
570      timer_adjust_oneshot(ted7360->timer2, TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), 0x10000), 2);
570      ted7360->timer2->adjust(TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), 0x10000), 2);
571571      ted7360->timer2_active = 1;
572572      ted7360_set_interrupt(machine, 0x10, ted7360);
573573      break;
574574   case 3:
575      timer_adjust_oneshot(ted7360->timer3, TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), 0x10000), 3);
575      ted7360->timer3->adjust(TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), 0x10000), 3);
576576      ted7360->timer3_active = 1;
577577      ted7360_set_interrupt(machine, 0x40, ted7360);
578578      break;
r10326r10327
858858
859859      if (ted7360->timer1_active)
860860      {
861         ted7360->reg[1] = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer1)) >> 8;
862         timer_reset(ted7360->timer1, attotime::never);
861         ted7360->reg[1] = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer1->remaining()) >> 8;
862         ted7360->timer1->reset();
863863         ted7360->timer1_active = 0;
864864      }
865865      break;
866866   case 1:                     /* start timer 1 */
867867      ted7360->reg[offset] = data;
868      timer_adjust_oneshot(ted7360->timer1, TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER1), 1);
868      ted7360->timer1->adjust(TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER1), 1);
869869      ted7360->timer1_active = 1;
870870      break;
871871   case 2:                     /* stop timer 2 */
872872      ted7360->reg[offset] = data;
873873      if (ted7360->timer2_active)
874874      {
875         ted7360->reg[3] = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer2)) >> 8;
876         timer_reset(ted7360->timer2, attotime::never);
875         ted7360->reg[3] = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer2->remaining()) >> 8;
876         ted7360->timer2->reset();
877877         ted7360->timer2_active = 0;
878878      }
879879      break;
880880   case 3:                     /* start timer 2 */
881881      ted7360->reg[offset] = data;
882      timer_adjust_oneshot(ted7360->timer2, TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER2), 2);
882      ted7360->timer2->adjust(TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER2), 2);
883883      ted7360->timer2_active = 1;
884884      break;
885885   case 4:                     /* stop timer 3 */
886886      ted7360->reg[offset] = data;
887887      if (ted7360->timer3_active)
888888      {
889         ted7360->reg[5] = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer3)) >> 8;
890         timer_reset(ted7360->timer3, attotime::never);
889         ted7360->reg[5] = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer3->remaining()) >> 8;
890         ted7360->timer3->reset();
891891         ted7360->timer3_active = 0;
892892      }
893893      break;
894894   case 5:                     /* start timer 3 */
895895      ted7360->reg[offset] = data;
896      timer_adjust_oneshot(ted7360->timer3, TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER3), 3);
896      ted7360->timer3->adjust(TEDTIME_IN_CYCLES((ted7360->type == TED7360_PAL), TIMER3), 3);
897897      ted7360->timer3_active = 1;
898898      break;
899899   case 6:
r10326r10327
10671067   {
10681068   case 0:
10691069      if (ted7360->timer1)
1070         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer1)) & 0xff;
1070         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer1->remaining()) & 0xff;
10711071      else
10721072         val = ted7360->reg[offset];
10731073      break;
10741074   case 1:
10751075      if (ted7360->timer1)
1076         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer1)) >> 8;
1076         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer1->remaining()) >> 8;
10771077      else
10781078         val = ted7360->reg[offset];
10791079      break;
10801080   case 2:
10811081      if (ted7360->timer2)
1082         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer2)) & 0xff;
1082         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer2->remaining()) & 0xff;
10831083      else
10841084         val = ted7360->reg[offset];
10851085      break;
10861086   case 3:
10871087      if (ted7360->timer2)
1088         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer2)) >> 8;
1088         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer2->remaining()) >> 8;
10891089      else
10901090         val = ted7360->reg[offset];
10911091      break;
10921092   case 4:
10931093      if (ted7360->timer3)
1094         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer3)) & 0xff;
1094         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer3->remaining()) & 0xff;
10951095      else
10961096         val = ted7360->reg[offset];
10971097      break;
10981098   case 5:
10991099      if (ted7360->timer3)
1100         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), timer_timeleft(ted7360->timer3)) >> 8;
1100         val = TEDTIME_TO_CYCLES((ted7360->type == TED7360_PAL), ted7360->timer3->remaining()) >> 8;
11011101      else
11021102         val = ted7360->reg[offset];
11031103      break;
src/mess/audio/upd1771.c
r10326r10327
204204                //logerror( "upd1771_w: ----------------noise state reset\n");
205205            }
206206            else
207                timer_adjust_oneshot( state->timer, attotime::from_ticks( 512, device->clock() ), 0 );
207                state->timer->adjust( attotime::from_ticks( 512, device->clock() ) );
208208      }break;
209209
210210        case 2:
r10326r10327
223223                state->index = 0;
224224            }
225225            else
226                timer_adjust_oneshot( state->timer, attotime::from_ticks( 512, device->clock() ), 0 );
226                state->timer->adjust( attotime::from_ticks( 512, device->clock() ) );
227227
228228      }break;
229229
r10326r10327
239239            state->packet[0]=0;
240240         }
241241         else
242            timer_adjust_oneshot( state->timer, attotime::from_ticks( 512, device->clock() ), 0 );
242            state->timer->adjust( attotime::from_ticks( 512, device->clock() ) );
243243
244244      }break;
245245
src/mess/audio/mea8000.c
r10326r10327
460460static void mea8000_start_frame( mea8000_t* mea8000 )
461461{
462462   /* enter or stay in active mode */
463   timer_reset( mea8000->timer, SAMPLING );
463   mea8000->timer->reset( SAMPLING );
464464   mea8000->framepos = 0;
465465}
466466
r10326r10327
469469static void mea8000_stop_frame( running_machine *machine, mea8000_t* mea8000 )
470470{
471471   /* enter stop mode */
472   timer_reset( mea8000->timer, attotime::never );
472   mea8000->timer->reset( );
473473   mea8000->state = MEA8000_STOPPED;
474474   dac_signed_data_16_w(machine->device(mea8000->iface->channel), 0x8000);
475475}
r10326r10327
535535   else
536536   {
537537      /* continue frame */
538      timer_reset( mea8000->timer, SAMPLING );
538      mea8000->timer->reset( SAMPLING );
539539   }
540540}
541541
r10326r10327
643643   mea8000_t* mea8000 = get_safe_token( device );
644644   int i;
645645   LOG (( "mea8000_reset\n" ));
646   timer_reset( mea8000->timer, attotime::never );
646   mea8000->timer->reset( );
647647   mea8000->phi = 0;
648648   mea8000->cont = 0;
649649   mea8000->roe = 0;
src/mess/machine/kr2376.c
r10326r10327
360360
361361   /* create the timers */
362362   kr2376->scan_timer = device->machine->scheduler().timer_alloc(FUNC(kr2376_scan_tick), (void *)device);
363   timer_adjust_periodic(kr2376->scan_timer, attotime::zero, 0, attotime::from_hz(kr2376->intf->clock));
363   kr2376->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(kr2376->intf->clock));
364364
365365   /* register for state saving */
366366   state_save_register_device_item(device, 0, kr2376->ring11);
src/mess/machine/pdp1.c
r10326r10327
376376         if (state->tape_reader.motor_on && state->tape_reader.rcl)
377377         {
378378            /* delay is approximately 1/400s */
379            timer_adjust_oneshot(state->tape_reader.timer, attotime::from_usec(2500), 0);
379            state->tape_reader.timer->adjust(attotime::from_usec(2500));
380380         }
381381         else
382382         {
383            timer_enable(state->tape_reader.timer, 0);
383            state->tape_reader.timer->enable(0);
384384         }
385385      }
386386      break;
r10326r10327
409409      state->tape_reader.motor_on = 0;
410410
411411      if (state->tape_reader.timer)
412         timer_enable(state->tape_reader.timer, 0);
412         state->tape_reader.timer->enable(0);
413413      break;
414414
415415   case 1:
r10326r10327
452452
453453   if (LOG_IOT_OVERLAP)
454454   {
455      if (timer_enable(state->tape_reader.timer, 0))
455      if (state->tape_reader.timer->enable(0))
456456         logerror("Error: overlapped perforated tape reads (Read-in mode, RPA/RPB instruction)\n");
457457   }
458458   /* set up delay if tape is advancing */
459459   if (state->tape_reader.motor_on && state->tape_reader.rcl)
460460   {
461461      /* delay is approximately 1/400s */
462      timer_adjust_oneshot(state->tape_reader.timer, attotime::from_usec(2500), 0);
462      state->tape_reader.timer->adjust(attotime::from_usec(2500));
463463   }
464464   else
465465   {
466      timer_enable(state->tape_reader.timer, 0);
466      state->tape_reader.timer->enable(0);
467467   }
468468}
469469
r10326r10327
513513
514514   if (state->tape_reader.motor_on && state->tape_reader.rcl)
515515      /* delay is approximately 1/400s */
516      timer_adjust_oneshot(state->tape_reader.timer, attotime::from_usec(2500), 0);
516      state->tape_reader.timer->adjust(attotime::from_usec(2500));
517517   else
518      timer_enable(state->tape_reader.timer, 0);
518      state->tape_reader.timer->enable(0);
519519}
520520
521521/*
r10326r10327
572572{
573573   pdp1_state *state = device->machine->driver_data<pdp1_state>();
574574   if (LOG_IOT_EXTRA)
575      logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
575      logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
576576
577577   begin_tape_read(state, 0, nac);
578578}
r10326r10327
610610{
611611   pdp1_state *state = device->machine->driver_data<pdp1_state>();
612612   if (LOG_IOT_EXTRA)
613      logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
613      logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
614614
615615   begin_tape_read(state, 1, nac);
616616}
r10326r10327
622622{
623623   pdp1_state *state = device->machine->driver_data<pdp1_state>();
624624   if (LOG_IOT_EXTRA)
625      logerror("RRB instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
625      logerror("RRB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
626626
627627   *io = state->tape_reader.rb;
628628   state->io_status &= ~io_st_ptr;
r10326r10327
646646{
647647   pdp1_state *state = device->machine->driver_data<pdp1_state>();
648648   if (LOG_IOT_EXTRA)
649      logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
649      logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
650650
651651   tape_write(state, *io & 0377);
652652   state->io_status &= ~io_st_ptp;
653653   /* delay is approximately 1/63.3 second */
654654   if (LOG_IOT_OVERLAP)
655655   {
656      if (timer_enable(state->tape_puncher.timer, 0))
657         logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
656      if (state->tape_puncher.timer->enable(0))
657         logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
658658   }
659659
660   timer_adjust_oneshot(state->tape_puncher.timer, attotime::from_usec(15800), nac);
660   state->tape_puncher.timer->adjust(attotime::from_usec(15800), nac);
661661}
662662
663663/*
r10326r10327
675675{
676676   pdp1_state *state = device->machine->driver_data<pdp1_state>();
677677   if (LOG_IOT_EXTRA)
678      logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
678      logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
679679
680680   tape_write(state, (*io >> 12) | 0200);
681681   state->io_status &= ~io_st_ptp;
682682   /* delay is approximately 1/63.3 second */
683683   if (LOG_IOT_OVERLAP)
684684   {
685      if (timer_enable(state->tape_puncher.timer, 0))
686         logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
685      if (state->tape_puncher.timer->enable(0))
686         logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
687687   }
688   timer_adjust_oneshot(state->tape_puncher.timer, attotime::from_usec(15800), nac);
688   state->tape_puncher.timer->adjust(attotime::from_usec(15800), nac);
689689}
690690
691691
r10326r10327
847847   int ch, delay;
848848
849849   if (LOG_IOT_EXTRA)
850      logerror("Warning, TYO instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
850      logerror("Warning, TYO instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
851851
852852   ch = (*io) & 077;
853853
r10326r10327
874874   }
875875   if (LOG_IOT_OVERLAP)
876876   {
877      if (timer_enable(state->typewriter.tyo_timer, 0))
878         logerror("Error: overlapped TYO instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
877      if (state->typewriter.tyo_timer->enable(0))
878         logerror("Error: overlapped TYO instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
879879   }
880880
881   timer_adjust_oneshot(state->typewriter.tyo_timer, attotime::from_msec(delay), nac);
881   state->typewriter.tyo_timer->adjust(attotime::from_msec(delay), nac);
882882}
883883
884884/*
r10326r10327
899899{
900900   pdp1_state *state = device->machine->driver_data<pdp1_state>();
901901   if (LOG_IOT_EXTRA)
902      logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
902      logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
903903
904904   *io = state->typewriter.tb;
905905   if (! (state->io_status & io_st_tyi))
r10326r10327
989989      {
990990         /* note that overlap detection is incomplete: it will only work if both DPY
991991            instructions require a completion pulse */
992         if (timer_enable(state->dpy_timer, 0))
993            logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
992         if (state->dpy_timer->enable(0))
993            logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
994994      }
995      timer_adjust_oneshot(state->dpy_timer, attotime::from_usec(50), 0);
995      state->dpy_timer->adjust(attotime::from_usec(50));
996996   }
997997}
998998
r10326r10327
10081008
10091009   state->parallel_drum.il = il;
10101010
1011   il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - timer_timeelapsed(state->parallel_drum.rotation_timer));
1011   il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - state->parallel_drum.rotation_timer->elapsed());
10121012   if (il_phase < attotime::zero)
10131013      il_phase = il_phase + PARALLEL_DRUM_ROTATION_TIME;
1014   timer_adjust_periodic(state->parallel_drum.il_timer, il_phase, 0, PARALLEL_DRUM_ROTATION_TIME);
1014   state->parallel_drum.il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME);
10151015}
10161016
10171017#ifdef UNUSED_FUNCTION
r10326r10327
10281028static void parallel_drum_init(pdp1_state *state)
10291029{
10301030   state->parallel_drum.rotation_timer = machine->scheduler().timer_alloc();
1031   timer_adjust_periodic(state->parallel_drum.rotation_timer, PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
1031   state->parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
10321032
10331033   state->parallel_drum.il_timer = machine->scheduler().timer_alloc(FUNC(il_timer_callback));
10341034   parallel_drum_set_il(0);
r10326r10327
11191119   /* clear status bit 5... */
11201120
11211121   /* do transfer */
1122   delay = timer_timeleft(state->parallel_drum.il_timer);
1122   delay = state->parallel_drum.il_timer->remaining();
11231123   dc = state->parallel_drum.il;
11241124   do
11251125   {
r10326r10327
11471147static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac)
11481148{
11491149   pdp1_state *state = device->machine->driver_data<pdp1_state>();
1150   (*io) = (timer_timeelapsed(state->parallel_drum.rotation_timer) *
1150   (*io) = (state->parallel_drum.rotation_timer->elapsed() *
11511151      (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds & 0007777;
11521152
11531153   /* set parity error and timing error... */
r10326r10327
12091209{
12101210   pdp1_state *state = device->machine->driver_data<pdp1_state>();
12111211   if (LOG_IOT_EXTRA)
1212      logerror("CKS instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
1212      logerror("CKS instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine->describe_context());
12131213
12141214   *io = state->io_status;
12151215}
r10326r10327
12251225   pdp1_state *state = device->machine->driver_data<pdp1_state>();
12261226   state->tape_reader.rcl = state->tape_reader.rc = 0;
12271227   if (state->tape_reader.timer)
1228      timer_enable(state->tape_reader.timer, 0);
1228      state->tape_reader.timer->enable(0);
12291229
12301230   if (state->tape_puncher.timer)
1231      timer_enable(state->tape_puncher.timer, 0);
1231      state->tape_puncher.timer->enable(0);
12321232
12331233   if (state->typewriter.tyo_timer)
1234      timer_enable(state->typewriter.tyo_timer, 0);
1234      state->typewriter.tyo_timer->enable(0);
12351235
12361236   if (state->dpy_timer)
1237      timer_enable(state->dpy_timer, 0);
1237      state->dpy_timer->enable(0);
12381238
12391239   state->io_status = io_st_tyo | io_st_ptp;
12401240}
src/mess/machine/applefdc.c
r10326r10327
235235      }
236236   }
237237
238   timer_reset(fdc->motor_timer, attotime::never);
238   fdc->motor_timer->reset();
239239}
240240
241241
r10326r10327
527527   {
528528      case 0x08:
529529         /* turn off motor */
530         timer_adjust_oneshot(fdc->motor_timer,
530         fdc->motor_timer->adjust(
531531            (fdc->mode & IWM_MODE_MOTOROFFDELAY) ? attotime::zero : attotime::from_seconds(1), 0);
532532         break;
533533
534534      case 0x09:
535535         /* turn on motor */
536         timer_adjust_oneshot(fdc->motor_timer, attotime::zero, 1);
536         fdc->motor_timer->adjust(attotime::zero, 1);
537537         break;
538538
539539      case 0x0A:
src/mess/machine/mockngbd.c
r10326r10327
130130
131131      default:
132132         if (LOG_MOCKINGBOARD)
133            logerror("mockingboard_r unmapped, offset: %02x, pc: %s\n", offset, cpuexec_describe_context(device->machine));
133            logerror("mockingboard_r unmapped, offset: %02x, pc: %s\n", offset, device->machine->describe_context());
134134         break;
135135   }
136136   return 0x00;
src/mess/machine/upd765.c
r10326r10327
349349   /* seek complete */
350350   upd765_seek_complete(device);
351351
352   timer_reset(fdc->seek_timer, attotime::never);
352   fdc->seek_timer->reset();
353353}
354354
355355static void upd765_timer_func(device_t *device, int timer_type)
r10326r10327
368368         if (fdc->upd765_command_bytes[0] & UPD765_MF)
369369         {
370370            /* MFM */
371            timer_reset(fdc->timer, attotime::from_usec(13));
371            fdc->timer->reset(attotime::from_usec(13));
372372         }
373373         else
374374         {
375375            /* FM */
376            timer_reset(fdc->timer, attotime::from_usec(27));
376            fdc->timer->reset(attotime::from_usec(27));
377377         }
378378      }
379379      else
r10326r10327
406406
407407      upd765_set_data_request(device);
408408
409      timer_reset(fdc->timer, attotime::never);
409      fdc->timer->reset();
410410   }
411411   else if (fdc->timer_type == 4)
412412   {
r10326r10327
425425         }
426426      }
427427
428      timer_reset(fdc->timer, attotime::never);
428      fdc->timer->reset();
429429   }
430430}
431431
r10326r10327
449449
450450   if (!(fdc->upd765_flags & UPD765_DMA_MODE))
451451   {
452      timer_adjust_oneshot(fdc->timer, duration, 0);
452      fdc->timer->adjust(duration);
453453   }
454454   else
455455   {
456456      upd765_timer_func(device,fdc->timer_type);
457      timer_reset(fdc->timer, attotime::never);
457      fdc->timer->reset();
458458   }
459459}
460460
r10326r10327
477477{
478478   upd765_t *fdc = get_safe_token(device);
479479   /* setup timer to signal after seek time is complete */
480   timer_adjust_oneshot(fdc->seek_timer, attotime::from_double(fdc->srt_in_ms*abs(signed_tracks)*0.001), 0);
480   fdc->seek_timer->adjust(attotime::from_double(fdc->srt_in_ms*abs(signed_tracks)*0.001));
481481}
482482
483483static void upd765_seek_setup(device_t *device, int is_recalibrate)
r10326r10327
760760         {
761761            if (fdc->timer_type==0)
762762            {
763               timer_reset(fdc->timer, attotime::never);
763               fdc->timer->reset();
764764
765765
766766            }
767767         }
768768
769769#ifdef NO_END_OF_CYLINDER
770         timer_adjust_oneshot(fdc->command_timer, attotime::zero, 0);
770         fdc->command_timer->adjust(attotime::zero);
771771#else
772772         upd765_update_state(device);
773773#endif
r10326r10327
779779{
780780   upd765_t *fdc = get_safe_token(device);
781781   if (LOG_EXTRA)
782      logerror("%s: upd765_status_r: %02x\n", cpuexec_describe_context(device->machine), fdc->FDC_main);
782      logerror("%s: upd765_status_r: %02x\n", device->machine->describe_context(), fdc->FDC_main);
783783   return fdc->FDC_main;
784784}
785785
r10326r10327
16711671
16721672      if ((fdc->upd765_transfer_bytes_remaining==0) || (fdc->upd765_flags & UPD765_TC))
16731673      {
1674         timer_adjust_oneshot(fdc->command_timer, attotime::zero, 0);
1674         fdc->command_timer->adjust(attotime::zero);
16751675      }
16761676      else
16771677      {
r10326r10327
16841684      fdc->FDC_main |= 0x10;                      /* set BUSY */
16851685
16861686      if (LOG_VERBOSE)
1687         logerror("%s: upd765(): command=0x%02x\n", cpuexec_describe_context(device->machine), fdc->upd765_data_reg);
1687         logerror("%s: upd765(): command=0x%02x\n", device->machine->describe_context(), fdc->upd765_data_reg);
16881688
16891689      /* seek in progress? */
16901690      if (fdc->upd765_flags & UPD765_SEEK_ACTIVE)
r10326r10327
17161716
17171717    case UPD765_COMMAND_PHASE_BYTES:
17181718      if (LOG_VERBOSE)
1719         logerror("%s: upd765(): command=0x%02x\n", cpuexec_describe_context(device->machine), fdc->upd765_data_reg);
1719         logerror("%s: upd765(): command=0x%02x\n", device->machine->describe_context(), fdc->upd765_data_reg);
17201720
17211721      fdc->upd765_command_bytes[fdc->upd765_transfer_bytes_count] = fdc->upd765_data_reg;
17221722      fdc->upd765_transfer_bytes_count++;
r10326r10327
17401740
17411741      if ((fdc->upd765_transfer_bytes_remaining == 0) || (fdc->upd765_flags & UPD765_TC))
17421742      {
1743         timer_adjust_oneshot(fdc->command_timer, attotime::zero, 0);
1743         fdc->command_timer->adjust(attotime::zero);
17441744      }
17451745      else
17461746      {
src/mess/machine/pokemini.c
r10326r10327
466466         int index = data & 0x07;
467467         int cycles = ( state->pm_reg[0x19] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
468468
469         timer_adjust_periodic(state->timers.timer1, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
469         state->timers.timer1->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
470470      }
471471
472472      /* Check for prescaler change for the high counter */
r10326r10327
475475         int index = ( data >> 4 ) & 0x07;
476476         int cycles = ( state->pm_reg[0x19] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
477477
478         timer_adjust_periodic(state->timers.timer1_hi, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
478         state->timers.timer1_hi->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
479479      }
480480
481481      /* Check if timer1 low should be enabled */
r10326r10327
483483           ( ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x19] & 0x01 ) ) ||
484484             ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x19] & 0x01 ) ) ) )
485485      {
486         timer_enable( state->timers.timer1, 1 );
486         state->timers.timer1->enable( 1 );
487487      }
488488      else
489489      {
490         timer_enable( state->timers.timer1, 0 );
490         state->timers.timer1->enable( 0 );
491491      }
492492
493493      /* Check if timer1 high should be enabled */
r10326r10327
495495           ( ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x19] & 0x02 ) ) ||
496496             ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x19] & 0x02 ) ) ) )
497497      {
498         timer_enable( state->timers.timer1_hi, 1 );
498         state->timers.timer1_hi->enable( 1 );
499499      }
500500      else
501501      {
502         timer_enable( state->timers.timer1_hi, 0 );
502         state->timers.timer1_hi->enable( 0 );
503503      }
504504      break;
505505   case 0x19:   /* Timers 1 speed
r10326r10327
516516         int index = state->pm_reg[0x18] & 0x07;
517517         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
518518
519         timer_adjust_periodic(state->timers.timer1, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
519         state->timers.timer1->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
520520      }
521521
522522      /* Check for prescaler change for the low counter */
r10326r10327
525525         int index = ( state->pm_reg[0x18] >> 4 ) & 0x07;
526526         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
527527
528         timer_adjust_periodic(state->timers.timer1_hi, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
528         state->timers.timer1_hi->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
529529      }
530530
531531      {
r10326r10327
567567            if ( ( state->pm_reg[0x1C] & 0x08 ) && ( state->pm_reg[0x1D] & 0x01 ) )
568568               timer3_enable = 1;
569569         }
570         timer_enable( state->timers.timer1, timer1_enable );
571         timer_enable( state->timers.timer1_hi, timer1_hi_enable );
572         timer_enable( state->timers.timer2, timer2_enable );
573         timer_enable( state->timers.timer2_hi, timer2_hi_enable );
574         timer_enable( state->timers.timer3, timer3_enable );
575         timer_enable( state->timers.timer3_hi, timer3_hi_enable );
570         state->timers.timer1->enable( timer1_enable );
571         state->timers.timer1_hi->enable( timer1_hi_enable );
572         state->timers.timer2->enable( timer2_enable );
573         state->timers.timer2_hi->enable( timer2_hi_enable );
574         state->timers.timer3->enable( timer3_enable );
575         state->timers.timer3_hi->enable( timer3_hi_enable );
576576      }
577577      break;
578578   case 0x1A:   /* Timer 2 pre-scale + enable
r10326r10327
595595         int index = data & 0x07;
596596         int cycles = ( state->pm_reg[0x1B] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
597597
598         timer_adjust_periodic(state->timers.timer2, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
598         state->timers.timer2->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
599599      }
600600
601601      /* Check for prescaler change for the high counter */
r10326r10327
604604         int index = ( data >> 4 ) & 0x07;
605605         int cycles = ( state->pm_reg[0x1B] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
606606
607         timer_adjust_periodic(state->timers.timer2_hi, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
607         state->timers.timer2_hi->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
608608      }
609609
610610      /* Check if timer2 low should be enabled */
r10326r10327
612612           ( ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1B] & 0x01 ) ) ||
613613             ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1B] & 0x01 ) ) ) )
614614      {
615         timer_enable( state->timers.timer2, 1 );
615         state->timers.timer2->enable( 1 );
616616      }
617617      else
618618      {
619         timer_enable( state->timers.timer2, 0 );
619         state->timers.timer2->enable( 0 );
620620      }
621621
622622      /* Check if timer2 high should be enabled */
r10326r10327
624624           ( ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1B] & 0x02 ) ) ||
625625             ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1B] & 0x02 ) ) ) )
626626      {
627         timer_enable( state->timers.timer2_hi, 1 );
627         state->timers.timer2_hi->enable( 1 );
628628      }
629629      else
630630      {
631         timer_enable( state->timers.timer2_hi, 0 );
631         state->timers.timer2_hi->enable( 0 );
632632      }
633633      break;
634634   case 0x1B:   /* Timer 2 speeds
r10326r10327
641641         int index = state->pm_reg[0x1A] & 0x07;
642642         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
643643
644         timer_adjust_periodic(state->timers.timer2, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
644         state->timers.timer2->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
645645
646646         if ( ( state->pm_reg[0x1A] & 0x08 ) && ( state->pm_reg[0x38] & 0x04 ) &&
647647              ( ( ( state->pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
648648                ( ( state->pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) )
649649         {
650            timer_enable( state->timers.timer2, 1 );
650            state->timers.timer2->enable( 1 );
651651         }
652652         else
653653         {
654            timer_enable( state->timers.timer2, 0 );
654            state->timers.timer2->enable( 0 );
655655         }
656656      }
657657
r10326r10327
661661         int index = ( state->pm_reg[0x1A] >> 4 ) & 0x07;
662662         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
663663
664         timer_adjust_periodic(state->timers.timer2_hi, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
664         state->timers.timer2_hi->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
665665
666666         if ( ( state->pm_reg[0x1A] & 0x80 ) && ( state->pm_reg[0x39] & 0x04 ) && ! ( state->pm_reg[0x38] & 0x80 ) &&
667667              ( ( ( state->pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
668668                ( ( state->pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) )
669669         {
670            timer_enable( state->timers.timer2_hi, 1 );
670            state->timers.timer2_hi->enable( 1 );
671671         }
672672         else
673673         {
674            timer_enable( state->timers.timer2_hi, 0 );
674            state->timers.timer2_hi->enable( 0 );
675675         }
676676      }
677677      break;
r10326r10327
695695         int index = data & 0x07;
696696         int cycles = ( state->pm_reg[0x1D] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
697697
698         timer_adjust_periodic(state->timers.timer3, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
698         state->timers.timer3->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
699699      }
700700
701701      /* Check for prescaler change for the high counter */
r10326r10327
704704         int index = ( data >> 4 ) & 0x07;
705705         int cycles = ( state->pm_reg[0x1D] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
706706
707         timer_adjust_periodic(state->timers.timer3_hi, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
707         state->timers.timer3_hi->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
708708      }
709709
710710      /* Check if timer2 low should be enabled */
r10326r10327
712712           ( ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1D] & 0x01 ) ) ||
713713             ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1D] & 0x01 ) ) ) )
714714      {
715         timer_enable( state->timers.timer3, 1 );
715         state->timers.timer3->enable( 1 );
716716      }
717717      else
718718      {
719         timer_enable( state->timers.timer3, 0 );
719         state->timers.timer3->enable( 0 );
720720      }
721721
722722      /* Check if timer2 high should be enabled */
r10326r10327
724724           ( ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1D] & 0x02 ) ) ||
725725             ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1D] & 0x02 ) ) ) )
726726      {
727         timer_enable( state->timers.timer3_hi, 1 );
727         state->timers.timer3_hi->enable( 1 );
728728      }
729729      else
730730      {
731         timer_enable( state->timers.timer3_hi, 0 );
731         state->timers.timer3_hi->enable( 0 );
732732      }
733733      break;
734734   case 0x1D:   /* Timer 3 speeds
r10326r10327
741741         int index = state->pm_reg[0x1C] & 0x07;
742742         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
743743
744         timer_adjust_periodic(state->timers.timer3, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
744         state->timers.timer3->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
745745
746746         if ( ( state->pm_reg[0x1C] & 0x08 ) && ( state->pm_reg[0x48] & 0x04 ) &&
747747              ( ( ( state->pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
748748                ( ( state->pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) )
749749         {
750            timer_enable( state->timers.timer3, 1 );
750            state->timers.timer3->enable( 1 );
751751         }
752752         else
753753         {
754            timer_enable( state->timers.timer3, 0 );
754            state->timers.timer3->enable( 0 );
755755         }
756756      }
757757
r10326r10327
761761         int index = ( state->pm_reg[0x1C] >> 4 ) & 0x07;
762762         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
763763
764         timer_adjust_periodic(state->timers.timer3_hi, attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
764         state->timers.timer3_hi->adjust(attotime::zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
765765
766766         if ( ( state->pm_reg[0x1C] & 0x80 ) && ( state->pm_reg[0x49] & 0x04 ) && ! ( state->pm_reg[0x48] & 0x80 ) &&
767767              ( ( ( state->pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
768768                ( ( state->pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) )
769769         {
770            timer_enable( state->timers.timer3_hi, 1 );
770            state->timers.timer3_hi->enable( 1 );
771771         }
772772         else
773773         {
774            timer_enable( state->timers.timer3_hi, 0 );
774            state->timers.timer3_hi->enable( 0 );
775775         }
776776      }
777777      break;
r10326r10327
905905           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x19] & 0x01 ) ) ||
906906             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x19] & 0x01 ) ) ) )
907907      {
908         timer_enable( state->timers.timer1, 1 );
908         state->timers.timer1->enable( 1 );
909909      }
910910      else
911911      {
912         timer_enable( state->timers.timer1, 0 );
912         state->timers.timer1->enable( 0 );
913913      }
914914
915915      if ( ( state->pm_reg[0x31] & 0x04 ) && ! ( data & 0x80 ) && ( state->pm_reg[0x18] & 0x80 ) &&
916916           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x19] & 0x02 ) ) ||
917917             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x19] & 0x02 ) ) ) )
918918      {
919         timer_enable( state->timers.timer1_hi, 1 );
919         state->timers.timer1_hi->enable( 1 );
920920      }
921921      else
922922      {
923         timer_enable( state->timers.timer1_hi, 0 );
923         state->timers.timer1_hi->enable( 0 );
924924      }
925925      break;
926926   case 0x31:   /* Timer 1 control 2
r10326r10327
940940           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x19] & 0x02 ) ) ||
941941             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x19] & 0x02 ) ) ) )
942942      {
943         timer_enable( state->timers.timer1_hi, 1 );
943         state->timers.timer1_hi->enable( 1 );
944944      }
945945      else
946946      {
947         timer_enable( state->timers.timer1_hi, 0 );
947         state->timers.timer1_hi->enable( 0 );
948948      }
949949      break;
950950   case 0x32:   /* Timer 1 preset value (low)
r10326r10327
985985           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1A] & 0x01 ) ) ||
986986             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1A] & 0x01 ) ) ) )
987987      {
988         timer_enable( state->timers.timer2, 1 );
988         state->timers.timer2->enable( 1 );
989989      }
990990      else
991991      {
992         timer_enable( state->timers.timer2, 0 );
992         state->timers.timer2->enable( 0 );
993993      }
994994      if ( ( state->pm_reg[0x39] & 0x04 ) && ! ( data & 0x80 ) && ( state->pm_reg[0x1A] & 0x80 ) &&
995995           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1B] & 0x02 ) ) ||
996996             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1B] & 0x02 ) ) ) )
997997      {
998         timer_enable( state->timers.timer2_hi, 1 );
998         state->timers.timer2_hi->enable( 1 );
999999      }
10001000      else
10011001      {
1002         timer_enable( state->timers.timer2_hi, 0 );
1002         state->timers.timer2_hi->enable( 0 );
10031003      }
10041004      break;
10051005   case 0x39:   /* Timer 2 control 2
r10326r10327
10191019           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1B] & 0x02 ) ) ||
10201020             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1B] & 0x02 ) ) ) )
10211021      {
1022         timer_enable( state->timers.timer2_hi, 1 );
1022         state->timers.timer2_hi->enable( 1 );
10231023      }
10241024      else
10251025      {
1026         timer_enable( state->timers.timer2_hi, 0 );
1026         state->timers.timer2_hi->enable( 0 );
10271027      }
10281028      break;
10291029   case 0x3A:   /* Timer 2 preset value (low)
r10326r10327
10811081           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1D] & 0x01 ) ) ||
10821082             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1D] & 0x01 ) ) ) )
10831083      {
1084         timer_enable( state->timers.timer3, 1 );
1084         state->timers.timer3->enable( 1 );
10851085      }
10861086      else
10871087      {
1088         timer_enable( state->timers.timer3, 0 );
1088         state->timers.timer3->enable( 0 );
10891089      }
10901090      if ( ( state->pm_reg[0x49] & 0x04 ) && ! ( data & 0x80 ) && ( state->pm_reg[0x1C] & 0x80 ) &&
10911091           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1D] & 0x02 ) ) ||
10921092             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1D] & 0x02 ) ) ) )
10931093      {
1094         timer_enable( state->timers.timer3_hi, 1 );
1094         state->timers.timer3_hi->enable( 1 );
10951095      }
10961096      else
10971097      {
1098         timer_enable( state->timers.timer3_hi, 0 );
1098         state->timers.timer3_hi->enable( 0 );
10991099      }
11001100      state->pm_reg[0x48] = data;
11011101      pokemini_update_sound( device->machine );
r10326r10327
11171117           ( ( ( state->pm_reg[0x19] & 0x20 ) && ! ( state->pm_reg[0x1D] & 0x02 ) ) ||
11181118             ( ( state->pm_reg[0x19] & 0x10 ) && ( state->pm_reg[0x1D] & 0x02 ) ) ) )
11191119      {
1120         timer_enable( state->timers.timer3_hi, 1 );
1120         state->timers.timer3_hi->enable( 1 );
11211121      }
11221122      else
11231123      {
1124         timer_enable( state->timers.timer3_hi, 0 );
1124         state->timers.timer3_hi->enable( 0 );
11251125      }
11261126      state->pm_reg[0x49] = data;
11271127      pokemini_update_sound( device->machine );
r10326r10327
15691569
15701570   /* Set up timers */
15711571   state->timers.seconds_timer = machine->scheduler().timer_alloc(FUNC(pokemini_seconds_timer_callback));
1572   timer_adjust_periodic( state->timers.seconds_timer, attotime::zero, 0, attotime::from_seconds( 1 ) );
1572   state->timers.seconds_timer->adjust( attotime::zero, 0, attotime::from_seconds( 1 ) );
15731573
15741574   state->timers.hz256_timer = machine->scheduler().timer_alloc(FUNC(pokemini_256hz_timer_callback));
1575   timer_adjust_periodic( state->timers.hz256_timer, attotime::zero, 0, attotime::from_hz( 256 ) );
1575   state->timers.hz256_timer->adjust( attotime::zero, 0, attotime::from_hz( 256 ) );
15761576
15771577   state->timers.timer1 = machine->scheduler().timer_alloc(FUNC(pokemini_timer1_callback));
15781578   state->timers.timer1_hi = machine->scheduler().timer_alloc(FUNC(pokemini_timer1_hi_callback));
r10326r10327
15841584   /* Set up the PRC */
15851585   state->prc.max_frame_count = 2;
15861586   state->prc.count_timer = machine->scheduler().timer_alloc(FUNC(pokemini_prc_counter_callback));
1587   timer_adjust_periodic( state->prc.count_timer, attotime::zero, 0, machine->device<cpu_device>("maincpu")->cycles_to_attotime(55640 / 65) );
1587   state->prc.count_timer->adjust( attotime::zero, 0, machine->device<cpu_device>("maincpu")->cycles_to_attotime(55640 / 65) );
15881588}
15891589
src/mess/machine/mos6530.c
r10326r10327
118118
119119   /* if counting, return the number of ticks remaining */
120120   else if (miot->timerstate == TIMER_COUNTING)
121      return timer_timeleft(miot->timer).as_ticks(miot->clock) >> miot->timershift;
121      return miot->timer->remaining().as_ticks(miot->clock) >> miot->timershift;
122122
123123   /* if finishing, return the number of ticks without the shift */
124124   else
125      return timer_timeleft(miot->timer).as_ticks(miot->clock);
125      return miot->timer->remaining().as_ticks(miot->clock);
126126}
127127
128128
r10326r10327
146146   if (miot->timerstate == TIMER_COUNTING)
147147   {
148148      miot->timerstate = TIMER_FINISHING;
149      timer_adjust_oneshot(miot->timer, attotime::from_ticks(256, miot->clock), 0);
149      miot->timer->adjust(attotime::from_ticks(256, miot->clock));
150150
151151      /* signal timer IRQ as well */
152152      miot->irqstate |= TIMER_FLAG;
r10326r10327
157157   else if (miot->timerstate == TIMER_FINISHING)
158158   {
159159      miot->timerstate = TIMER_IDLE;
160      timer_adjust_oneshot(miot->timer, attotime::never, 0);
160      miot->timer->adjust(attotime::never);
161161   }
162162}
163163
r10326r10327
199199      /* update the timer */
200200      miot->timerstate = TIMER_COUNTING;
201201      target = curtime.as_ticks(miot->clock) + 1 + (data << miot->timershift);
202      timer_adjust_oneshot(miot->timer, attotime::from_ticks(target, miot->clock) - curtime, 0);
202      miot->timer->adjust(attotime::from_ticks(target, miot->clock) - curtime);
203203   }
204204
205205   /* if A2 == 0, we are writing to the I/O section */
r10326r10327
430430   /* reset timer states */
431431   miot->timershift = 0;
432432   miot->timerstate = TIMER_IDLE;
433   timer_adjust_oneshot(miot->timer, attotime::never, 0);
433   miot->timer->adjust(attotime::never);
434434}
435435
436436
src/mess/machine/ti99/ti_fdc.c
r10326r10327
175175         {   /* on rising edge, set motor_running for 4.23s */
176176            card->DVENA = TRUE;
177177            fdc_handle_hold(device);
178            timer_adjust_oneshot(card->motor_on_timer, attotime::from_msec(4230), 0);
178            card->motor_on_timer->adjust(attotime::from_msec(4230));
179179         }
180180         card->strobe_motor = data;
181181         break;
src/mess/machine/ti99/hfdc.c
r10326r10327
238238         card->CD0 = data;
239239         if (data && !card->strobe_motor)
240240         {
241            timer_adjust_oneshot(card->motor_on_timer, attotime::from_msec(4230), 0);
241            card->motor_on_timer->adjust(attotime::from_msec(4230));
242242         }
243243         card->strobe_motor = data;
244244         break;
src/mess/machine/ti99/bwg.c
r10326r10327
271271         {   /* on rising edge, set motor_running for 4.23s */
272272            card->DVENA = TRUE;
273273            bwg_handle_hold(device);
274            timer_adjust_oneshot(card->motor_on_timer, attotime::from_msec(4230), 0);
274            card->motor_on_timer->adjust(attotime::from_msec(4230));
275275         }
276276         card->strobe_motor = data;
277277         break;
src/mess/machine/ti99/handset.c
r10326r10327
117117      // of next message is not requested for either, so we need to decide on
118118      // our own when we can post a new event.  Currently, we wait for 1000us
119119      // after the DSR acknowledges the second nybble.
120      timer_adjust_oneshot(handset->timer, attotime::from_usec(1000), 0);
120      handset->timer->adjust(attotime::from_usec(1000));
121121   }
122122
123123   if (handset->buflen == 0)
r10326r10327
137137      handset->ack = data;
138138      if (data == handset->clock)
139139         /* I don't know what the real delay is, but 30us apears to be enough */
140         timer_adjust_oneshot(handset->timer, attotime::from_usec(30), 0);
140         handset->timer->adjust(attotime::from_usec(30));
141141   }
142142}
143143
src/mess/machine/rp5c15.c
r10326r10327
194194   rtc->pulse_count = 0;
195195
196196   rtc->timer = device->machine->scheduler().timer_alloc(FUNC(rtc_alarm_pulse), (void*)device);
197   timer_adjust_periodic(rtc->timer, attotime::zero, 0, attotime::from_hz(32));
197   rtc->timer->adjust(attotime::zero, 0, attotime::from_hz(32));
198198}
199199
200200static int rp5c15_read(device_t* device, int offset, UINT16 mem_mask)
src/mess/machine/coco.c
r10326r10327
13071307static WRITE8_DEVICE_HANDLER( d_pia0_ca2_w )
13081308{
13091309   coco_state *state = device->machine->driver_data<coco_state>();
1310   timer_adjust_oneshot(state->mux_sel1_timer, JOYSTICK_MUX_DELAY, data);
1310   state->mux_sel1_timer->adjust(JOYSTICK_MUX_DELAY, data);
13111311}
13121312
13131313static TIMER_CALLBACK( coco_update_sel1_timerproc )
r10326r10327
13211321static WRITE8_DEVICE_HANDLER( d_pia0_cb2_w )
13221322{
13231323   coco_state *state = device->machine->driver_data<coco_state>();
1324   timer_adjust_oneshot(state->mux_sel2_timer, JOYSTICK_MUX_DELAY, data);
1324   state->mux_sel2_timer->adjust(JOYSTICK_MUX_DELAY, data);
13251325}
13261326
13271327static TIMER_CALLBACK( coco_update_sel2_timerproc )
r10326r10327
14481448   if (dclg_time != attotime::zero)
14491449   {
14501450      /* schedule lightgun events */
1451      timer_reset(state->update_keyboard_timer, dclg_time);
1451      state->update_keyboard_timer->reset(dclg_time);
14521452   }
14531453   else
14541454   {
r10326r10327
14561456      attotime xtrans = get_relative_time(machine, state->hiresjoy_xtransitiontime);
14571457      attotime ytrans = get_relative_time(machine, state->hiresjoy_ytransitiontime);
14581458
1459      timer_reset(state->update_keyboard_timer,
1459      state->update_keyboard_timer->reset(
14601460         (xtrans > ytrans) ? ytrans : xtrans);
14611461   }
14621462
r10326r10327
22512251         logerror("coco3_reset_timer(): delay_time=%g\n", delay_time.as_double());
22522252
22532253      /* and adjust the timer */
2254      timer_adjust_oneshot(state->gime_timer, delay_time, 0);
2254      state->gime_timer->adjust(delay_time);
22552255   }
22562256   else
22572257   {
22582258      /* timer is shut off */
2259      timer_reset(state->gime_timer, attotime::never);
2259      state->gime_timer->reset();
22602260      if (LOG_TIMER)
22612261         logerror("coco3_reset_timer(): timer is off\n");
22622262   }
src/mess/machine/mc6854.c
r10326r10327
269269   }
270270
271271   /* schedule when to ask the MC6854 for more bits */
272   expire = timer_timeleft( mc6854->ttimer );
272   expire = mc6854->ttimer ->remaining( );
273273   if ( expire== attotime::never )
274274      expire = attotime::zero;
275   timer_reset( mc6854->ttimer, expire + (BIT_LENGTH * len));
275   mc6854->ttimer->reset( expire + (BIT_LENGTH * len));
276276}
277277
278278
r10326r10327
441441   memset( mc6854->tfifo, 0, sizeof( mc6854->tfifo ) );
442442   mc6854->tstate = 0;
443443   mc6854->flen = 0;
444   timer_reset( mc6854->ttimer, attotime::never );
444   mc6854->ttimer->reset( );
445445}
446446
447447
src/mess/machine/gb.c
r10326r10327
249249
250250   /* Allocate the serial timer, and disable it */
251251   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
252   timer_enable( state->gb_serial_timer, 0 );
252   state->gb_serial_timer->enable( 0 );
253253
254254   MACHINE_START_CALL( gb_video );
255255}
r10326r10327
261261
262262   /* Allocate the serial timer, and disable it */
263263   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
264   timer_enable( state->gb_serial_timer, 0 );
264   state->gb_serial_timer->enable( 0 );
265265
266266   MACHINE_START_CALL( gbc_video );
267267}
r10326r10327
293293
294294   /* Allocate the serial timer, and disable it */
295295   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
296   timer_enable( state->gb_serial_timer, 0 );
296   state->gb_serial_timer->enable( 0 );
297297
298298   MACHINE_START_CALL( gb_video );
299299}
r10326r10327
824824      case 0x81:            /* enabled & internal clock */
825825         SIODATA = 0xFF;
826826         state->SIOCount = 8;
827         timer_adjust_periodic(state->gb_serial_timer, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(512), 0, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(512));
828         timer_enable( state->gb_serial_timer, 1 );
827         state->gb_serial_timer->adjust(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(512), 0, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(512));
828         state->gb_serial_timer->enable( 1 );
829829         break;
830830      }
831831      break;
r10326r10327
19351935   if ( ! state->SIOCount )
19361936   {
19371937      SIOCONT &= 0x7F;
1938      timer_enable( state->gb_serial_timer, 0 );
1938      state->gb_serial_timer->enable( 0 );
19391939      cputag_set_input_line(machine, "maincpu", SIO_INT, ASSERT_LINE);
19401940   }
19411941}
r10326r10327
20492049   gb_state *state = machine->driver_data<gb_state>();
20502050   /* Allocate the serial timer, and disable it */
20512051   state->gb_serial_timer = machine->scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
2052   timer_enable( state->gb_serial_timer, 0 );
2052   state->gb_serial_timer->enable( 0 );
20532053
20542054   MACHINE_START_CALL( gb_video );
20552055}
src/mess/machine/gamecom.c
r10326r10327
244244         if ( data & 0x40 )
245245         {
246246            /* timer resolution 1 minute */
247            timer_adjust_periodic(state->clock_timer, attotime::from_seconds(1), 0, attotime::from_seconds(60));
247            state->clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(60));
248248         }
249249         else
250250         {
251251            /* TImer resolution 1 second */
252            timer_adjust_periodic(state->clock_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
252            state->clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
253253         }
254254      }
255255      else
256256      {
257257         /* disable timer reset */
258         timer_enable( state->clock_timer, 0 );
258         state->clock_timer->enable( 0 );
259259         data &= 0xC0;
260260      }
261261      break;
src/mess/machine/serial.c
r10326r10327
184184      if (state)
185185      {
186186         /* start timer */
187         timer_adjust_periodic(ser->timer, attotime::zero, 0, attotime::from_hz(ser->BaudRate));
187         ser->timer->adjust(attotime::zero, 0, attotime::from_hz(ser->BaudRate));
188188      }
189189      else
190190      {
191191         /* remove timer */
192         timer_reset(ser->timer, attotime::never);
192         ser->timer->reset();
193193      }
194194   }
195195
src/mess/machine/mc6846.c
r10326r10327
9696   mc6846_t* mc6846 = get_safe_token( device );
9797   if ( mc6846->timer_started )
9898   {
99      attotime delay = timer_timeleft( mc6846->interval );
99      attotime delay = mc6846->interval ->remaining( );
100100      return delay.as_ticks(1000000) / FACTOR;
101101   }
102102   else
r10326r10327
173173
174174   case 0x20: /* single-shot */
175175      mc6846->cto = 0;
176      timer_reset( mc6846->one_shot, attotime::from_usec(FACTOR) );
176      mc6846->one_shot->reset( attotime::from_usec(FACTOR) );
177177      break;
178178
179179   case 0x30:  /* cascaded single-shot */
r10326r10327
181181
182182   default:
183183      logerror( "mc6846 timer mode %i not implemented\n", MODE );
184      timer_reset( mc6846->interval, attotime::never );
184      mc6846->interval->reset( );
185185      mc6846->timer_started = 0;
186186      return;
187187   }
188188
189   timer_reset( mc6846->interval, attotime::from_usec(delay) );
189   mc6846->interval->reset( attotime::from_usec(delay) );
190190   mc6846->timer_started = 1;
191191
192192   mc6846->csr &= ~1;
r10326r10327
229229
230230   default:
231231      logerror( "mc6846 timer mode %i not implemented\n", MODE );
232      timer_reset( mc6846->interval, attotime::never );
232      mc6846->interval->reset( );
233233      mc6846->timer_started = 0;
234234      return;
235235   }
236236
237   timer_reset( mc6846->interval, attotime::from_usec(delay) );
237   mc6846->interval->reset( attotime::from_usec(delay) );
238238
239239   mc6846->csr |= 1;
240240   mc6846_update_cto( device );
r10326r10327
435435         if ( MODE != 0x30 )
436436            mc6846->cto = 0;
437437         mc6846_update_cto( device );
438         timer_reset( mc6846->interval, attotime::never );
439         timer_reset( mc6846->one_shot, attotime::never );
438         mc6846->interval->reset(  );
439         mc6846->one_shot->reset(  );
440440         mc6846->timer_started = 0;
441441      }
442442      else
r10326r10327
575575   mc6846->csr1_to_be_cleared = 0;
576576   mc6846->csr2_to_be_cleared = 0;
577577   mc6846->timer_started = 0;
578   timer_reset( mc6846->interval, attotime::never );
579   timer_reset( mc6846->one_shot, attotime::never );
578   mc6846->interval->reset(  );
579   mc6846->one_shot->reset(  );
580580}
581581
582582
src/mess/machine/cdp1871.c
r10326r10327
175175
176176   // allocate timers
177177   m_scan_timer = timer_alloc();
178   timer_adjust_periodic(m_scan_timer, attotime::zero, 0, attotime::from_hz(clock()));
178   m_scan_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
179179
180180   // register for state saving
181181   state_save_register_device_item(this, 0, m_inhibit);
src/mess/machine/thomson.c
r10326r10327
12471247{
12481248   LOG (( "to7_game_init called\n" ));
12491249   to7_game_timer = machine->scheduler().timer_alloc(FUNC(to7_game_update_cb));
1250   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
1250   to7_game_timer->adjust(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 );
12531253}
r10326r10327
18991899static void mo5_init_timer(running_machine *machine)
19001900{
19011901   /* time is a little faster than 50 Hz to match video framerate */
1902   timer_adjust_periodic(mo5_periodic_timer, attotime::zero, 0, attotime::from_usec( 19968 ));
1902   mo5_periodic_timer->adjust(attotime::zero, 0, attotime::from_usec( 19968 ));
19031903}
19041904
19051905
r10326r10327
29762976      }
29772977
29782978      to9_kbd_byte_count = ( to9_kbd_byte_count + 1 ) & 3;
2979      timer_adjust_oneshot(to9_kbd_timer, to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE, 0);
2979      to9_kbd_timer->adjust(to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE);
29802980   }
29812981   else
29822982   {
r10326r10327
29842984      /* keyboard mode: send a byte only if a key is down */
29852985      if ( key )
29862986         to9_kbd_send( machine, key, 0 );
2987      timer_adjust_oneshot(to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0);
2987      to9_kbd_timer->adjust(TO9_KBD_POLL_PERIOD);
29882988   }
29892989}
29902990
r10326r10327
30043004   to9_kbd_key_count = 0;
30053005   to9_kbd_last_key = 0xff;
30063006   to9_kbd_update_irq(machine);
3007   timer_adjust_oneshot(to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0);
3007   to9_kbd_timer->adjust(TO9_KBD_POLL_PERIOD);
30083008}
30093009
30103010
r10326r10327
34203420      d = attotime::from_usec( bit ? 56 : 38 );
34213421      to8_kbd_step++;
34223422   }
3423   timer_adjust_oneshot(to8_kbd_timer, d, 0);
3423   to8_kbd_timer->adjust(d);
34243424}
34253425
34263426
r10326r10327
34413441
34423442   if ( data )
34433443   {
3444      double len = timer_timeelapsed( to8_kbd_signal).as_double() * 1000. - 2.;
3444      double len = to8_kbd_signal->elapsed( ).as_double() * 1000. - 2.;
34453445      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      {
r10326r10327
34553455            /* send back signal: TODO returned codes ? */
34563456            to8_kbd_data = 0;
34573457            to8_kbd_step = 0;
3458            timer_adjust_oneshot(to8_kbd_timer, attotime::from_msec( 1 ), 0);
3458            to8_kbd_timer->adjust(attotime::from_msec( 1 ));
34593459         }
34603460         else
34613461         {
34623462            to8_kbd_step = 0;
3463            timer_adjust_oneshot(to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0);
3463            to8_kbd_timer->adjust(TO8_KBD_POLL_PERIOD);
34643464            if ( len >= 1.2 && len <= 1.4 )
34653465            {
34663466               LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", machine->time().as_double() ));
r10326r10327
34783478      {
34793479         /* end key transmission */
34803480         to8_kbd_step = 0;
3481         timer_adjust_oneshot(to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0);
3481         to8_kbd_timer->adjust(TO8_KBD_POLL_PERIOD);
34823482      }
34833483   }
34843484
r10326r10327
34883488      {
34893489         /* CPU accepts key */
34903490         to8_kbd_step = 99;
3491         timer_adjust_oneshot(to8_kbd_timer, attotime::from_usec( 400 ), 0);
3491         to8_kbd_timer->adjust(attotime::from_usec( 400 ));
34923492      }
34933493      else
34943494      {
34953495         /* start signal from CPU */
34963496         to8_kbd_data = 0xfff;
34973497         to8_kbd_step = 91;
3498         timer_adjust_oneshot(to8_kbd_timer, attotime::from_usec( 400 ), 0);
3499         timer_adjust_oneshot(to8_kbd_signal, attotime::never, 0);
3498         to8_kbd_timer->adjust(attotime::from_usec( 400 ));
3499         to8_kbd_signal->adjust(attotime::never);
35003500      }
35013501      LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", machine->time().as_double(), to8_kbd_data ));
35023502   }
r10326r10327
46184618{
46194619   LOG (( "mo6_game_init called\n" ));
46204620   to7_game_timer = machine->scheduler().timer_alloc(FUNC(mo6_game_update_cb));
4621   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
4621   to7_game_timer->adjust(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 );
46244624}
r10326r10327
51315131{
51325132   LOG (( "mo5nr_game_init called\n" ));
51335133   to7_game_timer = machine->scheduler().timer_alloc(FUNC(mo6_game_update_cb));
5134   timer_adjust_periodic( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
5134   to7_game_timer->adjust( 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 );
51375137}
src/mess/machine/8530scc.c
r10326r10327
183183   scc->channel[ch].txUnderrun = 1;
184184   scc->channel[ch].baudtimer = timersave;
185185
186   timer_adjust_oneshot(scc->channel[ch].baudtimer, attotime::never, ch);
186   scc->channel[ch].baudtimer->adjust(attotime::never, ch);
187187}
188188
189189/*-------------------------------------------------
r10326r10327
212212   }
213213
214214   // reset timer according to current register values
215   timer_adjust_periodic(pChan->baudtimer, attotime::from_hz(rate), param, attotime::from_hz(rate));
215   pChan->baudtimer->adjust(attotime::from_hz(rate), param, attotime::from_hz(rate));
216216}
217217
218218/*-------------------------------------------------
r10326r10327
430430            int brconst = pChan->reg_val[13]<<8 | pChan->reg_val[14];
431431            int rate = scc->clock / brconst;
432432
433            timer_adjust_periodic(pChan->baudtimer, attotime::from_hz(rate), ch, attotime::from_hz(rate));
433            pChan->baudtimer->adjust(attotime::from_hz(rate), ch, attotime::from_hz(rate));
434434         }
435435         break;
436436
src/mess/machine/pmd85.c
r10326r10327
876876   state->previous_level = 0;
877877   state->clk_level = state->clk_level_tape = 1;
878878   state->cassette_timer = machine->scheduler().timer_alloc(FUNC(pmd85_cassette_timer_callback));
879   timer_adjust_periodic(state->cassette_timer, attotime::zero, 0, attotime::from_hz(2400));
879   state->cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(2400));
880880
881881   serial_connection_init(machine, &state->cassette_serial_connection);
882882   serial_connection_set_in_callback(machine, &state->cassette_serial_connection, pmd85_cassette_write);
src/mess/machine/at29040a.c
r10326r10327
111111      /* programming cycle start */
112112      feeprom->s_pgm = s_pgm_3;
113113      /* max delay 10ms, typical delay 5 to 7 ms */
114      timer_adjust_oneshot(feeprom->programming_timer, attotime::from_msec(5), 0);
114      feeprom->programming_timer->adjust(attotime::from_msec(5));
115115      break;
116116
117117   case s_pgm_3:
r10326r10327
180180      feeprom->s_pgm = s_pgm_0;
181181      feeprom->s_enabling_sdb = FALSE;
182182      feeprom->s_disabling_sdb = FALSE;
183      timer_adjust_oneshot(feeprom->programming_timer, attotime::never, 0);
183      feeprom->programming_timer->adjust(attotime::never);
184184   }
185185
186186
r10326r10327
215215      {   /* data polling starts the programming cycle (right???) */
216216         feeprom->s_pgm = s_pgm_3;
217217         /* max delay 10ms, typical delay 5 to 7 ms */
218         timer_adjust_oneshot(feeprom->programming_timer, attotime::from_msec(5), 0);
218         feeprom->programming_timer->adjust(attotime::from_msec(5));
219219      }
220220
221221      reply = feeprom->toggle_bit;
r10326r10327
291291         feeprom->s_pgm = s_pgm_0;
292292         feeprom->s_enabling_sdb = FALSE;
293293         feeprom->s_disabling_sdb = FALSE;
294         timer_adjust_oneshot(feeprom->programming_timer, attotime::never, 0);
294         feeprom->programming_timer->adjust(attotime::never);
295295
296296         /* process command */
297297         switch (data)
r10326r10327
317317               feeprom->s_pgm = s_pgm_1;
318318               feeprom->s_disabling_sdb = TRUE;
319319               /* set command timeout (right???) */
320               //timer_adjust_periodic(feeprom->programming_timer, attotime::from_usec(150), id, 0.);
320               //feeprom->programming_timer->adjust(attotime::from_usec(150), id, 0.);
321321            }
322322            break;
323323
r10326r10327
337337            feeprom->s_pgm = s_pgm_1;
338338            feeprom->s_enabling_sdb = TRUE;
339339            /* set command timeout (right???) */
340            //timer_adjust_periodic(feeprom->programming_timer, attotime::from_usec(150), id, 0.);
340            //feeprom->programming_timer->adjust(attotime::from_usec(150), id, 0.);
341341            break;
342342
343343         case 0xf0:
r10326r10327
366366      feeprom->s_pgm = s_pgm_0;
367367      feeprom->s_enabling_sdb = FALSE;
368368      feeprom->s_disabling_sdb = FALSE;
369      timer_adjust_oneshot(feeprom->programming_timer, attotime::never, 0);
369      feeprom->programming_timer->adjust(attotime::never);
370370   }
371371
372372   if (((feeprom->s_pgm == s_pgm_0) && !feeprom->s_sdp)
r10326r10327
392392      /* write data to programming buffer */
393393      feeprom->programming_buffer[offset & 0xff] = data;
394394      feeprom->programming_last_offset = offset;
395      timer_adjust_oneshot(feeprom->programming_timer, attotime::from_usec(150), 0);
395      feeprom->programming_timer->adjust(attotime::from_usec(150));
396396   }
397397}
398398
src/mess/machine/scsibus.c
r10326r10327
208208           
209209            // If we have the first byte, then cancel the dataout timout
210210            if(bus->data_idx==1)
211               timer_adjust_oneshot(bus->dataout_timer,attotime::never,0);
211               bus->dataout_timer->adjust(attotime::never);
212212
213213                // When we have the first 3 bytes, calculate how many more are in the
214214                // bad block list.
r10326r10327
297297{
298298    scsibus_t   *bus = get_token(device);
299299
300    timer_adjust_oneshot(bus->ack_timer,attotime::from_nsec(ACK_DELAY_NS),state);
300    bus->ack_timer->adjust(attotime::from_nsec(ACK_DELAY_NS),state);
301301}
302302
303303static void scsibus_exec_command(device_t *device)
r10326r10327
366366            bus->xfer_count=4;
367367            bus->data_last=bus->xfer_count;
368368            bus->bytes_left=0;
369         timer_adjust_oneshot(bus->dataout_timer,attotime::from_seconds(FORMAT_UNIT_TIMEOUT),0);
369         bus->dataout_timer->adjust(attotime::from_seconds(FORMAT_UNIT_TIMEOUT));
370370            break;
371371
372372      // Check track format Xebec
r10326r10327
614614            if(hdfile!=(void *)NULL)
615615            {
616616               if(state==0)
617                  timer_adjust_oneshot(bus->sel_timer,attotime::from_nsec(BSY_DELAY_NS),0);
617                  bus->sel_timer->adjust(attotime::from_nsec(BSY_DELAY_NS));
618618               else
619619                  scsi_change_phase(device,SCSI_PHASE_COMMAND);
620620            }
r10326r10327
738738{
739739    scsibus_t   *bus = get_token(device);
740740
741    timer_adjust_oneshot(bus->req_timer,attotime::from_nsec(REQ_DELAY_NS),state);
741    bus->req_timer->adjust(attotime::from_nsec(REQ_DELAY_NS),state);
742742}
743743
744744
src/mess/machine/tx0.c
r10326r10327
119119         if (state->tape_reader.motor_on && state->tape_reader.rcl)
120120         {
121121            /* delay is approximately 1/400s */
122            timer_adjust_oneshot(state->tape_reader.timer, attotime::from_usec(2500), 0);
122            state->tape_reader.timer->adjust(attotime::from_usec(2500));
123123         }
124124         else
125125         {
126            timer_enable(state->tape_reader.timer, 0);
126            state->tape_reader.timer->enable(0);
127127         }
128128      }
129129      break;
r10326r10327
152152      state->tape_reader.motor_on = 0;
153153
154154      if (state->tape_reader.timer)
155         timer_enable(state->tape_reader.timer, 0);
155         state->tape_reader.timer->enable(0);
156156      break;
157157
158158   case 1:
r10326r10327
194194   if (state->tape_reader.motor_on && state->tape_reader.rcl)
195195   {
196196      /* delay is approximately 1/400s */
197      timer_adjust_oneshot(state->tape_reader.timer, attotime::from_usec(2500), 0);
197      state->tape_reader.timer->adjust(attotime::from_usec(2500));
198198   }
199199   else
200200   {
201      timer_enable(state->tape_reader.timer, 0);
201      state->tape_reader.timer->enable(0);
202202   }
203203}
204204
r10326r10327
246246
247247   if (state->tape_reader.motor_on && state->tape_reader.rcl)
248248      /* delay is approximately 1/400s */
249      timer_adjust_oneshot(state->tape_reader.timer, attotime::from_usec(2500), 0);
249      state->tape_reader.timer->adjust(attotime::from_usec(2500));
250250   else
251      timer_enable(state->tape_reader.timer, 0);
251      state->tape_reader.timer->enable(0);
252252}
253253
254254/*
r10326r10327
290290   /* shuffle and punch 6-bit word */
291291   tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5));
292292
293   timer_adjust_oneshot(state->tape_puncher.timer, attotime::from_usec(15800), 0);
293   state->tape_puncher.timer->adjust(attotime::from_usec(15800));
294294}
295295
296296/*
r10326r10327
306306   /* shuffle and punch 6-bit word */
307307   tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100);
308308
309   timer_adjust_oneshot(state->tape_puncher.timer, attotime::from_usec(15800), 0);
309   state->tape_puncher.timer->adjust(attotime::from_usec(15800));
310310}
311311
312312
r10326r10327
369369   ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5);
370370   typewriter_out(device->machine, ch);
371371
372   timer_adjust_oneshot(state->typewriter.prt_timer, attotime::from_msec(100), 0);
372   state->typewriter.prt_timer->adjust(attotime::from_msec(100));
373373}
374374
375375
r10326r10327
396396   y = ac & 0777;
397397   tx0_plot(device->machine, x, y);
398398
399   timer_adjust_oneshot(state->dis_timer, attotime::from_usec(50), 0);
399   state->dis_timer->adjust(attotime::from_usec(50));
400400}
401401
402402
r10326r10327
429429      delay = attotime::from_usec(4600);
430430      break;
431431   }
432   timer_adjust_oneshot(state->magtape.timer, delay, 0);
432   state->magtape.timer->adjust(delay);
433433}
434434
435435static void schedule_unselect(tx0_state *state)
r10326r10327
451451      delay = attotime::from_usec(5750);
452452      break;
453453   }
454   timer_adjust_oneshot(state->magtape.timer, delay, 0);
454   state->magtape.timer->adjust(delay);
455455}
456456
457457DEVICE_START( tx0_magtape )
r10326r10327
492492   {
493493      if (state->magtape.state == MTS_SELECTING)
494494         /* I/O has not actually started, we can cancel the selection */
495         timer_enable(state->tape_reader.timer, 0);
495         state->tape_reader.timer->enable(0);
496496      if ((state->magtape.state == MTS_SELECTED) || ((state->magtape.state == MTS_SELECTING) && (state->magtape.command == 2)))
497497      {   /* unit has become unavailable */
498498         state->magtape.state = MTS_UNSELECTING;
r10326r10327
681681               break;
682682            }
683683            if (state->magtape.state != MTS_UNSELECTING)
684               timer_adjust_oneshot(state->magtape.timer, attotime::from_usec(66), 0);
684               state->magtape.timer->adjust(attotime::from_usec(66));
685685         }
686686         break;
687687
r10326r10327
840840               break;
841841            }
842842            if (state->magtape.state != MTS_UNSELECTING)
843               timer_adjust_oneshot(state->magtape.timer, attotime::from_usec(66), 0);
843               state->magtape.timer->adjust(attotime::from_usec(66));
844844         }
845845         break;
846846
847847      case 2:   /* rewind */
848848         state->magtape.state = MTS_UNSELECTING;
849849         /* we rewind at 10*read speed (I don't know the real value) */
850         timer_adjust_oneshot(state->magtape.timer, (attotime::from_nsec(6600) * state->magtape.img->ftell()), 0);
850         state->magtape.timer->adjust((attotime::from_nsec(6600) * state->magtape.img->ftell()));
851851         //schedule_unselect(state);
852852         state->magtape.img->fseek( 0, SEEK_END);
853853         state->magtape.irg_pos = MTIRGP_END;
r10326r10327
935935               state->magtape.img->unload();
936936            }
937937            else
938               timer_adjust_oneshot(state->magtape.timer, attotime::from_usec(66), 0);
938               state->magtape.timer->adjust(attotime::from_usec(66));
939939         }
940940         break;
941941      }
r10326r10327
952952   {
953953      if (0)
954954         magtape_callback(device);
955      timer_adjust_oneshot(state->magtape.timer, attotime::zero, 0);
955      state->magtape.timer->adjust(attotime::zero);
956956   }
957957}
958958
r10326r10327
996996   tx0_state *state = device->machine->driver_data<tx0_state>();
997997   state->tape_reader.rcl = state->tape_reader.rc = 0;
998998   if (state->tape_reader.timer)
999      timer_enable(state->tape_reader.timer, 0);
999      state->tape_reader.timer->enable(0);
10001000
10011001   if (state->tape_puncher.timer)
1002      timer_enable(state->tape_puncher.timer, 0);
1002      state->tape_puncher.timer->enable(0);
10031003
10041004   if (state->typewriter.prt_timer)
1005      timer_enable(state->typewriter.prt_timer, 0);
1005      state->typewriter.prt_timer->enable(0);
10061006
10071007   if (state->dis_timer)
1008      timer_enable(state->dis_timer, 0);
1008      state->dis_timer->enable(0);
10091009}
10101010
10111011
src/mess/machine/c128.c
r10326r10327
11061106         if (!(data & 0x20))
11071107         {
11081108            cassette_change_state(device->machine->device("cassette"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
1109            timer_adjust_periodic(state->datasette_timer, attotime::zero, 0, attotime::from_hz(44100));
1109            state->datasette_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
11101110         }
11111111         else
11121112         {
11131113            cassette_change_state(device->machine->device("cassette"),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
1114            timer_reset(state->datasette_timer, attotime::never);
1114            state->datasette_timer->reset();
11151115         }
11161116      }
11171117   }
src/mess/machine/tms9901.c
r10326r10327
277277   tms9901_t *tms = get_token(device);
278278   if (tms->clockinvl)
279279   {   /* reset clock interval */
280      timer_adjust_periodic(tms->timer, attotime::from_double((double) tms->clockinvl / (tms->clock_rate / 64.)), 0, attotime::from_double((double) tms->clockinvl / (tms->clock_rate / 64.)));
280      tms->timer->adjust(attotime::from_double((double) tms->clockinvl / (tms->clock_rate / 64.)), 0, attotime::from_double((double) tms->clockinvl / (tms->clock_rate / 64.)));
281281   }
282282   else
283283   {   /* clock interval == 0 -> no timer */
284      timer_enable(tms->timer, 0);
284      tms->timer->enable(0);
285285   }
286286}
287287
r10326r10327
404404            /* we are switching to clock mode: latch the current value of
405405                the decrementer register */
406406            if (tms->clockinvl)
407               tms->latchedtimer = ceil(timer_timeleft(tms->timer).as_double() * (tms->clock_rate / 64.));
407               tms->latchedtimer = ceil(tms->timer->remaining().as_double() * (tms->clock_rate / 64.));
408408            else
409409               tms->latchedtimer = 0;      /* timer inactive... */
410410         }
r10326r10327
545545
546546   if (tms->timer)
547547   {
548      timer_reset(tms->timer, attotime::never);   /* FIXME - timers should only be allocated once */
548      tms->timer->reset();   /* FIXME - timers should only be allocated once */
549549      tms->timer = NULL;
550550   }
551551}
src/mess/machine/c2040.c
r10326r10327
817817   int s0 = (data >> 2) & 0x03;
818818   micropolis_step_motor(c2040, 0, mtr0, s0);
819819
820   timer_enable(c2040->bit_timer, !mtr1 | !mtr0);
820   c2040->bit_timer->enable(!mtr1 | !mtr0);
821821}
822822
823823static READ_LINE_DEVICE_HANDLER( ready_r )
r10326r10327
941941   int s0 = (data >> 2) & 0x03;
942942   mpi_step_motor(c2040, 0, mtr0, s0);
943943
944   timer_enable(c2040->bit_timer, !mtr1 | !mtr0);
944   c2040->bit_timer->enable(!mtr1 | !mtr0);
945945}
946946
947947static const via6522_interface c8050_via_intf =
r10326r10327
10681068
10691069   if (c2040->ds != ds)
10701070   {
1071      timer_adjust_periodic(c2040->bit_timer, attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
1071      c2040->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
10721072      c2040->ds = ds;
10731073   }
10741074
r10326r10327
11581158
11591159   if (c2040->ds != ds)
11601160   {
1161      timer_adjust_periodic(c2040->bit_timer, attotime::zero, 0, attotime::from_hz(C8050_BITRATE[ds]));
1161      c2040->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C8050_BITRATE[ds]));
11621162      c2040->ds = ds;
11631163   }
11641164
src/mess/machine/pet.c
r10326r10327
190190   if (!data)
191191   {
192192      cassette_change_state(device->machine->device("cassette1"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
193      timer_adjust_periodic(state->datasette1_timer, attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
193      state->datasette1_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
194194   }
195195   else
196196   {
197197      cassette_change_state(device->machine->device("cassette1"),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
198      timer_reset(state->datasette1_timer, attotime::never);
198      state->datasette1_timer->reset();
199199   }
200200}
201201
r10326r10327
403403   if (BIT(data, 4))
404404   {
405405      cassette_change_state(device->machine->device("cassette2"), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
406      timer_adjust_periodic(state->datasette2_timer, attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
406      state->datasette2_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
407407   }
408408   else
409409   {
410410      cassette_change_state(device->machine->device("cassette2"), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
411      timer_reset(state->datasette2_timer, attotime::never);
411      state->datasette2_timer->reset();
412412   }
413413}
414414
src/mess/machine/thomflop.c
r10326r10327
10361036   thmfc1->stat0 |= THMFC1_STAT0_FINISHED;
10371037   thmfc1->data_idx = 0;
10381038   thmfc1->data_size = 0;
1039   timer_adjust_oneshot(thmfc_floppy_cmd, attotime::never, 0);
1039   thmfc_floppy_cmd->adjust(attotime::never);
10401040}
10411041
10421042
r10326r10327
13421342
13431343      /* abort previous command, if any */
13441344      thmfc1->op = THMFC1_OP_RESET;
1345      timer_adjust_oneshot(thmfc_floppy_cmd, attotime::never, 0);
1345      thmfc_floppy_cmd->adjust(attotime::never);
13461346
13471347      switch ( data & 3 )
13481348      {
r10326r10327
13621362            thmfc1->data_finish = thmfc1->sector_size + 3;
13631363            thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP;
13641364            thmfc1->op = THMFC1_OP_WRITE_SECT;
1365            timer_adjust_oneshot(thmfc_floppy_cmd, attotime::from_msec( 10 ), 0);
1365            thmfc_floppy_cmd->adjust(attotime::from_msec( 10 ));
13661366         }
13671367         break;
13681368
r10326r10327
13781378            thmfc1->data_idx = 1;
13791379            thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP;
13801380            thmfc1->op = THMFC1_OP_READ_ADDR;
1381            timer_adjust_oneshot(thmfc_floppy_cmd, attotime::from_msec( 1 ), 0);
1381            thmfc_floppy_cmd->adjust(attotime::from_msec( 1 ));
13821382         }
13831383         break;
13841384
r10326r10327
13941394            thmfc1->data_idx = 1;
13951395            thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP;
13961396            thmfc1->op = THMFC1_OP_READ_SECT;
1397            timer_adjust_oneshot(thmfc_floppy_cmd, attotime::from_msec( 10 ), 0);
1397            thmfc_floppy_cmd->adjust(attotime::from_msec( 10 ));
13981398         }
13991399         break;
14001400      }
r10326r10327
15541554   thmfc1->data_raw_size = 0;
15551555   thmfc1->data_crc = 0;
15561556   thmfc1->wsync = 0;
1557   timer_adjust_oneshot(thmfc_floppy_cmd, attotime::never, 0);
1557   thmfc_floppy_cmd->adjust(attotime::never);
15581558}
15591559
15601560
src/mess/machine/upd71071.c
r10326r10327
217217            // TODO
218218            break;
219219         case 0x40:  // Single
220            timer_adjust_oneshot(dmac->timer[channel],attotime::from_hz(dmac->intf->clock),channel);
220            dmac->timer[channel]->adjust(attotime::from_hz(dmac->intf->clock),channel);
221221            break;
222222         case 0x80:  // Block
223223            // TODO
src/mess/machine/europc.c
r10326r10327
294294   europc_rtc.data[0xf]=1;
295295
296296   europc_rtc.timer = machine->scheduler().timer_alloc(FUNC(europc_rtc_timer));
297   timer_adjust_periodic(europc_rtc.timer, attotime::zero, 0, attotime(1, 0));
297   europc_rtc.timer->adjust(attotime::zero, 0, attotime(1,0));
298298}
299299
300300 READ8_HANDLER( europc_rtc_r )
src/mess/machine/electron.c
r10326r10327
2929   state->ula.high_tone_set = 0;
3030   state->ula.bit_count = 0;
3131   state->ula.tape_running = 1;
32   timer_adjust_periodic(state->tape_timer, attotime::zero, 0, attotime::from_hz(4800));
32   state->tape_timer->adjust(attotime::zero, 0, attotime::from_hz(4800));
3333}
3434
3535static void electron_tape_stop( electron_state *state )
3636{
3737   state->ula.tape_running = 0;
38   timer_reset( state->tape_timer, attotime::never );
38   state->tape_timer->reset( );
3939}
4040
4141#define TAPE_LOW   0x00;
src/mess/machine/pc_hdc.c
r10326r10327
707707         status[n] |= STA_INPUT;
708708
709709         assert(timer[n]);
710         timer_adjust_oneshot(timer[n], attotime::from_msec(1), n);
710         timer[n]->adjust(attotime::from_msec(1), n);
711711        }
712712   }
713713}
src/mess/machine/fm_scsi.c
r10326r10327
187187      if(m_result_index >= m_result_length)
188188      {
189189         // end of data transfer
190         timer_adjust_oneshot(m_transfer_timer,attotime::never,0);  // stop timer
191         timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_STATUS);
190         m_transfer_timer->adjust(attotime::never);  // stop timer
191         m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS);
192192         if(m_output_lines & FMSCSI_LINE_DMAE)
193193         {
194194            devcb_call_write_line(&m_drq_func,0);
r10326r10327
201201   if(m_phase == SCSI_PHASE_MESSAGE_IN)
202202   {
203203      m_data = 0;  // command complete message
204      timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_BUS_FREE);
204      m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_BUS_FREE);
205205      m_command_index = 0;
206206      return m_data;
207207   }
r10326r10327
210210   {
211211      m_data = 0;  // GOOD status
212212      // no command complete message?
213      timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_MESSAGE_IN);
213      m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_MESSAGE_IN);
214214      m_command_index = 0;
215215      //set_input_line(FMSCSI_LINE_REQ,1);  // raise REQ yet again
216216      return m_data;
r10326r10327
251251      if(m_result_index >= m_result_length)
252252      {
253253         // end of data transfer
254         timer_adjust_oneshot(m_transfer_timer,attotime::never,0);  // stop timer
255         timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_STATUS);
254         m_transfer_timer->adjust(attotime::never);  // stop timer
255         m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS);
256256         if(m_output_lines & FMSCSI_LINE_DMAE)
257257         {
258258            devcb_call_write_line(&m_drq_func,0);
r10326r10327
272272         SCSIExecCommand(m_SCSIdevices[m_target],&m_result_length);
273273         SCSIGetPhase(m_SCSIdevices[m_target],&phase);
274274         if(m_command[0] == 1)  // rezero unit command - not implemented in SCSI code
275            timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_STATUS);
275            m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS);
276276         else
277            timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),phase);
277            m_phase_timer->adjust(attotime::from_usec(800),phase);
278278
279279         logerror("FMSCSI: Command %02x sent, result length = %i\n",m_command[0],m_result_length);
280280      }
281281      else
282282      {
283         timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_COMMAND);
283         m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND);
284284      }
285285   }
286286   if(m_phase == SCSI_PHASE_MESSAGE_OUT)
287287   {
288      timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_STATUS);
288      m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS);
289289   }
290290}
291291
r10326r10327
322322      set_input_line(FMSCSI_LINE_IO,1);
323323      set_input_line(FMSCSI_LINE_REQ,1);
324324      // start transfer timer
325      timer_adjust_periodic(m_transfer_timer,attotime::zero,0,attotime::from_hz(3000000));  // arbitrary value for now
325      m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000));  // arbitrary value for now
326326      SCSIReadData(m_SCSIdevices[m_target],m_buffer,512);
327327      m_result_index = 0;
328328      logerror("FMSCSI: Starting transfer (%i)\n",m_result_length);
r10326r10327
333333      set_input_line(FMSCSI_LINE_IO,0);
334334      set_input_line(FMSCSI_LINE_REQ,1);
335335      // start transfer timer
336      timer_adjust_periodic(m_transfer_timer,attotime::zero,0,attotime::from_hz(3000000));  // arbitrary value for now
336      m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000));  // arbitrary value for now
337337      m_result_index = 0;
338338      logerror("FMSCSI: Starting transfer (%i)\n",m_result_length);
339339      break;
r10326r10327
409409      {
410410         if (image->exists())  // if device is mounted
411411         {
412            timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_COMMAND);
412            m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND);
413413            m_data = 0x08;
414414         }
415415      }
r10326r10327
418418   if(line == FMSCSI_LINE_ATN)
419419   {
420420      if(state != 0)
421         timer_adjust_oneshot(m_phase_timer,attotime::from_usec(800),SCSI_PHASE_MESSAGE_OUT);
421         m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_MESSAGE_OUT);
422422   }
423423
424424   if(state != 0)
src/mess/machine/sorcerer.c
r10326r10327
173173   if (!BIT(data, 7)) // cassette operations
174174   {
175175#if SORCERER_USING_RS232
176      timer_adjust_oneshot(m_serial_timer, attotime::zero, 0);
176      m_serial_timer->adjust(attotime::zero);
177177#endif
178178
179179      UINT8 sound = input_port_read(machine, "CONFIG") & 8;
r10326r10327
193193         (BIT(data, 5)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
194194
195195      if (data & 0x30)
196         timer_adjust_periodic(m_cassette_timer, attotime::zero, 0, attotime::from_hz(19200));
196         m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200));
197197      else
198         timer_adjust_oneshot(m_cassette_timer, attotime::zero, 0);
198         m_cassette_timer->adjust(attotime::zero);
199199   }
200200#if SORCERER_USING_RS232
201201   else
202202   {
203      timer_adjust_periodic(m_serial_timer, attotime::zero, 0, attotime::from_hz(19200));
204      timer_adjust_oneshot(m_cassette_timer, attotime::zero, 0);
203      m_serial_timer->adjust(attotime::zero, 0, attotime::from_hz(19200));
204      m_cassette_timer->adjust(attotime::zero);
205205   }
206206#endif
207207
src/mess/machine/amigafdc.c
r10326r10327
9898   fdc->fdc_status[id].cached = -1;
9999   fdc->fdc_status[id].motor_on = 0;
100100   fdc->fdc_status[id].rev_timer_started = 0;
101   timer_reset( fdc->fdc_status[id].rev_timer, attotime::never );
102   timer_reset( fdc->fdc_status[id].sync_timer, attotime::never );
103   timer_reset( fdc->fdc_status[id].dma_timer, attotime::never );
101   fdc->fdc_status[id].rev_timer->reset(  );
102   fdc->fdc_status[id].sync_timer->reset(  );
103   fdc->fdc_status[id].dma_timer->reset(  );
104104   fdc->fdc_rdy = 0;
105105
106106   check_extended_image( image.device().owner(), id );
r10326r10327
115115   fdc->fdc_status[id].cached = -1;
116116   fdc->fdc_status[id].motor_on = 0;
117117   fdc->fdc_status[id].rev_timer_started = 0;
118   timer_reset( fdc->fdc_status[id].rev_timer, attotime::never );
119   timer_reset( fdc->fdc_status[id].sync_timer, attotime::never );
120   timer_reset( fdc->fdc_status[id].dma_timer, attotime::never );
118   fdc->fdc_status[id].rev_timer->reset(  );
119   fdc->fdc_status[id].sync_timer->reset(  );
120   fdc->fdc_status[id].dma_timer->reset(  );
121121   fdc->fdc_rdy = 0;
122122}
123123
r10326r10327
158158      fdc->fdc_status[id].is_ext_image = 0;
159159      fdc->fdc_status[id].tracklen = MAX_TRACK_BYTES;
160160      fdc->fdc_status[id].disk_changed = DISK_DETECT_DELAY;
161      timer_reset( fdc->fdc_status[id].rev_timer, attotime::never );
162      timer_reset( fdc->fdc_status[id].sync_timer, attotime::never );
163      timer_reset( fdc->fdc_status[id].dma_timer, attotime::never );
161      fdc->fdc_status[id].rev_timer->reset(  );
162      fdc->fdc_status[id].sync_timer->reset(  );
163      fdc->fdc_status[id].dma_timer->reset(  );
164164      memset( fdc->fdc_status[id].mfm, 0xaa, MAX_MFM_TRACK_LEN );
165165   }
166166   fdc->fdc_sel = 0x0f;
r10326r10327
237237      return 0;
238238   }
239239
240   elapsed = timer_timeelapsed( fdc->fdc_status[drive].rev_timer ).as_double();
240   elapsed = fdc->fdc_status[drive].rev_timer ->elapsed( ).as_double();
241241   speed = ( CUSTOM_REG(REG_ADKCON) & 0x100 ) ? 2 : 4;
242242
243243   bytes = elapsed /  attotime::from_usec( speed * 8 ).as_double();
r10326r10327
333333      time = ONE_SECTOR_BYTES;
334334      time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
335335      time *= 8;
336      timer_adjust_oneshot(fdc->fdc_status[drive].sync_timer, attotime::from_usec( time ), drive);
336      fdc->fdc_status[drive].sync_timer->adjust(attotime::from_usec( time ), drive);
337337      return;
338338   }
339339
340340bail:
341   timer_reset( fdc->fdc_status[drive].sync_timer, attotime::never );
341   fdc->fdc_status[drive].sync_timer->reset( );
342342}
343343
344344static TIMER_CALLBACK(fdc_dma_proc)
r10326r10327
417417         time = len_words * 2;
418418         time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
419419         time *= 8;
420         timer_adjust_oneshot(fdc->fdc_status[drive].dma_timer, attotime::from_usec( time ), drive);
420         fdc->fdc_status[drive].dma_timer->adjust(attotime::from_usec( time ), drive);
421421         return;
422422      }
423423   }
424424
425425bail:
426   timer_reset( fdc->fdc_status[drive].dma_timer, attotime::never );
426   fdc->fdc_status[drive].dma_timer->reset( );
427427}
428428
429429void amiga_fdc_setup_dma( device_t *device ) {
r10326r10327
492492   time += len_words * 2;
493493   time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
494494   time *= 8;
495   timer_adjust_oneshot(fdc->fdc_status[drive].dma_timer, attotime::from_usec( time ), drive);
495   fdc->fdc_status[drive].dma_timer->adjust(attotime::from_usec( time ), drive);
496496
497497   return;
498498
499499bail:
500   timer_reset( fdc->fdc_status[drive].dma_timer, attotime::never );
500   fdc->fdc_status[drive].dma_timer->reset( );
501501}
502502
503503static void setup_fdc_buffer( device_t *device,int drive )
r10326r10327
674674   mos6526_flag_w(cia, 0);
675675   mos6526_flag_w(cia, 1);
676676
677   timer_adjust_oneshot(fdc->fdc_status[drive].rev_timer, attotime::from_msec( ONE_REV_TIME ), drive);
677   fdc->fdc_status[drive].rev_timer->adjust(attotime::from_msec( ONE_REV_TIME ), drive);
678678   fdc->fdc_status[drive].rev_timer_started = 1;
679679
680680   if ( fdc->fdc_status[drive].is_ext_image == 0 )
r10326r10327
683683      time = GAP_TRACK_BYTES + 6;
684684      time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
685685      time *= 8;
686      timer_adjust_oneshot(fdc->fdc_status[drive].sync_timer, attotime::from_usec( time ), drive);
686      fdc->fdc_status[drive].sync_timer->adjust(attotime::from_usec( time ), drive);
687687   }
688688}
689689
r10326r10327
696696      return;
697697   }
698698
699   timer_adjust_oneshot(fdc->fdc_status[drive].rev_timer, attotime::from_msec( ONE_REV_TIME ), drive);
699   fdc->fdc_status[drive].rev_timer->adjust(attotime::from_msec( ONE_REV_TIME ), drive);
700700   fdc->fdc_status[drive].rev_timer_started = 1;
701701}
702702
r10326r10327
708708      return;
709709   }
710710
711   timer_reset( fdc->fdc_status[drive].rev_timer, attotime::never );
711   fdc->fdc_status[drive].rev_timer->reset( );
712712   fdc->fdc_status[drive].rev_timer_started = 0;
713   timer_reset( fdc->fdc_status[drive].dma_timer, attotime::never );
714   timer_reset( fdc->fdc_status[drive].sync_timer, attotime::never );
713   fdc->fdc_status[drive].dma_timer->reset(  );
714   fdc->fdc_status[drive].sync_timer->reset(  );
715715}
716716
717717static void fdc_setup_leds(device_t *device, int drive ) {
src/mess/machine/e05a03.c
r10326r10327
141141{
142142   e05a03_state *e05a03 = get_safe_token(device);
143143
144   logerror("%s: e05a03_w(%02x): %02x\n", cpuexec_describe_context(device->machine), offset, data);
144   logerror("%s: e05a03_w(%02x): %02x\n", device->machine->describe_context(), offset, data);
145145
146146   switch (offset)
147147   {
r10326r10327
181181   e05a03_state *e05a03 = get_safe_token(device);
182182   UINT8 result = 0;
183183
184   logerror("%s: e05a03_r(%02x)\n", cpuexec_describe_context(device->machine), offset);
184   logerror("%s: e05a03_r(%02x)\n", device->machine->describe_context(), offset);
185185
186186   switch (offset)
187187   {
src/mess/machine/c1541.c
r10326r10327
328328      }
329329
330330      floppy_mon_w(c1541->image, !mtr);
331      timer_enable(c1541->bit_timer, mtr);
331      c1541->bit_timer->enable(mtr);
332332
333333      c1541->mtr = mtr;
334334   }
r10326r10327
958958
959959   if (c1541->ds != ds)
960960   {
961      timer_adjust_periodic(c1541->bit_timer, attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
961      c1541->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
962962      c1541->ds = ds;
963963   }
964964}
src/mess/machine/amigakbd.c
r10326r10327
5151   /* if we still have more data, schedule another update */
5252   if ( key_buf_pos != key_cur_pos )
5353   {
54      timer_adjust_oneshot(kbd_timer, machine->primary_screen->frame_period() / 4, 0);
54      kbd_timer->adjust(machine->primary_screen->frame_period() / 4);
5555   }
5656}
5757
r10326r10327
9292      /* if the buffer was empty and we have new data, start a timer to send the keystrokes */
9393      if ( key_buf_was_empty && ( key_buf_pos != key_cur_pos ) )
9494      {
95         timer_adjust_oneshot(kbd_timer, field->port->machine->primary_screen->frame_period() / 4, 0);
95         kbd_timer->adjust(field->port->machine->primary_screen->frame_period() / 4);
9696      }
9797   }
9898}
r10326r10327
104104   key_buf_pos = 0;
105105   key_cur_pos = 0;
106106   kbd_timer = machine->scheduler().timer_alloc(FUNC(kbd_update_callback));
107   timer_reset( kbd_timer, attotime::never );
107   kbd_timer->reset( );
108108}
109109
110110/*********************************************************************************************/
src/mess/machine/matsucd.c
r10326r10327
142142   if (cdda != NULL)
143143   {
144144      cdda_stop_audio(cdda);
145      timer_reset( cd.frame_timer, attotime::never );
145      cd.frame_timer->reset( );
146146   }
147147}
148148
r10326r10327
152152   if (cdda != NULL)
153153   {
154154      cdda_start_audio(cdda, lba, num_blocks);
155      timer_adjust_oneshot(cd.frame_timer, attotime::from_hz( 75 ), 0);
155      cd.frame_timer->adjust(attotime::from_hz( 75 ));
156156   }
157157}
158158
r10326r10327
165165
166166      if ( pause )
167167      {
168         timer_reset( cd.frame_timer, attotime::never );
168         cd.frame_timer->reset( );
169169      }
170170      else
171171      {
172         timer_adjust_oneshot(cd.frame_timer, attotime::from_hz( 75 ), 0);
172         cd.frame_timer->adjust(attotime::from_hz( 75 ));
173173      }
174174   }
175175}
r10326r10327
299299
300300         newstatus |= MATSU_STATUS_PLAYING;
301301
302         timer_adjust_oneshot(cd.frame_timer, attotime::from_hz( 75 ), 0);
302         cd.frame_timer->adjust(attotime::from_hz( 75 ));
303303      }
304304      else
305305      {
src/mess/machine/tms9902.c
r10326r10327
228228   tms9902_t *tms9902 = get_token(device);
229229   if (tms9902->TMR)
230230   {   /* reset clock interval */
231      timer_adjust_periodic(tms9902->timer,
231      tms9902->timer->adjust(
232232                  attotime::from_double((double) tms9902->TMR / (tms9902->clock_rate / ((tms9902->CLK4M) ? 4. : 3.) / 64.)),
233233                  0,
234234                  attotime::from_double((double) tms9902->TMR / (tms9902->clock_rate / ((tms9902->CLK4M) ? 4. : 3.) / 64.)));
235235   }
236236   else
237237   {   /* clock interval == 0 -> no timer */
238      timer_enable(tms9902->timer, 0);
238      tms9902->timer->enable(0);
239239   }
240240}
241241
r10326r10327
581581
582582   if (tms9902->timer)
583583   {
584      timer_reset(tms9902->timer, attotime::never);   /* FIXME - timers should only be allocated once */
584      tms9902->timer->reset();   /* FIXME - timers should only be allocated once */
585585      tms9902->timer = NULL;
586586   }
587587}
src/mess/machine/osborne1.c
r10326r10327
397397      beep_set_state( speaker, 0 );
398398   }
399399
400   timer_adjust_oneshot(state->video_timer, machine->primary_screen->time_until_pos(y + 1, 0 ), 0);
400   state->video_timer->adjust(machine->primary_screen->time_until_pos(y + 1, 0 ));
401401}
402402
403403static TIMER_CALLBACK( setup_osborne1 )
r10326r10327
472472   /* Configure the 6850 ACIA */
473473//  acia6850_config( 0, &osborne1_6850_config );
474474   state->video_timer = machine->scheduler().timer_alloc(FUNC(osborne1_video_callback));
475   timer_adjust_oneshot(state->video_timer, machine->primary_screen->time_until_pos(1, 0 ), 0);
475   state->video_timer->adjust(machine->primary_screen->time_until_pos(1, 0 ));
476476
477477   machine->scheduler().timer_set(attotime::zero, FUNC(setup_osborne1));
478478}
src/mess/machine/hecdisk2.c
r10326r10327
195195if ((hector_disc2_RNMI==1) &&  (NMI_current_state==1)) 
196196   {
197197      cputag_set_input_line(machine, "disc2cpu", INPUT_LINE_NMI, CLEAR_LINE); // Clear NMI...
198      timer_adjust_oneshot(DMA_timer, attotime::from_usec(6), 0 );//a little time to let the Z80 terminate he's previous job !
198      DMA_timer->adjust(attotime::from_usec(6) );//a little time to let the Z80 terminate he's previous job !
199199      NMI_current_state=0;
200200   }
201201}
r10326r10327
224224{
225225   cputag_set_input_line(device->machine, "disc2cpu", INPUT_LINE_IRQ0, CLEAR_LINE);
226226   if (state)
227      timer_adjust_oneshot(INT_timer, attotime::from_usec(500), 0 );//a little time to let the Z80 terminate he's previous job !
227      INT_timer->adjust(attotime::from_usec(500) );//a little time to let the Z80 terminate he's previous job !
228228}
229229
230230static WRITE_LINE_DEVICE_HANDLER( hector_disc2_fdc_dma_irq )
src/mess/machine/wd17xx.c
r10326r10327
553553      else
554554      {
555555         /* requeue us for more data */
556         timer_adjust_oneshot(w->timer_data, attotime::from_usec(wd17xx_dden(device) ? 128 : 32), 0);
556         w->timer_data->adjust(attotime::from_usec(wd17xx_dden(device) ? 128 : 32));
557557      }
558558   }
559559   else
r10326r10327
569569
570570   w->status |= STA_1_BUSY;
571571
572   timer_adjust_oneshot(w->timer_cmd, duration, 0);
572   w->timer_cmd->adjust(duration);
573573}
574574
575575
r10326r10327
10361036    usecs   = w->complete_command_delay;
10371037
10381038   /* set new timer */
1039   timer_adjust_oneshot(w->timer_cmd, attotime::from_usec(usecs), 0);
1039   w->timer_cmd->adjust(attotime::from_usec(usecs));
10401040   
10411041   /* Kill onshot read/write sector timers */
1042   timer_adjust_oneshot(w->timer_rs, attotime::never, 0);
1043   timer_adjust_oneshot(w->timer_ws, attotime::never, 0);
1042   w->timer_rs->adjust(attotime::never);
1043   w->timer_ws->adjust(attotime::never);
10441044}
10451045
10461046
r10326r10327
11891189   wd1770_state *w = get_safe_token(device);
11901190
11911191   /* set new timer */
1192   timer_adjust_oneshot(w->timer_data, attotime::from_usec(wd17xx_dden(device) ? 128 : 32), 0);
1192   w->timer_data->adjust(attotime::from_usec(wd17xx_dden(device) ? 128 : 32));
11931193}
11941194
11951195
r10326r10327
12001200   wd1770_state *w = get_safe_token(device);
12011201
12021202   /* set new timer */
1203   timer_adjust_oneshot(w->timer_rs, attotime::from_usec(w->pause_time), 0);
1203   w->timer_rs->adjust(attotime::from_usec(w->pause_time));
12041204}
12051205
12061206
r10326r10327
12111211   wd1770_state *w = get_safe_token(device);
12121212
12131213   /* set new timer */
1214   timer_adjust_oneshot(w->timer_ws, attotime::from_usec(w->pause_time), 0);
1214   w->timer_ws->adjust(attotime::from_usec(w->pause_time));
12151215}
12161216
12171217
src/mess/machine/sms.c
r10326r10327
175175      else
176176         break;
177177   }
178   timer_adjust_oneshot(timer, machine->first_screen()->time_until_pos(beam_y, beam_x), 0);
178   timer->adjust(machine->first_screen()->time_until_pos(beam_y, beam_x));
179179
180180   return result;
181181}
r10326r10327
278278   {
279279      /* enable crosshair */
280280      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL);
281      if (!timer_enabled(state->lphaser_1_timer))
281      if (!state->lphaser_1_timer->enabled())
282282         lphaser1_sensor_check(machine);
283283   }
284284   else
285285   {
286286      /* disable crosshair */
287287      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE);
288      timer_enable(state->lphaser_1_timer, 0);
288      state->lphaser_1_timer->enable(0);
289289   }
290290   
291291   if ((input_port_read_safe(machine, "CTRLSEL", 0x00) & 0xf0) == 0x10)
292292   {
293293      /* enable crosshair */
294294      crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_ALL);
295      if (!timer_enabled(state->lphaser_2_timer))
295      if (!state->lphaser_2_timer->enabled())
296296         lphaser2_sensor_check(machine);
297297   }
298298   else
299299   {
300300      /* disable crosshair */
301301      crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_NONE);
302      timer_enable(state->lphaser_2_timer, 0);
302      state->lphaser_2_timer->enable(0);
303303   }
304304}
305305
r10326r10327
17061706
17071707   machine->add_notifier(MACHINE_NOTIFY_EXIT, sms_machine_stop);
17081708   state->rapid_fire_timer = machine->scheduler().timer_alloc(FUNC(rapid_fire_callback));
1709   timer_adjust_periodic(state->rapid_fire_timer, attotime::from_hz(10), 0, attotime::from_hz(10));
1709   state->rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));
17101710
17111711   state->lphaser_1_timer = machine->scheduler().timer_alloc(FUNC(lphaser_1_callback));
17121712   state->lphaser_2_timer = machine->scheduler().timer_alloc(FUNC(lphaser_2_callback));
src/mess/machine/poly88.c
r10326r10327
2424   poly88_state *state = space->machine->driver_data<poly88_state>();
2525   logerror("poly88_baud_rate_w %02x\n",data);
2626   state->usart_timer = space->machine->scheduler().timer_alloc(FUNC(poly88_usart_timer_callback));
27   timer_adjust_periodic(state->usart_timer, attotime::zero, 0, attotime::from_hz(300));
27   state->usart_timer->adjust(attotime::zero, 0, attotime::from_hz(300));
2828
2929}
3030
r10326r10327
210210   state->previous_level = 0;;
211211   state->clk_level = state->clk_level_tape = 1;
212212   state->cassette_timer = machine->scheduler().timer_alloc(FUNC(poly88_cassette_timer_callback));
213   timer_adjust_periodic(state->cassette_timer, attotime::zero, 0, attotime::from_hz(600));
213   state->cassette_timer->adjust(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);
src/mess/machine/nes_pcb.c
r10326r10327
91279127            if (!state->IRQ_enable && (data & 0x02))
91289128            {
91299129               state->IRQ_enable = 1;
9130               timer_adjust_oneshot(state->irq_timer, downcast<cpu_device *>(state->maincpu)->cycles_to_attotime(24576), 0);
9130               state->irq_timer->adjust(downcast<cpu_device *>(state->maincpu)->cycles_to_attotime(24576));
91319131            }
91329132            if (!(data & 0x02))
91339133            {
91349134               state->IRQ_enable = 0;
9135               timer_adjust_oneshot(state->irq_timer, attotime::never, 0);
9135               state->irq_timer->adjust(attotime::never);
91369136            }
91379137            break;
91389138      }
src/mess/machine/rp5c01a.c
r10326r10327
161161   case RP5C01A_REGISTER_MODE:
162162      rp5c01a->mode = data;
163163
164      timer_enable(rp5c01a->clock_timer, data & RP5C01A_MODE_TIMER_EN);
164      rp5c01a->clock_timer->enable(data & RP5C01A_MODE_TIMER_EN);
165165
166166      if (LOG)
167167      {
r10326r10327
187187         }
188188      }
189189
190      timer_enable(rp5c01a->alarm_timer, !(data & RP5C01A_RESET_16_HZ));
190      rp5c01a->alarm_timer->enable(!(data & RP5C01A_RESET_16_HZ));
191191
192192      if (LOG)
193193      {
r10326r10327
338338
339339   /* create the timers */
340340   rp5c01a->clock_timer = device->machine->scheduler().timer_alloc(FUNC(clock_tick), (void *)device);
341   timer_adjust_periodic(rp5c01a->clock_timer, attotime::zero, 0, attotime::from_hz(1));
341   rp5c01a->clock_timer->adjust(attotime::zero, 0, attotime::from_hz(1));
342342
343343   rp5c01a->alarm_timer = device->machine->scheduler().timer_alloc(FUNC(alarm_tick), (void *)device);
344   timer_adjust_periodic(rp5c01a->alarm_timer, attotime::zero, 0, attotime::from_hz(16));
345   timer_enable(rp5c01a->alarm_timer, 0);
344   rp5c01a->alarm_timer->adjust(attotime::zero, 0, attotime::from_hz(16));
345   rp5c01a->alarm_timer->enable(0);
346346
347347   /* register for state saving */
348348    state_save_register_global(device->machine, rp5c01a->mode);
src/mess/machine/samcoupe.c
r10326r10327
187187   UINT8 result;
188188
189189   /* on a read, reset the timer */
190   timer_adjust_oneshot(state->mouse_reset, attotime::from_usec(50), 0);
190   state->mouse_reset->adjust(attotime::from_usec(50));
191191
192192   /* update when we are about to read the first real values */
193193   if (state->mouse_index == 2)
r10326r10327
233233
234234   /* schedule our video updates */
235235   state->video_update_timer = machine->scheduler().timer_alloc(FUNC(sam_video_update_callback));
236   timer_adjust_oneshot(state->video_update_timer, machine->primary_screen->time_until_pos(0, 0), 0);
236   state->video_update_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
237237}
238238
239239/***************************************************************************
src/mess/machine/comx35.c
r10326r10327
634634   m_iden = 1;
635635   m_cdp1802_ef4 = CLEAR_LINE;
636636
637   timer_adjust_oneshot(m_reset_timer, attotime::from_msec(t), 0);
637   m_reset_timer->adjust(attotime::from_msec(t));
638638}
639639
640640INPUT_CHANGED( comx35_reset )
src/mess/machine/trs80.c
r10326r10327
909909   state->nmi_data=0xff;
910910
911911   state->cassette_data_timer = machine->scheduler().timer_alloc(FUNC(cassette_data_callback));
912   timer_adjust_periodic( state->cassette_data_timer, attotime::zero, 0, attotime::from_hz(11025) );
912   state->cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) );
913913   state->printer = machine->device("centronics");
914914   state->ay31015 = machine->device("tr1602");
915915   state->cass = machine->device("cassette");
src/mess/machine/tandy1t.c
r10326r10327
261261{
262262   UINT8 data = 0xFF;
263263
264   logerror( "%s: tandy1000_bank_r: offset = %x\n", cpuexec_describe_context(space->machine), offset );
264   logerror( "%s: tandy1000_bank_r: offset = %x\n", space->machine->describe_context(), offset );
265265
266266   switch( offset )
267267   {
r10326r10327
276276
277277WRITE8_HANDLER( tandy1000_bank_w )
278278{
279   logerror( "%s: tandy1000_bank_w: offset = %x, data = %02x\n", cpuexec_describe_context(space->machine), offset, data );
279   logerror( "%s: tandy1000_bank_w: offset = %x, data = %02x\n", space->machine->describe_context(), offset, data );
280280
281281   switch( offset )
282282   {
src/mess/machine/msm58321.c
r10326r10327
321321
322322   /* create busy timer */
323323   msm58321->busy_timer = device->machine->scheduler().timer_alloc(FUNC(busy_tick), (void *)device);
324   timer_adjust_periodic(msm58321->busy_timer, attotime::zero, 0, attotime::from_hz(2));
324   msm58321->busy_timer->adjust(attotime::zero, 0, attotime::from_hz(2));
325325
326326   /* register for state saving */
327327   state_save_register_device_item(device, 0, msm58321->cs1);
src/mess/machine/pf10.c
r10326r10327
135135/* serial interface in (to the host computer) */
136136READ_LINE_DEVICE_HANDLER( pf10_txd1_r )
137137{
138   logerror("%s: pf10_txd1_r\n", cpuexec_describe_context(device->machine));
138   logerror("%s: pf10_txd1_r\n", device->machine->describe_context());
139139
140140   return 0;
141141}
142142
143143WRITE_LINE_DEVICE_HANDLER( pf10_rxd1_w )
144144{
145   logerror("%s: pf10_rxd1_w %u\n", cpuexec_describe_context(device->machine), state);
145   logerror("%s: pf10_rxd1_w %u\n", device->machine->describe_context(), state);
146146}
147147
148148
149149/* serial interface out (to another floppy drive) */
150150READ_LINE_DEVICE_HANDLER( pf10_txd2_r )
151151{
152   logerror("%s: pf10_txd2_r\n", cpuexec_describe_context(device->machine));
152   logerror("%s: pf10_txd2_r\n", device->machine->describe_context());
153153
154154   return 0;
155155}
156156
157157WRITE_LINE_DEVICE_HANDLER( pf10_rxd2_w )
158158{
159   logerror("%s: pf10_rxd2_w %u\n", cpuexec_describe_context(device->machine), state);
159   logerror("%s: pf10_rxd2_w %u\n", device->machine->describe_context(), state);
160160}
161161
162162DEFINE_LEGACY_DEVICE(PF10, pf10);
src/mess/machine/i8155.c
r10326r10327
348348   m_status &= ~STATUS_TIMER;
349349
350350   // stop counting
351   timer_enable(m_timer, 0);
351   m_timer->enable(0);
352352
353353   // clear timer output
354354   m_to = 1;
r10326r10327
379379      {
380380      case COMMAND_TM_STOP_AFTER_TC:
381381         // stop timer
382         timer_enable(m_timer, 0);
382         m_timer->enable(0);
383383
384384         if (LOG) logerror("8155 '%s' Timer Stopped\n", tag());
385385         break;
r10326r10327
495495      case COMMAND_TM_STOP:
496496         // NOP if timer has not started, stop counting if the timer is running
497497         if (LOG) logerror("8155 '%s' Timer Command: Stop\n", tag());
498         timer_enable(m_timer, 0);
498         m_timer->enable(0);
499499         break;
500500
501501      case COMMAND_TM_STOP_AFTER_TC:
r10326r10327
506506      case COMMAND_TM_START:
507507         if (LOG) logerror("8155 '%s' Timer Command: Start\n", tag());
508508
509         if (timer_enabled(m_timer))
509         if (m_timer->enabled())
510510         {
511511            // if timer is running, start the new mode and CNT length immediately after present TC is reached
512512         }
r10326r10327
514514         {
515515            // load mode and CNT length and start immediately after loading (if timer is not running)
516516            m_counter = m_count_length;
517            timer_adjust_periodic(m_timer, attotime::zero, 0, attotime::from_hz(clock()));
517            m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
518518         }
519519         break;
520520      }
src/mess/machine/mm74c922.c
r10326r10327
212212
213213   /* create the timers */
214214   mm74c922->scan_timer = device->machine->scheduler().timer_alloc(FUNC(mm74c922_scan_tick), (void *)device);
215   timer_adjust_periodic(mm74c922->scan_timer, attotime::zero, 0, attotime::from_hz(50));
215   mm74c922->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
216216
217217   /* register for state saving */
218218   state_save_register_device_item(device, 0, mm74c922->inhibit);
src/mess/machine/compis.c
r10326r10327
540540   if (!state->i186.intr.pending)
541541      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
542542   state->i186.intr.pending = 1;
543   cpuexec_trigger(machine, CPU_RESUME_TRIGGER);
543   machine->scheduler().trigger(CPU_RESUME_TRIGGER);
544544   if (LOG_OPTIMIZATION) logerror("  - trigger due to interrupt pending\n");
545545   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine->time().as_double(), new_vector);
546546}
r10326r10327
636636   if (t->control & 0x0001)
637637   {
638638      int count = t->maxA ? t->maxA : 0x10000;
639      timer_adjust_oneshot(t->int_timer, attotime::from_hz(2000000) * count, which);
639      t->int_timer->adjust(attotime::from_hz(2000000) * count, which);
640640      if (LOG_TIMER) logerror("  Repriming interrupt\n");
641641   }
642642   else
643      timer_adjust_oneshot(t->int_timer, attotime::never, which);
643      t->int_timer->adjust(attotime::never, which);
644644}
645645
646646
r10326r10327
652652   /* if we have a timing timer running, adjust the count */
653653   if (t->time_timer_active)
654654   {
655      attotime current_time = timer_timeelapsed(t->time_timer);
655      attotime current_time = t->time_timer->elapsed();
656656      int net_clocks = ((current_time - t->last_time) * 2000000).seconds;
657657      t->last_time = current_time;
658658
r10326r10327
753753            internal_timer_sync(machine, which);
754754
755755            /* nuke the timer and force the interrupt timer to be recomputed */
756            timer_adjust_oneshot(t->time_timer, attotime::never, which);
756            t->time_timer->adjust(attotime::never, which);
757757            t->time_timer_active = 0;
758758            update_int_timer = 1;
759759         }
r10326r10327
762762         else if ((diff & 0x8000) && (new_control & 0x8000))
763763         {
764764            /* start the timing */
765            timer_adjust_oneshot(t->time_timer, attotime::never, which);
765            t->time_timer->adjust(attotime::never, which);
766766            t->time_timer_active = 1;
767767            update_int_timer = 1;
768768         }
r10326r10327
787787              int diff = t->maxA - t->count;
788788              if (diff <= 0)
789789                 diff += 0x10000;
790              timer_adjust_oneshot(t->int_timer, attotime::from_hz(2000000) * diff, which);
790              t->int_timer->adjust(attotime::from_hz(2000000) * diff, which);
791791              if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which);
792792          }
793793          else
794794          {
795              timer_adjust_oneshot(t->int_timer, attotime::never, which);
795              t->int_timer->adjust(attotime::never, which);
796796          }
797797   }
798798}
r10326r10327
874874         if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
875875
876876         d->finished = 0;
877/*          timer_adjust_oneshot(d->finish_timer,
877/*          d->finish_timer->adjust(
878878         attotime::from_hz(dac[dacnum].frequency) * (double)count, which);*/
879879      }
880880   }
src/mess/machine/corvushd.c
r10326r10327
13571357   // Set up timers for command completion and timeout from host
13581358   //
13591359   machine->scheduler().timer_set(attotime::from_usec(c->delay), FUNC(corvus_hdc_callback), CALLBACK_CTH_MODE);
1360   timer_enable(c->timeout_timer, 0);         // We've received enough data, disable the timeout timer
1360   c->timeout_timer->enable(0);         // We've received enough data, disable the timeout timer
13611361
13621362   c->delay = 0;                           // Reset delay for next function
13631363}
r10326r10327
14171417         assert(0);
14181418   }
14191419   if(function != CALLBACK_SAME_MODE) {
1420      timer_enable(c->timeout_timer, 0);            // Disable the four-second timer now that we're done
1420      c->timeout_timer->enable(0);            // Disable the four-second timer now that we're done
14211421   }
14221422}
14231423
r10326r10327
14561456   c->recv_bytes = 0;                     // We aren't waiting on additional data from the host
14571457
14581458   c->timeout_timer = machine->scheduler().timer_alloc(FUNC(corvus_hdc_callback));   // Set up a timer to handle the four-second host-to-controller timeout
1459   timer_adjust_oneshot(c->timeout_timer, attotime::from_seconds(4), CALLBACK_TIMEOUT);
1460   timer_enable(c->timeout_timer, 0);      // Start this timer out disabled
1459   c->timeout_timer->adjust(attotime::from_seconds(4), CALLBACK_TIMEOUT);
1460   c->timeout_timer->enable(0);      // Start this timer out disabled
14611461
14621462   LOG(("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors));
14631463
r10326r10327
16741674   if(c->offset == 0)   {                                       // First byte of a packet
16751675      LOG(("corvus_hdc_data_w: Received a byte with c->offset == 0.  Processing as command: 0x%2.2x\n", data));
16761676      c->invalid_command_flag = parse_hdc_command(data);
1677      timer_reset(c->timeout_timer, (attotime::from_seconds(4)));
1678      timer_enable(c->timeout_timer, 1);                        // Start our four-second timer
1677      c->timeout_timer->reset((attotime::from_seconds(4)));
1678      c->timeout_timer->enable(1);                        // Start our four-second timer
16791679   } else if(c->offset == 1 && c->awaiting_modifier) {                  // Second byte of a packet
16801680      LOG(("corvus_hdc_data_w: Received a byte while awaiting modifier with c->offset == 0.  Processing as modifier: 0x%2.2x\n", data));
16811681      c->awaiting_modifier = FALSE;
r10326r10327
16981698      //
16991699      // Reset the four-second timer since we received some data
17001700      //
1701      timer_reset(c->timeout_timer, (attotime::from_seconds(4)));
1701      c->timeout_timer->reset((attotime::from_seconds(4)));
17021702
17031703      //
17041704      // Make the controller busy for a few microseconds while the command is processed
src/mess/machine/c1551.c
r10326r10327
209209      }
210210
211211      floppy_mon_w(c1551->image, !mtr);
212      timer_enable(c1551->bit_timer, mtr);
212      c1551->bit_timer->enable(mtr);
213213
214214      c1551->mtr = mtr;
215215   }
r10326r10327
317317
318318   if (c1551->ds != ds)
319319   {
320      timer_adjust_periodic(c1551->bit_timer, attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
320      c1551->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
321321      c1551->ds = ds;
322322   }
323323}
src/mess/machine/wswan.c
r10326r10327
198198   state->system_type = TYPE_WSWAN;
199199   machine->add_notifier(MACHINE_NOTIFY_EXIT, wswan_machine_stop );
200200   state->vdp.timer = machine->scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &state->vdp );
201   timer_adjust_periodic( state->vdp.timer, attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
201   state->vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
202202
203203   wswan_setup_bios(machine);
204204
r10326r10327
214214   state->system_type = TYPE_WSC;
215215   machine->add_notifier(MACHINE_NOTIFY_EXIT, wswan_machine_stop );
216216   state->vdp.timer = machine->scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &state->vdp );
217   timer_adjust_periodic( state->vdp.timer, attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
217   state->vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
218218
219219   wswan_setup_bios(machine);
220220
src/mess/machine/zx.c
r10326r10327
411411
412412   if (offs == 0xfd)
413413   {
414      timer_reset(state->ula_nmi, attotime::never);
414      state->ula_nmi->reset();
415415
416416      LOG_ZX81_IOW("ULA NMIs off");
417417   }
418418   else
419419   if (offs == 0xfe)
420420   {
421      timer_adjust_periodic(state->ula_nmi, attotime::zero, 0, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(207));
421      state->ula_nmi->adjust(attotime::zero, 0, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(207));
422422
423423      LOG_ZX81_IOW("ULA NMIs on");
424424
src/mess/machine/z80ne.c
r10326r10327
617617         (motor_b) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
618618
619619      if (motor_a || motor_b)
620         timer_adjust_periodic(state->cassette_timer, attotime::zero, 0, attotime::from_hz(LX385_TAPE_SAMPLE_FREQ));
620         state->cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(LX385_TAPE_SAMPLE_FREQ));
621621      else
622         timer_adjust_oneshot(state->cassette_timer, attotime::zero, 0);
622         state->cassette_timer->adjust(attotime::zero);
623623   }
624624}
625625
src/mess/machine/upd1990a.c
r10326r10327
142142         if (LOG) logerror("UPD1990A Register Hold Mode\n");
143143
144144         /* enable time counter */
145         timer_enable(upd1990a->clock_timer, 1);
145         upd1990a->clock_timer->enable(1);
146146
147147         /* 1 Hz data out pulse */
148148         upd1990a->data_out = 1;
149         timer_adjust_periodic(upd1990a->data_out_timer, attotime::zero, 0, attotime::from_hz(1*2));
149         upd1990a->data_out_timer->adjust(attotime::zero, 0, attotime::from_hz(1*2));
150150
151151         /* 64 Hz time pulse */
152         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(64*2));
152         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(64*2));
153153         break;
154154
155155      case UPD1990A_MODE_SHIFT:
156156         if (LOG) logerror("UPD1990A Shift Mode\n");
157157
158158         /* enable time counter */
159         timer_enable(upd1990a->clock_timer, 1);
159         upd1990a->clock_timer->enable(1);
160160
161161         /* disable data out pulse */
162         timer_enable(upd1990a->data_out_timer, 0);
162         upd1990a->data_out_timer->enable(0);
163163
164164         /* output LSB of shift register */
165165         upd1990a->data_out = BIT(upd1990a->shift_reg[0], 0);
166166         devcb_call_write_line(&upd1990a->out_data_func, upd1990a->data_out);
167167
168168         /* 32 Hz time pulse */
169         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(32*2));
169         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(32*2));
170170         break;
171171
172172      case UPD1990A_MODE_TIME_SET:
r10326r10327
177177         if (LOG) logerror("UPD1990A Shift Register %02x%02x%02x%02x%02x\n", upd1990a->shift_reg[4], upd1990a->shift_reg[3], upd1990a->shift_reg[2], upd1990a->shift_reg[1], upd1990a->shift_reg[0]);
178178
179179         /* disable time counter */
180         timer_enable(upd1990a->clock_timer, 0);
180         upd1990a->clock_timer->enable(0);
181181
182182         /* disable data out pulse */
183         timer_enable(upd1990a->data_out_timer, 0);
183         upd1990a->data_out_timer->enable(0);
184184
185185         /* output LSB of shift register */
186186         upd1990a->data_out = BIT(upd1990a->shift_reg[0], 0);
r10326r10327
193193         }
194194
195195         /* 32 Hz time pulse */
196         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(32*2));
196         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(32*2));
197197         }
198198         break;
199199
r10326r10327
204204         if (LOG) logerror("UPD1990A Time Read Mode\n");
205205
206206         /* enable time counter */
207         timer_enable(upd1990a->clock_timer, 1);
207         upd1990a->clock_timer->enable(1);
208208
209209         /* load time counter data into shift register */
210210         for (i = 0; i < 5; i++)
r10326r10327
216216
217217         /* 512 Hz data out pulse */
218218         upd1990a->data_out = 1;
219         timer_adjust_periodic(upd1990a->data_out_timer, attotime::zero, 0, attotime::from_hz(512*2));
219         upd1990a->data_out_timer->adjust(attotime::zero, 0, attotime::from_hz(512*2));
220220
221221         /* 32 Hz time pulse */
222         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(32*2));
222         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(32*2));
223223         }
224224         break;
225225
r10326r10327
227227         if (LOG) logerror("UPD1990A TP = 64 Hz Set Mode\n");
228228
229229         /* 64 Hz time pulse */
230         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(64*2));
230         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(64*2));
231231         break;
232232
233233      case UPD1990A_MODE_TP_256HZ_SET:
234234         if (LOG) logerror("UPD1990A TP = 256 Hz Set Mode\n");
235235
236236         /* 256 Hz time pulse */
237         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(256*2));
237         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(256*2));
238238         break;
239239
240240      case UPD1990A_MODE_TP_2048HZ_SET:
241241         if (LOG) logerror("UPD1990A TP = 2048 Hz Set Mode\n");
242242
243243         /* 2048 Hz time pulse */
244         timer_adjust_periodic(upd1990a->tp_timer, attotime::zero, 0, attotime::from_hz(2048*2));
244         upd1990a->tp_timer->adjust(attotime::zero, 0, attotime::from_hz(2048*2));
245245         break;
246246
247247      case UPD1990A_MODE_TEST:
r10326r10327
496496
497497   /* create the timers */
498498   upd1990a->clock_timer = device->machine->scheduler().timer_alloc(FUNC(clock_tick), (void *)device);
499   timer_adjust_periodic(upd1990a->clock_timer, attotime::zero, 0, attotime::from_hz(1));
499   upd1990a->clock_timer->adjust(attotime::zero, 0, attotime::from_hz(1));
500500
501501   upd1990a->tp_timer = device->machine->scheduler().timer_alloc(FUNC(tp_tick), (void *)device);
502502
src/mess/machine/apple2gs.c
r10326r10327
786786         apple2_interrupt(machine->device("maincpu"));
787787   }
788788
789   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos((scanline+1)%262, 0), 0);
789   state->scanline_timer->adjust(machine->primary_screen->time_until_pos((scanline+1)%262, 0));
790790}
791791
792792
r10326r10327
18031803   state_save_register_item(machine, "SNDGLUDUMMYRD", NULL,0, state->sndglu_dummy_read);
18041804
18051805   state->clock_timer = machine->scheduler().timer_alloc(FUNC(apple2gs_clock_tick));
1806   timer_adjust_periodic(state->clock_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
1806   state->clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
18071807
18081808   state->qsecond_timer = machine->scheduler().timer_alloc(FUNC(apple2gs_qsecond_tick));
1809   timer_adjust_periodic(state->qsecond_timer, attotime::from_usec(266700), 0, attotime::from_usec(266700));
1809   state->qsecond_timer->adjust(attotime::from_usec(266700), 0, attotime::from_usec(266700));
18101810
18111811   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(apple2gs_scanline_tick));
1812   timer_adjust_oneshot(state->scanline_timer, attotime::never, 0);
1812   state->scanline_timer->adjust(attotime::never);
18131813
18141814   // fire on scanline zero
1815   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->time_until_pos(0, 0), 0);
1815   state->scanline_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
18161816}
src/mess/machine/mac.c
r10326r10327
778778      if (mac->m_keyboard_reply == 0x7B)
779779      {
780780         /* if NULL, wait until key pressed or timeout */
781         timer_adjust_oneshot(mac->m_inquiry_timeout,
781         mac->m_inquiry_timeout->adjust(
782782            attotime(0, DOUBLE_TO_ATTOSECONDS(0.25)), 0);
783783      }
784784      break;
r10326r10327
19091909   mac->m_adb_timer_ticks--;
19101910   if (!mac->m_adb_timer_ticks)
19111911   {
1912      timer_adjust_oneshot(mac->adb_timer, attotime::never, 0);
1912      mac->adb_timer->adjust(attotime::never);
19131913
19141914      if ((mac->m_adb_direction) && (ADB_IS_BITBANG))
19151915      {
r10326r10327
19571957            }
19581958
19591959//              mac->m_adb_timer_ticks = 8;
1960//              timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
1960//              mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
19611961
19621962            if ((mac->m_adb_datasize == 0) && (mac->m_adb_streaming == MCU_STREAMING_NONE))
19631963            {
r10326r10327
19831983   }
19841984   else
19851985   {
1986      timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(200)), 0);
1986      mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
19871987   }
19881988}
19891989
r10326r10327
20272027            mac->m_adb_direction = 1;   // Mac is shifting us a command
20282028            mac->m_adb_waiting_cmd = 1;   // we're going to get a command
20292029            mac->m_adb_irq_pending = 0;
2030            timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2030            mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
20312031            break;
20322032
20332033         case ADB_STATE_XFER_EVEN:
r10326r10327
20572057               mac->m_adb_irq_pending = 1;
20582058            }
20592059
2060            timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2060            mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
20612061            break;
20622062
20632063         case ADB_STATE_IDLE:
r10326r10327
20762076   mac->m_adb_state |= 1;
20772077   mac->m_adb_timer_ticks = 8;
20782078   mac->m_adb_datasize = 3;
2079   timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2079   mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
20802080}
20812081
20822082static void mac_egret_response_adb(mac_state *mac, int type, int flag, int cmd, int extra)
r10326r10327
20892089   mac->m_adb_state |= 1;
20902090   mac->m_adb_timer_ticks = 8;
20912091   mac->m_adb_datasize = 4;
2092   timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2092   mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
20932093}
20942094
20952095static void mac_egret_response_read_pram(mac_state *mac, int cmd, int addr)
r10326r10327
21042104
21052105   mac->m_adb_state |= 1;
21062106   mac->m_adb_timer_ticks = 8;
2107   timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2107   mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
21082108
21092109   // read PRAM is a "streaming" command, don't drop the state line when we're out of data
21102110   mac->m_adb_streaming = MCU_STREAMING_PRAMRD;
r10326r10327
21262126
21272127   mac->m_adb_state |= 1;
21282128   mac->m_adb_timer_ticks = 8;
2129   timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2129   mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
21302130}
21312131
21322132static void mac_egret_mcu_exec(mac_state *mac)
r10326r10327
22292229         mac->m_adb_buffer[1] = 0;   // spare
22302230         mac->m_adb_state |= 1;
22312231         mac->m_adb_timer_ticks = 8;
2232         timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2232         mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
22332233         break;
22342234
22352235      case 0x0e: // send to DFAC
r10326r10327
22992299      {
23002300         mac->m_adb_command = 0;
23012301         mac->m_adb_timer_ticks = 8;
2302         timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2302         mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
23032303      }
23042304
23052305      // if bit 2 is high and stays high, the falling edge of bit 1, and we're in send phase, the MCU should clock out a byte
23062306      if ((state & 0x04) && (mac->m_adb_state & 0x04) && !(state & 0x02) && (mac->m_adb_state & 0x02) && (mac->m_adb_state & 0x01))
23072307      {
23082308         mac->m_adb_timer_ticks = 8;
2309         timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2309         mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
23102310      }
23112311
23122312      // if bit 2 rises, bit 1 is 0, and MCU XS is high, the MCU should clock out a byte
23132313      if ((state & 0x04) && !(mac->m_adb_state & 0x04) && !(state & 0x02) && (mac->m_adb_state & 0x01))
23142314      {
23152315         mac->m_adb_timer_ticks = 8;
2316         timer_adjust_oneshot(mac->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2316         mac->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
23172317      }
23182318
23192319      // if bit 2 drops and bit 1 is 1, terminate the command
r10326r10327
24242424   mac->m_pm_out[0] = 1;   // length
24252425   mac->m_pm_out[1] = result;
24262426   mac->m_pm_slen = 2;
2427   timer_adjust_oneshot(mac->m_pmu_send_timer, attotime(0, ATTOSECONDS_IN_USEC(200)), 0);
2427   mac->m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
24282428}
24292429
24302430static void pmu_exec(mac_state *mac)
r10326r10327
24602460               mac->m_pm_out[1 + i] = mac->m_rtc_ram[i];
24612461            }
24622462            mac->m_pm_slen = 21;
2463            timer_adjust_oneshot(mac->m_pmu_send_timer, attotime(0, ATTOSECONDS_IN_USEC(200)), 0);
2463            mac->m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
24642464         }
24652465         break;
24662466
r10326r10327
24752475               mac->m_pm_out[1 + i] = mac->m_rtc_ram[mac->m_pm_cmd[2] + i];
24762476            }
24772477            mac->m_pm_slen = mac->m_pm_cmd[3] + 1;
2478            timer_adjust_oneshot(mac->m_pmu_send_timer, attotime(0, ATTOSECONDS_IN_USEC(200)), 0);
2478            mac->m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
24792479         }
24802480         break;
24812481
r10326r10327
25172517            this->adb_talk();
25182518
25192519            m_adb_timer_ticks = 8;
2520            timer_adjust_oneshot(this->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2520            this->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
25212521         }
25222522         else
25232523         {
25242524            m_adb_irq_pending = 1;
25252525            m_adb_command = m_adb_send = 0;
25262526            m_adb_timer_ticks = 1;   // one tick should be sufficient to make it see  the IRQ
2527            timer_adjust_oneshot(this->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2527            this->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
25282528            m_adb_srq_switch = 1;
25292529         }
25302530      }
r10326r10327
25372537            this->adb_talk();
25382538
25392539            m_adb_timer_ticks = 8;
2540            timer_adjust_oneshot(this->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2540            this->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
25412541         }
25422542         else
25432543         {
25442544            m_adb_irq_pending = 1;
25452545            m_adb_command = m_adb_send = 0;
25462546            m_adb_timer_ticks = 1;   // one tick should be sufficient to make it see  the IRQ
2547            timer_adjust_oneshot(this->adb_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2547            this->adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
25482548            m_adb_srq_switch = 1;
25492549         }
25502550      }
r10326r10327
28392839            // another byte to send?
28402840            if (mac->m_pm_slen)
28412841            {
2842               timer_adjust_oneshot(mac->m_pmu_send_timer, attotime(0, ATTOSECONDS_IN_USEC(100)), 0);
2842               mac->m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
28432843            }
28442844            else
28452845            {
28462846               mac->m_pm_state = 0;   // back to receive state
2847               timer_adjust_oneshot(mac->m_pmu_send_timer, attotime::never, 0);
2847               mac->m_pmu_send_timer->adjust(attotime::never);
28482848            }
28492849         }
28502850      }
r10326r10327
30323032   if (has_adb())
30333033   {
30343034      this->adb_timer = machine->scheduler().timer_alloc(FUNC(mac_adb_tick));
3035      timer_adjust_oneshot(this->adb_timer, attotime::never, 0);
3035      this->adb_timer->adjust(attotime::never);
30363036
30373037      // also allocate PMU timer
30383038      if (ADB_IS_PM_CLASS)
30393039      {
30403040         m_pmu_send_timer = machine->scheduler().timer_alloc(FUNC(mac_pmu_tick));
3041         timer_adjust_oneshot(this->adb_timer, attotime::never, 0);
3041         this->adb_timer->adjust(attotime::never);
30423042      }
30433043
30443044   }
30453045   this->scanline_timer = machine->scheduler().timer_alloc(FUNC(mac_scanline_tick));
3046   timer_adjust_oneshot(this->scanline_timer, machine->primary_screen->time_until_pos(0, 0), 0);
3046   this->scanline_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
30473047
30483048   m_6015_timer = machine->scheduler().timer_alloc(FUNC(mac_6015_tick));
3049   timer_adjust_oneshot(m_6015_timer, attotime::never, 0);
3049   m_6015_timer->adjust(attotime::never);
30503050}
30513051
30523052void mac_state::machine_reset()
30533053{
30543054   // stop 60.15 Hz timer
3055   timer_adjust_oneshot(m_6015_timer, attotime::never, 0);
3055   m_6015_timer->adjust(attotime::never);
30563056
30573057   // start 60.15 Hz timer for most systems
30583058   if (((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || (m_model >= MODEL_MAC_LC))
30593059   {
3060      timer_adjust_periodic(m_6015_timer, attotime::from_hz(60.15), 0, attotime::from_hz(60.15));
3060      m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15));
30613061   }
30623062
30633063   // clear PMU response timer
30643064   if (ADB_IS_PM_CLASS)
30653065   {
3066      timer_adjust_oneshot(this->adb_timer, attotime::never, 0);
3066      this->adb_timer->adjust(attotime::never);
30673067   }
30683068
30693069   // default to 32-bit mode on LC
r10326r10327
33423342
33433343         logerror("keyboard enquiry successful, keycode %X\n", keycode);
33443344
3345         timer_reset(m_inquiry_timeout, attotime::never);
3345         m_inquiry_timeout->reset();
33463346         kbd_shift_out(machine, keycode);
33473347      }
33483348   }
r10326r10327
34003400         mac->mouse_callback();
34013401   }
34023402
3403   timer_adjust_oneshot(mac->scanline_timer, machine->primary_screen->time_until_pos((scanline+1) % MAC_V_TOTAL, 0), 0);
3403   mac->scanline_timer->adjust(machine->primary_screen->time_until_pos((scanline+1) % MAC_V_TOTAL, 0));
34043404}
34053405
34063406
src/mess/machine/pcf8593.c
r10326r10327
9191   _logerror( 0, ("pcf8593_init\n"));
9292   memset( rtc, 0, sizeof(*rtc));
9393   rtc->timer = device->machine->scheduler().timer_alloc(FUNC(pcf8593_timer_callback), (void *) device);
94   timer_adjust_periodic(rtc->timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
94   rtc->timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
9595}
9696
9797
src/mess/machine/i8271.c
r10326r10327
265265   i8271_data_request(device);
266266
267267   /* stop it */
268   timer_reset(i8271->data_timer, attotime::never);
268   i8271->data_timer->reset();
269269}
270270
271271/* setup a timed data request - data request will be triggered in a few usecs time */
r10326r10327
277277   usecs = 64;
278278
279279   /* set timers */
280   timer_reset(i8271->command_complete_timer, attotime::never);
281   timer_adjust_oneshot(i8271->data_timer, attotime::from_usec(usecs), 0);
280   i8271->command_complete_timer->reset();
281   i8271->data_timer->adjust(attotime::from_usec(usecs));
282282}
283283
284284
r10326r10327
290290   i8271_command_complete(device,1,1);
291291
292292   /* stop it, but don't allow it to be free'd */
293   timer_reset(i8271->command_complete_timer, attotime::never);
293   i8271->command_complete_timer->reset();
294294}
295295
296296/* setup a irq to occur 128us later - in reality this would be much later, because the int would
r10326r10327
305305   usecs = 64*2;
306306
307307   /* set timers */
308   timer_reset(i8271->data_timer, attotime::never);
309   timer_adjust_oneshot(i8271->command_complete_timer, attotime::from_usec(usecs), 0);
308   i8271->data_timer->reset();
309   i8271->command_complete_timer->adjust(attotime::from_usec(usecs));
310310}
311311
312312static void i8271_set_irq_state(device_t *device,int state)
r10326r10327
15651565   i8271->ParameterCount = 0;
15661566
15671567   /* if timer is active remove */
1568   timer_reset(i8271->command_complete_timer, attotime::never);
1569   timer_reset(i8271->data_timer, attotime::never);
1568   i8271->command_complete_timer->reset();
1569   i8271->data_timer->reset();
15701570
15711571   /* clear irq */
15721572   i8271_set_irq_state(device,0);
src/mess/machine/amigacd.c
r10326r10327
113113   if ( dmac_data.wtc > 0 )
114114   {
115115      matsucd_read_next_block();
116      timer_adjust_oneshot(dmac_data.dma_timer, attotime::from_msec( CD_SECTOR_TIME ), 0);
116      dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME ));
117117   }
118118   else
119119   {
r10326r10327
223223      case 0x70:   /* DMA start strobe */
224224      {
225225         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", cpu_get_pc(space->cpu) ));
226         timer_adjust_oneshot(dmac_data.dma_timer, attotime::from_msec( CD_SECTOR_TIME ), 0);
226         dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME ));
227227      }
228228      break;
229229
230230      case 0x71:   /* DMA stop strobe */
231231      {
232232         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", cpu_get_pc(space->cpu) ));
233         timer_reset( dmac_data.dma_timer, attotime::never );
233         dmac_data.dma_timer->reset( );
234234      }
235235      break;
236236
r10326r10327
350350      case 0x70:   /* DMA start strobe */
351351      {
352352         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", cpu_get_pc(space->cpu) ));
353         timer_adjust_oneshot(dmac_data.dma_timer, attotime::from_msec( CD_SECTOR_TIME ), 0);
353         dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME ));
354354      }
355355      break;
356356
357357      case 0x71:   /* DMA stop strobe */
358358      {
359359         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", cpu_get_pc(space->cpu) ));
360         timer_reset( dmac_data.dma_timer, attotime::never );
360         dmac_data.dma_timer->reset( );
361361      }
362362      break;
363363
r10326r10327
461461   }
462462   else
463463   {
464      timer_adjust_oneshot(tp6525_delayed_timer, attotime::from_msec(1), 0);
464      tp6525_delayed_timer->adjust(attotime::from_msec(1));
465465   }
466466}
467467
r10326r10327
479479      else
480480      {
481481         /* we *have to* deliver the irq, so if we can't, delay it and try again later */
482         timer_adjust_oneshot(tp6525_delayed_timer, attotime::from_msec(1), 0);
482         tp6525_delayed_timer->adjust(attotime::from_msec(1));
483483      }
484484   }
485485}
src/mess/machine/nes.c
r10326r10327
207207{
208208   nes_state *state = machine->driver_data<nes_state>();
209209   cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE);
210   timer_adjust_oneshot(state->irq_timer, attotime::never, 0);
210   state->irq_timer->adjust(attotime::never);
211211}
212212
213213static STATE_POSTLOAD( nes_banks_restore )
src/mess/machine/at29040.c
r10326r10327
9494      /* programming cycle start */
9595      at29c040a[id].s_pgm = s_pgm_3;
9696      /* max delay 10ms, typical delay 5 to 7 ms */
97      timer_adjust_oneshot(at29c040a[id].programming_timer, attotime::from_msec(5), id);
97      at29c040a[id].programming_timer->adjust(attotime::from_msec(5), id);
9898      break;
9999
100100   case s_pgm_3:
r10326r10327
219219      at29c040a[id].s_pgm = s_pgm_0;
220220      at29c040a[id].s_enabling_sdb = FALSE;
221221      at29c040a[id].s_disabling_sdb = FALSE;
222      timer_adjust_oneshot(at29c040a[id].programming_timer, attotime::never, id);
222      at29c040a[id].programming_timer->adjust(attotime::never, id);
223223   }
224224
225225
r10326r10327
254254      {   /* data polling starts the programming cycle (right???) */
255255         at29c040a[id].s_pgm = s_pgm_3;
256256         /* max delay 10ms, typical delay 5 to 7 ms */
257         timer_adjust_oneshot(at29c040a[id].programming_timer, attotime::from_msec(5), id);
257         at29c040a[id].programming_timer->adjust(attotime::from_msec(5), id);
258258      }
259259
260260      reply = at29c040a[id].toggle_bit;
r10326r10327
326326         at29c040a[id].s_pgm = s_pgm_0;
327327         at29c040a[id].s_enabling_sdb = FALSE;
328328         at29c040a[id].s_disabling_sdb = FALSE;
329         timer_adjust_oneshot(at29c040a[id].programming_timer, attotime::never, id);
329         at29c040a[id].programming_timer->adjust(attotime::never, id);
330330
331331         /* process command */
332332         switch (data)
r10326r10327
352352               at29c040a[id].s_pgm = s_pgm_1;
353353               at29c040a[id].s_disabling_sdb = TRUE;
354354               /* set command timeout (right???) */
355               //timer_adjust_periodic(at29c040a[id].programming_timer, attotime::from_usec(150), id, 0.);
355               //at29c040a[id].programming_timer->adjust(attotime::from_usec(150), id, 0.);
356356            }
357357            break;
358358
r10326r10327
372372            at29c040a[id].s_pgm = s_pgm_1;
373373            at29c040a[id].s_enabling_sdb = TRUE;
374374            /* set command timeout (right???) */
375            //timer_adjust_periodic(at29c040a[id].programming_timer, attotime::from_usec(150), id, 0.);
375            //at29c040a[id].programming_timer->adjust(attotime::from_usec(150), id, 0.);
376376            break;
377377
378378         case 0xf0:
r10326r10327
401401      at29c040a[id].s_pgm = s_pgm_0;
402402      at29c040a[id].s_enabling_sdb = FALSE;
403403      at29c040a[id].s_disabling_sdb = FALSE;
404      timer_adjust_oneshot(at29c040a[id].programming_timer, attotime::never, id);
404      at29c040a[id].programming_timer->adjust(attotime::never, id);
405405   }
406406
407407   if (((at29c040a[id].s_pgm == s_pgm_0) && ! at29c040a[id].s_sdp)
r10326r10327
427427      /* write data to programming buffer */
428428      at29c040a[id].programming_buffer[offset & 0xff] = data;
429429      at29c040a[id].programming_last_offset = offset;
430      timer_adjust_oneshot(at29c040a[id].programming_timer, attotime::from_usec(150), id);
430      at29c040a[id].programming_timer->adjust(attotime::from_usec(150), id);
431431   }
432432}
433433
src/mess/machine/adc080x.c
r10326r10327
150150
151151   /* allocate cycle timer */
152152   adc080x->cycle_timer = device->machine->scheduler().timer_alloc(FUNC(cycle_tick), (void *)device);
153   timer_adjust_periodic(adc080x->cycle_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
153   adc080x->cycle_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock()));
154154
155155   /* register for state saving */
156156   state_save_register_item(device->machine, "adc080x", device->tag(), 0, adc080x->address);
src/mess/machine/vectrex.c
r10326r10327
335335
336336         if (state->imager_freq > 1)
337337         {
338            timer_adjust_periodic(state->imager_timer,
339                             attotime::from_double(MIN(1.0 / state->imager_freq, timer_timeleft(state->imager_timer).as_double())),
338            state->imager_timer->adjust(
339                             attotime::from_double(MIN(1.0 / state->imager_freq, state->imager_timer->remaining().as_double())),
340340                             2,
341341                             attotime::from_double(1.0 / state->imager_freq));
342342         }
src/mess/machine/dc.c
r10326r10327
8080{
8181   UINT8 sector_buffer[ 4096 ];
8282
83   timer_adjust_oneshot(atapi_timer, attotime::never, 0);
83   atapi_timer->adjust(attotime::never);
8484
8585   printf("atapi_xfer_end atapi_xferlen = %d, atapi_xfermod=%d\n", atapi_xfermod, atapi_xferlen );
8686
r10326r10327
126126      atapi_regs[ATAPI_REG_COUNTLOW] = atapi_xferlen & 0xff;
127127      atapi_regs[ATAPI_REG_COUNTHIGH] = (atapi_xferlen>>8)&0xff;
128128
129      timer_adjust_oneshot(atapi_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
129      atapi_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))));
130130   }
131131   else
132132   {
r10326r10327
369369
370370               case 0x45: // PLAY
371371                  atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_BSY;
372                  timer_adjust_oneshot( atapi_timer, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(ATAPI_CYCLES_PER_SECTOR ), 0 );
372                  atapi_timer->adjust( downcast<cpu_device *>(space->cpu)->cycles_to_attotime(ATAPI_CYCLES_PER_SECTOR ) );
373373                  break;
374374            }
375375
r10326r10327
546546   atapi_cdata_wait = 0;
547547
548548   atapi_timer = machine->scheduler().timer_alloc(FUNC(atapi_xfer_end));
549   timer_adjust_oneshot(atapi_timer, attotime::never, 0);
549   atapi_timer->adjust(attotime::never);
550550
551551   gdrom_device = NULL;
552552
r10326r10327
670670   // non 32-bit accesses have not yet been seen here, we need to know when they are
671671   if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
672672   {
673      mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine));
673      mame_printf_verbose("%s:Wrong mask!\n", machine->describe_context());
674674//      debugger_break(machine);
675675   }
676676
r10326r10327
717717         }
718718
719719         atapi_xferbase = g1bus_regs[SB_GDSTAR];
720         timer_adjust_oneshot(atapi_timer, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
720         atapi_timer->adjust(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))));
721721      }
722722      break;
723723   }
src/mess/machine/lisa.c
r10326r10327
565565
566566      case 0x7:   /* send mouse command */
567567         if (immediate & 0x8)
568            timer_adjust_periodic(state->mouse_timer, attotime::zero, 0, attotime::from_msec((immediate & 0x7)*4)); /* enable mouse */
568            state->mouse_timer->adjust(attotime::zero, 0, attotime::from_msec((immediate & 0x7)*4)); /* enable mouse */
569569         else
570            timer_reset(state->mouse_timer, attotime::never);
570            state->mouse_timer->reset();
571571         break;
572572      }
573573   }
r10326r10327
626626   for (i=0; i<8; i++)
627627      state->key_matrix[i] = 0;
628628
629   timer_reset(state->mouse_timer, attotime::never);
629   state->mouse_timer->reset();
630630}
631631
632632static void unplug_keyboard(running_machine *machine)
src/mess/machine/sym1.c
r10326r10327
3434static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_0_w )
3535{
3636   sym1_state *drvstate = device->machine->driver_data<sym1_state>();
37   if (state) timer_adjust_oneshot(drvstate->led_update, LED_REFRESH_DELAY, 0);
37   if (state) drvstate->led_update->adjust(LED_REFRESH_DELAY);
3838}
3939
4040
4141static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_1_w )
4242{
4343   sym1_state *drvstate = device->machine->driver_data<sym1_state>();
44   if (state) timer_adjust_oneshot(drvstate->led_update, LED_REFRESH_DELAY, 1);
44   if (state) drvstate->led_update->adjust(LED_REFRESH_DELAY, 1);
4545}
4646
4747
4848static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_2_w )
4949{
5050   sym1_state *drvstate = device->machine->driver_data<sym1_state>();
51   if (state) timer_adjust_oneshot(drvstate->led_update, LED_REFRESH_DELAY, 2);
51   if (state) drvstate->led_update->adjust(LED_REFRESH_DELAY, 2);
5252}
5353
5454
5555static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_3_w )
5656{
5757   sym1_state *drvstate = device->machine->driver_data<sym1_state>();
58   if (state) timer_adjust_oneshot(drvstate->led_update, LED_REFRESH_DELAY, 3);
58   if (state) drvstate->led_update->adjust(LED_REFRESH_DELAY, 3);
5959}
6060
6161
6262static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_4_w )
6363{
6464   sym1_state *drvstate = device->machine->driver_data<sym1_state>();
65   if (state) timer_adjust_oneshot(drvstate->led_update, LED_REFRESH_DELAY, 4);
65   if (state) drvstate->led_update->adjust(LED_REFRESH_DELAY, 4);
6666}
6767
6868
6969static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_5_w )
7070{
7171   sym1_state *drvstate = device->machine->driver_data<sym1_state>();
72   if (state) timer_adjust_oneshot(drvstate->led_update, LED_REFRESH_DELAY, 5);
72   if (state) drvstate->led_update->adjust(LED_REFRESH_DELAY, 5);
7373}
7474
7575
r10326r10327
186186
187187static WRITE8_DEVICE_HANDLER( sym1_via0_b_w )
188188{
189   logerror("%s: via0_b_w 0x%02x\n", cpuexec_describe_context(device->machine), data);
189   logerror("%s: via0_b_w 0x%02x\n", device->machine->describe_context(), data);
190190}
191191
192192
src/mess/machine/lynx.c
r10326r10327
14051405         else
14061406         {
14071407            if ( state->timer[which].timer_active )
1408               value = (UINT8) ( state->timer[which].bakup - (timer_timeleft(state->timer[which].timer) * lynx_time_factor( state->timer[which].cntrl1 & 0x07 )).seconds);
1408               value = (UINT8) ( state->timer[which].bakup - (state->timer[which].timer->remaining() * lynx_time_factor( state->timer[which].cntrl1 & 0x07 )).seconds);
14091409         }
14101410         break;
14111411
r10326r10327
14421442   /* Update timers */
14431443   if ( offset < 3 )
14441444   {
1445      timer_reset(state->timer[which].timer, attotime::never);
1445      state->timer[which].timer->reset();
14461446      state->timer[which].timer_active = 0;
14471447      if ((state->timer[which].cntrl1 & 0x08))      // 0x48?
14481448      {
r10326r10327
14501450         {
14511451            attotime t = (attotime::from_hz(lynx_time_factor(state->timer[which].cntrl1 & 0x07)) * (state->timer[which].bakup + 1));
14521452            if (state->timer[which].cntrl1 & 0x10)
1453               timer_adjust_periodic(state->timer[which].timer, attotime::zero, which, t);
1453               state->timer[which].timer->adjust(attotime::zero, which, t);
14541454            else
1455               timer_adjust_oneshot(state->timer[which].timer, t, which);
1455               state->timer[which].timer->adjust(t, which);
14561456            state->timer[which].timer_active = 1;
14571457         }
14581458      }
src/mess/machine/docg3.c
r10326r10327
2020      va_start( v, s_fmt );
2121      vsprintf( buf, s_fmt, v );
2222      va_end( v );
23      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
23      logerror( "%s: %s", machine->describe_context(), buf );
2424   }
2525}
2626
src/mess/machine/6551.c
r10326r10327
451451                rate = data & 0x07;
452452
453453            /* baud rate changed? */
454            timer_reset(acia->timer, attotime::never);
454            acia->timer->reset();
455455
456456            if (rate==0)
457457            {
r10326r10327
557557                  break;
558558               }
559559
560               timer_adjust_periodic(acia->timer, attotime::zero, 0, attotime::from_hz(baud_rate));
560               acia->timer->adjust(attotime::zero, 0, attotime::from_hz(baud_rate));
561561            }
562562         }
563563
src/mess/machine/mbc55x.c
r10326r10327
257257{
258258   mbc55x_state *state   = space->machine->driver_data<mbc55x_state>();
259259
260   logerror("%s : set vram page to %02X\n",cpuexec_describe_context(space->machine),data);
260   logerror("%s : set vram page to %02X\n",space->machine->describe_context(),data);
261261
262262   state->vram_page=data;
263263}
r10326r10327
311311   state->keyboard.key_special=0;
312312
313313    // Setup timer to scan state->keyboard.
314    timer_adjust_periodic(state->keyboard.keyscan_timer, attotime::zero, 0, attotime::from_hz(50));
314    state->keyboard.keyscan_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
315315}
316316
317317static void scan_keyboard(running_machine *machine)
r10326r10327
408408   
409409   switch (offset)
410410   {
411      case 0   : //logerror("%s read kb_uart\n",cpuexec_describe_context(space->machine));
411      case 0   : //logerror("%s read kb_uart\n",space->machine->describe_context());
412412              result=msm8251_data_r(msm8251,0); break;
413413                 
414414      case 2   : result=msm8251_status_r(msm8251,0);
src/mess/machine/ay31015.c
r10326r10327
613613
614614   if ( ay31015->rx_clock > 0.0 )
615615   {
616      timer_adjust_periodic( ay31015->rx_timer, attotime::from_hz( ay31015->rx_clock ), 0, attotime::from_hz( ay31015->rx_clock ) );
616      ay31015->rx_timer->adjust( attotime::from_hz( ay31015->rx_clock ), 0, attotime::from_hz( ay31015->rx_clock ) );
617617   }
618618   else
619619   {
620      timer_enable( ay31015->rx_timer, 0 );
620      ay31015->rx_timer->enable( 0 );
621621   }
622622}
623623
r10326r10327
628628
629629   if ( ay31015->tx_clock > 0.0 )
630630   {
631      timer_adjust_periodic( ay31015->tx_timer, attotime::from_hz( ay31015->tx_clock ), 0, attotime::from_hz( ay31015->tx_clock ) );
631      ay31015->tx_timer->adjust( attotime::from_hz( ay31015->tx_clock ), 0, attotime::from_hz( ay31015->tx_clock ) );
632632   }
633633   else
634634   {
635      timer_enable( ay31015->tx_timer, 0 );
635      ay31015->tx_timer->enable( 0 );
636636   }
637637}
638638
src/mess/machine/mc68328.c
r10326r10327
2323        va_start( v, s_fmt );
2424        vsprintf( buf, s_fmt, v );
2525        va_end( v );
26        logerror( "%s: %s", cpuexec_describe_context(machine), buf );
26        logerror( "%s: %s", machine->describe_context(), buf );
2727    }
2828}
2929
r10326r10327
191191    {
192192        if((mc68328->regs.tctl[index] & TCTL_CLKSOURCE) == TCTL_CLKSOURCE_TIN)
193193        {
194            timer_adjust_oneshot(mc68328->gptimer[index], attotime::never, 0);
194            mc68328->gptimer[index]->adjust(attotime::never);
195195        }
196196        else if(mc68328->regs.tcmp[index] == 0)
197197        {
198            timer_adjust_oneshot(mc68328->gptimer[index], attotime::never, 0);
198            mc68328->gptimer[index]->adjust(attotime::never);
199199        }
200200        else
201201        {
r10326r10327
207207                mc68328->regs.tcn[index] = 0x0000;
208208            }
209209
210            timer_adjust_oneshot(mc68328->gptimer[index], period, 0);
210            mc68328->gptimer[index]->adjust(period);
211211        }
212212    }
213213    else
214214    {
215        timer_adjust_oneshot(mc68328->gptimer[index], attotime::never, 0);
215        mc68328->gptimer[index]->adjust(attotime::never);
216216    }
217217}
218218
r10326r10327
233233
234234            mc68328->regs.tcn[index] = 0x0000;
235235
236            timer_adjust_oneshot(mc68328->gptimer[index], period, 0);
236            mc68328->gptimer[index]->adjust(period);
237237        }
238238        else
239239        {
240            timer_adjust_oneshot(mc68328->gptimer[index], attotime::never, 0);
240            mc68328->gptimer[index]->adjust(attotime::never);
241241        }
242242    }
243243    else
r10326r10327
248248        {
249249            attotime period = attotime::from_hz(frequency) * 0x10000;
250250
251            timer_adjust_oneshot(mc68328->gptimer[index], period, 0);
251            mc68328->gptimer[index]->adjust(period);
252252        }
253253        else
254254        {
255            timer_adjust_oneshot(mc68328->gptimer[index], attotime::never, 0);
255            mc68328->gptimer[index]->adjust(attotime::never);
256256        }
257257    }
258258    if((mc68328->regs.tctl[index] & TCTL_IRQEN) == TCTL_IRQEN_ENABLE)
r10326r10327
282282
283283    if(mc68328->regs.pwmw >= mc68328->regs.pwmp || mc68328->regs.pwmw == 0 || mc68328->regs.pwmp == 0)
284284    {
285        timer_adjust_oneshot(mc68328->pwm, attotime::never, 0);
285        mc68328->pwm->adjust(attotime::never);
286286        return;
287287    }
288288
r10326r10327
296296        frequency /= divisor;
297297        period = attotime::from_hz(frequency) * (mc68328->regs.pwmp - mc68328->regs.pwmw);
298298
299        timer_adjust_oneshot(mc68328->pwm, period, 0);
299        mc68328->pwm->adjust(period);
300300
301301        if(mc68328->regs.pwmc & PWMC_IRQEN)
302302        {
r10326r10327
312312        frequency /= divisor;
313313        period = attotime::from_hz(frequency) * mc68328->regs.pwmw;
314314
315        timer_adjust_oneshot(mc68328->pwm, period, 0);
315        mc68328->pwm->adjust(period);
316316    }
317317
318318    mc68328->regs.pwmc ^= PWMC_PIN;
r10326r10327
11141114                attotime period;
11151115                frequency /= divisor;
11161116                period = attotime::from_hz(frequency) * mc68328->regs.pwmw;
1117                timer_adjust_oneshot(mc68328->pwm, period, 0);
1117                mc68328->pwm->adjust(period);
11181118                if(mc68328->regs.pwmc & PWMC_IRQEN)
11191119                {
11201120                    mc68328_set_interrupt_line(device, INT_PWM, 1);
r10326r10327
11231123            }
11241124            else
11251125            {
1126                timer_adjust_oneshot(mc68328->pwm, attotime::never, 0);
1126                mc68328->pwm->adjust(attotime::never);
11271127            }
11281128            break;
11291129
r10326r10327
26512651    mc68328->regs.rtcienr = 0x00;
26522652    mc68328->regs.stpwtch = 0x00;
26532653
2654    timer_adjust_periodic(mc68328->rtc, attotime::from_hz(1), 0, attotime::from_hz(1));
2654    mc68328->rtc->adjust(attotime::from_hz(1), 0, attotime::from_hz(1));
26552655}
26562656
26572657static void mc68328_register_state_save(device_t *device)
src/mess/machine/pc_fdc.c
r10326r10327
374374   /* Is the watchdog timer disabled */
375375   if ( ! ( data & 0x20 ) )
376376   {
377      timer_adjust_oneshot( fdc->watchdog, attotime::never, 0 );
377      fdc->watchdog->adjust( attotime::never );
378378      if ( fdc->fdc_interface.pc_fdc_interrupt )
379379      {
380380         fdc->fdc_interface.pc_fdc_interrupt(machine, 0 );
r10326r10327
384384      if ( ( fdc->digital_output_register & 0x40 ) && ! ( data & 0x40 ) )
385385      {
386386         /* Start watchdog timer here */
387         timer_adjust_oneshot( fdc->watchdog, attotime::from_seconds(3), 0 );
387         fdc->watchdog->adjust( attotime::from_seconds(3) );
388388      }
389389   }
390390
src/mess/machine/mc6843.c
r10326r10327
394394
395395   LOG(( "%f mc6843_cont: timer called for cmd=%s(%i)\n", device->machine->time().as_double(), mc6843_cmd[cmd], cmd ));
396396
397   timer_adjust_oneshot( mc6843->timer_cont, attotime::never, 0 );
397   mc6843->timer_cont->adjust( attotime::never );
398398
399399   switch ( cmd )
400400   {
r10326r10327
463463               }
464464               else
465465               {
466                  timer_adjust_oneshot( mc6843->timer_cont, DELAY_ADDR, 0 );
466                  mc6843->timer_cont->adjust( DELAY_ADDR );
467467               }
468468            }
469469            else
r10326r10327
609609               }
610610               else
611611               {
612                  timer_adjust_oneshot( mc6843->timer_cont, DELAY_ADDR, 0 );
612                  mc6843->timer_cont->adjust( DELAY_ADDR );
613613               }
614614            }
615615            else
r10326r10327
710710         mc6843->STRA |=  0x80; /* set Busy */
711711         mc6843->STRA &= ~0x22; /* clear Track Not Equal & Delete Data Mark Detected */
712712         mc6843->STRB &= ~0x04; /* clear Data Mark Undetected */
713         timer_adjust_oneshot( mc6843->timer_cont, DELAY_ADDR, 0 );
713         mc6843->timer_cont->adjust( DELAY_ADDR );
714714         break;
715715      case CMD_STZ:
716716      case CMD_SEK:
717717         mc6843->STRA |= 0x80; /* set Busy */
718         timer_adjust_oneshot( mc6843->timer_cont, DELAY_SEEK, 0 );
718         mc6843->timer_cont->adjust( DELAY_SEEK );
719719         break;
720720      case CMD_FFW:
721721      case CMD_FFR:
r10326r10327
796796
797797   mc6843->data_size = 0;
798798   mc6843->data_idx = 0;
799   timer_adjust_oneshot( mc6843->timer_cont, attotime::never, 0 );
799   mc6843->timer_cont->adjust( attotime::never );
800800}
801801
802802
src/mess/machine/mm58274c.c
r10326r10327
203203   case 0x0:   /* Control Register (test mode and interrupt not emulated) */
204204      if ((! (mm58274c->control & ctl_intstop)) && (data & ctl_intstop))
205205         /* interrupt stop */
206         timer_enable(mm58274c->interrupt_timer, 0);
206         mm58274c->interrupt_timer->enable(0);
207207      else if ((mm58274c->control & ctl_intstop) && (! (data & ctl_intstop)))
208208      {
209209         /* interrupt run */
210210         attotime period = interrupt_period_table(mm58274c->int_ctl & int_ctl_dly);
211211
212         timer_adjust_periodic(mm58274c->interrupt_timer, period, 0, mm58274c->int_ctl & int_ctl_rpt ? period : attotime::zero);
212         mm58274c->interrupt_timer->adjust(period, 0, mm58274c->int_ctl & int_ctl_rpt ? period : attotime::zero);
213213      }
214214      if (data & ctl_clkstop)
215215         /* stopping the clock clears the tenth counter */
r10326r10327
282282            /* interrupt run */
283283            attotime period = interrupt_period_table(mm58274c->int_ctl & int_ctl_dly);
284284
285            timer_adjust_periodic(mm58274c->interrupt_timer, period, 0, mm58274c->int_ctl & int_ctl_rpt ? period : attotime::zero);
285            mm58274c->interrupt_timer->adjust(period, 0, mm58274c->int_ctl & int_ctl_rpt ? period : attotime::zero);
286286         }
287287      }
288288      else
r10326r10327
472472   state_save_register_item(device->machine, "mm58274c", device->tag(), 0, mm58274c->tenths);
473473
474474   mm58274c->increment_rtc = device->machine->scheduler().timer_alloc(FUNC(increment_rtc), ((void*)device));
475   timer_adjust_periodic(mm58274c->increment_rtc, attotime::zero, 0, attotime::from_msec(100));
475   mm58274c->increment_rtc->adjust(attotime::zero, 0, attotime::from_msec(100));
476476   mm58274c->interrupt_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_interrupt_callback), ((void*)device));
477477}
478478
src/mess/machine/ibmpc.c
r10326r10327
113113{
114114   memset(&pc_rtc,0,sizeof(pc_rtc));
115115   pc_rtc.timer = machine->scheduler().timer_alloc(FUNC(pc_rtc_timer));
116   timer_adjust_periodic(pc_rtc.timer, attotime::zero, 0, attotime(1, 0));
116   pc_rtc.timer->adjust(attotime::zero, 0, attotime(1,0));
117117}
118118
119119READ8_HANDLER( pc_rtc_r )
src/mess/machine/hec2hrp.c
r10326r10327
780780   
781781   /* For Cassette synchro*/
782782   Cassette_timer = machine->scheduler().timer_alloc(FUNC(Callback_CK));
783   timer_adjust_periodic(Cassette_timer, attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/
783   Cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/
784784
785785   /* Sound sn76477*/
786786   Init_Value_SN76477_Hector();  /*init R/C value*/
src/mess/machine/com8116.c
r10326r10327
7373
7474   com8116->fr = data & 0x0f;
7575
76   timer_adjust_periodic(com8116->fr_timer, attotime::zero, 0, attotime::from_hz(device->clock() / com8116->fr_divisors[com8116->fr] / 2));
76   com8116->fr_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / com8116->fr_divisors[com8116->fr] / 2));
7777}
7878
7979/*-------------------------------------------------
r10326r10327
8888
8989   com8116->ft = data & 0x0f;
9090
91   timer_adjust_periodic(com8116->ft_timer, attotime::zero, 0, attotime::from_hz(device->clock() / com8116->ft_divisors[com8116->fr] / 2));
91   com8116->ft_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / com8116->ft_divisors[com8116->fr] / 2));
9292}
9393
9494/*-------------------------------------------------
r10326r10327
155155   if (com8116->out_fx4_func.target)
156156   {
157157      com8116->fx4_timer = device->machine->scheduler().timer_alloc(FUNC(fx4_tick), (void *)device);
158      timer_adjust_periodic(com8116->fx4_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 4));
158      com8116->fx4_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 4));
159159   }
160160
161161   com8116->fr_timer = device->machine->scheduler().timer_alloc(FUNC(fr_tick), (void *)device);
src/mess/machine/e0516.c
r10326r10327
216216
217217   /* create the timers */
218218   e0516->clock_timer = device->machine->scheduler().timer_alloc(FUNC(clock_tick), (void *)device);
219   timer_adjust_periodic(e0516->clock_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 32768));
219   e0516->clock_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 32768));
220220
221221   /* register for state saving */
222222   state_save_register_device_item(device, 0, e0516->cs);
src/mess/machine/rmnimbus.c
r10326r10327
349349   if (!state->i186.intr.pending)
350350      cputag_set_input_line(machine, MAINCPU_TAG, 0, ASSERT_LINE);
351351   state->i186.intr.pending = 1;
352   cpuexec_trigger(machine, CPU_RESUME_TRIGGER);
352   machine->scheduler().trigger(CPU_RESUME_TRIGGER);
353353   if (LOG_OPTIMIZATION) logerror("  - trigger due to interrupt pending\n");
354354   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine->time().as_double(), new_vector);
355355}
r10326r10327
483483   if (t->control & 0x0001)
484484   {
485485      int count = t->maxA ? t->maxA : 0x10000;
486      timer_adjust_oneshot(t->int_timer, (attotime::from_hz(2000000) * count), which);
486      t->int_timer->adjust((attotime::from_hz(2000000) * count), which);
487487      if (LOG_TIMER) logerror("  Repriming interrupt\n");
488488   }
489489   else
490      timer_adjust_oneshot(t->int_timer, attotime::never, which);
490      t->int_timer->adjust(attotime::never, which);
491491}
492492
493493
r10326r10327
499499   /* if we have a timing timer running, adjust the count */
500500   if (t->time_timer_active)
501501   {
502      attotime current_time = timer_timeelapsed(t->time_timer);
502      attotime current_time = t->time_timer->elapsed();
503503      int net_clocks = ((current_time - t->last_time) * 2000000).seconds;
504504      t->last_time = current_time;
505505
r10326r10327
604604            internal_timer_sync(machine, which);
605605
606606            /* nuke the timer and force the interrupt timer to be recomputed */
607            timer_adjust_oneshot(t->time_timer, attotime::never, which);
607            t->time_timer->adjust(attotime::never, which);
608608            t->time_timer_active = 0;
609609            update_int_timer = 1;
610610         }
r10326r10327
613613         else if ((diff & 0x8000) && (new_control & 0x8000))
614614         {
615615            /* start the timing */
616            timer_adjust_oneshot(t->time_timer, attotime::never, which);
616            t->time_timer->adjust(attotime::never, which);
617617            t->time_timer_active = 1;
618618            update_int_timer = 1;
619619         }
r10326r10327
638638         int diff = t->maxA - t->count;
639639         if (diff <= 0)
640640            diff += 0x10000;
641         timer_adjust_oneshot(t->int_timer, attotime::from_hz(2000000) * diff, which);
641         t->int_timer->adjust(attotime::from_hz(2000000) * diff, which);
642642         if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which);
643643      }
644644      else
645645      {
646         timer_adjust_oneshot(t->int_timer, attotime::never, which);
646         t->int_timer->adjust(attotime::never, which);
647647      }
648648   }
649649}
r10326r10327
21252125    memset(state->keyboard.keyrows,0xFF,NIMBUS_KEYROWS);
21262126
21272127    // Setup timer to scan state->keyboard.
2128    timer_adjust_periodic(state->keyboard.keyscan_timer, attotime::zero, 0, attotime::from_hz(50));
2128    state->keyboard.keyscan_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
21292129}
21302130
21312131static void queue_scancode(running_machine *machine, UINT8 scancode)
r10326r10327
28442844    state->reg0a4=0xC0;
28452845
28462846    // Setup timer to poll the mouse
2847    timer_adjust_periodic(state->mouse_timer, attotime::zero, 0, attotime::from_hz(1000));
2847    state->mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(1000));
28482848}
28492849
28502850static TIMER_CALLBACK(mouse_callback)
src/mess/machine/c1571.c
r10326r10327
264264      }
265265
266266      floppy_mon_w(c1571->image, !mtr);
267      timer_enable(c1571->bit_timer, mtr);
267      c1571->bit_timer->enable(mtr);
268268
269269      c1571->mtr = mtr;
270270   }
r10326r10327
701701
702702   if (c1571->ds != ds)
703703   {
704      timer_adjust_periodic(c1571->bit_timer, attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
704      c1571->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4));
705705      c1571->ds = ds;
706706   }
707707}
src/mess/machine/abc77.c
r10326r10327
389389
390390      /* trigger reset */
391391      cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE);
392      timer_adjust_oneshot(abc77->reset_timer, attotime::from_msec(t), 0);
392      abc77->reset_timer->adjust(attotime::from_msec(t));
393393
394394      cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE);
395395   }
src/mess/machine/pc_mouse.c
r10326r10327
234234         }
235235
236236         /* start a timer to scan the mouse input */
237         timer_adjust_periodic(pc_mouse.timer, attotime::zero, 0, attotime::from_hz(240));
237         pc_mouse.timer->adjust(attotime::zero, 0, attotime::from_hz(240));
238238      }
239239      else
240240      {
241241         /* CTS just went to 0 */
242         timer_adjust_oneshot(pc_mouse.timer, attotime::zero, 0);
242         pc_mouse.timer->adjust(attotime::zero);
243243         pc_mouse.head = pc_mouse.tail = 0;
244244      }
245245   }
src/mess/machine/tf20.c
r10326r10327
8383
8484static READ8_HANDLER( tf20_dip_r )
8585{
86   logerror("%s: tf20_dip_r\n", cpuexec_describe_context(space->machine));
86   logerror("%s: tf20_dip_r\n", space->machine->describe_context());
8787
8888   return input_port_read(space->machine, "tf20_dip");
8989}
r10326r10327
9595
9696static READ8_DEVICE_HANDLER( tf20_upd765_tc_r )
9797{
98   logerror("%s: tf20_upd765_tc_r\n", cpuexec_describe_context(device->machine));
98   logerror("%s: tf20_upd765_tc_r\n", device->machine->describe_context());
9999
100100   /* toggle tc on read */
101101   upd765_tc_w(device, ASSERT_LINE);
r10326r10327
107107static WRITE8_HANDLER( tf20_fdc_control_w )
108108{
109109   tf20_state *tf20 = get_safe_token(space->cpu->owner());
110   logerror("%s: tf20_fdc_control_w %02x\n", cpuexec_describe_context(space->machine), data);
110   logerror("%s: tf20_fdc_control_w %02x\n", space->machine->describe_context(), data);
111111
112112   /* bit 0, motor on signal */
113113   floppy_mon_w(tf20->floppy_0, !BIT(data, 0));
r10326r10327
128128READ_LINE_DEVICE_HANDLER( tf20_rxs_r )
129129{
130130   tf20_state *tf20 = get_safe_token(device);
131   logerror("%s: tf20_rxs_r\n", cpuexec_describe_context(device->machine));
131   logerror("%s: tf20_rxs_r\n", device->machine->describe_context());
132132
133133   return upd7201_txda_r(tf20->upd7201);
134134}
r10326r10327
136136READ_LINE_DEVICE_HANDLER( tf20_pins_r )
137137{
138138   tf20_state *tf20 = get_safe_token(device);
139   logerror("%s: tf20_pins_r\n", cpuexec_describe_context(device->machine));
139   logerror("%s: tf20_pins_r\n", device->machine->describe_context());
140140
141141   return upd7201_dtra_r(tf20->upd7201);
142142}
r10326r10327
145145WRITE_LINE_DEVICE_HANDLER( tf20_txs_w )
146146{
147147   tf20_state *tf20 = get_safe_token(device);
148   logerror("%s: tf20_txs_w %u\n", cpuexec_describe_context(device->machine), state);
148   logerror("%s: tf20_txs_w %u\n", device->machine->describe_context(), state);
149149
150150   upd7201_rxda_w(tf20->upd7201, state);
151151}
r10326r10327
153153WRITE_LINE_DEVICE_HANDLER( tf20_pouts_w )
154154{
155155   tf20_state *tf20 = get_safe_token(device);
156   logerror("%s: tf20_pouts_w %u\n", cpuexec_describe_context(device->machine), state);
156   logerror("%s: tf20_pouts_w %u\n", device->machine->describe_context(), state);
157157
158158   upd7201_ctsa_w(tf20->upd7201, state);
159159}
r10326r10327
163163WRITE_LINE_DEVICE_HANDLER( tf20_txc_w )
164164{
165165   tf20_state *tf20 = get_safe_token(device);
166   logerror("%s: tf20_txc_w %u\n", cpuexec_describe_context(device->machine), state);
166   logerror("%s: tf20_txc_w %u\n", device->machine->describe_context(), state);
167167
168168   upd7201_rxda_w(tf20->upd7201, state);
169169}
r10326r10327
172172READ_LINE_DEVICE_HANDLER( tf20_rxc_r )
173173{
174174   tf20_state *tf20 = get_safe_token(device);
175   logerror("%s: tf20_rxc_r\n", cpuexec_describe_context(device->machine));
175   logerror("%s: tf20_rxc_r\n", device->machine->describe_context());
176176
177177   return upd7201_txda_r(tf20->upd7201);
178178}
r10326r10327
180180WRITE_LINE_DEVICE_HANDLER( tf20_poutc_w )
181181{
182182   tf20_state *tf20 = get_safe_token(device);
183   logerror("%s: tf20_poutc_w %u\n", cpuexec_describe_context(device->machine), state);
183   logerror("%s: tf20_poutc_w %u\n", device->machine->describe_context(), state);
184184
185185   upd7201_ctsa_w(tf20->upd7201, state);
186186}
r10326r10327
188188READ_LINE_DEVICE_HANDLER( tf20_pinc_r )
189189{
190190   tf20_state *tf20 = get_safe_token(device);
191   logerror("%s: tf20_pinc_r\n", cpuexec_describe_context(device->machine));
191   logerror("%s: tf20_pinc_r\n", device->machine->describe_context());
192192
193193   return upd7201_dtra_r(tf20->upd7201);
194194}
src/mess/machine/zx8302.c
r10326r10327
356356   m_gap_timer = timer_alloc(TIMER_GAP);
357357   m_ipc_timer = timer_alloc(TIMER_IPC);
358358
359   timer_adjust_periodic(m_rtc_timer, attotime::zero, 0, attotime::from_hz(m_config.rtc_clock / 32768));
360   timer_adjust_periodic(m_gap_timer, attotime::zero, 0, attotime::from_msec(31));
359   m_rtc_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.rtc_clock / 32768));
360   m_gap_timer->adjust(attotime::zero, 0, attotime::from_msec(31));
361361
362362   // register for state saving
363363   state_save_register_device_item(this, 0, m_idr);
r10326r10327
461461
462462   m_tcr = data;
463463
464   timer_adjust_periodic(m_txd_timer, attotime::zero, 0, attotime::from_hz(baud));
465   timer_adjust_periodic(m_baudx4_timer, attotime::zero, 0, attotime::from_hz(baudx4));
464   m_txd_timer->adjust(attotime::zero, 0, attotime::from_hz(baud));
465   m_baudx4_timer->adjust(attotime::zero, 0, attotime::from_hz(baudx4));
466466}
467467
468468
r10326r10327
540540
541541   if (data != 0x01)
542542   {
543      timer_adjust_oneshot(m_ipc_timer, attotime::from_nsec(480), data);
543      m_ipc_timer->adjust(attotime::from_nsec(480), data);
544544   }
545545}
546546
src/mess/machine/c64.c
r10326r10327
577577         if(!(data & 0x20))
578578         {
579579            cassette_change_state(device->machine->device("cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
580            timer_adjust_periodic(state->datasette_timer, attotime::zero, 0, attotime::from_hz(44100));
580            state->datasette_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
581581         }
582582         else
583583         {
584584            cassette_change_state(device->machine->device("cassette"), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
585            timer_reset(state->datasette_timer, attotime::never);
585            state->datasette_timer->reset();
586586         }
587587      }
588588   }
src/mess/machine/hd63450.c
r10326r10327
259259   {
260260      device_t *cpu = device->machine->device(dmac->intf->cpu_tag);
261261      cpu_set_input_line(cpu, INPUT_LINE_HALT, ASSERT_LINE);
262      timer_adjust_periodic(dmac->timer[channel], attotime::zero, channel, dmac->burst_clock[channel]);
262      dmac->timer[channel]->adjust(attotime::zero, channel, dmac->burst_clock[channel]);
263263   }
264264   else
265      timer_adjust_periodic(dmac->timer[channel], attotime::from_usec(500), channel, dmac->clock[channel]);
265      dmac->timer[channel]->adjust(attotime::from_usec(500), channel, dmac->clock[channel]);
266266
267267   dmac->transfer_size[channel] = dmac->reg[channel].mtc;
268268
r10326r10327
275275
276276   dmac->clock[channel] = tm;
277277   if(dmac->in_progress[channel] != 0)
278      timer_adjust_periodic(dmac->timer[channel], attotime::zero, channel, dmac->clock[channel]);
278      dmac->timer[channel]->adjust(attotime::zero, channel, dmac->clock[channel]);
279279}
280280
281281static TIMER_CALLBACK(dma_transfer_timer)
r10326r10327
288288   hd63450_t* dmac = get_safe_token(device);
289289
290290   logerror("DMA#%i: Transfer aborted\n",channel);
291   timer_adjust_oneshot(dmac->timer[channel], attotime::zero, 0);
291   dmac->timer[channel]->adjust(attotime::zero);
292292   dmac->in_progress[channel] = 0;
293293   dmac->reg[channel].mtc = dmac->transfer_size[channel];
294294   dmac->reg[channel].csr |= 0xe0;  // channel operation complete, block transfer complete
r10326r10327
300300   hd63450_t* dmac = get_safe_token(device);
301301
302302   dmac->halted[channel] = 1;
303   timer_adjust_oneshot(dmac->timer[channel], attotime::zero, 0);
303   dmac->timer[channel]->adjust(attotime::zero);
304304}
305305
306306static void dma_transfer_continue(device_t* device, int channel)
r10326r10327
310310   if(dmac->halted[channel] != 0)
311311   {
312312      dmac->halted[channel] = 0;
313      timer_adjust_periodic(dmac->timer[channel], attotime::zero, channel, dmac->clock[channel]);
313      dmac->timer[channel]->adjust(attotime::zero, channel, dmac->clock[channel]);
314314   }
315315}
316316
r10326r10327
431431               dmac->reg[x].mtc = space->read_word(dmac->reg[x].bar+4);
432432               return;
433433            }
434            timer_adjust_oneshot(dmac->timer[x], attotime::zero, 0);
434            dmac->timer[x]->adjust(attotime::zero);
435435            dmac->in_progress[x] = 0;
436436            dmac->reg[x].csr |= 0xe0;  // channel operation complete, block transfer complete
437437            dmac->reg[x].csr &= ~0x08;  // channel no longer active
src/mess/machine/pc.c
r10326r10327
220220{
221221   if ( cpu_get_reg( device->machine->firstcpu, STATE_GENPC ) == 0xF0454 )
222222   {
223      timer_adjust_oneshot( pc_int_delay_timer, device->machine->firstcpu->cycles_to_attotime(1), state );
223      pc_int_delay_timer->adjust( device->machine->firstcpu->cycles_to_attotime(1), state );
224224   }
225225   else
226226   {
r10326r10327
479479
480480   if ( pcjr_keyb.signal_count <= 0 )
481481   {
482      timer_adjust_periodic( pcjr_keyb.keyb_signal_timer, attotime::never, 0, attotime::never );
482      pcjr_keyb.keyb_signal_timer->adjust( attotime::never, 0, attotime::never );
483483      pcjr_keyb.transferring = 0;
484484   }
485485}
r10326r10327
517517      pcjr_keyb.transferring = 1;
518518
519519      /* Set timer */
520      timer_adjust_periodic( pcjr_keyb.keyb_signal_timer, attotime::from_usec(220), 0, attotime::from_usec(220) );
520      pcjr_keyb.keyb_signal_timer->adjust( attotime::from_usec(220), 0, attotime::from_usec(220) );
521521
522522      /* Trigger NMI */
523523      if ( ! pcjr_keyb.latch )
src/mess/machine/pecom.c
r10326r10327
4646
4747   state->reset = 0;
4848   state->dma = 0;
49   timer_adjust_oneshot(state->reset_timer, attotime::from_msec(5), 0);
49   state->reset_timer->adjust(attotime::from_msec(5));
5050}
5151
5252static READ8_HANDLER( pecom_cdp1869_charram_r )
src/mess/machine/kb3600.c
r10326r10327
150150
151151   /* create the timers */
152152   ay3600->scan_timer = device->machine->scheduler().timer_alloc(FUNC(ay3600_scan_tick), (void *)device);
153   timer_adjust_periodic(ay3600->scan_timer, attotime::zero, 0, attotime::from_hz(60));
153   ay3600->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(60));
154154
155155   /* register for state saving */
156156   state_save_register_device_item(device, 0, ay3600->b);
src/mess/machine/pce.c
r10326r10327
607607   }
608608   else
609609   {
610      timer_adjust_periodic(pce_cd.data_timer, attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND ), 0, attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND ));
610      pce_cd.data_timer->adjust(attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND ), 0, attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND ));
611611   }
612612}
613613
r10326r10327
10481048         pce_cd.selected = 0;
10491049         pce_cd.cdda_status = PCE_CD_CDDA_OFF;
10501050         cdda_stop_audio( machine->device( "cdda" ) );
1051         timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime::never, 0); // stop ADPCM DMA here
1051         pce_cd.adpcm_dma_timer->adjust(attotime::never); // stop ADPCM DMA here
10521052      }
10531053      pce_cd.scsi_last_RST = pce_cd.scsi_RST;
10541054   }
r10326r10327
12101210         /* We are done, disable the timer */
12111211         logerror("Last frame read from CD\n");
12121212         pce_cd.data_transferred = 1;
1213         timer_adjust_oneshot(pce_cd.data_timer, attotime::never, 0);
1213         pce_cd.data_timer->adjust(attotime::never);
12141214      }
12151215      else
12161216      {
r10326r10327
12701270   }
12711271
12721272   pce_cd.data_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_data_timer_callback));
1273   timer_adjust_oneshot(pce_cd.data_timer, attotime::never, 0);
1273   pce_cd.data_timer->adjust(attotime::never);
12741274   pce_cd.adpcm_dma_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_adpcm_dma_timer_callback));
1275   timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime::never, 0);
1275   pce_cd.adpcm_dma_timer->adjust(attotime::never);
12761276
12771277   pce_cd.cdda_fadeout_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_cdda_fadeout_callback));
1278   timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::never, 0);
1278   pce_cd.cdda_fadeout_timer->adjust(attotime::never);
12791279   pce_cd.cdda_fadein_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_cdda_fadein_callback));
1280   timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
1280   pce_cd.cdda_fadein_timer->adjust(attotime::never);
12811281
12821282   pce_cd.adpcm_fadeout_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_adpcm_fadeout_callback));
1283   timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::never, 0);
1283   pce_cd.adpcm_fadeout_timer->adjust(attotime::never);
12841284   pce_cd.adpcm_fadein_timer = machine->scheduler().timer_alloc(FUNC(pce_cd_adpcm_fadein_callback));
1285   timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::never, 0);
1285   pce_cd.adpcm_fadein_timer->adjust(attotime::never);
12861286}
12871287
12881288WRITE8_HANDLER( pce_cd_bram_w )
r10326r10327
13151315   {
13161316      pce_cd.cdda_volume = 0.0;
13171317      cdda_set_volume(machine->device("cdda"), 0.0);
1318      timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::never, 0);
1318      pce_cd.cdda_fadeout_timer->adjust(attotime::never);
13191319   }
13201320   else
13211321   {
13221322      cdda_set_volume(machine->device("cdda"), pce_cd.cdda_volume);
1323      timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::from_usec(param), param);
1323      pce_cd.cdda_fadeout_timer->adjust(attotime::from_usec(param), param);
13241324   }
13251325}
13261326
r10326r10327
13321332   {
13331333      pce_cd.cdda_volume = 100.0;
13341334      cdda_set_volume(machine->device("cdda"), 100.0);
1335      timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
1335      pce_cd.cdda_fadein_timer->adjust(attotime::never);
13361336   }
13371337   else
13381338   {
13391339      cdda_set_volume(machine->device("cdda"), pce_cd.cdda_volume);
1340      timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::from_usec(param), param);
1340      pce_cd.cdda_fadein_timer->adjust(attotime::from_usec(param), param);
13411341   }
13421342}
13431343
r10326r10327
13491349   {
13501350      pce_cd.adpcm_volume = 0.0;
13511351      msm5205_set_volume(machine->device("msm5205"), 0.0);
1352      timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::never, 0);
1352      pce_cd.adpcm_fadeout_timer->adjust(attotime::never);
13531353   }
13541354   else
13551355   {
13561356      msm5205_set_volume(machine->device("msm5205"), pce_cd.adpcm_volume);
1357      timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::from_usec(param), param);
1357      pce_cd.adpcm_fadeout_timer->adjust(attotime::from_usec(param), param);
13581358   }
13591359}
13601360
r10326r10327
13661366   {
13671367      pce_cd.adpcm_volume = 100.0;
13681368      msm5205_set_volume(machine->device("msm5205"), 100.0);
1369      timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::never, 0);
1369      pce_cd.adpcm_fadein_timer->adjust(attotime::never);
13701370   }
13711371   else
13721372   {
13731373      msm5205_set_volume(machine->device("msm5205"), pce_cd.adpcm_volume);
1374      timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::from_usec(param), param);
1374      pce_cd.adpcm_fadein_timer->adjust(attotime::from_usec(param), param);
13751375   }
13761376}
13771377
r10326r10327
13921392      pce_cd.scsi_SEL = 1;
13931393      pce_cd_update(space->machine);
13941394      pce_cd.scsi_SEL = 0;
1395      timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime::never, 0); // stop ADPCM DMA here
1395      pce_cd.adpcm_dma_timer->adjust(attotime::never); // stop ADPCM DMA here
13961396      /* any write here clears CD transfer irqs */
13971397      pce_cd.regs[0x03] &= ~0x70;
13981398      cputag_set_input_line(space->machine, "maincpu", 1, CLEAR_LINE );
r10326r10327
14351435      if ( data & 0x03 )
14361436      {
14371437         /* Start CD to ADPCM transfer */
1438         timer_adjust_periodic(pce_cd.adpcm_dma_timer, attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) );
1438         pce_cd.adpcm_dma_timer->adjust(attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, attotime::from_hz( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) );
14391439         pce_cd.regs[0x0c] |= 4;
14401440      }
14411441      break;
r10326r10327
15021502         {
15031503            case 0x00: //CD-DA / ADPCM enable (100 msecs)
15041504               pce_cd.cdda_volume = 0.0;
1505               timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::from_usec(100), 100);
1505               pce_cd.cdda_fadein_timer->adjust(attotime::from_usec(100), 100);
15061506               pce_cd.adpcm_volume = 0.0;
1507               timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::from_usec(100), 100);
1508               timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::never, 0);
1509               timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::never, 0);
1507               pce_cd.adpcm_fadein_timer->adjust(attotime::from_usec(100), 100);
1508               pce_cd.cdda_fadeout_timer->adjust(attotime::never);
1509               pce_cd.adpcm_fadeout_timer->adjust(attotime::never);
15101510               break;
15111511            case 0x01: //CD-DA enable (100 msecs)
15121512               pce_cd.cdda_volume = 0.0;
1513               timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::from_usec(100), 100);
1514               timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::never, 0);
1513               pce_cd.cdda_fadein_timer->adjust(attotime::from_usec(100), 100);
1514               pce_cd.cdda_fadeout_timer->adjust(attotime::never);
15151515               break;
15161516            case 0x08: //CD-DA short (1500 msecs) fade out / ADPCM enable
15171517               pce_cd.cdda_volume = 100.0;
1518               timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::from_usec(1500), 1500);
1518               pce_cd.cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500);
15191519               pce_cd.adpcm_volume = 0.0;
1520               timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::from_usec(100), 100);
1521               timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
1522               timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::never, 0);
1520               pce_cd.adpcm_fadein_timer->adjust(attotime::from_usec(100), 100);
1521               pce_cd.cdda_fadein_timer->adjust(attotime::never);
1522               pce_cd.adpcm_fadeout_timer->adjust(attotime::never);
15231523               break;
15241524            case 0x09: //CD-DA long (5000 msecs) fade out
15251525               pce_cd.cdda_volume = 100.0;
1526               timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::from_usec(5000), 5000);
1527               timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
1526               pce_cd.cdda_fadeout_timer->adjust(attotime::from_usec(5000), 5000);
1527               pce_cd.cdda_fadein_timer->adjust(attotime::never);
15281528               break;
15291529            case 0x0a: //ADPCM long (5000 msecs) fade out
15301530               pce_cd.adpcm_volume = 100.0;
1531               timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::from_usec(5000), 5000);
1532               timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::never, 0);
1531               pce_cd.adpcm_fadeout_timer->adjust(attotime::from_usec(5000), 5000);
1532               pce_cd.adpcm_fadein_timer->adjust(attotime::never);
15331533               break;
15341534            case 0x0c: //CD-DA short (1500 msecs) fade out / ADPCM enable
15351535               pce_cd.cdda_volume = 100.0;
1536               timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::from_usec(1500), 1500);
1536               pce_cd.cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500);
15371537               pce_cd.adpcm_volume = 0.0;
1538               timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::from_usec(100), 100);
1539               timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
1540               timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::never, 0);
1538               pce_cd.adpcm_fadein_timer->adjust(attotime::from_usec(100), 100);
1539               pce_cd.cdda_fadein_timer->adjust(attotime::never);
1540               pce_cd.adpcm_fadeout_timer->adjust(attotime::never);
15411541               break;
15421542            case 0x0d: //CD-DA short (1500 msecs) fade out
15431543               pce_cd.cdda_volume = 100.0;
1544               timer_adjust_oneshot(pce_cd.cdda_fadeout_timer, attotime::from_usec(1500), 1500);
1545               timer_adjust_oneshot(pce_cd.cdda_fadein_timer, attotime::never, 0);
1544               pce_cd.cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500);
1545               pce_cd.cdda_fadein_timer->adjust(attotime::never);
15461546               break;
15471547            case 0x0e: //ADPCM short (1500 msecs) fade out
15481548               pce_cd.adpcm_volume = 100.0;
1549               timer_adjust_oneshot(pce_cd.adpcm_fadeout_timer, attotime::from_usec(1500), 1500);
1550               timer_adjust_oneshot(pce_cd.adpcm_fadein_timer, attotime::never, 0);
1549               pce_cd.adpcm_fadeout_timer->adjust(attotime::from_usec(1500), 1500);
1550               pce_cd.adpcm_fadein_timer->adjust(attotime::never);
15511551               break;
15521552            default:
15531553               popmessage("CD-DA / ADPCM Fade effect mode %02x, contact MESSdev",data & 0x0f);
src/mess/machine/smc92x4.c
r10326r10327
431431      time = 1;
432432
433433   /* set new timer */
434   timer_adjust_oneshot(w->timer_data, attotime::from_usec(time, 0));
434   w->timer_data->adjust(attotime::from_usec(time));
435435}
436436#endif
437437
r10326r10327
451451   if (!w->use_real_timing)
452452      time = 1;
453453
454   timer_adjust_oneshot(w->timer_rs, attotime::from_usec(time), 0);
454   w->timer_rs->adjust(attotime::from_usec(time));
455455   w->to_be_continued = TRUE;
456456}
457457
r10326r10327
470470   if (!w->use_real_timing)
471471      time = 1;
472472
473   timer_adjust_oneshot(w->timer_ws, attotime::from_usec(time), 0);
473   w->timer_ws->adjust(attotime::from_usec(time));
474474   w->to_be_continued = TRUE;
475475}
476476
r10326r10327
490490   if (!w->use_real_timing)
491491      time = 1;
492492
493   timer_adjust_oneshot(w->timer_track, attotime::from_usec(time), 0);
493   w->timer_track->adjust(attotime::from_usec(time));
494494
495495   w->to_be_continued = TRUE;
496496}
r10326r10327
524524      time = 1;
525525   }
526526
527   timer_adjust_oneshot(w->timer_seek, attotime::from_usec(time), 0);
527   w->timer_seek->adjust(attotime::from_usec(time));
528528   w->to_be_continued = TRUE;
529529}
530530
src/mess/machine/i8257.c
r10326r10327
420420      {
421421         set_hrq(device, 0);
422422         i8257->state = STATE_SI;
423         timer_enable(i8257->dma_timer, 0);
423         i8257->dma_timer->enable(0);
424424      }
425425      else
426426      {
r10326r10327
545545
546546      if ((i8257->state == STATE_SI) && sample_drq(device))
547547      {
548         timer_enable(i8257->dma_timer, 1);
548         i8257->dma_timer->enable(1);
549549      }
550550
551551      if (LOG)
r10326r10327
591591
592592   if (state && (i8257->state == STATE_SI))
593593   {
594      timer_enable(i8257->dma_timer, 1);
594      i8257->dma_timer->enable(1);
595595   }
596596}
597597
r10326r10327
626626
627627   /* create the DMA timer */
628628   i8257->dma_timer = device->machine->scheduler().timer_alloc(FUNC(dma_tick), (void *)device);
629   timer_adjust_periodic(i8257->dma_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
629   i8257->dma_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock()));
630630
631631   /* register for state saving */
632632   state_save_register_device_item(device, 0, i8257->mr);
r10326r10327
668668   set_tc(device, 0);
669669   set_dack(device, -1);
670670
671   timer_enable(i8257->dma_timer, 0);
671   i8257->dma_timer->enable(0);
672672}
673673
674674/*-------------------------------------------------
src/mess/machine/tms5501.c
r10326r10327
233233
234234   if (tms->timer_counter[timer])
235235   {   /* reset clock interval */
236      timer_adjust_periodic(tms->timer[timer], attotime::from_double((double) tms->timer_counter[0] / (intf->clock_rate / 128.)), timer_name[timer], attotime::from_double((double) tms->timer_counter[timer] / (intf->clock_rate / 128.)));
236      tms->timer[timer]->adjust(attotime::from_double((double) tms->timer_counter[0] / (intf->clock_rate / 128.)), timer_name[timer], attotime::from_double((double) tms->timer_counter[timer] / (intf->clock_rate / 128.)));
237237   }
238238   else
239239   {   /* clock interval == 0 -> no timer */
r10326r10327
245245         case 3: tms5501_timer_decrementer(device, TMS5501_TIMER_3_INT); break;
246246         case 4: tms5501_timer_decrementer(device, TMS5501_TIMER_4_INT); break;
247247      }
248      timer_enable(tms->timer[timer], 0);
248      tms->timer[timer]->enable(0);
249249   }
250250}
251251
r10326r10327
267267   for (i=0; i<5; i++)
268268   {
269269      tms->timer_counter[i] = 0;
270      timer_enable(tms->timer[i], 0);
270      tms->timer[i]->enable(0);
271271   }
272272
273273   LOG_TMS5501(device, "Reset", 0);
r10326r10327
286286   for (i = 0; i < 5; i++)
287287   {
288288      tms->timer[i] = device->machine->scheduler().timer_alloc(FUNC(tms5501_timer_decrementer_callback), (void *) device);
289      timer_set_param(tms->timer[i], i);
289      tms->timer[i]->set_param(i);
290290   }
291291
292292   tms->interrupt_mask = 0;
src/mess/machine/sgi.c
r10326r10327
491491void sgi_mc_timer_init(running_machine *machine)
492492{
493493   tMC_UpdateTimer = machine->scheduler().timer_alloc(FUNC(mc_update_callback));
494   timer_adjust_periodic(tMC_UpdateTimer, attotime::from_hz(10000), 0, attotime::from_hz(10000));
494   tMC_UpdateTimer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000));
495495}
496496
497497void sgi_mc_init(running_machine *machine)
src/mess/machine/bbc.c
r10326r10327
14411441   if (status)
14421442   {
14431443      cassette_change_state(machine->device("cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
1444      timer_adjust_periodic(state->tape_timer, attotime::zero, 0, attotime::from_hz(44100));
1444      state->tape_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
14451445   }
14461446   else
14471447   {
14481448      cassette_change_state(machine->device("cassette"), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
1449      timer_reset(state->tape_timer, attotime::never);
1449      state->tape_timer->reset();
14501450      state->len0 = 0;
14511451      state->len1 = 0;
14521452      state->len2 = 0;
src/mess/machine/kc.c
r10326r10327
420420      if (motor_state)
421421      {
422422         /* start timer */
423         timer_adjust_periodic(state->cassette_timer, attotime::zero, 0, KC_CASSETTE_TIMER_FREQUENCY);
423         state->cassette_timer->adjust(attotime::zero, 0, KC_CASSETTE_TIMER_FREQUENCY);
424424      }
425425      else
426426      {
427427         /* stop timer */
428         timer_reset(state->cassette_timer, attotime::never);
428         state->cassette_timer->reset();
429429      }
430430   }
431431
src/mess/video/vidbrain.c
r10326r10327
175175{
176176   int scanline = ((m_cmd & COMMAND_YINT_H_O) << 1) | m_y_int;
177177
178   m_timer_y_odd->adjust(m_screen->time_until_pos(scanline, 0), 0, m_screen->frame_period());
179   m_timer_y_even->adjust(m_screen->time_until_pos(scanline + 262, 0), 0, m_screen->frame_period());
178   m_timer_y_odd->adjust(m_screen->time_until_pos(scanline), 0, m_screen->frame_period());
179   m_timer_y_even->adjust(m_screen->time_until_pos(scanline + 262), 0, m_screen->frame_period());
180180}
181181
182182
src/mess/video/upd3301.c
r10326r10327
217217
218218   attotime duration = upd3301->screen->time_until_pos(next_y, next_x);
219219
220   timer_adjust_oneshot(upd3301->hrtc_timer, duration, !state);
220   upd3301->hrtc_timer->adjust(duration, !state);
221221}
222222
223223/*-------------------------------------------------
r10326r10327
231231
232232   attotime duration = upd3301->screen->time_until_pos(next_y, 0);
233233
234   timer_adjust_oneshot(upd3301->vrtc_timer, duration, !state);
234   upd3301->vrtc_timer->adjust(duration, !state);
235235}
236236
237237/*-------------------------------------------------
src/mess/video/coco6847.c
r10326r10327
14501450   attotime duration;
14511451
14521452   /* get the time since last field sync */
1453   duration = timer_starttime(m6847->hs_rise_timer) - timer_starttime(m6847->fs_rise_timer);
1453   duration = m6847->hs_rise_timer->start() - m6847->fs_rise_timer->start();
14541454   assert_always(duration.seconds == 0, "get_scanline(): duration exceeds one second");
14551455
14561456   if (duration.attoseconds < m6847->vblank_period)
r10326r10327
14711471   attotime scanline_time;
14721472   int result;
14731473
1474   scanline_time = timer_timeelapsed(m6847->hs_rise_timer);
1474   scanline_time = m6847->hs_rise_timer->elapsed();
14751475   if (scanline_time.seconds != 0)
14761476      return 0;
14771477   assert(scanline_time.as_attoseconds() < m6847->scanline_period);
r10326r10327
15871587
15881588int m6847_get_horizontal_sync(running_machine *machine)
15891589{
1590   attotime fire_time = timer_firetime(m6847->hs_fall_timer);
1590   attotime fire_time = m6847->hs_fall_timer->expire();
15911591   return fire_time > machine->time();
15921592}
15931593
r10326r10327
15951595
15961596static void set_horizontal_sync(running_machine *machine)
15971597{
1598   attotime fire_time = timer_firetime(m6847->hs_fall_timer);
1598   attotime fire_time = m6847->hs_fall_timer->expire();
15991599   int horizontal_sync = fire_time >  machine->time();
16001600   if (m6847->horizontal_sync_callback)
16011601      m6847->horizontal_sync_callback(machine, !horizontal_sync);
r10326r10327
16051605
16061606int m6847_get_field_sync(running_machine *machine)
16071607{
1608   attotime fire_time = timer_firetime(m6847->fs_fall_timer);
1608   attotime fire_time = m6847->fs_fall_timer->expire();
16091609   return fire_time > machine->time();
16101610}
16111611
r10326r10327
16131613
16141614static void set_field_sync(running_machine *machine)
16151615{
1616   attotime fire_time = timer_firetime(m6847->fs_fall_timer);
1616   attotime fire_time = m6847->fs_fall_timer->expire();
16171617   int field_sync = fire_time > machine->time();
16181618   if (m6847->field_sync_callback)
16191619      m6847->field_sync_callback(machine,field_sync);
r10326r10327
16401640   if (LOG_HS)
16411641      logerror("hs_rise(): time=%s\n", machine->time().as_string(ATTOTIME_STRING_PRECISION));
16421642
1643   timer_adjust_oneshot(m6847->hs_rise_timer,
1643   m6847->hs_rise_timer->adjust(
16441644      attotime(0, m6847->scanline_period), 0);
1645   timer_adjust_oneshot(m6847->hs_fall_timer,
1645   m6847->hs_fall_timer->adjust(
16461646      attotime(0, m6847->horizontal_sync_period), 0);
16471647
16481648   set_horizontal_sync(machine);
r10326r10327
16631663      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 */
1666   timer_adjust_oneshot(m6847->fs_fall_timer,
1666   m6847->fs_fall_timer->adjust(
16671667      attotime(0, m6847->field_sync_period), 0);
16681668
16691669   /* adjust horizontal sync rising timer */
1670   timer_adjust_oneshot(m6847->hs_rise_timer, attotime::zero, 0);
1670   m6847->hs_rise_timer->adjust(attotime::zero);
16711671
16721672   /* this is a hook for the CoCo 3 code to extend this stuff */
16731673   if (m6847->new_frame_callback)
r10326r10327
19071907   /* setup timing */
19081908   frame_period = period *
19091909      (UINT32) (v->clocks_per_scanline * total_scanlines * GROSS_FACTOR);
1910   timer_adjust_periodic(m6847->fs_rise_timer, attotime::zero, 0, attotime(0, frame_period));
1910   m6847->fs_rise_timer->adjust(attotime::zero, 0, attotime(0, frame_period));
19111911
19121912   /* setup save states */
19131913   state_save_register_postload(machine, m6847_postload, NULL);
src/mess/video/911_vdt.c
r10326r10327
479479         /* beep enable strobe - not tested */
480480         beep_set_state(device->machine->device("beep"), 1);
481481
482         timer_adjust_oneshot(vdt->beep_timer, attotime::from_usec(300), 0);
482         vdt->beep_timer->adjust(attotime::from_usec(300));
483483         break;
484484
485485      case 0xf:
src/mess/video/gb.c
r10326r10327
298298   if ( ( LCDSTAT & 0x03 ) == 0x03 )
299299   {
300300      /* Calculate number of pixels to render based on time still left on the timer */
301      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_timeleft( state->lcd.lcd_timer ) );
301      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(state->lcd.lcd_timer ->remaining( ) );
302302      int l = 0;
303303
304304      if ( state->lcd.start_x < 0 )
r10326r10327
623623   if ( ( LCDSTAT & 0x03 ) == 0x03 )
624624   {
625625      /* Calcuate number of pixels to render based on time still left on the timer */
626      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_timeleft( state->lcd.lcd_timer ) );
626      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(state->lcd.lcd_timer ->remaining( ) );
627627      int l = 0;
628628
629629      if ( state->lcd.start_x < 0 )
r10326r10327
931931   if ( ( LCDSTAT & 0x03 ) == 0x03 )
932932   {
933933      /* Calcuate number of pixels to render based on time still left on the timer */
934      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_timeleft( state->lcd.lcd_timer ) );
934      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(state->lcd.lcd_timer ->remaining( ) );
935935      int l = 0;
936936
937937      if ( state->lcd.start_x < 0 )
r10326r10327
12881288   switch( mode )
12891289   {
12901290   case GB_VIDEO_DMG:
1291      timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(456), 0);
1291      state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(456));
12921292
12931293      /* set the scanline update function */
12941294      state->update_scanline = gb_update_scanline;
r10326r10327
13221322      CURLINE = state->lcd.current_line = 0;
13231323      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x05;
13241324      state->lcd.mode = 1;
1325      timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(60), GB_LCD_STATE_LY00_M0);
1325      state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(60), GB_LCD_STATE_LY00_M0);
13261326
13271327      break;
13281328   case GB_VIDEO_SGB:
r10326r10327
14181418               state->lcd.mode_irq = 0;
14191419            }
14201420         }
1421         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0);
1421         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0);
14221422         break;
14231423      case GB_LCD_STATE_LYXX_M0:      /* Switch to mode 0 */
14241424         /* update current scanline */
r10326r10327
14431443         if ( ( SCROLLX & 0x03 ) == 0x03 )
14441444         {
14451445            state->lcd.scrollx_adjust += 4;
1446            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3);
1446            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3);
14471447            break;
14481448         }
14491449      case GB_LCD_STATE_LYXX_M0_SCX3:
r10326r10327
14531453         {
14541454            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
14551455         }
1456         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(196 - state->lcd.scrollx_adjust - state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
1456         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(196 - state->lcd.scrollx_adjust - state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
14571457         break;
14581458      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
14591459         if ( CURLINE < 143 )
r10326r10327
14761476               }
14771477            }
14781478         }
1479         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC);
1479         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC);
14801480         break;
14811481      case GB_LCD_STATE_LYXX_M0_INC:   /* Increment LY, stay in M0 for 4 more cycles */
14821482         gb_increment_scanline(state);
r10326r10327
14931493         /* Check if we're going into VBlank next */
14941494         if ( CURLINE == 144 )
14951495         {
1496            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
1496            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
14971497         }
14981498         else
14991499         {
r10326r10327
15061506               state->lcd.mode_irq = 1;
15071507               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
15081508            }
1509            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2);
1509            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2);
15101510         }
15111511         break;
15121512      case GB_LCD_STATE_LY00_M2:      /* Switch to mode 2 on line #0 */
r10326r10327
15221522         /* Check for regular compensation of x-scroll register */
15231523         state->lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
15241524         /* Mode 2 lasts approximately 80 clock cycles */
1525         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
1525         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
15261526         break;
15271527      case GB_LCD_STATE_LYXX_M2:      /* Switch to mode 2 */
15281528         /* Update STAT register to the correct state */
r10326r10327
15441544         /* Check for regular compensation of x-scroll register */
15451545         state->lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
15461546         /* Mode 2 last for approximately 80 clock cycles */
1547         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
1547         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
15481548         break;
15491549      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
15501550         gb_select_sprites(state);
r10326r10327
15551555         state->lcd.vram_locked = LOCKED;
15561556         /* Check for compensations of x-scroll register */
15571557         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1558         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(168 + state->lcd.scrollx_adjust + state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
1558         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(168 + state->lcd.scrollx_adjust + state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
15591559         state->lcd.start_x = -1;
15601560         break;
15611561      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
r10326r10327
15811581         {
15821582            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
15831583         }
1584         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC);
1584         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC);
15851585         break;
15861586      case GB_LCD_STATE_LY9X_M1_INC:      /* Increment scanline counter */
15871587         gb_increment_scanline(state);
r10326r10327
15971597         LCDSTAT &= 0xFB;
15981598         if ( state->lcd.current_line == 153 )
15991599         {
1600            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1);
1600            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1);
16011601         }
16021602         else
16031603         {
1604            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
1604            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
16051605         }
16061606         break;
16071607      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
r10326r10327
16221622         state->lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
16231623         state->lcd.line_irq = 0;
16241624         LCDSTAT &= 0xFB;
1625         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1);
1625         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1);
16261626         break;
16271627      case GB_LCD_STATE_LY00_M1_1:
16281628         if ( ! state->lcd.delayed_line_irq && state->lcd.triggering_line_irq )
r10326r10327
16301630            state->lcd.line_irq = state->lcd.triggering_line_irq;
16311631            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16321632         }
1633         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2);
1633         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2);
16341634         break;
16351635      case GB_LCD_STATE_LY00_M1_2:   /* Rest of line #0 during VBlank */
16361636         if ( state->lcd.delayed_line_irq && state->lcd.triggering_line_irq )
r10326r10327
16421642         {
16431643            LCDSTAT |= 0x04;
16441644         }
1645         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0);
1645         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0);
16461646         break;
16471647      case GB_LCD_STATE_LY00_M0:      /* The STAT register seems to go to 0 for about 4 cycles */
16481648         /* Set Mode 0 lcdstat */
16491649         state->lcd.mode = 0;
16501650         LCDSTAT = ( LCDSTAT & 0xFC );
1651         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2);
1651         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2);
16521652         break;
16531653      }
16541654   }
r10326r10327
16591659      {
16601660         (*state->update_scanline)( machine );
16611661      }
1662      timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(456), 0);
1662      state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(456));
16631663   }
16641664}
16651665
r10326r10327
16911691               state->lcd.mode_irq = 0;
16921692            }
16931693         }
1694         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0);
1694         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0);
16951695         break;
16961696      case GB_LCD_STATE_LYXX_M0:      /* Switch to mode 0 */
16971697         /* update current scanline */
r10326r10327
17171717         if ( ( SCROLLX & 0x03 ) == 0x03 )
17181718         {
17191719            state->lcd.scrollx_adjust += 4;
1720            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3);
1720            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3);
17211721            break;
17221722         }
17231723      case GB_LCD_STATE_LYXX_M0_SCX3:
r10326r10327
17321732         {
17331733            state->lcd.pal_locked = UNLOCKED;
17341734         }
1735         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL);
1735         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL);
17361736         break;
17371737      case GB_LCD_STATE_LYXX_M0_GBC_PAL:
17381738         state->lcd.pal_locked = UNLOCKED;
r10326r10327
17461746         {
17471747            state->lcd.hdma_possible = 1;
17481748         }
1749         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(192 - state->lcd.scrollx_adjust - state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
1749         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(192 - state->lcd.scrollx_adjust - state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
17501750         break;
17511751      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
17521752         state->lcd.cmp_line = CMPLINE;
r10326r10327
17691769               }
17701770            }
17711771         }
1772         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC);
1772         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC);
17731773         break;
17741774      case GB_LCD_STATE_LYXX_M0_INC:   /* Increment LY, stay in M0 for 4 more cycles */
17751775         gb_increment_scanline(state);
r10326r10327
17851785         /* Check if we're going into VBlank next */
17861786         if ( CURLINE == 144 )
17871787         {
1788            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
1788            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
17891789         }
17901790         else
17911791         {
r10326r10327
17981798               state->lcd.mode_irq = 1;
17991799               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
18001800            }
1801            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2);
1801            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2);
18021802         }
18031803         break;
18041804      case GB_LCD_STATE_LY00_M2:      /* Switch to mode 2 on line #0 */
r10326r10327
18141814         /* Check for regular compensation of x-scroll register */
18151815         state->lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
18161816         /* Mode 2 lasts approximately 80 clock cycles */
1817         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
1817         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
18181818         break;
18191819      case GB_LCD_STATE_LYXX_M2:      /* Switch to mode 2 */
18201820         /* Update STAT register to the correct state */
r10326r10327
18391839         /* Check for regular compensation of x-scroll register */
18401840         state->lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
18411841         /* Mode 2 last for approximately 80 clock cycles */
1842         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
1842         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
18431843         break;
18441844      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
18451845         gb_select_sprites(state);
r10326r10327
18511851         state->lcd.pal_locked = LOCKED;
18521852         /* Check for compensations of x-scroll register */
18531853         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1854         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(168 + state->lcd.scrollx_adjust + state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
1854         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(168 + state->lcd.scrollx_adjust + state->lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
18551855         state->lcd.start_x = -1;
18561856         break;
18571857      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
r10326r10327
18811881         {
18821882            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
18831883         }
1884         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC);
1884         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC);
18851885         break;
18861886      case GB_LCD_STATE_LY9X_M1_INC:      /* Increment scanline counter */
18871887         gb_increment_scanline(state);
r10326r10327
18951895         }
18961896         if ( state->lcd.current_line == 153 )
18971897         {
1898            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1);
1898            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1);
18991899         }
19001900         else
19011901         {
1902            timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
1902            state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
19031903         }
19041904         break;
19051905      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
r10326r10327
19241924         state->lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
19251925         state->lcd.line_irq = 0;
19261926         LCDSTAT &= 0xFB;
1927         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1);
1927         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1);
19281928         break;
19291929      case GB_LCD_STATE_LY00_M1_1:
19301930         if ( ! state->lcd.delayed_line_irq && state->lcd.triggering_line_irq )
r10326r10327
19321932            state->lcd.line_irq = state->lcd.triggering_line_irq;
19331933            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19341934         }
1935         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2);
1935         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2);
19361936         break;
19371937      case GB_LCD_STATE_LY00_M1_2:   /* Rest of line #0 during VBlank */
19381938         if ( state->lcd.delayed_line_irq && state->lcd.triggering_line_irq )
r10326r10327
19481948         {
19491949            LCDSTAT &= ~0x04;
19501950         }
1951         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0);
1951         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0);
19521952         break;
19531953      case GB_LCD_STATE_LY00_M0:      /* The STAT register seems to go to 0 for about 4 cycles */
19541954         /* Set Mode 0 lcdstat */
19551955         state->lcd.mode = 0;
1956         timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2);
1956         state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2);
19571957         break;
19581958      }
19591959   }
r10326r10327
19641964      {
19651965         (*state->update_scanline)( machine );
19661966      }
1967      timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(456), 0);
1967      state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(456));
19681968   }
19691969}
19701970
r10326r10327
19891989      }
19901990   }
19911991   state->lcd.state = GB_LCD_STATE_LY00_M2;
1992   timer_adjust_oneshot(state->lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
1992   state->lcd.lcd_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
19931993}
19941994
19951995READ8_HANDLER( gb_video_r )
src/mess/video/gamecom.c
r10326r10327
6666   gamecom_state *state = machine->driver_data<gamecom_state>();
6767   VIDEO_START_CALL( generic_bitmapped );
6868   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(gamecom_scanline));
69   timer_adjust_periodic( state->scanline_timer, machine->primary_screen->time_until_pos(0, 0 ), 0, machine->primary_screen->scan_period() );
69   state->scanline_timer->adjust( machine->primary_screen->time_until_pos(0 ), 0, machine->primary_screen->scan_period() );
7070
7171}
7272
src/mess/video/vectrex.c
r10326r10327
131131      period = (attotime::from_hz(cputag_get_clock(space->machine, "maincpu")) * state->via_timer2);
132132
133133      if (state->reset_refresh)
134         timer_adjust_periodic(state->refresh, period, 0, period);
134         state->refresh->adjust(period, 0, period);
135135      else
136         timer_adjust_periodic(state->refresh,
137                          min(period, timer_timeleft(state->refresh)),
136         state->refresh->adjust(
137                          min(period, state->refresh->remaining()),
138138                          0,
139139                          period);
140140      break;
r10326r10327
293293
294294   state->vector_add_point_function = vectrex_add_point;
295295   state->imager_timer = machine->scheduler().timer_alloc(FUNC(vectrex_imager_eye));
296   timer_adjust_periodic(state->imager_timer,
296   state->imager_timer->adjust(
297297                    attotime::from_hz(state->imager_freq),
298298                    2,
299299                    attotime::from_hz(state->imager_freq));
r10326r10327
365365                  +(double)(state->pen_y - state->y_int) * (state->pen_y - state->y_int);
366366               d2 = b2 - ab * ab / a2;
367367               if (d2 < 2e10 && state->analog[A_Z] * state->blank > 0)
368                  timer_adjust_oneshot(state->lp_t, attotime::from_double(ab / a2 / (cputag_get_clock(device->machine, "maincpu") * INT_PER_CLOCK)), 0);
368                  state->lp_t->adjust(attotime::from_double(ab / a2 / (cputag_get_clock(device->machine, "maincpu") * INT_PER_CLOCK)));
369369            }
370370         }
371371      }
r10326r10327
383383      {
384384         /* Cancel running timer, line already finished */
385385         if (state->lightpen_down)
386            timer_adjust_oneshot(state->lp_t, attotime::never, 0);
386            state->lp_t->adjust(attotime::never);
387387      }
388388   }
389389
src/mess/video/aim65.c
r10326r10327
9595   if (!data)
9696   {
9797      aim65_printer_cr(state);
98      timer_adjust_periodic(state->print_timer, attotime::zero, 0, attotime::from_usec(10));
98      state->print_timer->adjust(attotime::zero, 0, attotime::from_usec(10));
9999      via_0->write_cb1(0);
100100      state->printer_level = 1;
101101   }
102102   else
103      timer_reset(state->print_timer, attotime::never);
103      state->print_timer->reset();
104104}
105105
106106
src/mess/video/m6847.c
r10326r10327
11861186   attotime duration;
11871187
11881188   /* get the time since last field sync */
1189   duration = timer_starttime(mc6847->hs_rise_timer) - timer_starttime(mc6847->fs_rise_timer);
1189   duration = mc6847->hs_rise_timer->start() - mc6847->fs_rise_timer->start();
11901190   assert_always(duration.seconds == 0, "get_scanline(): duration exceeds one second");
11911191
11921192   if (duration.attoseconds < mc6847->vblank_period)
r10326r10327
13621362   if (LOG_HS)
13631363      logerror("hs_rise(): time=%s\n", machine->time().as_string(ATTOTIME_STRING_PRECISION));
13641364
1365   timer_adjust_oneshot(mc6847->hs_rise_timer,
1365   mc6847->hs_rise_timer->adjust(
13661366      attotime(0, mc6847->scanline_period), 0);
1367   timer_adjust_oneshot(mc6847->hs_fall_timer,
1367   mc6847->hs_fall_timer->adjust(
13681368      attotime(0, mc6847->horizontal_sync_period), 0);
13691369
13701370   mc6847->hs = CLEAR_LINE;
r10326r10327
13921392      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 */
1395   timer_adjust_oneshot(mc6847->fs_fall_timer,
1395   mc6847->fs_fall_timer->adjust(
13961396      attotime(0, mc6847->field_sync_period), 0);
13971397
13981398   /* adjust horizontal sync rising timer */
1399   timer_adjust_oneshot(mc6847->hs_rise_timer, attotime::zero, 0);
1399   mc6847->hs_rise_timer->adjust(attotime::zero);
14001400
14011401   /* this is a hook for the CoCo 3 code to extend this stuff */
14021402   if (mc6847->new_frame_callback)
r10326r10327
14211421   attotime scanline_time;
14221422   int result;
14231423
1424   scanline_time = timer_timeelapsed(mc6847->hs_rise_timer);
1424   scanline_time = mc6847->hs_rise_timer->elapsed();
14251425   if (scanline_time.seconds != 0)
14261426      return 0;
14271427   assert(scanline.as_attoseconds() < mc6847->scanline_period);
r10326r10327
18961896   /* setup timing */
18971897   frame_period = period *
18981898      (UINT32) (v->clocks_per_scanline * total_scanlines * GROSS_FACTOR);
1899   timer_adjust_periodic(mc6847->fs_rise_timer, attotime::zero, 0, attotime(0, frame_period));
1899   mc6847->fs_rise_timer->adjust(attotime::zero, 0, attotime(0, frame_period));
19001900
19011901   /* build font */
19021902   build_fontdata(device, v);
src/mess/video/thomson.c
r10326r10327
9898INLINE unsigned thom_video_elapsed ( running_machine *machine )
9999{
100100   unsigned u;
101   attotime elapsed = timer_timeelapsed( thom_video_timer );
101   attotime elapsed = thom_video_timer ->elapsed( );
102102   u = (elapsed * 1000000 ).seconds;
103103   if ( u >= 19968 )
104104      u = 19968;
r10326r10327
216216      thom_lightpen_cb( machine, step );
217217
218218   if ( step < thom_lightpen_nb )
219      timer_adjust_oneshot(thom_lightpen_timer, attotime::from_usec( 64 ), step + 1);
219      thom_lightpen_timer->adjust(attotime::from_usec( 64 ), step + 1);
220220}
221221
222222
r10326r10327
822822
823823   /* prepare for next scanline */
824824   if ( y == 199 )
825      timer_adjust_oneshot(thom_scanline_timer, attotime::never, 0);
825      thom_scanline_timer->adjust(attotime::never);
826826   else
827827   {
828828
r10326r10327
847847         thom_pal_changed = 0;
848848      }
849849
850      timer_adjust_oneshot(thom_scanline_timer, attotime::from_usec(64), y + 1);
850      thom_scanline_timer->adjust(attotime::from_usec(64), y + 1);
851851   }
852852}
853853
r10326r10327
10301030   if ( thom_init_cb )
10311031      thom_init_cb( machine, init );
10321032   if ( ! init )
1033      timer_adjust_oneshot(thom_init_timer, attotime::from_usec( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init);
1033      thom_init_timer->adjust(attotime::from_usec( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init);
10341034}
10351035
10361036/* call this at the very begining of each new frame */
r10326r10327
10681068   thom_vstate_dirty = 0;
10691069
10701070   /* schedule first init signal */
1071   timer_adjust_oneshot(thom_init_timer, attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7 ), 0);
1071   thom_init_timer->adjust(attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7 ));
10721072
10731073   /* schedule first lightpen signal */
10741074   l.line &= ~1; /* hack (avoid lock in MO6 palette selection) */
1075   timer_adjust_oneshot(thom_lightpen_timer,
1075   thom_lightpen_timer->adjust(
10761076            attotime::from_usec( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ), 0);
10771077
10781078   /* schedule first active-area scanline call-back */
1079   timer_adjust_oneshot(thom_scanline_timer, attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7), -1);
1079   thom_scanline_timer->adjust(attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7), -1);
10801080
10811081   /* reset video frame time */
1082   timer_adjust_oneshot(thom_video_timer, attotime::zero, 0);
1082   thom_video_timer->adjust(attotime::zero);
10831083
10841084   /* update screen size according to user options */
10851085   if ( thom_update_screen_size( machine ) )
src/mess/video/x68k.c
r10326r10327
191191            if(scan > state->crtc.vend)
192192               scan = state->crtc.vbegin;
193193            hsync_time = machine->primary_screen->time_until_pos(scan,(state->crtc.htotal + state->crtc.hend) / 2);
194            timer_adjust_oneshot(state->scanline_timer, hsync_time, 0);
194            state->scanline_timer->adjust(hsync_time);
195195            if(scan != 0)
196196            {
197197               if((input_port_read(machine, "options") & 0x04))
r10326r10327
206206            if(scan > state->crtc.vend)
207207               scan = state->crtc.vbegin;
208208            hsync_time = machine->primary_screen->time_until_pos(scan,state->crtc.hend / 2);
209            timer_adjust_oneshot(state->scanline_timer, hsync_time, 0);
209            state->scanline_timer->adjust(hsync_time);
210210            if(scan != 0)
211211            {
212212               if((input_port_read(machine, "options") & 0x04))
r10326r10327
226226            else
227227               scan++;
228228            hsync_time = machine->primary_screen->time_until_pos(scan,state->crtc.hbegin / 2);
229            timer_adjust_oneshot(state->scanline_timer, hsync_time, 1);
229            state->scanline_timer->adjust(hsync_time, 1);
230230            state->oddscanline = 0;
231231         }
232232         else
233233         {
234234            hsync_time = machine->primary_screen->time_until_pos(machine->primary_screen->vpos(),(state->crtc.htotal + state->crtc.hbegin) / 2);
235            timer_adjust_oneshot(state->scanline_timer, hsync_time, 1);
235            state->scanline_timer->adjust(hsync_time, 1);
236236            state->oddscanline = 1;
237237         }
238238      }
r10326r10327
245245         if(scan > state->crtc.vend)
246246            scan = 0;
247247         hsync_time = machine->primary_screen->time_until_pos(scan,state->crtc.hend);
248         timer_adjust_oneshot(state->scanline_timer, hsync_time, 0);
248         state->scanline_timer->adjust(hsync_time);
249249         if(scan != 0)
250250         {
251251            if((input_port_read(machine, "options") & 0x04))
r10326r10327
257257      if(hstate == 0)
258258      {
259259         hsync_time = machine->primary_screen->time_until_pos(machine->primary_screen->vpos()+1,state->crtc.hbegin);
260         timer_adjust_oneshot(state->scanline_timer, hsync_time, 1);
260         state->scanline_timer->adjust(hsync_time, 1);
261261   //      if(!(state->mfp.gpio & 0x40))  // if GPIP6 is active, clear it
262262   //          state->mfp.gpio |= 0x40;
263263      }
r10326r10327
286286      irq_time = machine->primary_screen->time_until_pos(scan,state->crtc.hbegin);
287287      // end of HBlank period clears GPIP6 also?
288288      end_time = machine->primary_screen->time_until_pos(scan,state->crtc.hend);
289      timer_adjust_oneshot(state->raster_irq, irq_time, scan);
289      state->raster_irq->adjust(irq_time, scan);
290290      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   }
r10326r10327
305305      state->crtc.vblank = 1;
306306      vblank_line = state->crtc.vbegin;
307307      irq_time = machine->primary_screen->time_until_pos(vblank_line,2);
308      timer_adjust_oneshot(state->vblank_irq, irq_time, 0);
308      state->vblank_irq->adjust(irq_time);
309309      logerror("CRTC: VBlank on\n");
310310   }
311311   if(val == 0)  // V-DISP off
r10326r10327
315315      if(vblank_line > state->crtc.vtotal)
316316         vblank_line = state->crtc.vtotal;
317317      irq_time = machine->primary_screen->time_until_pos(vblank_line,2);
318      timer_adjust_oneshot(state->vblank_irq, irq_time, 1);
318      state->vblank_irq->adjust(irq_time, 1);
319319      logerror("CRTC: VBlank off\n");
320320   }
321321
r10326r10327
397397         irq_time = space->machine->primary_screen->time_until_pos((data) / state->crtc.vmultiple,2);
398398
399399         if(irq_time.as_double() > 0)
400            timer_adjust_oneshot(state->raster_irq, irq_time, (data) / state->crtc.vmultiple);
400            state->raster_irq->adjust(irq_time, (data) / state->crtc.vmultiple);
401401      }
402402      logerror("CRTC: Write to raster IRQ register - %i\n",data);
403403      break;
r10326r10327
11111111   tilemap_set_transparent_pen(state->bg0_16,0);
11121112   tilemap_set_transparent_pen(state->bg1_16,0);
11131113
1114//  timer_adjust_periodic(state->scanline_timer, attotime::zero, 0, attotime::from_hz(55.45)/568);
1114//  state->scanline_timer->adjust(attotime::zero, 0, attotime::from_hz(55.45)/568);
11151115}
11161116
11171117VIDEO_UPDATE( x68000 )
src/mess/video/crtc_ega.c
r10326r10327
365365      else
366366         duration = attotime::never;
367367
368      timer_adjust_oneshot(crtc_ega->de_changed_timer, duration, 0);
368      crtc_ega->de_changed_timer->adjust(duration);
369369   }
370370}
371371
r10326r10327
388388      if (next_y > crtc_ega->max_visible_y)
389389         next_y = 0;
390390
391      timer_adjust_oneshot(crtc_ega->hsync_on_timer,  crtc_ega->screen->time_until_pos(next_y, crtc_ega->hsync_on_pos) , 0);
392      timer_adjust_oneshot(crtc_ega->hsync_off_timer, crtc_ega->screen->time_until_pos(next_y, crtc_ega->hsync_off_pos), 0);
391      crtc_ega->hsync_on_timer->adjust(crtc_ega->screen->time_until_pos(next_y, crtc_ega->hsync_on_pos) );
392      crtc_ega->hsync_off_timer->adjust(crtc_ega->screen->time_until_pos(next_y, crtc_ega->hsync_off_pos));
393393   }
394394}
395395
r10326r10327
398398{
399399   if (crtc_ega->has_valid_parameters && (crtc_ega->vsync_on_timer != NULL))
400400   {
401      timer_adjust_oneshot(crtc_ega->vsync_on_timer,  crtc_ega->screen->time_until_pos(crtc_ega->vsync_on_pos,  0), 0);
402      timer_adjust_oneshot(crtc_ega->vsync_off_timer, crtc_ega->screen->time_until_pos(crtc_ega->vsync_off_pos, 0), 0);
401      crtc_ega->vsync_on_timer->adjust(crtc_ega->screen->time_until_pos(crtc_ega->vsync_on_pos,  0));
402      crtc_ega->vsync_off_timer->adjust(crtc_ega->screen->time_until_pos(crtc_ega->vsync_off_pos, 0));
403403   }
404404}
405405
r10326r10327
408408{
409409   if (crtc_ega->has_valid_parameters && (crtc_ega->vblank_on_timer != NULL))
410410   {
411      timer_adjust_oneshot(crtc_ega->vblank_on_timer,  crtc_ega->screen->time_until_pos(crtc_ega->vert_disp_end,  crtc_ega->hsync_on_pos), 0);
412      timer_adjust_oneshot(crtc_ega->vblank_off_timer, crtc_ega->screen->time_until_pos(0, crtc_ega->hsync_off_pos), 0);
411      crtc_ega->vblank_on_timer->adjust(crtc_ega->screen->time_until_pos(crtc_ega->vert_disp_end,  crtc_ega->hsync_on_pos));
412      crtc_ega->vblank_off_timer->adjust(crtc_ega->screen->time_until_pos(0, crtc_ega->hsync_off_pos));
413413   }
414414}
415415
r10326r10327
585585      }
586586
587587      /* set the timer that will latch the display address into the light pen registers */
588      timer_adjust_oneshot(crtc_ega->light_pen_latch_timer, crtc_ega->screen->time_until_pos(y, x), 0);
588      crtc_ega->light_pen_latch_timer->adjust(crtc_ega->screen->time_until_pos(y, x));
589589   }
590590}
591591
src/mess/video/atarist.c
r10326r10327
10831083   m_shifter_timer = machine->scheduler().timer_alloc(FUNC(atarist_shifter_tick));
10841084   m_glue_timer = machine->scheduler().timer_alloc(FUNC(atarist_glue_tick));
10851085
1086//   timer_adjust_periodic(m_shifter_timer, machine->primary_screen->time_until_pos(0,0), 0, attotime::from_hz(Y2/4)); // 125 ns
1087   timer_adjust_periodic(m_glue_timer, machine->primary_screen->time_until_pos(0,0), 0, attotime::from_hz(Y2/16)); // 500 ns
1086//   m_shifter_timer->adjust(machine->primary_screen->time_until_pos(0), 0, attotime::from_hz(Y2/4)); // 125 ns
1087   m_glue_timer->adjust(machine->primary_screen->time_until_pos(0), 0, attotime::from_hz(Y2/16)); // 500 ns
10881088
10891089   /* register for state saving */
10901090   state_save_register_global(machine, m_shifter_base);
src/mess/video/upd7220.c
r10326r10327
311311
312312   attotime duration = upd7220->screen->time_until_pos(next_y, 0);
313313
314   timer_adjust_oneshot(upd7220->vsync_timer, duration, !state);
314   upd7220->vsync_timer->adjust(duration, !state);
315315}
316316
317317/*-------------------------------------------------
r10326r10327
350350
351351   attotime duration = upd7220->screen->time_until_pos(next_y, next_x);
352352
353   timer_adjust_oneshot(upd7220->hsync_timer, duration, !state);
353   upd7220->hsync_timer->adjust(duration, !state);
354354}
355355
356356/*-------------------------------------------------
r10326r10327
380380
381381   attotime duration = upd7220->screen->time_until_pos(next_y, next_x);
382382
383   timer_adjust_oneshot(upd7220->hsync_timer, duration, !state);
383   upd7220->hsync_timer->adjust(duration, !state);
384384}
385385
386386/*-------------------------------------------------
r10326r10327
441441   }
442442   else
443443   {
444      timer_enable(upd7220->hsync_timer, 0);
445      timer_enable(upd7220->vsync_timer, 0);
444      upd7220->hsync_timer->enable(0);
445      upd7220->vsync_timer->enable(0);
446446   }
447447
448448   update_blank_timer(upd7220, 0);
src/mess/video/gf4500.c
r10326r10327
1919      va_start( v, s_fmt);
2020      vsprintf( buf, s_fmt, v);
2121      va_end( v);
22      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
22      logerror( "%s: %s", machine->describe_context( ), buf);
2323   }
2424}
2525
src/mess/video/crt9007.c
r10326r10327
372372
373373   attotime duration = m_screen->time_until_pos(next_y, next_x);
374374
375   timer_adjust_oneshot(m_hsync_timer, duration, !state);
375   m_hsync_timer->adjust(duration, !state);
376376}
377377
378378
r10326r10327
386386
387387   attotime duration = m_screen->time_until_pos(next_y, 0);
388388
389   timer_adjust_oneshot(m_vsync_timer, duration, !state);
389   m_vsync_timer->adjust(duration, !state);
390390}
391391
392392
r10326r10327
404404
405405   attotime duration = m_screen->time_until_pos(next_y, next_x);
406406
407   timer_adjust_oneshot(m_vlt_timer, duration, !state);
407   m_vlt_timer->adjust(duration, !state);
408408}
409409
410410
r10326r10327
451451
452452   attotime duration = m_screen->time_until_pos(next_y, next_x);
453453
454   timer_adjust_oneshot(m_drb_timer, duration, !state);
454   m_drb_timer->adjust(duration, !state);
455455}
456456
457457
r10326r10327
514514
515515   m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);
516516
517   timer_adjust_oneshot(m_hsync_timer, m_screen->time_until_pos(0, 0), 0);
518   timer_adjust_oneshot(m_vsync_timer, m_screen->time_until_pos(0, 0), 0);
519   timer_adjust_oneshot(m_vlt_timer, m_screen->time_until_pos(0, m_vlt_start), 1);
520   timer_adjust_oneshot(m_drb_timer, m_screen->time_until_pos(0, 0), 0);
517   m_hsync_timer->adjust(m_screen->time_until_pos(0, 0));
518   m_vsync_timer->adjust(m_screen->time_until_pos(0, 0));
519   m_vlt_timer->adjust(m_screen->time_until_pos(0, m_vlt_start), 1);
520   m_drb_timer->adjust(m_screen->time_until_pos(0, 0));
521521}
522522
523523
r10326r10327
962962   if (m_dmar && !m_ack && state)
963963   {
964964      // start DMA transfer
965      timer_adjust_oneshot(m_dma_timer, attotime::from_hz(clock()), 0);
965      m_dma_timer->adjust(attotime::from_hz(clock()));
966966   }
967967
968968   m_ack = state;
src/mess/video/electron.c
r10326r10327
4747      state->map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 );
4848   }
4949   state->scanline_timer = machine->scheduler().timer_alloc(FUNC(electron_scanline_interrupt));
50   timer_adjust_periodic( state->scanline_timer, machine->primary_screen->time_until_pos(0), 0, machine->primary_screen->scan_period() );
50   state->scanline_timer->adjust( machine->primary_screen->time_until_pos(0), 0, machine->primary_screen->scan_period() );
5151}
5252
5353INLINE UINT8 read_vram( electron_state *state, UINT16 addr )
src/mess/video/zx8301.c
r10326r10327
188188   m_flash_timer = timer_alloc(TIMER_FLASH);
189189
190190   // adjust timer periods
191   timer_adjust_periodic(m_vsync_timer, attotime::zero, 0, attotime::from_hz(50));
192   timer_adjust_periodic(m_flash_timer, attotime::from_hz(2), 0, attotime::from_hz(2));
191   m_vsync_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
192   m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
193193
194194   // register for state saving
195195   state_save_register_device_item(this, 0, m_dispoff);
src/mess/video/fmtowns.c
r10326r10327
909909      state->video.towns_sprite_page = 0;
910910
911911   state->video.towns_sprite_flag = 1;  // we are now drawing
912   timer_adjust_oneshot(state->video.sprite_timer,machine->device<cpu_device>("maincpu")->cycles_to_attotime(128 * (1025-sprite_limit)),0);
912   state->video.sprite_timer->adjust(machine->device<cpu_device>("maincpu")->cycles_to_attotime(128 * (1025-sprite_limit)));
913913}
914914
915915static void towns_crtc_draw_scan_layer_hicolour(running_machine* machine, bitmap_t* bitmap,const rectangle* rect,int layer,int line,int scanline)
src/mess/video/a7800.c
r10326r10327
336336
337337   if( state->maria_wsync )
338338   {
339      cpuexec_trigger( device->machine, TRIGGER_HSYNC );
339      device->machine->scheduler().trigger( TRIGGER_HSYNC );
340340      state->maria_wsync = 0;
341341   }
342342
src/mess/video/hd44780.c
r10326r10327
114114   m_busy_timer = timer_alloc(BUSY_TIMER);
115115   m_blink_timer = timer_alloc(BLINKING_TIMER);
116116
117   timer_adjust_periodic(m_blink_timer, attotime::from_msec(409), 0, attotime::from_msec(409));
117   m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409));
118118
119119   state_save_register_device_item( this, 0, m_ac);
120120   state_save_register_device_item( this, 0, m_ac_mode);
r10326r10327
186186{
187187   m_busy_flag = 1;
188188
189   timer_adjust_oneshot( m_busy_timer, attotime::from_usec( usec ), 0 );
189   m_busy_timer->adjust( attotime::from_usec( usec ) );
190190
191191}
192192
src/mess/video/coco3.c
r10326r10327
486486   }
487487
488488   /* set up GIME field sync */
489   timer_adjust_oneshot(video->gime_fs_timer,
489   video->gime_fs_timer->adjust(
490490      coco6847_scanline_time(gime_field_sync), 0);
491491
492492   return video->legacy_video;
src/mess/video/smsvdp.c
r10326r10327
14471447   smsvdp->tmpbitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED32);
14481448
14491449   smsvdp->smsvdp_display_timer = device->machine->scheduler().timer_alloc(FUNC(smsvdp_display_callback), smsvdp);
1450   timer_adjust_periodic(smsvdp->smsvdp_display_timer, screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, screen->scan_period());
1450   smsvdp->smsvdp_display_timer->adjust(screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, screen->scan_period());
14511451
14521452   state_save_register_device_item(device, 0, smsvdp->status);
14531453   state_save_register_device_item(device, 0, smsvdp->reg9copy);
src/mess/video/ef9345.c
r10326r10327
181181
182182   m_screen_out = auto_bitmap_alloc(machine, 496, m_screen->height() , BITMAP_FORMAT_INDEXED16);
183183
184   timer_adjust_periodic(m_blink_timer, attotime::from_msec(500), 0, attotime::from_msec(500));
184   m_blink_timer->adjust(attotime::from_msec(500), 0, attotime::from_msec(500));
185185
186186   init_accented_chars();
187187
r10326r10327
255255void ef9345_device::set_busy_flag(int period)
256256{
257257   m_bf = 1;
258   timer_adjust_oneshot(m_busy_timer, attotime::from_usec(period), 0);
258   m_busy_timer->adjust(attotime::from_usec(period));
259259}
260260
261261// draw a char in 40 char line mode
src/mess/video/samcoupe.c
r10326r10327
161161      samcoupe_irq(machine->firstcpu, SAM_LINE_INT);
162162
163163   /* schedule next update */
164   timer_adjust_oneshot(state->video_update_timer, machine->primary_screen->time_until_pos(next_vpos, next_hpos), 0);
164   state->video_update_timer->adjust(machine->primary_screen->time_until_pos(next_vpos, next_hpos));
165165}
src/mess/video/odyssey2.c
r10326r10327
593593   state->tmp_bitmap = auto_bitmap_alloc( machine, width, height, screen->format() );
594594
595595   state->i824x_line_timer = machine->scheduler().timer_alloc(FUNC(i824x_scanline_callback));
596   timer_adjust_periodic( state->i824x_line_timer, machine->primary_screen->time_until_pos(1, I824X_START_ACTIVE_SCAN ), 0,  machine->primary_screen->scan_period() );
596   state->i824x_line_timer->adjust( machine->primary_screen->time_until_pos(1, I824X_START_ACTIVE_SCAN ), 0,  machine->primary_screen->scan_period() );
597597
598598   state->i824x_hblank_timer = machine->scheduler().timer_alloc(FUNC(i824x_hblank_callback));
599   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() );
599   state->i824x_hblank_timer->adjust( machine->primary_screen->time_until_pos(1, I824X_END_ACTIVE_SCAN + 18 ), 0, machine->primary_screen->scan_period() );
600600}
601601
602602/***************************************************************************
src/mess/video/m6845.c
r10326r10327
805805{
806806   if (crtc.vsync_set_timer!=NULL)
807807   {
808      timer_adjust_oneshot(crtc.vsync_set_timer, attotime::never, 0);
808      crtc.vsync_set_timer->adjust(attotime::never);
809809   }
810810}
811811
r10326r10327
814814{
815815   if (crtc.vsync_clear_timer != NULL)
816816   {
817      timer_adjust_oneshot(crtc.vsync_clear_timer, attotime::never, 0);
817      crtc.vsync_clear_timer->adjust(attotime::never);
818818   }
819819}
820820
r10326r10327
832832   //crtc.vsync_set_timer = machine->scheduler().timer_alloc(FUNC(m6845_vsync_set_timer_callback));
833833   if (crtc_cycles_to_vsync_start!=-1)
834834   {
835      timer_adjust_oneshot(crtc.vsync_set_timer, attotime::from_usec(crtc_cycles_to_vsync_start), 0);
835      crtc.vsync_set_timer->adjust(attotime::from_usec(crtc_cycles_to_vsync_start));
836836   }
837837}
838838
r10326r10327
849849   //crtc.vsync_clear_timer = machine->scheduler().timer_alloc(FUNC(m6845_vsync_clear_timer_callback));
850850   if (crtc_cycles_to_vsync_end!=-1)
851851   {
852      timer_adjust_oneshot(crtc.vsync_clear_timer, attotime::from_usec(crtc_cycles_to_vsync_end), 0);
852      crtc.vsync_clear_timer->adjust(attotime::from_usec(crtc_cycles_to_vsync_end));
853853   }
854854}
855855
r10326r10327
872872   m6845_set_new_vsync_set_time(m6845_cycles_per_frame()-m6845_vsync_length_in_cycles());
873873
874874   /* prevent timer from being free'd and don't let it trigger again */
875   timer_adjust_oneshot(crtc.vsync_clear_timer, attotime::never, 0);
875   crtc.vsync_clear_timer->adjust(attotime::never);
876876}
877877
878878/* called when vsync is set */
r10326r10327
893893   m6845_set_new_vsync_clear_time( m6845_vsync_length_in_cycles());
894894
895895   /* prevent timer from being free'd and don't let it trigger again */
896   timer_reset(crtc.vsync_set_timer, attotime::never);
896   crtc.vsync_set_timer->reset();
897897}
898898static void m6845_recalc_cycles_to_vsync_end(void)
899899{
src/mess/video/hd61830.c
r10326r10327
262262   m_bf = true;
263263
264264   // adjust busy timer
265   timer_adjust_oneshot(m_busy_timer, attotime::from_usec(CYCLES[m_ir]), 0);
265   m_busy_timer->adjust(attotime::from_usec(CYCLES[m_ir]));
266266}
267267
268268
src/mess/video/galaxy.c
r10326r10327
107107{
108108   galaxy_state *state = machine->driver_data<galaxy_state>();
109109   state->gal_cnt = 0;
110   timer_adjust_periodic(state->gal_video_timer, attotime::zero, 0, attotime::from_hz(6144000 / 8));
110   state->gal_video_timer->adjust(attotime::zero, 0, attotime::from_hz(6144000 / 8));
111111}
112112
113113VIDEO_START( galaxy )
r10326r10327
116116   state->gal_cnt = 0;
117117
118118   state->gal_video_timer = machine->scheduler().timer_alloc(FUNC(gal_video));
119   timer_adjust_periodic(state->gal_video_timer, attotime::zero, 0, attotime::never);
119   state->gal_video_timer->adjust(attotime::zero, 0, attotime::never);
120120
121121   VIDEO_START_CALL( generic_bitmapped );
122122}
r10326r10327
124124VIDEO_UPDATE( galaxy )
125125{
126126   galaxy_state *state = screen->machine->driver_data<galaxy_state>();
127   timer_adjust_periodic(state->gal_video_timer, attotime::zero, 0, attotime::never);
127   state->gal_video_timer->adjust(attotime::zero, 0, attotime::never);
128128   if (state->interrupts_enabled == FALSE)
129129   {
130130      static const rectangle black_area = {0, 384 - 1, 0, 208 - 1};
src/mess/video/cdp1861.c
r10326r10327
8585         devcb_call_write_line(&cdp1861->out_int_func, ASSERT_LINE);
8686      }
8787
88      timer_adjust_oneshot(cdp1861->int_timer, cdp1861->screen->time_until_pos( CDP1861_SCANLINE_INT_END, 0), 0);
88      cdp1861->int_timer->adjust(cdp1861->screen->time_until_pos( CDP1861_SCANLINE_INT_END, 0));
8989   }
9090   else
9191   {
r10326r10327
9494         devcb_call_write_line(&cdp1861->out_int_func, CLEAR_LINE);
9595      }
9696
97      timer_adjust_oneshot(cdp1861->int_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0), 0);
97      cdp1861->int_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
9898   }
9999}
100100
r10326r10327
113113   {
114114   case CDP1861_SCANLINE_EFX_TOP_START:
115115      devcb_call_write_line(&cdp1861->out_efx_func, ASSERT_LINE);
116      timer_adjust_oneshot(cdp1861->efx_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_END, 0), 0);
116      cdp1861->efx_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_END, 0));
117117      break;
118118
119119   case CDP1861_SCANLINE_EFX_TOP_END:
120120      devcb_call_write_line(&cdp1861->out_efx_func, CLEAR_LINE);
121      timer_adjust_oneshot(cdp1861->efx_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_START, 0), 0);
121      cdp1861->efx_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_START, 0));
122122      break;
123123
124124   case CDP1861_SCANLINE_EFX_BOTTOM_START:
125125      devcb_call_write_line(&cdp1861->out_efx_func, ASSERT_LINE);
126      timer_adjust_oneshot(cdp1861->efx_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_END, 0), 0);
126      cdp1861->efx_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_END, 0));
127127      break;
128128
129129   case CDP1861_SCANLINE_EFX_BOTTOM_END:
130130      devcb_call_write_line(&cdp1861->out_efx_func, CLEAR_LINE);
131      timer_adjust_oneshot(cdp1861->efx_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0), 0);
131      cdp1861->efx_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
132132      break;
133133   }
134134}
r10326r10327
154154         }
155155      }
156156
157      timer_adjust_oneshot(cdp1861->dma_timer, cdp1861->cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_WAIT), 0);
157      cdp1861->dma_timer->adjust(cdp1861->cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_WAIT));
158158
159159      cdp1861->dmaout = 0;
160160   }
r10326r10327
168168         }
169169      }
170170
171      timer_adjust_oneshot(cdp1861->dma_timer, cdp1861->cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_ACTIVE), 0);
171      cdp1861->dma_timer->adjust(cdp1861->cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
172172
173173      cdp1861->dmaout = 1;
174174   }
r10326r10327
286286{
287287   cdp1861_t *cdp1861 = get_safe_token(device);
288288
289   timer_adjust_oneshot(cdp1861->int_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0), 0);
290   timer_adjust_oneshot(cdp1861->efx_timer, cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0), 0);
291   timer_adjust_oneshot(cdp1861->dma_timer, cdp1861->cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_START), 0);
289   cdp1861->int_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
290   cdp1861->efx_timer->adjust(cdp1861->screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
291   cdp1861->dma_timer->adjust(cdp1861->cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_START));
292292
293293   cdp1861->disp = 0;
294294   cdp1861->dmaout = 0;
src/mess/video/k1ge.c
r10326r10327
797797      {
798798         if ( k1ge->vram[0x000] & 0x40 )
799799            devcb_call_write8( &k1ge->hblank_pin_w, 0, 1 );
800         timer_adjust_oneshot( k1ge->hblank_on_timer, k1ge->screen->time_until_pos(y, 480 ), 0 );
800         k1ge->hblank_on_timer->adjust( k1ge->screen->time_until_pos(y, 480 ) );
801801      }
802802   }
803803
r10326r10327
807807      k1ge->draw( device, y - 1 );
808808   }
809809
810   timer_adjust_oneshot( k1ge->timer, k1ge->screen->time_until_pos(( y + 1 ) % K1GE_SCREEN_HEIGHT, 0 ), 0 );
810   k1ge->timer->adjust( k1ge->screen->time_until_pos(( y + 1 ) % K1GE_SCREEN_HEIGHT, 0 ) );
811811}
812812
813813
r10326r10327
888888   k1ge->vram[0x7e0] = 0x52;   /* RESET */
889889   k1ge->vram[0x7e2] = 0x00;   /* MODE */
890890
891   timer_adjust_oneshot( k1ge->timer, k1ge->screen->time_until_pos(( k1ge->screen->vpos() + 1 ) % K1GE_SCREEN_HEIGHT, 0 ), 0 );
891   k1ge->timer->adjust( k1ge->screen->time_until_pos(( k1ge->screen->vpos() + 1 ) % K1GE_SCREEN_HEIGHT, 0 ) );
892892}
893893
894894
src/mess/video/fm7.c
r10326r10327
13941394   if(param == 0)  // start of vsync
13951395   {
13961396      state->video.vsync_flag = 1;
1397      timer_adjust_oneshot(state->fm77av_vsync_timer,attotime::from_usec(510),1);  // VSync length for 200 line modes = 0.51ms
1397      state->fm77av_vsync_timer->adjust(attotime::from_usec(510),1);  // VSync length for 200 line modes = 0.51ms
13981398   }
13991399   else
14001400   {
14011401      state->video.vsync_flag = 0;
1402      timer_adjust_oneshot(state->fm77av_vsync_timer,machine->primary_screen->time_until_vblank_end(),0);
1402      state->fm77av_vsync_timer->adjust(machine->primary_screen->time_until_vblank_end());
14031403   }
14041404}
14051405
src/mess/video/hd44352.c
r10326r10327
110110   devcb_resolve_write_line(&m_on, &m_config.m_on, this);
111111
112112   m_on_timer = timer_alloc(ON_TIMER);
113   timer_adjust_periodic(m_on_timer, attotime::from_hz(m_clock/16384), 0, attotime::from_hz(m_clock/16384));
113   m_on_timer->adjust(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);
116116   state_save_register_device_item( this, 0, m_data_bus);
r10326r10327
386386                     default:      on_timer_rate = 8192;      break;
387387                  }
388388
389                  timer_adjust_periodic(m_on_timer, attotime::from_hz(m_clock/on_timer_rate), 0, attotime::from_hz(m_clock/on_timer_rate));
389                  m_on_timer->adjust(attotime::from_hz(m_clock/on_timer_rate), 0, attotime::from_hz(m_clock/on_timer_rate));
390390               }
391391               m_data_bus = 0xff;
392392               m_state = 0;
src/mess/drivers/pb1000.c
r10326r10327
406406   if (matrix & 0x80)
407407   {
408408      if ((m_kb_matrix & 0x80) != (matrix & 0x80))
409         timer_adjust_periodic(m_kb_timer, attotime::never, 0, attotime::never);
409         m_kb_timer->adjust(attotime::never, 0, attotime::never);
410410   }
411411   else
412412   {
413413      if ((m_kb_matrix & 0x40) != (matrix & 0x40))
414414      {
415415         if (matrix & 0x40)
416            timer_adjust_periodic(m_kb_timer, attotime::from_hz(32), 0, attotime::from_hz(32));
416            m_kb_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32));
417417         else
418            timer_adjust_periodic(m_kb_timer, attotime::from_hz(256), 0, attotime::from_hz(256));
418            m_kb_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
419419      }
420420   }
421421
r10326r10327
498498   memory_set_bankptr(machine, "bank1", machine->region("rom")->base());
499499
500500   m_kb_timer = machine->scheduler().timer_alloc(FUNC(keyboard_timer));
501   timer_adjust_periodic(m_kb_timer, attotime::from_hz(192), 0, attotime::from_hz(192));
501   m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192));
502502}
503503
504504static const hd44352_interface hd44352_pb1000_conf =
src/mess/drivers/dectalk.c
r10326r10327
376376{
377377   dectalk_state *state = space->machine->driver_data<dectalk_state>();
378378#ifdef USE_LOOSE_TIMING
379   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(25));
379   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(25));
380380#endif
381381#ifdef SPC_LOG_68K
382382   logerror("m68k: SPC infifo written with data = %04X, fifo head was: %02X; fifo tail: %02X\n",data, state->infifo_head_ptr, state->infifo_tail_ptr);
r10326r10327
411411{
412412   dectalk_state *state = space->machine->driver_data<dectalk_state>();
413413#ifdef USE_LOOSE_TIMING
414   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(25));
414   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(25));
415415#endif
416416#ifdef SPC_LOG_68K
417417   logerror("m68k: SPC flags written with %04X, only storing %04X\n",data, data&0x41);
r10326r10327
560560{
561561   dectalk_state *state = space->machine->driver_data<dectalk_state>();
562562#ifdef USE_LOOSE_TIMING
563   cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(25));
563   space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(25));
564564#endif
565565#ifdef SPC_LOG_DSP
566566   logerror("dsp: set fifo semaphore and set error status = %01X\n",data&1);
src/mess/drivers/osbexec.c
r10326r10327
580580      }
581581   }
582582
583   timer_adjust_oneshot( state->video_timer, machine->primary_screen->time_until_pos( y + 1, 0 ), 0 );
583   state->video_timer->adjust( machine->primary_screen->time_until_pos( y + 1, 0 ) );
584584}
585585
586586
r10326r10327
609609
610610   state->set_banks( machine );
611611
612   timer_adjust_oneshot( state->video_timer, machine->primary_screen->time_until_pos( 0, 0 ), 0 );
612   state->video_timer->adjust( machine->primary_screen->time_until_pos( 0, 0 ) );
613613
614614   state->rtc = 0;
615615}
src/mess/drivers/tec1.c
r10326r10327
185185{
186186   tec1_state *state = machine->driver_data<tec1_state>();
187187   state->m_kbd_timer = machine->scheduler().timer_alloc(FUNC(tec1_kbd_callback));
188   timer_adjust_periodic( state->m_kbd_timer, attotime::zero, 0, attotime::from_hz(500) );
188   state->m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) );
189189}
190190
191191static MACHINE_RESET( tec1 )
src/mess/drivers/pc6001.c
r10326r10327
13011301   pc6001_state *state = space->machine->driver_data<pc6001_state>();
13021302   state->timer_hz_div = data;
13031303   attotime period = attotime::from_hz((487.5*4)/(state->timer_hz_div+1));
1304   timer_adjust_periodic(state->timer_irq_timer, period,  0, period);
1304   state->timer_irq_timer->adjust(period,  0, period);
13051305}
13061306
13071307static WRITE8_HANDLER( pc6001m2_timer_irqv_w )
r10326r10327
20482048   {
20492049      attotime period = attotime::from_hz((487.5*4)/(state->timer_hz_div+1));
20502050      state->timer_irq_timer = machine->scheduler().timer_alloc(FUNC(audio_callback));
2051      timer_adjust_periodic(state->timer_irq_timer, period,  0, period);
2051      state->timer_irq_timer->adjust(period,  0, period);
20522052   }
20532053}
20542054
src/mess/drivers/pc88va.c
r10326r10327
10241024   if(state->timer3_io_reg & 0x80)
10251025   {
10261026      pic8259_ir5_w(machine->device("pic8259_slave"), 1);
1027      timer_adjust_oneshot(state->t3_mouse_timer, attotime::from_hz(120 >> (state->timer3_io_reg & 3)), 0);
1027      state->t3_mouse_timer->adjust(attotime::from_hz(120 >> (state->timer3_io_reg & 3)));
10281028   }
10291029}
10301030
r10326r10327
10381038   state->timer3_io_reg = data;
10391039
10401040   if(data & 0x80)
1041      timer_adjust_oneshot(state->t3_mouse_timer, attotime::from_hz(120 >> (state->timer3_io_reg & 3)), 0);
1041      state->t3_mouse_timer->adjust(attotime::from_hz(120 >> (state->timer3_io_reg & 3)));
10421042   else
10431043   {
10441044      pic8259_ir5_w(space->machine->device("pic8259_slave"), 0);
1045      timer_adjust_oneshot(state->t3_mouse_timer, attotime::never, 0);
1045      state->t3_mouse_timer->adjust(attotime::never);
10461046   }
10471047}
10481048
r10326r10327
15121512   cpu_set_irq_callback(machine->device("maincpu"), pc88va_irq_callback);
15131513
15141514   state->t3_mouse_timer = machine->scheduler().timer_alloc(FUNC(t3_mouse_callback));
1515   timer_adjust_oneshot(state->t3_mouse_timer, attotime::never, 0);
1515   state->t3_mouse_timer->adjust(attotime::never);
15161516}
15171517
15181518static MACHINE_RESET( pc88va )
src/mess/drivers/x1.c
r10326r10327
23362336   for(i=0;i<0x10;i++)
23372337      palette_set_color_rgb(machine, i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
23382338
2339   timer_adjust_periodic(state->rtc_timer, attotime::zero, 0, attotime::from_seconds(1));
2339   state->rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
23402340}
23412341
23422342static MACHINE_START( x1 )
src/mess/drivers/tm990189.c
r10326r10327
345345   else
346346   {
347347      state->segment &= ~ (1 << (offset-4));
348      if ((timer_timeleft(state->displayena_timer) > attotime::zero)  && (state->digitsel < 10))
348      if ((state->displayena_timer->remaining() > attotime::zero)  && (state->digitsel < 10))
349349         draw_digit(state);
350350   }
351351}
r10326r10327
355355   tm990189_state *state = device->machine->driver_data<tm990189_state>();
356356   if ((!data) && (state->digitsel < 10))
357357   {
358      timer_reset(state->displayena_timer, displayena_duration);
358      state->displayena_timer->reset(displayena_duration);
359359      draw_digit(state);
360360   }
361361}
r10326r10327
404404   tm990189_state *state = image.device().machine->driver_data<tm990189_state>();
405405   tms9902_set_dsr(image.device().machine->device("tms9902"), 1);
406406   state->rs232_input_timer = image.device().machine->scheduler().timer_alloc(FUNC(rs232_input_callback), (void*)image);
407   timer_adjust_periodic(state->rs232_input_timer, attotime::zero, 0, attotime::from_msec(10));
407   state->rs232_input_timer->adjust(attotime::zero, 0, attotime::from_msec(10));
408408
409409   return IMAGE_INIT_PASS;
410410}
r10326r10327
417417   tm990189_state *state = image.device().machine->driver_data<tm990189_state>();
418418   tms9902_set_dsr(image.device().machine->device("tms9902"), 0);
419419
420   timer_reset(state->rs232_input_timer, attotime::never);   /* FIXME - timers should only be allocated once */
420   state->rs232_input_timer->reset();   /* FIXME - timers should only be allocated once */
421421}
422422
423423DEVICE_GET_INFO( tm990_189_rs232 )
r10326r10327
562562   int reply = input_port_read(space->machine, "BUTTONS");
563563
564564
565   if (timer_timeleft(state->joy1x_timer) < attotime::zero)
565   if (state->joy1x_timer->remaining() < attotime::zero)
566566      reply |= 0x01;
567567
568   if (timer_timeleft(state->joy1y_timer) < attotime::zero)
568   if (state->joy1y_timer->remaining() < attotime::zero)
569569      reply |= 0x02;
570570
571   if (timer_timeleft(state->joy2x_timer) < attotime::zero)
571   if (state->joy2x_timer->remaining() < attotime::zero)
572572      reply |= 0x08;
573573
574   if (timer_timeleft(state->joy2y_timer) < attotime::zero)
574   if (state->joy2y_timer->remaining() < attotime::zero)
575575      reply |= 0x10;
576576
577577   return reply;
r10326r10327
580580static WRITE8_HANDLER(video_joy_w)
581581{
582582   tm990189_state *state = space->machine->driver_data<tm990189_state>();
583   timer_reset(state->joy1x_timer, attotime::from_usec(input_port_read(space->machine, "JOY1_X")*28+28));
584   timer_reset(state->joy1y_timer, attotime::from_usec(input_port_read(space->machine, "JOY1_Y")*28+28));
585   timer_reset(state->joy2x_timer, attotime::from_usec(input_port_read(space->machine, "JOY2_X")*28+28));
586   timer_reset(state->joy2y_timer, attotime::from_usec(input_port_read(space->machine, "JOY2_Y")*28+28));
583   state->joy1x_timer->reset(attotime::from_usec(input_port_read(space->machine, "JOY1_X")*28+28));
584   state->joy1y_timer->reset(attotime::from_usec(input_port_read(space->machine, "JOY1_Y")*28+28));
585   state->joy2x_timer->reset(attotime::from_usec(input_port_read(space->machine, "JOY2_X")*28+28));
586   state->joy2y_timer->reset(attotime::from_usec(input_port_read(space->machine, "JOY2_Y")*28+28));
587587}
588588
589589/* user tms9901 setup */
src/mess/drivers/mpf1.c
r10326r10327
256256   UINT8 led_data = BITSWAP8(data, 6, 1, 2, 0, 7, 5, 4, 3);
257257
258258   /* timer to update segments */
259   timer_adjust_oneshot(state->led_refresh_timer, attotime::from_usec(70), led_data);
259   state->led_refresh_timer->adjust(attotime::from_usec(70), led_data);
260260}
261261
262262static WRITE8_DEVICE_HANDLER( mpf1_portc_w )
r10326r10327
265265
266266   /* bits 0-5, led select and keyboard latch */
267267   state->lednum = data & 0x3f;
268   timer_adjust_oneshot(state->led_refresh_timer, attotime::never, 0);
268   state->led_refresh_timer->adjust(attotime::never);
269269
270270   /* bit 6, monitor break control */
271271   state->_break = BIT(data, 6);
src/mess/drivers/atarist.c
r10326r10327
762762      }
763763      else
764764      {
765         timer_enable(m_dmasound_timer, 0);
765         m_dmasound_timer->enable(0);
766766      }
767767   }
768768}
r10326r10327
894894      if (!m_dmasnd_active)
895895      {
896896         dmasound_set_state(1);
897         timer_adjust_periodic(m_dmasound_timer, attotime::zero, 0, attotime::from_hz(DMASOUND_RATE[m_dmasnd_mode & 0x03]));
897         m_dmasound_timer->adjust(attotime::zero, 0, attotime::from_hz(DMASOUND_RATE[m_dmasnd_mode & 0x03]));
898898      }
899899   }
900900   else
901901   {
902902      dmasound_set_state(0);
903      timer_enable(m_dmasound_timer, 0);
903      m_dmasound_timer->enable(0);
904904   }
905905}
906906
r10326r10327
10131013      microwire_shift();
10141014      lmc1992_enable_w(m_lmc1992, 1);
10151015      m_mw_shift = 0;
1016      timer_enable(m_microwire_timer, 0);
1016      m_microwire_timer->enable(0);
10171017      break;
10181018   }
10191019}
r10326r10327
10471047
10481048WRITE16_MEMBER( ste_state::microwire_data_w )
10491049{
1050   if (!timer_enabled(m_microwire_timer))
1050   if (!m_microwire_timer->enabled())
10511051   {
10521052      m_mw_data = data;
1053      timer_adjust_periodic(m_microwire_timer, attotime::zero, 0, attotime::from_usec(2));
1053      m_microwire_timer->adjust(attotime::zero, 0, attotime::from_usec(2));
10541054   }
10551055}
10561056
r10326r10327
10711071
10721072WRITE16_MEMBER( ste_state::microwire_mask_w )
10731073{
1074   if (!timer_enabled(m_microwire_timer))
1074   if (!m_microwire_timer->enabled())
10751075   {
10761076      m_mw_mask = data;
10771077   }
r10326r10327
22712271
22722272   // allocate timers
22732273   m_mouse_timer = machine->scheduler().timer_alloc(FUNC(st_mouse_tick));
2274   timer_adjust_periodic(m_mouse_timer, attotime::zero, 0, attotime::from_hz(500));
2274   m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500));
22752275   
22762276   // register for state saving
22772277   state_save();
src/mess/drivers/cat.c
r10326r10327
278278{
279279   cat_state *state = machine->driver_data<cat_state>();
280280   cpu_set_irq_callback(machine->device("maincpu"), cat_int_ack);
281   timer_adjust_periodic(state->keyboard_timer, attotime::zero, 0, attotime::from_hz(120));
281   state->keyboard_timer->adjust(attotime::zero, 0, attotime::from_hz(120));
282282}
283283
284284static VIDEO_START( cat )
src/mess/drivers/phunsy.c
r10326r10327
5353   phunsy_state *state = space->machine->driver_data<phunsy_state>();
5454
5555   if (LOG)
56      logerror("%s: phunsy_ctrl_w %02x\n", cpuexec_describe_context(space->machine), data);
56      logerror("%s: phunsy_ctrl_w %02x\n", space->machine->describe_context(), data);
5757
5858   state->u_bank = data >> 4;
5959   state->q_bank = data & 0x0F;
r10326r10327
8181   phunsy_state *state = space->machine->driver_data<phunsy_state>();
8282
8383   if (LOG)
84      logerror("%s: phunsy_data_w %02x\n", cpuexec_describe_context(space->machine), data);
84      logerror("%s: phunsy_data_w %02x\n", space->machine->describe_context(), data);
8585
8686   state->data_out = data;
8787
r10326r10327
111111   UINT8 data;
112112
113113   if (LOG)
114      logerror("%s: phunsy_data_r\n", cpuexec_describe_context(space->machine));
114      logerror("%s: phunsy_data_r\n", space->machine->describe_context());
115115
116116   if ( state->data_out & 0x02 )
117117   {
src/mess/drivers/a2600.c
r10326r10327
20232023            state->dpc.df[data_fetcher].music_mode = 0;
20242024         }
20252025      }
2026      timer_adjust_periodic(state->dpc.oscillator, attotime::from_hz(42000), 0, attotime::from_hz(42000));
2026      state->dpc.oscillator->adjust(attotime::from_hz(42000), 0, attotime::from_hz(42000));
20272027      break;
20282028
20292029   case mode32in1:
src/mess/drivers/pcw.c
r10326r10327
857857   {
858858      logerror("Strobe active [%02x]\n",state->printer_shift);
859859      state->printer_shift_output = state->printer_shift;
860      timer_adjust_oneshot(state->prn_stepper,PERIOD_OF_555_MONOSTABLE(22000,0.00000001),0);
860      state->prn_stepper->adjust(PERIOD_OF_555_MONOSTABLE(22000,0.00000001));
861861   }
862862
863863   if(data & 0x40)
864      timer_adjust_oneshot(state->prn_pins,PERIOD_OF_555_MONOSTABLE(22000,0.0000000068),0);
864      state->prn_pins->adjust(PERIOD_OF_555_MONOSTABLE(22000,0.0000000068));
865865
866866   if(data & 0x01)
867867      state->printer_pins |= 0x0100;
src/mess/drivers/rt1715.c
r10326r10327
3939
4040static WRITE8_HANDLER( rt1715_floppy_enable )
4141{
42   logerror("%s: rt1715_floppy_enable %02x\n", cpuexec_describe_context(space->machine), data);
42   logerror("%s: rt1715_floppy_enable %02x\n", space->machine->describe_context(), data);
4343}
4444
4545
r10326r10327
5252{
5353   rt1715_state *state = space->machine->driver_data<rt1715_state>();
5454   state->led1_val ^= 1;
55   logerror("%s: k7658_led1_r %02x\n", cpuexec_describe_context(space->machine), state->led1_val);
55   logerror("%s: k7658_led1_r %02x\n", space->machine->describe_context(), state->led1_val);
5656   return 0xff;
5757}
5858
r10326r10327
6161{
6262   rt1715_state *state = space->machine->driver_data<rt1715_state>();
6363   state->led2_val ^= 1;
64   logerror("%s: k7658_led2_r %02x\n", cpuexec_describe_context(space->machine), state->led2_val);
64   logerror("%s: k7658_led2_r %02x\n", space->machine->describe_context(), state->led2_val);
6565   return 0xff;
6666}
6767
r10326r10327
9090/* serial output on D0 */
9191static WRITE8_HANDLER( k7658_data_w )
9292{
93   logerror("%s: k7658_data_w %02x\n", cpuexec_describe_context(space->machine), BIT(data, 0));
93   logerror("%s: k7658_data_w %02x\n", space->machine->describe_context(), BIT(data, 0));
9494}
9595
9696
r10326r10327
112112
113113static WRITE8_HANDLER( rt1715_rom_disable )
114114{
115   logerror("%s: rt1715_set_bank %02x\n", cpuexec_describe_context(space->machine), data);
115   logerror("%s: rt1715_set_bank %02x\n", space->machine->describe_context(), data);
116116
117117   /* disable ROM, enable RAM */
118118   memory_set_bankptr(space->machine, "bank1", ram_get_ptr(space->machine->device(RAM_TAG)));
src/mess/drivers/a7000.c
r10326r10327
249249         if(vert_reg == 4)
250250         {
251251            if(state->vidc20_vert_reg[VDER] != 0)
252               timer_adjust_oneshot(state->flyback_timer, space->machine->primary_screen->time_until_pos(state->vidc20_vert_reg[VDER]),0);
252               state->flyback_timer->adjust(space->machine->primary_screen->time_until_pos(state->vidc20_vert_reg[VDER]));
253253            else
254               timer_adjust_oneshot(state->flyback_timer, attotime::never,0);
254               state->flyback_timer->adjust(attotime::never);
255255         }
256256
257257         // logerror("VIDC20: %s Register write = %08x (%d)\n",vidc20_vert_regnames[vert_reg],val,val);
r10326r10327
577577   int val = timer_count / 2; // correct?
578578
579579   if(val==0)
580      timer_adjust_oneshot(state->IOMD_timer[timer], attotime::never, 0);
580      state->IOMD_timer[timer]->adjust(attotime::never);
581581   else
582      timer_adjust_periodic(state->IOMD_timer[timer], attotime::from_usec(val), 0, attotime::from_usec(val));
582      state->IOMD_timer[timer]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val));
583583}
584584
585585static TIMER_CALLBACK( IOMD_timer0_callback )
r10326r10327
611611      generic_pulse_irq_line(machine->device("maincpu"), ARM7_IRQ_LINE);
612612   }
613613
614   timer_adjust_oneshot(state->flyback_timer, machine->primary_screen->time_until_pos(state->vidc20_vert_reg[VDER]),0);
614   state->flyback_timer->adjust(machine->primary_screen->time_until_pos(state->vidc20_vert_reg[VDER]));
615615}
616616
617617static void viddma_transfer_start(address_space *space)
r10326r10327
799799
800800   state->IOMD_keyb_ctrl = 0x00;
801801
802   timer_adjust_oneshot( state->IOMD_timer[0], attotime::never, 0);
803   timer_adjust_oneshot( state->IOMD_timer[1], attotime::never, 0);
804   timer_adjust_oneshot( state->flyback_timer, attotime::never, 0);
802   state->IOMD_timer[0]->adjust( attotime::never);
803   state->IOMD_timer[1]->adjust( attotime::never);
804   state->flyback_timer->adjust( attotime::never);
805805}
806806
807807static MACHINE_CONFIG_START( a7000, a7000_state )
src/mess/drivers/tmc1800.c
r10326r10327
430430   {
431431      // TODO: what are the correct values?
432432      int t = RES_K(27) * CAP_U(1) * 1000; // t = R26 * C1
433      timer_adjust_oneshot(state->ef4_timer, attotime::from_msec(t), 0);
433      state->ef4_timer->adjust(attotime::from_msec(t));
434434   }
435435}
436436
src/mess/drivers/fmtowns.c
r10326r10327
918918            }
919919            else
920920               state->towns_mouse_output++;
921            timer_adjust_periodic(state->towns_mouse_timer,attotime::from_usec(600),0,attotime::zero);
921            state->towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
922922         }
923923         if((state->towns_pad_mask & 0x10) == 0 && (state->prev_pad_mask & 0x10) != 0)
924924         {
r10326r10327
934934            }
935935            else
936936               state->towns_mouse_output++;
937            timer_adjust_periodic(state->towns_mouse_timer,attotime::from_usec(600),0,attotime::zero);
937            state->towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
938938         }
939939         state->prev_pad_mask = state->towns_pad_mask;
940940      }
r10326r10327
954954            }
955955            else
956956               state->towns_mouse_output++;
957            timer_adjust_periodic(state->towns_mouse_timer,attotime::from_usec(600),0,attotime::zero);
957            state->towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
958958         }
959959         if((state->towns_pad_mask & 0x20) == 0 && (state->prev_pad_mask & 0x20) != 0)
960960         {
r10326r10327
970970            }
971971            else
972972               state->towns_mouse_output++;
973            timer_adjust_periodic(state->towns_mouse_timer,attotime::from_usec(600),0,attotime::zero);
973            state->towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
974974         }
975975         state->prev_pad_mask = state->towns_pad_mask;
976976      }
r10326r10327
12491249//  logerror("DMARQ: param=%i ret=%i bufferptr=%i\n",param,masked,state->towns_cd.buffer_ptr);
12501250   if(param != 0)
12511251   {
1252      timer_adjust_oneshot(state->towns_cd.read_timer,attotime::from_hz(300000),0);
1252      state->towns_cd.read_timer->adjust(attotime::from_hz(300000));
12531253   }
12541254   else
12551255   {
12561256      if(masked != 0)  // check if the DMA channel is masked
12571257      {
1258         timer_adjust_oneshot(state->towns_cd.read_timer,attotime::from_hz(300000),1);
1258         state->towns_cd.read_timer->adjust(attotime::from_hz(300000),1);
12591259         return;
12601260      }
12611261      if(state->towns_cd.buffer_ptr < 2048)
1262         timer_adjust_oneshot(state->towns_cd.read_timer,attotime::from_hz(300000),1);
1262         state->towns_cd.read_timer->adjust(attotime::from_hz(300000),1);
12631263      else
12641264      {  // end of transfer
12651265         state->towns_cd.status &= ~0x10;  // no longer transferring by DMA
r10326r10327
12791279            towns_cd_set_status(device->machine,0x22,0x00,0x00,0x00);
12801280            towns_cdrom_set_irq(device->machine,TOWNS_CD_IRQ_DMA,1);
12811281            cdrom_read_data(cd_get_cdrom_file(state->cdrom),++state->towns_cd.lba_current,state->towns_cd.buffer,CD_TRACK_MODE1);
1282            timer_adjust_oneshot(state->towns_cd.read_timer,attotime::from_hz(300000),1);
1282            state->towns_cd.read_timer->adjust(attotime::from_hz(300000),1);
12831283            state->towns_cd.buffer_ptr = -1;
12841284         }
12851285      }
r10326r10327
13321332      state->towns_cd.status |= 0x10;  // DMA transfer begin
13331333      state->towns_cd.status &= ~0x20;  // not a software transfer
13341334//      state->towns_cd.buffer_ptr = 0;
1335//      timer_adjust_oneshot(state->towns_cd.read_timer,attotime::from_hz(300000),1);
1335//      state->towns_cd.read_timer->adjust(attotime::from_hz(300000),1);
13361336      if(state->towns_cd.command & 0x20)
13371337      {
13381338         state->towns_cd.extra_status = 2;
r10326r10327
16861686            if(state->towns_cd.buffer_ptr < 0)
16871687            {
16881688               state->towns_cd.buffer_ptr = 0;
1689               timer_adjust_oneshot(state->towns_cd.read_timer,attotime::from_hz(300000),1);
1689               state->towns_cd.read_timer->adjust(attotime::from_hz(300000),1);
16901690            }
16911691         }
16921692         logerror("CD: transfer mode write %02x\n",data);
r10326r10327
23252325   state->towns_cd.status = 0x01;  // CDROM controller ready
23262326   state->towns_cd.buffer_ptr = -1;
23272327   state->towns_volume_select = 0;
2328   timer_adjust_periodic(state->towns_rtc_timer,attotime::zero,0,attotime::from_hz(1));
2329   timer_adjust_periodic(state->towns_kb_timer,attotime::zero,0,attotime::from_msec(10));
2328   state->towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1));
2329   state->towns_kb_timer->adjust(attotime::zero,0,attotime::from_msec(10));
23302330}
23312331
23322332static const struct pit8253_config towns_pit8253_config =
src/mess/drivers/newbrain.c
r10326r10327
13891389
13901390   /* allocate reset timer */
13911391   state->reset_timer = machine->scheduler().timer_alloc(FUNC(reset_tick));
1392   timer_adjust_oneshot(state->reset_timer, attotime::from_usec(get_reset_t()), 0);
1392   state->reset_timer->adjust(attotime::from_usec(get_reset_t()));
13931393
13941394   /* allocate power up timer */
13951395   state->pwrup_timer = machine->scheduler().timer_alloc(FUNC(pwrup_tick));
1396   timer_adjust_oneshot(state->pwrup_timer, attotime::from_usec(get_pwrup_t()), 0);
1396   state->pwrup_timer->adjust(attotime::from_usec(get_pwrup_t()));
13971397
13981398   /* initialize variables */
13991399   state->pwrup = 1;
r10326r10327
14621462   cputag_set_input_line(machine, Z80_TAG, INPUT_LINE_RESET, HOLD_LINE);
14631463   cputag_set_input_line(machine, COP420_TAG, INPUT_LINE_RESET, HOLD_LINE);
14641464
1465   timer_adjust_oneshot(state->reset_timer, attotime::from_msec(get_reset_t()), 0);
1465   state->reset_timer->adjust(attotime::from_msec(get_reset_t()));
14661466}
14671467
14681468static INTERRUPT_GEN( newbrain_interrupt )
src/mess/drivers/einstein.c
r10326r10327
120120   result |= einstein->crtc_screen->vblank() ? 1 : 0;
121121   result |= input_port_read(space->machine, "80column_dips") & 0x06;
122122
123   logerror("%s: einstein_80col_state_r %02x\n", cpuexec_describe_context(space->machine), result);
123   logerror("%s: einstein_80col_state_r %02x\n", space->machine->describe_context(), result);
124124
125125   return result;
126126}
r10326r10327
212212
213213static WRITE8_DEVICE_HANDLER( einstein_drsel_w )
214214{
215   logerror("%s: einstein_drsel_w %02x\n", cpuexec_describe_context(device->machine), data);
215   logerror("%s: einstein_drsel_w %02x\n", device->machine->describe_context(), data);
216216
217217   /* bit 0 to 3 select the drive */
218218   if (BIT(data, 0)) wd17xx_set_drive(device, 0);
r10326r10327
306306   /* bit 5 to 7: graph, control and shift key */
307307   data |= input_port_read(space->machine, "EXTRA");
308308
309   logerror("%s: einstein_kybintmsk_r %02x\n", cpuexec_describe_context(space->machine), data);
309   logerror("%s: einstein_kybintmsk_r %02x\n", space->machine->describe_context(), data);
310310
311311   return data;
312312}
r10326r10327
315315{
316316   einstein_state *einstein = space->machine->driver_data<einstein_state>();
317317
318   logerror("%s: einstein_kybintmsk_w %02x\n", cpuexec_describe_context(space->machine), data);
318   logerror("%s: einstein_kybintmsk_w %02x\n", space->machine->describe_context(), data);
319319
320320   /* set mask from bit 0 */
321321   if (data & 0x01)
r10326r10327
336336{
337337   einstein_state *einstein = space->machine->driver_data<einstein_state>();
338338
339   logerror("%s: einstein_adcintmsk_w %02x\n", cpuexec_describe_context(space->machine), data);
339   logerror("%s: einstein_adcintmsk_w %02x\n", space->machine->describe_context(), data);
340340
341341   if (data & 0x01)
342342   {
r10326r10327
356356{
357357   einstein_state *einstein = space->machine->driver_data<einstein_state>();
358358
359   logerror("%s: einstein_fire_int_w %02x\n", cpuexec_describe_context(space->machine), data);
359   logerror("%s: einstein_fire_int_w %02x\n", space->machine->describe_context(), data);
360360
361361   if (data & 0x01)
362362   {
src/mess/drivers/gizmondo.c
r10326r10327
4545      va_start( v, s_fmt);
4646      vsprintf( buf, s_fmt, v);
4747      va_end( v);
48      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
48      logerror( "%s: %s", machine->describe_context( ), buf);
4949   }
5050}
5151
src/mess/drivers/ng_aes.c
r10326r10327
119119      attotime period = (attotime::from_hz(NEOGEO_PIXEL_CLOCK) * (state->display_counter + 1));
120120      if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer  current y: %02x  current x: %02x   target y: %x  target x: %x\n", machine->primary_screen->vpos(), machine->primary_screen->hpos(), (state->display_counter + 1) / NEOGEO_HTOTAL, (state->display_counter + 1) % NEOGEO_HTOTAL);
121121
122      timer_adjust_oneshot(state->display_position_interrupt_timer, period, 0);
122      state->display_position_interrupt_timer->adjust(period);
123123   }
124124}
125125
r10326r10327
224224   }
225225
226226   /* set timer for next screen */
227   timer_adjust_oneshot(state->display_position_vblank_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0);
227   state->display_position_vblank_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS));
228228}
229229
230230
r10326r10327
242242   update_interrupts(machine);
243243
244244   /* set timer for next screen */
245   timer_adjust_oneshot(state->vblank_interrupt_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART, 0), 0);
245   state->vblank_interrupt_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART, 0));
246246}
247247
248248
r10326r10327
258258static void start_interrupt_timers( running_machine *machine )
259259{
260260   neogeo_state *state = machine->driver_data<neogeo_state>();
261   timer_adjust_oneshot(state->vblank_interrupt_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART, 0), 0);
262   timer_adjust_oneshot(state->display_position_vblank_timer, machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0);
261   state->vblank_interrupt_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART, 0));
262   state->display_position_vblank_timer->adjust(machine->primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS));
263263}
264264
265265
r10326r10327
572572      audio_cpu_assert_nmi(space->machine);
573573
574574      /* boost the interleave to let the audio CPU read the command */
575      cpuexec_boost_interleave(space->machine, attotime::zero, attotime::from_usec(50));
575      space->machine->scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
576576
577577      if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(space->cpu), data, mem_mask);
578578   }
src/mess/drivers/psx.c
r10326r10327
6666      va_start( v, s_fmt );
6767      vsprintf( buf, s_fmt, v );
6868      va_end( v );
69      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
69      logerror( "%s: %s", machine->describe_context(), buf );
7070   }
7171}
7272
src/mess/drivers/samcoupe.c
r10326r10327
201201
202202static READ8_HANDLER( samcoupe_midi_r )
203203{
204   logerror("%s: read from midi port\n", cpuexec_describe_context(space->machine));
204   logerror("%s: read from midi port\n", space->machine->describe_context());
205205   return 0xff;
206206}
207207
208208static WRITE8_HANDLER( samcoupe_midi_w )
209209{
210   logerror("%s: write to midi port: 0x%02x\n", cpuexec_describe_context(space->machine), data);
210   logerror("%s: write to midi port: 0x%02x\n", space->machine->describe_context(), data);
211211}
212212
213213static READ8_HANDLER( samcoupe_keyboard_r )
src/mess/drivers/tutor.c
r10326r10327
420420         {
421421            state->tape_interrupt_enable = ! data;
422422            if (state->tape_interrupt_enable)
423               timer_adjust_periodic(state->tape_interrupt_timer, /*attotime::from_hz(44100)*/attotime::zero, 0, attotime::from_hz(44100));
423               state->tape_interrupt_timer->adjust(/*attotime::from_hz(44100)*/attotime::zero, 0, attotime::from_hz(44100));
424424            else
425425            {
426               timer_adjust_oneshot(state->tape_interrupt_timer, attotime::never, 0);
426               state->tape_interrupt_timer->adjust(attotime::never);
427427               cputag_set_input_line(space->machine, "maincpu", 1, CLEAR_LINE);
428428            }
429429         }
src/mess/drivers/pockstat.c
r10326r10327
141141      va_start( v, s_fmt );
142142      vsprintf( buf, s_fmt, v );
143143      va_end( v );
144      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
144      logerror( "%s: %s", machine->describe_context(), buf );
145145   }
146146}
147147#else
r10326r10327
433433   }
434434   period = attotime::from_hz(CPU_FREQ[state->clock_regs.mode & 0x0f] / 2) * divisor;
435435   period = period * state->timer_regs.timer[index].count;
436   timer_adjust_oneshot(state->timer_regs.timer[index].timer, period, index);
436   state->timer_regs.timer[index].timer->adjust(period, index);
437437}
438438
439439static READ32_HANDLER( ps_timer_r )
r10326r10327
500500         }
501501         else
502502         {
503            timer_adjust_oneshot(state->timer_regs.timer[offset / (0x10/4)].timer, attotime::never, offset / (0x10/4));
503            state->timer_regs.timer[offset / (0x10/4)].timer->adjust(attotime::never, offset / (0x10/4));
504504         }
505505         break;
506506      default:
r10326r10327
591591         }
592592      }
593593   }
594   timer_adjust_oneshot(state->rtc_regs.timer, attotime::from_hz(1), 0);
594   state->rtc_regs.timer->adjust(attotime::from_hz(1));
595595}
596596
597597static READ32_HANDLER( ps_rtc_r )
r10326r10327
869869   for(index = 0; index < 3; index++)
870870   {
871871      state->timer_regs.timer[index].timer = machine->scheduler().timer_alloc(FUNC(timer_tick));
872      timer_adjust_oneshot(state->timer_regs.timer[index].timer, attotime::never, index);
872      state->timer_regs.timer[index].timer->adjust(attotime::never, index);
873873   }
874874
875875   state->rtc_regs.time = 0x01000000;
876876   state->rtc_regs.date = 0x19990101;
877877
878878   state->rtc_regs.timer = machine->scheduler().timer_alloc(FUNC(rtc_tick));
879   timer_adjust_oneshot(state->rtc_regs.timer, attotime::from_hz(1), index);
879   state->rtc_regs.timer->adjust(attotime::from_hz(1), index);
880880
881881   state_save_register_global(machine, state->ftlb_regs.control);
882882   state_save_register_global(machine, state->ftlb_regs.stat);
src/mess/drivers/x07.c
r10326r10327
589589      m_regs_r[1] = m_out.data[m_out.read];
590590      m_regs_r[2] |= 0x01;
591591      cpu_set_input_line(m_maincpu, NSC800_RSTA, ASSERT_LINE);
592      timer_adjust_oneshot(m_rsta_clear, attotime::from_msec(50), 0);
592      m_rsta_clear->adjust(attotime::from_msec(50));
593593   }
594594}
595595
r10326r10327
658658            m_regs_r[1] = m_out.data[m_out.read];
659659            m_regs_r[2] |= 0x01;
660660            cpu_set_input_line(m_maincpu, NSC800_RSTA, ASSERT_LINE);
661            timer_adjust_oneshot(m_rsta_clear, attotime::from_msec(50), 0);
661            m_rsta_clear->adjust(attotime::from_msec(50));
662662         }
663663      }
664664   }
r10326r10327
674674
675675      popmessage("%04x//%04x", m_k7pos, m_k7size);
676676
677      timer_adjust_oneshot(m_k7irq, attotime::from_msec(2), 0);
677      m_k7irq->adjust(attotime::from_msec(2));
678678   }
679679}
680680
r10326r10327
844844      m_kb_size--;
845845      m_regs_r[2] |= 0x01;
846846      cpu_set_input_line(m_maincpu, NSC800_RSTA, ASSERT_LINE);
847      timer_adjust_oneshot(m_rsta_clear, attotime::from_msec(50), 0);
847      m_rsta_clear->adjust(attotime::from_msec(50));
848848   }
849849}
850850
r10326r10327
10701070         beep_set_state(m_beep, 1);
10711071         beep_set_frequency(m_beep, 192000 / ((m_regs_w[2] | (m_regs_w[3] << 8)) & 0x0fff));
10721072
1073         timer_adjust_oneshot(m_beep_stop, attotime::from_msec(ram_get_ptr(m_ram)[0x450] * 0x20), 0);
1073         m_beep_stop->adjust(attotime::from_msec(ram_get_ptr(m_ram)[0x450] * 0x20));
10741074      }
10751075      else
10761076         beep_set_state(m_beep, 0);
r10326r10327
11521152         state->m_regs_r[1] = 0x05;
11531153         state->m_regs_r[2] |= 0x01;
11541154         cpu_set_input_line(state->m_maincpu, NSC800_RSTA, ASSERT_LINE );
1155         timer_adjust_oneshot(state->m_rsta_clear, attotime::from_msec(50), 0);
1155         state->m_rsta_clear->adjust(attotime::from_msec(50));
11561156      }
11571157   }
11581158}
r10326r10327
13191319
13201320   cpu_set_input_line(state->m_maincpu, NSC800_RSTB, ASSERT_LINE);
13211321
1322   timer_adjust_oneshot(state->m_rstb_clear, attotime::from_usec(200), 0);
1322   state->m_rstb_clear->adjust(attotime::from_usec(200));
13231323}
13241324
13251325static const gfx_layout x07_charlayout =
src/mess/drivers/fm7.c
r10326r10327
17491749   UINT8* RAM = machine->region("maincpu")->base();
17501750   UINT8* ROM = machine->region("init")->base();
17511751
1752   timer_adjust_periodic(state->timer,attotime::from_nsec(2034500),0,attotime::from_nsec(2034500));
1753   timer_adjust_periodic(state->subtimer,attotime::from_msec(20),0,attotime::from_msec(20));
1754   timer_adjust_periodic(state->keyboard_timer,attotime::zero,0,attotime::from_msec(10));
1752   state->timer->adjust(attotime::from_nsec(2034500),0,attotime::from_nsec(2034500));
1753   state->subtimer->adjust(attotime::from_msec(20),0,attotime::from_msec(20));
1754   state->keyboard_timer->adjust(attotime::zero,0,attotime::from_msec(10));
17551755   if(state->type != SYS_FM7)
1756      timer_adjust_oneshot(state->fm77av_vsync_timer,machine->primary_screen->time_until_vblank_end(),0);
1756      state->fm77av_vsync_timer->adjust(machine->primary_screen->time_until_vblank_end());
17571757
17581758   state->irq_mask = 0x00;
17591759   state->irq_flags = 0x00;
src/mess/drivers/ami1200.c
r10326r10327
135135static READ8_DEVICE_HANDLER( cd32_cia_0_portb_r )
136136{
137137   /* parallel port */
138   logerror("%s:CIA0_portb_r\n", cpuexec_describe_context(device->machine));
138   logerror("%s:CIA0_portb_r\n", device->machine->describe_context());
139139   return 0xff;
140140}
141141
142142static WRITE8_DEVICE_HANDLER( cd32_cia_0_portb_w )
143143{
144144   /* parallel port */
145   logerror("%s:CIA0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data);
145   logerror("%s:CIA0_portb_w(%02x)\n", device->machine->describe_context(), data);
146146}
147147
148148static ADDRESS_MAP_START( a1200_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mess/drivers/hp49gp.c
r10326r10327
2020      va_start( v, s_fmt);
2121      vsprintf( buf, s_fmt, v);
2222      va_end( v);
23      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
23      logerror( "%s: %s", machine->describe_context( ), buf);
2424   }
2525}
2626
src/mess/drivers/pv1000.c
r10326r10327
311311
312312   /* Set IRQ line and schedule release of IRQ line */
313313   cpu_set_input_line( state->maincpu, 0, ASSERT_LINE );
314   timer_adjust_oneshot( state->irq_off_timer, state->screen->time_until_pos(vpos, 380/2 ), 0 );
314   state->irq_off_timer->adjust( state->screen->time_until_pos(vpos, 380/2 ) );
315315
316316   /* Schedule next IRQ trigger */
317317   if ( vpos >= 255 )
318318   {
319319      next_vpos = 195;
320320   }
321   timer_adjust_oneshot( state->irq_on_timer, state->screen->time_until_pos(next_vpos, 0 ), 0 );
321   state->irq_on_timer->adjust( state->screen->time_until_pos(next_vpos, 0 ) );
322322}
323323
324324
r10326r10327
347347
348348   state->io_regs[5] = 0;
349349   state->fd_data = 0;
350   timer_adjust_oneshot( state->irq_on_timer, state->screen->time_until_pos(195, 0 ), 0 );
351   timer_adjust_oneshot( state->irq_off_timer, attotime::never, 0 );
350   state->irq_on_timer->adjust( state->screen->time_until_pos(195, 0 ) );
351   state->irq_off_timer->adjust( attotime::never );
352352}
353353
354354
src/mess/drivers/nc.c
r10326r10327
309309        nc_update_interrupts(machine);
310310
311311        /* don't trigger again, but don't free it */
312        timer_reset(state->keyboard_timer, attotime::never);
312        state->keyboard_timer->reset();
313313}
314314
315315
r10326r10327
624624      if ((data & (1<<3))!=0)
625625      {
626626         /* set timer to occur again */
627         timer_reset(state->keyboard_timer, attotime::from_msec(10));
627         state->keyboard_timer->reset(attotime::from_msec(10));
628628
629629         nc_update_interrupts(space->machine);
630630      }
r10326r10327
641641           )
642642        {
643643         /* set timer to occur again */
644         timer_reset(state->keyboard_timer, attotime::from_msec(10));
644         state->keyboard_timer->reset(attotime::from_msec(10));
645645        }
646646#endif
647647        state->irq_status &=~data;
r10326r10327
670670      state->irq_status &= ~(1<<3);
671671
672672      /* set timer to occur again */
673      timer_reset(state->keyboard_timer, attotime::from_msec(10));
673      state->keyboard_timer->reset(attotime::from_msec(10));
674674
675675      nc_update_interrupts(space->machine);
676676   }
r10326r10327
797797      }
798798   }
799799
800   timer_adjust_periodic(state->serial_timer, attotime::zero, 0, attotime::from_hz(baud_rate_table[(data & 0x07)]));
800   state->serial_timer->adjust(attotime::zero, 0, attotime::from_hz(baud_rate_table[(data & 0x07)]));
801801
802802   state->uart_control = data;
803803}
r10326r10327
994994
995995   /* keyboard timer */
996996   state->keyboard_timer = machine->scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback));
997   timer_adjust_oneshot(state->keyboard_timer, attotime::from_msec(10), 0);
997   state->keyboard_timer->adjust(attotime::from_msec(10));
998998
999999   /* serial timer */
10001000   state->serial_timer = machine->scheduler().timer_alloc(FUNC(nc_serial_timer_callback));
r10326r10327
13901390
13911391   /* keyboard timer */
13921392   state->keyboard_timer = machine->scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback));
1393   timer_adjust_oneshot(state->keyboard_timer, attotime::from_msec(10), 0);
1393   state->keyboard_timer->adjust(attotime::from_msec(10));
13941394
13951395   /* serial timer */
13961396   state->serial_timer = machine->scheduler().timer_alloc(FUNC(nc_serial_timer_callback));
src/mess/drivers/ngp.c
r10326r10327
605605   ngp_state *state = machine->driver_data<ngp_state>();
606606
607607   state->seconds_timer = machine->scheduler().timer_alloc(FUNC(ngp_seconds_callback));
608   timer_adjust_periodic( state->seconds_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1) );
608   state->seconds_timer->adjust( attotime::from_seconds(1), 0, attotime::from_seconds(1) );
609609}
610610
611611
src/mess/drivers/z88.c
r10326r10327
107107         /* column has gone low in snooze/coma */
108108         state->blink.sta |= STA_KEY;
109109
110         cpuexec_trigger(timer.machine, Z88_SNOOZE_TRIGGER);
110         timer.machine->scheduler().trigger(Z88_SNOOZE_TRIGGER);
111111
112112         z88_interrupt_refresh(timer.machine);
113113      }
src/mess/drivers/prof80.c
r10326r10327
244244         /* trigger floppy motor off NE555 timer */
245245         int t = 110 * RES_M(10) * CAP_U(6.8); // t = 1.1 * R8 * C6
246246
247         timer_adjust_oneshot(state->floppy_motor_off_timer, attotime::from_msec(t), 0);
247         state->floppy_motor_off_timer->adjust(attotime::from_msec(t));
248248      }
249249      else
250250      {
r10326r10327
257257         state->motor = 1;
258258
259259         /* reset floppy motor off NE555 timer */
260         timer_enable(state->floppy_motor_off_timer, 0);
260         state->floppy_motor_off_timer->enable(0);
261261      }
262262      break;
263263
r10326r10327
284284      if (!fb)
285285      {
286286         /* immediately turn off floppy motor */
287         timer_adjust_oneshot(state->floppy_motor_off_timer, attotime::zero, 0);
287         state->floppy_motor_off_timer->adjust(attotime::zero);
288288      }
289289      break;
290290
src/mess/drivers/aquarius.c
r10326r10327
199199/* note: 0xe6-0xe7 = drive 1, 0xea-0xeb = drive 2 */
200200static READ8_HANDLER( floppy_r )
201201{
202   logerror("%s: floppy_r[0x%02x]\n", cpuexec_describe_context(space->machine), offset);
202   logerror("%s: floppy_r[0x%02x]\n", space->machine->describe_context(), offset);
203203   return 0xff;
204204}
205205
206206static WRITE8_HANDLER( floppy_w )
207207{
208   logerror("%s: floppy_w[0x%02x] (0x%02x)\n", cpuexec_describe_context(space->machine), offset, data);
208   logerror("%s: floppy_w[0x%02x] (0x%02x)\n", space->machine->describe_context(), offset, data);
209209}
210210
211211
src/mess/drivers/x68k.c
r10326r10327
180180    mfp_timer[2] = machine->scheduler().timer_alloc(FUNC(mfp_timer_c_callback));
181181    mfp_timer[3] = machine->scheduler().timer_alloc(FUNC(mfp_timer_d_callback));
182182    mfp_irq = machine->scheduler().timer_alloc(FUNC(mfp_update_irq));
183    timer_adjust_periodic(mfp_irq, attotime::zero, 0, attotime::from_usec(32));
183    mfp_irq->adjust(attotime::zero, 0, attotime::from_usec(32));
184184#endif
185185}
186186
r10326r10327
308308{
309309    if((data & 0x07) == 0x0000)
310310    {  // Timer stop
311        timer_adjust_oneshot(mfp_timer[timer], attotime::zero, 0);
311        mfp_timer[timer]->adjust(attotime::zero);
312312        logerror("MFP: Timer #%i stopped. \n",timer);
313313        return;
314314    }
315315
316    timer_adjust_periodic(mfp_timer[timer], attotime::zero, 0, prescale(data & 0x07));
316    mfp_timer[timer]->adjust(attotime::zero, 0, prescale(data & 0x07));
317317    logerror("MFP: Timer #%i set to %2.1fus\n",timer, prescale(data & 0x07).as_double() * 1000000);
318318
319319}
r10326r10327
945945   if((state->ppi_prev & 0x10) == 0x00 && (data & 0x10) == 0x10)
946946   {
947947      state->mdctrl.seq1++;
948      timer_adjust_oneshot(state->mdctrl.io_timeout1,device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192),0);
948      state->mdctrl.io_timeout1->adjust(device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192));
949949   }
950950
951951   state->joy.joy2_enable = data & 0x20;
r10326r10327
953953   if((state->ppi_prev & 0x20) == 0x00 && (data & 0x20) == 0x20)
954954   {
955955      state->mdctrl.seq2++;
956      timer_adjust_oneshot(state->mdctrl.io_timeout2,device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192),0);
956      state->mdctrl.io_timeout2->adjust(device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192));
957957   }
958958   state->ppi_prev = data;
959959
r10326r10327
25722572   // start VBlank timer
25732573   state->crtc.vblank = 1;
25742574   irq_time = machine->primary_screen->time_until_pos(state->crtc.reg[6],2);
2575   timer_adjust_oneshot(state->vblank_irq, irq_time, 0);
2575   state->vblank_irq->adjust(irq_time);
25762576
25772577   // start HBlank timer
2578   timer_adjust_oneshot(state->scanline_timer, machine->primary_screen->scan_period(), 1);
2578   state->scanline_timer->adjust(machine->primary_screen->scan_period(), 1);
25792579
25802580   state->mfp.gpio = 0xfb;
25812581
r10326r10327
26212621   memory_set_bankptr(machine, "bank4",state->m_nvram);  // so that code in SRAM is executable, there is an option for booting from SRAM
26222622
26232623   // start keyboard timer
2624   timer_adjust_periodic(state->kb_timer, attotime::zero, 0, attotime::from_msec(5));  // every 5ms
2624   state->kb_timer->adjust(attotime::zero, 0, attotime::from_msec(5));  // every 5ms
26252625
26262626   // start mouse timer
2627   timer_adjust_periodic(state->mouse_timer, attotime::zero, 0, attotime::from_msec(1));  // a guess for now
2627   state->mouse_timer->adjust(attotime::zero, 0, attotime::from_msec(1));  // a guess for now
26282628   state->mouse.inputtype = 0;
26292629
26302630   // start LED timer
2631   timer_adjust_periodic(state->led_timer, attotime::zero, 0, attotime::from_msec(400));
2631   state->led_timer->adjust(attotime::zero, 0, attotime::from_msec(400));
26322632}
26332633
26342634static MACHINE_START( x68030 )
r10326r10327
26552655   memory_set_bankptr(machine, "bank4",state->m_nvram);  // so that code in SRAM is executable, there is an option for booting from SRAM
26562656
26572657   // start keyboard timer
2658   timer_adjust_periodic(state->kb_timer, attotime::zero, 0, attotime::from_msec(5));  // every 5ms
2658   state->kb_timer->adjust(attotime::zero, 0, attotime::from_msec(5));  // every 5ms
26592659
26602660   // start mouse timer
2661   timer_adjust_periodic(state->mouse_timer, attotime::zero, 0, attotime::from_msec(1));  // a guess for now
2661   state->mouse_timer->adjust(attotime::zero, 0, attotime::from_msec(1));  // a guess for now
26622662   state->mouse.inputtype = 0;
26632663
26642664   // start LED timer
2665   timer_adjust_periodic(state->led_timer, attotime::zero, 0, attotime::from_msec(400));
2665   state->led_timer->adjust(attotime::zero, 0, attotime::from_msec(400));
26662666}
26672667
26682668static DRIVER_INIT( x68000 )
src/mess/drivers/beta.c
r10326r10327
149149
150150   /* display */
151151   state->segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f;
152   timer_adjust_oneshot(state->led_refresh_timer, attotime::from_usec(70), 0);
152   state->led_refresh_timer->adjust(attotime::from_usec(70));
153153
154154   /* EPROM data */
155155   state->eprom_data = data;
src/mess/drivers/px4.c
r10326r10327
321321   px4_state *px4 = space->machine->driver_data<px4_state>();
322322
323323   if (VERBOSE)
324      logerror("%s: px4_icrlc_r\n", cpuexec_describe_context(space->machine));
324      logerror("%s: px4_icrlc_r\n", space->machine->describe_context());
325325
326326   /* latch value */
327327   px4->frc_latch = px4->frc_value;
r10326r10327
336336   int baud;
337337
338338   if (VERBOSE)
339      logerror("%s: px4_ctrl1_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
339      logerror("%s: px4_ctrl1_w (0x%02x)\n", space->machine->describe_context(), data);
340340
341341   /* baudrate generator */
342342   baud = data >> 4;
343343
344344   if (baud <= 12)
345345   {
346      timer_adjust_periodic(px4->transmit_timer, attotime::zero, 0, attotime::from_hz(XTAL_7_3728MHz/2/transmit_rate[baud]));
347      timer_adjust_periodic(px4->receive_timer, attotime::zero, 0, attotime::from_hz(XTAL_7_3728MHz/2/receive_rate[baud]));
346      px4->transmit_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_7_3728MHz/2/transmit_rate[baud]));
347      px4->receive_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_7_3728MHz/2/receive_rate[baud]));
348348   }
349349
350350   px4->ctrl1 = data;
r10326r10327
356356   px4_state *px4 = space->machine->driver_data<px4_state>();
357357
358358   if (VERBOSE)
359      logerror("%s: px4_icrhc_r\n", cpuexec_describe_context(space->machine));
359      logerror("%s: px4_icrhc_r\n", space->machine->describe_context());
360360
361361   return (px4->frc_latch >> 8) & 0xff;
362362}
r10326r10327
367367   px4_state *px4 = space->machine->driver_data<px4_state>();
368368
369369   if (VERBOSE)
370      logerror("%s: px4_cmdr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
370      logerror("%s: px4_cmdr_w (0x%02x)\n", space->machine->describe_context(), data);
371371
372372   /* clear overflow interrupt? */
373373   if (BIT(data, 2))
r10326r10327
383383   px4_state *px4 = space->machine->driver_data<px4_state>();
384384
385385   if (VERBOSE)
386      logerror("%s: px4_icrlb_r\n", cpuexec_describe_context(space->machine));
386      logerror("%s: px4_icrlb_r\n", space->machine->describe_context());
387387
388388   return px4->icrb & 0xff;
389389}
r10326r10327
394394   px4_state *px4 = space->machine->driver_data<px4_state>();
395395
396396   if (VERBOSE)
397      logerror("%s: px4_ctrl2_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
397      logerror("%s: px4_ctrl2_w (0x%02x)\n", space->machine->describe_context(), data);
398398
399399   /* bit 0, MIC, cassette output */
400400   cassette_output(px4->ext_cas, BIT(data, 0) ? -1.0 : +1.0);
r10326r10327
403403   if (BIT(data, 1))
404404   {
405405      cassette_change_state(px4->ext_cas, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
406      timer_adjust_periodic(px4->ext_cas_timer, attotime::zero, 0, attotime::from_hz(44100));
406      px4->ext_cas_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
407407   }
408408   else
409409   {
410410      cassette_change_state(px4->ext_cas, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
411      timer_adjust_oneshot(px4->ext_cas_timer, attotime::zero, 0);
411      px4->ext_cas_timer->adjust(attotime::zero);
412412   }
413413}
414414
r10326r10327
418418   px4_state *px4 = space->machine->driver_data<px4_state>();
419419
420420   if (VERBOSE)
421      logerror("%s: px4_icrhb_r\n", cpuexec_describe_context(space->machine));
421      logerror("%s: px4_icrhb_r\n", space->machine->describe_context());
422422
423423   /* clear icf interrupt */
424424   px4->isr &= ~INT2_ICF;
r10326r10327
433433   px4_state *px4 = space->machine->driver_data<px4_state>();
434434
435435   if (VERBOSE)
436      logerror("%s: px4_isr_r\n", cpuexec_describe_context(space->machine));
436      logerror("%s: px4_isr_r\n", space->machine->describe_context());
437437
438438   return px4->isr;
439439}
r10326r10327
444444   px4_state *px4 = space->machine->driver_data<px4_state>();
445445
446446   if (VERBOSE)
447      logerror("%s: px4_ier_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
447      logerror("%s: px4_ier_w (0x%02x)\n", space->machine->describe_context(), data);
448448
449449   px4->ier = data;
450450   gapnit_interrupt(space->machine);
r10326r10327
457457   UINT8 result = 0;
458458
459459   if (VERBOSE)
460      logerror("%s: px4_str_r\n", cpuexec_describe_context(space->machine));
460      logerror("%s: px4_str_r\n", space->machine->describe_context());
461461
462462   result |= cassette_input(px4->ext_cas) > 0 ? 1 : 0;
463463   result |= 1 << 1;   /* BCRD, barcode reader input */
r10326r10327
502502   address_space *space_program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
503503
504504   if (VERBOSE)
505      logerror("%s: px4_bankr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
505      logerror("%s: px4_bankr_w (0x%02x)\n", space->machine->describe_context(), data);
506506
507507   px4->bankr = data;
508508
r10326r10327
544544   px4_state *px4 = space->machine->driver_data<px4_state>();
545545
546546   if (VERBOSE)
547      logerror("%s: px4_sior_r 0x%02x\n", cpuexec_describe_context(space->machine), px4->sior);
547      logerror("%s: px4_sior_r 0x%02x\n", space->machine->describe_context(), px4->sior);
548548
549549   return px4->sior;
550550}
r10326r10327
555555   px4_state *px4 = space->machine->driver_data<px4_state>();
556556
557557   if (VERBOSE)
558      logerror("%s: px4_sior_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
558      logerror("%s: px4_sior_w (0x%02x)\n", space->machine->describe_context(), data);
559559
560560   px4->sior = data;
561561
r10326r10327
687687   px4_state *px4 = space->machine->driver_data<px4_state>();
688688
689689   if (VERBOSE)
690      logerror("%s: px4_vadr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
690      logerror("%s: px4_vadr_w (0x%02x)\n", space->machine->describe_context(), data);
691691
692692   px4->vadr = data;
693693}
r10326r10327
698698   px4_state *px4 = space->machine->driver_data<px4_state>();
699699
700700   if (VERBOSE)
701      logerror("%s: px4_yoff_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
701      logerror("%s: px4_yoff_w (0x%02x)\n", space->machine->describe_context(), data);
702702
703703   px4->yoff = data;
704704}
r10326r10327
707707static WRITE8_HANDLER( px4_fr_w )
708708{
709709   if (VERBOSE)
710      logerror("%s: px4_fr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
710      logerror("%s: px4_fr_w (0x%02x)\n", space->machine->describe_context(), data);
711711}
712712
713713/* speed-up register */
714714static WRITE8_HANDLER( px4_spur_w )
715715{
716716   if (VERBOSE)
717      logerror("%s: px4_spur_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
717      logerror("%s: px4_spur_w (0x%02x)\n", space->machine->describe_context(), data);
718718}
719719
720720
r10326r10327
746746static READ8_HANDLER( px4_ctgif_r )
747747{
748748   if (VERBOSE)
749      logerror("%s: px4_ctgif_r @ 0x%02x\n", cpuexec_describe_context(space->machine), offset);
749      logerror("%s: px4_ctgif_r @ 0x%02x\n", space->machine->describe_context(), offset);
750750
751751   return 0xff;
752752}
r10326r10327
755755static WRITE8_HANDLER( px4_ctgif_w )
756756{
757757   if (VERBOSE)
758      logerror("%s: px4_ctgif_w (0x%02x @ 0x%02x)\n", cpuexec_describe_context(space->machine), data, offset);
758      logerror("%s: px4_ctgif_w (0x%02x @ 0x%02x)\n", space->machine->describe_context(), data, offset);
759759}
760760
761761/* art data input register */
r10326r10327
764764   px4_state *px4 = space->machine->driver_data<px4_state>();
765765
766766   if (VERBOSE)
767      logerror("%s: px4_artdir_r\n", cpuexec_describe_context(space->machine));
767      logerror("%s: px4_artdir_r\n", space->machine->describe_context());
768768
769769   return px4->artdir;
770770}
r10326r10327
775775   px4_state *px4 = space->machine->driver_data<px4_state>();
776776
777777   if (VERBOSE)
778      logerror("%s: px4_artdor_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
778      logerror("%s: px4_artdor_w (0x%02x)\n", space->machine->describe_context(), data);
779779
780780   /* clear ready */
781781   px4->artsr &= ~ART_TXRDY;
r10326r10327
790790   UINT8 result = 0;
791791
792792   if (VERBOSE)
793      logerror("%s: px4_artsr_r\n", cpuexec_describe_context(space->machine));
793      logerror("%s: px4_artsr_r\n", space->machine->describe_context());
794794
795795   result |= px4_rs232c_dsr(px4->rs232c_device) << 7;
796796
r10326r10327
803803   px4_state *px4 = space->machine->driver_data<px4_state>();
804804
805805   if (VERBOSE)
806      logerror("%s: px4_artmr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
806      logerror("%s: px4_artmr_w (0x%02x)\n", space->machine->describe_context(), data);
807807
808808   px4->artmr = data;
809809}
r10326r10327
815815   UINT8 result = 0;
816816
817817   if (VERBOSE)
818      logerror("%s: px4_iostr_r\n", cpuexec_describe_context(space->machine));
818      logerror("%s: px4_iostr_r\n", space->machine->describe_context());
819819
820820   result |= centronics_busy_r(px4->printer) << 0;
821821   result |= !centronics_pe_r(px4->printer) << 1;
r10326r10327
835835   px4_state *px4 = space->machine->driver_data<px4_state>();
836836
837837   if (VERBOSE)
838      logerror("%s: px4_artcr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
838      logerror("%s: px4_artcr_w (0x%02x)\n", space->machine->describe_context(), data);
839839
840840   px4->artcr = data;
841841
r10326r10327
869869   px4_state *px4 = space->machine->driver_data<px4_state>();
870870
871871   if (VERBOSE)
872      logerror("%s: px4_swr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
872      logerror("%s: px4_swr_w (0x%02x)\n", space->machine->describe_context(), data);
873873
874874   px4->swr = data;
875875}
r10326r10327
880880   px4_state *px4 = space->machine->driver_data<px4_state>();
881881
882882   if (VERBOSE)
883      logerror("%s: px4_ioctlr_w (0x%02x)\n", cpuexec_describe_context(space->machine), data);
883      logerror("%s: px4_ioctlr_w (0x%02x)\n", space->machine->describe_context(), data);
884884
885885   centronics_strobe_w(px4->printer, !BIT(data, 0));
886886   centronics_prime_w(px4->printer, BIT(data, 1));
src/mess/drivers/jr200.c
r10326r10327
304304   {
305305      case 0xc805: break; //LPT printer port W
306306      case 0xc816: if (data!=0) {
307               timer_adjust_periodic(state->timer_d, attotime::zero, 0, attotime::from_hz(XTAL_14_31818MHz) * (state->mn1271_ram[0x17]*0x100 + state->mn1271_ram[0x18]));
307               state->timer_d->adjust(attotime::zero, 0, attotime::from_hz(XTAL_14_31818MHz) * (state->mn1271_ram[0x17]*0x100 + state->mn1271_ram[0x18]));
308308            } else {
309               timer_adjust_periodic(state->timer_d, attotime::zero, 0,  attotime::zero);
309               state->timer_d->adjust(attotime::zero, 0,  attotime::zero);
310310            }
311311            break;
312312      case 0xc819: jr200_beep_w(space,0,data); break;
src/mess/drivers/gp32.c
r10326r10327
3535      va_start( v, s_fmt);
3636      vsprintf( buf, s_fmt, v);
3737      va_end( v);
38      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
38      logerror( "%s: %s", machine->describe_context( ), buf);
3939   }
4040}
4141
r10326r10327
284284      }
285285      if ((state->s3c240x_lcd.vpos == 0) && (state->s3c240x_lcd.hpos == 0)) break;
286286   }
287   timer_adjust_oneshot( state->s3c240x_lcd_timer, screen->time_until_pos(state->s3c240x_lcd.vpos, state->s3c240x_lcd.hpos), 0);
287   state->s3c240x_lcd_timer->adjust( screen->time_until_pos(state->s3c240x_lcd.vpos, state->s3c240x_lcd.hpos));
288288}
289289
290290static VIDEO_START( gp32 )
r10326r10327
357357   verboselog( machine, 1, "LCD start\n");
358358   s3c240x_lcd_configure( machine);
359359   s3c240x_lcd_dma_init( machine);
360   timer_adjust_oneshot( state->s3c240x_lcd_timer, screen->time_until_pos(0, 0), 0);
360   state->s3c240x_lcd_timer->adjust( screen->time_until_pos(0, 0));
361361}
362362
363363static void s3c240x_lcd_stop( running_machine *machine)
364364{
365365   gp32_state *state = machine->driver_data<gp32_state>();
366366   verboselog( machine, 1, "LCD stop\n");
367   timer_adjust_oneshot( state->s3c240x_lcd_timer, attotime::never, 0);
367   state->s3c240x_lcd_timer->adjust( attotime::never);
368368}
369369
370370static void s3c240x_lcd_recalc( running_machine *machine)
r10326r10327
632632   verboselog( machine, 5, "PWM %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d auto_reload=%d hz=%f\n", timer, s3c240x_get_fclk(state, MPLLCON), s3c240x_get_hclk(state, MPLLCON), s3c240x_get_pclk(state, MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, auto_reload, hz);
633633   if (auto_reload)
634634   {
635      timer_adjust_periodic( state->s3c240x_pwm_timer[timer], attotime::from_hz( hz), timer, attotime::from_hz( hz));
635      state->s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer, attotime::from_hz( hz));
636636   }
637637   else
638638   {
639      timer_adjust_oneshot( state->s3c240x_pwm_timer[timer], attotime::from_hz( hz), timer);
639      state->s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer);
640640   }
641641}
642642
r10326r10327
644644{
645645   gp32_state *state = machine->driver_data<gp32_state>();
646646   verboselog( machine, 1, "PWM %d stop\n", timer);
647   timer_adjust_oneshot( state->s3c240x_pwm_timer[timer], attotime::never, 0);
647   state->s3c240x_pwm_timer[timer]->adjust( attotime::never);
648648}
649649
650650static void s3c240x_pwm_recalc( running_machine *machine, int timer)
r10326r10327
14131413   gp32_state *state = machine->driver_data<gp32_state>();
14141414   verboselog( machine, 1, "IIC start\n");
14151415   state->s3c240x_iic.data_index = 0;
1416   timer_adjust_oneshot( state->s3c240x_iic_timer, attotime::from_msec( 1), 0);
1416   state->s3c240x_iic_timer->adjust( attotime::from_msec( 1));
14171417}
14181418
14191419static void iic_stop( running_machine *machine)
14201420{
14211421   gp32_state *state = machine->driver_data<gp32_state>();
14221422   verboselog( machine, 1, "IIC stop\n");
1423   timer_adjust_oneshot( state->s3c240x_iic_timer, attotime::never, 0);
1423   state->s3c240x_iic_timer->adjust( attotime::never);
14241424}
14251425
14261426static void iic_resume( running_machine *machine)
14271427{
14281428   gp32_state *state = machine->driver_data<gp32_state>();
14291429   verboselog( machine, 1, "IIC resume\n");
1430   timer_adjust_oneshot( state->s3c240x_iic_timer, attotime::from_msec( 1), 0);
1430   state->s3c240x_iic_timer->adjust( attotime::from_msec( 1));
14311431}
14321432
14331433static READ32_HANDLER( s3c240x_iic_r )
r10326r10327
15631563   codeclk = BIT( state->s3c240x_iis_regs[1], 2);
15641564   freq = (double)(s3c240x_get_pclk(state, MPLLCON) / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two?
15651565   verboselog( machine, 5, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", s3c240x_get_pclk(state, MPLLCON), prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq);
1566   timer_adjust_periodic( state->s3c240x_iis_timer, attotime::from_hz( freq), 0, attotime::from_hz( freq));
1566   state->s3c240x_iis_timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq));
15671567}
15681568
15691569static void s3c240x_iis_stop( running_machine *machine)
15701570{
15711571   gp32_state *state = machine->driver_data<gp32_state>();
15721572   verboselog( machine, 1, "IIS stop\n");
1573   timer_adjust_oneshot( state->s3c240x_iis_timer, attotime::never, 0);
1573   state->s3c240x_iis_timer->adjust( attotime::never);
15741574}
15751575
15761576static void s3c240x_iis_recalc( running_machine *machine)
src/mess/drivers/saturn.c
r10326r10327
640640            if(LOG_SMPC) logerror ("SMPC: Slave OFF\n");
641641            smpc_ram[0x5f]=0x03;
642642            stv_enable_slave_sh2 = 0;
643            cpuexec_trigger(machine, 1000);
643            machine->scheduler().trigger(1000);
644644            cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
645645            break;
646646         case 0x06:
r10326r10327
18531853static WRITE32_HANDLER( minit_w )
18541854{
18551855   logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->cpu->tag(), cpu_get_pc(space->cpu),data);
1856   cpuexec_boost_interleave(space->machine, minit_boost_timeslice, attotime::from_usec(minit_boost));
1857   cpuexec_trigger(space->machine, 1000);
1856   space->machine->scheduler().boost_interleave(minit_boost_timeslice, attotime::from_usec(minit_boost));
1857   space->machine->scheduler().trigger(1000);
18581858   sh2_set_frt_input(space->machine->device("slave"), PULSE_LINE);
18591859}
18601860
18611861static WRITE32_HANDLER( sinit_w )
18621862{
18631863   logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->cpu->tag(), cpu_get_pc(space->cpu),data);
1864   cpuexec_boost_interleave(space->machine, sinit_boost_timeslice, attotime::from_usec(sinit_boost));
1864   space->machine->scheduler().boost_interleave(sinit_boost_timeslice, attotime::from_usec(sinit_boost));
18651865   sh2_set_frt_input(space->machine->device("maincpu"), PULSE_LINE);
18661866}
18671867
r10326r10327
21182118      /*set the first Timer-1 event*/
21192119      cur_scan = scanline+1;
21202120      if(stv_irq.timer_1)
2121         t1_timer->adjust(timer.machine->primary_screen->time_until_pos(scanline+1, 0));
2121         t1_timer->adjust(timer.machine->primary_screen->time_until_pos(scanline+1));
21222122   }
21232123
21242124   timer_0++;
r10326r10327
21612161
21622162   /*Next V-Blank-OUT event*/
21632163   if(stv_irq.vblank_out)
2164      vblank_out_timer->adjust(device->machine->primary_screen->time_until_pos(0, 0));
2164      vblank_out_timer->adjust(device->machine->primary_screen->time_until_pos(0));
21652165   /*Set the first Hblank-IN event*/
21662166   if(stv_irq.hblank_in || stv_irq.timer_0 || stv_irq.timer_1)
21672167      scan_timer->adjust(device->machine->primary_screen->time_until_pos(0, h_sync));
r10326r10327
22862286   scan_timer = machine->device<timer_device>("scan_timer");
22872287   t1_timer = machine->device<timer_device>("t1_timer");
22882288   vblank_out_timer = machine->device<timer_device>("vbout_timer");
2289   vblank_out_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
2289   vblank_out_timer->adjust(machine->primary_screen->time_until_pos(0));
22902290   scan_timer->adjust(machine->primary_screen->time_until_pos(224, 352));
22912291}
22922292
src/mess/drivers/supracan.c
r10326r10327
14941494{
14951495    supracan_state *state = machine->driver_data<supracan_state>();
14961496
1497    timer_adjust_oneshot(state->hbl_timer, attotime::never, 0);
1497    state->hbl_timer->adjust(attotime::never);
14981498}
14991499
15001500static TIMER_CALLBACK( supracan_line_on_callback )
r10326r10327
15031503
15041504    cpu_set_input_line(machine->device("maincpu"), 5, HOLD_LINE);
15051505
1506    timer_adjust_oneshot(state->line_on_timer, attotime::never, 0);
1506    state->line_on_timer->adjust(attotime::never);
15071507}
15081508
15091509static TIMER_CALLBACK( supracan_line_off_callback )
r10326r10327
15121512
15131513    cpu_set_input_line(machine->device("maincpu"), 5, CLEAR_LINE);
15141514
1515    timer_adjust_oneshot(state->line_on_timer, attotime::never, 0);
1515    state->line_on_timer->adjust(attotime::never);
15161516}
15171517
15181518static TIMER_CALLBACK( supracan_video_callback )
r10326r10327
15511551
15521552    state->video_regs[1] = machine->primary_screen->vpos()-16; // for son of evil, wants vblank active around 224 instead...
15531553
1554    timer_adjust_oneshot( state->hbl_timer, machine->primary_screen->time_until_pos( vpos, 320 ), 0 );
1555    timer_adjust_oneshot( state->video_timer, machine->primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ), 0 );
1554    state->hbl_timer->adjust( machine->primary_screen->time_until_pos( vpos, 320 ) );
1555    state->video_timer->adjust( machine->primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ) );
15561556}
15571557
15581558static WRITE16_HANDLER( supracan_video_w )
r10326r10327
16551655                verboselog("maincpu", space->machine, 0, "IRQ Trigger? = %04x\n", data);
16561656                if(data & 0x8000)
16571657                {
1658                    timer_adjust_oneshot(state->line_on_timer, space->machine->primary_screen->time_until_pos((data & 0x00ff), 0), 0);
1658                    state->line_on_timer->adjust(space->machine->primary_screen->time_until_pos((data & 0x00ff), 0));
16591659                }
16601660                else
16611661                {
1662                    timer_adjust_oneshot(state->line_on_timer, attotime::never, 0);
1662                    state->line_on_timer->adjust(attotime::never);
16631663                }
16641664            }
16651665            break;
r10326r10327
16691669                verboselog("maincpu", space->machine, 0, "IRQ De-Trigger? = %04x\n", data);
16701670                if(data & 0x8000)
16711671                {
1672                    timer_adjust_oneshot(state->line_off_timer, space->machine->primary_screen->time_until_pos(data & 0x00ff, 0), 0);
1672                    state->line_off_timer->adjust(space->machine->primary_screen->time_until_pos(data & 0x00ff, 0));
16731673                }
16741674                else
16751675                {
1676                    timer_adjust_oneshot(state->line_off_timer, attotime::never, 0);
1676                    state->line_off_timer->adjust(attotime::never);
16771677                }
16781678            }
16791679            break;
r10326r10327
17911791
17921792   cputag_set_input_line(machine, "soundcpu", INPUT_LINE_HALT, ASSERT_LINE);
17931793
1794   timer_adjust_oneshot( state->video_timer, machine->primary_screen->time_until_pos( 0, 0 ), 0 );
1794   state->video_timer->adjust( machine->primary_screen->time_until_pos( 0, 0 ) );
17951795   state->irq_mask = 0;
17961796}
17971797
src/mess/drivers/craft.c
r10326r10327
669669         verboselog(machine, 0, "avr8_update_timer1_clock_source: T1 Trigger mode not implemented yet\n");
670670         break;
671671   }
672   timer_adjust_periodic(state->timer1_timer, period, 0, period);
672   state->timer1_timer->adjust(period, 0, period);
673673}
674674
675675static void avr8_changed_tccr1b(running_machine *machine, UINT8 data)
r10326r10327
774774         period = attotime::from_hz(MASTER_CLOCK/1024);
775775         break;
776776   }
777   timer_adjust_periodic(state->timer2_timer, period, 0, period);
777   state->timer2_timer->adjust(period, 0, period);
778778}
779779
780780static void avr8_timer2_force_output_compare(running_machine *machine, int reg)
src/mess/drivers/pv2000.c
r10326r10327
5252{
5353   pv2000_state *state = space->machine->driver_data<pv2000_state>();
5454
55   logerror( "%s: pv2000_cass_conf_w %02x\n", cpuexec_describe_context(space->machine), data );
55   logerror( "%s: pv2000_cass_conf_w %02x\n", space->machine->describe_context(), data );
5656
5757   state->cass_conf = data & 0x0f;
5858
r10326r10327
6767{
6868   pv2000_state *state = space->machine->driver_data<pv2000_state>();
6969
70   logerror( "%s: pv2000_keys_w %02x\n", cpuexec_describe_context(space->machine), data );
70   logerror( "%s: pv2000_keys_w %02x\n", space->machine->describe_context(), data );
7171
7272   state->keyb_column = data & 0x0f;
7373
r10326r10327
120120   pv2000_state *state = space->machine->driver_data<pv2000_state>();
121121   UINT8 data = 0;
122122
123   logerror("%s: pv2000_keys_r\n", cpuexec_describe_context(space->machine) );
123   logerror("%s: pv2000_keys_r\n", space->machine->describe_context() );
124124
125125   switch ( state->keyb_column )
126126   {
src/mess/drivers/scv.c
r10326r10327
431431      break;
432432   }
433433
434   timer_adjust_oneshot( state->vb_timer, machine->primary_screen->time_until_pos(( vpos + 1 ) % 262, 0 ), 0 );
434   state->vb_timer->adjust( machine->primary_screen->time_until_pos(( vpos + 1 ) % 262, 0 ) );
435435}
436436
437437
r10326r10327
736736{
737737   scv_state *state = machine->driver_data<scv_state>();
738738
739   timer_adjust_oneshot( state->vb_timer, machine->primary_screen->time_until_pos(0, 0 ), 0 );
739   state->vb_timer->adjust( machine->primary_screen->time_until_pos(0, 0 ) );
740740}
741741
742742
src/mess/drivers/supercon.c
r10326r10327
334334   if (!state->emu_started)
335335      return 0xbf;
336336   else
337      timer_adjust_periodic( state->timer_update_irq, attotime::zero, 0, attotime::from_hz(598) );  //HACK adjust timer after start ???
337      state->timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(598) );  //HACK adjust timer after start ???
338338
339339
340340/* Buttons */
r10326r10327
551551   state->remove_led_flag=TRUE;
552552
553553   state->timer_update_irq = machine->scheduler().timer_alloc(FUNC(update_irq));
554   timer_adjust_periodic( state->timer_update_irq, attotime::zero, 0, attotime::from_hz(1000) );
554   state->timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(1000) );
555555
556556   state_save_register_global_array(machine,state->save_board);
557557   state_save_register_postload(machine,m_board_postload,NULL);
src/mess/drivers/lx800.c
r10326r10327
4444{
4545   UINT8 result = 0;
4646
47   logerror("%s: lx800_porta_r(%02x)\n", cpuexec_describe_context(space->machine), offset);
47   logerror("%s: lx800_porta_r(%02x)\n", space->machine->describe_context(), offset);
4848
4949   result |= input_port_read(space->machine, "LINEFEED") << 3;
5050   result |= input_port_read(space->machine, "FORMFEED") << 4;
r10326r10327
5757
5858static WRITE8_HANDLER( lx800_porta_w )
5959{
60   logerror("%s: lx800_porta_w(%02x): %02x\n", cpuexec_describe_context(space->machine), offset, data);
60   logerror("%s: lx800_porta_w(%02x): %02x\n", space->machine->describe_context(), offset, data);
6161   logerror("--> carriage: %d, paper feed: %d\n", BIT(data, 0), BIT(data, 2));
6262}
6363
r10326r10327
7474{
7575   UINT8 result = 0;
7676
77   logerror("%s: lx800_portc_r(%02x)\n", cpuexec_describe_context(space->machine), offset);
77   logerror("%s: lx800_portc_r(%02x)\n", space->machine->describe_context(), offset);
7878
7979   result |= input_port_read(space->machine, "ONLINE") << 3;
8080
r10326r10327
8585{
8686   lx800_state *lx800 = space->machine->driver_data<lx800_state>();
8787
88   logerror("%s: lx800_portc_w(%02x): %02x\n", cpuexec_describe_context(space->machine), offset, data);
88   logerror("%s: lx800_portc_w(%02x): %02x\n", space->machine->describe_context(), offset, data);
8989   logerror("--> err: %d, ack: %d, fire: %d, buzzer: %d\n", BIT(data, 4), BIT(data, 5), BIT(data, 6), BIT(data, 7));
9090
9191   output_set_value("online_led", !BIT(data, 2));
src/mess/drivers/svision.c
r10326r10327
6969{
7070   svision_state *state = machine->driver_data<svision_state>();
7171    state->svision.timer_shot = TRUE;
72    timer_enable(state->svision.timer1, FALSE);
72    state->svision.timer1->enable(FALSE);
7373    svision_irq( machine );
7474}
7575
r10326r10327
142142            delay = 16384;
143143         else
144144            delay = 256;
145         timer_enable(state->svision.timer1, TRUE);
146         timer_reset(state->svision.timer1, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(value * delay));
145         state->svision.timer1->enable(TRUE);
146         state->svision.timer1->reset(space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(value * delay));
147147         break;
148148      case 0x10: case 0x11: case 0x12: case 0x13:
149149         svision_soundport_w(state->sound, 0, offset & 3, data);
src/mess/drivers/micronic.c
r10326r10327
246246      case 15:   timer_per = attotime::from_msec(500);            break;
247247   }
248248
249   timer_adjust_periodic(state->rtc_periodic_irq, timer_per, 0, timer_per);
249   state->rtc_periodic_irq->adjust(timer_per, 0, timer_per);
250250}
251251
252252static WRITE8_HANDLER( rtc_address_w )
src/mess/drivers/ptcsol.c
r10326r10327
332332      (BIT(data, 6)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
333333
334334   if (data & 0xc0)
335      timer_adjust_periodic(m_cassette_timer, attotime::zero, 0, attotime::from_hz(19200));
335      m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200));
336336   else
337      timer_adjust_oneshot(m_cassette_timer, attotime::zero, 0);
337      m_cassette_timer->adjust(attotime::zero);
338338
339339   // bit 5 baud rate */
340340   ay31015_set_receiver_clock( m_uart, (BIT(data, 5)) ? 4800.0 : 19200.0);
src/mess/drivers/gba.c
r10326r10327
117117
118118//  printf("dma complete: ch %d\n", ch);
119119
120   timer_adjust_oneshot(state->dma_timer[ch], attotime::never, 0);
120   state->dma_timer[ch]->adjust(attotime::never);
121121
122122   ctrl = state->dma_regs[(ch*3)+2] >> 16;
123123
r10326r10327
279279   state->dma_dst[ch] = dst;
280280
281281//  printf("settng DMA timer %d for %d cycs (tmr %x)\n", ch, cnt, (UINT32)state->dma_timer[ch]);
282//  timer_adjust_oneshot(state->dma_timer[ch], ATTOTIME_IN_CYCLES(0, cnt), ch);
282//  state->dma_timer[ch]->adjust(ATTOTIME_IN_CYCLES(0, cnt), ch);
283283   dma_complete(machine, NULL, ch);
284284}
285285
r10326r10327
395395      state->timer_hz[tmr] = final;
396396      time = attotime::from_hz(final);
397397      GBA_ATTOTIME_NORMALIZE(time);
398      timer_adjust_periodic(state->tmr_timer[tmr], time, tmr, time);
398      state->tmr_timer[tmr]->adjust(time, tmr, time);
399399   }
400400
401401   // check if timers 0 or 1 are feeding directsound
r10326r10327
521521
522522   gba_request_irq(machine, state->IF);
523523
524   timer_adjust_oneshot(state->irq_timer, attotime::never, 0);
524   state->irq_timer->adjust(attotime::never);
525525}
526526
527527static READ32_HANDLER( gba_io_r )
r10326r10327
884884               else
885885               {
886886
887               time = timer_timeelapsed(state->tmr_timer[timer]).as_double();
887               time = state->tmr_timer[timer]->elapsed().as_double();
888888
889889               ticks = (double)(0x10000 - (state->timer_regs[timer] & 0xffff));
890890
r10326r10327
17111711               {
17121712                  attotime time = attotime::from_hz(final);
17131713                  GBA_ATTOTIME_NORMALIZE(time);
1714                  timer_adjust_periodic(state->tmr_timer[offset], time, offset, time);
1714                  state->tmr_timer[offset]->adjust(time, offset, time);
17151715               }
17161716            }
17171717         }
r10326r10327
18521852            // if we still have interrupts, yank the IRQ line again
18531853            if (state->IF)
18541854            {
1855               timer_adjust_oneshot(state->irq_timer, machine->device<cpu_device>("maincpu")->clocks_to_attotime(120), 0);
1855               state->irq_timer->adjust(machine->device<cpu_device>("maincpu")->clocks_to_attotime(120));
18561856            }
18571857         }
18581858         break;
r10326r10327
18741874            state->IME = ( state->IME & ~mem_mask ) | ( data & mem_mask );
18751875            if (state->IF)
18761876            {
1877               timer_adjust_oneshot(state->irq_timer, attotime::zero, 0);
1877               state->irq_timer->adjust(attotime::zero);
18781878            }
18791879         }
18801880         if( (mem_mask) & 0xffff0000 )
r10326r10327
19871987      UINT16 insn = space->read_word( pc + 4);
19881988      data = (insn << 16) | (insn << 0);
19891989   }
1990   logerror( "%s: unmapped program memory read from %08X = %08X & %08X\n", cpuexec_describe_context( space->machine), 0x10000000 + (offset << 2), data, mem_mask);
1990   logerror( "%s: unmapped program memory read from %08X = %08X & %08X\n", space->machine->describe_context( ), 0x10000000 + (offset << 2), data, mem_mask);
19911991   return data;
19921992}
19931993
r10326r10327
20492049      }
20502050   }
20512051
2052   timer_adjust_oneshot(state->hbl_timer, attotime::never, 0);
2052   state->hbl_timer->adjust(attotime::never);
20532053}
20542054
20552055static TIMER_CALLBACK( perform_scan )
r10326r10327
21042104      }
21052105   }
21062106
2107   timer_adjust_oneshot(state->hbl_timer, machine->primary_screen->time_until_pos(scanline, 240), 0);
2108   timer_adjust_oneshot(state->scan_timer, machine->primary_screen->time_until_pos(( scanline + 1 ) % 228, 0), 0);
2107   state->hbl_timer->adjust(machine->primary_screen->time_until_pos(scanline, 240));
2108   state->scan_timer->adjust(machine->primary_screen->time_until_pos(( scanline + 1 ) % 228, 0));
21092109}
21102110
21112111static MACHINE_RESET( gba )
r10326r10327
21382138
21392139   state->bios_protected = 0;
21402140
2141   timer_adjust_oneshot(state->scan_timer, machine->primary_screen->time_until_pos(0, 0), 0);
2142   timer_adjust_oneshot(state->hbl_timer, attotime::never, 0);
2143   timer_adjust_oneshot(state->dma_timer[0], attotime::never, 0);
2144   timer_adjust_oneshot(state->dma_timer[1], attotime::never, 1);
2145   timer_adjust_oneshot(state->dma_timer[2], attotime::never, 2);
2146   timer_adjust_oneshot(state->dma_timer[3], attotime::never, 3);
2141   state->scan_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
2142   state->hbl_timer->adjust(attotime::never);
2143   state->dma_timer[0]->adjust(attotime::never);
2144   state->dma_timer[1]->adjust(attotime::never, 1);
2145   state->dma_timer[2]->adjust(attotime::never, 2);
2146   state->dma_timer[3]->adjust(attotime::never, 3);
21472147
21482148   state->fifo_a_ptr = state->fifo_b_ptr = 17;   // indicate empty
21492149   state->fifo_a_in = state->fifo_b_in = 17;
r10326r10327
21782178   /* create a timer to fire scanline functions */
21792179   state->scan_timer = machine->scheduler().timer_alloc(FUNC(perform_scan));
21802180   state->hbl_timer = machine->scheduler().timer_alloc(FUNC(perform_hbl));
2181   timer_adjust_oneshot(state->scan_timer, machine->primary_screen->time_until_pos(0, 0), 0);
2181   state->scan_timer->adjust(machine->primary_screen->time_until_pos(0, 0));
21822182
21832183   /* and one for each DMA channel */
21842184   state->dma_timer[0] = machine->scheduler().timer_alloc(FUNC(dma_complete));
21852185   state->dma_timer[1] = machine->scheduler().timer_alloc(FUNC(dma_complete));
21862186   state->dma_timer[2] = machine->scheduler().timer_alloc(FUNC(dma_complete));
21872187   state->dma_timer[3] = machine->scheduler().timer_alloc(FUNC(dma_complete));
2188   timer_adjust_oneshot(state->dma_timer[0], attotime::never, 0);
2189   timer_adjust_oneshot(state->dma_timer[1], attotime::never, 1);
2190   timer_adjust_oneshot(state->dma_timer[2], attotime::never, 2);
2191   timer_adjust_oneshot(state->dma_timer[3], attotime::never, 3);
2188   state->dma_timer[0]->adjust(attotime::never);
2189   state->dma_timer[1]->adjust(attotime::never, 1);
2190   state->dma_timer[2]->adjust(attotime::never, 2);
2191   state->dma_timer[3]->adjust(attotime::never, 3);
21922192
21932193   /* also one for each timer (heh) */
21942194   state->tmr_timer[0] = machine->scheduler().timer_alloc(FUNC(timer_expire));
21952195   state->tmr_timer[1] = machine->scheduler().timer_alloc(FUNC(timer_expire));
21962196   state->tmr_timer[2] = machine->scheduler().timer_alloc(FUNC(timer_expire));
21972197   state->tmr_timer[3] = machine->scheduler().timer_alloc(FUNC(timer_expire));
2198   timer_adjust_oneshot(state->tmr_timer[0], attotime::never, 0);
2199   timer_adjust_oneshot(state->tmr_timer[1], attotime::never, 1);
2200   timer_adjust_oneshot(state->tmr_timer[2], attotime::never, 2);
2201   timer_adjust_oneshot(state->tmr_timer[3], attotime::never, 3);
2198   state->tmr_timer[0]->adjust(attotime::never);
2199   state->tmr_timer[1]->adjust(attotime::never, 1);
2200   state->tmr_timer[2]->adjust(attotime::never, 2);
2201   state->tmr_timer[3]->adjust(attotime::never, 3);
22022202
22032203   /* and an IRQ handling timer */
22042204   state->irq_timer = machine->scheduler().timer_alloc(FUNC(handle_irq));
2205   timer_adjust_oneshot(state->irq_timer, attotime::never, 0);
2205   state->irq_timer->adjust(attotime::never);
22062206
22072207   gba_video_start(machine);
22082208}
src/ldplayer/ldplayer.c
r10326r10327
317317      data = pr8210_command_buffer[pr8210_command_buffer_out++ % ARRAY_LENGTH(pr8210_command_buffer)];
318318      bitsleft = 12;
319319   }
320   timer_adjust_oneshot(pr8210_bit_timer, duration, (bitsleft << 16) | data);
320   pr8210_bit_timer->adjust(duration, (bitsleft << 16) | data);
321321}
322322
323323
r10326r10327
332332static MACHINE_RESET( pr8210 )
333333{
334334   MACHINE_RESET_CALL(ldplayer);
335   timer_adjust_oneshot(pr8210_bit_timer, attotime::zero, 0);
335   pr8210_bit_timer->adjust(attotime::zero);
336336}
337337
338338

Previous 15994 Revisions Next


© 1998-2018 The MESS Team