Previous 15994 Revisions Next

r8692 Monday 2nd August, 2010 at 13:20:40 UTC by Miodrag Milanović
Made things compile with current MAME code (due the address map changes).
Removed usage of :
- cputag_clocks_to_attotime()
- cputag_attotime_to_clocks()
- cputag_suspend()
- cputag_resume()

Note that some handlers are now commented it is due the fact that address map was not used and now it would return warning in compilation time, so they have been commented.
[src/mess/drivers]cgc7900.c genesis.c geneve.c intv.c m20.c px8.c spectrum.c svision.c tandy2k.c ti89.c trs80m2.c v1050.c victor9k.c x07.c x68k.c
[src/mess/machine]amigacrt.c coco.c dc.c gb.c geneve.c intv.c lynx.c microtan.c pc8801.c pce.c pdp1.c pokemini.c sms.c ti99_4x.c zx.c
[src/mess/video]gb.c vic6567.c zx.c

src/mess/machine/pdp1.c
r8691r8692
11721172      if (parallel_drum.wc)
11731173         delay = attotime_add(delay, PARALLEL_DRUM_WORD_TIME);
11741174   } while (parallel_drum.wc);
1175   cpu_adjust_icount(device->machine->device("maincpu"),-cputag_attotime_to_clocks(device->machine, "maincpu", delay));
1175   cpu_adjust_icount(device->machine->device("maincpu"),-device->machine->device<cpu_device>("maincpu")->attotime_to_cycles(delay));
11761176   /* if no error, skip */
11771177   cpu_set_reg(device->machine->device("maincpu"), PDP1_PC, cpu_get_reg(device->machine->device("maincpu"), PDP1_PC)+1);
11781178}
src/mess/machine/pokemini.c
r8691r8692
491491         int index = data & 0x07;
492492         int cycles = ( pm_reg[0x19] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
493493
494         timer_adjust_periodic(timers.timer1, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
494         timer_adjust_periodic(timers.timer1, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
495495      }
496496
497497      /* Check for prescaler change for the high counter */
r8691r8692
500500         int index = ( data >> 4 ) & 0x07;
501501         int cycles = ( pm_reg[0x19] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
502502
503         timer_adjust_periodic(timers.timer1_hi, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
503         timer_adjust_periodic(timers.timer1_hi, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
504504      }
505505
506506      /* Check if timer1 low should be enabled */
r8691r8692
541541         int index = pm_reg[0x18] & 0x07;
542542         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
543543
544         timer_adjust_periodic(timers.timer1, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
544         timer_adjust_periodic(timers.timer1, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
545545      }
546546
547547      /* Check for prescaler change for the low counter */
r8691r8692
550550         int index = ( pm_reg[0x18] >> 4 ) & 0x07;
551551         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
552552
553         timer_adjust_periodic(timers.timer1_hi, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
553         timer_adjust_periodic(timers.timer1_hi, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
554554      }
555555
556556      {
r8691r8692
620620         int index = data & 0x07;
621621         int cycles = ( pm_reg[0x1B] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
622622
623         timer_adjust_periodic(timers.timer2, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
623         timer_adjust_periodic(timers.timer2, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
624624      }
625625
626626      /* Check for prescaler change for the high counter */
r8691r8692
629629         int index = ( data >> 4 ) & 0x07;
630630         int cycles = ( pm_reg[0x1B] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
631631
632         timer_adjust_periodic(timers.timer2_hi, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
632         timer_adjust_periodic(timers.timer2_hi, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
633633      }
634634
635635      /* Check if timer2 low should be enabled */
r8691r8692
666666         int index = pm_reg[0x1A] & 0x07;
667667         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
668668
669         timer_adjust_periodic(timers.timer2, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
669         timer_adjust_periodic(timers.timer2, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
670670
671671         if ( ( pm_reg[0x1A] & 0x08 ) && ( pm_reg[0x38] & 0x04 ) &&
672672              ( ( ( pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
r8691r8692
686686         int index = ( pm_reg[0x1A] >> 4 ) & 0x07;
687687         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
688688
689         timer_adjust_periodic(timers.timer2_hi, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
689         timer_adjust_periodic(timers.timer2_hi, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
690690
691691         if ( ( pm_reg[0x1A] & 0x80 ) && ( pm_reg[0x39] & 0x04 ) && ! ( pm_reg[0x38] & 0x80 ) &&
692692              ( ( ( pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
r8691r8692
720720         int index = data & 0x07;
721721         int cycles = ( pm_reg[0x1D] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
722722
723         timer_adjust_periodic(timers.timer3, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
723         timer_adjust_periodic(timers.timer3, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
724724      }
725725
726726      /* Check for prescaler change for the high counter */
r8691r8692
729729         int index = ( data >> 4 ) & 0x07;
730730         int cycles = ( pm_reg[0x1D] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
731731
732         timer_adjust_periodic(timers.timer3_hi, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
732         timer_adjust_periodic(timers.timer3_hi, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
733733      }
734734
735735      /* Check if timer2 low should be enabled */
r8691r8692
766766         int index = pm_reg[0x1C] & 0x07;
767767         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
768768
769         timer_adjust_periodic(timers.timer3, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
769         timer_adjust_periodic(timers.timer3, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
770770
771771         if ( ( pm_reg[0x1C] & 0x08 ) && ( pm_reg[0x48] & 0x04 ) &&
772772              ( ( ( pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
r8691r8692
786786         int index = ( pm_reg[0x1C] >> 4 ) & 0x07;
787787         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
788788
789         timer_adjust_periodic(timers.timer3_hi, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "maincpu", cycles));
789         timer_adjust_periodic(timers.timer3_hi, attotime_zero, 0, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
790790
791791         if ( ( pm_reg[0x1C] & 0x80 ) && ( pm_reg[0x49] & 0x04 ) && ! ( pm_reg[0x48] & 0x80 ) &&
792792              ( ( ( pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
r8691r8692
16061606   /* Set up the PRC */
16071607   prc.max_frame_count = 2;
16081608   prc.count_timer = timer_alloc(machine,  pokemini_prc_counter_callback, NULL );
1609   timer_adjust_periodic( prc.count_timer, attotime_zero, 0, cputag_clocks_to_attotime(machine, "maincpu", 55640 / 65) );
1609   timer_adjust_periodic( prc.count_timer, attotime_zero, 0, machine->device<cpu_device>("maincpu")->cycles_to_attotime(55640 / 65) );
16101610}
16111611
src/mess/machine/coco.c
r8691r8692
10811081{
10821082   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, halt_line);
10831083   if (halt_line == CLEAR_LINE)
1084      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 1), NULL, 0, recalc_interrupts);
1084      timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), NULL, 0, recalc_interrupts);
10851085}
10861086#endif
10871087
src/mess/machine/gb.c
r8691r8692
850850      case 0x81:            /* enabled & internal clock */
851851         SIODATA = 0xFF;
852852         gb_driver_data.SIOCount = 8;
853         timer_adjust_periodic(gb_driver_data.gb_serial_timer, cputag_clocks_to_attotime(space->machine, "maincpu", 512), 0, cputag_clocks_to_attotime(space->machine, "maincpu", 512));
853         timer_adjust_periodic(gb_driver_data.gb_serial_timer, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(512), 0, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(512));
854854         timer_enable( gb_driver_data.gb_serial_timer, 1 );
855855         break;
856856      }
src/mess/machine/microtan.c
r8691r8692
404404        break;
405405    case 1: /* BFF1: write delayed NMI */
406406        LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data));
407        timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 8), NULL, 0, microtan_pulse_nmi);
407        timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8), NULL, 0, microtan_pulse_nmi);
408408        break;
409409    case 2: /* BFF2: write keypad column write (what is this meant for?) */
410410        LOG(("microtan_bff2_w: %d <- %02x (keypad column)\n", offset, data));
src/mess/machine/amigacrt.c
r8691r8692
101101
102102      /* trigger NMI irq */
103103      amiga_ar1_spurious = 0;
104      timer_set(machine,  cputag_clocks_to_attotime(machine, "maincpu", 28), NULL, 0, amiga_ar1_delayed_nmi );
104      timer_set(machine,  machine->device<cpu_device>("maincpu")->cycles_to_attotime(28), NULL, 0, amiga_ar1_delayed_nmi );
105105   }
106106}
107107
r8691r8692
118118      {
119119         /* trigger an NMI or spurious irq */
120120         amiga_ar1_spurious = (offset == 0x60/2) ? 0 : 1;
121         timer_set(space->machine,  cputag_clocks_to_attotime(space->machine, "maincpu", 28), NULL, 0, amiga_ar1_delayed_nmi );
121         timer_set(space->machine,  space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(28), NULL, 0, amiga_ar1_delayed_nmi );
122122      }
123123   }
124124
src/mess/machine/sms.c
r8691r8692
15321532   logerror("0x%04X: sms_store_control write 0x%02X\n", cpu_get_pc(space->cpu), data);
15331533   if (data & 0x02)
15341534   {
1535      cputag_resume(space->machine, "maincpu", SUSPEND_REASON_HALT);
1535      space->machine->device<cpu_device>("maincpu")->resume(SUSPEND_REASON_HALT);
15361536   }
15371537   else
15381538   {
15391539      /* Pull reset line of CPU #0 low */
15401540      space->machine->device("maincpu")->reset();
1541      cputag_suspend(space->machine, "maincpu", SUSPEND_REASON_HALT, 1);
1541      space->machine->device<cpu_device>("maincpu")->suspend(SUSPEND_REASON_HALT, 1);
15421542   }
15431543   sms_state.store_control = data;
15441544}
src/mess/machine/zx.c
r8691r8692
412412   else
413413   if (offs == 0xfe)
414414   {
415      timer_adjust_periodic(ula_nmi, attotime_zero, 0, cputag_clocks_to_attotime(space->machine, "maincpu", 207));
415      timer_adjust_periodic(ula_nmi, attotime_zero, 0, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(207));
416416
417417      LOG_ZX81_IOW("ULA NMIs on");
418418
src/mess/machine/dc.c
r8691r8692
126126      atapi_regs[ATAPI_REG_COUNTLOW] = atapi_xferlen & 0xff;
127127      atapi_regs[ATAPI_REG_COUNTHIGH] = (atapi_xferlen>>8)&0xff;
128128
129      timer_adjust_oneshot(atapi_timer, cputag_clocks_to_attotime(machine, "maincpu", (ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
129      timer_adjust_oneshot(atapi_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
130130   }
131131   else
132132   {
r8691r8692
717717         }
718718
719719         atapi_xferbase = g1bus_regs[SB_GDSTAR];
720         timer_adjust_oneshot(atapi_timer, cputag_clocks_to_attotime(space->machine, "maincpu", (ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
720         timer_adjust_oneshot(atapi_timer, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
721721      }
722722      break;
723723   }
src/mess/machine/lynx.c
r8691r8692
886886   }
887887
888888   if (0)
889      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", blitter.memory_accesses*20), NULL, 0, lynx_blitter_timer);
889      timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(blitter.memory_accesses*20), NULL, 0, lynx_blitter_timer);
890890}
891891
892892
r8691r8692
10051005      case 0x92:   /* Better check this with docs! */
10061006         if (!attotime_compare(blitter.time, attotime_zero))
10071007         {
1008            if (cputag_attotime_to_clocks(space->machine, "maincpu", attotime_sub(timer_get_time(space->machine), blitter.time)) > blitter.memory_accesses * 20)
1008            if (space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(attotime_sub(timer_get_time(space->machine), blitter.time)) > blitter.memory_accesses * 20)
10091009            {
10101010               suzy.data[offset] &= ~0x01; //blitter finished
10111011               blitter.time = attotime_zero;
src/mess/machine/geneve.c
r8691r8692
333333   if (! tms5220_readyq_r(space->machine->device("tmc0285")))
334334   {
335335      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(space->machine->device("tmc0285")));
336      int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
336      int cycles_to_ready = space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(time_to_ready);
337337
338338      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
339339
src/mess/machine/pc8801.c
r8691r8692
755755   use_5FD = (input_port_read(machine, "DSW2") & 0x80) != 0x00;
756756
757757   if (!use_5FD)
758      cputag_suspend(machine, "sub", SUSPEND_REASON_DISABLE, 1);
758      machine->device<cpu_device>("sub")->suspend(SUSPEND_REASON_DISABLE, 1);
759759   else
760      cputag_resume(machine, "sub", SUSPEND_REASON_DISABLE);
760      machine->device<cpu_device>("sub")->resume(SUSPEND_REASON_DISABLE);
761761
762762   cpu_set_input_line_vector(machine->device("sub"), 0, 0);
763763
src/mess/machine/intv.c
r8691r8692
499499{
500500   cputag_set_input_line(device->machine, "maincpu", CP1610_INT_INTRM, ASSERT_LINE);
501501   sr1_int_pending = 1;
502   timer_set(device->machine, cputag_clocks_to_attotime(device->machine, "maincpu", 3791), NULL, 0, intv_interrupt_complete);
502   timer_set(device->machine, device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(3791), NULL, 0, intv_interrupt_complete);
503503   intv_stic_screenrefresh(device->machine);
504504}
505505
src/mess/machine/pce.c
r8691r8692
10911091      if ( pce_cd.scsi_IO )
10921092      {
10931093         pce_cd.scsi_ACK = 1;
1094         timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 15), NULL, 0, pce_cd_clear_ack );
1094         timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(15), NULL, 0, pce_cd_clear_ack );
10951095      }
10961096   }
10971097   return data;
src/mess/machine/ti99_4x.c
r8691r8692
811811   if (! tms5220_readyq_r(space->machine->device("tmc0285")))
812812   {
813813      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(space->machine->device("tmc0285")));
814      int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
814      int cycles_to_ready = space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(time_to_ready);
815815
816816      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
817817
r8691r8692
28832883               if (! tms5220_readyq_r(space->machine->device("tms5220")))
28842884               {
28852885                  attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(space->machine->device("tms5220")));
2886                  double d = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
2886                  double d = space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(time_to_ready);
28872887                  int cycles_to_ready = ((int) (d + 3)) & ~3;
28882888
28892889                  logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready)
src/mess/video/zx.c
r8691r8692
176176      for (y = charline_ptr; y < ARRAY_LENGTH(charline); y++)
177177         charline[y] = 0;
178178
179      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", ((32 - charline_ptr) << 2)), NULL, 0, zx_ula_irq);
179      timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(((32 - charline_ptr) << 2)), NULL, 0, zx_ula_irq);
180180      ula_irq_active++;
181181
182182      scanline = BITMAP_ADDR16(bitmap, ula_scanline_count, 0);
src/mess/video/gb.c
r8691r8692
362362   if ( ( LCDSTAT & 0x03 ) == 0x03 )
363363   {
364364      /* Calculate number of pixels to render based on time still left on the timer */
365      UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) );
365      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_timeleft( gb_lcd.lcd_timer ) );
366366      int l = 0;
367367
368368      if ( gb_lcd.start_x < 0 )
r8691r8692
684684   if ( ( LCDSTAT & 0x03 ) == 0x03 )
685685   {
686686      /* Calcuate number of pixels to render based on time still left on the timer */
687      UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) );
687      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_timeleft( gb_lcd.lcd_timer ) );
688688      int l = 0;
689689
690690      if ( gb_lcd.start_x < 0 )
r8691r8692
990990   if ( ( LCDSTAT & 0x03 ) == 0x03 )
991991   {
992992      /* Calcuate number of pixels to render based on time still left on the timer */
993      UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) );
993      UINT32 cycles_to_go = machine->device<cpu_device>("maincpu")->attotime_to_cycles(timer_timeleft( gb_lcd.lcd_timer ) );
994994      int l = 0;
995995
996996      if ( gb_lcd.start_x < 0 )
r8691r8692
13441344   switch( mode )
13451345   {
13461346   case GB_VIDEO_DMG:
1347      timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 456), 0);
1347      timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(456), 0);
13481348
13491349      /* set the scanline update function */
13501350      update_scanline = gb_update_scanline;
r8691r8692
13671367      memcpy( gb_lcd.gb_oam->base(), mgb_oam_fingerprint, 0x100 );
13681368
13691369      /* Make sure the VBlank interrupt is set when the first instruction gets executed */
1370      timer_set(machine,  cputag_clocks_to_attotime(machine, "maincpu", 1), NULL, 0, gb_video_init_vbl );
1370      timer_set(machine,  machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), NULL, 0, gb_video_init_vbl );
13711371
13721372      /* Initialize some video registers */
13731373      gb_video_w( space, 0x0, 0x91 );    /* LCDCONT */
r8691r8692
13781378      CURLINE = gb_lcd.current_line = 0;
13791379      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x05;
13801380      gb_lcd.mode = 1;
1381      timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 60), GB_LCD_STATE_LY00_M0);
1381      timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(60), GB_LCD_STATE_LY00_M0);
13821382
13831383      break;
13841384   case GB_VIDEO_SGB:
r8691r8692
14721472               gb_lcd.mode_irq = 0;
14731473            }
14741474         }
1475         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0);
1475         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0);
14761476         break;
14771477      case GB_LCD_STATE_LYXX_M0:      /* Switch to mode 0 */
14781478         /* update current scanline */
r8691r8692
14971497         if ( ( SCROLLX & 0x03 ) == 0x03 )
14981498         {
14991499            gb_lcd.scrollx_adjust += 4;
1500            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_SCX3);
1500            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3);
15011501            break;
15021502         }
15031503      case GB_LCD_STATE_LYXX_M0_SCX3:
r8691r8692
15071507         {
15081508            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
15091509         }
1510         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
1510         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
15111511         break;
15121512      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
15131513         if ( CURLINE < 143 )
r8691r8692
15301530               }
15311531            }
15321532         }
1533         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_INC);
1533         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC);
15341534         break;
15351535      case GB_LCD_STATE_LYXX_M0_INC:   /* Increment LY, stay in M0 for 4 more cycles */
15361536         gb_increment_scanline();
r8691r8692
15471547         /* Check if we're going into VBlank next */
15481548         if ( CURLINE == 144 )
15491549         {
1550            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1);
1550            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
15511551         }
15521552         else
15531553         {
r8691r8692
15601560               gb_lcd.mode_irq = 1;
15611561               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
15621562            }
1563            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M2);
1563            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2);
15641564         }
15651565         break;
15661566      case GB_LCD_STATE_LY00_M2:      /* Switch to mode 2 on line #0 */
r8691r8692
15761576         /* Check for regular compensation of x-scroll register */
15771577         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
15781578         /* Mode 2 lasts approximately 80 clock cycles */
1579         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3);
1579         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
15801580         break;
15811581      case GB_LCD_STATE_LYXX_M2:      /* Switch to mode 2 */
15821582         /* Update STAT register to the correct state */
r8691r8692
15981598         /* Check for regular compensation of x-scroll register */
15991599         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
16001600         /* Mode 2 last for approximately 80 clock cycles */
1601         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3);
1601         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
16021602         break;
16031603      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
16041604         gb_select_sprites();
r8691r8692
16091609         gb_lcd.vram_locked = LOCKED;
16101610         /* Check for compensations of x-scroll register */
16111611         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1612         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
1612         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
16131613         gb_lcd.start_x = -1;
16141614         break;
16151615      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
r8691r8692
16351635         {
16361636            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16371637         }
1638         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 452), GB_LCD_STATE_LY9X_M1_INC);
1638         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC);
16391639         break;
16401640      case GB_LCD_STATE_LY9X_M1_INC:      /* Increment scanline counter */
16411641         gb_increment_scanline();
r8691r8692
16511651         LCDSTAT &= 0xFB;
16521652         if ( gb_lcd.current_line == 153 )
16531653         {
1654            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1);
1654            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1);
16551655         }
16561656         else
16571657         {
1658            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1);
1658            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
16591659         }
16601660         break;
16611661      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
r8691r8692
16761676         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
16771677         gb_lcd.line_irq = 0;
16781678         LCDSTAT &= 0xFB;
1679         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4/*8*/), GB_LCD_STATE_LY00_M1_1);
1679         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1);
16801680         break;
16811681      case GB_LCD_STATE_LY00_M1_1:
16821682         if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
r8691r8692
16841684            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
16851685            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16861686         }
1687         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_2);
1687         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2);
16881688         break;
16891689      case GB_LCD_STATE_LY00_M1_2:   /* Rest of line #0 during VBlank */
16901690         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
r8691r8692
16961696         {
16971697            LCDSTAT |= 0x04;
16981698         }
1699         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 444), GB_LCD_STATE_LY00_M0);
1699         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0);
17001700         break;
17011701      case GB_LCD_STATE_LY00_M0:      /* The STAT register seems to go to 0 for about 4 cycles */
17021702         /* Set Mode 0 lcdstat */
17031703         gb_lcd.mode = 0;
17041704         LCDSTAT = ( LCDSTAT & 0xFC );
1705         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M2);
1705         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2);
17061706         break;
17071707      }
17081708   }
r8691r8692
17131713      {
17141714         update_scanline( machine );
17151715      }
1716      timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 456), 0);
1716      timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(456), 0);
17171717   }
17181718}
17191719
r8691r8692
17441744               gb_lcd.mode_irq = 0;
17451745            }
17461746         }
1747         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0);
1747         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0);
17481748         break;
17491749      case GB_LCD_STATE_LYXX_M0:      /* Switch to mode 0 */
17501750         /* update current scanline */
r8691r8692
17701770         if ( ( SCROLLX & 0x03 ) == 0x03 )
17711771         {
17721772            gb_lcd.scrollx_adjust += 4;
1773            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_SCX3);
1773            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3);
17741774            break;
17751775         }
17761776      case GB_LCD_STATE_LYXX_M0_SCX3:
r8691r8692
17851785         {
17861786            gb_lcd.pal_locked = UNLOCKED;
17871787         }
1788         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_GBC_PAL);
1788         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL);
17891789         break;
17901790      case GB_LCD_STATE_LYXX_M0_GBC_PAL:
17911791         gb_lcd.pal_locked = UNLOCKED;
r8691r8692
17991799         {
18001800            gb_lcd.hdma_possible = 1;
18011801         }
1802         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 192 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
1802         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(192 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC);
18031803         break;
18041804      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
18051805         gb_lcd.cmp_line = CMPLINE;
r8691r8692
18221822               }
18231823            }
18241824         }
1825         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_INC);
1825         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC);
18261826         break;
18271827      case GB_LCD_STATE_LYXX_M0_INC:   /* Increment LY, stay in M0 for 4 more cycles */
18281828         gb_increment_scanline();
r8691r8692
18381838         /* Check if we're going into VBlank next */
18391839         if ( CURLINE == 144 )
18401840         {
1841            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1);
1841            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
18421842         }
18431843         else
18441844         {
r8691r8692
18511851               gb_lcd.mode_irq = 1;
18521852               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
18531853            }
1854            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M2);
1854            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2);
18551855         }
18561856         break;
18571857      case GB_LCD_STATE_LY00_M2:      /* Switch to mode 2 on line #0 */
r8691r8692
18671867         /* Check for regular compensation of x-scroll register */
18681868         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
18691869         /* Mode 2 lasts approximately 80 clock cycles */
1870         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3);
1870         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
18711871         break;
18721872      case GB_LCD_STATE_LYXX_M2:      /* Switch to mode 2 */
18731873         /* Update STAT register to the correct state */
r8691r8692
18921892         /* Check for regular compensation of x-scroll register */
18931893         gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0;
18941894         /* Mode 2 last for approximately 80 clock cycles */
1895         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3);
1895         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
18961896         break;
18971897      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
18981898         gb_select_sprites();
r8691r8692
19041904         gb_lcd.pal_locked = LOCKED;
19051905         /* Check for compensations of x-scroll register */
19061906         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1907         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
1907         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0);
19081908         gb_lcd.start_x = -1;
19091909         break;
19101910      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
r8691r8692
19341934         {
19351935            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19361936         }
1937         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 452), GB_LCD_STATE_LY9X_M1_INC);
1937         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC);
19381938         break;
19391939      case GB_LCD_STATE_LY9X_M1_INC:      /* Increment scanline counter */
19401940         gb_increment_scanline();
r8691r8692
19481948         }
19491949         if ( gb_lcd.current_line == 153 )
19501950         {
1951            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1);
1951            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1);
19521952         }
19531953         else
19541954         {
1955            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1);
1955            timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1);
19561956         }
19571957         break;
19581958      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
r8691r8692
19771977         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
19781978         gb_lcd.line_irq = 0;
19791979         LCDSTAT &= 0xFB;
1980         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_1);
1980         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1);
19811981         break;
19821982      case GB_LCD_STATE_LY00_M1_1:
19831983         if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
r8691r8692
19851985            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
19861986            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19871987         }
1988         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_2);
1988         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2);
19891989         break;
19901990      case GB_LCD_STATE_LY00_M1_2:   /* Rest of line #0 during VBlank */
19911991         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
r8691r8692
20012001         {
20022002            LCDSTAT &= ~0x04;
20032003         }
2004         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 444), GB_LCD_STATE_LY00_M0);
2004         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0);
20052005         break;
20062006      case GB_LCD_STATE_LY00_M0:      /* The STAT register seems to go to 0 for about 4 cycles */
20072007         /* Set Mode 0 lcdstat */
20082008         gb_lcd.mode = 0;
2009         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M2);
2009         timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2);
20102010         break;
20112011      }
20122012   }
r8691r8692
20172017      {
20182018         update_scanline( machine );
20192019      }
2020      timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 456), 0);
2020      timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(456), 0);
20212021   }
20222022}
20232023
r8691r8692
20412041      }
20422042   }
20432043   gb_lcd.state = GB_LCD_STATE_LY00_M2;
2044   timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3);
2044   timer_adjust_oneshot(gb_lcd.lcd_timer, machine->device<cpu_device>("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3);
20452045}
20462046
20472047READ8_HANDLER( gb_video_r )
src/mess/video/vic6567.c
r8691r8692
15421542   }
15431543
15441544   vic2->raster_x += 8;
1545   timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 1), vic2, 0, pal_timer_callback);
1545   timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), vic2, 0, pal_timer_callback);
15461546}
15471547
15481548static TIMER_CALLBACK( ntsc_timer_callback )
r8691r8692
21212121   }
21222122
21232123   vic2->raster_x += 8;
2124   timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 1), vic2, 0, ntsc_timer_callback);
2124   timer_set(machine, machine->device<cpu_device>("maincpu")->cycles_to_attotime(1), vic2, 0, ntsc_timer_callback);
21252125}
21262126
21272127
src/mess/drivers/m20.c
r8691r8692
6969
7070static ADDRESS_MAP_START( m20_io , ADDRESS_SPACE_IO, 8)
7171   ADDRESS_MAP_UNMAP_HIGH
72   AM_RANGE(0x61, 0x61) AM_DEVWRITE8("crtc", mc6845_address_w, 0x00ff)
73   AM_RANGE(0x63, 0x63) AM_DEVWRITE8("crtc", mc6845_register_w, 0x00ff)
72   AM_RANGE(0x61, 0x61) AM_DEVWRITE("crtc", mc6845_address_w)
73   AM_RANGE(0x63, 0x63) AM_DEVWRITE("crtc", mc6845_register_w)
7474   // 0x81 / 0x87 - i8255A
7575   // 0xa1 - i8251 keyboard data
7676   // 0xa3 - i8251 keyboard status / control
src/mess/drivers/spectrum.c
r8691r8692
304304   if ((Changed & 0x07)!=0)
305305   {
306306      /* yes - send event */
307      EventList_AddItemOffset(space->machine, 0x0fe, data & 0x07, cputag_attotime_to_clocks(space->machine, "maincpu", attotime_mul(space->machine->primary_screen->scan_period(), space->machine->primary_screen->vpos())));
307      EventList_AddItemOffset(space->machine, 0x0fe, data & 0x07, space->machine->device<cpu_device>("maincpu")->attotime_to_cycles(attotime_mul(space->machine->primary_screen->scan_period(), space->machine->primary_screen->vpos())));
308308   }
309309
310310   if ((Changed & (1<<4))!=0)
src/mess/drivers/px8.c
r8691r8692
460460   state->ier = data;
461461}
462462
463/*-------------------------------------------------
464    krtn_read - read keyboard return
465-------------------------------------------------*/
463///*-------------------------------------------------
464//    krtn_read - read keyboard return
465//-------------------------------------------------*/
466//
467//static UINT8 krtn_read(running_machine *machine)
468//{
469//   px8_state *state = (px8_state *)machine->driver_data;
470//   UINT8 data = 0xff;
471//
472//   switch (state->ksc)
473//   {
474//   case 0: data = input_port_read(machine, "KSC0"); break;
475//   case 1: data = input_port_read(machine, "KSC1"); break;
476//   case 2: data = input_port_read(machine, "KSC2"); break;
477//   case 3: data = input_port_read(machine, "KSC3"); break;
478//   case 4: data = input_port_read(machine, "KSC4"); break;
479//   case 5: data = input_port_read(machine, "KSC5"); break;
480//   case 6: data = input_port_read(machine, "KSC6"); break;
481//   case 7: data = input_port_read(machine, "KSC7"); break;
482//   case 8: data = input_port_read(machine, "KSC8"); break;
483//   case 9: data = input_port_read(machine, "SW4");  break;
484//   }
485//
486//   return data;
487//}
488//
489///*-------------------------------------------------
490//    krtn_0_3_r - keyboard return 0..3 read
491//-------------------------------------------------*/
492//
493//static READ8_HANDLER( krtn_0_3_r )
494//{
495//   return krtn_read(space->machine) & 0x0f;
496//}
497//
498///*-------------------------------------------------
499//    krtn_4_7_r - keyboard return 4..7 read
500//-------------------------------------------------*/
501//
502//static READ8_HANDLER( krtn_4_7_r )
503//{
504//   return krtn_read(space->machine) >> 4;
505//}
506//
507///*-------------------------------------------------
508//    ksc_w - keyboard scan write
509//-------------------------------------------------*/
510//
511//static WRITE8_HANDLER( ksc_w )
512//{
513//   px8_state *state = (px8_state *)space->machine->driver_data;
514//
515//   state->ksc = data;
516//}
466517
467static UINT8 krtn_read(running_machine *machine)
468{
469   px8_state *state = (px8_state *)machine->driver_data;
470   UINT8 data = 0xff;
471
472   switch (state->ksc)
473   {
474   case 0: data = input_port_read(machine, "KSC0"); break;
475   case 1: data = input_port_read(machine, "KSC1"); break;
476   case 2: data = input_port_read(machine, "KSC2"); break;
477   case 3: data = input_port_read(machine, "KSC3"); break;
478   case 4: data = input_port_read(machine, "KSC4"); break;
479   case 5: data = input_port_read(machine, "KSC5"); break;
480   case 6: data = input_port_read(machine, "KSC6"); break;
481   case 7: data = input_port_read(machine, "KSC7"); break;
482   case 8: data = input_port_read(machine, "KSC8"); break;
483   case 9: data = input_port_read(machine, "SW4");  break;
484   }
485
486   return data;
487}
488
489/*-------------------------------------------------
490    krtn_0_3_r - keyboard return 0..3 read
491-------------------------------------------------*/
492
493static READ8_HANDLER( krtn_0_3_r )
494{
495   return krtn_read(space->machine) & 0x0f;
496}
497
498/*-------------------------------------------------
499    krtn_4_7_r - keyboard return 4..7 read
500-------------------------------------------------*/
501
502static READ8_HANDLER( krtn_4_7_r )
503{
504   return krtn_read(space->machine) >> 4;
505}
506
507/*-------------------------------------------------
508    ksc_w - keyboard scan write
509-------------------------------------------------*/
510
511static WRITE8_HANDLER( ksc_w )
512{
513   px8_state *state = (px8_state *)space->machine->driver_data;
514
515   state->ksc = data;
516}
517
518518/***************************************************************************
519519    MEMORY MAPS
520520***************************************************************************/
r8691r8692
573573    ADDRESS_MAP( px8_sub_io )
574574-------------------------------------------------*/
575575
576static ADDRESS_MAP_START( px8_sub_io, ADDRESS_SPACE_IO, 8 )
577//  AM_RANGE(0x00, 0x00) AM_READWRITE()
578   AM_RANGE(0x01, 0x01) AM_READ(krtn_0_3_r)
579//  AM_RANGE(0x02, 0x02) AM_WRITE()
580   AM_RANGE(0x03, 0x03) AM_WRITE(ksc_w)
581//  AM_RANGE(0x04, 0x04) AM_WRITE()
582   AM_RANGE(0x05, 0x05) AM_READ(krtn_4_7_r)
583//  AM_RANGE(0x06, 0x06) AM_READ()
584//  AM_RANGE(0x07, 0x07) AM_WRITE()
585ADDRESS_MAP_END
576//static ADDRESS_MAP_START( px8_sub_io, ADDRESS_SPACE_IO, 8 )
577////  AM_RANGE(0x00, 0x00) AM_READWRITE()
578//   AM_RANGE(0x01, 0x01) AM_READ(krtn_0_3_r)
579////  AM_RANGE(0x02, 0x02) AM_WRITE()
580//   AM_RANGE(0x03, 0x03) AM_WRITE(ksc_w)
581////  AM_RANGE(0x04, 0x04) AM_WRITE()
582//   AM_RANGE(0x05, 0x05) AM_READ(krtn_4_7_r)
583////  AM_RANGE(0x06, 0x06) AM_READ()
584////  AM_RANGE(0x07, 0x07) AM_WRITE()
585//ADDRESS_MAP_END
586586
587587/***************************************************************************
588588    INPUT PORTS
src/mess/drivers/v1050.c
r8691r8692
377377
378378/* i8049 Read/Write Handlers */
379379
380static READ8_HANDLER( keyboard_r )
380/*static READ8_HANDLER( keyboard_r )
381381{
382382   v1050_state *state = (v1050_state *)space->machine->driver_data;
383383
r8691r8692
392392
393393   state->keylatch = data & 0x0f;
394394}
395*/
396//static WRITE8_HANDLER( p2_w )
397//{
398//   /*
399//
400//        bit     description
401//
402//        P20
403//        P21
404//        P22
405//        P23
406//        P24
407//        P25     led output
408//        P26     speaker (NE555) output
409//        P27     serial output
410//
411//    */
412//
413//   v1050_state *state = (v1050_state *)space->machine->driver_data;
414//
415//   output_set_led_value(0, BIT(data, 5));
416////  discrete_sound_w(discrete, NODE_01, BIT(data, 6));
417//   state->kb_so = BIT(data, 7);
418//}
395419
396static WRITE8_HANDLER( p2_w )
397{
398   /*
399
400        bit     description
401
402        P20
403        P21
404        P22
405        P23
406        P24
407        P25     led output
408        P26     speaker (NE555) output
409        P27     serial output
410
411    */
412
413   v1050_state *state = (v1050_state *)space->machine->driver_data;
414
415   output_set_led_value(0, BIT(data, 5));
416//  discrete_sound_w(discrete, NODE_01, BIT(data, 6));
417   state->kb_so = BIT(data, 7);
418}
419
420420/* Memory Maps */
421421
422422static ADDRESS_MAP_START( v1050_mem, ADDRESS_SPACE_PROGRAM, 8 )
r8691r8692
459459   AM_RANGE(0xe000, 0xffff) AM_ROM
460460ADDRESS_MAP_END
461461
462static ADDRESS_MAP_START( v1050_kbd_io, ADDRESS_SPACE_IO, 8 )
463   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(keyboard_r, keyboard_w)
464   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
465ADDRESS_MAP_END
462//static ADDRESS_MAP_START( v1050_kbd_io, ADDRESS_SPACE_IO, 8 )
463//   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(keyboard_r, keyboard_w)
464//   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
465//ADDRESS_MAP_END
466466
467467/* Input Ports */
468468
src/mess/drivers/cgc7900.c
r8691r8692
294294    ADDRESS_MAP( keyboard_mem )
295295-------------------------------------------------*/
296296
297static ADDRESS_MAP_START( keyboard_mem, ADDRESS_SPACE_PROGRAM, 8 )
298   AM_RANGE(0x000, 0x7ff) AM_ROM
299ADDRESS_MAP_END
297//static ADDRESS_MAP_START( keyboard_mem, ADDRESS_SPACE_PROGRAM, 8 )
298//   AM_RANGE(0x000, 0x7ff) AM_ROM
299//ADDRESS_MAP_END
300300
301301/*-------------------------------------------------
302302    ADDRESS_MAP( keyboard_io )
303303-------------------------------------------------*/
304304
305static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
305//static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
306306/*  AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
307307    AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2)
308308    AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1)
309309    AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)*/
310ADDRESS_MAP_END
310//ADDRESS_MAP_END
311311
312312/***************************************************************************
313313    INPUT PORTS
src/mess/drivers/tandy2k.c
r8691r8692
198198   logerror("Address Control %02x\n", data);
199199}
200200
201static READ8_HANDLER( keyboard_x0_r )
202{
203   /*
201//static READ8_HANDLER( keyboard_x0_r )
202//{
203//   /*
204//
205//        bit     description
206//
207//        0       X0
208//        1       X1
209//        2       X2
210//        3       X3
211//        4       X4
212//        5       X5
213//        6       X6
214//        7       X7
215//
216//    */
217//
218//   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
219//
220//   UINT8 data = 0xff;
221//
222//   if (!BIT(state->keylatch,  0)) data &= input_port_read(space->machine,  "Y0");
223//   if (!BIT(state->keylatch,  1)) data &= input_port_read(space->machine,  "Y1");
224//   if (!BIT(state->keylatch,  2)) data &= input_port_read(space->machine,  "Y2");
225//   if (!BIT(state->keylatch,  3)) data &= input_port_read(space->machine,  "Y3");
226//   if (!BIT(state->keylatch,  4)) data &= input_port_read(space->machine,  "Y4");
227//   if (!BIT(state->keylatch,  5)) data &= input_port_read(space->machine,  "Y5");
228//   if (!BIT(state->keylatch,  6)) data &= input_port_read(space->machine,  "Y6");
229//   if (!BIT(state->keylatch,  7)) data &= input_port_read(space->machine,  "Y7");
230//   if (!BIT(state->keylatch,  8)) data &= input_port_read(space->machine,  "Y8");
231//   if (!BIT(state->keylatch,  9)) data &= input_port_read(space->machine,  "Y9");
232//   if (!BIT(state->keylatch, 10)) data &= input_port_read(space->machine, "Y10");
233//   if (!BIT(state->keylatch, 11)) data &= input_port_read(space->machine, "Y11");
234//
235//   return ~data;
236//}
237//
238//static WRITE8_HANDLER( keyboard_y0_w )
239//{
240//   /*
241//
242//        bit     description
243//
244//        0       Y0
245//        1       Y1
246//        2       Y2
247//        3       Y3
248//        4       Y4
249//        5       Y5
250//        6       Y6
251//        7       Y7
252//
253//    */
254//
255//   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
256//
257//   /* keyboard row select */
258//   state->keylatch = (state->keylatch & 0xff00) | data;
259//}
260//
261//static WRITE8_HANDLER( keyboard_y8_w )
262//{
263//   /*
264//
265//        bit     description
266//
267//        0       Y8
268//        1       Y9
269//        2       Y10
270//        3       Y11
271//        4       LED 2
272//        5       LED 1
273//        6
274//        7
275//
276//    */
277//
278//   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
279//
280//   /* keyboard row select */
281//   state->keylatch = ((data & 0x0f) << 8) | (state->keylatch & 0xff);
282//}
204283
205        bit     description
206
207        0       X0
208        1       X1
209        2       X2
210        3       X3
211        4       X4
212        5       X5
213        6       X6
214        7       X7
215
216    */
217
218   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
219
220   UINT8 data = 0xff;
221
222   if (!BIT(state->keylatch,  0)) data &= input_port_read(space->machine,  "Y0");
223   if (!BIT(state->keylatch,  1)) data &= input_port_read(space->machine,  "Y1");
224   if (!BIT(state->keylatch,  2)) data &= input_port_read(space->machine,  "Y2");
225   if (!BIT(state->keylatch,  3)) data &= input_port_read(space->machine,  "Y3");
226   if (!BIT(state->keylatch,  4)) data &= input_port_read(space->machine,  "Y4");
227   if (!BIT(state->keylatch,  5)) data &= input_port_read(space->machine,  "Y5");
228   if (!BIT(state->keylatch,  6)) data &= input_port_read(space->machine,  "Y6");
229   if (!BIT(state->keylatch,  7)) data &= input_port_read(space->machine,  "Y7");
230   if (!BIT(state->keylatch,  8)) data &= input_port_read(space->machine,  "Y8");
231   if (!BIT(state->keylatch,  9)) data &= input_port_read(space->machine,  "Y9");
232   if (!BIT(state->keylatch, 10)) data &= input_port_read(space->machine, "Y10");
233   if (!BIT(state->keylatch, 11)) data &= input_port_read(space->machine, "Y11");
234
235   return ~data;
236}
237
238static WRITE8_HANDLER( keyboard_y0_w )
239{
240   /*
241
242        bit     description
243
244        0       Y0
245        1       Y1
246        2       Y2
247        3       Y3
248        4       Y4
249        5       Y5
250        6       Y6
251        7       Y7
252
253    */
254
255   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
256
257   /* keyboard row select */
258   state->keylatch = (state->keylatch & 0xff00) | data;
259}
260
261static WRITE8_HANDLER( keyboard_y8_w )
262{
263   /*
264
265        bit     description
266
267        0       Y8
268        1       Y9
269        2       Y10
270        3       Y11
271        4       LED 2
272        5       LED 1
273        6
274        7
275
276    */
277
278   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
279
280   /* keyboard row select */
281   state->keylatch = ((data & 0x0f) << 8) | (state->keylatch & 0xff);
282}
283
284284/* Memory Maps */
285285
286286static ADDRESS_MAP_START( tandy2k_mem, ADDRESS_SPACE_PROGRAM, 16 )
r8691r8692
319319//  AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_r, wd1010_w, 0x00ff)
320320ADDRESS_MAP_END
321321
322static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
323   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(keyboard_y0_w)
324   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(keyboard_y8_w)
325   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(keyboard_x0_r)
326ADDRESS_MAP_END
322//static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
323//   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(keyboard_y0_w)
324//   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(keyboard_y8_w)
325//   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(keyboard_x0_r)
326//ADDRESS_MAP_END
327327
328328/* Input Ports */
329329
src/mess/drivers/x07.c
r8691r8692
777777      state->kb_size--;
778778      state->regs_r[2] |= 0x01;
779779      cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE);
780      timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0);
780      timer_adjust_oneshot(state->irq_clear, machine->device<cpu_device>("maincpu")->cycles_to_attotime(500), 0);
781781      return;
782782   }
783783   else if (state->kb_brk)
r8691r8692
787787      state->regs_r[2] |= 0x01;
788788      state->kb_brk = 0;
789789      cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE );
790      timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0);
790      timer_adjust_oneshot(state->irq_clear, machine->device<cpu_device>("maincpu")->cycles_to_attotime(500), 0);
791791      return;
792792   }
793793   else if ( state->z80_irq&1 )
r8691r8692
795795      receive_from_t6834 (machine);
796796      state->z80_irq &= ~1;
797797      cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE);
798      timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0);
798      timer_adjust_oneshot(state->irq_clear, machine->device<cpu_device>("maincpu")->cycles_to_attotime(500), 0);
799799      return;
800800   }
801801}
src/mess/drivers/trs80m2.c
r8691r8692
323323   bankswitch(space->machine);
324324}
325325
326static READ8_HANDLER( keyboard_busy_r )
327{
328   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
326//static READ8_HANDLER( keyboard_busy_r )
327//{
328//   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
329//
330//   return state->kbirq;
331//}
332//
333//static READ8_HANDLER( keyboard_data_r )
334//{
335//   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
336//
337//   static const char *const KEY_ROW[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9", "ROW10", "ROW11" };
338//
339//   return input_port_read(space->machine, KEY_ROW[state->key_latch]);
340//}
341//
342//static WRITE8_HANDLER( keyboard_ctrl_w )
343//{
344//   /*
345//
346//        bit     description
347//
348//        0       DATA
349//        1       CLOCK
350//        2       LED
351//        3
352//        4       LED
353//        5
354//        6
355//        7
356//
357//    */
358//
359//   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
360//
361//   int kbdata = BIT(data, 0);
362//   int kbclk = BIT(data, 1);
363//
364//   if (state->key_bit == 8)
365//   {
366//      if (!state->kbdata && kbdata)
367//      {
368//         /* trigger keyboard interrupt */
369//         state->kbirq = 0;
370//         z80ctc_trg3_w(state->z80ctc, state->kbirq);
371//      }
372//   }
373//   else
374//   {
375//      if (!state->kbclk && kbclk)
376//      {
377//         /* shift in keyboard data bit */
378//         state->key_data <<= 1;
379//         state->key_data |= kbdata;
380//         state->key_bit++;
381//      }
382//   }
383//
384//   state->kbdata = kbdata;
385//   state->kbclk = kbclk;
386//}
387//
388//static WRITE8_HANDLER( keyboard_latch_w )
389//{
390//   /*
391//
392//        bit     description
393//
394//        0       D
395//        1       C
396//        2       B
397//        3       A
398//        4
399//        5
400//        6
401//        7
402//
403//    */
404//
405//   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
406//
407//   state->key_latch = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 0x0f;
408//}
329409
330   return state->kbirq;
331}
332
333static READ8_HANDLER( keyboard_data_r )
334{
335   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
336
337   static const char *const KEY_ROW[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9", "ROW10", "ROW11" };
338
339   return input_port_read(space->machine, KEY_ROW[state->key_latch]);
340}
341
342static WRITE8_HANDLER( keyboard_ctrl_w )
343{
344   /*
345
346        bit     description
347
348        0       DATA
349        1       CLOCK
350        2       LED
351        3
352        4       LED
353        5
354        6
355        7
356
357    */
358
359   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
360
361   int kbdata = BIT(data, 0);
362   int kbclk = BIT(data, 1);
363
364   if (state->key_bit == 8)
365   {
366      if (!state->kbdata && kbdata)
367      {
368         /* trigger keyboard interrupt */
369         state->kbirq = 0;
370         z80ctc_trg3_w(state->z80ctc, state->kbirq);
371      }
372   }
373   else
374   {
375      if (!state->kbclk && kbclk)
376      {
377         /* shift in keyboard data bit */
378         state->key_data <<= 1;
379         state->key_data |= kbdata;
380         state->key_bit++;
381      }
382   }
383
384   state->kbdata = kbdata;
385   state->kbclk = kbclk;
386}
387
388static WRITE8_HANDLER( keyboard_latch_w )
389{
390   /*
391
392        bit     description
393
394        0       D
395        1       C
396        2       B
397        3       A
398        4
399        5
400        6
401        7
402
403    */
404
405   trs80m2_state *state = (trs80m2_state *)space->machine->driver_data;
406
407   state->key_latch = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 0x0f;
408}
409
410410/* Memory Maps */
411411
412412static ADDRESS_MAP_START( z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
r8691r8692
429429   AM_RANGE(0xff, 0xff) AM_READWRITE(nmi_r, nmi_w)
430430ADDRESS_MAP_END
431431
432static ADDRESS_MAP_START( trs80m2_keyboard_io, ADDRESS_SPACE_IO, 8 )
433   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(keyboard_busy_r)
434   AM_RANGE(MCS48_PORT_P0, MCS48_PORT_P0) AM_READ(keyboard_data_r)
435   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(keyboard_ctrl_w)
436   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(keyboard_latch_w)
437ADDRESS_MAP_END
432//static ADDRESS_MAP_START( trs80m2_keyboard_io, ADDRESS_SPACE_IO, 8 )
433//   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(keyboard_busy_r)
434//   AM_RANGE(MCS48_PORT_P0, MCS48_PORT_P0) AM_READ(keyboard_data_r)
435//   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(keyboard_ctrl_w)
436//   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(keyboard_latch_w)
437//ADDRESS_MAP_END
438438
439static ADDRESS_MAP_START( m68000_mem, ADDRESS_SPACE_PROGRAM, 16 )
440ADDRESS_MAP_END
439//static ADDRESS_MAP_START( m68000_mem, ADDRESS_SPACE_PROGRAM, 16 )
440//ADDRESS_MAP_END
441441
442442/* Input Ports */
443443
src/mess/drivers/x68k.c
r8691r8692
938938   if((prev1 & 0x10) == 0x00 && (data & 0x10) == 0x10)
939939   {
940940      x68k_sys.mdctrl.seq1++;
941      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout1,cputag_clocks_to_attotime(device->machine, "maincpu", 8192),0);
941      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout1,device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192),0);
942942   }
943943   prev1 = data;
944944
r8691r8692
947947   if((prev2 & 0x20) == 0x00 && (data & 0x20) == 0x20)
948948   {
949949      x68k_sys.mdctrl.seq2++;
950      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout2,cputag_clocks_to_attotime(device->machine, "maincpu", 8192),0);
950      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout2,device->machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192),0);
951951   }
952952   prev2 = data;
953953
r8691r8692
16981698      offset *= 2;
16991699      if(ACCESSING_BITS_0_7)
17001700         offset++;
1701      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
1701      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
17021702   }
17031703   return 0xff;
17041704}
r8691r8692
17151715      offset *= 2;
17161716      if(ACCESSING_BITS_0_7)
17171717         offset++;
1718      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
1718      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
17191719   }
17201720}
17211721
r8691r8692
17311731      offset *= 2;
17321732      if(ACCESSING_BITS_0_7)
17331733         offset++;
1734      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, offset,x68k_fake_bus_error);
1734      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, offset,x68k_fake_bus_error);
17351735   }
17361736   return 0xff;
17371737}
r8691r8692
17481748      offset *= 2;
17491749      if(ACCESSING_BITS_0_7)
17501750         offset++;
1751      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, offset,x68k_fake_bus_error);
1751      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(4), NULL, offset,x68k_fake_bus_error);
17521752   }
17531753}
17541754
r8691r8692
17621762      offset *= 2;
17631763      if(ACCESSING_BITS_0_7)
17641764         offset++;
1765      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1765      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
17661766//      cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
17671767   }
17681768   return 0xffff;
r8691r8692
17781778      offset *= 2;
17791779      if(ACCESSING_BITS_0_7)
17801780         offset++;
1781      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1781      timer_set(space->machine, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
17821782//      cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
17831783   }
17841784}
src/mess/drivers/geneve.c
r8691r8692
240240   AM_RANGE(0x0100, 0x01ff) AM_DEVREAD("per_exp_box", geneve_peb_cru_r)
241241
242242   AM_RANGE(0x0000, 0x07ff) AM_DEVWRITE("tms9901", tms9901_cru_w)
243   AM_RANGE(0x0800, 0x0fff) AM_DEVWRITE("per_exp_box", geneve_peb_mode_cru_w)
243   AM_RANGE(0x0800, 0x0fff) AM_WRITE(geneve_peb_mode_cru_w)
244244ADDRESS_MAP_END
245245
246246
src/mess/drivers/victor9k.c
r8691r8692
6767//  AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)
6868ADDRESS_MAP_END
6969
70static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
70//static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
7171//  AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
7272//  AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2)
7373//  AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1)
7474//  AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)
75ADDRESS_MAP_END
75//ADDRESS_MAP_END
7676
7777/* Input Ports */
7878
src/mess/drivers/intv.c
r8691r8692
370370static INTERRUPT_GEN( intv_interrupt2 )
371371{
372372   cputag_set_input_line(device->machine, "keyboard", 0, ASSERT_LINE);
373   timer_set(device->machine, cputag_clocks_to_attotime(device->machine, "keyboard", 100), NULL, 0, intv_interrupt2_complete);
373   timer_set(device->machine, device->machine->device<cpu_device>("keyboard")->cycles_to_attotime(100), NULL, 0, intv_interrupt2_complete);
374374}
375375
376376static MACHINE_DRIVER_START( intv )
src/mess/drivers/svision.c
r8691r8692
155155         else
156156            delay = 256;
157157         timer_enable(svision.timer1, TRUE);
158         timer_reset(svision.timer1, cputag_clocks_to_attotime(space->machine, "maincpu", value * delay));
158         timer_reset(svision.timer1, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(value * delay));
159159         break;
160160      case 0x10: case 0x11: case 0x12: case 0x13:
161161         svision_soundport_w(space->machine, svision_channel + 0, offset & 3, data);
src/mess/drivers/genesis.c
r8691r8692
210210         if (((megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40))
211211         {
212212            mess_io_stage[portnum]++;
213            timer_adjust_oneshot(mess_io_timeout[portnum], cputag_clocks_to_attotime(machine, "maincpu", 8192), 0);
213            timer_adjust_oneshot(mess_io_timeout[portnum], machine->device<cpu_device>("maincpu")->cycles_to_attotime(8192), 0);
214214         }
215215
216216      }
src/mess/drivers/ti89.c
r8691r8692
8484         break;
8585      case 0x02:
8686         if (!(data & 0x10) && data != state->io_hw1[offset])
87            cputag_suspend(space->machine, "maincpu", SUSPEND_REASON_DISABLE, 1);
87            space->machine->device<cpu_device>("maincpu")->suspend(SUSPEND_REASON_DISABLE, 1);
8888         break;
8989      case 0x08:
9090            state->lcd_base = data << 3;
r8691r8692
330330   if (state->on_key)
331331   {
332332      if (field->port->machine->device<cpu_device>("maincpu")->suspended(SUSPEND_REASON_DISABLE))
333         cputag_resume(field->port->machine, "maincpu", SUSPEND_REASON_DISABLE);
333         field->port->machine->device<cpu_device>("maincpu")->resume(SUSPEND_REASON_DISABLE);
334334
335335      cputag_set_input_line(field->port->machine, "maincpu", M68K_IRQ_6, HOLD_LINE);
336336   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team