Previous 15994 Revisions Next

r1682 Thursday 14th February, 2008 at 15:33:19 UTC by Dirk Best
Replaced legacy timer_adjust by timer_adjust_oneshot and timer_adjust_periodic. Updated all drivers.
[src/mess]mslegacy.c mslegacy.h
[src/mess/audio]t6721.c
[src/mess/devices]flopdrv.c thomflop.c
[src/mess/drivers]a2600.c a310.c abc80.c abc80x.c atarist.c exidy.c nc.c ql.c tm990189.c tutor.c x68k.c
[src/mess/machine]6551.c 68901mfp.c 99_dsk.c amigacd.c amigafdc.c amigakbd.c apple2gs.c applefdc.c at29040.c bbc.c centroni.c coco.c compis.c corvushd.c electron.c europc.c gamecom.c gb.c hd63450.c i8271.c ibmpc.c kc.c kim1.c lisa.c lynx.c mac.c matsucd.c mc6843.c mm58274c.c mz700.c nec765.c nes_mmc.c osborne1.c pc_hdc.c pc_mouse.c pce.c pcf8593.c pdp1.c pmd85.c pokemini.c rp5c15.c rriot.c serial.c sgi.c sms.c sym1.c thomson.c tms5501.c tms9901.c tms9902.c tx0.c vc1541.c vc20tape.c vectrex.c wd17xx.c z80dart.c zx.c
[src/mess/video]911_vdt.c abc80.c aim65.c atarist.c cdp1861.c cdp1864.c coco3.c gb.c m6847.c smsvdp.c ted7360.c thomson.c vectrex.c x68k.c zx8301.c

src/mess/devices/flopdrv.c
r1681r1682
1616*/
1717
1818#include "driver.h"
19#include "mslegacy.h"
2019#include "flopdrv.h"
2120
2221
r1681r1682
7675   if (pDrive->index)
7776   {
7877      pDrive->index = 0;
79      timer_adjust(pDrive->index_timer, double_to_attotime(ms*19/20/1000.0), 0, attotime_zero);
78      timer_adjust_oneshot(pDrive->index_timer, double_to_attotime(ms*19/20/1000.0), 0);
8079   }
8180   else
8281   {
8382      pDrive->index = 1;
84      timer_adjust(pDrive->index_timer, double_to_attotime(ms/20/1000.0), 0, attotime_zero);
83      timer_adjust_oneshot(pDrive->index_timer, double_to_attotime(ms/20/1000.0), 0);
8584   }
8685
8786   if (pDrive->index_pulse_callback)
r1681r1682
224223         else
225224         {
226225            /* on->off */
227            timer_adjust(pDrive->index_timer, attotime_zero, 0, attotime_zero);
226            timer_adjust_oneshot(pDrive->index_timer, attotime_zero, 0);
228227         }
229228      }
230229   }
src/mess/devices/thomflop.c
r1681r1682
77**********************************************************************/
88
99#include "driver.h"
10#include "mslegacy.h"
1110#include "includes/thomson.h"
1211#include "machine/wd17xx.h"
1312#include "devices/flopdrv.h"
r1681r1682
10421041   thmfc1->stat0 |= THMFC1_STAT0_FINISHED;
10431042   thmfc1->data_idx = 0;
10441043   thmfc1->data_size = 0;
1045   timer_adjust( thmfc_floppy_cmd, attotime_never, 0, attotime_never );
1044   timer_adjust_oneshot(thmfc_floppy_cmd, attotime_never, 0);
10461045}
10471046
10481047
r1681r1682
13421341
13431342      /* abort previous command, if any */
13441343      thmfc1->op = THMFC1_OP_RESET;
1345      timer_adjust( thmfc_floppy_cmd, attotime_never, 0, attotime_never );
1344      timer_adjust_oneshot(thmfc_floppy_cmd, attotime_never, 0);
13461345
13471346      switch ( data & 3 )
13481347      {
r1681r1682
13611360            thmfc1->data_finish = thmfc1->sector_size + 3;
13621361            thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP;
13631362            thmfc1->op = THMFC1_OP_WRITE_SECT;
1364            timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 10 ), 0, attotime_never );
1363            timer_adjust_oneshot(thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 10 ), 0);
13651364         }
13661365         break;
13671366
r1681r1682
13771376            thmfc1->data_idx = 1;
13781377            thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP;
13791378            thmfc1->op = THMFC1_OP_READ_ADDR;
1380            timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 1 ), 0, attotime_never );
1379            timer_adjust_oneshot(thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 1 ), 0);
13811380         }
13821381         break;
13831382
r1681r1682
13931392            thmfc1->data_idx = 1;
13941393            thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP;
13951394            thmfc1->op = THMFC1_OP_READ_SECT;
1396            timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 10 ), 0, attotime_never );
1395            timer_adjust_oneshot(thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 10 ), 0);
13971396         }
13981397         break;
13991398      }
r1681r1682
15501549   thmfc1->data_raw_size = 0;
15511550   thmfc1->data_crc = 0;
15521551   thmfc1->wsync = 0;
1553   timer_adjust( thmfc_floppy_cmd, attotime_never, 0, attotime_never );
1552   timer_adjust_oneshot(thmfc_floppy_cmd, attotime_never, 0);
15541553}
15551554
15561555
src/mess/mslegacy.c
r1681r1682
105105
106106
107107/***************************************************************************
108    TIMER
109***************************************************************************/
110
111void timer_adjust(emu_timer *which, attotime duration, INT32 param, attotime period)
112{
113   if (attotime_compare(period, attotime_zero) == 0)
114      timer_adjust_oneshot(which, duration, param);
115   else
116      timer_adjust_periodic(which, duration, param, period);
117}
118
119
120
121/***************************************************************************
122108    MC6845
123109***************************************************************************/
124110
src/mess/mslegacy.h
r1681r1682
8484const char * ui_getstring (int string_num);
8585
8686
87/* timer */
88void timer_adjust(emu_timer *which, attotime duration, INT32 param, attotime period);
89
90
9187/* mc6845 */
9288struct _mc6845_t;
9389struct _mc6845_interface;
src/mess/audio/t6721.c
r1681r1682
1515
1616#include <ctype.h>
1717#include "driver.h"
18#include "mslegacy.h"
1918#include "cpu/m6502/m6502.h"
2019
2120#define VERBOSE_DBG 1
r1681r1682
118117               speech.playing=FALSE;
119118               break;
120119            case 1: /* start */
121               timer_adjust(speech.timer, attotime_zero, 0, ATTOTIME_IN_HZ(8000));
120               timer_adjust_periodic(speech.timer, attotime_zero, 0, ATTOTIME_IN_HZ(8000));
122121               speech.playing=TRUE;
123122               speech.endOfSample=FALSE;
124123               speech.sampleindex=0;
src/mess/video/911_vdt.c
r1681r1682
1515#include "911_chr.h"
1616#include "911_key.h"
1717#include "sound/beep.h"
18#include "mslegacy.h"
1918#include "deprecat.h"
2019
2120
r1681r1682
443442         /* beep enable strobe - not tested */
444443         beep_set_state(unit, 1);
445444
446         timer_adjust(vdt[unit].beep_timer, ATTOTIME_IN_USEC(300), unit, attotime_zero);
445         timer_adjust_oneshot(vdt[unit].beep_timer, ATTOTIME_IN_USEC(300), unit);
447446         break;
448447
449448      case 0xf:
src/mess/video/gb.c
r1681r1682
1313
1414#include "driver.h"
1515#include "deprecat.h"
16#include "mslegacy.h"
1716#include "includes/gb.h"
1817#include "cpu/z80gb/z80gb.h"
1918#include "profiler.h"
2019
20
2121#define LCDCONT      gb_vid_regs[0x00]   /* LCD control register                       */
2222#define LCDSTAT      gb_vid_regs[0x01]   /* LCD status register                        */
2323#define SCROLLY      gb_vid_regs[0x02]   /* Starting Y position of the background      */
r1681r1682
11911191   switch( mode ) {
11921192   case GB_VIDEO_DMG:
11931193      gb_lcd.lcd_timer = timer_alloc( gb_lcd_timer_proc , NULL);
1194      timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0, attotime_never );
1194      timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0);
11951195
11961196      /* set the scanline update function */
11971197      update_scanline = gb_update_scanline;
r1681r1682
12261226      CURLINE = gb_lcd.current_line = 0;
12271227      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x05;
12281228      gb_lcd.mode = 1;
1229      timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(60,0), GB_LCD_STATE_LY00_M0, attotime_never );
1229      timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(60,0), GB_LCD_STATE_LY00_M0);
12301230
12311231      break;
12321232   case GB_VIDEO_SGB:
r1681r1682
12541254      CURLINE = gb_lcd.current_line = 0;
12551255      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x05;
12561256      gb_lcd.mode = 1;
1257      timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(60,0), GB_LCD_STATE_LY00_M0, attotime_never );
1257      timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(60,0), GB_LCD_STATE_LY00_M0);
12581258
12591259      break;
12601260   case GB_VIDEO_CGB:
r1681r1682
12861286      CURLINE = gb_lcd.current_line = 0x90;
12871287      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x01;
12881288      gb_lcd.mode = 1;
1289      timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(292,0), GB_LCD_STATE_LY9X_M1_INC, attotime_never );
1289      timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(292,0), GB_LCD_STATE_LY9X_M1_INC);
12901290      gb_lcd.oam_locked = UNLOCKED;
12911291      gb_lcd.vram_locked = UNLOCKED;
12921292      gb_lcd.pal_locked = UNLOCKED;
r1681r1682
13451345               gb_lcd.mode_irq = 0;
13461346            }
13471347         }
1348         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0, attotime_never );
1348         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0);
13491349         break;
13501350      case GB_LCD_STATE_LYXX_M0:      /* Switch to mode 0 */
13511351         /* update current scanline */
r1681r1682
13681368         */
13691369         if ( ( SCROLLX & 0x03 ) == 0x03 ) {
13701370            gb_lcd.scrollx_adjust += 4;
1371            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_SCX3, attotime_never );
1371            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_SCX3);
13721372            break;
13731373         }
13741374      case GB_LCD_STATE_LYXX_M0_SCX3:
r1681r1682
13771377              ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) {
13781378            cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
13791379         }
1380         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_M0_PRE_INC, attotime_never );
1380         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_M0_PRE_INC);
13811381         break;
13821382      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
13831383         if ( CURLINE < 143 ) {
r1681r1682
13941394               }
13951395            }
13961396         }
1397         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_INC, attotime_never );
1397         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_INC);
13981398         break;
13991399      case GB_LCD_STATE_LYXX_M0_INC:   /* Increment LY, stay in M0 for 4 more cycles */
14001400         gb_increment_scanline();
r1681r1682
14091409         LCDSTAT &= 0xFB;
14101410         /* Check if we're going into VBlank next */
14111411         if ( CURLINE == 144 ) {
1412            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1, attotime_never );
1412            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1);
14131413         } else {
14141414            /* Internally switch to mode 2 */
14151415            gb_lcd.mode = 2;
r1681r1682
14191419               gb_lcd.mode_irq = 1;
14201420               cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
14211421            }
1422            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M2, attotime_never );
1422            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M2);
14231423         }
14241424         break;
14251425      case GB_LCD_STATE_LY00_M2:      /* Switch to mode 2 on line #0 */
r1681r1682
14341434         /* Check for regular compensation of x-scroll register */
14351435         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
14361436         /* Mode 2 lasts approximately 80 clock cycles */
1437         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, attotime_never );
1437         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3);
14381438         break;
14391439      case GB_LCD_STATE_LYXX_M2:      /* Switch to mode 2 */
14401440         /* Update STAT register to the correct state */
r1681r1682
14541454         /* Check for regular compensation of x-scroll register */
14551455         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
14561456         /* Mode 2 last for approximately 80 clock cycles */
1457         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, attotime_never );
1457         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3);
14581458         break;
14591459      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
14601460         gb_select_sprites();
r1681r1682
14651465         gb_lcd.vram_locked = LOCKED;
14661466         /* Check for compensations of x-scroll register */
14671467         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1468         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0, attotime_never );
1468         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0);
14691469         gb_lcd.start_x = -1;
14701470         break;
14711471      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
r1681r1682
14871487         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) {
14881488            cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
14891489         }
1490         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(452,0), GB_LCD_STATE_LY9X_M1_INC, attotime_never );
1490         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(452,0), GB_LCD_STATE_LY9X_M1_INC);
14911491         break;
14921492      case GB_LCD_STATE_LY9X_M1_INC:      /* Increment scanline counter */
14931493         gb_increment_scanline();
r1681r1682
15011501         /* Reset LY==LYC STAT bit */
15021502         LCDSTAT &= 0xFB;
15031503         if ( gb_lcd.current_line == 153 ) {
1504            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1, attotime_never );
1504            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1);
15051505         } else {
1506            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1, attotime_never );
1506            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1);
15071507         }
15081508         break;
15091509      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
r1681r1682
15211521         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
15221522         gb_lcd.line_irq = 0;
15231523         LCDSTAT &= 0xFB;
1524         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4/*8*/,0), GB_LCD_STATE_LY00_M1_1, attotime_never );
1524         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4/*8*/,0), GB_LCD_STATE_LY00_M1_1);
15251525         break;
15261526      case GB_LCD_STATE_LY00_M1_1:
15271527         if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) {
15281528            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
15291529            cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
15301530         }
1531         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_2, attotime_never );
1531         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_2);
15321532         break;
15331533      case GB_LCD_STATE_LY00_M1_2:   /* Rest of line #0 during VBlank */
15341534         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) {
r1681r1682
15381538         if ( CURLINE == CMPLINE ) {
15391539            LCDSTAT |= 0x04;
15401540         }
1541         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(444,0), GB_LCD_STATE_LY00_M0, attotime_never );
1541         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(444,0), GB_LCD_STATE_LY00_M0);
15421542         break;
15431543      case GB_LCD_STATE_LY00_M0:      /* The STAT register seems to go to 0 for about 4 cycles */
15441544         /* Set Mode 0 lcdstat */
15451545         gb_lcd.mode = 0;
15461546         LCDSTAT = ( LCDSTAT & 0xFC );
1547         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M2, attotime_never );
1547         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M2);
15481548         break;
15491549      }
15501550   } else {
r1681r1682
15521552      if ( gb_lcd.current_line < 144 ) {
15531553         update_scanline();
15541554      }
1555      timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0, attotime_never );
1555      timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0);
15561556   }
15571557}
15581558
r1681r1682
15761576               gb_lcd.mode_irq = 0;
15771577            }
15781578         }
1579         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0, attotime_never );
1579         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0);
15801580         break;
15811581      case GB_LCD_STATE_LYXX_M0:      /* Switch to mode 0 */
15821582         /* update current scanline */
r1681r1682
16001600         gb_lcd.triggering_mode_irq = ( LCDSTAT & 0x08 ) ? 1 : 0;
16011601         if ( ( SCROLLX & 0x03 ) == 0x03 ) {
16021602            gb_lcd.scrollx_adjust += 4;
1603            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_SCX3, attotime_never );
1603            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_SCX3);
16041604            break;
16051605         }
16061606      case GB_LCD_STATE_LYXX_M0_SCX3:
r1681r1682
16131613         if ( ( SCROLLX & 0x03 ) == 0x03 ) {
16141614            gb_lcd.pal_locked = UNLOCKED;
16151615         }
1616         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_GBC_PAL, attotime_never );
1616         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_GBC_PAL);
16171617         break;
16181618      case GB_LCD_STATE_LYXX_M0_GBC_PAL:
16191619         gb_lcd.pal_locked = UNLOCKED;
r1681r1682
16241624         } else {
16251625            gb_lcd.hdma_possible = 1;
16261626         }
1627         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(192 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_M0_PRE_INC, attotime_never );
1627         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(192 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_M0_PRE_INC);
16281628         break;
16291629      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
16301630         gb_lcd.cmp_line = CMPLINE;
r1681r1682
16411641               }
16421642            }
16431643         }
1644         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_INC, attotime_never );
1644         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M0_INC);
16451645         break;
16461646      case GB_LCD_STATE_LYXX_M0_INC:   /* Increment LY, stay in M0 for 4 more cycles */
16471647         gb_increment_scanline();
r1681r1682
16551655         gb_lcd.hdma_possible = 0;
16561656         /* Check if we're going into VBlank next */
16571657         if ( CURLINE == 144 ) {
1658            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1, attotime_never );
1658            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1);
16591659         } else {
16601660            /* Internally switch to mode 2 */
16611661            gb_lcd.mode = 2;
r1681r1682
16651665               gb_lcd.mode_irq = 1;
16661666               cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
16671667            }
1668            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M2, attotime_never );
1668            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M2);
16691669         }
16701670         break;
16711671      case GB_LCD_STATE_LY00_M2:      /* Switch to mode 2 on line #0 */
r1681r1682
16801680         /* Check for regular compensation of x-scroll register */
16811681         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
16821682         /* Mode 2 lasts approximately 80 clock cycles */
1683         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, attotime_never );
1683         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3);
16841684         break;
16851685      case GB_LCD_STATE_LYXX_M2:      /* Switch to mode 2 */
16861686         /* Update STAT register to the correct state */
r1681r1682
17011701         /* Check for regular compensation of x-scroll register */
17021702         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
17031703         /* Mode 2 last for approximately 80 clock cycles */
1704         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, attotime_never );
1704         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3);
17051705         break;
17061706      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
17071707         gb_select_sprites();
r1681r1682
17131713         gb_lcd.pal_locked = LOCKED;
17141714         /* Check for compensations of x-scroll register */
17151715         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1716         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0, attotime_never );
1716         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0);
17171717         gb_lcd.start_x = -1;
17181718         break;
17191719      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
r1681r1682
17371737         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) {
17381738            cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
17391739         }
1740         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(452,0), GB_LCD_STATE_LY9X_M1_INC, attotime_never );
1740         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(452,0), GB_LCD_STATE_LY9X_M1_INC);
17411741         break;
17421742      case GB_LCD_STATE_LY9X_M1_INC:      /* Increment scanline counter */
17431743         gb_increment_scanline();
r1681r1682
17491749            cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
17501750         }
17511751         if ( gb_lcd.current_line == 153 ) {
1752            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1, attotime_never );
1752            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1);
17531753         } else {
1754            timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1, attotime_never );
1754            timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY9X_M1);
17551755         }
17561756         break;
17571757      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
r1681r1682
17711771         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
17721772         gb_lcd.line_irq = 0;
17731773         LCDSTAT &= 0xFB;
1774         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_1, attotime_never );
1774         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_1);
17751775         break;
17761776      case GB_LCD_STATE_LY00_M1_1:
17771777         if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) {
17781778            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
17791779            cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE );
17801780         }
1781         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_2, attotime_never );
1781         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_2);
17821782         break;
17831783      case GB_LCD_STATE_LY00_M1_2:   /* Rest of line #0 during VBlank */
17841784         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) {
r1681r1682
17901790         } else {
17911791            LCDSTAT &= ~0x04;
17921792         }
1793         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(444,0), GB_LCD_STATE_LY00_M0, attotime_never );
1793         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(444,0), GB_LCD_STATE_LY00_M0);
17941794         break;
17951795      case GB_LCD_STATE_LY00_M0:      /* The STAT register seems to go to 0 for about 4 cycles */
17961796         /* Set Mode 0 lcdstat */
17971797         gb_lcd.mode = 0;
1798         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M2, attotime_never );
1798         timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M2);
17991799         break;
18001800      }
18011801   } else {
r1681r1682
18031803      if ( gb_lcd.current_line < 144 ) {
18041804         update_scanline();
18051805      }
1806      timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0, attotime_never );
1806      timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0);
18071807   }
18081808}
18091809
r1681r1682
18241824      }
18251825   }
18261826   gb_lcd.state = GB_LCD_STATE_LY00_M2;
1827   timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, attotime_never );
1827   timer_adjust_oneshot(gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3);
18281828}
18291829
18301830READ8_HANDLER( gb_video_r ) {
src/mess/video/vectrex.c
r1681r1682
11#include <math.h>
22#include "driver.h"
33#include "deprecat.h"
4#include "mslegacy.h"
54#include "includes/vectrex.h"
65#include "video/vector.h"
76#include "machine/6522via.h"
r1681r1682
275274   imager_freq = 1;
276275
277276   imager_timer = timer_alloc(vectrex_imager_right_eye, NULL);
278   timer_adjust(imager_timer, ATTOTIME_IN_HZ(imager_freq), 2, ATTOTIME_IN_HZ(imager_freq));
277   timer_adjust_periodic(imager_timer, ATTOTIME_IN_HZ(imager_freq), 2, ATTOTIME_IN_HZ(imager_freq));
279278
280279   lp_t = timer_alloc(lightpen_trigger_callback, NULL);
281280
r1681r1682
334333                  +(double)(pen_y-y_int)*(pen_y-y_int);
335334               d2=b2-ab*ab/a2;
336335               if (d2<2e10 && analog_sig[ASIG_Z]*blank>0)
337                  timer_adjust(lp_t, double_to_attotime(ab/a2/(VECTREX_CLOCK*INT_PER_CLOCK)),0,attotime_zero);
336                  timer_adjust_oneshot(lp_t, double_to_attotime(ab/a2/(VECTREX_CLOCK*INT_PER_CLOCK)), 0);
338337            }
339338         }
340339      }
r1681r1682
357356         vectrex_solid_line(attotime_to_double(timer_get_time())-start_time+RAMP_DELAY, blank);
358357         /* Cancel running timer, line already finished */
359358         if (lightpen_down)
360            timer_adjust(lp_t,attotime_never,0,attotime_zero);
359            timer_adjust_oneshot(lp_t, attotime_never, 0);
361360      }
362361   }
363362
src/mess/video/aim65.c
r1681r1682
66******************************************************************************/
77
88#include "driver.h"
9#include "mslegacy.h"
109
1110#include "includes/aim65.h"
1211#include "machine/6522via.h"
1312
13
1414static int printer_x;
1515static int printer_y;
1616static int printer_dir;
r1681r1682
9696   if (!data)
9797   {
9898      aim65_printer_cr();
99      timer_adjust(print_timer, attotime_zero, 0, ATTOTIME_IN_USEC(10));
99      timer_adjust_periodic(print_timer, attotime_zero, 0, ATTOTIME_IN_USEC(10));
100100      via_0_cb1_w(0, 0);
101101      printer_level = 1;
102102   }
src/mess/video/m6847.c
r1681r1682
6666#include "driver.h"
6767#include "m6847.h"
6868#include "deprecat.h"
69#include "mslegacy.h"
7069
7170#ifdef ENABLE_DEBUGGER
7271#include "debug/debugcpu.h"
7372#include "debug/debugcon.h"
7473#endif
7574
75
7676#define LOG_FS         0
7777#define LOG_HS         0
7878#define LOG_STATS      0
r1681r1682
16331633   if (LOG_HS)
16341634      logerror("hs_rise(): time=%s\n", attotime_string(timer_get_time(), ATTOTIME_STRING_PRECISION));
16351635
1636   timer_adjust(m6847->hs_rise_timer,
1637      attotime_make(0, m6847->scanline_period),
1638      0, attotime_never);
1639   timer_adjust(m6847->hs_fall_timer,
1640      attotime_make(0, m6847->horizontal_sync_period),
1641      0, attotime_never);
1636   timer_adjust_oneshot(m6847->hs_rise_timer,
1637      attotime_make(0, m6847->scanline_period), 0);
1638   timer_adjust_oneshot(m6847->hs_fall_timer,
1639      attotime_make(0, m6847->horizontal_sync_period), 0);
16421640
16431641   set_horizontal_sync();
16441642   prepare_scanline(0);
r1681r1682
16581656      logerror("fs_rise(): time=%s scanline=%d\n", attotime_string(timer_get_time(), ATTOTIME_STRING_PRECISION), get_scanline());
16591657
16601658   /* adjust field sync falling edge timer */
1661   timer_adjust(m6847->fs_fall_timer,
1662      attotime_make(0, m6847->field_sync_period),
1663      0, attotime_never);
1659   timer_adjust_oneshot(m6847->fs_fall_timer,
1660      attotime_make(0, m6847->field_sync_period), 0);
16641661
16651662   /* adjust horizontal sync rising timer */
1666   timer_adjust(m6847->hs_rise_timer, attotime_zero, 0, attotime_never);
1663   timer_adjust_oneshot(m6847->hs_rise_timer, attotime_zero, 0);
16671664
16681665   /* this is a hook for the CoCo 3 code to extend this stuff */
16691666   if (m6847->new_frame_callback)
r1681r1682
18921889   /* setup timing */
18931890   frame_period = period *
18941891      (UINT32) (v->clocks_per_scanline * total_scanlines * GROSS_FACTOR);
1895   timer_adjust(m6847->fs_rise_timer, attotime_zero, 0, attotime_make(0, frame_period));
1892   timer_adjust_periodic(m6847->fs_rise_timer, attotime_zero, 0, attotime_make(0, frame_period));
18961893
18971894   /* setup save states */
18981895   state_save_register_func_postload(set_field_sync);
src/mess/video/thomson.c
r1681r1682
99#include <math.h>
1010#include "driver.h"
1111#include "deprecat.h"
12#include "mslegacy.h"
1312#include "includes/thomson.h"
1413#include "cpu/m6809/m6809.h"
1514#include "machine/6821pia.h"
r1681r1682
220219      thom_lightpen_cb( step );
221220
222221   if ( step < thom_lightpen_nb )
223      timer_adjust( thom_lightpen_timer, ATTOTIME_IN_USEC( 64 ), step + 1, attotime_zero );
222      timer_adjust_oneshot(thom_lightpen_timer, ATTOTIME_IN_USEC( 64 ), step + 1);
224223}
225224
226225
r1681r1682
820819
821820   /* prepare for next scanline */
822821   if ( y == 199 )
823      timer_adjust( thom_scanline_timer, attotime_never, 0, attotime_zero);
822      timer_adjust_oneshot(thom_scanline_timer, attotime_never, 0);
824823   else
825824   {
826825
r1681r1682
845844         thom_pal_changed = 0;
846845      }
847846
848      timer_adjust( thom_scanline_timer, ATTOTIME_IN_USEC(64), y + 1, attotime_zero);
847      timer_adjust_oneshot(thom_scanline_timer, ATTOTIME_IN_USEC(64), y + 1);
849848   }
850849}
851850
r1681r1682
10281027   if ( thom_init_cb )
10291028      thom_init_cb( init );
10301029   if ( ! init )
1031      timer_adjust( thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init, attotime_zero );
1030      timer_adjust_oneshot(thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init);
10321031}
10331032
10341033/* call this at the very begining of each new frame */
r1681r1682
10661065   thom_vstate_dirty = 0;
10671066
10681067   /* schedule first init signal */
1069   timer_adjust( thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7 ), 0, attotime_zero );
1068   timer_adjust_oneshot(thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7 ), 0);
10701069
10711070   /* schedule first lightpen signal */
10721071   l.line &= ~1; /* hack (avoid lock in MO6 palette selection) */
1073   timer_adjust( thom_lightpen_timer,
1074            ATTOTIME_IN_USEC( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ),
1075            0, attotime_zero );
1072   timer_adjust_oneshot(thom_lightpen_timer,
1073            ATTOTIME_IN_USEC( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ), 0);
10761074
10771075   /* schedule first active-area scanline call-back */
1078   timer_adjust( thom_scanline_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7),
1079            -1, attotime_zero );
1076   timer_adjust_oneshot(thom_scanline_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7), -1);
10801077
10811078   /* reset video frame time */
1082   timer_adjust( thom_video_timer, attotime_zero, 0, attotime_never );
1079   timer_adjust_oneshot(thom_video_timer, attotime_zero, 0);
10831080
10841081   /* update screen size according to user options */
10851082   if ( thom_update_screen_size() )
src/mess/video/abc80.c
r1681r1682
55 ****************************************************************************/
66
77#include "driver.h"
8#include "mslegacy.h"
98#include "includes/abc80.h"
109
1110
r1681r1682
7170VIDEO_START( abc80 )
7271{
7372   abc80_blink_timer = timer_alloc(abc80_blink_tick, NULL);
74   timer_adjust(abc80_blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC80_XTAL/2/6/64/312/16));
73   timer_adjust_periodic(abc80_blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC80_XTAL/2/6/64/312/16));
7574
7675   tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan,
7776      6, 10, 40, 24);
src/mess/video/x68k.c
r1681r1682
2626*/
2727
2828#include "driver.h"
29#include "mslegacy.h"
3029#include "includes/x68k.h"
3130#include "machine/68901mfp.h"
3231
32
3333extern struct x68k_system sys;
3434
3535extern emu_timer* scanline_timer;
r1681r1682
232232   if(sys.crtc.reg[4] != 0)
233233   {
234234//      scantime = ATTOTIME_IN_HZ(55.45) / sys.crtc.reg[4];
235//      timer_adjust(scanline_timer,attotime_zero,0,scantime);
235//      timer_adjust_periodic(scanline_timer, attotime_zero, 0, scantime);
236236   }*/
237237}
238238
r1681r1682
248248      if(scan > sys.crtc.vend)
249249         scan = 0;
250250      hsync_time = video_screen_get_time_until_pos(0,scan+1,sys.crtc.hsync_end);
251      timer_adjust(scanline_timer,hsync_time,0,attotime_never);
251      timer_adjust_oneshot(scanline_timer, hsync_time, 0);
252252   }
253253   if(state == 0)
254254   {
255255      hsync_time = video_screen_get_time_until_pos(0,video_screen_get_vpos(0),sys.crtc.hend);
256      timer_adjust(scanline_timer,hsync_time,1,attotime_never);
256      timer_adjust_oneshot(scanline_timer, hsync_time, 1);
257257//      if(!(sys.mfp.gpio & 0x40))  // if GPIP6 is active, clear it
258258//         sys.mfp.gpio |= 0x40;
259259   }
r1681r1682
272272
273273   if(scan > sys.crtc.vtotal)
274274   {
275      timer_adjust(raster_irq,attotime_zero,0,attotime_never);  // disable timer
275      timer_adjust_oneshot(raster_irq, attotime_zero, 0);  // disable timer
276276      return;
277277   }
278278   sys.mfp.gpio &= ~0x40;  // GPIP6
r1681r1682
284284   irq_time = video_screen_get_time_until_pos(0,scan,2);
285285   // end of HBlank period clears GPIP6 also?
286286   end_time = video_screen_get_time_until_pos(0,scan,sys.crtc.hbegin);
287   timer_adjust(raster_irq,irq_time,scan,attotime_never);
287   timer_adjust_oneshot(raster_irq, irq_time, scan);
288288   timer_set(end_time,NULL,0,x68k_crtc_raster_end);
289289   logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,video_screen_get_vpos(0));
290290}
r1681r1682
302302      if(vblank_line > sys.crtc.vtotal)
303303         vblank_line = sys.crtc.vtotal;
304304      irq_time = video_screen_get_time_until_pos(0,vblank_line,2);
305      timer_adjust(vblank_irq,irq_time,0,attotime_never);
305      timer_adjust_oneshot(vblank_irq, irq_time, 0);
306306      logerror("CRTC: VBlank on\n");
307307   }
308308   if(val == 0)  // VBlank off
r1681r1682
310310      sys.crtc.vblank = 0;
311311      vblank_line = sys.crtc.vbegin;
312312      irq_time = video_screen_get_time_until_pos(0,vblank_line,2);
313      timer_adjust(vblank_irq,irq_time,1,attotime_never);
313      timer_adjust_oneshot(vblank_irq, irq_time, 1);
314314      logerror("CRTC: VBlank off\n");
315315   }
316316}
r1681r1682
388388            irq_time = video_screen_get_time_until_pos(0,(data - 1) / sys.crtc.vmultiple,2);
389389
390390            if(attotime_to_double(irq_time) > 0)
391               timer_adjust(raster_irq,irq_time,(data - 1) / sys.crtc.vmultiple,attotime_never);
391               timer_adjust_oneshot(raster_irq, irq_time, (data - 1) / sys.crtc.vmultiple);
392392            logerror("CRTC: Time until next raster IRQ = %f\n",attotime_to_double(irq_time));
393393         }
394394      }
395395      else
396396      {
397         timer_adjust(raster_irq,attotime_zero,0,attotime_never);  // disable timer
397         timer_adjust_oneshot(raster_irq, attotime_zero, 0);  // disable timer
398398      }
399399      logerror("CRTC: Write to raster IRQ register - %i\n",data);
400400      break;
r1681r1682
977977   tilemap_set_transparent_pen(x68k_bg0_16,0);
978978   tilemap_set_transparent_pen(x68k_bg1_16,0);
979979
980//   timer_adjust(scanline_timer,attotime_zero,0,ATTOTIME_IN_HZ(55.45)/568);
980//   timer_adjust_periodic(scanline_timer, attotime_zero, 0, ATTOTIME_IN_HZ(55.45)/568);
981981}
982982
983983VIDEO_UPDATE( x68000 )
src/mess/video/atarist.c
r1681r1682
1515#include "cpu/m68000/m68000.h"
1616#include "machine/68901mfp.h"
1717#include "video/atarist.h"
18#include "mslegacy.h"
1918
19
2020static struct SHIFTER
2121{
2222   UINT32 base;
r1681r1682
721721   atarist_shifter_timer = timer_alloc(atarist_shifter_tick, NULL);
722722   atarist_glue_timer = timer_alloc(atarist_glue_tick, NULL);
723723
724   timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns
725   timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns
724   timer_adjust_periodic(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns
725   timer_adjust_periodic(atarist_glue_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns
726726
727727   memset(&shifter, 0, sizeof(shifter));
728728
src/mess/video/zx8301.c
r1681r1682
66
77#include "driver.h"
88#include "deprecat.h"
9#include "mslegacy.h"
109#include "zx8301.h"
1110
1211
r1681r1682
121120VIDEO_START( zx8301 )
122121{
123122   zx8301_flash_timer = timer_alloc(zx8301_flash_tick, NULL);
124   timer_adjust(zx8301_flash_timer, ATTOTIME_IN_HZ(2), 0, ATTOTIME_IN_HZ(2));
123   timer_adjust_periodic(zx8301_flash_timer, ATTOTIME_IN_HZ(2), 0, ATTOTIME_IN_HZ(2));
125124
126125   state_save_register_global(zx8301.dispoff);
127126   state_save_register_global(zx8301.mode8);
src/mess/video/coco3.c
r1681r1682
3232#include "machine/6883sam.h"
3333#include "video/m6847.h"
3434#include "includes/coco.h"
35#include "mslegacy.h"
3635
3736
3837#if defined(__GNUC__) && (__GNUC__ >= 3)
r1681r1682
511510   }
512511
513512   /* set up GIME field sync */
514   timer_adjust(video->gime_fs_timer,
515      m6847_scanline_time(gime_field_sync),
516      0,
517      attotime_never);
513   timer_adjust_oneshot(video->gime_fs_timer,
514      m6847_scanline_time(gime_field_sync), 0);
518515
519516   return video->legacy_video;
520517}
src/mess/video/smsvdp.c
r1681r1682
3838
3939#include "driver.h"
4040#include "deprecat.h"
41#include "mslegacy.h"
4241#include "video/smsvdp.h"
4342#include "includes/sms.h"
4443
44
4545#define IS_SMS1_VDP         ( smsvdp.features & MODEL_315_5124 )
4646#define IS_SMS2_VDP         ( smsvdp.features & MODEL_315_5246 )
4747#define IS_GAMEGEAR_VDP      ( smsvdp.features & MODEL_315_5378 )
r1681r1682
211211   set_display_settings();
212212
213213   smsvdp.smsvdp_display_timer = timer_alloc( smsvdp_display_callback , NULL);
214   timer_adjust( smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 ) );
214   timer_adjust_periodic(smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 ));
215215   return 0;
216216}
217217
src/mess/video/cdp1864.c
r1681r1682
33#include "cpu/cdp1802/cdp1802.h"
44#include "sound/beep.h"
55#include "video/cdp1864.h"
6#include "mslegacy.h"
76
7
88static mame_bitmap *cdptmpbitmap;
99
1010static emu_timer *cdp1864_int_timer;
r1681r1682
4040         cdp1864.dmaptr = 0;
4141      }
4242
43      timer_adjust(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_END, 0), 0, attotime_zero);
43      timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_END, 0), 0);
4444   }
4545   else
4646   {
r1681r1682
4949         cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, CLEAR_LINE);
5050      }
5151
52      timer_adjust(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0, attotime_zero);
52      timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0);
5353   }
5454}
5555
r1681r1682
6161   {
6262   case CDP1864_SCANLINE_EFX_TOP_START:
6363      cdp1864_efx = ASSERT_LINE;
64      timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_END, 0), 0, attotime_zero);
64      timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_END, 0), 0);
6565      break;
6666
6767   case CDP1864_SCANLINE_EFX_TOP_END:
6868      cdp1864_efx = CLEAR_LINE;
69      timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_BOTTOM_START, 0), 0, attotime_zero);
69      timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_BOTTOM_START, 0), 0);
7070      break;
7171
7272   case CDP1864_SCANLINE_EFX_BOTTOM_START:
7373      cdp1864_efx = ASSERT_LINE;
74      timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_BOTTOM_END, 0), 0, attotime_zero);
74      timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_BOTTOM_END, 0), 0);
7575      break;
7676
7777   case CDP1864_SCANLINE_EFX_BOTTOM_END:
7878      cdp1864_efx = CLEAR_LINE;
79      timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0, attotime_zero);
79      timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0);
8080      break;
8181   }
8282}
r1681r1682
9595         }
9696      }
9797
98      timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_WAIT, 0), 0, attotime_zero);
98      timer_adjust_oneshot(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_WAIT, 0), 0);
9999
100100      cdp1864.dmaout = 0;
101101   }
r1681r1682
109109         }
110110      }
111111
112      timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_ACTIVE, 0), 0, attotime_zero);
112      timer_adjust_oneshot(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_ACTIVE, 0), 0);
113113
114114      cdp1864.dmaout = 1;
115115   }
r1681r1682
180180
181181MACHINE_RESET( cdp1864 )
182182{
183   timer_adjust(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0, attotime_zero);
184   timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0, attotime_zero);
185   timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_START, 0), 0, attotime_zero);
183   timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0);
184   timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0);
185   timer_adjust_oneshot(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_START, 0), 0);
186186
187187   cdp1864.disp = 0;
188188   cdp1864.dmaout = 0;
src/mess/video/ted7360.c
r1681r1682
356356#include <stdio.h>
357357#include "driver.h"
358358#include "deprecat.h"
359#include "mslegacy.h"
360359#include "utils.h"
361360#include "sound/custom.h"
362361
r1681r1682
590589   {
591590   case 1:
592591       // prooved by digisound of several intros like eoroidpro
593      timer_adjust(timer1, TEDTIME_IN_CYCLES (TIMER1), 1, attotime_zero);
592      timer_adjust_oneshot(timer1, TEDTIME_IN_CYCLES (TIMER1), 1);
594593      timer1_active = 1;
595594      ted7360_set_interrupt (8);
596595      break;
597596   case 2:
598      timer_adjust(timer2, TEDTIME_IN_CYCLES (0x10000), 2, attotime_zero);
597      timer_adjust_oneshot(timer2, TEDTIME_IN_CYCLES (0x10000), 2);
599598      timer2_active = 1;
600599      ted7360_set_interrupt (0x10);
601600      break;
602601   case 3:
603      timer_adjust(timer3, TEDTIME_IN_CYCLES (0x10000), 3, attotime_zero);
602      timer_adjust_oneshot(timer3, TEDTIME_IN_CYCLES (0x10000), 3);
604603      timer3_active = 1;
605604      ted7360_set_interrupt (0x40);
606605      break;
r1681r1682
653652      break;
654653   case 1:                     /* start timer 1 */
655654      ted7360[offset] = data;
656      timer_adjust(timer1, TEDTIME_IN_CYCLES (TIMER1), 1, attotime_zero);
655      timer_adjust_oneshot(timer1, TEDTIME_IN_CYCLES (TIMER1), 1);
657656      timer1_active = 1;
658657      break;
659658   case 2:                     /* stop timer 2 */
r1681r1682
667666      break;
668667   case 3:                     /* start timer 2 */
669668      ted7360[offset] = data;
670      timer_adjust(timer2, TEDTIME_IN_CYCLES (TIMER2), 2, attotime_zero);
669      timer_adjust_oneshot(timer2, TEDTIME_IN_CYCLES (TIMER2), 2);
671670      timer2_active = 1;
672671      break;
673672   case 4:                     /* stop timer 3 */
r1681r1682
681680      break;
682681   case 5:                     /* start timer 3 */
683682      ted7360[offset] = data;
684      timer_adjust(timer3, TEDTIME_IN_CYCLES (TIMER3), 3, attotime_zero);
683      timer_adjust_oneshot(timer3, TEDTIME_IN_CYCLES (TIMER3), 3);
685684      timer3_active = 1;
686685      break;
687686   case 6:
src/mess/video/cdp1861.c
r1681r1682
11#include "driver.h"
22#include "deprecat.h"
3#include "mslegacy.h"
43#include "cpu/cdp1802/cdp1802.h"
54#include "video/cdp1861.h"
65
r1681r1682
3130         cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, HOLD_LINE);
3231      }
3332
34      timer_adjust(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_END, 0), 0, attotime_zero);
33      timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_END, 0), 0);
3534   }
3635   else
3736   {
r1681r1682
4039         cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, CLEAR_LINE);
4140      }
4241
43      timer_adjust(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0, attotime_zero);
42      timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0);
4443   }
4544}
4645
r1681r1682
5251   {
5352   case CDP1861_SCANLINE_EFX_TOP_START:
5453      cdp1861_efx = ASSERT_LINE;
55      timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_END, 0), 0, attotime_zero);
54      timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_END, 0), 0);
5655      break;
5756
5857   case CDP1861_SCANLINE_EFX_TOP_END:
5958      cdp1861_efx = CLEAR_LINE;
60      timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_BOTTOM_START, 0), 0, attotime_zero);
59      timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_BOTTOM_START, 0), 0);
6160      break;
6261
6362   case CDP1861_SCANLINE_EFX_BOTTOM_START:
6463      cdp1861_efx = ASSERT_LINE;
65      timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_BOTTOM_END, 0), 0, attotime_zero);
64      timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_BOTTOM_END, 0), 0);
6665      break;
6766
6867   case CDP1861_SCANLINE_EFX_BOTTOM_END:
6968      cdp1861_efx = CLEAR_LINE;
70      timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0, attotime_zero);
69      timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0);
7170      break;
7271   }
7372}
r1681r1682
8685         }
8786      }
8887
89      timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_WAIT, 0), 0, attotime_zero);
88      timer_adjust_oneshot(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_WAIT, 0), 0);
9089
9190      cdp1861.dmaout = 0;
9291   }
r1681r1682
10099         }
101100      }
102101
103      timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_ACTIVE, 0), 0, attotime_zero);
102      timer_adjust_oneshot(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_ACTIVE, 0), 0);
104103
105104      cdp1861.dmaout = 1;
106105   }
r1681r1682
122121
123122MACHINE_RESET( cdp1861 )
124123{
125   timer_adjust(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0, attotime_zero);
126   timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0, attotime_zero);
127   timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_START, 0), 0, attotime_zero);
124   timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0);
125   timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0);
126   timer_adjust_oneshot(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_START, 0), 0);
128127
129128   cdp1861.disp = 0;
130129   cdp1861.dmaout = 0;
src/mess/machine/zx.c
r1681r1682
1111#include "cpu/z80/z80.h"
1212#include "includes/zx.h"
1313#include "devices/cassette.h"
14#include "mslegacy.h"
1514
15
1616#define   DEBUG_ZX81_PORTS   1
1717#define DEBUG_ZX81_VSYNC   1
1818
r1681r1682
7979   }
8080   else if ((offset & 1) == 0)
8181   {
82      timer_adjust(ula_nmi, attotime_zero, 0, ATTOTIME_IN_CYCLES(207, 0));
82      timer_adjust_periodic(ula_nmi, attotime_zero, 0, ATTOTIME_IN_CYCLES(207, 0));
8383
8484      LOG_ZX81_IOW("ULA NMIs on");
8585
src/mess/machine/pdp1.c
r1681r1682
1313
1414#include "driver.h"
1515#include "deprecat.h"
16#include "mslegacy.h"
1716
1817#include "cpu/pdp1/pdp1.h"
1918#include "includes/pdp1.h"
r1681r1682
407406         if (tape_reader.motor_on && tape_reader.rcl)
408407         {
409408            /* delay is approximately 1/400s */
410            timer_adjust(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0, attotime_zero);
409            timer_adjust_oneshot(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0);
411410         }
412411         else
413412         {
r1681r1682
489488   if (tape_reader.motor_on && tape_reader.rcl)
490489   {
491490      /* delay is approximately 1/400s */
492      timer_adjust(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0, attotime_zero);
491      timer_adjust_oneshot(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0);
493492   }
494493   else
495494   {
r1681r1682
542541
543542   if (tape_reader.motor_on && tape_reader.rcl)
544543      /* delay is approximately 1/400s */
545      timer_adjust(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0, attotime_zero);
544      timer_adjust_oneshot(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0);
546545   else
547546      timer_enable(tape_reader.timer, 0);
548547}
r1681r1682
680679         logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC));
681680   }
682681
683   timer_adjust(tape_puncher.timer, ATTOTIME_IN_USEC(15800), nac, attotime_zero);
682   timer_adjust_oneshot(tape_puncher.timer, ATTOTIME_IN_USEC(15800), nac);
684683}
685684
686685/*
r1681r1682
707706      if (timer_enable(tape_puncher.timer, 0))
708707         logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC));
709708   }
710   timer_adjust(tape_puncher.timer, ATTOTIME_IN_USEC(15800), nac, attotime_zero);
709   timer_adjust_oneshot(tape_puncher.timer, ATTOTIME_IN_USEC(15800), nac);
711710}
712711
713712
r1681r1682
896895         logerror("Error: overlapped TYO instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC));
897896   }
898897
899   timer_adjust(typewriter.tyo_timer, ATTOTIME_IN_MSEC(delay), nac, attotime_zero);
898   timer_adjust_oneshot(typewriter.tyo_timer, ATTOTIME_IN_MSEC(delay), nac);
900899}
901900
902901/*
r1681r1682
10081007         if (timer_enable(dpy_timer, 0))
10091008            logerror("Error: overlapped DPY instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC));
10101009      }
1011      timer_adjust(dpy_timer, ATTOTIME_IN_USEC(50), 0, attotime_zero);
1010      timer_adjust_oneshot(dpy_timer, ATTOTIME_IN_USEC(50), 0);
10121011   }
10131012}
10141013
r1681r1682
10271026   il_phase = attotime_sub(attotime_mul(PARALLEL_DRUM_WORD_TIME, il), timer_timeelapsed(parallel_drum.rotation_timer));
10281027   if (attotime_compare(il_phase, attotime_zero) < 0)
10291028      il_phase = attotime_add(il_phase, PARALLEL_DRUM_ROTATION_TIME);
1030   timer_adjust(parallel_drum.il_timer, il_phase, 0, PARALLEL_DRUM_ROTATION_TIME);
1029   timer_adjust_periodic(parallel_drum.il_timer, il_phase, 0, PARALLEL_DRUM_ROTATION_TIME);
10311030}
10321031
10331032#ifdef UNUSED_FUNCTION
r1681r1682
10431042static void parallel_drum_init(void)
10441043{
10451044   parallel_drum.rotation_timer = timer_alloc(NULL, NULL);
1046   timer_adjust(parallel_drum.rotation_timer, PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
1045   timer_adjust_periodic(parallel_drum.rotation_timer, PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
10471046
10481047   parallel_drum.il_timer = timer_alloc(il_timer_callback, NULL);
10491048   parallel_drum_set_il(0);
src/mess/machine/nec765.c
r1681r1682
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "mslegacy.h"
2524#include "machine/nec765.h"
2625
26
2727typedef enum
2828{
2929   NEC765_COMMAND_PHASE_FIRST_BYTE,
r1681r1682
402402
403403   if (!(fdc.nec765_flags & NEC765_DMA_MODE))
404404   {
405      timer_adjust(fdc.timer, duration, 0, attotime_zero);
405      timer_adjust_oneshot(fdc.timer, duration, 0);
406406   }
407407   else
408408   {
r1681r1682
429429static void nec765_setup_timed_int(int signed_tracks)
430430{
431431   /* setup timer to signal after seek time is complete */
432   timer_adjust(fdc.seek_timer, attotime_zero, 0, double_to_attotime(fdc.srt_in_ms*abs(signed_tracks)*0.001));
432   timer_adjust_periodic(fdc.seek_timer, attotime_zero, 0, double_to_attotime(fdc.srt_in_ms*abs(signed_tracks)*0.001));
433433}
434434
435435static void nec765_seek_setup(int is_recalibrate)
r1681r1682
732732         }
733733
734734#ifdef NO_END_OF_CYLINDER
735         timer_adjust(fdc.command_timer, attotime_zero, 0, attotime_zero);
735         timer_adjust_oneshot(fdc.command_timer, attotime_zero, 0);
736736#else
737737         nec765_update_state();
738738#endif
r1681r1682
16051605
16061606      if ((fdc.nec765_transfer_bytes_remaining==0) || (fdc.nec765_flags & NEC765_TC))
16071607      {
1608         timer_adjust(fdc.command_timer, attotime_zero, 0, attotime_zero);
1608         timer_adjust_oneshot(fdc.command_timer, attotime_zero, 0);
16091609      }
16101610      else
16111611      {
r1681r1682
16731673
16741674      if ((fdc.nec765_transfer_bytes_remaining == 0) || (fdc.nec765_flags & NEC765_TC))
16751675      {
1676         timer_adjust(fdc.command_timer, attotime_zero, 0, attotime_zero);
1676         timer_adjust_oneshot(fdc.command_timer, attotime_zero, 0);
16771677      }
16781678      else
16791679      {
src/mess/machine/apple2gs.c
r1681r1682
107107#include <assert.h>
108108#include "driver.h"
109109#include "deprecat.h"
110#include "mslegacy.h"
111110
112111#include "includes/apple2gs.h"
113112#include "includes/apple2.h"
r1681r1682
837836         apple2_interrupt(machine, 0);
838837   }
839838
840   timer_adjust(apple2gs_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1)%262, 0), 0, attotime_never);
839   timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1)%262, 0), 0);
841840
842841   cpuintrf_pop_context();
843842}
r1681r1682
17251724MACHINE_RESET( apple2gs )
17261725{
17271726   apple2gs_clock_timer = timer_alloc(apple2gs_clock_tick, NULL);
1728   timer_adjust(apple2gs_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
1727   timer_adjust_periodic(apple2gs_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
17291728   
17301729   apple2gs_qsecond_timer = timer_alloc(apple2gs_qsecond_tick, NULL);
1731   timer_adjust(apple2gs_qsecond_timer, ATTOTIME_IN_USEC(266700), 0, ATTOTIME_IN_USEC(266700));
1730   timer_adjust_periodic(apple2gs_qsecond_timer, ATTOTIME_IN_USEC(266700), 0, ATTOTIME_IN_USEC(266700));
17321731   
17331732   apple2gs_scanline_timer = timer_alloc(apple2gs_scanline_tick, NULL);
1734   timer_adjust(apple2gs_scanline_timer, attotime_never, 0, attotime_never);
1733   timer_adjust_oneshot(apple2gs_scanline_timer, attotime_never, 0);
17351734
17361735   // fire on scanline zero
1737   timer_adjust(apple2gs_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never);
1736   timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0);
17381737}
17391738
17401739MACHINE_START( apple2gs )
src/mess/machine/applefdc.c
r1681r1682
3737
3838#include "applefdc.h"
3939#include "deprecat.h"
40#include "mslegacy.h"
4140
41
4242/* logging */
4343#define LOG_IWM         0
4444#define LOG_IWM_EXTRA   0
r1681r1682
310310   {
311311      case 0x08:
312312         /* Turn off motor */
313         timer_adjust(motor_timer,
314            (iwm_mode & IWM_MODE_MOTOROFFDELAY) ? attotime_zero : ATTOTIME_IN_SEC(1),
315            0,
316            attotime_zero);
313         timer_adjust_oneshot(motor_timer,
314            (iwm_mode & IWM_MODE_MOTOROFFDELAY) ? attotime_zero : ATTOTIME_IN_SEC(1), 0);
317315         break;
318316
319317      case 0x09:
320318         /* Turn on motor */
321         timer_adjust(motor_timer, attotime_zero, 1, attotime_zero);
319         timer_adjust_oneshot(motor_timer, attotime_zero, 1);
322320         break;
323321
324322      case 0x0A:
src/mess/machine/mac.c
r1681r1682
3939
4040#include "driver.h"
4141#include "deprecat.h"
42#include "mslegacy.h"
4342#include "machine/6522via.h"
4443#include "machine/8530scc.h"
4544#include "cpu/m68000/m68000.h"
r1681r1682
4847#include "machine/ncr5380.h"
4948#include "includes/mac.h"
5049
50
5151#ifdef MAME_DEBUG
5252#define LOG_VIA         0
5353#define LOG_RTC         0
r1681r1682
491491      if (keyboard_reply == 0x7B)
492492      {
493493         /* if NULL, wait until key pressed or timeout */
494         timer_adjust(inquiry_timeout,
495            attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.25)),
496            0, attotime_zero);
494         timer_adjust_oneshot(inquiry_timeout,
495            attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.25)), 0);
497496      }
498497      break;
499498
r1681r1682
13301329      timer_set(attotime_zero, NULL, 0, set_memory_overlay_callback);
13311330
13321331   mac_scanline_timer = timer_alloc(mac_scanline_tick, NULL);
1333   timer_adjust(mac_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never);
1332   timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0);
13341333}
13351334
13361335
r1681r1682
14741473   if (!(scanline % 10))
14751474      mouse_callback();
14761475
1477   timer_adjust(mac_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1) % MAC_V_TOTAL, 0), 0, attotime_never);
1476   timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1) % MAC_V_TOTAL, 0), 0);
14781477
14791478   cpuintrf_pop_context();
14801479}
src/mess/machine/pcf8593.c
r1681r1682
88
99#include "pcf8593.h"
1010#include "deprecat.h"
11#include "mslegacy.h"
1211
1312#include <time.h>
1413
r1681r1682
5958   rtc.size = 16;
6059   rtc.data = malloc_or_die( rtc.size);
6160   rtc.timer = timer_alloc( pcf8593_timer_callback , NULL);
62   timer_adjust( rtc.timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
61   timer_adjust_periodic(rtc.timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
6362   pcf8593_reset();
6463}
6564
src/mess/machine/i8271.c
r1681r1682
1515#include "driver.h"
1616#include "i8271.h"
1717#include "devices/flopdrv.h"
18#include "mslegacy.h"
1918
2019
2120I8271_STATE_t I8271_STATE;
r1681r1682
150149
151150   /* set timers */
152151   timer_reset(i8271.command_complete_timer, attotime_never);
153   timer_adjust(i8271.data_timer, ATTOTIME_IN_USEC(usecs), 0, attotime_zero);
152   timer_adjust_oneshot(i8271.data_timer, ATTOTIME_IN_USEC(usecs), 0);
154153}
155154
156155
r1681r1682
174173
175174   /* set timers */
176175   timer_reset(i8271.data_timer, attotime_never);
177   timer_adjust(i8271.command_complete_timer, ATTOTIME_IN_USEC(usecs), 0, attotime_zero);
176   timer_adjust_oneshot(i8271.command_complete_timer, ATTOTIME_IN_USEC(usecs), 0);
178177}
179178
180179void i8271_reset()
src/mess/machine/pokemini.c
r1681r1682
11#include "driver.h"
2#include "mslegacy.h"
32#include "includes/pokemini.h"
43#include "cpu/minx/minx.h"
54
5
66struct VDP {
77   UINT8   colors_inverted;
88   UINT8   background_enabled;
r1681r1682
126126         */
127127      if ( data & 0x01 ) {   /* enable timer */
128128         if ( ! timers.seconds_running ) {
129            timer_adjust( timers.seconds_timer, ATTOTIME_IN_SEC(1), 0, attotime_zero );
129            timer_adjust_oneshot(timers.seconds_timer, ATTOTIME_IN_SEC(1), 0);
130130            timers.seconds_running = 1;
131131         }
132132      } else {      /* pause timer */
r1681r1682
172172            Bit 4-7 R/W Unused
173173         */
174174      if ( ( data & 0x07 ) != ( pokemini_hwreg[0x18] & 0x07 ) ) {
175         timer_adjust( timers.timer1_timer, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ), 0, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ) );
175         timer_adjust_periodic(timers.timer1_timer, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ), 0, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ));
176176      }
177177      if ( ( data & 0x08 ) && timers.timers_enabled ) {
178178         timer_enable( timers.timer1_timer, 1 );
r1681r1682
217217            Bit 4-7     Unused
218218         */
219219      if ( ( data & 0x07 ) != ( pokemini_hwreg[0x1A] & 0x07 ) ) {
220         timer_adjust( timers.timer2_timer, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ), 0, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ) );
220         timer_adjust_periodic(timers.timer2_timer, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ), 0, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ));
221221      }
222222      if ( ( data & 0x08 ) && timers.timers_enabled ) {
223223         timer_enable( timers.timer2_timer, 1 );
r1681r1682
238238            Bit 4-7     Unused
239239         */
240240      if ( ( data & 0x07 ) != ( pokemini_hwreg[0x1C] & 0x07 ) ) {
241         timer_adjust( timers.timer3_timer, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ), 0, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ) );
241         timer_adjust_periodic(timers.timer3_timer, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ), 0, ATTOTIME_IN_CYCLES( timer_to_cycles[data & 0x07], 0 ));
242242      }
243243      if ( ( data & 0x08 ) && timers.timers_enabled ) {
244244         timer_enable( timers.timer3_timer, 1 );
r1681r1682
415415         */
416416      if ( data & 0x01 ) {   /* enable timer */
417417         if ( ! timers.hz256_running ) {
418            timer_adjust( timers.hz256_timer, ATTOTIME_IN_HZ(256), 0, attotime_zero );
418            timer_adjust_oneshot(timers.hz256_timer, ATTOTIME_IN_HZ(256), 0);
419419            timers.hz256_running = 1;
420420         }
421421      } else {      /* pause timer */
src/mess/machine/rp5c15.c
r1681r1682
6969
7070#include "rp5c15.h"
7171#include "deprecat.h"
72#include "mslegacy.h"
7372
73
7474static struct rp5c15 rtc;
7575
7676static emu_timer* rtc_timer;
r1681r1682
138138   rtc.pulse_count = 0;
139139
140140   rtc_timer = timer_alloc(rtc_alarm_pulse, NULL);
141   timer_adjust(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32));
141   timer_adjust_periodic(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32));
142142}
143143
144144static int rp5c15_read(int offset, UINT16 mem_mask)
src/mess/machine/coco.c
r1681r1682
9898#include "sound/dac.h"
9999#include "sound/ay8910.h"
100100#include "devices/cococart.h"
101#include "mslegacy.h"
102101
102
103103/*common vars/calls */
104104static UINT8 *coco_rom;
105105static int dclg_state, dclg_output_h, dclg_output_v, dclg_timer;
r1681r1682
11881188
11891189static WRITE8_HANDLER ( d_pia0_ca2_w )
11901190{
1191   timer_adjust(mux_sel1_timer, ATTOTIME_IN_USEC(16), data, attotime_never);
1191   timer_adjust_oneshot(mux_sel1_timer, ATTOTIME_IN_USEC(16), data);
11921192}
11931193
11941194static TIMER_CALLBACK(coco_update_sel1_timerproc)
r1681r1682
12001200
12011201static WRITE8_HANDLER ( d_pia0_cb2_w )
12021202{
1203   timer_adjust(mux_sel2_timer, ATTOTIME_IN_USEC(16), data, attotime_never);
1203   timer_adjust_oneshot(mux_sel2_timer, ATTOTIME_IN_USEC(16), data);
12041204}
12051205
12061206static TIMER_CALLBACK(coco_update_sel2_timerproc)
r1681r1682
20352035         logerror("coco3_reset_timer(): target_time=%g\n", attotime_to_double(target_time));
20362036
20372037      /* and adjust the timer */
2038      timer_adjust(coco3_gime_timer, target_time, 0, attotime_zero);
2038      timer_adjust_oneshot(coco3_gime_timer, target_time, 0);
20392039   }
20402040   else
20412041   {
r1681r1682
25722572
25732573   /* special code for Q state */
25742574   if ((data == 0x02) || (data == 0x03) || (data == 0x04))
2575      timer_adjust(cart_timer, ATTOTIME_IN_USEC(0), data + 1, attotime_zero);
2575      timer_adjust_oneshot(cart_timer, ATTOTIME_IN_USEC(0), data + 1);
25762576}
25772577
25782578
r1681r1682
26372637   switch(line)
26382638   {
26392639      case COCOCART_LINE_CART:
2640         timer_adjust(cart_timer, ATTOTIME_IN_USEC(0), (int) value, attotime_zero);
2640         timer_adjust_oneshot(cart_timer, ATTOTIME_IN_USEC(0), (int) value);
26412641         break;
26422642
26432643      case COCOCART_LINE_NMI:
2644         timer_adjust(nmi_timer, ATTOTIME_IN_USEC(0), (int) value, attotime_zero);
2644         timer_adjust_oneshot(nmi_timer, ATTOTIME_IN_USEC(0), (int) value);
26452645         break;
26462646
26472647      case COCOCART_LINE_HALT:
2648         timer_adjust(halt_timer, ATTOTIME_IN_CYCLES(7,0), (int) value, attotime_zero);
2648         timer_adjust_oneshot(halt_timer, ATTOTIME_IN_CYCLES(7,0), (int) value);
26492649         break;
26502650   }
26512651}
r1681r1682
27062706{
27072707   /* if the cartridge CART line is set to Q, trigger another round of pulses */
27082708   if ((coco_cart != NULL) && (cococart_get_line(coco_cart, COCOCART_LINE_CART) == COCOCART_LINE_VALUE_Q))
2709      timer_adjust(cart_timer, ATTOTIME_IN_USEC(0), 0x02, attotime_zero);
2709      timer_adjust_oneshot(cart_timer, ATTOTIME_IN_USEC(0), 0x02);
27102710}
27112711
27122712
src/mess/machine/amigacd.c
r1681r1682
1616#include "machine/wd33c93.h"
1717#include "machine/tpi6525.h"
1818#include "matsucd.h"
19#include "mslegacy.h"
2019
2120
2221#define VERBOSE_DMAC 0
r1681r1682
112111   if ( dmac_data.wtc > 0 )
113112   {
114113      matsucd_read_next_block();
115      timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
114      timer_adjust_oneshot(dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0);
116115   }
117116   else
118117   {
r1681r1682
221220      case 0x70:   /* DMA start strobe */
222221      {
223222         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ));
224         timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
223         timer_adjust_oneshot(dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0);
225224      }
226225      break;
227226
r1681r1682
347346      case 0x70:   /* DMA start strobe */
348347      {
349348         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ));
350         timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
349         timer_adjust_oneshot(dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0);
351350      }
352351      break;
353352
r1681r1682
456455   }
457456   else
458457   {
459      timer_adjust( tp6525_delayed_timer, ATTOTIME_IN_MSEC(1), 0, attotime_zero );
458      timer_adjust_oneshot(tp6525_delayed_timer, ATTOTIME_IN_MSEC(1), 0);
460459   }
461460}
462461
r1681r1682
473472      else
474473      {
475474         /* we *have to* deliver the irq, so if we can't, delay it and try again later */
476         timer_adjust( tp6525_delayed_timer, ATTOTIME_IN_MSEC(1), 0, attotime_zero );
475         timer_adjust_oneshot(tp6525_delayed_timer, ATTOTIME_IN_MSEC(1), 0);
477476      }
478477   }
479478}
src/mess/machine/gb.c
r1681r1682
3737
3838#include "driver.h"
3939#include "deprecat.h"
40#include "mslegacy.h"
4140#include "includes/gb.h"
4241#include "cpu/z80gb/z80gb.h"
4342#include "image.h"
r1681r1682
720719      case 0x81:            /* enabled & internal clock */
721720         SIODATA = 0xFF;
722721         SIOCount = 8;
723         timer_adjust( gb_serial_timer, ATTOTIME_IN_CYCLES( 512, 0 ), 0, ATTOTIME_IN_CYCLES( 512, 0 ) );
722         timer_adjust_periodic(gb_serial_timer, ATTOTIME_IN_CYCLES( 512, 0 ), 0, ATTOTIME_IN_CYCLES( 512, 0 ));
724723         timer_enable( gb_serial_timer, 1 );
725724         break;
726725      }
src/mess/machine/kim1.c
r1681r1682
88******************************************************************************/
99
1010#include "driver.h"
11#include "mslegacy.h"
1211#include "cpu/m6502/m6502.h"
1312#include "includes/kim1.h"
1413#include "sound/dac.h"
r1681r1682
598597
599598static void set_chip_clock(int chip, int data)
600599{
601   timer_adjust(m6530[chip].timer, attotime_zero, chip, ATTOTIME_IN_HZ((data + 1) * m6530[chip].clock / 256 / 256));
600   timer_adjust_periodic(m6530[chip].timer, attotime_zero, chip, ATTOTIME_IN_HZ((data + 1) * m6530[chip].clock / 256 / 256));
602601}
603602
604603MACHINE_RESET( kim1 )
src/mess/machine/99_dsk.c
r1681r1682
2525
2626#include "driver.h"
2727#include "deprecat.h"
28#include "mslegacy.h"
2928#include "machine/wd17xx.h"
3029#include "smc92x4.h"
3130#include "ti99_4x.h"
r1681r1682
3534#include "formats/basicdsk.h"
3635#include "devices/mflopimg.h"
3736
37
3838#define MAX_FLOPPIES 4
3939#define TI99DSK_TAG   "ti99dsktag"
4040
41
4142static int use_80_track_drives;
4243
4344/* defines for DRQ_IRQ_status */
r1681r1682
507508      {   /* on rising edge, set DVENA for 4.23s */
508509         DVENA = 1;
509510         fdc_handle_hold();
510         timer_adjust(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0, attotime_zero);
511         timer_adjust_oneshot(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0);
511512      }
512513      motor_on = data;
513514      break;
r1681r1682
711712      {   /* on rising edge, set DVENA for 4.23s */
712713         DVENA = 1;
713714         fdc_handle_hold();
714         timer_adjust(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0, attotime_zero);
715         timer_adjust_oneshot(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0);
715716      }
716717      motor_on = data;
717718      break;
r1681r1682
925926      {   /* on rising edge, set DVENA for 4.23s */
926927         DVENA = 1;
927928         fdc_handle_hold();
928         timer_adjust(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0, attotime_zero);
929         timer_adjust_oneshot(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0);
929930      }
930931      motor_on = data;
931932      break;
r1681r1682
13171318      {
13181319         DVENA = 1;
13191320         fdc_handle_hold();
1320         timer_adjust(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0, attotime_zero);
1321         timer_adjust_oneshot(motor_on_timer, ATTOTIME_IN_MSEC(4230), 0);
13211322      }
13221323      motor_on = data;
13231324      break;
src/mess/machine/at29040.c
r1681r1682
1010*/
1111
1212#include "driver.h"
13#include "mslegacy.h"
1413#include "at29040.h"
1514
15
1616#define MAX_AT29C040A 4
1717
1818#define FEEPROM_SIZE        0x80000
r1681r1682
9191      /* programming cycle start */
9292      at29c040a[id].s_pgm = s_pgm_3;
9393      /* max delay 10ms, typical delay 5 to 7 ms */
94      timer_adjust(at29c040a[id].programming_timer, ATTOTIME_IN_MSEC(5), id, attotime_zero);
94      timer_adjust_oneshot(at29c040a[id].programming_timer, ATTOTIME_IN_MSEC(5), id);
9595      break;
9696
9797   case s_pgm_3:
r1681r1682
216216      at29c040a[id].s_pgm = s_pgm_0;
217217      at29c040a[id].s_enabling_sdb = FALSE;
218218      at29c040a[id].s_disabling_sdb = FALSE;
219      timer_adjust(at29c040a[id].programming_timer, attotime_never, id, attotime_zero);
219      timer_adjust_oneshot(at29c040a[id].programming_timer, attotime_never, id);
220220   }
221221
222222
r1681r1682
251251      {   /* data polling starts the programming cycle (right???) */
252252         at29c040a[id].s_pgm = s_pgm_3;
253253         /* max delay 10ms, typical delay 5 to 7 ms */
254         timer_adjust(at29c040a[id].programming_timer, ATTOTIME_IN_MSEC(5), id, attotime_zero);
254         timer_adjust_oneshot(at29c040a[id].programming_timer, ATTOTIME_IN_MSEC(5), id);
255255      }
256256
257257      reply = at29c040a[id].toggle_bit;
r1681r1682
319319         at29c040a[id].s_pgm = s_pgm_0;
320320         at29c040a[id].s_enabling_sdb = FALSE;
321321         at29c040a[id].s_disabling_sdb = FALSE;
322         timer_adjust(at29c040a[id].programming_timer, attotime_never, id, attotime_zero);
322         timer_adjust_oneshot(at29c040a[id].programming_timer, attotime_never, id);
323323
324324         /* process command */
325325         switch (data)
r1681r1682
345345               at29c040a[id].s_pgm = s_pgm_1;
346346               at29c040a[id].s_disabling_sdb = TRUE;
347347               /* set command timeout (right???) */
348               //timer_adjust(at29c040a[id].programming_timer, ATTOTIME_IN_USEC(150), id, 0.);
348               //timer_adjust_periodic(at29c040a[id].programming_timer, ATTOTIME_IN_USEC(150), id, 0.);
349349            }
350350            break;
351351
r1681r1682
365365            at29c040a[id].s_pgm = s_pgm_1;
366366            at29c040a[id].s_enabling_sdb = TRUE;
367367            /* set command timeout (right???) */
368            //timer_adjust(at29c040a[id].programming_timer, ATTOTIME_IN_USEC(150), id, 0.);
368            //timer_adjust_periodic(at29c040a[id].programming_timer, ATTOTIME_IN_USEC(150), id, 0.);
369369            break;
370370
371371         case 0xf0:
r1681r1682
394394      at29c040a[id].s_pgm = s_pgm_0;
395395      at29c040a[id].s_enabling_sdb = FALSE;
396396      at29c040a[id].s_disabling_sdb = FALSE;
397      timer_adjust(at29c040a[id].programming_timer, attotime_never, id, attotime_zero);
397      timer_adjust_oneshot(at29c040a[id].programming_timer, attotime_never, id);
398398   }
399399
400400   if (((at29c040a[id].s_pgm == s_pgm_0) && ! at29c040a[id].s_sdp)
r1681r1682
420420      /* write data to programming buffer */
421421      at29c040a[id].programming_buffer[offset & 0xff] = data;
422422      at29c040a[id].programming_last_offset = offset;
423      timer_adjust(at29c040a[id].programming_timer, ATTOTIME_IN_USEC(150), id, attotime_zero);
423      timer_adjust_oneshot(at29c040a[id].programming_timer, ATTOTIME_IN_USEC(150), id);
424424   }
425425}
426426
src/mess/machine/gamecom.c
r1681r1682
11
22#include "driver.h"
33#include "deprecat.h"
4#include "mslegacy.h"
54#include "includes/gamecom.h"
65#include "cpu/sm8500/sm8500.h"
76#include "image.h"
r1681r1682
328327         /* timer run */
329328         if ( data & 0x40 ) {
330329            /* timer resolution 1 minute */
331            timer_adjust( gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(60) );
330            timer_adjust_periodic(gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(60));
332331         } else {
333332            /* TImer resolution 1 second */
334            timer_adjust( gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1) );
333            timer_adjust_periodic(gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
335334         }
336335      } else {
337336         /* disable timer reset */
src/mess/machine/mz700.c
r1681r1682
1313#include "driver.h"
1414#include "deprecat.h"
1515#include "includes/mz700.h"
16#include "mslegacy.h"
1716
1817/* Components */
1918#include "cpu/z80/z80.h"
r1681r1682
9897MACHINE_RESET( mz700 )
9998{
10099   ne556_timer[0] = timer_alloc(ne556_callback, NULL);
101   timer_adjust(ne556_timer[0], ATTOTIME_IN_HZ(1.5), 0, ATTOTIME_IN_HZ(1.5));
100   timer_adjust_periodic(ne556_timer[0], ATTOTIME_IN_HZ(1.5), 0, ATTOTIME_IN_HZ(1.5));
102101   /*timer_pulse(ATTOTIME_IN_HZ(1.5), NULL, 0, ne556_callback)*/
103102   ne556_timer[1] = timer_alloc(ne556_callback, NULL);
104   timer_adjust(ne556_timer[1], ATTOTIME_IN_HZ(34.5), 1, ATTOTIME_IN_HZ(34.5));
103   timer_adjust_periodic(ne556_timer[1], ATTOTIME_IN_HZ(34.5), 1, ATTOTIME_IN_HZ(34.5));
105104   /*timer_pulse(ATTOTIME_IN_HZ(34.5), NULL, 1, ne556_callback)*/
106105}
107106
src/mess/machine/serial.c
r1681r1682
3030*/
3131
3232#include "driver.h"
33#include "mslegacy.h"
3433#include "includes/serial.h"
3534
35
3636#define VERBOSE 0
3737#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
3838
r1681r1682
209209      if (state)
210210      {
211211         /* start timer */
212         timer_adjust(serial_devices[id].timer, attotime_zero, id, ATTOTIME_IN_HZ(serial_devices[id].BaudRate));
212         timer_adjust_periodic(serial_devices[id].timer, attotime_zero, id, ATTOTIME_IN_HZ(serial_devices[id].BaudRate));
213213      }
214214      else
215215      {
src/mess/machine/vectrex.c
r1681r1682
66#include "cpu/m6809/m6809.h"
77#include "sound/ay8910.h"
88#include "image.h"
9#include "mslegacy.h"
109
1110#include "includes/vectrex.h"
1211
12
1313#define VC_RED      MAKE_RGB(0xff, 0x00, 0x00)
1414#define VC_GREEN    MAKE_RGB(0x00, 0xff, 0x00)
1515#define VC_BLUE     MAKE_RGB(0x00, 0x00, 0xff)
r1681r1682
290290
291291         if (imager_freq > 1)
292292         {
293            timer_adjust (imager_timer,
293            timer_adjust_periodic(imager_timer,
294294               double_to_attotime(MIN(1.0/imager_freq, attotime_to_double(timer_timeleft(imager_timer)))),
295295               2,
296296               ATTOTIME_IN_HZ(imager_freq));
src/mess/machine/nes_mmc.c
r1681r1682
3030#include "osdepend.h"
3131#include "deprecat.h"
3232#include "driver.h"
33#include "mslegacy.h"
3433#include "includes/nes.h"
3534#include "nes_mmc.h"
3635#include "sound/nes_apu.h"
r1681r1682
102101static TIMER_CALLBACK(nes_irq_callback)
103102{
104103   cpunum_set_input_line(machine, 0, M6502_IRQ_LINE, HOLD_LINE);
105   timer_adjust(nes_irq_timer, attotime_never, 0, attotime_never);
104   timer_adjust_oneshot(nes_irq_timer, attotime_never, 0);
106105}
107106
108107WRITE8_HANDLER( nes_low_mapper_w )
r1681r1682
635634      {
636635         logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(0), video_screen_get_hpos(0));
637636         cpunum_set_input_line(Machine, 0, M6502_IRQ_LINE, HOLD_LINE);
638//         timer_adjust(nes_irq_timer, ATTOTIME_IN_CYCLES(4, 0), 0, attotime_never);
637//         timer_adjust_oneshot(nes_irq_timer, ATTOTIME_IN_CYCLES(4, 0), 0);
639638      }
640639   }
641640}
r1681r1682
28742873         /* Check if IRQ is being enabled */
28752874         if ( ! IRQ_enable && ( data & 0x02 ) ) {
28762875            IRQ_enable = 1;
2877            timer_adjust(nes_irq_timer, ATTOTIME_IN_CYCLES(24576, 0), 0, attotime_never);
2876            timer_adjust_oneshot(nes_irq_timer, ATTOTIME_IN_CYCLES(24576, 0), 0);
28782877         }
28792878         if ( ! ( data & 0x02 ) ) {
28802879            IRQ_enable = 0;
2881            timer_adjust(nes_irq_timer, attotime_never, 0, attotime_never);
2880            timer_adjust_oneshot(nes_irq_timer, attotime_never, 0);
28822881         }
28832882         break;
28842883      }
src/mess/machine/vc1541.c
r1681r1682
102102
103103#include "driver.h"
104104#include "deprecat.h"
105#include "mslegacy.h"
106105#include "image.h"
107106#include "cpu/m6502/m6502.h"
108107#include "machine/6522via.h"
r1681r1682
572571            if (attotime_to_double(timer_timeelapsed(vc1541->timer)) > 1.0e29)
573572               timer_reset(vc1541->timer, attotime_never);
574573            else
575               timer_adjust(vc1541->timer, attotime_zero, 0, double_to_attotime(tme));
574               timer_adjust_periodic(vc1541->timer, attotime_zero, 0, double_to_attotime(tme));
576575         }
577576         else
578577         {
r1681r1682
866865               if (attotime_to_double(timer_timeelapsed(vc1541->timer)) > 1.0e29)
867866                  timer_reset(vc1541->timer, attotime_never);
868867               else
869                  timer_adjust(vc1541->timer, attotime_zero, 0, double_to_attotime(tme));
868                  timer_adjust_periodic(vc1541->timer, attotime_zero, 0, double_to_attotime(tme));
870869            }
871870            else
872871            {
r1681r1682
947946   /* time should be small enough to allow quitting of the irq
948947      line before the next interrupt is triggered */
949948   vc1541->drive.c1551.timer = timer_alloc(c1551_timer, NULL);
950   timer_adjust(vc1541->drive.c1551.timer, attotime_zero, 0, ATTOTIME_IN_HZ(60));
949   timer_adjust_periodic(vc1541->drive.c1551.timer, attotime_zero, 0, ATTOTIME_IN_HZ(60));
951950   return 0;
952951}
953952
src/mess/machine/thomson.c
r1681r1682
88
99#include "driver.h"
1010#include "deprecat.h"
11#include "mslegacy.h"
1211#include "includes/thomson.h"
1312#include "cpu/m6809/m6809.h"
1413#include "machine/6821pia.h"
r1681r1682
976975   LOG (( "to7_game_init called\n" ));
977976   pia_config( THOM_PIA_GAME, &to7_game );
978977   to7_game_timer = timer_alloc( to7_game_update_cb , NULL);
979   timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
978   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
980979   state_save_register_global( to7_game_sound );
981980   state_save_register_global( to7_game_mute );
982981}
r1681r1682
15991598static void mo5_init_timer(void)
16001599{
16011600   /* time is a faster than 50 Hz to match video framerate */
1602   timer_adjust( mo5_periodic_timer, attotime_zero, 0, ATTOTIME_IN_USEC( 19968 ) );
1601   timer_adjust_periodic(mo5_periodic_timer, attotime_zero, 0, ATTOTIME_IN_USEC( 19968 ));
16031602}
16041603
16051604
r1681r1682
26242623      }
26252624
26262625      to9_kbd_byte_count = ( to9_kbd_byte_count + 1 ) & 3;
2627      timer_adjust( to9_kbd_timer, to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE, 0, attotime_never );
2626      timer_adjust_oneshot(to9_kbd_timer, to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE, 0);
26282627   }
26292628   else
26302629   {
r1681r1682
26322631      /* keyboard mode: send a byte only if a key is down */
26332632      if ( key )
26342633         to9_kbd_send( key, 0 );
2635      timer_adjust( to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0, attotime_never );
2634      timer_adjust_oneshot(to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0);
26362635   }
26372636}
26382637
r1681r1682
26522651   to9_kbd_key_count = 0;
26532652   to9_kbd_last_key = 0xff;
26542653   to9_kbd_update_irq();
2655   timer_adjust( to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0, attotime_never );
2654   timer_adjust_oneshot(to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0);
26562655}
26572656
26582657
r1681r1682
30653064      d = ATTOTIME_IN_USEC( bit ? 56 : 38 );
30663065      to8_kbd_step++;
30673066   }
3068   timer_adjust( to8_kbd_timer, d, 0, attotime_never );
3067   timer_adjust_oneshot(to8_kbd_timer, d, 0);
30693068}
30703069
30713070
r1681r1682
31003099            /* send back signal: TODO returned codes ? */
31013100            to8_kbd_data = 0;
31023101            to8_kbd_step = 0;
3103            timer_adjust( to8_kbd_timer, ATTOTIME_IN_MSEC( 1 ), 0, attotime_never );
3102            timer_adjust_oneshot(to8_kbd_timer, ATTOTIME_IN_MSEC( 1 ), 0);
31043103         }
31053104         else
31063105         {
31073106            to8_kbd_step = 0;
3108            timer_adjust( to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0, attotime_never );
3107            timer_adjust_oneshot(to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0);
31093108            if ( len >= 1.2 && len <= 1.4 )
31103109            {
31113110               LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", attotime_to_double(timer_get_time()) ));
r1681r1682
31233122      {
31243123         /* end key transmission */
31253124         to8_kbd_step = 0;
3126         timer_adjust( to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0, attotime_never );
3125         timer_adjust_oneshot(to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0);
31273126      }
31283127   }
31293128
r1681r1682
31333132      {
31343133         /* CPU accepts key */
31353134         to8_kbd_step = 99;
3136         timer_adjust( to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0, attotime_never );
3135         timer_adjust_oneshot(to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0);
31373136      }
31383137      else
31393138      {
31403139         /* start signal from CPU */
31413140         to8_kbd_data = 0xfff;
31423141         to8_kbd_step = 91;
3143         timer_adjust( to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0, attotime_never );
3144         timer_adjust( to8_kbd_signal, attotime_never, 0, attotime_never );
3142         timer_adjust_oneshot(to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0);
3143         timer_adjust_oneshot(to8_kbd_signal, attotime_never, 0);
31453144      }
31463145      LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_data ));
31473146   }
r1681r1682
41634162   LOG (( "mo6_game_init called\n" ));
41644163   pia_config( THOM_PIA_GAME, &mo6_game );
41654164   to7_game_timer = timer_alloc( mo6_game_update_cb , NULL);
4166   timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
4165   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
41674166   state_save_register_global( to7_game_sound );
41684167   state_save_register_global( to7_game_mute );
41694168}
r1681r1682
46714670   LOG (( "mo5nr_game_init called\n" ));
46724671   pia_config( THOM_PIA_GAME, &mo5nr_game );
46734672   to7_game_timer = timer_alloc( mo6_game_update_cb , NULL);
4674   timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
4673   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
46754674   state_save_register_global( to7_game_sound );
46764675   state_save_register_global( to7_game_mute );
46774676}
src/mess/machine/lisa.c
r1681r1682
3838
3939#include "driver.h"
4040#include "deprecat.h"
41#include "mslegacy.h"
4241#include "includes/lisa.h"
4342#include "machine/6522via.h"
4443#include "machine/applefdc.h"
r1681r1682
646645
647646      case 0x7:   /* send mouse command */
648647         if (immediate & 0x8)
649            timer_adjust(mouse_timer, attotime_zero, 0, ATTOTIME_IN_MSEC((immediate & 0x7)*4)); /* enable mouse */
648            timer_adjust_periodic(mouse_timer, attotime_zero, 0, ATTOTIME_IN_MSEC((immediate & 0x7)*4)); /* enable mouse */
650649         else
651650            timer_reset(mouse_timer, attotime_never);
652651         break;
src/mess/machine/sym1.c
r1681r1682
99
1010#include "driver.h"
1111#include "deprecat.h"
12#include "mslegacy.h"
1312#include "includes/sym1.h"
1413
1514/* M6502 CPU */
r1681r1682
3736
3837static void sym1_74145_output_0_w(int state)
3938{
40   if (state) timer_adjust(led_update, LED_REFRESH_DELAY, 0, attotime_never);
39   if (state) timer_adjust_oneshot(led_update, LED_REFRESH_DELAY, 0);
4140}
4241
4342
4443static void sym1_74145_output_1_w(int state)
4544{
46   if (state) timer_adjust(led_update, LED_REFRESH_DELAY, 1, attotime_never);
45   if (state) timer_adjust_oneshot(led_update, LED_REFRESH_DELAY, 1);
4746}
4847
4948
5049static void sym1_74145_output_2_w(int state)
5150{
52   if (state) timer_adjust(led_update, LED_REFRESH_DELAY, 2, attotime_never);
51   if (state) timer_adjust_oneshot(led_update, LED_REFRESH_DELAY, 2);
5352}
5453
5554
5655static void sym1_74145_output_3_w(int state)
5756{
58   if (state) timer_adjust(led_update, LED_REFRESH_DELAY, 3, attotime_never);
57   if (state) timer_adjust_oneshot(led_update, LED_REFRESH_DELAY, 3);
5958}
6059
6160
6261static void sym1_74145_output_4_w(int state)
6362{
64   if (state) timer_adjust(led_update, LED_REFRESH_DELAY, 4, attotime_never);
63   if (state) timer_adjust_oneshot(led_update, LED_REFRESH_DELAY, 4);
6564}
6665
6766
6867static void sym1_74145_output_5_w(int state)
6968{
70   if (state) timer_adjust(led_update, LED_REFRESH_DELAY, 5, attotime_never);
69   if (state) timer_adjust_oneshot(led_update, LED_REFRESH_DELAY, 5);
7170}
7271
7372
src/mess/machine/lynx.c
r1681r1682
55#include "driver.h"
66#include "includes/lynx.h"
77#include "deprecat.h"
8#include "mslegacy.h"
9
108#include "cpu/m6502/m6502.h"
119
1210
r1681r1682
948946         {
949947            attotime t = attotime_mul(ATTOTIME_IN_HZ( lynx_time_factor( lynx_timer[which].cntrl1 & 7 ) ), lynx_timer[which].bakup + 1 );
950948            if ( lynx_timer[which].cntrl1 & 0x10 )
951               timer_adjust( lynx_timer[which].timer, attotime_zero, which, t);
949               timer_adjust_periodic(lynx_timer[which].timer, attotime_zero, which, t);
952950            else
953               timer_adjust( lynx_timer[which].timer, t, which, attotime_zero);
951               timer_adjust_oneshot(lynx_timer[which].timer, t, which);
954952            lynx_timer[which].timer_active = 1;
955953         }
956954      }
src/mess/machine/pmd85.c
r1681r1682
1212#include <stdarg.h>
1313#include "driver.h"
1414#include "deprecat.h"
15#include "mslegacy.h"
1615#include "devices/cassette.h"
1716#include "cpu/i8085/i8085.h"
1817#include "includes/pmd85.h"
r1681r1682
787786   msm8251_init(&pmd85_msm8251_interface);
788787
789788   pmd85_cassette_timer = timer_alloc(pmd85_cassette_timer_callback, NULL);
790   timer_adjust(pmd85_cassette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2400));
789   timer_adjust_periodic(pmd85_cassette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2400));
791790
792791   serial_connection_init(&pmd85_cassette_serial_connection);
793792   serial_connection_set_in_callback(&pmd85_cassette_serial_connection, pmd85_cassette_write);
src/mess/machine/rriot.c
r1681r1682
1010 * used in chess champion mk2
1111 * rockwell aim65 ?
1212 **********************************************************************/
13
1314#include "driver.h"
1415#include "rriot.h"
15#include "mslegacy.h"
1616
17
1718#define VERBOSE 0
1819
1920#define LOG(a) do { if (VERBOSE) logerror a; } while (0)
r1681r1682
220221      switch (offset&3) {
221222      case 0: /* Timer 1 start */
222223         LOG(("rriot(%d) TMR1  write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" ")));
223         timer_adjust(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) ), chip, attotime_zero);
224         timer_adjust_oneshot(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) ), chip);
224225         rriot[chip].state=Delay1;
225226         break;
226227      case 1: /* Timer 8 start */
227228         LOG(("rriot(%d) TMR8  write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" ")));
228         timer_adjust(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) * 8 ), chip, attotime_zero);
229         timer_adjust_oneshot(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) * 8 ), chip);
229230         rriot[chip].state=Delay8;
230231         break;
231232      case 2: /* Timer 64 start */
232233         LOG(("rriot(%d) TMR64 write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" ")));
233234//         LOG(("rriot(%d) TMR64 write: time is $%f\n", chip, (double)(64.0 * (data + 1) / rriot[chip].clock)));
234         timer_adjust(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) * 64 ), chip, attotime_zero);
235         timer_adjust_oneshot(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) * 64 ), chip);
235236         rriot[chip].state=Delay64;
236237         break;
237238      case 3: /* Timer 1024 start */
238239         LOG(("rriot(%d) TMR1K write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" ")));
239         timer_adjust(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) * 1024 ), chip, attotime_zero);
240         timer_adjust_oneshot(rriot[chip].timer, attotime_mul(ATTOTIME_IN_HZ(rriot[chip].config->baseclock), (data+1) * 1024 ), chip);
240241         rriot[chip].state=Delay1024;
241242         break;
242243      }
src/mess/machine/tx0.c
r1681r1682
88
99#include "cpu/pdp1/tx0.h"
1010#include "includes/tx0.h"
11#include "mslegacy.h"
1211#include "video/crt.h"
1312
1413
r1681r1682
232231         if (tape_reader.motor_on && tape_reader.rcl)
233232         {
234233            /* delay is approximately 1/400s */
235            timer_adjust(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0, attotime_zero);
234            timer_adjust_oneshot(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0);
236235         }
237236         else
238237         {
r1681r1682
306305   if (tape_reader.motor_on && tape_reader.rcl)
307306   {
308307      /* delay is approximately 1/400s */
309      timer_adjust(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0, attotime_zero);
308      timer_adjust_oneshot(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0);
310309   }
311310   else
312311   {
r1681r1682
357356
358357   if (tape_reader.motor_on && tape_reader.rcl)
359358      /* delay is approximately 1/400s */
360      timer_adjust(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0, attotime_zero);
359      timer_adjust_oneshot(tape_reader.timer, ATTOTIME_IN_USEC(2500), 0);
361360   else
362361      timer_enable(tape_reader.timer, 0);
363362}
r1681r1682
398397   /* shuffle and punch 6-bit word */
399398   tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5));
400399
401   timer_adjust(tape_puncher.timer, ATTOTIME_IN_USEC(15800), 0, attotime_zero);
400   timer_adjust_oneshot(tape_puncher.timer, ATTOTIME_IN_USEC(15800), 0);
402401}
403402
404403/*
r1681r1682
413412   /* shuffle and punch 6-bit word */
414413   tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100);
415414
416   timer_adjust(tape_puncher.timer, ATTOTIME_IN_USEC(15800), 0, attotime_zero);
415   timer_adjust_oneshot(tape_puncher.timer, ATTOTIME_IN_USEC(15800), 0);
417416}
418417
419418
r1681r1682
472471   ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5);
473472   typewriter_out(ch);
474473
475   timer_adjust(typewriter.prt_timer, ATTOTIME_IN_MSEC(100), 0, attotime_zero);
474   timer_adjust_oneshot(typewriter.prt_timer, ATTOTIME_IN_MSEC(100), 0);
476475}
477476
478477
r1681r1682
498497   y = ac & 0777;
499498   tx0_plot(x, y);
500499
501   timer_adjust(dis_timer, ATTOTIME_IN_USEC(50), 0, attotime_zero);
500   timer_adjust_oneshot(dis_timer, ATTOTIME_IN_USEC(50), 0);
502501}
503502
504503
r1681r1682
531530      delay = ATTOTIME_IN_USEC(4600);
532531      break;
533532   }
534   timer_adjust(magtape.timer, delay, 0, attotime_zero);
533   timer_adjust_oneshot(magtape.timer, delay, 0);
535534}
536535
537536static void schedule_unselect(void)
r1681r1682
553552      delay = ATTOTIME_IN_USEC(5750);
554553      break;
555554   }
556   timer_adjust(magtape.timer, delay, 0, attotime_zero);
555   timer_adjust_oneshot(magtape.timer, delay, 0);
557556}
558557
559558DEVICE_INIT( tx0_magtape )
r1681r1682
783782               break;
784783            }
785784            if (magtape.state != MTS_UNSELECTING)
786               timer_adjust(magtape.timer, ATTOTIME_IN_USEC(66), 0, attotime_zero);
785               timer_adjust_oneshot(magtape.timer, ATTOTIME_IN_USEC(66), 0);
787786         }
788787         break;
789788
r1681r1682
942941               break;
943942            }
944943            if (magtape.state != MTS_UNSELECTING)
945               timer_adjust(magtape.timer, ATTOTIME_IN_USEC(66), 0, attotime_zero);
944               timer_adjust_oneshot(magtape.timer, ATTOTIME_IN_USEC(66), 0);
946945         }
947946         break;
948947
949948      case 2:   /* rewind */
950949         magtape.state = MTS_UNSELECTING;
951950         /* we rewind at 10*read speed (I don't know the real value) */
952         timer_adjust(magtape.timer, attotime_mul(ATTOTIME_IN_NSEC(6600), image_ftell(magtape.img)), 0, attotime_zero);
951         timer_adjust_oneshot(magtape.timer, attotime_mul(ATTOTIME_IN_NSEC(6600), image_ftell(magtape.img)), 0);
953952         //schedule_unselect();
954953         image_fseek(magtape.img, 0, SEEK_END);
955954         magtape.irg_pos = MTIRGP_END;
r1681r1682
10371036               image_unload(magtape.img);
10381037            }
10391038            else
1040               timer_adjust(magtape.timer, ATTOTIME_IN_USEC(66), 0, attotime_zero);
1039               timer_adjust_oneshot(magtape.timer, ATTOTIME_IN_USEC(66), 0);
10411040         }
10421041         break;
10431042      }
r1681r1682
10531052   {
10541053      if (0)
10551054         magtape_callback(0);
1056      timer_adjust(magtape.timer, attotime_zero, 0, attotime_zero);
1055      timer_adjust_oneshot(magtape.timer, attotime_zero, 0);
10571056   }
10581057}
10591058
src/mess/machine/tms9901.c
r1681r1682
66
77#include <math.h>
88#include "driver.h"
9#include "mslegacy.h"
109
1110#include "tms9901.h"
1211
r1681r1682
329328{
330329   if (tms9901[which].clockinvl)
331330   {   /* reset clock interval */
332      timer_adjust(tms9901[which].timer, double_to_attotime((double) tms9901[which].clockinvl / (tms9901[which].clock_rate / 64.)), which, double_to_attotime((double) tms9901[which].clockinvl / (tms9901[which].clock_rate / 64.)));
331      timer_adjust_periodic(tms9901[which].timer, double_to_attotime((double) tms9901[which].clockinvl / (tms9901[which].clock_rate / 64.)), which, double_to_attotime((double) tms9901[which].clockinvl / (tms9901[which].clock_rate / 64.)));
333332   }
334333   else
335334   {   /* clock interval == 0 -> no timer */
src/mess/machine/europc.c
r1681r1682
55#include "video/pc_aga.h"
66#include "audio/pc.h"
77#include "deprecat.h"
8#include "mslegacy.h"
98
9
1010/*
1111
1212 */
r1681r1682
279279   europc_rtc.data[0xf]=1;
280280
281281   europc_rtc.timer = timer_alloc(europc_rtc_timer, NULL);
282   timer_adjust(europc_rtc.timer, attotime_zero, 0, attotime_make(1, 0));
282   timer_adjust_periodic(europc_rtc.timer, attotime_zero, 0, attotime_make(1, 0));
283283}
284284
285285 READ8_HANDLER( europc_rtc_r )
src/mess/machine/6551.c
r1681r1682
11#include "driver.h"
22#include "6551.h"
33#include "includes/serial.h"
4#include "mslegacy.h"
54
5
66static void acia_6551_receive_char(unsigned char ch);
77static void acia_6551_refresh_ints(void);
88
r1681r1682
467467                  break;
468468               }
469469
470               timer_adjust(acia.timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate));
470               timer_adjust_periodic(acia.timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate));
471471            }
472472         }
473473
src/mess/machine/electron.c
r1681r1682
99
1010#include "driver.h"
1111#include "deprecat.h"
12#include "mslegacy.h"
1312#include "includes/electron.h"
1413#include "sound/beep.h"
1514#include "devices/cassette.h"
r1681r1682
3029   ula.high_tone_set = 0;
3130   ula.bit_count = 0;
3231   ula.tape_running = 1;
33   timer_adjust( electron_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800) );
32   timer_adjust_periodic(electron_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800));
3433}
3534
3635static void electron_tape_stop( void ) {
src/mess/machine/pc_hdc.c
r1681r1682
2424#include "machine/8237dma.h"
2525#include "devices/harddriv.h"
2626#include "memconv.h"
27#include "mslegacy.h"
2827
2928
3029#define LOG_HDC_STATUS      0
r1681r1682
635634         status[n] |= STA_INPUT;
636635
637636         assert(timer[n]);
638         timer_adjust(timer[n], ATTOTIME_IN_MSEC(1), n, attotime_zero);
637         timer_adjust_oneshot(timer[n], ATTOTIME_IN_MSEC(1), n);
639638        }
640639   }
641640}
src/mess/machine/centroni.c
r1681r1682
66
77#include "driver.h"
88#include "centroni.h"
9#include "mslegacy.h"
109#include "devices/printer.h"
1110
1211typedef struct {
r1681r1682
7574   {
7675      This->new_control_mask = CENTRONICS_ACKNOWLEDGE;
7776      This->new_control_data = 0;
78      timer_adjust(This->timer, ATTOTIME_IN_USEC(2), nr, attotime_zero);
77      timer_adjust_oneshot(This->timer, ATTOTIME_IN_USEC(2), nr);
7978   }
8079   /* phase 3: end */
8180   else if ( This->control & CENTRONICS_NOT_BUSY )
8281   {
83      timer_adjust(This->timer, attotime_never, nr, attotime_zero);
82      timer_adjust_oneshot(This->timer, attotime_never, nr);
8483   }
8584   /* phase 1: schedule not busy & ack */
8685   else
8786   {
8887      This->new_control_mask = CENTRONICS_NOT_BUSY | CENTRONICS_ACKNOWLEDGE;
8988      This->new_control_data = CENTRONICS_NOT_BUSY | CENTRONICS_ACKNOWLEDGE;
90      timer_adjust(This->timer, ATTOTIME_IN_USEC(15), nr, attotime_zero);
89      timer_adjust_oneshot(This->timer, ATTOTIME_IN_USEC(15), nr);
9190   }
9291}
9392
r1681r1682
105104         /* schedule busy */
106105         This->new_control_mask = CENTRONICS_NOT_BUSY;
107106         This->new_control_data = 0;
108         timer_adjust(This->timer, ATTOTIME_IN_USEC(5), nr, attotime_zero);
107         timer_adjust_oneshot(This->timer, ATTOTIME_IN_USEC(5), nr);
109108
110109         /* output */
111110         printer_output(image_from_devtype_and_index(IO_PRINTER, nr), This->data);
src/mess/machine/mc6843.c
r1681r1682
3333#include "driver.h"
3434#include "mc6843.h"
3535#include "devices/flopdrv.h"
36#include "mslegacy.h"
3736
3837
3938/******************* parameters ******************/
r1681r1682
376375
377376   LOG(( "%f mc6843_cont: timer called for cmd=%s(%i)\n", attotime_to_double(timer_get_time()), mc6843_cmd[cmd], cmd ));
378377
379   timer_adjust( mc6843->timer_cont, attotime_never, 0, attotime_never );
378   timer_adjust_oneshot(mc6843->timer_cont, attotime_never, 0);
380379
381380   switch ( cmd )
382381   {
r1681r1682
444443               }
445444               else
446445               {
447                  timer_adjust( mc6843->timer_cont, DELAY_ADDR, 0, attotime_never );
446                  timer_adjust_oneshot(mc6843->timer_cont, DELAY_ADDR, 0);
448447               }
449448            }
450449            else
r1681r1682
589588               }
590589               else
591590               {
592                  timer_adjust( mc6843->timer_cont, DELAY_ADDR, 0, attotime_never );
591                  timer_adjust_oneshot(mc6843->timer_cont, DELAY_ADDR, 0);
593592               }
594593            }
595594            else
r1681r1682
690689         mc6843->STRA |=  0x80; /* set Busy */
691690         mc6843->STRA &= ~0x22; /* clear Track Not Equal & Delete Data Mark Detected */
692691         mc6843->STRB &= ~0x04; /* clear Data Mark Undetected */
693         timer_adjust( mc6843->timer_cont, DELAY_ADDR, 0, attotime_never );
692         timer_adjust_oneshot(mc6843->timer_cont, DELAY_ADDR, 0);
694693         break;
695694      case CMD_STZ:
696695      case CMD_SEK:
697696         mc6843->STRA |= 0x80; /* set Busy */
698         timer_adjust( mc6843->timer_cont, DELAY_SEEK, 0, attotime_never );
697         timer_adjust_oneshot(mc6843->timer_cont, DELAY_SEEK, 0);
699698         break;
700699      case CMD_FFW:
701700      case CMD_FFR:
r1681r1682
778777
779778   mc6843->data_size = 0;
780779   mc6843->data_idx = 0;
781   timer_adjust( mc6843->timer_cont, attotime_never, 0, attotime_never );
780   timer_adjust_oneshot(mc6843->timer_cont, attotime_never, 0);
782781}
783782
784783
src/mess/machine/mm58274c.c
r1681r1682
2020
2121#include "driver.h"
2222#include "deprecat.h"
23#include "mslegacy.h"
2423#include "mm58274c.h"
2524
2625
r1681r1682
249248         /* interrupt run */
250249         attotime period = interrupt_period_table(rtc[which].int_ctl & int_ctl_dly);
251250
252         timer_adjust(rtc[which].interrupt_timer, period, which, rtc[which].int_ctl & int_ctl_rpt ? period : attotime_zero);
251         timer_adjust_periodic(rtc[which].interrupt_timer, period, which, rtc[which].int_ctl & int_ctl_rpt ? period : attotime_zero);
253252      }
254253      if (data & ctl_clkstop)
255254         /* stopping the clock clears the tenth counter */
r1681r1682
322321            /* interrupt run */
323322            attotime period = interrupt_period_table(rtc[which].int_ctl & int_ctl_dly);
324323
325            timer_adjust(rtc[which].interrupt_timer, period, which, rtc[which].int_ctl & int_ctl_rpt ? period : attotime_zero);
324            timer_adjust_periodic(rtc[which].interrupt_timer, period, which, rtc[which].int_ctl & int_ctl_rpt ? period : attotime_zero);
326325         }
327326      }
328327      else
src/mess/machine/ibmpc.c
r1681r1682
11#include "driver.h"
22#include "memconv.h"
3#include "mslegacy.h"
43#include "includes/ibmpc.h"
54
65#include "machine/pcshare.h"
r1681r1682
221220{
222221   memset(&pc_rtc,0,sizeof(pc_rtc));
223222   pc_rtc.timer = timer_alloc(pc_rtc_timer, NULL);
224   timer_adjust(pc_rtc.timer, attotime_zero, 0, attotime_make(1, 0));
223   timer_adjust_periodic(pc_rtc.timer, attotime_zero, 0, attotime_make(1, 0));
225224}
226225
227226READ8_HANDLER( pc_rtc_r )
src/mess/machine/68901mfp.c
r1681r1682
3434*/
3535
3636#include "68901mfp.h"
37#include "mslegacy.h"
3837
38
3939typedef struct
4040{
4141   const mfp68901_interface *intf;
r1681r1682
657657         {
658658         int divisor = PRESCALER[mfp_p->tacr & 0x07];
659659         logerror("MFP68901 #%u Timer A Delay Mode : %u Prescale\n", which, divisor);
660         timer_adjust(mfp_p->timer[MFP68901_TIMER_A], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
660         timer_adjust_periodic(mfp_p->timer[MFP68901_TIMER_A], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
661661         }
662662         break;
663663
r1681r1682
676676         {
677677         int divisor = PRESCALER[mfp_p->tacr & 0x07];
678678         logerror("MFP68901 #%u Timer A Pulse Width Mode : %u Prescale\n", which, divisor);
679         timer_adjust(mfp_p->timer[MFP68901_TIMER_A], attotime_never, which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
679         timer_adjust_periodic(mfp_p->timer[MFP68901_TIMER_A], attotime_never, which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
680680         timer_enable(mfp_p->timer[MFP68901_TIMER_A], 0);
681681         }
682682         break;
r1681r1682
715715         {
716716         int divisor = PRESCALER[mfp_p->tbcr & 0x07];
717717         logerror("MFP68901 #%u Timer B Delay Mode : %u Prescale\n", which, divisor);
718         timer_adjust(mfp_p->timer[MFP68901_TIMER_B], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
718         timer_adjust_periodic(mfp_p->timer[MFP68901_TIMER_B], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
719719         }
720720         break;
721721
r1681r1682
734734         {
735735         int divisor = PRESCALER[mfp_p->tbcr & 0x07];
736736         logerror("MFP68901 #%u Timer B Pulse Width Mode : %u Prescale\n", which, DIVISOR);
737         timer_adjust(mfp_p->timer[MFP68901_TIMER_B], attotime_never, which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
737         timer_adjust_periodic(mfp_p->timer[MFP68901_TIMER_B], attotime_never, which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
738738         timer_enable(mfp_p->timer[MFP68901_TIMER_B], 0);
739739         }
740740         break;
r1681r1682
773773         {
774774         int divisor = PRESCALER[mfp_p->tcdcr & 0x07];
775775         logerror("MFP68901 #%u Timer D Delay Mode : %u Prescale\n", which, divisor);
776         timer_adjust(mfp_p->timer[MFP68901_TIMER_D], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
776         timer_adjust_periodic(mfp_p->timer[MFP68901_TIMER_D], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
777777         }
778778         break;
779779      }
r1681r1682
795795         {
796796         int divisor = PRESCALER[(mfp_p->tcdcr >> 4) & 0x07];
797797         logerror("MFP68901 #%u Timer C Delay Mode : %u Prescale\n", which, divisor);
798         timer_adjust(mfp_p->timer[MFP68901_TIMER_C], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
798         timer_adjust_periodic(mfp_p->timer[MFP68901_TIMER_C], ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor), which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor));
799799         }
800800         break;
801801      }
src/mess/machine/amigafdc.c
r1681r1682
1515#include "amiga.h"
1616#include "amigafdc.h"
1717#include "machine/6526cia.h"
18#include "mslegacy.h"
1918
2019
2120#define MAX_TRACK_BYTES         12500
r1681r1682
277276      time = ONE_SECTOR_BYTES;
278277      time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
279278      time *= 8;
280      timer_adjust( fdc_status[drive].sync_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero );
279      timer_adjust_oneshot(fdc_status[drive].sync_timer, ATTOTIME_IN_USEC( time ), drive);
281280      return;
282281   }
283282
r1681r1682
354353         time = len_words * 2;
355354         time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
356355         time *= 8;
357         timer_adjust( fdc_status[drive].dma_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero );
356         timer_adjust_oneshot(fdc_status[drive].dma_timer, ATTOTIME_IN_USEC( time ), drive);
358357         return;
359358      }
360359   }
r1681r1682
425424   time += len_words * 2;
426425   time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
427426   time *= 8;
428   timer_adjust( fdc_status[drive].dma_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero );
427   timer_adjust_oneshot(fdc_status[drive].dma_timer, ATTOTIME_IN_USEC( time ), drive);
429428
430429   return;
431430
r1681r1682
601600   /* Issue a index pulse when a disk revolution completes */
602601   cia_issue_index(1);
603602
604   timer_adjust(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive, attotime_zero);
603   timer_adjust_oneshot(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive);
605604   fdc_status[drive].rev_timer_started = 1;
606605
607606   if ( fdc_status[drive].is_ext_image == 0 )
r1681r1682
610609      time = GAP_TRACK_BYTES + 6;
611610      time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
612611      time *= 8;
613      timer_adjust( fdc_status[drive].sync_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero );
612      timer_adjust_oneshot(fdc_status[drive].sync_timer, ATTOTIME_IN_USEC( time ), drive);
614613   }
615614}
616615
r1681r1682
622621      return;
623622   }
624623
625   timer_adjust(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive, attotime_zero);
624   timer_adjust_oneshot(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive);
626625   fdc_status[drive].rev_timer_started = 1;
627626}
628627
src/mess/machine/z80dart.c
r1681r1682
88***************************************************************************/
99
1010#include "driver.h"
11#include "mslegacy.h"
1211#include "z80dart.h"
1312#include "cpu/z80/z80.h"
1413#include "cpu/z80/z80daisy.h"
r1681r1682
309308   interrupt_check(dart);
310309
311310   /* start the receive timer running */
312   timer_adjust(chan->receive_timer, tpc, ((dart - darts) << 1) | ch, tpc);
311   timer_adjust_periodic(chan->receive_timer, tpc, ((dart - darts) << 1) | ch, tpc);
313312}
314313
315314
src/mess/machine/amigakbd.c
r1681r1682
99#include "amiga.h"
1010#include "amigakbd.h"
1111#include "machine/6526cia.h"
12#include "mslegacy.h"
1312
1413
1514#define KEYBOARD_BUFFER_SIZE   256
r1681r1682
5150   /* if we still have more data, schedule another update */
5251   if ( key_buf_pos != key_cur_pos )
5352   {
54      timer_adjust( kbd_timer, attotime_div(video_screen_get_frame_period(0),4), 0, attotime_zero);
53      timer_adjust_oneshot(kbd_timer, attotime_div(video_screen_get_frame_period(0),4), 0);
5554   }
5655}
5756
r1681r1682
9190      /* if the buffer was empty and we have new data, start a timer to send the keystrokes */
9291      if ( key_buf_was_empty && ( key_buf_pos != key_cur_pos ) )
9392      {
94         timer_adjust( kbd_timer, attotime_div(video_screen_get_frame_period(0),4), 0, attotime_zero);
93         timer_adjust_oneshot(kbd_timer, attotime_div(video_screen_get_frame_period(0),4), 0);
9594      }
9695   }
9796}
src/mess/machine/matsucd.c
r1681r1682
1616#include "devices/chd_cd.h"
1717#include "sound/cdda.h"
1818#include "machine/matsucd.h"
19#include "mslegacy.h"
2019
2120
2221#define MATSU_STATUS_READY      ( 1 << 0 )   /* driver ready */
r1681r1682
151150   if (cddanum != -1)
152151   {
153152      cdda_start_audio(cddanum, lba, num_blocks);
154      timer_adjust( cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0, attotime_zero );
153      timer_adjust_oneshot(cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0);
155154   }
156155}
157156
r1681r1682
168167      }
169168      else
170169      {
171         timer_adjust( cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0, attotime_zero );
170         timer_adjust_oneshot(cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0);
172171      }
173172   }
174173}
r1681r1682
298297
299298         newstatus |= MATSU_STATUS_PLAYING;
300299
301         timer_adjust( cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0, attotime_zero );
300         timer_adjust_oneshot(cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0);
302301      }
303302      else
304303      {
src/mess/machine/tms9902.c
r1681r1682
66
77#include <math.h>
88#include "driver.h"
9#include "mslegacy.h"
109
1110#include "tms9902.h"
1211
r1681r1682
281280{
282281   if (tms9902[which].TMR)
283282   {   /* reset clock interval */
284      timer_adjust(tms9902[which].timer,
283      timer_adjust_periodic(tms9902[which].timer,
285284                  double_to_attotime((double) tms9902[which].TMR / (tms9902[which].clock_rate / ((tms9902[which].CLK4M) ? 4. : 3.) / 64.)),
286285                  which,
287286                  double_to_attotime((double) tms9902[which].TMR / (tms9902[which].clock_rate / ((tms9902[which].CLK4M) ? 4. : 3.) / 64.)));
src/mess/machine/osborne1.c
r1681r1682
1616
1717#include "driver.h"
1818#include "deprecat.h"
19#include "mslegacy.h"
2019#include "cpu/z80/z80.h"
2120#include "machine/6821pia.h"
2221#include "machine/6850acia.h"
r1681r1682
358357      beep_set_state( 0, 0 );
359358   }
360359
361   timer_adjust( osborne1.video_timer, video_screen_get_time_until_pos( 0, y + 1, 0 ), 0, attotime_never );
360   timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos( 0, y + 1, 0 ), 0);
362361}
363362
364363/*
r1681r1682
435434   memset( mess_ram + 0x10000, 0xFF, 0x1000 );
436435
437436   osborne1.video_timer = timer_alloc( osborne1_video_callback , NULL);
438   timer_adjust( osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0, attotime_never );
437   timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0);
439438   pia_1_ca1_w( 0, 0 );
440439
441440   timer_set( attotime_zero, NULL, 0, setup_beep );
src/mess/machine/sms.c
r1681r1682
22#include "driver.h"
33#include "image.h"
44#include "deprecat.h"
5#include "mslegacy.h"
65#include "includes/sms.h"
76#include "video/smsvdp.h"
87#include "sound/2413intf.h"
r1681r1682
945944   rapid_fire_state_1 = 0;
946945   rapid_fire_state_2 = 0;
947946   rapid_fire_timer = timer_alloc( rapid_fire_callback , NULL);
948   timer_adjust( rapid_fire_timer, ATTOTIME_IN_HZ(10), 0, ATTOTIME_IN_HZ(10) );
947   timer_adjust_periodic(rapid_fire_timer, ATTOTIME_IN_HZ(10), 0, ATTOTIME_IN_HZ(10));
949948
950949   last_paddle_read_time = 0;
951950   paddle_read_state = 0;
src/mess/machine/wd17xx.c
r1681r1682
3737
3838#include "driver.h"
3939#include "deprecat.h"
40#include "mslegacy.h"
4140#include "machine/wd17xx.h"
4241#include "devices/flopdrv.h"
4342
r1681r1682
314313static void wd17xx_set_busy(wd17xx_info *w, attotime duration)
315314{
316315   w->status |= STA_1_BUSY;
317   timer_adjust(busy_timer, duration, 0, attotime_zero);
316   timer_adjust_oneshot(busy_timer, duration, 0);
318317}
319318
320319
r1681r1682
832831   usecs *= delay;
833832
834833   /* set new timer */
835   timer_adjust(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_COMMAND, attotime_zero);
834   timer_adjust_oneshot(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_COMMAND);
836835}
837836
838837
r1681r1682
10141013   usecs = floppy_drive_get_datarate_in_us(w->density);
10151014
10161015   /* set new timer */
1017   timer_adjust(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_DATA, attotime_zero);
1016   timer_adjust_oneshot(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_DATA);
10181017}
10191018
10201019
src/mess/machine/pc_mouse.c
r1681r1682
99#include "driver.h"
1010#include "machine/uart8250.h"
1111#include "includes/pc_mouse.h"
12#include "mslegacy.h"
1312
1413
1514static struct {
r1681r1682
230229         }
231230
232231         /* start a timer to scan the mouse input */
233         timer_adjust(pc_mouse.timer, attotime_zero, pc_mouse.serial_port, ATTOTIME_IN_HZ(240));
232         timer_adjust_periodic(pc_mouse.timer, attotime_zero, pc_mouse.serial_port, ATTOTIME_IN_HZ(240));
234233      }
235234      else
236235      {
237236         /* CTS just went to 0 */
238         timer_adjust(pc_mouse.timer, attotime_zero, pc_mouse.serial_port, attotime_zero);
237         timer_adjust_oneshot(pc_mouse.timer, attotime_zero, pc_mouse.serial_port);
239238         pc_mouse.head = pc_mouse.tail = 0;
240239      }
241240   }
src/mess/machine/hd63450.c
r1681r1682
66
77#include "machine/hd63450.h"
88#include "deprecat.h"
9#include "mslegacy.h"
109
10
1111static struct hd63450 dmac;
1212
1313static TIMER_CALLBACK(dma_transfer_timer);
r1681r1682
207207   if((dmac.reg[channel].dcr & 0xc0) == 0x00)  // Burst transfer
208208   {
209209      cpunum_set_input_line(Machine, dmac.intf->cpu,INPUT_LINE_HALT,ASSERT_LINE);
210      timer_adjust(dmac.timer[channel],attotime_zero,channel, dmac.intf->burst_clock[channel]);
210      timer_adjust_periodic(dmac.timer[channel], attotime_zero, channel, dmac.intf->burst_clock[channel]);
211211   }
212212   else
213      timer_adjust(dmac.timer[channel],ATTOTIME_IN_USEC(500),channel, dmac.intf->clock[channel]);
213      timer_adjust_periodic(dmac.timer[channel], ATTOTIME_IN_USEC(500), channel, dmac.intf->clock[channel]);
214214
215215
216216   dmac.transfer_size[channel] = dmac.reg[channel].mtc;
r1681r1682
226226static void dma_transfer_abort(int channel)
227227{
228228   logerror("DMA#%i: Transfer aborted\n",channel);
229   timer_adjust(dmac.timer[channel],attotime_zero,0,attotime_zero);
229   timer_adjust_oneshot(dmac.timer[channel], attotime_zero, 0);
230230   dmac.in_progress[channel] = 0;
231231   dmac.reg[channel].mtc = dmac.transfer_size[channel];
232232   dmac.reg[channel].csr |= 0xe0;  // channel operation complete, block transfer complete
r1681r1682
236236static void dma_transfer_halt(int channel)
237237{
238238   dmac.halted[channel] = 1;
239   timer_adjust(dmac.timer[channel],attotime_zero,0,attotime_zero);
239   timer_adjust_oneshot(dmac.timer[channel], attotime_zero, 0);
240240}
241241
242242static void dma_transfer_continue(int channel)
r1681r1682
244244   if(dmac.halted[channel] != 0)
245245   {
246246      dmac.halted[channel] = 0;
247      timer_adjust(dmac.timer[channel],attotime_zero,channel, dmac.intf->clock[channel]);
247      timer_adjust_periodic(dmac.timer[channel], attotime_zero, channel, dmac.intf->clock[channel]);
248248   }
249249}
250250
r1681r1682
363363               dmac.reg[x].mtc = program_read_word(dmac.reg[x].bar+4);
364364               return;
365365            }
366            timer_adjust(dmac.timer[x],attotime_zero,0,attotime_zero);
366            timer_adjust_oneshot(dmac.timer[x], attotime_zero, 0);
367367            dmac.in_progress[x] = 0;
368368            dmac.reg[x].mtc = dmac.transfer_size[x];
369369            dmac.reg[x].csr |= 0xe0;  // channel operation complete, block transfer complete
src/mess/machine/pce.c
r1681r1682
11
22#include "driver.h"
33#include "deprecat.h"
4#include "mslegacy.h"
54#include "video/vdc.h"
65#include "cpu/h6280/h6280.h"
76#include "includes/pce.h"
r1681r1682
357356   if ( frame_count == 0 ) {
358357      pce_cd_reply_status_byte( SCSI_STATUS_OK );
359358   } else {
360      timer_adjust( pce_cd.data_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ) );
359      timer_adjust_periodic(pce_cd.data_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ));
361360   }
362361}
363362
r1681r1682
789788         /* We are done, disable the timer */
790789         logerror("Last frame read from CD\n");
791790         pce_cd.data_transferred = 1;
792         timer_adjust( pce_cd.data_timer, attotime_never, 0, attotime_never );
791         timer_adjust_oneshot(pce_cd.data_timer, attotime_never, 0);
793792      } else {
794793         pce_cd.data_transferred = 0;
795794      }
r1681r1682
834833   }
835834
836835   pce_cd.data_timer = timer_alloc( pce_cd_data_timer_callback , NULL);
837   timer_adjust( pce_cd.data_timer, attotime_never, 0, attotime_never );
836   timer_adjust_oneshot(pce_cd.data_timer, attotime_never, 0);
838837   pce_cd.adpcm_dma_timer = timer_alloc( pce_cd_adpcm_dma_timer_callback , NULL);
839   timer_adjust( pce_cd.adpcm_dma_timer, attotime_never, 0, attotime_never );
838   timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
840839}
841840
842841WRITE8_HANDLER( pce_cd_bram_w ) {
r1681r1682
890889   case 0x0B:   /* ADPCM DMA control */
891890      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) ) {
892891         /* Start CD to ADPCM transfer */
893         timer_adjust( pce_cd.adpcm_dma_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) );
892         timer_adjust_periodic(pce_cd.adpcm_dma_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) );
894893      }
895894      if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) ) {
896895         /* Stop CD to ADPCM transfer (?) */
897         timer_adjust( pce_cd.adpcm_dma_timer, attotime_never, 0, attotime_never );
896         timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
898897      }
899898      break;
900899   case 0x0C:   /* ADPCM status */
src/mess/machine/tms5501.c
r1681r1682
1616
1717#include "driver.h"
1818#include "tms5501.h"
19#include "mslegacy.h"
2019
20
2121#define DEBUG_TMS5501   0
2222
2323#define LOG_TMS5501(n, message, data) do { if (DEBUG_TMS5501) logerror ("TMS5501 %d: %s %02x\n", n, message, data); } while (0)
r1681r1682
212212{
213213   if (tms5501[which].timer_counter[timer])
214214   {   /* reset clock interval */
215      timer_adjust(tms5501[which].timer[timer], double_to_attotime((double) tms5501[which].timer_counter[0] / (tms5501[which].clock_rate / 128.)), which, double_to_attotime((double) tms5501[which].timer_counter[timer] / (tms5501[which].clock_rate / 128.)));
215      timer_adjust_periodic(tms5501[which].timer[timer], double_to_attotime((double) tms5501[which].timer_counter[0] / (tms5501[which].clock_rate / 128.)), which, double_to_attotime((double) tms5501[which].timer_counter[timer] / (tms5501[which].clock_rate / 128.)));
216216   }
217217   else
218218   {   /* clock interval == 0 -> no timer */
src/mess/machine/sgi.c
r1681r1682
99#include "driver.h"
1010#include "sgi.h"
1111#include "deprecat.h"
12#include "mslegacy.h"
1312
13
1414#define VERBOSE_LEVEL ( 1 )
1515
1616INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... )
r1681r1682
576576   nMC_DMAMode = 0;
577577   nMC_DMAZoomByteCnt = 0;
578578   tMC_UpdateTimer = timer_alloc( mc_update_callback , NULL);
579   timer_adjust( tMC_UpdateTimer, ATTOTIME_IN_HZ(10000), 0, ATTOTIME_IN_HZ(10000) );
579   timer_adjust_periodic(tMC_UpdateTimer, ATTOTIME_IN_HZ(10000), 0, ATTOTIME_IN_HZ(10000));
580580
581581   // if Indigo2, ID appropriately
582582   if (!strcmp(Machine->gamedrv->name, "ip244415"))
src/mess/machine/vc20tape.c
r1681r1682
233233      if (tape.motor && tape.play)
234234      {
235235         wav.state = 3;
236         timer_adjust(wav.timer, 0, 0, 1.0 / wav.sample->smpfreq);
236         timer_adjust_periodic(wav.timer, 0, 0, 1.0 / wav.sample->smpfreq);
237237         break;
238238      }
239239      if (tape.motor && tape.record)
src/mess/machine/bbc.c
r1681r1682
1111#include "ctype.h"
1212#include "driver.h"
1313#include "deprecat.h"
14#include "mslegacy.h"
1514#include "cpu/m6502/m6502.h"
1615#include "machine/6522via.h"
1716#include "machine/wd17xx.h"
r1681r1682
14531452   if (status)
14541453   {
14551454      cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0),CASSETTE_MOTOR_ENABLED ,CASSETTE_MASK_MOTOR);
1456      timer_adjust(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
1455      timer_adjust_periodic(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
14571456   } else {
14581457      cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
14591458      timer_reset(bbc_tape_timer, attotime_never);
src/mess/machine/compis.c
r1681r1682
1414
1515#include "driver.h"
1616#include "deprecat.h"
17#include "mslegacy.h"
1817#include "cpu/i86/i186intf.h"
1918#include "video/i82720.h"
2019#include "machine/8255ppi.h"
r1681r1682
2726#include "devices/basicdsk.h"
2827#include "devices/printer.h"
2928
29
3030/*-------------------------------------------------------------------------*/
3131/* Defines, constants, and global variables                                */
3232/*-------------------------------------------------------------------------*/
r1681r1682
778778   if (t->control & 0x0001)
779779   {
780780      int count = t->maxA ? t->maxA : 0x10000;
781      timer_adjust(t->int_timer, attotime_mul(ATTOTIME_IN_HZ(2000000), count), which, attotime_zero);
781      timer_adjust_oneshot(t->int_timer, attotime_mul(ATTOTIME_IN_HZ(2000000), count), which);
782782      if (LOG_TIMER) logerror("  Repriming interrupt\n");
783783   }
784784   else
785      timer_adjust(t->int_timer, attotime_never, which, attotime_zero);
785      timer_adjust_oneshot(t->int_timer, attotime_never, which);
786786}
787787
788788
r1681r1682
893893            internal_timer_sync(which);
894894
895895            /* nuke the timer and force the interrupt timer to be recomputed */
896            timer_adjust(t->time_timer, attotime_never, which, attotime_zero);
896            timer_adjust_oneshot(t->time_timer, attotime_never, which);
897897            t->time_timer_active = 0;
898898            update_int_timer = 1;
899899         }
r1681r1682
902902         else if ((diff & 0x8000) && (new_control & 0x8000))
903903         {
904904            /* start the timing */
905            timer_adjust(t->time_timer, attotime_never, which, attotime_zero);
905            timer_adjust_oneshot(t->time_timer, attotime_never, which);
906906            t->time_timer_active = 1;
907907            update_int_timer = 1;
908908         }
r1681r1682
927927              int diff = t->maxA - t->count;
928928               if (diff <= 0)
929929                  diff += 0x10000;
930               timer_adjust(t->int_timer, attotime_mul(ATTOTIME_IN_HZ(2000000), diff), which, attotime_zero);
930               timer_adjust_oneshot(t->int_timer, attotime_mul(ATTOTIME_IN_HZ(2000000), diff), which);
931931               if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which);
932932            }
933933            else
934934            {
935              timer_adjust(t->int_timer, attotime_never, which, attotime_zero);
935              timer_adjust_oneshot(t->int_timer, attotime_never, which);
936936      }
937937   }
938938}
r1681r1682
10141014         if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
10151015
10161016         d->finished = 0;
1017/*         timer_adjust(d->finish_timer,
1018         ATTOTIME_IN_HZ(dac[dacnum].frequency) * (double)count, which, 0);*/
1017/*         timer_adjust_oneshot(d->finish_timer,
1018         ATTOTIME_IN_HZ(dac[dacnum].frequency) * (double)count, which);*/
10191019      }
10201020   }
10211021
src/mess/machine/kc.c
r1681r1682
11/* Core includes */
22#include "driver.h"
33#include "deprecat.h"
4#include "mslegacy.h"
54#include "includes/kc.h"
65
76/* Components */
r1681r1682
434433      if (motor_state)
435434      {
436435         /* start timer */
437         timer_adjust(kc_cassette_timer, attotime_zero, 0, KC_CASSETTE_TIMER_FREQUENCY);
436         timer_adjust_periodic(kc_cassette_timer, attotime_zero, 0, KC_CASSETTE_TIMER_FREQUENCY);
438437      }
439438      else
440439      {
src/mess/machine/corvushd.c
r1681r1682
6464//
6565
6666#include "driver.h"
67#include "mslegacy.h"
6867#include "devices/harddriv.h"
6968#include "includes/corvushd.h"
7069#include <ctype.h>
7170
71
7272#define VERBOSE 0
7373#define VERBOSE_RESPONSES 0
7474#define VERSION 1
r1681r1682
14551455   c->recv_bytes = 0;                     // We aren't waiting on additional data from the host
14561456
14571457   c->timeout_timer = timer_alloc(corvus_hdc_callback, NULL);   // Set up a timer to handle the four-second host-to-controller timeout
1458   timer_adjust(c->timeout_timer, ATTOTIME_IN_SEC(4), CALLBACK_TIMEOUT, attotime_zero);
1458   timer_adjust_oneshot(c->timeout_timer, ATTOTIME_IN_SEC(4), CALLBACK_TIMEOUT);
14591459   timer_enable(c->timeout_timer, 0);      // Start this timer out disabled
14601460
14611461   LOG(("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors));
src/mess/drivers/nc.c
r1681r1682
9595
9696#include "driver.h"
9797#include "deprecat.h"
98#include "mslegacy.h"
9998#include "includes/nc.h"
10099#include "includes/serial.h"   /* for serial data transfers */
101100#include "machine/msm8251.h"   /* for NC100 uart */
r1681r1682
593592
594593   /* keyboard timer */
595594   nc_keyboard_timer = timer_alloc(nc_keyboard_timer_callback, NULL);
596   timer_adjust(nc_keyboard_timer, ATTOTIME_IN_MSEC(10), 0, attotime_zero);
595   timer_adjust_oneshot(nc_keyboard_timer, ATTOTIME_IN_MSEC(10), 0);
597596
598597   /* dummy timer */
599598   timer_pulse(ATTOTIME_IN_HZ(50), NULL, 0, dummy_timer_callback);
r1681r1682
798797      }
799798   }
800799
801   timer_adjust(nc_serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate_table[(data & 0x07)]));
800   timer_adjust_periodic(nc_serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate_table[(data & 0x07)]));
802801
803802   nc_uart_control = data;
804803}
src/mess/drivers/tm990189.c
r1681r1682
3838*/
3939
4040#include "driver.h"
41#include "deprecat.h"
42#include "mslegacy.h"
4143#include "cpu/tms9900/tms9900.h"
4244#include "machine/tms9901.h"
4345#include "machine/tms9902.h"
4446#include "video/tms9928a.h"
4547#include "devices/cassette.h"
4648#include "sound/speaker.h"
47#include "mslegacy.h"
48#include "deprecat.h"
4949
50
5051static int load_state;
5152static int ic_state;
5253
r1681r1682
489490
490491   tms9902_set_dsr(id, 1);
491492   rs232_input_timer = timer_alloc(rs232_input_callback, NULL);
492   timer_adjust(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10));
493   timer_adjust_periodic(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10));
493494
494495   return INIT_PASS;
495496}
src/mess/drivers/abc80.c
r1681r1682
7979#include "machine/z80pio.h"
8080#include "sound/sn76477.h"
8181#include "machine/abcbus.h"
82#include "mslegacy.h"
8382
8483/* Devices */
8584#include "devices/basicdsk.h"
r1681r1682
447446   state_save_register_global(keylatch);
448447
449448   abc80_keyboard_timer = timer_alloc(abc80_keyboard_tick, NULL);
450   timer_adjust(abc80_keyboard_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2500));
449   timer_adjust_periodic(abc80_keyboard_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2500));
451450}
452451
453452/* Machine Drivers */
src/mess/drivers/x68k.c
r1681r1682
127127#include "driver.h"
128128#include "render.h"
129129#include "deprecat.h"
130#include "mslegacy.h"
131130#include "cpu/m68000/m68000.h"
132131#include "machine/68901mfp.h"
133132#include "machine/8255ppi.h"
r1681r1682
140139#include "devices/basicdsk.h"
141140#include "includes/x68k.h"
142141
142
143143struct x68k_system sys;
144144
145145extern UINT16* gvram;  // Graphic VRAM
r1681r1682
210210    mfp_timer[2] = timer_alloc(mfp_timer_c_callback, NULL);
211211    mfp_timer[3] = timer_alloc(mfp_timer_d_callback, NULL);
212212    mfp_irq = timer_alloc(mfp_update_irq, NULL);
213    timer_adjust(mfp_irq, attotime_zero, 0, ATTOTIME_IN_USEC(32));
213    timer_adjust_periodic(mfp_irq, attotime_zero, 0, ATTOTIME_IN_USEC(32));
214214*/
215215}
216216/*
r1681r1682
331331{
332332    if((data & 0x07) == 0x0000)
333333    {  // Timer stop
334        timer_adjust(mfp_timer[timer],attotime_zero,0,attotime_zero);
334        timer_adjust_oneshot(mfp_timer[timer], attotime_zero, 0);
335335        logerror("MFP: Timer #%i stopped. \n",timer);
336336        return;
337337    }
338338
339    timer_adjust(mfp_timer[timer], attotime_zero, 0, prescale(data & 0x07));
339    timer_adjust_periodic(mfp_timer[timer], attotime_zero, 0, prescale(data & 0x07));
340340    logerror("MFP: Timer #%i set to %2.1fus\n",timer, attotime_to_double(prescale(data & 0x07)) * 1000000);
341341
342342}
r1681r1682
18961896   // start VBlank timer
18971897   sys.crtc.vblank = 1;
18981898   irq_time = video_screen_get_time_until_pos(0,sys.crtc.reg[6],2);
1899   timer_adjust(vblank_irq,irq_time,0,attotime_never);
1899   timer_adjust_oneshot(vblank_irq, irq_time, 0);
19001900
19011901   // start HBlank timer
1902   timer_adjust(scanline_timer,video_screen_get_scan_period(0),1,attotime_never);
1902   timer_adjust_oneshot(scanline_timer, video_screen_get_scan_period(0), 1);
19031903
19041904   sys.mfp.gpio = 0xfb;
19051905}
r1681r1682
19221922   memory_set_bankptr(4,generic_nvram16);  // so that code in SRAM is executable, there is an option for booting from SRAM
19231923
19241924   // start keyboard timer
1925   timer_adjust(kb_timer,attotime_zero,0,ATTOTIME_IN_MSEC(5));  // every 5ms
1925   timer_adjust_periodic(kb_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(5));  // every 5ms
19261926
19271927   // start mouse timer
1928   timer_adjust(mouse_timer,attotime_zero,0,ATTOTIME_IN_MSEC(1));  // a guess for now
1928   timer_adjust_periodic(mouse_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(1));  // a guess for now
19291929   sys.mouse.inputtype = 0;
19301930}
19311931
src/mess/drivers/atarist.c
r1681r1682
11#include "driver.h"
22#include "deprecat.h"
3#include "mslegacy.h"
43#include "video/atarist.h"
54#include "cpu/m68000/m68k.h"
65#include "cpu/m68000/m68000.h"
r1681r1682
598597      if (!dmasound.active)
599598      {
600599         atariste_dmasound_set_state(1);
601         timer_adjust(dmasound_timer, attotime_zero, 0, ATTOTIME_IN_HZ(DMASOUND_RATE[dmasound.mode & 0x03]));
600         timer_adjust_periodic(dmasound_timer, attotime_zero, 0, ATTOTIME_IN_HZ(DMASOUND_RATE[dmasound.mode & 0x03]));
602601      }
603602   }
604603   else
r1681r1682
713712   if (!timer_enabled(microwire_timer))
714713   {
715714      mwire.data = data;
716      timer_adjust(microwire_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2));
715      timer_adjust_periodic(microwire_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2));
717716   }
718717}
719718
src/mess/drivers/exidy.c
r1681r1682
9494#include "devices/printer.h"
9595#include "devices/z80bin.h"
9696#include "sound/speaker.h"
97#include "mslegacy.h"
9897
9998
10099static int device_load_exidy_floppy(mess_image *image)
r1681r1682
465464         /* both are now off */
466465
467466         /* stop timer */
468         timer_adjust(cassette_timer, attotime_zero, 0, attotime_zero);
467         timer_adjust_oneshot(cassette_timer, attotime_zero, 0);
469468      }
470469      else
471470      {
r1681r1682
477476            cassette_clock_state = 0;
478477            /* start timer */
479478            /* the correct baud rate should be being used here (see bit 6 below) */
480            timer_adjust(cassette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800));
479            timer_adjust_periodic(cassette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800));
481480         }
482481      }
483482   }
r1681r1682
514513         baud_rate = 1200;
515514      }
516515
517      timer_adjust(serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate));
516      timer_adjust_periodic(serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate));
518517   }
519518
520519   exidy_fe = data;
src/mess/drivers/a2600.c
r1681r1682
1313#include "formats/a26_cas.h"
1414#include "video/tia.h"
1515#include "deprecat.h"
16#include "mslegacy.h"
1716
17
1818#define CART memory_region(REGION_USER1)
1919
2020#define MASTER_CLOCK_NTSC   3579545
r1681r1682
17431743         }
17441744      }
17451745      dpc.oscillator = timer_alloc( modeDPC_timer_callback , NULL);
1746      timer_adjust( dpc.oscillator, ATTOTIME_IN_HZ(42000), 0, ATTOTIME_IN_HZ(42000) );
1746      timer_adjust_periodic(dpc.oscillator, ATTOTIME_IN_HZ(42000), 0, ATTOTIME_IN_HZ(42000));
17471747      break;
17481748
17491749   case mode32in1:
src/mess/drivers/ql.c
r1681r1682
11#include "driver.h"
22#include "deprecat.h"
3#include "mslegacy.h"
43#include "cpu/i8039/i8039.h"
54#include "cpu/m68000/m68000.h"
65#include "devices/cartslot.h"
r1681r1682
212211
213212   zx8302.tcr = data;
214213
215   timer_adjust(zx8302_txd_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud));
216   timer_adjust(zx8302_ipc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baudx4));
214   timer_adjust_periodic(zx8302_txd_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud));
215   timer_adjust_periodic(zx8302_ipc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baudx4));
217216}
218217
219218static UINT8 zx8302_get_microdrive_status(void)
r1681r1682
878877   zx8302_rtc_timer = timer_alloc(zx8302_rtc_tick, NULL);
879878   zx8302_gap_timer = timer_alloc(zx8302_gap_tick, NULL);
880879
881   timer_adjust(zx8302_rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(X2/32768));
882   timer_adjust(zx8302_gap_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(31));
880   timer_adjust_periodic(zx8302_rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(X2/32768));
881   timer_adjust_periodic(zx8302_gap_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(31));
883882
884883   zx8302.ctr = time(NULL) + 283996800;
885884
src/mess/drivers/abc80x.c
r1681r1682
7070
7171/* Core includes */
7272#include "driver.h"
73#include "mslegacy.h"
7374#include "includes/abc80x.h"
74#include "mslegacy.h"
7575
7676/* Components */
7777#include "cpu/z80/z80daisy.h"
r1681r1682
658658   state_save_register_global(abc77_clock);
659659
660660   abc800_ctc_timer = timer_alloc(abc800_ctc_tick, NULL);
661   timer_adjust(abc800_ctc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC800_X01/2/2/2));
661   timer_adjust_periodic(abc800_ctc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC800_X01/2/2/2));
662662
663663   z80ctc_init(0, &abc800_ctc_intf);
664664   z80sio_init(0, &abc800_sio_intf);
src/mess/drivers/a310.c
r1681r1682
3535#include "cpu/arm/arm.h"
3636#include "sound/dac.h"
3737#include "deprecat.h"
38#include "mslegacy.h"
3938
4039
4140// interrupt register stuff
r1681r1682
130129   a310_request_irq_a(A310_IRQA_VBL);
131130
132131   // set up for next vbl
133   timer_adjust(vbl_timer, video_screen_get_time_until_pos(0, a310_vidregs[0xb4], 0), 0, attotime_never);
132   timer_adjust_oneshot(vbl_timer, video_screen_get_time_until_pos(0, a310_vidregs[0xb4], 0), 0);
134133}
135134
136135static void a310_set_timer(int tmr)
r1681r1682
139138
140139//  logerror("IOC: starting timer %d, %d ticks, freq %f Hz\n", tmr, a310_timercnt[tmr], freq);
141140
142   timer_adjust(timer[tmr], ATTOTIME_IN_HZ(freq), tmr, attotime_never);
141   timer_adjust_oneshot(timer[tmr], ATTOTIME_IN_HZ(freq), tmr);
143142}
144143
145144// param
r1681r1682
208207   wd17xx_init(WD_TYPE_1772, a310_wd177x_callback, NULL);
209208
210209   vbl_timer = timer_alloc(a310_vblank, NULL);
211   timer_adjust(vbl_timer, attotime_never, 0, attotime_never);
210   timer_adjust_oneshot(vbl_timer, attotime_never, 0);
212211
213212   timer[0] = timer_alloc(a310_timer, NULL);
214213   timer[1] = timer_alloc(a310_timer, NULL);
215214   timer[2] = timer_alloc(a310_timer, NULL);
216215   timer[3] = timer_alloc(a310_timer, NULL);
217   timer_adjust(timer[0], attotime_never, 0, attotime_never);
218   timer_adjust(timer[1], attotime_never, 0, attotime_never);
219   timer_adjust(timer[2], attotime_never, 0, attotime_never);
220   timer_adjust(timer[3], attotime_never, 0, attotime_never);
216   timer_adjust_oneshot(timer[0], attotime_never, 0);
217   timer_adjust_oneshot(timer[1], attotime_never, 0);
218   timer_adjust_oneshot(timer[2], attotime_never, 0);
219   timer_adjust_oneshot(timer[3], attotime_never, 0);
221220
222221   snd_timer = timer_alloc(a310_audio_tick, NULL);
223   timer_adjust(snd_timer, attotime_never, 0, attotime_never);
222   timer_adjust_oneshot(snd_timer, attotime_never, 0);
224223
225224   // reset the DAC to centerline
226225   DAC_signed_data_w(0, 0x80);
r1681r1682
591590         video_screen_configure(0, a310_vidregs[0x80], a310_vidregs[0xa0], &visarea, Machine->screen[0].refresh);
592591
593592         // slightly hacky: fire off a VBL right now.  the BIOS doesn't wait long enough otherwise.
594         timer_adjust(vbl_timer, attotime_zero, 0, attotime_never);
593         timer_adjust_oneshot(vbl_timer, attotime_zero, 0);
595594      }
596595
597596      a310_vidregs[reg] = val>>12;
r1681r1682
638637
639638               a310_sndcur = a310_sndstart;
640639
641               timer_adjust(snd_timer, ATTOTIME_IN_HZ(sndhz), 0, ATTOTIME_IN_HZ(sndhz));
640               timer_adjust_periodic(snd_timer, ATTOTIME_IN_HZ(sndhz), 0, ATTOTIME_IN_HZ(sndhz));
642641            }
643642            else
644643            {
645               timer_adjust(snd_timer, attotime_never, 0, attotime_never);
644               timer_adjust_oneshot(snd_timer, attotime_never, 0);
646645               DAC_signed_data_w(0, 0x80);
647646            }
648647            break;
src/mess/drivers/tutor.c
r1681r1682
7474
7575#include "driver.h"
7676#include "deprecat.h"
77#include "mslegacy.h"
7877#include "cpu/tms9900/tms9900.h"
7978#include "video/tms9928a.h"
8079#include "devices/cartslot.h"
r1681r1682
291290         {
292291            tape_interrupt_enable = ! data;
293292            if (tape_interrupt_enable)
294               timer_adjust(tape_interrupt_timer, /*ATTOTIME_IN_HZ(44100)*/attotime_zero, 0, ATTOTIME_IN_HZ(44100));
293               timer_adjust_periodic(tape_interrupt_timer, /*ATTOTIME_IN_HZ(44100)*/attotime_zero, 0, ATTOTIME_IN_HZ(44100));
295294            else
296295            {
297               timer_adjust(tape_interrupt_timer, attotime_never, 0, attotime_zero);
296               timer_adjust_oneshot(tape_interrupt_timer, attotime_never, 0);
298297               cpunum_set_input_line(Machine, 0, 1, CLEAR_LINE);
299298            }
300299         }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team