Previous 15994 Revisions Next

r4088 Wednesday 7th January, 2009 at 16:23:05 UTC by Dirk Best
Replaced device_list_find_by_tag with devtag_get_device
[src/mess/devices]coco_fdc.c sonydriv.c thomflop.c
[src/mess/drivers]a2600.c a310.c acrnsys1.c adam.c amiga.c amstrad.c apf.c aquarius.c atarist.c bbc.c bebox.c bw2.c einstein.c enterp.c exidy.c ip20.c ip22.c jupiter.c kc.c kim1.c lynx.c mbee.c nc.c newbrain.c pasogo.c pcw.c pcw16.c pet.c samcoupe.c sg1000.c sord.c specpls3.c spectrum.c ssystem3.c super80.c tm990189.c tutor.c vip.c x68k.c
[src/mess/machine]6551.c 990_hd.c 994x_ser.c 99_dsk.c 99_ide.c aim65.c amigacd.c amigafdc.c amigakbd.c amstr_pc.c amstrad.c apple1.c apple2.c apple2gs.c apple3.c at.c atom.c b2m.c bbc.c bebox.c beta.c bk.c c128.c c16.c c64.c c65.c centroni.c cgenie.c coco.c compis.c comx35.c concept.c conkort.c corvushd.c cybiko.c dai.c dgn_beta.c electron.c europc.c galaxy.c gb.c genesis.c geneve.c hp48.c kc.c lisa.c lviv.c mac.c mbee.c mc10.c microtan.c mikro80.c msm8251.c msx.c msx_slot.c mtx.c mz700.c mz80.c nascom1.c nc.c nes.c orao.c oric.c orion.c osborne1.c partner.c pc.c pc8801.c pc_hdc.c pce.c pecom.c pet.c pmd85.c primo.c radio86.c samcoupe.c sms.c snescart.c special.c svi318.c sym1.c tandy1t.c thomson.c ti99_4x.c trs80.c ut88.c vc1541.c vc20.c vector06.c vectrex.c vtech1.c vtech2.c wswan.c zx.c
[src/mess/tools/messtest]testmess.c
[src/mess/video]aim65.c cbmb.c cdp1861.c cdp1862.c cdp1864.c coco.c coco3.c comx35.c crtc_ega.c i8275.c msm6255.c pc_aga.c pc_cga.c pc_ega.c pc_mda.c pc_t1t.c radio86.c vectrex.c x68k.c zx8301.c

src/mess/tools/messtest/testmess.c
r4087r4088
710710   if (ident->type == IO_UNKNOWN)
711711   {
712712      /* no device_type was specified; use the new preferred mechanism */
713      device = device_list_find_by_tag(machine->config->devicelist, DEVICE_TYPE_WILDCARD, ident->tag);
713      device = devtag_get_device(machine, DEVICE_TYPE_WILDCARD, ident->tag);
714714   }
715715   else if (ident->tag != NULL)
716716   {
src/mess/video/cbmb.c
r4087r4088
1717
1818VIDEO_UPDATE( cbmb_crtc )
1919{
20   const device_config *mc6845 = device_list_find_by_tag(screen->machine->config->devicelist, MC6845, "crtc");
20   const device_config *mc6845 = devtag_get_device(screen->machine, MC6845, "crtc");
2121   mc6845_update(mc6845, bitmap, cliprect);
2222   return 0;
2323}
src/mess/video/i8275.c
r4087r4088
504504
505505   // get the screen device
506506
507   i8275->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, i8275->intf->screen_tag);
507   i8275->screen = devtag_get_device(device->machine, VIDEO_SCREEN, i8275->intf->screen_tag);
508508   assert(i8275->screen != NULL);
509509
510510   // register for state saving
src/mess/video/coco.c
r4087r4088
6464
6565const UINT8 *get_video_ram_coco(running_machine *machine,int scanline)
6666{
67   device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883, "sam");
67   device_config *sam = (device_config*)devtag_get_device(machine, SAM6883, "sam");
6868   return sam_m6847_get_video_ram(sam,scanline);
6969}
7070
src/mess/video/cdp1862.c
r4087r4088
139139   assert(cdp1862->intf != NULL);
140140
141141   /* get the screen device */
142   cdp1862->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1862->intf->screen_tag);
142   cdp1862->screen = devtag_get_device(device->machine, VIDEO_SCREEN, cdp1862->intf->screen_tag);
143143   assert(cdp1862->screen != NULL);
144144
145145   /* allocate the temporary bitmap */
src/mess/video/radio86.c
r4087r4088
9595
9696VIDEO_UPDATE( radio86 )
9797{
98   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, I8275, "i8275");
98   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, I8275, "i8275");
9999   i8275_update( devconf, bitmap, cliprect);
100100   VIDEO_UPDATE_CALL ( generic_bitmapped );
101101   return 0;
src/mess/video/vectrex.c
r4087r4088
9898{
9999   if (vectrex_lightpen_port & 1)
100100   {
101      const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
101      const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
102102      via_ca1_w(via_0, 0, 1);
103103      via_ca1_w(via_0, 0, 0);
104104   }
r4087r4088
131131
132132READ8_HANDLER(vectrex_via_r)
133133{
134   const device_config *via = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
134   const device_config *via = devtag_get_device(space->machine, VIA6522, "via6522_0");
135135   return via_r(via, offset);
136136}
137137
138138WRITE8_HANDLER(vectrex_via_w)
139139{
140   const device_config *via = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
140   const device_config *via = devtag_get_device(space->machine, VIA6522, "via6522_0");
141141   attotime period;
142142
143143   switch (offset)
src/mess/video/aim65.c
r4087r4088
8484
8585TIMER_CALLBACK(aim65_printer_timer)
8686{
87   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
87   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
8888
8989   via_cb1_w(via_0, 0, printer_level);
9090   via_ca1_w(via_0, 0, !printer_level);
r4087r4088
9595
9696WRITE8_DEVICE_HANDLER( aim65_printer_on )
9797{
98   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
98   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
9999
100100   if (!data)
101101   {
src/mess/video/x68k.c
r4087r4088
309309
310310TIMER_CALLBACK(x68k_crtc_vblank_irq)
311311{
312   const device_config *x68k_mfp = device_list_find_by_tag(machine->config->devicelist, MC68901, MC68901_TAG);
312   const device_config *x68k_mfp = devtag_get_device(machine, MC68901, MC68901_TAG);
313313   int val = param;
314314   attotime irq_time;
315315   int vblank_line;
src/mess/video/crtc_ega.c
r4087r4088
738738      crtc_ega->hpixels_per_column = crtc_ega->intf->hpixels_per_column;
739739
740740      /* get the screen device */
741      crtc_ega->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, crtc_ega->intf->screen_tag);
741      crtc_ega->screen = devtag_get_device(device->machine, VIDEO_SCREEN, crtc_ega->intf->screen_tag);
742742      assert(crtc_ega->screen != NULL);
743743
744744      /* create the timers */
src/mess/video/zx8301.c
r4087r4088
249249   zx8301->vsync = 1;
250250
251251   /* get the screen device */
252   zx8301->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, zx8301->intf->screen_tag);
252   zx8301->screen = devtag_get_device(device->machine, VIDEO_SCREEN, zx8301->intf->screen_tag);
253253   assert(zx8301->screen != NULL);
254254
255255   /* create the timers */
src/mess/video/pc_mda.c
r4087r4088
128128
129129static VIDEO_UPDATE( mc6845_mda )
130130{
131   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, MDA_MC6845_NAME);
131   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, MC6845, MDA_MC6845_NAME);
132132   mc6845_update( devconf, bitmap, cliprect );
133133   return 0;
134134}
r4087r4088
363363 *************************************************************************/
364364WRITE8_HANDLER ( pc_MDA_w )
365365{
366   device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, MDA_MC6845_NAME);
366   device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, MDA_MC6845_NAME);
367367   switch( offset )
368368   {
369369      case 0: case 2: case 4: case 6:
r4087r4088
380380
381381 READ8_HANDLER ( pc_MDA_r )
382382{
383   device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, MDA_MC6845_NAME);
383   device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, MDA_MC6845_NAME);
384384   int data = 0xff;
385385   switch( offset )
386386   {
r4087r4088
520520
521521static VIDEO_UPDATE( mc6845_hercules )
522522{
523   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, HERCULES_MC6845_NAME);
523   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, MC6845, HERCULES_MC6845_NAME);
524524   mc6845_update( devconf, bitmap, cliprect );
525525   return 0;
526526}
r4087r4088
528528
529529static void hercules_mode_control_w(running_machine *machine, int data)
530530{
531   device_config   *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, HERCULES_MC6845_NAME);
531   device_config   *devconf = (device_config *) devtag_get_device(machine, MC6845, HERCULES_MC6845_NAME);
532532
533533   MDA_LOG(1,"hercules_mode_control_w",("$%02x: colums %d, gfx %d, enable %d, blink %d\n",
534534      data, (data&1)?80:40, (data>>1)&1, (data>>3)&1, (data>>5)&1));
r4087r4088
564564
565565static WRITE8_HANDLER ( pc_hercules_w )
566566{
567   device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, HERCULES_MC6845_NAME);
567   device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, HERCULES_MC6845_NAME);
568568
569569   switch( offset )
570570   {
r4087r4088
604604
605605static READ8_HANDLER ( pc_hercules_r )
606606{
607   device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, HERCULES_MC6845_NAME);
607   device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, HERCULES_MC6845_NAME);
608608   int data = 0xff;
609609
610610   switch( offset )
src/mess/video/pc_t1t.c
r4087r4088
165165
166166static VIDEO_UPDATE( mc6845_t1000 )
167167{
168   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, T1000_MC6845_NAME);
168   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, MC6845, T1000_MC6845_NAME);
169169   mc6845_update( devconf, bitmap, cliprect);
170170   return 0;
171171}
r4087r4088
739739   switch( offset )
740740   {
741741      case 0: case 2: case 4: case 6:
742         devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, T1000_MC6845_NAME);
742         devconf = (device_config *) devtag_get_device(space->machine, MC6845, T1000_MC6845_NAME);
743743         mc6845_address_w( devconf, offset, data );
744744         break;
745745      case 1: case 3: case 5: case 7:
746         devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, T1000_MC6845_NAME);
746         devconf = (device_config *) devtag_get_device(space->machine, MC6845, T1000_MC6845_NAME);
747747         mc6845_register_w( devconf, offset, data );
748748         break;
749749      case 8:
r4087r4088
779779   switch( offset )
780780   {
781781      case 0: case 4:
782         devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, T1000_MC6845_NAME);
782         devconf = (device_config *) devtag_get_device(space->machine, MC6845, T1000_MC6845_NAME);
783783         mc6845_address_w( devconf, offset, data );
784784         break;
785785      case 1: case 5:
786         devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, T1000_MC6845_NAME);
786         devconf = (device_config *) devtag_get_device(space->machine, MC6845, T1000_MC6845_NAME);
787787         mc6845_register_w( devconf, offset, data );
788788         break;
789789      case 10:
r4087r4088
824824         break;
825825
826826      case 1: case 3: case 5: case 7:
827         devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, T1000_MC6845_NAME);
827         devconf = (device_config *) devtag_get_device(space->machine, MC6845, T1000_MC6845_NAME);
828828         data = mc6845_register_r( devconf, offset );
829829         break;
830830
r4087r4088
884884   {
885885      pcjr.pc_framecnt++;
886886   }
887   pic8259_set_irq_line(device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259_master" ), 5, vsync);
887   pic8259_set_irq_line(devtag_get_device(device->machine, PIC8259, "pic8259_master"), 5, vsync);
888888}
889889
src/mess/video/coco3.c
r4087r4088
792792
793793const UINT8 *get_video_ram_coco3(running_machine *machine,int scanline)
794794{
795   device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883_GIME, "sam");
795   device_config *sam = (device_config*)devtag_get_device(machine, SAM6883_GIME, "sam");
796796   return sam_m6847_get_video_ram(sam,scanline);
797797}
798798
src/mess/video/pc_aga.c
r4087r4088
477477   UINT8 data = 0xFF;
478478
479479   if ( aga.mode == AGA_MONO ) {
480      device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, MDA_MC6845_NAME);
480      device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, MDA_MC6845_NAME);
481481      switch( offset )
482482      {
483483      case 0: case 2: case 4: case 6:
r4087r4088
499499static WRITE8_HANDLER ( pc_aga_mda_w )
500500{
501501   if ( aga.mode == AGA_MONO ) {
502      device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, AGA_MC6845_NAME);
502      device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, AGA_MC6845_NAME);
503503      switch( offset )
504504      {
505505         case 0: case 2: case 4: case 6:
r4087r4088
532532   UINT8 data = 0xFF;
533533
534534   if ( aga.mode == AGA_COLOR ) {
535      device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, AGA_MC6845_NAME);
535      device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, AGA_MC6845_NAME);
536536      switch( offset ) {
537537      case 0: case 2: case 4: case 6:
538538         /* return last written mc6845 address value here? */
r4087r4088
578578static WRITE8_HANDLER ( pc_aga_cga_w )
579579{
580580   if ( aga.mode == AGA_COLOR ) {
581      device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, AGA_MC6845_NAME);
581      device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, AGA_MC6845_NAME);
582582
583583      switch(offset) {
584584      case 0: case 2: case 4: case 6:
r4087r4088
659659
660660void pc_aga_set_mode(running_machine *machine, AGA_MODE mode)
661661{
662   device_config   *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, AGA_MC6845_NAME);
662   device_config   *devconf = (device_config *) devtag_get_device(machine, MC6845, AGA_MC6845_NAME);
663663
664664   aga.mode = mode;
665665
r4087r4088
738738
739739
740740static VIDEO_UPDATE( mc6845_aga ) {
741   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, AGA_MC6845_NAME);
741   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, MC6845, AGA_MC6845_NAME);
742742   mc6845_update( devconf, bitmap, cliprect);
743743
744744   return 0;
src/mess/video/pc_cga.c
r4087r4088
517517static VIDEO_UPDATE( mc6845_cga )
518518{
519519   UINT8 *gfx = memory_region(screen->machine, "gfx1");
520   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
520   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, MC6845, CGA_MC6845_NAME);
521521   mc6845_update( devconf, bitmap, cliprect);
522522
523523   /* Check for changes in font dipsetting */
r4087r4088
10591059 */
10601060static void pc_cga_mode_control_w(running_machine *machine, int data)
10611061{
1062   device_config   *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, CGA_MC6845_NAME);
1062   device_config   *devconf = (device_config *) devtag_get_device(machine, MC6845, CGA_MC6845_NAME);
10631063
10641064   CGA_LOG(1,"CGA_mode_control_w",("$%02x: columns %d, gfx %d, hires %d, blink %d\n",
10651065      data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1));
r4087r4088
11971197
11981198static READ8_HANDLER( pc_cga8_r )
11991199{
1200   device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
1200   device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, CGA_MC6845_NAME);
12011201   int data = 0xff;
12021202   switch( offset )
12031203   {
r4087r4088
12221222
12231223   switch(offset) {
12241224   case 0: case 2: case 4: case 6:
1225      devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
1225      devconf = (device_config *) devtag_get_device(space->machine, MC6845, CGA_MC6845_NAME);
12261226      mc6845_address_w( devconf, offset, data );
12271227      break;
12281228   case 1: case 3: case 5: case 7:
1229      devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
1229      devconf = (device_config *) devtag_get_device(space->machine, MC6845, CGA_MC6845_NAME);
12301230      mc6845_register_w( devconf, offset, data );
12311231      break;
12321232   case 8:
r4087r4088
14881488
14891489static WRITE8_HANDLER ( pc1512_w )
14901490{
1491   device_config   *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
1491   device_config   *devconf = (device_config *) devtag_get_device(space->machine, MC6845, CGA_MC6845_NAME);
14921492
14931493   switch (offset)
14941494   {
r4087r4088
16521652static VIDEO_UPDATE( mc6845_pc1512 )
16531653{
16541654   UINT8 *gfx = memory_region(screen->machine, "gfx1");
1655   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
1655   device_config   *devconf = (device_config *) devtag_get_device(screen->machine, MC6845, CGA_MC6845_NAME);
16561656   mc6845_update( devconf, bitmap, cliprect);
16571657
16581658   /* Check for changes in font dipsetting */
src/mess/video/pc_ega.c
r4087r4088
670670
671671   pc_ega_install_banks(machine);
672672
673   ega.crtc_ega = device_list_find_by_tag(machine->config->devicelist, CRTC_EGA, EGA_CRTC_NAME);
673   ega.crtc_ega = devtag_get_device(machine, CRTC_EGA, EGA_CRTC_NAME);
674674   ega.update_row = NULL;
675675   ega.misc_output = 0;
676676   ega.attribute.index_write = 1;
src/mess/video/msm6255.c
r4087r4088
358358
359359   // get the screen device
360360
361   msm6255->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, msm6255->intf->screen_tag);
361   msm6255->screen = devtag_get_device(device->machine, VIDEO_SCREEN, msm6255->intf->screen_tag);
362362   assert(msm6255->screen != NULL);
363363
364364   // register for state saving
src/mess/video/cdp1864.c
r4087r4088
370370   assert(cdp1864->intf->on_efx_changed != NULL);
371371
372372   /* get the screen device */
373   cdp1864->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1864->intf->screen_tag);
373   cdp1864->screen = devtag_get_device(device->machine, VIDEO_SCREEN, cdp1864->intf->screen_tag);
374374   assert(cdp1864->screen != NULL);
375375
376376   /* allocate the temporary bitmap */
src/mess/video/comx35.c
r4087r4088
112112
113113static VIDEO_UPDATE( comx35 )
114114{
115   const device_config *screen_40 = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, SCREEN_TAG);
115   const device_config *screen_40 = devtag_get_device(screen->machine, VIDEO_SCREEN, SCREEN_TAG);
116116
117117   if (screen == screen_40)
118118   {
119      const device_config *cdp1869 = device_list_find_by_tag(screen->machine->config->devicelist, CDP1869_VIDEO, CDP1869_TAG);
119      const device_config *cdp1869 = devtag_get_device(screen->machine, CDP1869_VIDEO, CDP1869_TAG);
120120
121121      cdp1869_update(cdp1869, bitmap, cliprect);
122122   }
123123   else
124124   {
125      const device_config *mc6845 = device_list_find_by_tag(screen->machine->config->devicelist, MC6845, MC6845_TAG);
125      const device_config *mc6845 = devtag_get_device(screen->machine, MC6845, MC6845_TAG);
126126     
127127      mc6845_update(mc6845, bitmap, cliprect);
128128   }
src/mess/video/cdp1861.c
r4087r4088
202202   assert(cdp1861->intf->on_efx_changed != NULL);
203203
204204   /* get the screen device */
205   cdp1861->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1861->intf->screen_tag);
205   cdp1861->screen = devtag_get_device(device->machine, VIDEO_SCREEN, cdp1861->intf->screen_tag);
206206   assert(cdp1861->screen != NULL);
207207
208208   /* allocate the temporary bitmap */
src/mess/machine/dgn_beta.c
r4087r4088
656656static WRITE8_HANDLER(d_pia1_pa_w)
657657{
658658   int   HALT_DMA;
659   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
659   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
660660   
661661   /* Only play with halt line if halt bit changed since last write */
662662   if((data & 0x80)!=d_pia1_pa_last)
r4087r4088
915915 READ8_HANDLER(dgnbeta_wd2797_r)
916916{
917917   int result = 0;
918   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
918   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
919919
920920   switch(offset & 0x03)
921921   {
r4087r4088
941941
942942WRITE8_HANDLER(dgnbeta_wd2797_w)
943943{
944   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
944   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
945945
946946    switch(offset & 0x3)
947947   {
r4087r4088
10321032
10331033static void dgnbeta_reset(running_machine *machine)
10341034{
1035   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
1035   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
10361036
10371037   system_rom = memory_region(machine, "main");
10381038
src/mess/machine/conkort.c
r4087r4088
233233
234234static WRITE8_HANDLER( slow_ctrl_w )
235235{
236   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
236   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
237237   /*
238238
239239      bit      description
src/mess/machine/hp48.c
r4087r4088
186186/* end of send event */
187187static TIMER_CALLBACK( hp48_rs232_byte_sent_cb )
188188{   
189   const device_config *xmodem = device_list_find_by_tag( machine->config->devicelist, XMODEM, "rs232_x" );
190   const device_config *kermit = device_list_find_by_tag( machine->config->devicelist, KERMIT, "rs232_k" );
189   const device_config *xmodem = devtag_get_device(machine, XMODEM, "rs232_x");
190   const device_config *kermit = devtag_get_device(machine, KERMIT, "rs232_k");
191191
192192   LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n",
193193           attotime_to_double(timer_get_time(machine)), param ));
r4087r4088
211211/* CPU initiates a send event */
212212static void hp48_rs232_send_byte( running_machine *machine )
213213{
214   const device_config *xmodem = device_list_find_by_tag( machine->config->devicelist, XMODEM, "rs232_x" );
215   const device_config *kermit = device_list_find_by_tag( machine->config->devicelist, KERMIT, "rs232_k" );   
214   const device_config *xmodem = devtag_get_device(machine, XMODEM, "rs232_x");
215   const device_config *kermit = devtag_get_device(machine, KERMIT, "rs232_k");   
216216   UINT8 data = HP48_IO_8(0x16); /* byte to send */
217217
218218   LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n",
r4087r4088
596596   {
597597                /* second nibble of received data */
598598
599      const device_config *xmodem = device_list_find_by_tag( space->machine->config->devicelist, XMODEM, "rs232_x" );
600      const device_config *kermit = device_list_find_by_tag( space->machine->config->devicelist, KERMIT, "rs232_k" );   
599      const device_config *xmodem = devtag_get_device(space->machine, XMODEM, "rs232_x");
600      const device_config *kermit = devtag_get_device(space->machine, KERMIT, "rs232_k");   
601601
602602      hp48_io[0x11] &= ~1;  /* clear byte received */
603603      data = hp48_io[offset];
src/mess/machine/apple3.c
r4087r4088
178178            a3 |= VAR_EXTA0 << ((offset - 0xD0) / 2);
179179         else
180180            a3 &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2));
181         apple3_update_drives((device_config*)device_list_find_by_tag( space->machine->config->devicelist,APPLEFDC,"fdc"));
181         apple3_update_drives((device_config*)devtag_get_device(space->machine, APPLEFDC, "fdc"));
182182         result = 0x00;
183183         break;
184184
r4087r4088
246246            a3 |= VAR_EXTA0 << ((offset - 0xD0) / 2);
247247         else
248248            a3 &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2));
249         apple3_update_drives((device_config*)device_list_find_by_tag( space->machine->config->devicelist,APPLEFDC,"fdc"));
249         apple3_update_drives((device_config*)devtag_get_device(space->machine, APPLEFDC, "fdc"));
250250         break;
251251
252252      case 0xDB:
r4087r4088
271271
272272INTERRUPT_GEN( apple3_interrupt )
273273{
274   const device_config *via_1 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_1");
274   const device_config *via_1 = devtag_get_device(device->machine, VIA6522, "via6522_1");
275275
276276   via_ca2_w(via_1, 0, (AY3600_keydata_strobe_r() & 0x80) ? 1 : 0);
277277   via_cb1_w(via_1, 0, video_screen_get_vblank(device->machine->primary_screen));
r4087r4088
467467
468468   /* reinstall VIA handlers */
469469   {
470      const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
471      const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
470      const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
471      const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
472472      memory_install_read8_device_handler(space, via_0, 0xFFD0, 0xFFDF, 0, 0, via_r);
473473      memory_install_write8_device_handler(space, via_0, 0xFFD0, 0xFFDF, 0, 0, via_w);
474474      memory_install_read8_device_handler(space, via_1, 0xFFE0, 0xFFEF, 0, 0, via_r);
r4087r4088
725725   memory_region(machine, "main")[0x0685] = 0x00;
726726
727727   apple3_enable_mask = 0;
728   apple3_update_drives((device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"));
728   apple3_update_drives((device_config*)devtag_get_device(machine, APPLEFDC, "fdc"));
729729
730730   AY3600_init(machine);
731731
src/mess/machine/c65.c
r4087r4088
510510static WRITE8_HANDLER ( c65_write_io_dc00 )
511511{
512512   running_machine *machine = space->machine;
513   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
514   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
513   const device_config *cia_0 = devtag_get_device(space->machine, CIA6526R1, "cia_0");
514   const device_config *cia_1 = devtag_get_device(space->machine, CIA6526R1, "cia_1");
515515
516516   switch(offset&0xf00) {
517517   case 0x000:
r4087r4088
566566static READ8_HANDLER ( c65_read_io_dc00 )
567567{
568568   running_machine *machine = space->machine;
569   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
570   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
569   const device_config *cia_0 = devtag_get_device(space->machine, CIA6526R1, "cia_0");
570   const device_config *cia_1 = devtag_get_device(space->machine, CIA6526R1, "cia_1");
571571
572572   switch(offset&0x300) {
573573   case 0x000:
src/mess/machine/dai.c
r4087r4088
140140
141141MACHINE_START( dai )
142142{
143   dai_tms5501 = device_list_find_by_tag( machine->config->devicelist, TMS5501, "tms5501" );
143   dai_tms5501 = devtag_get_device(machine, TMS5501, "tms5501");
144144
145145   memory_configure_bank(machine, 2, 0, 4, memory_region(machine, "main") + 0x010000, 0x1000);
146146}
r4087r4088
191191      data |= 0x08;         // serial ready
192192      if (mame_rand(space->machine)&0x01)
193193         data |= 0x40;      // random number generator
194      if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.01)
194      if (cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) > 0.01)
195195         data |= 0x80;      // tape input
196196      break;
197197
r4087r4088
226226      dai_paddle_enable = (data&0x08)>>3;
227227      dai_cassette_motor[0] = (data&0x10)>>4;
228228      dai_cassette_motor[1] = (data&0x20)>>5;
229      cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
230      cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x01) ? -1.0 : 1.0);
229      cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette"), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
230      cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), (data & 0x01) ? -1.0 : 1.0);
231231      dai_update_memory (space->machine, (data&0xc0)>>6);
232232      LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select");
233233      LOG_DAI_PORT_W (offset, (data&0x08)>>3, "discrete devices - paddle enable");
src/mess/machine/msx_slot.c
r4087r4088
11271127
11281128MSX_SLOT_RESET(diskrom)
11291129{
1130   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
1130   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
11311131   wd17xx_reset(fdc);   
11321132}
11331133
11341134static READ8_HANDLER (msx_diskrom_page1_r)
11351135{
1136   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1136   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
11371137   switch (offset) {
11381138   case 0: return wd17xx_status_r (fdc, 0);
11391139   case 1: return wd17xx_track_r (fdc, 0);
r4087r4088
11471147
11481148static READ8_HANDLER (msx_diskrom_page2_r)
11491149{
1150   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1150   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
11511151   if (offset >= 0x7f8) {
11521152      switch (offset) {
11531153      case 0x7f8:
r4087r4088
11961196
11971197MSX_SLOT_WRITE(diskrom)
11981198{
1199   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
1199   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
12001200   if (addr >= 0xa000 && addr < 0xc000) {
12011201      addr -= 0x4000;
12021202   }
r4087r4088
12431243
12441244MSX_SLOT_RESET(diskrom2)
12451245{
1246   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
1246   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
12471247   wd17xx_reset (fdc);
12481248}
12491249
12501250static READ8_HANDLER (msx_diskrom2_page1_r)
12511251{
1252   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1252   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
12531253   switch (offset) {
12541254   case 0: return wd17xx_status_r(fdc, 0);
12551255   case 1: return wd17xx_track_r(fdc, 0);
r4087r4088
12631263
12641264static  READ8_HANDLER (msx_diskrom2_page2_r)
12651265{
1266   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1266   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
12671267   if (offset >= 0x7b8) {
12681268      switch (offset) {
12691269      case 0x7b8:
r4087r4088
13111311
13121312MSX_SLOT_WRITE(diskrom2)
13131313{
1314   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
1314   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
13151315   if (addr >= 0xa000 && addr < 0xc000) {
13161316      addr -= 0x4000;
13171317   }
src/mess/machine/mbee.c
r4087r4088
8181
8282WRITE8_HANDLER ( mbee_fdc_motor_w )
8383{
84   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
84   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
8585   logerror("mbee fdc_motor_w $%02X\n", data);
8686   /* Controller latch bits
8787    * 0-1   driver select
src/mess/machine/coco.c
r4087r4088
455455
456456static void pak_load_trailer(running_machine *machine, const pak_decodedtrailer *trailer)
457457{
458   device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883, "sam");
458   device_config *sam = (device_config*)devtag_get_device(machine, SAM6883, "sam");
459459   cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc);
460460   cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x);
461461   cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y);
r4087r4088
11201120
11211121static const device_config *cartslot_image(running_machine *machine)
11221122{
1123   return device_list_find_by_tag( machine->config->devicelist, CARTSLOT, "cart" );
1123   return devtag_get_device(machine, CARTSLOT, "cart");
11241124}
11251125
11261126static const device_config *cassette_device_image(running_machine *machine)
11271127{
1128   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
1128   return devtag_get_device(machine, CASSETTE, "cassette");
11291129}
11301130
11311131static const device_config *bitbanger_image(running_machine *machine)
11321132{
1133   return device_list_find_by_tag(machine->config->devicelist, BITBANGER, "bitbanger");
1133   return devtag_get_device(machine, BITBANGER, "bitbanger");
11341134}
11351135
11361136static const device_config *printer_image(running_machine *machine)
11371137{
1138   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
1138   return devtag_get_device(machine, PRINTER, "printer");
11391139}
11401140
11411141static int get_soundmux_status(void)
r4087r4088
12151215
12161216WRITE8_HANDLER ( dgnalpha_psg_porta_write )
12171217{
1218   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1218   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
12191219   /* Bits 0..3 are the drive select lines for the internal floppy interface */
12201220   /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */
12211221   /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */
r4087r4088
16711671/* The Dragon Alpha hardware reverses the order of the WD2797 registers */
16721672READ8_HANDLER(wd2797_r)
16731673{
1674   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1674   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
16751675   int result = 0;
16761676
16771677   switch(offset & 0x03)
r4087r4088
16971697
16981698WRITE8_HANDLER(wd2797_w)
16991699{
1700   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1700   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
17011701    switch(offset & 0x3)
17021702   {
17031703      case 0:
r4087r4088
19371937
19381938   /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */
19391939   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
1940   device_config *sam = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, SAM6883, "sam");
1940   device_config *sam = (device_config*)devtag_get_device(space->machine, SAM6883, "sam");
19411941   UINT8 memsize   = get_sam_memorysize(sam);
19421942   UINT8 maptype   = get_sam_maptype(sam);
19431943//   UINT8 pagemode   = get_sam_pagemode(machine);
src/mess/machine/gb.c
r4087r4088
403403   /* NOTE: The reason we save the carts RAM this way instead of using MAME's
404404      built in macros is because they force the filename to be the name of
405405      the machine.  We need to have a separate name for each game. */
406   image_battery_save(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), gb_cart_ram, RAMBanks * 0x2000 );
406   image_battery_save(devtag_get_device(machine, CARTSLOT, "cart"), gb_cart_ram, RAMBanks * 0x2000 );
407407}
408408
409409static void gb_set_mbc1_banks( running_machine *machine ) {
src/mess/machine/990_hd.c
r4087r4088
332332   hdc.w[7] = w7_idle;
333333
334334   /* get references to harddisk devices */
335   hdc.d[0].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk1" );
336   hdc.d[1].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk2" );
337   hdc.d[2].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk3" );
338   hdc.d[3].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk4" );
335   hdc.d[0].img = devtag_get_device(machine, HARDDISK, "harddisk1");
336   hdc.d[1].img = devtag_get_device(machine, HARDDISK, "harddisk2");
337   hdc.d[2].img = devtag_get_device(machine, HARDDISK, "harddisk3");
338   hdc.d[3].img = devtag_get_device(machine, HARDDISK, "harddisk4");
339339
340340   hdc.interrupt_callback = interrupt_callback;
341341
src/mess/machine/99_dsk.c
r4087r4088
436436*/
437437void ti99_fdc_reset(running_machine *machine)
438438{
439   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
439   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
440440   ti99_disk_DSR = memory_region(machine, region_dsr) + offset_fdc_dsr;
441441   DSEL = 0;
442442   DSKnum = -1;
r4087r4088
491491*/
492492static void fdc_cru_w(running_machine *machine, int offset, int data)
493493{
494   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
494   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
495495   
496496   switch (offset)
497497   {
r4087r4088
571571*/
572572static  READ8_HANDLER(fdc_mem_r)
573573{
574   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
574   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
575575   
576576   switch (offset)
577577   {
r4087r4088
598598*/
599599static WRITE8_HANDLER(fdc_mem_w)
600600{
601   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
601   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
602602   
603603   data ^= 0xFF;   /* inverted data bus */
604604
r4087r4088
650650#if HAS_99CCFDC
651651void ti99_ccfdc_reset(running_machine *machine)
652652{
653   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
653   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
654654   
655655   ti99_disk_DSR = memory_region(machine, region_dsr) + offset_ccfdc_dsr;
656656   DSEL = 0;
r4087r4088
704704*/
705705static void ccfdc_cru_w(running_machine *machine, int offset, int data)
706706{
707   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
707   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
708708   
709709   switch (offset)
710710   {
r4087r4088
865865*/
866866void ti99_bwg_reset(running_machine *machine)
867867{
868   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
868   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
869869   
870870   ti99_disk_DSR = memory_region(machine, region_dsr) + offset_bwg_dsr;
871871        bwg_ram = memory_region(machine, region_dsr) + offset_bwg_ram;
r4087r4088
922922*/
923923static void bwg_cru_w(running_machine *machine, int offset, int data)
924924{
925   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
925   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
926926   
927927   switch (offset)
928928   {
r4087r4088
10391039*/
10401040static  READ8_HANDLER(bwg_mem_r)
10411041{
1042   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1042   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
10431043   
10441044   int reply = 0;
10451045
r4087r4088
10501050   else if (bwg_rtc_enable)
10511051   {
10521052      if (! (offset & 1))
1053         reply = mm58274c_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1);
1053         reply = mm58274c_r((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1);
10541054   }
10551055   else
10561056   {
r4087r4088
10841084*/
10851085static WRITE8_HANDLER(bwg_mem_w)
10861086{
1087   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1087   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
10881088   
10891089   if (offset < 0x1c00)
10901090      ;
r4087r4088
10931093   else if (bwg_rtc_enable)
10941094   {
10951095      if (! (offset & 1))
1096         mm58274c_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1, data);
1096         mm58274c_w((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1, data);
10971097   }
10981098   else
10991099   {
r4087r4088
14191419   {
14201420      /* rtc */
14211421      if (! (offset & 1))
1422         reply = mm58274c_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1);
1422         reply = mm58274c_r((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1);
14231423   }
14241424   else if (offset < 0x1400)
14251425   {
r4087r4088
14691469   {
14701470      /* rtc */
14711471      if (! (offset & 1))
1472         mm58274c_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1, data);
1472         mm58274c_w((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c_floppy"), (offset - 0x1FE0) >> 1, data);
14731473   }
14741474   else if (offset < 0x1400)
14751475   {
src/mess/machine/radio86.c
r4087r4088
5959
6060static READ8_DEVICE_HANDLER (radio86_8255_portc_r2 )
6161{
62   double level = cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ));                                               
62   double level = cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette"));                                               
6363   UINT8 dat = input_port_read(device->machine, "LINE8");
6464   if (level <  0) {
6565      dat ^= radio86_tape_value;
r4087r4088
7474
7575static WRITE8_DEVICE_HANDLER (radio86_8255_portc_w2 )
7676{
77   cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1);   
77   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"),data & 0x01 ? 1 : -1);   
7878}
7979
8080
r4087r4088
102102
103103static READ8_DEVICE_HANDLER (rk7007_8255_portc_r )
104104{
105   double level = cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ));                                               
105   double level = cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette"));                                               
106106   UINT8 key = 0xff;
107107   if ((radio86_keyboard_mask & 0x01)!=0) { key &= input_port_read(device->machine,"CLINE0"); }
108108   if ((radio86_keyboard_mask & 0x02)!=0) { key &= input_port_read(device->machine,"CLINE1"); }
r4087r4088
130130};
131131
132132static I8275_DMA_REQUEST(radio86_video_dma_request) {
133   const device_config *dma8257 = device_list_find_by_tag(device->machine->config->devicelist, DMA8257, "dma8257");
133   const device_config *dma8257 = devtag_get_device(device->machine, DMA8257, "dma8257");
134134   dma8257_drq_w(dma8257, 2, state);
135135}
136136
r4087r4088
143143
144144WRITE8_DEVICE_HANDLER(radio86_write_video)
145145{
146   i8275_dack_set_data((device_config*)device_list_find_by_tag( device->machine->config->devicelist, I8275, "i8275" ),data);
146   i8275_dack_set_data((device_config*)devtag_get_device(device->machine, I8275, "i8275"),data);
147147}
148148
149149const dma8257_interface radio86_dma =
src/mess/machine/b2m.c
r4087r4088
161161
162162static PIT8253_OUTPUT_CHANGED(bm2_pit_out0)
163163{
164   pic8259_set_irq_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"),1,state);     
164   pic8259_set_irq_line((device_config*)devtag_get_device(device->machine, PIC8259, "pic8259"),1,state);     
165165}
166166
167167
r4087r4088
234234{     
235235   UINT8 drive = ((data >> 1) & 1) ^ 1;
236236   UINT8 side  = (data  & 1) ^ 1;   
237   device_config *fdc = (device_config*)device_list_find_by_tag( device->machine->config->devicelist, WD1793, "wd1793");
237   device_config *fdc = (device_config*)devtag_get_device(device->machine, WD1793, "wd1793");
238238   
239239   if (b2m_drive!=drive) {
240240      wd17xx_set_drive(fdc,drive);
r4087r4088
330330
331331MACHINE_START(b2m)
332332{
333   wd17xx_set_pause_time((device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793"),10);
333   wd17xx_set_pause_time((device_config*)devtag_get_device(machine, WD1793, "wd1793"),10);
334334}
335335
336336static IRQ_CALLBACK(b2m_irq_callback)
337337{   
338   return pic8259_acknowledge((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"));   
338   return pic8259_acknowledge((device_config*)devtag_get_device(device->machine, PIC8259, "pic8259"));
339339}
340340
341341
r4087r4088
347347{   
348348   vblank_state++;
349349   if (vblank_state>1) vblank_state=0;
350   pic8259_set_irq_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"),0,vblank_state);     
350   pic8259_set_irq_line((device_config*)devtag_get_device(device->machine, PIC8259, "pic8259"),0,vblank_state);     
351351}
352352
353353MACHINE_RESET(b2m)
src/mess/machine/aim65.c
r4087r4088
213213
214214MACHINE_START( aim65 )
215215{
216   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
216   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
217217   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
218218
219219   /* Init RAM */
src/mess/machine/vc1541.c
r4087r4088
604604   
605605      if (drive->type == type_1541)
606606      {
607         const device_config *via_3 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_3");
607         const device_config *via_3 = devtag_get_device(machine, VIA6522, "via6522_3");
608608
609609         cpu_set_input_line(machine->cpu[drive->cpunumber], M6502_SET_OVERFLOW, 1);
610610         via_ca1_w(via_3, 0, 1);
r4087r4088
642642
643643   if (drive->type == type_1541)
644644   {
645      const device_config *via_3 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_3");
645      const device_config *via_3 = devtag_get_device(machine, VIA6522, "via6522_3");
646646      cpu_set_input_line(machine->cpu[drive->cpunumber], M6502_SET_OVERFLOW, 0);
647647      via_ca1_w(via_3, 0, 0);
648648   }
r4087r4088
936936
937937void vc1541_serial_atn_write (running_machine *machine, int which, int level)
938938{
939   const device_config *via_2 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_2");
939   const device_config *via_2 = devtag_get_device(machine, VIA6522, "via6522_2");
940940#if 0
941941   int value;
942942#endif
src/mess/machine/thomson.c
r4087r4088
3737/********************* common cassette code ***************************/
3838
3939INLINE const device_config* thom_cassette_img( running_machine *machine )
40{ return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ); }
40{ return devtag_get_device(machine, CASSETTE, "cassette"); }
4141
4242/*-------------- TO7 ------------*/
4343
r4087r4088
731731
732732static const device_config *printer_device(running_machine *machine)
733733{
734   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
734   return devtag_get_device(machine, PRINTER, "printer");
735735}
736736
737737/* test whether a parallel or a serial device is connected: both cannot
src/mess/machine/pmd85.c
r4087r4088
504504            switch (offset & 0x80)
505505            {
506506               case 0x80:   /* Motherboard 8255 */
507                     return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03);
507                     return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_0"), offset & 0x03);
508508            }
509509            break;
510510      case 0x08:   /* ROM module connector */
r4087r4088
520520                     switch (offset & 0x80)
521521                     {
522522                        case 0x80:   /* ROM module 8255 */
523                              return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_3" ), offset & 0x03);
523                              return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_3"), offset & 0x03);
524524                     }
525525                  }
526526                  break;
r4087r4088
535535                        case 0x10:   /* 8251 (casette recorder, V24) */
536536                              switch (offset & 0x01)
537537                              {
538                                 case 0x00: return msm8251_data_r(device_list_find_by_tag( space->machine->config->devicelist, MSM8251, "uart" ), offset & 0x01);
539                                 case 0x01: return msm8251_status_r(device_list_find_by_tag( space->machine->config->devicelist, MSM8251, "uart" ), offset & 0x01);
538                                 case 0x00: return msm8251_data_r(devtag_get_device(space->machine, MSM8251, "uart"), offset & 0x01);
539                                 case 0x01: return msm8251_status_r(devtag_get_device(space->machine, MSM8251, "uart"), offset & 0x01);
540540                              }
541541                              break;
542542                        case 0x40:      /* 8255 (GPIO/0, GPIO/1) */
543                              return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 0x03);
543                              return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_1"), offset & 0x03);
544544                        case 0x50:   /* 8253 */
545                              return pit8253_r( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), offset & 0x03);
545                              return pit8253_r( (device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), offset & 0x03);
546546                        case 0x70:   /* 8255 (IMS-2) */
547                              return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 0x03);
547                              return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_2"), offset & 0x03);
548548                     }
549549                     break;
550550               case 0x80:   /* external interfaces */
r4087r4088
571571            switch (offset & 0x80)
572572            {
573573               case 0x80:   /* Motherboard 8255 */
574                     ppi8255_w((device_config*)device_list_find_by_tag(space-> machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03, data);
574                     ppi8255_w((device_config*)devtag_get_device(space-> machine, PPI8255, "ppi8255_0"), offset & 0x03, data);
575575                     /* PMD-85.3 memory banking */
576576                     if ((offset & 0x03) == 0x03)
577577                     {
r4087r4088
594594                     switch (offset & 0x80)
595595                     {
596596                        case 0x80:   /* ROM module 8255 */
597                              ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_3" ), offset & 0x03, data);
597                              ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_3"), offset & 0x03, data);
598598                              break;
599599                     }
600600                  }
r4087r4088
610610                        case 0x10:   /* 8251 (casette recorder, V24) */
611611                              switch (offset & 0x01)
612612                              {
613                                 case 0x00: msm8251_data_w(device_list_find_by_tag( space->machine->config->devicelist, MSM8251, "uart" ), offset & 0x01, data); break;
614                                 case 0x01: msm8251_control_w(device_list_find_by_tag( space->machine->config->devicelist, MSM8251, "uart" ), offset & 0x01, data); break;
613                                 case 0x00: msm8251_data_w(devtag_get_device(space->machine, MSM8251, "uart"), offset & 0x01, data); break;
614                                 case 0x01: msm8251_control_w(devtag_get_device(space->machine, MSM8251, "uart"), offset & 0x01, data); break;
615615                              }
616616                              break;
617617                        case 0x40:      /* 8255 (GPIO/0, GPIO/0) */
618                              ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 0x03, data);
618                              ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_1"), offset & 0x03, data);
619619                              break;
620620                        case 0x50:   /* 8253 */
621                              pit8253_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), offset & 0x03, data);
621                              pit8253_w((device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), offset & 0x03, data);
622622                              logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data);
623623                              break;
624624                        case 0x70:   /* 8255 (IMS-2) */
625                              ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 0x03, data);
625                              ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_2"), offset & 0x03, data);
626626                              break;
627627                     }
628628                     break;
r4087r4088
656656            switch (offset & 0x80)
657657            {
658658               case 0x80:   /* Motherboard 8255 */
659                     return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03);
659                     return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_0"), offset & 0x03);
660660            }
661661            break;
662662   }
r4087r4088
679679            switch (offset & 0x80)
680680            {
681681               case 0x80:   /* Motherboard 8255 */
682                     ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03, data);
682                     ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_0"), offset & 0x03, data);
683683                     break;
684684            }
685685            break;
r4087r4088
778778   if (!(input_port_read(machine, "DSW0") & 0x02))   /* V.24 / Tape Switch */
779779   {
780780      /* tape reading */
781      if (cassette_get_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ))&CASSETTE_PLAY)
781      if (cassette_get_state(devtag_get_device(machine, CASSETTE, "cassette"))&CASSETTE_PLAY)
782782      {
783783         switch (pmd85_model)
784784         {
785785            case PMD85_1:
786786               if (clk_level_tape)
787787               {
788                  previous_level = (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.038) ? 1 : 0;
788                  previous_level = (cassette_input(devtag_get_device(machine, CASSETTE, "cassette")) > 0.038) ? 1 : 0;
789789                  clk_level_tape = 0;
790790               }
791791               else
792792               {
793                  current_level = (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.038) ? 1 : 0;
793                  current_level = (cassette_input(devtag_get_device(machine, CASSETTE, "cassette")) > 0.038) ? 1 : 0;
794794
795795                  if (previous_level!=current_level)
796796                  {
r4087r4088
798798
799799                     set_out_data_bit(pmd85_cassette_serial_connection.State, data);
800800                     serial_connection_out(machine, &pmd85_cassette_serial_connection);
801                     msm8251_receive_clock(device_list_find_by_tag( machine->config->devicelist, MSM8251, "uart" ));
801                     msm8251_receive_clock(devtag_get_device(machine, MSM8251, "uart"));
802802
803803                     clk_level_tape = 1;
804804                  }
r4087r4088
815815      }
816816
817817      /* tape writing */
818      if (cassette_get_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ))&CASSETTE_RECORD)
818      if (cassette_get_state(devtag_get_device(machine, CASSETTE, "cassette"))&CASSETTE_RECORD)
819819      {
820820         data = get_in_data_bit(pmd85_cassette_serial_connection.input_state);
821821         data ^= clk_level_tape;
822         cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), data&0x01 ? 1 : -1);
822         cassette_output(devtag_get_device(machine, CASSETTE, "cassette"), data&0x01 ? 1 : -1);
823823
824824         if (!clk_level_tape)
825            msm8251_transmit_clock(device_list_find_by_tag( machine->config->devicelist, MSM8251, "uart" ));
825            msm8251_transmit_clock(devtag_get_device(machine, MSM8251, "uart"));
826826
827827         clk_level_tape = clk_level_tape ? 0 : 1;
828828
r4087r4088
832832      clk_level_tape = 1;
833833
834834      if (!clk_level)
835         msm8251_transmit_clock(device_list_find_by_tag( machine->config->devicelist, MSM8251, "uart" ));
835         msm8251_transmit_clock(devtag_get_device(machine, MSM8251, "uart"));
836836      clk_level = clk_level ? 0 : 1;
837837   }
838838}
r4087r4088
900900}
901901
902902static TIMER_CALLBACK( setup_machine_state ) {
903   device_config *pit8253 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" );
903   device_config *pit8253 = (device_config*)devtag_get_device(machine, PIT8253, "pit8253");
904904
905905   pit8253_gate_w(pit8253, 0, 1);
906906   pit8253_gate_w(pit8253, 1, 1);
907907   pit8253_gate_w(pit8253, 2, 1);
908908   if (pmd85_model!=MATO) {
909      msm8251_connect(device_list_find_by_tag( machine->config->devicelist, MSM8251, "uart" ), &pmd85_cassette_serial_connection);
909      msm8251_connect(devtag_get_device(machine, MSM8251, "uart"), &pmd85_cassette_serial_connection);
910910   }
911911}
912912
src/mess/machine/c128.c
r4087r4088
9393WRITE8_HANDLER( c128_write_d000 )
9494{
9595   running_machine *machine = space->machine;
96   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
97   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
96   const device_config *cia_0 = devtag_get_device(space->machine, CIA6526R1, "cia_0");
97   const device_config *cia_1 = devtag_get_device(space->machine, CIA6526R1, "cia_1");
9898
9999   UINT8 c64_port6510 = (UINT8) device_get_info_int(space->machine->cpu[0], CPUINFO_INT_M6510_PORT);
100100
r4087r4088
148148static READ8_HANDLER( c128_read_io )
149149{
150150   running_machine *machine = space->machine;
151   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
152   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
151   const device_config *cia_0 = devtag_get_device(space->machine, CIA6526R1, "cia_0");
152   const device_config *cia_1 = devtag_get_device(space->machine, CIA6526R1, "cia_1");
153153
154154   if (offset < 0x400)
155155      return vic2_port_r (space, offset & 0x3ff);
r4087r4088
840840   {
841841      if (direction & 0x08)
842842      {
843         cassette_output(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
843         cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
844844      }
845845
846846      if (direction & 0x20)
847847      {
848848         if(!(data & 0x20))
849849         {
850            cassette_change_state(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
850            cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
851851            timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
852852         }
853853         else
854854         {
855            cassette_change_state(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" ),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
855            cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
856856            timer_reset(datasette_timer, attotime_never);
857857         }
858858      }
r4087r4088
868868{
869869   UINT8 data = c64_port_data;
870870
871   if ((cassette_get_state(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" )) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
871   if ((cassette_get_state(devtag_get_device(device->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
872872      data &= ~0x10;
873873   else
874874      data |=  0x10;
src/mess/machine/pet.c
r4087r4088
4444
4545static READ8_HANDLER( pet_mc6845_register_r )
4646{
47   device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, "crtc");
47   device_config *devconf = (device_config *) devtag_get_device(space->machine, MC6845, "crtc");
4848   return mc6845_register_r(devconf, offset);
4949}
5050
5151static WRITE8_HANDLER( pet_mc6845_register_w )
5252{
53   device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, "crtc");
53   device_config *devconf = (device_config *) devtag_get_device(space->machine, MC6845, "crtc");
5454   mc6845_register_w(devconf, offset, data);
5555}
5656
5757static WRITE8_HANDLER( pet_mc6845_address_w )
5858{
59   device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, "crtc");
59   device_config *devconf = (device_config *) devtag_get_device(space->machine, MC6845, "crtc");
6060   mc6845_address_w(devconf, offset, data);
6161}
6262
r4087r4088
7878{
7979   int data = 0xf0 | pet_keyline_select;
8080
81   if ((cassette_get_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" )) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
81   if ((cassette_get_state(devtag_get_device(space->machine, CASSETTE, "cassette1")) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
8282      data &= ~0x10;
8383
84   if ((cassette_get_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette2" )) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
84   if ((cassette_get_state(devtag_get_device(space->machine, CASSETTE, "cassette2")) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
8585      data &= ~0x20;
8686
8787   if (!cbm_ieee_eoi_r(space->machine))
r4087r4088
144144static READ8_HANDLER( pet_pia0_ca1_in )
145145{
146146   // cassette 1 read
147   return (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" )) > +0.0) ? 1 : 0;
147   return (cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette1")) > +0.0) ? 1 : 0;
148148}
149149
150150
r4087r4088
157157{
158158   if (!data)
159159   {
160      cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
160      cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette1"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
161161      timer_adjust_periodic(datasette1_timer, attotime_zero, 0, ATTOTIME_IN_HZ(48000));   // I put 48000 because I was given some .wav with this freq
162162   }
163163   else
164164   {
165      cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
165      cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette1"),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
166166      timer_reset(datasette1_timer, attotime_never);
167167   }
168168}
r4087r4088
301301
302302   if (!(data & 0x10))
303303   {
304      cassette_change_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette2" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
304      cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette2"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
305305      timer_adjust_periodic(datasette2_timer, attotime_zero, 0, ATTOTIME_IN_HZ(48000));   // I put 48000 because I was given some .wav with this freq
306306   }
307307   else
308308   {
309      cassette_change_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette2" ),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
309      cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette2"),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
310310      timer_reset(datasette2_timer, attotime_never);
311311   }
312312
r4087r4088
321321static READ8_DEVICE_HANDLER( pet_via_cb1_r )
322322{
323323   // cassette 2 read
324   return (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette2" )) > +0.0) ? 1 : 0;
324   return (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette2")) > +0.0) ? 1 : 0;
325325}
326326
327327
r4087r4088
352352
353353static WRITE8_HANDLER(cbm8096_io_w)
354354{
355   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
355   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
356356
357357   if (offset < 0x10) ;
358358   else if (offset < 0x14) pia_0_w(space, offset & 3, data);
r4087r4088
367367
368368static READ8_HANDLER(cbm8096_io_r)
369369{
370   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
370   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
371371
372372   int data = 0xff;
373373   if (offset < 0x10) ;
r4087r4088
562562static TIMER_CALLBACK( pet_tape1_timer )
563563{
564564//  cassette 1
565   UINT8 data = (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette1" )) > +0.0) ? 1 : 0;
565   UINT8 data = (cassette_input(devtag_get_device(machine, CASSETTE, "cassette1")) > +0.0) ? 1 : 0;
566566   pia_0_ca1_w(cputag_get_address_space(machine,"main",ADDRESS_SPACE_PROGRAM), 0, data);
567567}
568568
569569/* NOT WORKING - Just placeholder */
570570static TIMER_CALLBACK( pet_tape2_timer )
571571{
572   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
572   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
573573//  cassette 2
574   UINT8 data = (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette2" )) > +0.0) ? 1 : 0;
574   UINT8 data = (cassette_input(devtag_get_device(machine, CASSETTE, "cassette2")) > +0.0) ? 1 : 0;
575575   via_cb1_w(via_0, 0, data);
576576}
577577
src/mess/machine/c16.c
r4087r4088
135135
136136//   data &= ~0x20; // port bit not in pinout
137137
138   if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > +0.0)
138   if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > +0.0)
139139      data |=  0x10;
140140   else
141141      data &= ~0x10;
142142
143   cassette_change_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), (c16_port7501 & 0x08) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
143   cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"), (c16_port7501 & 0x08) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
144144
145145   return data;
146146}
r4087r4088
303303{
304304   int data = 0x00;
305305
306   if (!((cassette_get_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY))
306   if (!((cassette_get_state(devtag_get_device(space->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY))
307307      data |= 0x04;
308308   return data;
309309}
r4087r4088
312312{
313313   int data = 0x00;
314314
315   if (!((cassette_get_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY))
315   if (!((cassette_get_state(devtag_get_device(space->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY))
316316      data |= 0x04;
317317   return data;
318318}
src/mess/machine/oric.c
r4087r4088
274274
275275static const device_config *cassette_device_image(running_machine *machine)
276276{
277   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
277   return devtag_get_device(machine, CASSETTE, "cassette");
278278}
279279
280280/* not called yet - this will update the via with the state of the tape data.
r4087r4088
283283{
284284   int data;
285285   int input_port_9;
286   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
286   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
287287
288288   data = 0;
289289
r4087r4088
352352static void oric_printer_handshake_in(running_machine *machine,int number, int data, int mask)
353353{
354354   int acknowledge;
355   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
355   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
356356
357357   acknowledge = 1;
358358
r4087r4088
732732
733733static READ8_HANDLER (oric_jasmin_r)
734734{
735   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
736   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
735   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
736   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
737737   unsigned char data = 0x0ff;
738738
739739   switch (offset & 0x0f)
r4087r4088
763763
764764static WRITE8_HANDLER(oric_jasmin_w)
765765{
766   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
767   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
766   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
767   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
768768   switch (offset & 0x0f)
769769   {
770770      /* microdisc floppy disc interface */
r4087r4088
970970READ8_HANDLER (oric_microdisc_r)
971971{
972972   unsigned char data = 0x0ff;
973   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
973   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
974974   
975975   switch (offset & 0x0ff)
976976   {
r4087r4088
998998
999999      default:
10001000         {
1001            const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1001            const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
10021002            data = via_r(via_0, offset & 0x0f);
10031003         }
10041004         break;
r4087r4088
10101010
10111011WRITE8_HANDLER(oric_microdisc_w)
10121012{
1013   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
1013   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
10141014   switch (offset & 0x0ff)
10151015   {
10161016      /* microdisc floppy disc interface */
r4087r4088
10581058
10591059      default:
10601060         {
1061            const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1061            const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
10621062            via_w(via_0, offset & 0x0f, data);
10631063         }
10641064         break;
r4087r4088
11391139
11401140static void oric_common_init_machine(running_machine *machine)
11411141{
1142   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
1142   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
11431143
11441144   /* clear all irqs */
11451145   oric_irqs = 0;
r4087r4088
12261226
12271227READ8_HANDLER ( oric_IO_r )
12281228{
1229   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1229   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
12301230#if 0
12311231   switch (input_port_read(machine, "FLOPPY") & 0x07)
12321232   {
r4087r4088
12661266
12671267WRITE8_HANDLER ( oric_IO_w )
12681268{
1269   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1269   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
12701270#if 0
12711271   switch (input_port_read(machine, "FLOPPY") & 0x07)
12721272   {
src/mess/machine/europc.c
r4087r4088
170170      europc_pio.port61=data;
171171//      if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4;
172172//      else if (data==0x34) pc1640.port62=pc1640.port65&0xf;
173      pit8253_gate_w( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
173      pit8253_gate_w( (device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), 2, data & 1);
174174      pc_speaker_set_spkrdata( data & 0x02 );
175175      pc_keyb_set_clock(data&0x40);
176176      break;
r4087r4088
192192      data=europc_pio.port61;
193193      break;
194194   case 2:
195      if (pit8253_get_output(device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ),2)) data|=0x20;
195      if (pit8253_get_output(devtag_get_device(space->machine, PIT8253, "pit8253"),2)) data|=0x20;
196196      break;
197197   }
198198   return data;
src/mess/machine/orao.c
r4087r4088
5757       case 0x03FF : return input_port_read(space->machine, "LINE19");
5858       /* Tape */
5959       case 0x07FF :
60                level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ));                                               
60                level = cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette"));                                               
6161               if (level <  0) {
6262                  return 0x00;
6363               }
src/mess/machine/at.c
r4087r4088
405405
406406static device_config * at_get_device(running_machine *machine )
407407{
408   return (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC765A, "nec765");   
408   return (device_config*)devtag_get_device(machine, NEC765A, "nec765");
409409}
410410
411411static const struct pc_fdc_interface fdc_interface =
r4087r4088
765765
766766MACHINE_RESET( at )
767767{
768   at_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
769   at_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
770   at_devices.dma8237_1 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
771   at_devices.dma8237_2 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
772   at_devices.pit8254 = device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" );
773   pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, NS16450, "ns16450_0" ) );
768   at_devices.pic8259_master = devtag_get_device(machine, PIC8259, "pic8259_master");
769   at_devices.pic8259_slave = devtag_get_device(machine, PIC8259, "pic8259_slave");
770   at_devices.dma8237_1 = devtag_get_device(machine, DMA8237, "dma8237_1");
771   at_devices.dma8237_2 = devtag_get_device(machine, DMA8237, "dma8237_2");
772   at_devices.pit8254 = devtag_get_device(machine, PIT8254, "pit8254");
773   pc_mouse_set_serial_port( devtag_get_device(machine, NS16450, "ns16450_0") );
774774}
775775
src/mess/machine/vector06.c
r4087r4088
4141
4242static READ8_DEVICE_HANDLER (vector06_8255_portc_r )
4343{   
44   double level = cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ));
44   double level = cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette"));
4545   UINT8 retVal = input_port_read(device->machine, "LINE8");
4646   if (level >  0) {
4747      retVal |= 0x10;
r4087r4088
124124};
125125
126126READ8_HANDLER(vector_8255_1_r) {
127   return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), (offset ^ 0x03));
127   return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), (offset ^ 0x03));
128128}
129129
130130WRITE8_HANDLER(vector_8255_1_w) {
131   ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), (offset ^0x03) , data );
131   ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), (offset ^0x03) , data );
132132
133133}
134134
135135READ8_HANDLER(vector_8255_2_r) {
136   return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_2" ), (offset ^ 0x03));
136   return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_2"), (offset ^ 0x03));
137137}
138138
139139WRITE8_HANDLER(vector_8255_2_w) {
140   ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_2" ), (offset ^0x03) , data );
140   ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_2"), (offset ^0x03) , data );
141141
142142}
143143
r4087r4088
171171
172172WRITE8_HANDLER(vector_disc_w)
173173{
174   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
174   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
175175   wd17xx_set_side (fdc,((data & 4) >> 2) ^ 1);
176176    wd17xx_set_drive(fdc,data & 1);               
177177}
r4087r4088
205205
206206MACHINE_START( vector06 )
207207{
208   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793");
208   device_config *fdc = (device_config*)devtag_get_device(machine, WD1793, "wd1793");
209209   wd17xx_set_density (fdc, DEN_FM_HI);
210210}
211211
src/mess/machine/electron.c
r4087r4088
1616static emu_timer *electron_tape_timer;
1717
1818static const device_config *cassette_device_image( running_machine *machine ) {
19   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
19   return devtag_get_device(machine, CASSETTE, "cassette");
2020}
2121
2222static void electron_tape_start( void ) {
src/mess/machine/pc_hdc.c
r4087r4088
215215   switch( id )
216216   {
217217   case 0:
218      img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk1" );
218      img = devtag_get_device(machine, HARDDISK, "harddisk1");
219219      break;
220220   case 1:
221      img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk2" );
221      img = devtag_get_device(machine, HARDDISK, "harddisk2");
222222      break;
223223   case 2:
224      img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk3" );
224      img = devtag_get_device(machine, HARDDISK, "harddisk3");
225225      break;
226226   case 3:
227      img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk4" );
227      img = devtag_get_device(machine, HARDDISK, "harddisk4");
228228      break;
229229   }
230230
src/mess/machine/orion.c
r4087r4088
7171
7272MACHINE_START( orion128 )
7373{
74   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793");
74   device_config *fdc = (device_config*)devtag_get_device(machine, WD1793, "wd1793");
7575
7676   wd17xx_set_density (fdc,DEN_FM_HI);   
7777   orion_video_mode_mask = 7;
r4087r4088
7979
8080READ8_HANDLER ( orion128_system_r )
8181{
82   return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 3);
82   return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_2"), offset & 3);
8383}
8484
8585WRITE8_HANDLER ( orion128_system_w )
8686{
87   ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 3, data);   
87   ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_2"), offset & 3, data);   
8888}
8989
9090READ8_HANDLER ( orion128_romdisk_r )
9191{
92   return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);   
92   return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_1"), offset & 3);   
9393}
9494
9595WRITE8_HANDLER ( orion128_romdisk_w )
9696{   
97   ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3, data);   
97   ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_1"), offset & 3, data);   
9898}
9999
100100static void orion_set_video_mode(running_machine *machine, int width) {
r4087r4088
204204
205205static WRITE8_HANDLER ( orion_disk_control_w )
206206{
207   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
207   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
208208
209209   wd17xx_set_side(fdc,((data & 0x10) >> 4) ^ 1);
210210    wd17xx_set_drive(fdc,data & 3);           
r4087r4088
212212
213213READ8_HANDLER ( orion128_floppy_r )
214214{   
215   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
215   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
216216
217217   switch(offset) {
218218      case 0x0   :
r4087r4088
229229
230230WRITE8_HANDLER ( orion128_floppy_w )
231231{     
232   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
232   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
233233   
234234   switch(offset) {
235235      case 0x0   :
r4087r4088
272272
273273MACHINE_START( orionz80 )
274274{
275   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793");
275   device_config *fdc = (device_config*)devtag_get_device(machine, WD1793, "wd1793");
276276
277277   wd17xx_set_density (fdc,DEN_FM_HI);
278278   mc146818_init(machine, MC146818_IGNORE_CENTURY);
r4087r4088
443443
444444MACHINE_START( orionpro )
445445{
446   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793");
446   device_config *fdc = (device_config*)devtag_get_device(machine, WD1793, "wd1793");
447447   wd17xx_set_density (fdc,DEN_FM_HI);
448448}
449449
r4087r4088
562562}
563563
564564READ8_HANDLER ( orionpro_io_r ) {
565   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
565   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
566566     
567567   switch (offset & 0xff) {     
568568      case 0x00 : return 0x56;
r4087r4088
593593}
594594
595595WRITE8_HANDLER ( orionpro_io_w ) {
596   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
596   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
597597     
598598   switch (offset & 0xff) {     
599599      case 0x04 : orionpro_ram0_segment = data; orionpro_bank_switch(space->machine); break;     
src/mess/machine/amigafdc.c
r4087r4088
606606   const device_config *cia;
607607
608608   /* Issue a index pulse when a disk revolution completes */
609   cia = device_list_find_by_tag(machine->config->devicelist, CIA8520, "cia_1");
609   cia = devtag_get_device(machine, CIA8520, "cia_1");
610610   cia_issue_index(cia);
611611
612612   timer_adjust_oneshot(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive);
src/mess/machine/bk.c
r4087r4088
102102}
103103
104104READ16_HANDLER (bk_key_press_r) {
105   double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ));                                               
105   double level = cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette"));                                               
106106   UINT16 cas;
107107   if (level < 0) {
108108       cas = 0x00;
src/mess/machine/amigakbd.c
r4087r4088
2222static void kbd_sendscancode( running_machine *machine, UINT8 scancode )
2323{
2424   int j;
25   const device_config *cia = device_list_find_by_tag(machine->config->devicelist, CIA8520, "cia_0");
25   const device_config *cia = devtag_get_device(machine, CIA8520, "cia_0");
2626
2727   /* send over to the cia A */
2828   for( j = 0; j < 8; j++ )
src/mess/machine/nascom1.c
r4087r4088
7878
7979WRITE8_HANDLER( nascom2_fdc_select_w )
8080{
81   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
81   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
8282   nascom2_fdc.select = data;
8383
8484   logerror("nascom2_fdc_select_w: %02x\n", data);
r4087r4088
107107DEVICE_IMAGE_LOAD( nascom2_floppy )
108108{
109109   int sides, sectors;
110   device_config *fdc = (device_config*)device_list_find_by_tag( image->machine->config->devicelist, WD1793, "wd1793");
110   device_config *fdc = (device_config*)devtag_get_device(image->machine, WD1793, "wd1793");
111111   if (!image_has_been_created(image))
112112   {
113113      switch (image_length(image))
r4087r4088
165165WRITE8_HANDLER( nascom1_port_00_w )
166166{
167167
168   cassette_change_state( device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),
168   cassette_change_state( devtag_get_device(space->machine, CASSETTE, "cassette"),
169169      ( data & 0x10 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR );
170170
171171   if (!(data & NASCOM1_KEY_RESET))
r4087r4088
296296
297297MACHINE_RESET( nascom1 )
298298{
299   nascom1_hd6402 = device_list_find_by_tag( machine->config->devicelist, AY31015, "hd6402" );
299   nascom1_hd6402 = devtag_get_device(machine, AY31015, "hd6402");
300300
301301   /* Set up hd6402 pins */
302302   ay31015_set_input_pin( nascom1_hd6402, AY31015_SWE, 1 );
src/mess/machine/microtan.c
r4087r4088
161161
162162static const device_config *cassette_device_image(running_machine *machine)
163163{
164   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
164   return devtag_get_device(machine, CASSETTE, "cassette");
165165}
166166
167167/**************************************************************
r4087r4088
340340static TIMER_CALLBACK(microtan_read_cassette)
341341{
342342   double level = cassette_input(cassette_device_image(machine));
343   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
343   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
344344
345345   LOG(("microtan_read_cassette: %g\n", level));
346346   if (level < -0.07)
r4087r4088
714714{
715715    UINT8 *RAM = memory_region(machine, "main");
716716   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
717   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
718   const device_config *via_1 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_1");
717   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
718   const device_config *via_1 = devtag_get_device(machine, VIA6522, "via6522_1");
719719   
720720    /* check for .DMP file format */
721721    if (snapshot_size == 8263)
src/mess/machine/osborne1.c
r4087r4088
7474READ8_HANDLER( osborne1_2000_r )
7575{
7676   UINT8   data = 0xFF;
77   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, MB8877, "mb8877");
77   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
7878   /* Check whether regular RAM is enabled */
7979   if ( ! osborne1.bank2_enabled )
8080   {
r4087r4088
121121
122122WRITE8_HANDLER( osborne1_2000_w )
123123{
124   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, MB8877, "mb8877");
124   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
125125   /* Check whether regular RAM is enabled */
126126   if ( ! osborne1.bank2_enabled )
127127   {
r4087r4088
277277
278278static WRITE8_HANDLER( video_pia_port_a_w )
279279{
280   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, MB8877, "mb8877");
280   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
281281   osborne1.new_start_x = data >> 1;
282282   wd17xx_set_density(fdc, ( data & 0x01 ) ? DEN_FM_LO : DEN_FM_HI );
283283
r4087r4088
287287
288288static WRITE8_HANDLER( video_pia_port_b_w )
289289{
290   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, MB8877, "mb8877");
290   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
291291   osborne1.new_start_y = data & 0x1F;
292292   osborne1.beep = ( data & 0x20 ) ? 1 : 0;
293293   if ( data & 0x40 )
r4087r4088
415415DEVICE_IMAGE_LOAD( osborne1_floppy )
416416{
417417   int size, sectors, sectorsize;
418   device_config *fdc = (device_config*)device_list_find_by_tag( image->machine->config->devicelist, MB8877, "mb8877");
418   device_config *fdc = (device_config*)devtag_get_device(image->machine, MB8877, "mb8877");
419419
420420   if ( ! image_has_been_created( image ) )
421421   {
src/mess/machine/vtech1.c
r4087r4088
166166
167167static const device_config *cassette_device_image(running_machine *machine)
168168{
169   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
169   return devtag_get_device(machine, CASSETTE, "cassette");
170170}
171171
172172
r4087r4088
545545
546546static const device_config *printer_device(running_machine *machine)
547547{
548   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
548   return devtag_get_device(machine, PRINTER, "printer");
549549}
550550
551551/*
src/mess/machine/amstrad.c
r4087r4088
136136   AmstradCPC_SetUpperRom(machine, pSnapshot[0x055]);
137137
138138   /* PPI */
139   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),3,pSnapshot[0x059] & 0x0ff);
139   ppi8255_w((device_config*)devtag_get_device(machine, PPI8255, "ppi8255"),3,pSnapshot[0x059] & 0x0ff);
140140
141   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),0,pSnapshot[0x056] & 0x0ff);
142   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),1,pSnapshot[0x057] & 0x0ff);
143   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),2,pSnapshot[0x058] & 0x0ff);
141   ppi8255_w((device_config*)devtag_get_device(machine, PPI8255, "ppi8255"),0,pSnapshot[0x056] & 0x0ff);
142   ppi8255_w((device_config*)devtag_get_device(machine, PPI8255, "ppi8255"),1,pSnapshot[0x057] & 0x0ff);
143   ppi8255_w((device_config*)devtag_get_device(machine, PPI8255, "ppi8255"),2,pSnapshot[0x058] & 0x0ff);
144144
145145   /* PSG */
146146   for (i=0; i<16; i++)
src/mess/machine/sms.c
r4087r4088
582582static void sms_machine_stop(running_machine *machine) {
583583   /* Does the cartridge have SRAM that should be saved? */
584584   if ( sms_cartridge[sms_current_cartridge].sram_save )
585      image_battery_save(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart1"), sms_cartridge[sms_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
585      image_battery_save(devtag_get_device(machine, CARTSLOT, "cart1"), sms_cartridge[sms_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
586586}
587587
588588void setup_rom(const address_space *space)
src/mess/machine/samcoupe.c
r4087r4088
150150
151151static READ8_HANDLER( samcoupe_rtc_r )
152152{
153   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, MSM6242, "sambus_clock");
153   const device_config *rtc = devtag_get_device(space->machine, MSM6242, "sambus_clock");
154154   return msm6242_r(rtc, offset >> 12);
155155}
156156
157157
158158static WRITE8_HANDLER( samcoupe_rtc_w )
159159{
160   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, MSM6242, "sambus_clock");
160   const device_config *rtc = devtag_get_device(space->machine, MSM6242, "sambus_clock");
161161   msm6242_w(rtc, offset >> 12, data);
162162}
163163
src/mess/machine/comx35.c
r4087r4088
178178static UINT8 fdc_r(const address_space *space)
179179{
180180   comx35_state *state = space->machine->driver_data;
181   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1770, "wd1770");
181   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1770, "wd1770");
182182
183183   UINT8 data;
184184
r4087r4088
196196
197197static void fdc_w(const address_space *space, UINT8 data)
198198{
199   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1770, "wd1770");
199   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1770, "wd1770");
200200   /*
201201
202202      bit      description
src/mess/machine/trs80.c
r4087r4088
5959
6060static TIMER_CALLBACK( cassette_data_callback )
6161{
62   double new_val = cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ));
62   double new_val = cassette_input(devtag_get_device(machine, CASSETTE, "cassette"));
6363
6464   /* Check for HI-LO transition */
6565   if ( old_cassette_val > -0.2 && new_val < -0.2 )
r4087r4088
300300WRITE8_HANDLER( trs80_port_ff_w )
301301{
302302   static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 };
303   const device_config *cass = device_list_find_by_tag(space->machine->config->devicelist, CASSETTE, "cassette" );
303   const device_config *cass = devtag_get_device(space->machine, CASSETTE, "cassette");
304304
305305   cassette_change_state( cass, ( data & 0x04 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR );
306306
r4087r4088
401401WRITE8_HANDLER( trs80_motor_w )
402402{
403403   UINT8 drive = 255;
404   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
404   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
405405
406406   LOG(("trs80 motor_w $%02X\n", data));
407407
src/mess/machine/tandy1t.c
r4087r4088
184184   switch (offset) {
185185   case 1:
186186      tandy_ppi.portb = data;
187      pit8253_gate_w( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
187      pit8253_gate_w( (device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), 2, data & 1);
188188      pc_speaker_set_spkrdata( data & 0x02 );
189189      pc_keyb_set_clock(data&0x40);
190190      if ( data & 0x80 ) {
src/mess/machine/primo.c
r4087r4088
9393   // bit 3 - I3 (external bus)
9494
9595   // bit 2 - cassette
96   data |= (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) < 0.1) ? 0x04 : 0x00;
96   data |= (cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) < 0.1) ? 0x04 : 0x00;
9797
9898   // bit 1 - reset button
9999   data |= (input_port_read(space->machine, "RESET")) ? 0x02 : 0x00;
r4087r4088
157157   switch (data & 0x03)
158158   {
159159      case 0:
160         cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), -1.0);
160         cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), -1.0);
161161         break;
162162      case 1:
163163      case 2:
164         cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), 0.0);
164         cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), 0.0);
165165         break;
166166      case 3:
167         cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), 1.0);
167         cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), 1.0);
168168         break;
169169   }
170170}
src/mess/machine/svi318.c
r4087r4088
165165{
166166   int data = 0x0f;
167167
168   if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038)
168   if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.0038)
169169      data |= 0x80;
170170   if (!svi318_cassette_present(device->machine, 0))
171171      data |= 0x40;
r4087r4088
226226   if (svi318_cassette_present(device->machine, 0))
227227   {
228228      cassette_change_state(
229         device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),
229         devtag_get_device(device->machine, CASSETTE, "cassette"),
230230         (data & 0x10) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,
231231         CASSETTE_MOTOR_DISABLED);
232232   }
233233
234234   /* cassette signal write */
235   cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x20) ? -1.0 : +1.0);
235   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x20) ? -1.0 : +1.0);
236236
237237   svi.keyboard_row = data & 0x0F;
238238}
r4087r4088
261261
262262static const device_config *printer_image(running_machine *machine)
263263{
264   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
264   return devtag_get_device(machine, PRINTER, "printer");
265265}
266266
267267static WRITE8_HANDLER( svi318_printer_w )
r4087r4088
361361
362362static WRITE8_HANDLER( svi318_fdc_drive_motor_w )
363363{
364   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
364   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
365365   switch (data & 3)
366366   {
367367   case 1:
r4087r4088
378378static WRITE8_HANDLER( svi318_fdc_density_side_w )
379379{
380380   const device_config *image;
381   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
381   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
382382
383383   wd17xx_set_density(fdc, data & 0x01 ? DEN_FM_LO:DEN_MFM_LO);
384384
r4087r4088
507507   }
508508   else if (!strcmp(screen->tag, "svi806"))
509509   {
510      const device_config *mc6845 = device_list_find_by_tag(screen->machine->config->devicelist, MC6845, "crtc");
510      const device_config *mc6845 = devtag_get_device(screen->machine, MC6845, "crtc");
511511      mc6845_update(mc6845, bitmap, cliprect);
512512   }
513513   else
r4087r4088
775775
776776int svi318_cassette_present(running_machine *machine, int id)
777777{
778   const device_config *img = device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
778   const device_config *img = devtag_get_device(machine, CASSETTE, "cassette");
779779
780780   if ( img == NULL )
781781      return FALSE;
r4087r4088
787787READ8_HANDLER( svi318_io_ext_r )
788788{
789789   UINT8 data = 0xff;
790   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
790   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
791791
792792   if (svi.bankLow == SVI_CART) {
793793      return 0xff;
r4087r4088
806806   case 0x25:
807807   case 0x26:
808808   case 0x27:
809      data = ins8250_r(device_list_find_by_tag( space->machine->config->devicelist, INS8250, "ins8250_0" ), offset & 7);
809      data = ins8250_r(devtag_get_device(space->machine, INS8250, "ins8250_0"), offset & 7);
810810      break;
811811
812812   case 0x28:
r4087r4088
817817   case 0x2D:
818818   case 0x2E:
819819   case 0x2F:
820      data = ins8250_r(device_list_find_by_tag( space->machine->config->devicelist, INS8250, "ins8250_1" ), offset & 7);
820      data = ins8250_r(devtag_get_device(space->machine, INS8250, "ins8250_1"), offset & 7);
821821      break;
822822
823823   case 0x30:
r4087r4088
836836      data = svi318_fdc_irqdrq_r(space, 0);
837837      break;
838838   case 0x51: {
839      device_config *devconf = (device_config *) device_list_find_by_tag( space->machine->config->devicelist, MC6845, "crtc");
839      device_config *devconf = (device_config *) devtag_get_device(space->machine, MC6845, "crtc");
840840      data = mc6845_register_r(devconf, 0);
841841      }
842842      break;
r4087r4088
847847
848848WRITE8_HANDLER( svi318_io_ext_w )
849849{
850   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
850   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
851851   
852852   if (svi.bankLow == SVI_CART) {
853853      return;
r4087r4088
867867   case 0x25:
868868   case 0x26:
869869   case 0x27:
870      ins8250_w(device_list_find_by_tag( space->machine->config->devicelist, INS8250, "ins8250_0" ), offset & 7, data);
870      ins8250_w(devtag_get_device(space->machine, INS8250, "ins8250_0"), offset & 7, data);
871871      break;
872872
873873   case 0x28:
r4087r4088
878878   case 0x2D:
879879   case 0x2E:
880880   case 0x2F:
881      ins8250_w(device_list_find_by_tag( space->machine->config->devicelist, INS8250, "ins8250_1" ), offset & 7, data);
881      ins8250_w(devtag_get_device(space->machine, INS8250, "ins8250_1"), offset & 7, data);
882882      break;
883883
884884   case 0x30:
r4087r4088
901901      break;
902902
903903   case 0x50: {
904      device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, "crtc");
904      device_config *devconf = (device_config *) devtag_get_device(space->machine, MC6845, "crtc");
905905      mc6845_address_w(devconf, 0, data);
906906      }
907907      break;
908908   case 0x51: {
909      device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, "crtc");
909      device_config *devconf = (device_config *) devtag_get_device(space->machine, MC6845, "crtc");
910910      mc6845_register_w(devconf, 0, data);
911911      }
912912      break;
src/mess/machine/amstr_pc.c
r4087r4088
154154      pc1640.port61=data;
155155      if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4;
156156      else if (data==0x34) pc1640.port62=pc1640.port65&0xf;
157      pit8253_gate_w( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
157      pit8253_gate_w( (device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), 2, data & 1);
158158      pc_speaker_set_spkrdata( data & 0x02 );
159159      pc_keyb_set_clock(data&0x40);
160160      break;
r4087r4088
192192
193193   case 2:
194194      data = pc1640.port62;
195      if (pit8253_get_output(device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 2))
195      if (pit8253_get_output(devtag_get_device(space->machine, PIT8253, "pit8253"), 2))
196196         data |= 0x20;
197197      break;
198198   }
src/mess/machine/galaxy.c
r4087r4088
2222
2323   if (offset == 0)
2424   {
25      double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ));
25      double level = cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette"));
2626      return (level >  0) ? 0xfe : 0xff;
2727   }
2828   else
r4087r4088
3737{   
3838   double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000;         
3939   gal_latch_value = data;
40   cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), val);
40   cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), val);
4141}
4242
4343
src/mess/machine/994x_ser.c
r4087r4088
116116      return INIT_FAIL;
117117   
118118   if (id==0) {
119      tms9902 = device_list_find_by_tag(image->machine->config->devicelist, TMS9902, "tms9902_0");
119      tms9902 = devtag_get_device(image->machine, TMS9902, "tms9902_0");
120120   }
121121   if (id==1) {
122      tms9902 = device_list_find_by_tag(image->machine->config->devicelist, TMS9902, "tms9902_1");
122      tms9902 = devtag_get_device(image->machine, TMS9902, "tms9902_1");
123123   }
124124   
125125   rs232_fp = image;
r4087r4088
251251
252252   case 1:
253253      /* first 9902 */
254      reply = tms9902_cru_r(device_list_find_by_tag(machine->config->devicelist, TMS9902, "tms9902_0"), offset);
254      reply = tms9902_cru_r(devtag_get_device(machine, TMS9902, "tms9902_0"), offset);
255255      break;
256256
257257   case 2:
258258      /* second 9902 */
259      reply = tms9902_cru_r(device_list_find_by_tag(machine->config->devicelist, TMS9902, "tms9902_1"), offset);
259      reply = tms9902_cru_r(devtag_get_device(machine, TMS9902, "tms9902_1"), offset);
260260      break;
261261
262262   default:
r4087r4088
352352
353353   case 1:
354354      /* first 9902 */
355      tms9902_cru_w(device_list_find_by_tag(machine->config->devicelist, TMS9902, "tms9902_0"), offset, data);
355      tms9902_cru_w(devtag_get_device(machine, TMS9902, "tms9902_0"), offset, data);
356356      break;
357357
358358   case 2:
359359      /* second 9902 */
360      tms9902_cru_w(device_list_find_by_tag(machine->config->devicelist, TMS9902, "tms9902_1"), offset, data);
360      tms9902_cru_w(devtag_get_device(machine, TMS9902, "tms9902_1"), offset, data);
361361      break;
362362
363363   default:
src/mess/machine/compis.c
r4087r4088
288288/*-------------------------------------------------------------------------*/
289289static void compis_fdc_reset(running_machine *machine)
290290{
291   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC765A, "nec765");     
291   device_config *fdc = (device_config*)devtag_get_device(machine, NEC765A, "nec765");
292292   
293293   nec765_reset(fdc, 0);
294294
r4087r4088
298298
299299static void compis_fdc_tc(running_machine *machine, int state)
300300{
301   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC765A, "nec765");
301   device_config *fdc = (device_config*)devtag_get_device(machine, NEC765A, "nec765");
302302   /* Terminal count if iSBX-218A has DMA enabled */
303303     if (input_port_read(machine, "DSW1"))
304304   {
r4087r4088
334334
335335READ16_HANDLER (compis_fdc_dack_r)
336336{
337   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
337   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
338338   UINT16 data;
339339   data = 0xffff;   
340340   /* DMA acknowledge if iSBX-218A has DMA enabled */
r4087r4088
348348
349349WRITE16_HANDLER (compis_fdc_w)
350350{
351   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
351   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
352352   switch(offset)
353353   {
354354      case 2:
r4087r4088
362362
363363READ16_HANDLER (compis_fdc_r)
364364{
365   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
365   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
366366   UINT16 data;
367367   data = 0xffff;
368368   switch(offset)
r4087r4088
389389
390390static const device_config *printer_device(running_machine *machine)
391391{
392   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
392   return devtag_get_device(machine, PRINTER, "printer");
393393}
394394
395395/*-------------------------------------------------------------------------*/
r4087r4088
532532
533533READ16_HANDLER ( compis_rtc_r )
534534{
535   return mm58274c_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), offset);
535   return mm58274c_r((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), offset);
536536}
537537
538538WRITE16_HANDLER ( compis_rtc_w )
539539{
540   mm58274c_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), offset, data);
540   mm58274c_w((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), offset, data);
541541}
542542
543543/*-------------------------------------------------------------------------*/
r4087r4088
560560
561561READ16_HANDLER ( compis_usart_r )
562562{
563   const device_config *uart = device_list_find_by_tag(space->machine->config->devicelist, MSM8251, "uart");
563   const device_config *uart = devtag_get_device(space->machine, MSM8251, "uart");
564564   return msm8251_data_r(uart, offset);
565565}
566566
567567WRITE16_HANDLER ( compis_usart_w )
568568{
569   const device_config *uart = device_list_find_by_tag(space->machine->config->devicelist, MSM8251, "uart");
569   const device_config *uart = devtag_get_device(space->machine, MSM8251, "uart");
570570   switch (offset)
571571   {
572572      case 0x00:
r4087r4088
15591559   /* OSP PIC 8259 */
15601560   cpu_set_irq_callback(machine->cpu[0], compis_irq_callback);
15611561
1562   compis_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
1563   compis_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
1562   compis_devices.pic8259_master = (device_config*)devtag_get_device(machine, PIC8259, "pic8259_master");
1563   compis_devices.pic8259_slave = (device_config*)devtag_get_device(machine, PIC8259, "pic8259_slave");
15641564}
15651565
15661566/*-------------------------------------------------------------------------*/
src/mess/machine/vtech2.c
r4087r4088
198198
199199static const device_config *vtech2_cassette_image(running_machine *machine)
200200{
201   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
201   return devtag_get_device(machine, CASSETTE, "cassette");
202202}
203203
204204/*************************************************
src/mess/machine/corvushd.c
r4087r4088
11811181   /* Only one harddisk supported right now */
11821182   assert ( id == 0 );
11831183
1184   img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, tags[id] );
1184   img = devtag_get_device(machine, HARDDISK, tags[id]);
11851185
11861186   if ( !img )
11871187      return NULL;
src/mess/machine/wswan.c
r4087r4088
200200
201201static void wswan_machine_stop( running_machine *machine ) {
202202   if ( eeprom.size ) {
203      image_battery_save( device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), eeprom.data, eeprom.size );
203      image_battery_save( devtag_get_device(machine, CARTSLOT, "cart"), eeprom.data, eeprom.size );
204204   }
205205}
206206
src/mess/machine/zx.c
r4087r4088
173173      }
174174      else
175175      {
176         if ((cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) < -0.75) && zx_tape_bit)
176         if ((cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) < -0.75) && zx_tape_bit)
177177         {
178178            zx_tape_bit = 0x00;
179179            timer_set(space->machine, ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse);
r4087r4088
238238      }
239239      else
240240      {
241         if ((cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) < -0.75) && zx_tape_bit)
241         if ((cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) < -0.75) && zx_tape_bit)
242242         {
243243            zx_tape_bit = 0x00;
244244            timer_set(space->machine, ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse);
src/mess/machine/apple2gs.c
r4087r4088
10411041      case 0x39:   /* C039 - SCCAREG */
10421042      case 0x3A:   /* C03A - SCCBDATA */
10431043      case 0x3B:   /* C03B - SCCADATA */
1044         scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
1044         scc = devtag_get_device(space->machine, SCC8530, "scc");
10451045         result = scc_r(scc, offset & 0x03);
10461046         break;
10471047
r4087r4088
11811181      case 0x39:   /* C039 - SCCAREG */
11821182      case 0x3A:   /* C03A - SCCBDATA */
11831183      case 0x3B:   /* C03B - SCCADATA */
1184         scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
1184         scc = devtag_get_device(space->machine, SCC8530, "scc");
11851185         scc_w(scc, offset & 0x03, data);
11861186         break;
11871187
src/mess/machine/nc.c
r4087r4088
146146
147147DEVICE_IMAGE_LOAD( nc_serial )
148148{
149   const device_config *uart = device_list_find_by_tag(image->machine->config->devicelist, MSM8251, "uart");
149   const device_config *uart = devtag_get_device(image->machine, MSM8251, "uart");
150150
151151   /* filename specified */
152152   if (device_load_serial_device(image)==INIT_PASS)
src/mess/machine/mac.c
r4087r4088
571571static TIMER_CALLBACK(kbd_clock)
572572{
573573   int i;
574   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
574   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
575575
576576   if (kbd_comm == TRUE)
577577   {
r4087r4088
890890
891891void mac_scc_mouse_irq(running_machine *machine, int x, int y)
892892{
893   const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc");
893   const device_config *scc = devtag_get_device(machine, SCC8530, "scc");
894894   static int last_was_x = 0;
895895
896896   if (x && y)
r4087r4088
918918
919919READ16_HANDLER ( mac_scc_r )
920920{
921   const device_config *scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
921   const device_config *scc = devtag_get_device(space->machine, SCC8530, "scc");
922922   UINT16 result;
923923
924924   result = scc_r(scc, offset);
r4087r4088
929929
930930WRITE16_HANDLER ( mac_scc_w )
931931{
932   const device_config *scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
932   const device_config *scc = devtag_get_device(space->machine, SCC8530, "scc");
933933   scc_w(scc, offset, (UINT8) data);
934934}
935935
936936WRITE16_HANDLER ( mac_scc_2_w )
937937{
938   const device_config *scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
938   const device_config *scc = devtag_get_device(space->machine, SCC8530, "scc");
939939   UINT8 wdata = data>>8;
940940
941941   scc_w(scc, offset, wdata);
r4087r4088
15121512
15131513static TIMER_CALLBACK(mac_adb_tick)
15141514{
1515   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
1515   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
15161516
15171517   // do one clock transition on CB1 to advance the VIA shifter
15181518   adb_extclock ^= 1;
r4087r4088
17241724{
17251725   set_scc_waitrequest((data & 0x80) >> 7);
17261726   mac_set_screen_buffer((data & 0x40) >> 6);
1727   sony_set_sel_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist,APPLEFDC,"fdc"),(data & 0x20) >> 5);
1727   sony_set_sel_line((device_config*)devtag_get_device(device->machine, APPLEFDC, "fdc"),(data & 0x20) >> 5);
17281728   if (mac_model == MODEL_MAC_SE)   // on SE this selects which floppy drive (0 = upper, 1 = lower)
17291729   {
17301730      mac_drive_select = ((data & 0x10) >> 4);
r4087r4088
17771777READ16_HANDLER ( mac_via_r )
17781778{
17791779   UINT16 data;
1780   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1780   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
17811781
17821782   offset >>= 8;
17831783   offset &= 0x0f;
r4087r4088
17911791
17921792WRITE16_HANDLER ( mac_via_w )
17931793{
1794   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1794   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
17951795
17961796   offset >>= 8;
17971797   offset &= 0x0f;
r4087r4088
18141814READ16_HANDLER ( mac_via2_r )
18151815{
18161816   int data;
1817   const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
1817   const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
18181818
18191819   offset >>= 8;
18201820   offset &= 0x0f;
r4087r4088
18281828
18291829WRITE16_HANDLER ( mac_via2_w )
18301830{
1831   const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
1831   const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
18321832
18331833   offset >>= 8;
18341834   offset &= 0x0f;
r4087r4088
20382038static void mac_vblank_irq(running_machine *machine)
20392039{
20402040   static int irq_count = 0, ca1_data = 0, ca2_data = 0;
2041   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
2041   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
20422042
20432043   /* handle ADB keyboard/mouse */
20442044   if (has_adb())
src/mess/machine/nes.c
r4087r4088
6666
6767static const device_config *cartslot_image(running_machine *machine)
6868{
69   return device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart");
69   return devtag_get_device(machine, CARTSLOT, "cart");
7070}
7171
7272static void init_nes_core (running_machine *machine)
src/mess/machine/amigacd.c
r4087r4088
524524MACHINE_RESET( amigacd )
525525{
526526   /* initialize the cdrom */
527   matsucd_init( device_list_find_by_tag( machine->config->devicelist, CDROM, "cdrom" ) );
527   matsucd_init( devtag_get_device(machine, CDROM, "cdrom") );
528528   matsucd_set_status_enabled_callback( cdrom_status_enabled );
529529   matsucd_set_status_changed_callback( cdrom_status_change );
530530   matsucd_set_subcode_ready_callback( cdrom_subcode_ready );
src/mess/machine/concept.c
r4087r4088
329329      /* calendar R/W */
330330      VLOG(("concept_io_r: Calendar read at address 0x03%4.4x\n", offset << 1));
331331      if (!clock_enable)
332         return mm58274c_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), clock_address);
332         return mm58274c_r((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), clock_address);
333333      break;
334334
335335   case 7:
r4087r4088
377377         /* NVIA versatile system interface */
378378         LOG(("concept_io_r: VIA read at address 0x03%4.4x\n", offset << 1));
379379         {
380            const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
380            const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
381381            return via_r(via_0, offset & 0xf);
382382         }
383383         break;
r4087r4088
471471      /* calendar R/W */
472472      LOG(("concept_io_w: Calendar written to at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data));
473473      if (!clock_enable)
474         mm58274c_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), clock_address, data & 0xf);
474         mm58274c_w((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), clock_address, data & 0xf);
475475      break;
476476
477477   case 7:
r4087r4088
490490      case 3:
491491         /* NVIA versatile system interface */
492492         {
493            const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
493            const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
494494            via_w(via_0, offset & 0xf, data);
495495         }
496496         break;
r4087r4088
602602
603603static  READ8_HANDLER(concept_fdc_reg_r)
604604{
605   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
605   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
606606   switch (offset)
607607   {
608608   case 0:
r4087r4088
637637static WRITE8_HANDLER(concept_fdc_reg_w)
638638{
639639   int current_drive;
640   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
640   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
641641   switch (offset)
642642   {
643643   case 0:
src/mess/machine/msx.c
r4087r4088
325325
326326MACHINE_START( msx2 )
327327{
328   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
328   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
329329   wd17xx_set_density (fdc,DEN_FM_HI);
330330   msx1.dsk_stat = 0x7f;
331331}
r4087r4088
447447
448448static const device_config *cassette_device_image(running_machine *machine)
449449{
450   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
450   return devtag_get_device(machine, CASSETTE, "cassette");
451451}
452452
453453static const device_config *printer_image(running_machine *machine)
454454{
455   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
455   return devtag_get_device(machine, PRINTER, "printer");
456456}
457457
458458READ8_HANDLER ( msx_psg_port_a_r )
r4087r4088
601601
602602WRITE8_HANDLER (msx_rtc_reg_w)
603603{
604   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, TC8521, "rtc");
604   const device_config *rtc = devtag_get_device(space->machine, TC8521, "rtc");
605605   tc8521_w(rtc, msx1.rtc_latch, data);
606606}
607607
608608READ8_HANDLER (msx_rtc_reg_r)
609609{
610   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, TC8521, "rtc");
610   const device_config *rtc = devtag_get_device(space->machine, TC8521, "rtc");
611611   return tc8521_r(rtc, msx1.rtc_latch);
612612}
613613
614614NVRAM_HANDLER( msx2 )
615615{
616   const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, TC8521, "rtc");
616   const device_config *rtc = devtag_get_device(machine, TC8521, "rtc");
617617   if (file)
618618   {
619619      if (read_or_write)
src/mess/machine/mz700.c
r4087r4088
168168    if (mz700_motor_on)
169169        data |= 0x10;
170170
171    if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038)
171    if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.0038)
172172        data |= 0x20;       /* set the RDATA status */
173173
174174   if (ne556_out[0])
r4087r4088
217217   pio_port_c_output = data;
218218
219219   cassette_change_state(
220      device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),
220      devtag_get_device(device->machine, CASSETTE, "cassette"),
221221      ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
222222      CASSETTE_MOTOR_DISABLED);
223223
224    cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x02) ? +1.0 : -1.0);
224    cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x02) ? +1.0 : -1.0);
225225}
226226
227227/************************ MMIO ***********************************************/
r4087r4088
236236   {
237237   /* the first four ports are connected to a 8255 PPI */
238238    case 0: case 1: case 2: case 3:
239      data = ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3);
239      data = ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), offset & 3);
240240      break;
241241
242242   case 4: case 5: case 6: case 7:
243      data = pit8253_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), offset & 3);
243      data = pit8253_r((device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), offset & 3);
244244        break;
245245
246246   case 8:
r4087r4088
260260   {
261261   /* the first four ports are connected to a 8255 PPI */
262262    case 0: case 1: case 2: case 3:
263      ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3, data);
263      ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), offset & 3, data);
264264        break;
265265
266266   /* the next four ports are connected to a 8253 PIT */
267267    case 4: case 5: case 6: case 7:
268      pit8253_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), offset & 3, data);
268      pit8253_w((device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), offset & 3, data);
269269      break;
270270
271271   case 8:
272272      LOG(1,"mz700_e008_w",("%02X\n", data),space->machine);
273      pit8253_gate_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 0, data & 1);
273      pit8253_gate_w((device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), 0, data & 1);
274274        break;
275275   }
276276}
r4087r4088
518518   {
519519   /* the first four ports are connected to a 8255 PPI */
520520    case 0: case 1: case 2: case 3:
521      data = ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3);
521      data = ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), offset & 3);
522522      break;
523523
524524   case 4: case 5: case 6: case 7:
525      data = pit8253_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), offset & 3);
525      data = pit8253_r((device_config*)devtag_get_device(space->machine, PIT8253, "pit8253"), offset & 3);
526526        break;
527527
528528   default:
src/mess/machine/vectrex.c
r4087r4088
281281
282282TIMER_CALLBACK(vectrex_imager_eye)
283283{
284   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
284   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
285285   int coffset;
286286   double rtime = (1.0 / imager_freq);
287287
src/mess/machine/lisa.c
r4087r4088
337337
338338INLINE void COPS_send_data_if_possible(running_machine *machine)
339339{
340   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
340   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
341341
342342   if ((! hold_COPS_data) && fifo_size && (! COPS_Ready))
343343   {
r4087r4088
523523static TIMER_CALLBACK(read_COPS_command)
524524{
525525   int command;
526   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
526   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
527527
528528   COPS_Ready = 0;
529529
r4087r4088
818818
819819static WRITE8_DEVICE_HANDLER(COPS_via_out_b)
820820{
821   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
821   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
822822
823823   /* pull-up */
824824   data |= (~ via_r(via_0, VIA_DDRA)) & 0x01;
r4087r4088
11701170   init_COPS(machine);
11711171
11721172   {
1173      const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
1173      const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
11741174      COPS_via_out_ca2(via_0, 0, 0);   /* VIA core forgets to do so */
11751175   }
11761176
11771177   /* initialize floppy */
11781178   {
11791179      if (lisa_features.floppy_hardware == sony_lisa2)
1180         sony_set_enable_lines((device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"),1);   /* on lisa2, drive unit 1 is always selected (?) */
1180         sony_set_enable_lines((device_config*)devtag_get_device(machine, APPLEFDC, "fdc"),1);   /* on lisa2, drive unit 1 is always selected (?) */
11811181   }
11821182}
11831183
r4087r4088
13281328      /*if (lisa_features.floppy_hardware == twiggy)
13291329         twiggy_set_head_line(offset & 1);
13301330      else*/ if (lisa_features.floppy_hardware == sony_lisa210)
1331         sony_set_sel_line((device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"), offset & 1);
1331         sony_set_sel_line((device_config*)devtag_get_device(machine, APPLEFDC, "fdc"), offset & 1);
13321332      break;
13331333   case 6:
13341334      DISK_DIAG = offset & 1;
r4087r4088
19051905
19061906static READ16_HANDLER ( lisa_IO_r )
19071907{
1908   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
1909   const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
1908   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
1909   const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
19101910   int answer=0;
19111911
19121912   switch ((offset & 0x7000) >> 12)
r4087r4088
20342034
20352035static WRITE16_HANDLER ( lisa_IO_w )
20362036{
2037   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
2038   const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
2037   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
2038   const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
20392039
20402040   switch ((offset & 0x7000) >> 12)
20412041   {
src/mess/machine/sym1.c
r4087r4088
137137   riot_port_b = data;
138138
139139   /* first 4 pins are connected to the 74145 */
140   ttl74145_w( (device_config*)device_list_find_by_tag( device->machine->config->devicelist, TTL74145, "ttl74145" ), 0, data & 0x0f);
140   ttl74145_w( (device_config*)devtag_get_device(device->machine, TTL74145, "ttl74145"), 0, data & 0x0f);
141141}
142142
143143
src/mess/machine/cgenie.c
r4087r4088
8383
8484static TIMER_CALLBACK( handle_cassette_input )
8585{
86   UINT8 new_level = ( cassette_input( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ) ) > 0.0 ) ? 1 : 0;
86   UINT8 new_level = ( cassette_input( devtag_get_device(machine, CASSETTE, "cassette") ) > 0.0 ) ? 1 : 0;
8787
8888   if ( new_level != cass_level )
8989   {
r4087r4088
321321{
322322   int port_ff_changed = port_ff ^ data;
323323
324   cassette_output ( device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), data & 0x01 ? -1.0 : 1.0 );
324   cassette_output ( devtag_get_device(space->machine, CASSETTE, "cassette"), data & 0x01 ? -1.0 : 1.0 );
325325
326326   /* background bits changed ? */
327327   if( port_ff_changed & FF_BGD )
r4087r4088
476476
477477 READ8_HANDLER( cgenie_status_r )
478478{
479   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
479   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
480480   /* If the floppy isn't emulated, return 0 */
481481   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
482482      return 0;
r4087r4088
485485
486486 READ8_HANDLER( cgenie_track_r )
487487{
488   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
488   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
489489   /* If the floppy isn't emulated, return 0xff */
490490   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
491491      return 0xff;
r4087r4088
494494
495495 READ8_HANDLER( cgenie_sector_r )
496496{
497   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
497   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
498498   /* If the floppy isn't emulated, return 0xff */
499499   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
500500      return 0xff;
r4087r4088
503503
504504 READ8_HANDLER(cgenie_data_r )
505505{
506   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
506   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
507507   /* If the floppy isn't emulated, return 0xff */
508508   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
509509      return 0xff;
r4087r4088
512512
513513WRITE8_HANDLER( cgenie_command_w )
514514{
515   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
515   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
516516   /* If the floppy isn't emulated, return immediately */
517517   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
518518      return;
r4087r4088
521521
522522WRITE8_HANDLER( cgenie_track_w )
523523{
524   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
524   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
525525   /* If the floppy isn't emulated, ignore the write */
526526   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
527527      return;
r4087r4088
530530
531531WRITE8_HANDLER( cgenie_sector_w )
532532{
533   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
533   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
534534   /* If the floppy isn't emulated, ignore the write */
535535   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
536536      return;
r4087r4088
539539
540540WRITE8_HANDLER( cgenie_data_w )
541541{
542   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
542   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
543543   /* If the floppy isn't emulated, ignore the write */
544544   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
545545      return;
r4087r4088
592592
593593WRITE8_HANDLER( cgenie_motor_w )
594594{
595   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
595   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
596596   UINT8 drive = 255;
597597
598598   logerror("cgenie motor_w $%02X\n", data);
src/mess/machine/geneve.c
r4087r4088
290290*/
291291static void inta_callback(running_machine *machine, int state)
292292{
293   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 1, state);
293   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 1, state);
294294   cpu_set_input_line(machine->cpu[0], 1, state ? ASSERT_LINE : CLEAR_LINE);
295295}
296296
r4087r4088
299299*/
300300static void intb_callback(running_machine *machine, int state)
301301{
302   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 12, state);
302   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 12, state);
303303}
304304
305305
r4087r4088
419419         case 0xf13d:
420420         case 0xf13e:
421421         case 0xf13f:
422            return mm58274c_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), offset-0xf130);
422            return mm58274c_r((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), offset-0xf130);
423423
424424         default:
425425            logerror("unmapped read offs=%d\n", (int) offset);
r4087r4088
465465         case 0x801d:
466466         case 0x801e:
467467         case 0x801f:
468            return mm58274c_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), offset-0xf130);
468            return mm58274c_r((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), offset-0xf130);
469469
470470         default:
471471            logerror("unmapped read offs=%d\n", (int) offset);
r4087r4088
682682         case 0xf13d:
683683         case 0xf13e:
684684         case 0xf13f:
685            mm58274c_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), offset-0xf130, data);
685            mm58274c_w((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), offset-0xf130, data);
686686            return;
687687
688688         default:
r4087r4088
731731         case 0x801d:
732732         case 0x801e:
733733         case 0x801f:
734            mm58274c_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, MM58274C, "mm58274c"), offset-0xf130, data);
734            mm58274c_w((device_config*)devtag_get_device(space->machine, MM58274C, "mm58274c"), offset-0xf130, data);
735735            return;
736736
737737         default:
r4087r4088
948948               KeyQueueLen--;
949949            }
950950            /* clear keyboard interrupt */
951            tms9901_set_single_int(device_list_find_by_tag(space->machine->config->devicelist, TMS9901, "tms9901"), 8, 0);
951            tms9901_set_single_int(devtag_get_device(space->machine, TMS9901, "tms9901"), 8, 0);
952952            KeyInBuf = 0;
953953         }
954954      }
r4087r4088
969969   buffer clear is disabled, and key queue is not empty. */
970970   if ((! KeyReset) && (mode_flags & mf_keyclock) && (mode_flags & mf_keyclear) && KeyQueueLen)
971971   {
972      tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 8, 1);
972      tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 8, 1);
973973      KeyInBuf = 1;
974974   }
975975}
r4087r4088
12811281*/
12821282/*void tms9901_set_int2(int state)
12831283{
1284   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 2, state);
1284   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 2, state);
12851285}*/
12861286
12871287/*
src/mess/machine/beta.c
r4087r4088
7070READ8_HANDLER(betadisk_status_r)
7171{
7272   if (betadisk_active==1) {
73      return wd17xx_status_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
73      return wd17xx_status_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
7474   } else {
7575      return 0xff;
7676   }
r4087r4088
7979READ8_HANDLER(betadisk_track_r)
8080{
8181   if (betadisk_active==1) {
82      return wd17xx_track_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
82      return wd17xx_track_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
8383   } else {
8484      return 0xff;
8585   }
r4087r4088
8888READ8_HANDLER(betadisk_sector_r)
8989{
9090   if (betadisk_active==1) {
91      return wd17xx_sector_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
91      return wd17xx_sector_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
9292   } else {
9393      return 0xff;
9494   }
r4087r4088
9797READ8_HANDLER(betadisk_data_r)
9898{
9999   if (betadisk_active==1) {
100      return wd17xx_data_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
100      return wd17xx_data_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
101101   } else {
102102      return 0xff;
103103   }
r4087r4088
114114
115115WRITE8_HANDLER(betadisk_param_w)
116116{
117   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
117   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
118118   if (betadisk_active==1) {
119119        wd17xx_set_drive(fdc, data & 3); 
120120        wd17xx_set_side (fdc,(data & 0x10) ? 0 : 1 );
r4087r4088
130130WRITE8_HANDLER(betadisk_command_w)
131131{
132132   if (betadisk_active==1) {
133      wd17xx_command_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset, data);
133      wd17xx_command_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset, data);
134134   }   
135135}
136136
137137WRITE8_HANDLER(betadisk_track_w)
138138{
139139   if (betadisk_active==1) {
140      wd17xx_track_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset, data);
140      wd17xx_track_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset, data);
141141   }   
142142}
143143
144144WRITE8_HANDLER(betadisk_sector_w)
145145{
146146   if (betadisk_active==1) {
147      wd17xx_sector_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset, data);
147      wd17xx_sector_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset, data);
148148   }   
149149}
150150
151151WRITE8_HANDLER(betadisk_data_w)
152152{
153153   if (betadisk_active==1) {
154      wd17xx_data_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset, data);
154      wd17xx_data_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset, data);
155155   }   
156156}
157157
src/mess/machine/lviv.c
r4087r4088
6666static READ8_DEVICE_HANDLER ( lviv_ppi_0_portc_r )
6767{
6868   UINT8 data = lviv_ppi_port_outputs[0][2] & 0x0f;
69   if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0.038)
69   if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.038)
7070      data |= 0x10;
7171   if (lviv_ppi_port_outputs[0][0] & input_port_read(device->machine, "JOY"))
7272      data |= 0x80;
r4087r4088
8989   lviv_ppi_port_outputs[0][2] = data;
9090   if (lviv_ppi_port_outputs[0][1]&0x80)
9191      speaker_level_w(0, data&0x01);
92   cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x01) ? -1.0 : 1.0);
92   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x01) ? -1.0 : 1.0);
9393   lviv_update_memory(device->machine);
9494}
9595
r4087r4088
146146      switch ((offset >> 4) & 0x3)
147147      {
148148      case 0:
149         return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 3);
149         return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_0"), offset & 3);
150150         break;
151151
152152      case 1:
153         return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);
153         return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_1"), offset & 3);
154154         break;
155155
156156      case 2:
r4087r4088
184184      switch ((offset >> 4) & 0x3)
185185      {
186186      case 0:
187         ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 3, data);
187         ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_0"), offset & 3, data);
188188         break;
189189
190190      case 1:
191         ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3, data);
191         ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255_1"), offset & 3, data);
192192         break;
193193
194194      case 2:
src/mess/machine/pc8801.c
r4087r4088
723723
724724static UINT8 load_8255_A(running_machine *machine, int chip)
725725{
726   return use_5FD ? ppi8255_get_port_b((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, chip ? "ppi8255_0" : "ppi8255_1" ) ) : 0xff;
726   return use_5FD ? ppi8255_get_port_b((device_config*)devtag_get_device(machine, PPI8255, chip? "ppi8255_0" : "ppi8255_1" ) ) : 0xff;
727727}
728728
729729static UINT8 load_8255_B(running_machine *machine, int chip)
730730{
731   return use_5FD ? ppi8255_get_port_a((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, chip ? "ppi8255_0" : "ppi8255_1" ) ) : 0xff;
731   return use_5FD ? ppi8255_get_port_a((device_config*)devtag_get_device(machine, PPI8255, chip? "ppi8255_0" : "ppi8255_1" ) ) : 0xff;
732732}
733733
734734static UINT8 load_8255_C(running_machine *machine, int chip)
r4087r4088
738738
739739   if (use_5FD)
740740   {
741      port_c = ppi8255_get_port_c((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, chip ? "ppi8255_0" : "ppi8255_1" ) );
741      port_c = ppi8255_get_port_c((device_config*)devtag_get_device(machine, PPI8255, chip? "ppi8255_0" : "ppi8255_1" ) );
742742      result = ((port_c >> 4) & 0x0F) | ((port_c << 4) & 0xF0);
743743   }
744744
r4087r4088
795795
796796READ8_HANDLER(pc8801fd_nec765_tc)
797797{
798  device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
798  device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
799799  nec765_set_tc_state(fdc, 1);
800800  nec765_set_tc_state(fdc, 0);
801801  return 0;
src/mess/machine/mc10.c
r4087r4088
135135     *   BIT 4 CASSETTE TAPE INPUT
136136     */
137137
138   const device_config *img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
138   const device_config *img = devtag_get_device(space->machine, CASSETTE, "cassette");
139139   int val = 0xed;
140140
141141   if ((input_port_read(space->machine, "LINE6") | mc10_keyboard_strobe) == 0xff)
r4087r4088
150150
151151WRITE8_HANDLER ( mc10_port2_w )
152152{
153   const device_config *img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
153   const device_config *img = devtag_get_device(space->machine, CASSETTE, "cassette");
154154
155155   /*   BIT 0 PRINTER OUTFUT & CASS OUTPUT
156156     */
src/mess/machine/6551.c
r4087r4088
8484   acia6551_t *acia;
8585
8686   /* NPW 29-Nov-2008 - These two lines are a hack and indicate why our "serial" infrastructure needs to be updated */
87   device = device_list_find_by_tag(machine->config->devicelist, ACIA6551, "acia");
87   device = devtag_get_device(machine, ACIA6551, "acia");
8888   acia = get_token(device);
8989
9090   acia->connection.input_state = state;
src/mess/machine/atom.c
r4087r4088
5353
5454static const device_config *cassette_device_image(running_machine *machine)
5555{
56   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
56   return devtag_get_device(machine, CASSETTE, "cassette");
5757}
5858
5959static const device_config *printer_image(running_machine *machine)
6060{
61   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
61   return devtag_get_device(machine, PRINTER, "printer");
6262}
6363
6464/* printer status */
r4087r4088
414414/* KT- I've assumed that the atom 8271 is linked in exactly the same way as on the bbc */
415415READ8_HANDLER(atom_8271_r)
416416{
417   device_config *i8271 = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, I8271, "i8271" );
417   device_config *i8271 = (device_config*)devtag_get_device(space->machine, I8271, "i8271");
418418
419419   switch (offset)
420420   {
r4087r4088
435435
436436WRITE8_HANDLER(atom_8271_w)
437437{
438   device_config *i8271 = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, I8271, "i8271" );
438   device_config *i8271 = (device_config*)devtag_get_device(space->machine, I8271, "i8271");
439439
440440   switch (offset)
441441   {
src/mess/machine/vc20.c
r4087r4088
9696
9797   if(via0_ca2)
9898   {
99      cassette_change_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
99      cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
100100      timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
101101   }
102102   else
103103   {
104      cassette_change_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
104      cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"),CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
105105      timer_reset(datasette_timer, attotime_never);
106106   }
107107}
r4087r4088
121121   if (!serial_data || !cbm_serial_data_read (device->machine))
122122      value &= ~0x02;
123123
124   if ((cassette_get_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
124   if ((cassette_get_state(devtag_get_device(device->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
125125      value &= ~0x40;
126126   else
127127      value |=  0x40;
r4087r4088
185185
186186static READ8_DEVICE_HANDLER( vc20_via1_read_ca1 )
187187{
188   UINT8 data = (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > +0.0) ? 1 : 0;
188   UINT8 data = (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > +0.0) ? 1 : 0;
189189   return data;
190190}
191191
r4087r4088
324324static WRITE8_DEVICE_HANDLER( vc20_via1_write_portb )
325325{
326326/*  logerror("via1_write_portb: $%02X\n", data); */
327   cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
327   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
328328   via1_portb = data;
329329}
330330
r4087r4088
556556
557557static TIMER_CALLBACK( vic20_tape_timer )
558558{
559   const device_config *via_1 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_1");
560   UINT8 data = (cassette_input(device_list_find_by_tag(machine->config->devicelist, CASSETTE, "cassette" )) > +0.0) ? 1 : 0;
559   const device_config *via_1 = devtag_get_device(machine, VIA6522, "via6522_1");
560   UINT8 data = (cassette_input(devtag_get_device(machine, CASSETTE, "cassette")) > +0.0) ? 1 : 0;
561561   via_ca1_w(via_1, 0, data);
562562}
563563
r4087r4088
612612
613613MACHINE_RESET( vic20 )
614614{
615   const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0");
615   const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0");
616616
617617   if (has_vc1541)
618618   {
r4087r4088
663663
664664INTERRUPT_GEN( vic20_frame_interrupt )
665665{
666   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
666   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
667667
668668   via_ca1_w(via_0, 0, vc20_via0_read_ca1(via_0, 0));
669669   keyboard[0] = input_port_read(device->machine, "ROW0");
src/mess/machine/partner.c
r4087r4088
3030
3131static WD17XX_CALLBACK( partner_wd17xx_callback )
3232{
33   const device_config *dma8257 = device_list_find_by_tag(device->machine->config->devicelist, DMA8257, "dma8257");
33   const device_config *dma8257 = devtag_get_device(device->machine, DMA8257, "dma8257");
3434   switch(state)
3535   {
3636      case WD17XX_IRQ_CLR:
r4087r4088
4949
5050MACHINE_START(partner)
5151{
52   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793");
52   device_config *fdc = (device_config*)devtag_get_device(machine, WD1793, "wd1793");
5353   wd17xx_set_density (fdc,DEN_MFM_HI);   
5454   wd17xx_set_pause_time(fdc,10);
5555}
r4087r4088
108108}
109109
110110static READ8_HANDLER ( partner_floppy_r ) {
111   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
111   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
112112   
113113   if (offset<0x100) {
114114      switch(offset & 3) {
r4087r4088
124124}
125125
126126static WRITE8_HANDLER ( partner_floppy_w ) {
127   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
127   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
128128   
129129   if (offset<0x100) {
130130      switch(offset & 3) {
r4087r4088
383383
384384static READ8_DEVICE_HANDLER ( partner_wd17xx_data_r )
385385{
386   device_config *fdc = (device_config*)device_list_find_by_tag( device->machine->config->devicelist, WD1793, "wd1793");
386   device_config *fdc = (device_config*)devtag_get_device(device->machine, WD1793, "wd1793");
387387   return wd17xx_data_r(fdc, offset);
388388}
389389
390390static WRITE8_DEVICE_HANDLER ( partner_wd17xx_data_w )
391391{
392   device_config *fdc = (device_config*)device_list_find_by_tag( device->machine->config->devicelist, WD1793, "wd1793");
392   device_config *fdc = (device_config*)devtag_get_device(device->machine, WD1793, "wd1793");
393393   wd17xx_data_w(fdc, offset, data);
394394}
395395
src/mess/machine/centroni.c
r4087r4088
111111         fatalerror("\nInvalid centronics device: %X",index);
112112         break;
113113   }
114   return device_list_find_by_tag(machine->config->devicelist, PRINTER, tag);
114   return devtag_get_device(machine, PRINTER, tag);
115115}
116116
117117void centronics_write_handshake(running_machine *machine,int nr, int data, int mask)
src/mess/machine/apple1.c
r4087r4088
492492
493493static const device_config *cassette_device_image(running_machine *machine)
494494{
495   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
495   return devtag_get_device(machine, CASSETTE, "cassette");
496496}
497497
498498/* The cassette output signal for writing tapes is generated by a
src/mess/machine/99_ide.c
r4087r4088
249249      case 2:      /* IDE registers set 1 (CS1Fx) */
250250         if (tms9995_mode ? (!(offset & 1)) : (offset & 1))
251251         {   /* first read triggers 16-bit read cycle */
252            const device_config *ide_device = device_list_find_by_tag(space->machine->config->devicelist, IDE_CONTROLLER, "ide");
252            const device_config *ide_device = devtag_get_device(space->machine, IDE_CONTROLLER, "ide");
253253            input_latch = (! (offset & 0x10)) ? ide_bus_r(ide_device, 0, (offset >> 1) & 0x7) : 0;
254254         }
255255
r4087r4088
261261      case 3:      /* IDE registers set 2 (CS3Fx) */
262262         if (tms9995_mode ? (!(offset & 1)) : (offset & 1))
263263         {   /* first read triggers 16-bit read cycle */
264            const device_config *ide_device = device_list_find_by_tag(space->machine->config->devicelist, IDE_CONTROLLER, "ide");
264            const device_config *ide_device = devtag_get_device(space->machine, IDE_CONTROLLER, "ide");
265265            input_latch = (! (offset & 0x10)) ? ide_bus_r(ide_device, 1, (offset >> 1) & 0x7) : 0;
266266         }
267267
r4087r4088
327327
328328         if (tms9995_mode ? (offset & 1) : (!(offset & 1)))
329329         {   /* second write triggers 16-bit write cycle */
330            const device_config *ide_device = device_list_find_by_tag(space->machine->config->devicelist, IDE_CONTROLLER, "ide");
330            const device_config *ide_device = devtag_get_device(space->machine, IDE_CONTROLLER, "ide");
331331            ide_bus_w(ide_device, 0, (offset >> 1) & 0x7, output_latch);
332332         }
333333         break;
r4087r4088
345345
346346         if (tms9995_mode ? (offset & 1) : (!(offset & 1)))
347347         {   /* second write triggers 16-bit write cycle */
348            const device_config *ide_device = device_list_find_by_tag(space->machine->config->devicelist, IDE_CONTROLLER, "ide");
348            const device_config *ide_device = devtag_get_device(space->machine, IDE_CONTROLLER, "ide");
349349            ide_bus_w(ide_device, 1, (offset >> 1) & 0x7, output_latch);
350350         }
351351         break;
src/mess/machine/bebox.c
r4087r4088
431431
432432static device_config * bebox_get_device(running_machine *machine )
433433{
434   return (device_config*)device_list_find_by_tag( machine->config->devicelist, SMC37C78, "smc37c78");   
434   return (device_config*)devtag_get_device(machine, SMC37C78, "smc37c78");
435435}
436436
437437
r4087r4088
864864}
865865
866866static int bebox_get_out2(running_machine *machine) {
867   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
867   return pit8253_get_output((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 2 );
868868}
869869
870870static const struct kbdc8042_interface bebox_8042_interface =
r4087r4088
10531053
10541054
10551055static TIMER_CALLBACK( bebox_get_devices ) {
1056   bebox_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
1057   bebox_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
1058   bebox_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
1059   bebox_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
1056   bebox_devices.pic8259_master = (device_config*)devtag_get_device(machine, PIC8259, "pic8259_master");
1057   bebox_devices.pic8259_slave = (device_config*)devtag_get_device(machine, PIC8259, "pic8259_slave");
1058   bebox_devices.dma8237_1 = (device_config*)devtag_get_device(machine, DMA8237, "dma8237_1");
1059   bebox_devices.dma8237_2 = (device_config*)devtag_get_device(machine, DMA8237, "dma8237_2");
10601060}
10611061
10621062
src/mess/machine/mtx.c
r4087r4088
5050
5151static void mtx_tms9929a_interrupt(running_machine *machine, int data)
5252{
53   z80ctc_trg0_w( device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, data ? 0 : 1);
53   z80ctc_trg0_w( devtag_get_device(machine, Z80CTC, "z80ctc"), 0, data ? 0 : 1);
5454}
5555
5656static const TMS9928a_interface tms9928a_interface =
r4087r4088
128128
129129static const device_config *mtx_printer_image(running_machine *machine)
130130{
131   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
131   return devtag_get_device(machine, PRINTER, "printer");
132132}
133133
134134READ8_HANDLER( mtx_strobe_r )
r4087r4088
361361   DRIVER_INIT_CALL(mtx512);
362362
363363   /* install handlers for dart interface */
364   device = device_list_find_by_tag(machine->config->devicelist, Z80DART, "z80dart");
364   device = devtag_get_device(machine, Z80DART, "z80dart");
365365   space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
366366   memory_install_readwrite8_device_handler(space, device, 0x0c, 0x0d, 0, 0, mtx_dart_data_r, mtx_dart_data_w);
367367   memory_install_readwrite8_device_handler(space, device, 0x0e, 0x0f, 0, 0, mtx_dart_control_r, mtx_dart_control_w);
src/mess/machine/special.c
r4087r4088
7070   dat = (dat  << 2) ^0xff;   
7171   if (input_port_read(device->machine, "LINE12")!=0xff) dat ^= 0x02;
7272     
73   level = cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ));                                               
73   level = cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette"));                                               
7474   if (level >=  0) {
7575         dat ^= 0x01;
7676    }     
r4087r4088
9999{     
100100   specialist_8255_portc = data;
101101   
102   cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),data & 0x80 ? 1 : -1);   
102   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"),data & 0x80 ? 1 : -1);   
103103
104104   dac_data_w(0,data & 0x20); //beeper
105105   
r4087r4088
129129
130130READ8_HANDLER( specialist_keyboard_r )
131131{   
132   return ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), (offset & 3));
132   return ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), (offset & 3));
133133}
134134
135135WRITE8_HANDLER( specialist_keyboard_w )
136136{   
137   ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), (offset & 3) , data );
137   ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), (offset & 3) , data );
138138}
139139
140140
r4087r4088
246246
247247MACHINE_START( specimx )
248248{
249   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1793, "wd1793");
249   device_config *fdc = (device_config*)devtag_get_device(machine, WD1793, "wd1793");
250250   wd17xx_set_density (fdc,DEN_FM_HI);
251251}
252252
253253static TIMER_CALLBACK( setup_pit8253_gates ) {
254   device_config *pit8253 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" );
254   device_config *pit8253 = (device_config*)devtag_get_device(machine, PIT8253, "pit8253");
255255
256256   pit8253_gate_w(pit8253, 0, 0);
257257   pit8253_gate_w(pit8253, 1, 0);
r4087r4088
272272
273273WRITE8_HANDLER( specimx_disk_ctrl_w )
274274{   
275   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
275   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
276276
277277   switch(offset) {             
278278      case 2 :                 
r4087r4088
438438}
439439
440440WRITE8_HANDLER( erik_disk_reg_w ) {
441   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1793, "wd1793");
441   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1793, "wd1793");
442442   
443443   wd17xx_set_side (fdc,data & 1);   
444444   wd17xx_set_drive(fdc,(data >> 1) & 1);
src/mess/machine/mikro80.c
r4087r4088
101101
102102WRITE8_HANDLER( mikro80_tape_w )
103103{
104   cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1);
104   cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"),data & 0x01 ? 1 : -1);
105105}
106106
107107
108108READ8_HANDLER( mikro80_tape_r )
109109{
110   double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ));
110   double level = cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette"));
111111   if (level <  0) {
112112          return 0x00;
113113    }
src/mess/machine/mz80.c
r4087r4088
5151   UINT8 val = 0;
5252   val |= mz80k_vertical ? 0x80 : 0x00;
5353   val |= (mz80k_cursor_cnt > 31) ? 0x40 : 0x00;
54    val |= (cassette_get_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) & CASSETTE_MASK_UISTATE)== CASSETTE_PLAY ? 0x10 : 0x00;
54    val |= (cassette_get_state(devtag_get_device(device->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE)== CASSETTE_PLAY ? 0x10 : 0x00;
5555
56    if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0.00)
56    if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.00)
5757        val |= 0x20;
5858
5959   return val;
src/mess/machine/ut88.c
r4087r4088
8787WRITE8_HANDLER( ut88_sound_w )
8888{
8989   dac_data_w(0,data); //beeper
90   cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1);   
90   cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"),data & 0x01 ? 1 : -1);   
9191}
9292
9393
9494READ8_HANDLER( ut88_tape_r )
9595{
96   double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ));                                               
96   double level = cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette"));                                               
9797   if (level <  0) {
9898          return 0x00;
9999    }
src/mess/machine/cybiko.c
r4087r4088
185185
186186static void cybiko_pcf8593_load(running_machine *machine, mame_file *file)
187187{
188   const device_config *device = device_list_find_by_tag(machine->config->devicelist, PCF8593, "rtc");
188   const device_config *device = devtag_get_device(machine, PCF8593, "rtc");
189189   pcf8593_load(device, file);
190190}
191191
192192static void cybiko_pcf8593_save(running_machine *machine, mame_file *file)
193193{
194   const device_config *device = device_list_find_by_tag(machine->config->devicelist, PCF8593, "rtc");
194   const device_config *device = devtag_get_device(machine, PCF8593, "rtc");
195195   pcf8593_save(device, file);
196196}
197197
r4087r4088
462462      // real-time clock
463463      case H8S_IO_PORTF :
464464      {
465         const device_config *device = device_list_find_by_tag(space->machine->config->devicelist, PCF8593, "rtc");
465         const device_config *device = devtag_get_device(space->machine, PCF8593, "rtc");
466466         data = H8S_PF_PF2;
467467         if (pcf8593_pin_sda_r(device)) data |= H8S_PF_PF0;
468468      }
r4087r4088
479479
480480static WRITE8_HANDLER( cybiko_io_reg_w )
481481{
482   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, PCF8593, "rtc");
482   const device_config *rtc = devtag_get_device(space->machine, PCF8593, "rtc");
483483
484484   _logerror( 2, ("cybiko_io_reg_w (%08X/%02X)\n", offset, data));
485485   switch (offset)
src/mess/machine/snescart.c
r4087r4088
126126
127127   battery_ram = malloc_or_die(snes_cart.sram_max);
128128   ptr = battery_ram;
129   image_battery_load(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), battery_ram, snes_cart.sram_max);
129   image_battery_load(devtag_get_device(machine, CARTSLOT, "cart"), battery_ram, snes_cart.sram_max);
130130
131131   if (snes_cart.mode == SNES_MODE_20)
132132   {
r4087r4088
198198      }
199199   }
200200
201   image_battery_save(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), battery_ram, snes_cart.sram_max);
201   image_battery_save(devtag_get_device(machine, CARTSLOT, "cart"), battery_ram, snes_cart.sram_max);
202202
203203   free(battery_ram);
204204}
src/mess/machine/apple2.c
r4087r4088
12341234{
12351235   apple2_fdc_diskreg = data & 0xC0;
12361236   if (apple2_fdc_has_35(machine))
1237      sony_set_sel_line( (device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"),apple2_fdc_diskreg & 0x80);
1237      sony_set_sel_line( (device_config*)devtag_get_device(machine, APPLEFDC, "fdc"),apple2_fdc_diskreg & 0x80);
12381238}
12391239
12401240
src/mess/machine/c64.c
r4087r4088
109109static void c64_nmi(running_machine *machine)
110110{
111111   static int nmilevel = 0;
112   const device_config *cia_1 = device_list_find_by_tag(machine->config->devicelist, CIA6526R1, "cia_1");
112   const device_config *cia_1 = devtag_get_device(machine, CIA6526R1, "cia_1");
113113   int cia1irq = cia_get_irq(cia_1);
114114
115115   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
r4087r4088
281281static UINT8 c64_cia0_port_b_r (const device_config *device)
282282{
283283    UINT8 value = 0xff;
284   UINT8 cia0porta = cia_get_output_a(device_list_find_by_tag(device->machine->config->devicelist, CIA6526R1, "cia_0"));
284   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, CIA6526R1, "cia_0"));
285285
286286    if (!(cia0porta & 0x80)) value &= c64_keyline[7];
287287    if (!(cia0porta & 0x40)) value &= c64_keyline[6];
r4087r4088
353353
354354void c64_vic_interrupt (running_machine *machine, int level)
355355{
356   const device_config *cia_0 = device_list_find_by_tag(machine->config->devicelist, CIA6526R1, "cia_0");
356   const device_config *cia_0 = devtag_get_device(machine, CIA6526R1, "cia_0");
357357#if 1
358358   if (level != vicirq)
359359   {
r4087r4088
468468WRITE8_HANDLER( c64_write_io )
469469{
470470   running_machine *machine = space->machine;
471   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
472   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
471   const device_config *cia_0 = devtag_get_device(space->machine, CIA6526R1, "cia_0");
472   const device_config *cia_1 = devtag_get_device(space->machine, CIA6526R1, "cia_1");
473473
474474   c64_io_mirror[ offset ] = data;
475475   if (offset < 0x400) {
r4087r4088
514514READ8_HANDLER( c64_read_io )
515515{
516516   running_machine *machine = space->machine;
517   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
518   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
517   const device_config *cia_0 = devtag_get_device(space->machine, CIA6526R1, "cia_0");
518   const device_config *cia_1 = devtag_get_device(space->machine, CIA6526R1, "cia_1");
519519
520520   if (offset < 0x400)
521521      return vic2_port_r (space, offset & 0x3ff);
r4087r4088
801801   {
802802      if (direction & 0x08)
803803      {
804         cassette_output(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
804         cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
805805      }
806806
807807      if (direction & 0x20)
808808      {
809809         if(!(data & 0x20))
810810         {
811            cassette_change_state(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" ), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
811            cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
812812            timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
813813         }
814814         else
815815         {
816            cassette_change_state(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" ), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
816            cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
817817            timer_reset(datasette_timer, attotime_never);
818818         }
819819      }
r4087r4088
838838
839839   if (c64_tape_on)
840840   {
841      if ((cassette_get_state(device_list_find_by_tag(device->machine->config->devicelist, CASSETTE, "cassette" )) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
841      if ((cassette_get_state(devtag_get_device(device->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
842842         data &= ~0x10;
843843      else
844844         data |=  0x10;
r4087r4088
861861{
862862   running_machine *machine = device->machine;
863863   int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp;
864   UINT8 cia0porta = cia_get_output_a(device_list_find_by_tag(machine->config->devicelist, CIA6526R1, "cia_0"));
864   UINT8 cia0porta = cia_get_output_a(devtag_get_device(machine, CIA6526R1, "cia_0"));
865865   int controller1 = input_port_read(machine, "CTRLSEL") & 0x07;
866866   int controller2 = input_port_read(machine, "CTRLSEL") & 0x70;
867867
r4087r4088
10071007
10081008TIMER_CALLBACK( c64_tape_timer )
10091009{
1010   double tmp = cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ));
1011   const device_config *cia_0 = device_list_find_by_tag(machine->config->devicelist, CIA6526R1, "cia_0");
1010   double tmp = cassette_input(devtag_get_device(machine, CASSETTE, "cassette"));
1011   const device_config *cia_0 = devtag_get_device(machine, CIA6526R1, "cia_0");
10121012
10131013   if((last > +0.0) && (tmp < +0.0))
10141014      cia_issue_index(cia_0);
src/mess/machine/genesis.c
r4087r4088
12051205         genesis_sram_end += 1;
12061206     
12071207      genesis_sram = malloc_or_die(genesis_sram_end - genesis_sram_start);
1208      image_battery_load(device_list_find_by_tag(image->machine->config->devicelist, CARTSLOT, "cart"), genesis_sram, genesis_sram_end - genesis_sram_start);
1208      image_battery_load(devtag_get_device(image->machine, CARTSLOT, "cart"), genesis_sram, genesis_sram_end - genesis_sram_start);
12091209
12101210      megadriv_backupram = (UINT16*)ROM + ((genesis_sram_start & 0x3fffff) / 2);
12111211      memmove(&megadriv_backupram[0], genesis_sram, genesis_sram_end - genesis_sram_start);
src/mess/machine/pc.c
r4087r4088
750750
751751   if ( ! ( pc_ppi.portb & 0x08 ) )
752752   {
753      double tap_val = cassette_input( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ) );
753      double tap_val = cassette_input( devtag_get_device(device->machine, CASSETTE, "cassette") );
754754
755755      if ( tap_val < 0 )
756756      {
r4087r4088
793793   pit8253_gate_w( pc_devices.pit8253, 2, data & 1);
794794   pc_speaker_set_spkrdata( data & 0x02 );
795795
796   cassette_change_state( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
796   cassette_change_state( devtag_get_device(device->machine, CASSETTE, "cassette"), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
797797
798798   pc_ppi.clock_signal = ( pc_ppi.keyb_clock ) ? 1 : 0;
799799
r4087r4088
10321032   /* KB controller port B */
10331033   pc_ppi.portb = data;
10341034   pc_ppi.portc_switch_high = data & 0x08;
1035   pit8253_gate_w( device_list_find_by_tag( device->machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
1035   pit8253_gate_w( devtag_get_device(device->machine, PIT8253, "pit8253"), 2, data & 1);
10361036   pc_speaker_set_spkrdata( data & 0x02 );
10371037
1038   cassette_change_state( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
1038   cassette_change_state( devtag_get_device(device->machine, CASSETTE, "cassette"), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
10391039}
10401040
10411041
r4087r4088
10661066 */
10671067static READ8_DEVICE_HANDLER ( pcjr_ppi_portc_r )
10681068{
1069   int timer2_output = pit8253_get_output( device_list_find_by_tag( device->machine->config->devicelist, PIT8253, "pit8253" ), 2 );
1069   int timer2_output = pit8253_get_output( devtag_get_device(device->machine, PIT8253, "pit8253"), 2 );
10701070   int data=0xff;
10711071
10721072   data&=~0x80;
r4087r4088
10741074   data = ( data & ~0x01 ) | ( pcjr_keyb.latch ? 0x01: 0x00 );
10751075   if ( ! ( pc_ppi.portb & 0x08 ) )
10761076   {
1077      double tap_val = cassette_input( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ) );
1077      double tap_val = cassette_input( devtag_get_device(device->machine, CASSETTE, "cassette") );
10781078
10791079      if ( tap_val < 0 )
10801080      {
r4087r4088
11321132
11331133static device_config * pc_get_device(running_machine *machine )
11341134{
1135   return (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC765A, "nec765");   
1135   return (device_config*)devtag_get_device(machine, NEC765A, "nec765");
11361136}
11371137
11381138static const struct pc_fdc_interface fdc_interface_nc =
r4087r4088
13791379{
13801380   cpu_set_irq_callback(machine->cpu[0], pc_irq_callback);
13811381
1382   pc_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
1383   pc_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
1384   pc_devices.dma8237 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237" );
1385   pc_devices.pit8253 = device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" );
1386   pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, INS8250, "ins8250_0" ) );
1382   pc_devices.pic8259_master = devtag_get_device(machine, PIC8259, "pic8259_master");
1383   pc_devices.pic8259_slave = devtag_get_device(machine, PIC8259, "pic8259_slave");
1384   pc_devices.dma8237 = devtag_get_device(machine, DMA8237, "dma8237");
1385   pc_devices.pit8253 = devtag_get_device(machine, PIT8253, "pit8253");
1386   pc_mouse_set_serial_port( devtag_get_device(machine, INS8250, "ins8250_0") );
13871387   pc_hdc_set_dma8237_device( pc_devices.dma8237 );
13881388   speaker_level_w( 0, 0 );
13891389}
src/mess/machine/pecom.c
r4087r4088
6262
6363WRITE8_HANDLER( pecom_bank_w )
6464{
65   const device_config *cdp1869 = device_list_find_by_tag(space->machine->config->devicelist, CDP1869_VIDEO, CDP1869_TAG);
65   const device_config *cdp1869 = devtag_get_device(space->machine, CDP1869_VIDEO, CDP1869_TAG);
6666   const address_space *space2 = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
6767   UINT8 *rom = memory_region(space->machine, "main");
6868   memory_install_write8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1);
src/mess/machine/pce.c
r4087r4088
938938
939939   pce_cd.subcode_buffer = auto_malloc( 96 );
940940
941   device = device_list_find_by_tag(machine->config->devicelist, CDROM, "cdrom" );
941   device = devtag_get_device(machine, CDROM, "cdrom");
942942   if ( device )
943943   {
944944      pce_cd.cd = mess_cd_get_cdrom_file(device);
src/mess/machine/ti99_4x.c
r4087r4088
747747   handset_buflen = 0;
748748   handset_clock = 0;
749749   handset_ack = 0;
750   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 12, 0);
750   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 12, 0);
751751
752752   /* read config */
753753   if (ti99_model == model_99_8)
r4087r4088
17151715   handset_clock = ! handset_clock;
17161716   handset_buf >>= 4;
17171717   handset_buflen--;
1718   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 12, 0);
1718   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 12, 0);
17191719
17201720   if (handset_buflen == 1)
17211721   {
r4087r4088
17631763   handset_clock = 1;
17641764   handset_buf = ~ message;
17651765   handset_buflen = 3;
1766   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 12, 1);
1766   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 12, 1);
17671767}
17681768
17691769/*
r4087r4088
21462146*/
21472147static void tms9901_set_int1(running_machine *machine, int state)
21482148{
2149   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 1, state);
2149   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 1, state);
21502150}
21512151
21522152/*
r4087r4088
21542154*/
21552155void tms9901_set_int2(running_machine *machine, int state)
21562156{
2157   tms9901_set_single_int(device_list_find_by_tag(machine->config->devicelist, TMS9901, "tms9901"), 2, state);
2157   tms9901_set_single_int(devtag_get_device(machine, TMS9901, "tms9901"), 2, state);
21582158}
21592159
21602160/*
r4087r4088
22382238   }
22392239   
22402240   /* we don't take CS2 into account, as CS2 is a write-only unit */
2241   /*if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette1" )) > 0)
2241   /*if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette1")) > 0)
22422242      answer |= 8;*/
22432243
22442244   return answer;
r4087r4088
22722272   /* we don't take CS2 into account, as CS2 is a write-only unit */
22732273   if ( ti99_model != model_99_8 )
22742274   {
2275      if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette1" )) > 0)
2275      if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette1")) > 0)
22762276         answer |= 8;
22772277   }
22782278   else
22792279   {
2280      if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0)
2280      if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0)
22812281         answer |= 8;
22822282   }
22832283
r4087r4088
23742374   }
23752375   
23762376   /* we don't take CS2 into account, as CS2 is a write-only unit */
2377   /*if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0)
2377   /*if (cassette_input(devtag_get_device(machine, CASSETTE, "cassette")) > 0)
23782378      answer |= 8;*/
23792379
23802380   return answer;
r4087r4088
24132413
24142414   if ( ti99_model != model_99_8 )
24152415   {
2416      img = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, ( offset-6 ) ? "cassette2" :  "cassette1" );
2416      img = devtag_get_device(device->machine, CASSETTE, (offset-6 ) ? "cassette2" :  "cassette1" );
24172417   }
24182418   else
24192419   {
2420      img = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" );
2420      img = devtag_get_device(device->machine, CASSETTE, "cassette");
24212421   }
24222422   cassette_change_state(img, data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
24232423}
r4087r4088
24432443{
24442444   if (ti99_model != model_99_8)   /* 99/8 only has one tape port!!! */
24452445   {
2446      cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette1" ), data ? +1 : -1);
2447      cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette2" ), data ? +1 : -1);
2446      cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette1"), data ? +1 : -1);
2447      cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette2"), data ? +1 : -1);
24482448   }
24492449   else
24502450   {
2451      cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), data ? +1 : -1);
2451      cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), data ? +1 : -1);
24522452   }
24532453}
24542454
src/mess/machine/msm8251.c
r4087r4088
109109   int changed;
110110
111111   /* NPW 29-Nov-2008 - These two lines are a hack and indicate why our "serial" infrastructure needs to be updated */
112   device = device_list_find_by_tag(machine->config->devicelist, MSM8251, "uart");
112   device = devtag_get_device(machine, MSM8251, "uart");
113113   uart = get_token(device);
114114
115115   changed = uart->connection.input_state^state;
src/mess/machine/bbc.c
r4087r4088
580580
581581   if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */
582582   {
583      const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
584      const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
583      const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
584      const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
585585
586586      myo=offset-0x200;
587587      if ((myo>=0x00) && (myo<=0x07)) return BBC_6845_r(space, myo-0x00);      /* Video Controller */
588588      if ((myo>=0x08) && (myo<=0x0f)) return BBC_6850_r(space, myo-0x08);      /* Serial Controller */
589589      if ((myo>=0x10) && (myo<=0x17)) return 0xfe;                  /* Serial System Chip */
590      if ((myo>=0x18) && (myo<=0x1f)) return uPD7002_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, UPD7002, "upd7002" ), myo-0x18);         /* A to D converter */
590      if ((myo>=0x18) && (myo<=0x1f)) return uPD7002_r((device_config*)devtag_get_device(space->machine, UPD7002, "upd7002"), myo-0x18);         /* A to D converter */
591591      if ((myo>=0x20) && (myo<=0x23)) return 0xfe;                  /* VideoULA */
592592      if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd1770l_read(space, myo-0x24); /* 1770 */
593593      if ((myo>=0x28) && (myo<=0x2f)) return bbcm_wd1770_read(space, myo-0x28);  /* disc control latch */
r4087r4088
611611
612612   if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */
613613   {
614      const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
615      const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
614      const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
615      const device_config *via_1 = devtag_get_device(space->machine, VIA6522, "via6522_1");
616616
617617      myo=offset-0x200;
618618      if ((myo>=0x00) && (myo<=0x07)) BBC_6845_w(space, myo-0x00,data);         /* Video Controller */
619619      if ((myo>=0x08) && (myo<=0x0f)) BBC_6850_w(space, myo-0x08,data);         /* Serial Controller */
620620      if ((myo>=0x10) && (myo<=0x17)) BBC_SerialULA_w(space, myo-0x10,data);      /* Serial System Chip */
621      if ((myo>=0x18) && (myo<=0x1f)) uPD7002_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, UPD7002, "upd7002" ),myo-0x18,data);         /* A to D converter */
621      if ((myo>=0x18) && (myo<=0x1f)) uPD7002_w((device_config*)devtag_get_device(space->machine, UPD7002, "upd7002"),myo-0x18,data);         /* A to D converter */
622622      if ((myo>=0x20) && (myo<=0x23)) videoULA_w(space, myo-0x20,data);         /* VideoULA */
623623      if ((myo>=0x24) && (myo<=0x27)) bbcm_wd1770l_write(space, myo-0x24,data);    /* 1770 */
624624      if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(space, myo-0x28,data);     /* disc control latch */
r4087r4088
765765{
766766   static const char *const colnames[] = { "COL0", "COL1", "COL2", "COL3", "COL4",
767767                              "COL5", "COL6", "COL7", "COL8", "COL9" };
768   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
768   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
769769   
770770     /* only do auto scan if keyboard is not enabled */
771771   if (b3_keyboard == 1)
r4087r4088
801801{
802802   static const char *const colnames[] = { "COL0", "COL1", "COL2", "COL3", "COL4",
803803                              "COL5", "COL6", "COL7", "COL8", "COL9" };
804   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
804   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
805805
806806     /* only do auto scan if keyboard is not enabled */
807807   if (b3_keyboard == 1)
r4087r4088
839839   int res;
840840   static const char *const colnames[] = { "COL0", "COL1", "COL2", "COL3", "COL4",
841841                              "COL5", "COL6", "COL7", "COL8", "COL9" };
842   const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0");
842   const device_config *via_0 = devtag_get_device(space->machine, VIA6522, "via6522_0");
843843
844844   column = data & 0x0f;
845845   row = (data>>4) & 0x07;
r4087r4088
11591159/* joystick EOC */
11601160static READ8_DEVICE_HANDLER( bbcb_via_system_read_cb1 )
11611161{
1162   return uPD7002_EOC_r((device_config*)device_list_find_by_tag( device->machine->config->devicelist, UPD7002, "upd7002" ),0);
1162   return uPD7002_EOC_r((device_config*)devtag_get_device(device->machine, UPD7002, "upd7002"),0);
11631163}
11641164
11651165
r4087r4088
12691269
12701270static WRITE8_DEVICE_HANDLER( bbcb_via_user_write_ca2 )
12711271{
1272   const device_config *via_1 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_1");
1272   const device_config *via_1 = devtag_get_device(device->machine, VIA6522, "via6522_1");
12731273
12741274   /* write value to printer on rising edge of ca2 */
12751275   if ((bbc_printer_ca2==0) && (data==1))
r4087r4088
13351335
13361336UPD7002_EOC(BBC_uPD7002_EOC)
13371337{
1338   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
1338   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
13391339   via_cb1_w(via_0, 0,data);
13401340}
13411341
r4087r4088
13521352
13531353WRITE8_HANDLER ( BBC_6850_w )
13541354{
1355   const device_config *acia = device_list_find_by_tag(space->machine->config->devicelist, ACIA6850, "acia6850");
1355   const device_config *acia = devtag_get_device(space->machine, ACIA6850, "acia6850");
13561356
13571357   switch (offset&1)
13581358   {
r4087r4088
13701370
13711371READ8_HANDLER (BBC_6850_r)
13721372{
1373   const device_config *acia = device_list_find_by_tag(space->machine->config->devicelist, ACIA6850, "acia6850");
1373   const device_config *acia = devtag_get_device(space->machine, ACIA6850, "acia6850");
13741374   UINT8 retval=0;
13751375
13761376   switch (offset&1)
r4087r4088
14291429{
14301430   if (!mc6850_clock && new_clock)
14311431   {
1432      const device_config *acia = device_list_find_by_tag(machine->config->devicelist, ACIA6850, "acia6850");
1432      const device_config *acia = devtag_get_device(machine, ACIA6850, "acia6850");
14331433      acia_tx_clock_in(acia);
14341434   }
14351435   mc6850_clock = new_clock;
r4087r4088
14391439{
14401440
14411441   double dev_val;
1442   dev_val=cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ));
1442   dev_val=cassette_input(devtag_get_device(machine, CASSETTE, "cassette"));
14431443
14441444   // look for rising edges on the cassette wave
14451445   if (((dev_val>=0.0) && (last_dev_val<0.0)) || ((dev_val<0.0) && (last_dev_val>=0.0)))
r4087r4088
14981498{
14991499   if (status)
15001500   {
1501      cassette_change_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ),CASSETTE_MOTOR_ENABLED ,CASSETTE_MASK_MOTOR);
1501      cassette_change_state(devtag_get_device(machine, CASSETTE, "cassette"),CASSETTE_MOTOR_ENABLED ,CASSETTE_MASK_MOTOR);
15021502      timer_adjust_periodic(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
15031503   } else {
1504      cassette_change_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
1504      cassette_change_state(devtag_get_device(machine, CASSETTE, "cassette"),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
15051505      timer_reset(bbc_tape_timer, attotime_never);
15061506      len0=0;
15071507      len1=0;
r4087r4088
15781578static READ8_HANDLER( bbc_i8271_read )
15791579{
15801580   int ret;
1581   device_config *i8271 = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, I8271, "i8271" );
1581   device_config *i8271 = (device_config*)devtag_get_device(space->machine, I8271, "i8271");
15821582   ret=0x0ff;
15831583   logerror("i8271 read %d  ",offset);
15841584   switch (offset)
r4087r4088
16041604
16051605static WRITE8_HANDLER( bbc_i8271_write )
16061606{
1607   device_config *i8271 = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, I8271, "i8271" );
1607   device_config *i8271 = (device_config*)devtag_get_device(space->machine, I8271, "i8271");
16081608   logerror("i8271 write  %d  %d\n",offset,data);
16091609
16101610   switch (offset)
r4087r4088
17421742
17431743static WRITE8_HANDLER(bbc_wd177x_status_w)
17441744{
1745   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");   
1745   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
17461746   drive_control = data;
17471747
17481748   /* set drive */
r4087r4088
17731773READ8_HANDLER ( bbc_wd1770_read )
17741774{   
17751775   int retval=0xff;
1776   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1776   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
17771777   switch (offset)
17781778   {
17791779   case 4:
r4087r4088
17981798
17991799WRITE8_HANDLER ( bbc_wd1770_write )
18001800{
1801   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1801   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
18021802   logerror("wd177x write: $%02X  $%02X\n", offset,data);
18031803   switch (offset)
18041804   {
r4087r4088
18621862
18631863static WRITE8_HANDLER( bbc_opus_status_w )
18641864{
1865   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1865   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
18661866   drive_control = data;
18671867
18681868   /* set drive */
r4087r4088
18901890
18911891READ8_HANDLER( bbc_opus_read )
18921892{
1893   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1893   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
18941894   logerror("wd177x read: $%02X\n", offset);
18951895
18961896   if (bbc_DFSType==6)
r4087r4088
19221922
19231923WRITE8_HANDLER (bbc_opus_write)
19241924{
1925   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1925   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
19261926   logerror("wd177x write: $%02X  $%02X\n", offset,data);
19271927
19281928   if (bbc_DFSType==6)
r4087r4088
19681968READ8_HANDLER ( bbcm_wd1770_read )
19691969{
19701970   int retval=0xff;
1971   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1971   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
19721972   switch (offset)
19731973   {
19741974   case 0:
r4087r4088
19921992
19931993WRITE8_HANDLER ( bbcm_wd1770_write )
19941994{
1995   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
1995   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
19961996   //logerror("wd177x write: $%02X  $%02X\n", offset,data);
19971997   switch (offset)
19981998   {
r4087r4088
20212021
20222022WRITE8_HANDLER ( bbcm_wd1770l_write )
20232023{
2024   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
2024   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
20252025   drive_control = data;
20262026
20272027   /* set drive */
src/mess/machine/kc.c
r4087r4088
203203
204204WRITE8_HANDLER(kc85_disc_hw_terminal_count_w)
205205{
206   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
206   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
207207   logerror("kc85 disc hw tc w: %02x\n",data);
208208   nec765_set_tc_state(fdc, data & 0x01);
209209}
r4087r4088
405405   bit = 0;
406406
407407   /* get data from cassette */
408   if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038)
408   if (cassette_input(devtag_get_device(machine, CASSETTE, "cassette")) > 0.0038)
409409      bit = 1;
410410
411411   /* update astb with bit */
r4087r4088
423423   if (((kc_cassette_motor_state^motor_state)&0x01)!=0)
424424   {
425425      /* set new motor state in cassette device */
426      cassette_change_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ),
426      cassette_change_state(devtag_get_device(machine, CASSETTE, "cassette"),
427427         motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
428428         CASSETTE_MASK_MOTOR);
429429
r4087r4088
18531853   kc85_50hz_state = 0;
18541854   kc85_15khz_state = 0;
18551855   kc85_15khz_count = 0;
1856   timer_pulse(machine, ATTOTIME_IN_HZ(15625), (void *)device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, kc85_15khz_timer_callback);
1856   timer_pulse(machine, ATTOTIME_IN_HZ(15625), (void *)devtag_get_device(machine, Z80CTC, "z80ctc"), 0, kc85_15khz_timer_callback);
18571857   timer_set(machine, attotime_zero, NULL, 0, kc85_reset_timer_callback);
18581858   kc85_module_system_init();
18591859}
r4087r4088
18691869   kc85_pio_data[0] = 0x0f;
18701870   kc85_pio_data[1] = 0x0f1;
18711871
1872   kc85_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" );
1872   kc85_z80pio = devtag_get_device(machine, Z80PIO, "z80pio");
18731873
18741874   kc85_4_update_0x04000(machine);
18751875   kc85_4_update_0x08000(machine);
r4087r4088
19051905   memory_set_bankptr(machine, 2,mess_ram+0x0c000);
19061906   memory_set_bankptr(machine, 7,mess_ram+0x0c000);
19071907
1908   kc85_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" );
1908   kc85_z80pio = devtag_get_device(machine, Z80PIO, "z80pio");
19091909
19101910   kc85_3_update_0x08000(machine);
19111911   kc85_3_update_0x0c000(machine);
src/mess/devices/sonydriv.c
r4087r4088
496496   const device_config *fdc;
497497
498498   /* locate the FDC */
499   fdc = device_list_find_by_tag( image->machine->config->devicelist, IWM, "fdc");
499   fdc = devtag_get_device(image->machine, IWM, "fdc");
500500
501501   id = image_index_in_device(image);
502502   save_track_data(fdc, id);
src/mess/devices/coco_fdc.c
r4087r4088
241241
242242static void fdc_coco_dskreg_w(running_machine *machine, coco_cartridge *cartridge, UINT8 data)
243243{
244   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1773, "wd1773");
244   device_config *fdc = (device_config*)devtag_get_device(machine, WD1773, "wd1773");
245245   fdc_info *info = fdc_get_info(cartridge);
246246   UINT8 drive = 0;
247247   UINT8 head = 0;
r4087r4088
300300
301301static UINT8 fdc_coco_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr)
302302{
303   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1773, "wd1773");
303   device_config *fdc = (device_config*)devtag_get_device(machine, WD1773, "wd1773");
304304   UINT8 result = 0;
305305   switch(addr & 0xEF)
306306   {
r4087r4088
328328
329329static void fdc_coco_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
330330{
331   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1773, "wd1773");
331   device_config *fdc = (device_config*)devtag_get_device(machine, WD1773, "wd1773");
332332   switch(addr & 0xEF)
333333   {
334334      case 0: case 1: case 2: case 3:
r4087r4088
415415      case 0x10:   /* FF50 */
416416         if (real_time_clock(machine) == RTC_DISTO)
417417         {
418            dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto");
418            dev = devtag_get_device(machine, MSM6242, "disto");
419419            result = msm6242_r(dev, msm6242_rtc_address);
420420         }
421421         break;
r4087r4088
423423      case 0x38:   /* FF78 */
424424         if (real_time_clock(machine) == RTC_CLOUD9)
425425         {
426            dev = device_list_find_by_tag(machine->config->devicelist, DS1315, "cloud9");
426            dev = devtag_get_device(machine, DS1315, "cloud9");
427427            ds1315_r_0(dev, addr);
428428         }
429429         break;
r4087r4088
431431      case 0x39:   /* FF79 */
432432         if (real_time_clock(machine) == RTC_CLOUD9)
433433         {
434            dev = device_list_find_by_tag(machine->config->devicelist, DS1315, "cloud9");
434            dev = devtag_get_device(machine, DS1315, "cloud9");
435435            ds1315_r_1(dev, addr);
436436         }
437437         break;
r4087r4088
439439      case 0x3C:   /* FF7C */
440440         if (real_time_clock(machine) == RTC_CLOUD9)
441441         {
442            dev = device_list_find_by_tag(machine->config->devicelist, DS1315, "cloud9");
442            dev = devtag_get_device(machine, DS1315, "cloud9");
443443            result = ds1315_r_data(dev, addr);
444444         }
445445         break;
r4087r4088
450450      case 0x43:
451451      case 0x44:
452452      case 0x45:
453         dev = device_list_find_by_tag(machine->config->devicelist, DEVICE_GET_INFO_NAME(coco_vhd), "vhd");
453         dev = devtag_get_device(machine, DEVICE_GET_INFO_NAME(coco_vhd), "vhd");
454454         if (dev != NULL)
455455            result = coco_vhd_io_r((device_config *) dev, addr);
456456         break;
r4087r4088
475475      case 0x10:   /* FF50 */
476476         if (real_time_clock(machine) == RTC_DISTO)
477477         {
478            dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto");
478            dev = devtag_get_device(machine, MSM6242, "disto");
479479            msm6242_w(dev, msm6242_rtc_address, data);
480480         }
481481         break;
r4087r4088
491491      case 0x43:
492492      case 0x44:
493493      case 0x45:
494         dev = device_list_find_by_tag(machine->config->devicelist, DEVICE_GET_INFO_NAME(coco_vhd), "vhd");
494         dev = devtag_get_device(machine, DEVICE_GET_INFO_NAME(coco_vhd), "vhd");
495495         if (dev != NULL)
496496            coco_vhd_io_w((device_config *) dev, addr, data);
497497         break;
r4087r4088
571571
572572static void fdc_dragon_dskreg_w(running_machine *machine,coco_cartridge *cartridge, UINT8 data)
573573{
574   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
574   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
575575   fdc_info *info = fdc_get_info(cartridge);
576576
577577   if (LOG_FDC)
r4087r4088
603603
604604static UINT8 fdc_dragon_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr)
605605{
606   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
606   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
607607   UINT8 result = 0;
608608   switch(addr & 0xEF)
609609   {
r4087r4088
631631
632632static void fdc_dragon_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
633633{
634   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
634   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
635635   switch(addr & 0xEF)
636636   {
637637      case 0:
src/mess/devices/thomflop.c
r4087r4088
270270
271271static READ8_HANDLER ( to7_5p14_r )
272272{
273   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD2793, "wd2793");
273   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD2793, "wd2793");
274274   
275275   if ( offset < 4 )
276276      return wd17xx_r( fdc, offset );
r4087r4088
285285
286286static WRITE8_HANDLER( to7_5p14_w )
287287{
288   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD2793, "wd2793");
288   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD2793, "wd2793");
289289   if ( offset < 4 )
290290      wd17xx_w( fdc, offset, data );
291291   else if ( offset == 8 )
r4087r4088
331331static void to7_5p14_reset( running_machine *machine )
332332{
333333   int i;
334   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD2793, "wd2793");   
334   device_config *fdc = (device_config*)devtag_get_device(machine, WD2793, "wd2793");
335335   LOG(( "to7_5p14_reset: CD 90-640 controller\n" ));
336336   thom_floppy_set_density( DEN_MFM_LO );
337337   wd17xx_reset(fdc);
src/mess/drivers/vip.c
r4087r4088
237237
238238static const device_config *cassette_device_image(running_machine *machine)
239239{
240   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
240   return devtag_get_device(machine, CASSETTE, "cassette");
241241}
242242
243243/* Sound */
src/mess/drivers/nc.c
r4087r4088
784784
785785static TIMER_CALLBACK(nc_serial_timer_callback)
786786{
787   const device_config *uart = device_list_find_by_tag(machine->config->devicelist, MSM8251, "uart");
787   const device_config *uart = devtag_get_device(machine, MSM8251, "uart");
788788
789789   msm8251_transmit_clock(uart);
790790   msm8251_receive_clock(uart);
r4087r4088
975975   nc_common_open_stream_for_reading(machine);
976976
977977   {
978      const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, TC8521, "rtc");
978      const device_config *rtc = devtag_get_device(machine, TC8521, "rtc");
979979      tc8521_load_stream(rtc, file);
980980   }
981981
r4087r4088
991991{
992992   nc_common_open_stream_for_writing(machine);
993993   {
994      const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, TC8521, "rtc");
994      const device_config *rtc = devtag_get_device(machine, TC8521, "rtc");
995995      tc8521_save_stream(rtc, file);
996996   }
997997   nc_common_store_memory_to_stream();
r4087r4088
15181518
15191519static WRITE8_HANDLER(nc200_memory_card_wait_state_w)
15201520{
1521   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
1521   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
15221522   LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n",cpu_get_pc(space->machine->cpu[0]),data));
15231523#if 0
15241524   floppy_drive_set_motor_state(0,1);
src/mess/drivers/adam.c
r4087r4088
600600{
601601   const device_config *img;
602602
603   img = device_list_find_by_tag( machine->config->devicelist, CARTSLOT, "cart" );
603   img = devtag_get_device(machine, CARTSLOT, "cart");
604604
605605   if (image_exists(img))
606606   {
src/mess/drivers/sord.c
r4087r4088
9191
9292   LOG(("fd5 0x010 r: %02x %04x\n",fd5_databus,cpu_get_pc(space->cpu)));
9393
94   ppi8255_set_port_c((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
95   ppi8255_set_port_c((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), 0x10);
96   ppi8255_set_port_c((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
94   ppi8255_set_port_c((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), 0x50);
95   ppi8255_set_port_c((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), 0x10);
96   ppi8255_set_port_c((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), 0x50);
9797
9898   return fd5_databus;
9999}
r4087r4088
105105   fd5_databus = data;
106106
107107   /* set stb on data write */
108   ppi8255_set_port_c((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
109   ppi8255_set_port_c((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), 0x40);
110   ppi8255_set_port_c((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
108   ppi8255_set_port_c((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), 0x50);
109   ppi8255_set_port_c((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), 0x40);
110   ppi8255_set_port_c((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), 0x50);
111111
112112   cpu_yield(space->cpu);
113113}
r4087r4088
131131
132132static WRITE8_HANDLER(fd5_tc_w)
133133{
134   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
134   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
135135   nec765_set_tc_state(fdc, 1);
136136   nec765_set_tc_state(fdc, 0);
137137}
r4087r4088
177177   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
178178   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40);
179179   MACHINE_RESET_CALL(sord_m5);
180   ppi8255_set_port_c((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
180   ppi8255_set_port_c((device_config*)devtag_get_device(machine, PPI8255, "ppi8255"), 0x50);
181181}
182182
183183
184184static const device_config *cassette_device_image(running_machine *machine)
185185{
186   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
186   return devtag_get_device(machine, CASSETTE, "cassette");
187187}
188188
189189/*********************************************************************************************/
r4087r4088
441441{
442442   if (state)
443443   {
444      z80ctc_trg3_w(device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, 1);
445      z80ctc_trg3_w(device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, 0);
444      z80ctc_trg3_w(devtag_get_device(machine, Z80CTC, "z80ctc"), 0, 1);
445      z80ctc_trg3_w(devtag_get_device(machine, Z80CTC, "z80ctc"), 0, 0);
446446   }
447447}
448448
src/mess/drivers/mbee.c
r4087r4088
5959
6060static const device_config *cassette_device_image(running_machine *machine)
6161{
62   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
62   return devtag_get_device(machine, CASSETTE, "cassette");
6363}
6464
6565static READ8_DEVICE_HANDLER(z80pio_alt_r)
src/mess/drivers/pcw16.c
r4087r4088
12051205
12061206static device_config * pcw16_get_device(running_machine *machine )
12071207{
1208   return (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC765A, "nec765");   
1208   return (device_config*)devtag_get_device(machine, NEC765A, "nec765");
12091209}
12101210
12111211static const struct pc_fdc_interface pcw16_fdc_interface=
r4087r4088
13671367
13681368   /* initialise mouse */
13691369   pc_mouse_initialise(machine);
1370   pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, NS16550, "ns16550_0" ) );
1370   pc_mouse_set_serial_port( devtag_get_device(machine, NS16550, "ns16550_0") );
13711371
13721372   /* initialise keyboard */
13731373   at_keyboard_init(machine, AT_KEYBOARD_TYPE_AT);
src/mess/drivers/kim1.c
r4087r4088
207207   if ( newdata & 0x20 )
208208   {
209209      /* cassette write/speaker update */
210      cassette_output( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), ( newdata & 0x80 ) ? -1.0 : 1.0 );
210      cassette_output( devtag_get_device(device->machine, CASSETTE, "cassette"), ( newdata & 0x80 ) ? -1.0 : 1.0 );
211211   }
212212
213213   /* Set IRQ when bit 7 is cleared */
r4087r4088
256256
257257static TIMER_CALLBACK( kim1_cassette_input )
258258{
259   double tap_val = cassette_input( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ) );
259   double tap_val = cassette_input( devtag_get_device(machine, CASSETTE, "cassette") );
260260
261261   if ( tap_val <= 0 )
262262   {
src/mess/drivers/tm990189.c
r4087r4088
283283{
284284   (void)ic;
285285
286   tms9901_set_single_int(device_list_find_by_tag(device->machine->config->devicelist, TMS9901, "tms9901_0"), 5, intreq);
286   tms9901_set_single_int(devtag_get_device(device->machine, TMS9901, "tms9901_0"), 5, intreq);
287287}
288288
289289static READ8_DEVICE_HANDLER( sys9901_r0 )
r4087r4088
296296      reply |= input_port_read(device->machine, keynames[digitsel]) << 1;
297297
298298   /* tape input */
299   if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0)
299   if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.0)
300300      reply |= 0x40;
301301
302302   return reply;
r4087r4088
346346
347347static WRITE8_DEVICE_HANDLER( sys9901_tapewdata_w )
348348{
349   cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), data ? +1.0 : -1.0);
349   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), data ? +1.0 : -1.0);
350350}
351351
352352/*
r4087r4088
360360   if (/*rs232_rts &&*/ /*(mame_ftell(rs232_fp) < mame_fsize(rs232_fp))*/1)
361361   {
362362      if (image_fread(rs232_fp, &buf, 1) == 1)
363         tms9902_push_data(device_list_find_by_tag(machine->config->devicelist, TMS9902, "tms9902"), buf);
363         tms9902_push_data(devtag_get_device(machine, TMS9902, "tms9902"), buf);
364364   }
365365}
366366
r4087r4088
376376
377377   rs232_fp = image;
378378
379   tms9902_set_dsr(device_list_find_by_tag(image->machine->config->devicelist, TMS9902, "tms9902"), 1);
379   tms9902_set_dsr(devtag_get_device(image->machine, TMS9902, "tms9902"), 1);
380380   rs232_input_timer = timer_alloc(image->machine, rs232_input_callback, NULL);
381381   timer_adjust_periodic(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10));
382382
r4087r4088
395395
396396   rs232_fp = NULL;
397397
398   tms9902_set_dsr(device_list_find_by_tag(image->machine->config->devicelist, TMS9902, "tms9902"), 0);
398   tms9902_set_dsr(devtag_get_device(image->machine, TMS9902, "tms9902"), 0);
399399
400400   timer_reset(rs232_input_timer, attotime_never);   /* FIXME - timers should only be allocated once */
401401}
r4087r4088
436436   case 5: /* CKON: set DECKCONTROL */
437437      LED_state |= 0x20;
438438      {
439         const device_config *img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
439         const device_config *img = devtag_get_device(space->machine, CASSETTE, "cassette");
440440         cassette_change_state(img, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
441441      }
442442      break;
r4087r4088
444444   case 6: /* CKOF: clear DECKCONTROL */
445445      LED_state &= ~0x20;
446446      {
447         const device_config *img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
447         const device_config *img = devtag_get_device(space->machine, CASSETTE, "cassette");
448448         cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
449449      }
450450      break;
src/mess/drivers/pasogo.c
r4087r4088
432432
433433static IRQ_CALLBACK(pasogo_irq_callback)
434434{
435   return pic8259_acknowledge( (device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"));
435   return pic8259_acknowledge( (device_config*)devtag_get_device(device->machine, PIC8259, "pic8259"));
436436}
437437
438438static MACHINE_RESET( pasogo )
r4087r4088
444444
445445static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
446446{
447   pic8259_set_irq_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"), 0, state);
447   pic8259_set_irq_line((device_config*)devtag_get_device(device->machine, PIC8259, "pic8259"), 0, state);
448448}
449449
450450static const struct pit8253_config pc_pit8254_config =
src/mess/drivers/lynx.c
r4087r4088
179179   rom[0x1fc] = start & 0xff;
180180   rom[0x1fd] = start >> 8;
181181
182   lynx_crc_keyword(device_list_find_by_tag( image->machine->config->devicelist, QUICKLOAD, TAG_QUICKLOAD ));
182   lynx_crc_keyword(devtag_get_device(image->machine, QUICKLOAD, TAG_QUICKLOAD));
183183
184184   return INIT_PASS;
185185}
src/mess/drivers/aquarius.c
r4087r4088
2929
3030static const device_config *cassette_device_image(running_machine *machine)
3131{
32   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
32   return devtag_get_device(machine, CASSETTE, "cassette");
3333}
3434
3535/* Read/Write Handlers */
src/mess/drivers/specpls3.c
r4087r4088
187187static WRITE8_HANDLER(spectrum_plus3_port_3ffd_w)
188188{
189189      if (~input_port_read(space->machine, "CONFIG") & 0x20)
190            nec765_data_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765"), 0,data);
190            nec765_data_w((device_config*)devtag_get_device(space->machine, NEC765A, "nec765"), 0,data);
191191}
192192
193193static  READ8_HANDLER(spectrum_plus3_port_3ffd_r)
r4087r4088
195195      if (input_port_read(space->machine, "CONFIG") & 0x20)
196196            return 0xff;
197197      else
198            return nec765_data_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765"), 0);
198            return nec765_data_r((device_config*)devtag_get_device(space->machine, NEC765A, "nec765"), 0);
199199}
200200
201201
r4087r4088
204204      if (input_port_read(space->machine, "CONFIG") & 0x20)
205205            return 0xff;
206206      else
207            return nec765_status_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765"), 0);
207            return nec765_status_r((device_config*)devtag_get_device(space->machine, NEC765A, "nec765"), 0);
208208}
209209
210210
src/mess/drivers/x68k.c
r4087r4088
347347// 4 channel DMA controller (Hitachi HD63450)
348348static WRITE16_HANDLER( x68k_dmac_w )
349349{
350   const device_config* device = device_list_find_by_tag(space->machine->config->devicelist,HD63450,"hd63450");
350   const device_config* device = devtag_get_device(space->machine, HD63450, "hd63450");
351351   hd63450_w(device, offset, data, mem_mask);
352352}
353353
354354static READ16_HANDLER( x68k_dmac_r )
355355{
356   const device_config* device = device_list_find_by_tag(space->machine->config->devicelist,HD63450,"hd63450");
356   const device_config* device = devtag_get_device(space->machine, HD63450, "hd63450");
357357   return hd63450_r(device, offset, mem_mask);
358358}
359359
r4087r4088
557557   sys.mouse.inputtype++;
558558   if(sys.mouse.inputtype > 2)
559559   {
560      const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc");
560      const device_config *scc = devtag_get_device(machine, SCC8530, "scc");
561561      int val = scc_get_reg_b(scc, 0);
562562      sys.mouse.inputtype = 0;
563563      sys.mouse.bufferempty = 1;
r4087r4088
577577*/
578578static READ16_HANDLER( x68k_scc_r )
579579{
580   const device_config *scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
580   const device_config *scc = devtag_get_device(space->machine, SCC8530, "scc");
581581   offset %= 4;
582582   switch(offset)
583583   {
r4087r4088
596596
597597static WRITE16_HANDLER( x68k_scc_w )
598598{
599   const device_config *scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
599   const device_config *scc = devtag_get_device(space->machine, SCC8530, "scc");
600600   static unsigned char prev;
601601   offset %= 4;
602602
r4087r4088
630630
631631static TIMER_CALLBACK(x68k_scc_ack)
632632{
633   const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc");
633   const device_config *scc = devtag_get_device(machine, SCC8530, "scc");
634634   if(sys.mouse.bufferempty != 0)  // nothing to do if the mouse data buffer is empty
635635      return;
636636
r4087r4088
655655
656656static void x68k_set_adpcm(running_machine* machine)
657657{
658   const device_config *dev = device_list_find_by_tag(machine->config->devicelist, HD63450, "hd63450");
658   const device_config *dev = devtag_get_device(machine, HD63450, "hd63450");
659659   UINT32 rate = 0;
660660
661661   switch(sys.adpcm.rate & 0x0c)
r4087r4088
731731// NEC uPD72065 at 0xe94000
732732static WRITE16_HANDLER( x68k_fdc_w )
733733{
734   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC72065, "nec72065");
734   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC72065, "nec72065");
735735   unsigned int drive, x;
736736   switch(offset)
737737   {
r4087r4088
806806{
807807   unsigned int ret;
808808   int x;
809   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC72065, "nec72065");
809   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC72065, "nec72065");
810810   
811811   switch(offset)
812812   {
r4087r4088
855855static int x68k_fdc_read_byte(running_machine *machine,int addr)
856856{
857857   int data = -1;
858   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC72065, "nec72065");
858   device_config *fdc = (device_config*)devtag_get_device(machine, NEC72065, "nec72065");
859859
860860   if(sys.fdc.drq_state != 0)
861861      data = nec765_dack_r(fdc, 0);
r4087r4088
865865
866866static void x68k_fdc_write_byte(running_machine *machine,int addr, int data)
867867{
868   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC72065, "nec72065");
868   device_config *fdc = (device_config*)devtag_get_device(machine, NEC72065, "nec72065");
869869   nec765_dack_w(fdc, 0, data);
870870}
871871
r4087r4088
899899
900900static WRITE8_HANDLER( x68k_ct_w )
901901{
902   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC72065, "nec72065");
902   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC72065, "nec72065");
903903   // CT1 and CT2 bits from YM2151 port 0x1b
904904   // CT1 - ADPCM clock - 0 = 8MHz, 1 = 4MHz
905905   // CT2 - 1 = Set ready state of FDC
r4087r4088
10341034
10351035/*static READ16_HANDLER( x68k_mfp_r )
10361036{
1037   const device_config *x68k_mfp = device_list_find_by_tag(space->machine->config->devicelist, MC68901, MC68901_TAG);
1037   const device_config *x68k_mfp = devtag_get_device(space->machine, MC68901, MC68901_TAG);
10381038
10391039   return mc68901_register_r(x68k_mfp, offset);
10401040}*/
10411041
10421042READ16_HANDLER( x68k_mfp_r )
10431043{
1044   const device_config *x68k_mfp = device_list_find_by_tag(space->machine->config->devicelist, MC68901, MC68901_TAG);
1044   const device_config *x68k_mfp = devtag_get_device(space->machine, MC68901, MC68901_TAG);
10451045    // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full,
10461046    // MFP Timer C, and the power switch
10471047//  logerror("MFP: [%08x] Reading offset %i\n",cpu_get_pc(space->cpu),offset);
r4087r4088
11031103
11041104static WRITE16_HANDLER( x68k_mfp_w )
11051105{
1106   const device_config *x68k_mfp = device_list_find_by_tag(space->machine->config->devicelist, MC68901, MC68901_TAG);
1106   const device_config *x68k_mfp = devtag_get_device(space->machine, MC68901, MC68901_TAG);
11071107
11081108   /* For the Interrupt registers, the bits are set out as such:
11091109       Reg A - bit 7: GPIP7 (HSync)
r4087r4088
14811481
14821482static void x68k_dma_irq(running_machine *machine, int channel)
14831483{
1484   const device_config *device = device_list_find_by_tag(machine->config->devicelist, HD63450, "hd63450");
1484   const device_config *device = devtag_get_device(machine, HD63450, "hd63450");
14851485   current_vector[3] = hd63450_get_vector(device, channel);
14861486   current_irq_line = 3;
14871487   logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,current_vector[3]);
r4087r4088
14981498
14991499static void x68k_dma_error(running_machine *machine, int channel, int irq)
15001500{
1501   const device_config *device = device_list_find_by_tag(machine->config->devicelist, HD63450, "hd63450");
1501   const device_config *device = devtag_get_device(machine, HD63450, "hd63450");
15021502   if(irq != 0)
15031503   {
15041504      current_vector[3] = hd63450_get_error_vector(device,channel);
r4087r4088
15621562
15631563static IRQ_CALLBACK(x68k_int_ack)
15641564{
1565   const device_config *x68k_mfp = device_list_find_by_tag(device->machine->config->devicelist, MC68901, MC68901_TAG);
1565   const device_config *x68k_mfp = devtag_get_device(device->machine, MC68901, MC68901_TAG);
15661566
15671567   if(irqline == 6)  // MFP
15681568   {
src/mess/drivers/spectrum.c
r4087r4088
190190   if ((Changed & (1<<3))!=0)
191191   {
192192      /* write cassette data */
193      cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), (data & (1<<3)) ? -1.0 : +1.0);
193      cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), (data & (1<<3)) ? -1.0 : +1.0);
194194   }
195195
196196   PreviousFE = data;
r4087r4088
261261   data |= (0xe0); /* Set bits 5-7 - as reset above */
262262
263263   /* cassette input from wav */
264   if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038 )
264   if (cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) > 0.0038 )
265265   {
266266      data &= ~0x40;
267267   }
src/mess/drivers/super80.c
r4087r4088
394394
395395static const device_config *cassette_device_image(running_machine *machine)
396396{
397   return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
397   return devtag_get_device(machine, CASSETTE, "cassette");
398398}
399399
400400static void cassette_motor( running_machine *machine, UINT8 data )
r4087r4088
472472
473473static const device_config *printer_device(running_machine *machine)
474474{
475   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
475   return devtag_get_device(machine, PRINTER, "printer");
476476}
477477
478478
r4087r4088
998998
999999static MACHINE_RESET( super80 )
10001000{
1001   super80_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" );
1001   super80_z80pio = devtag_get_device(machine, Z80PIO, "z80pio");
10021002   centronics_config(machine,0, super80_cent_config);
10031003   /* assumption: select is tied low */
10041004   centronics_write_handshake(machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET);
src/mess/drivers/atarist.c
r4087r4088
4444
4545static void atarist_fdc_dma_transfer(running_machine *machine)
4646{
47   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1772, "wd1772");
47   device_config *fdc = (device_config*)devtag_get_device(machine, WD1772, "wd1772");
4848   const address_space *program = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
4949   atarist_state *state = machine->driver_data;
5050
r4087r4088
115115static READ16_HANDLER( atarist_fdc_data_r )
116116{
117117   atarist_state *state = space->machine->driver_data;
118   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");
118   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
119119
120120   if (state->fdc_mode & ATARIST_FLOPPY_MODE_SECTOR_COUNT)
121121   {
r4087r4088
140140static WRITE16_HANDLER( atarist_fdc_data_w )
141141{
142142   atarist_state *state = space->machine->driver_data;
143   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");
143   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
144144   
145145   if (state->fdc_mode & ATARIST_FLOPPY_MODE_SECTOR_COUNT)
146146   {
r4087r4088
12831283
12841284static WRITE8_HANDLER( ym2149_port_a_w )
12851285{
1286   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");
1286   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
12871287   wd17xx_set_side(fdc, BIT(data, 0) ? 0 : 1);
12881288
12891289   if (!BIT(data, 1))
r4087r4088
16491649
16501650static WRITE8_HANDLER( stbook_ym2149_port_a_w )
16511651{
1652   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");
1652   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
16531653   wd17xx_set_side(fdc,(data & 0x01) ? 0 : 1);
16541654
16551655   if (!(data & 0x02))
src/mess/drivers/sg1000.c
r4087r4088
642642
643643static WRITE8_DEVICE_HANDLER( sf7000_ppi8255_c_w )
644644{
645   device_config *fdc = (device_config*)device_list_find_by_tag( device->machine->config->devicelist, NEC765A, "nec765");
645   device_config *fdc = (device_config*)devtag_get_device(device->machine, NEC765A, "nec765");
646646   /*
647647        Signal  Description
648648
src/mess/drivers/ip22.c
r4087r4088
232232//      mame_printf_info("INT3: r @ %x mask %08x (PC=%x)\n", offset*4, mem_mask, activecpu_get_pc());
233233      return int3_regs[offset-0x80/4];
234234   case 0xb0/4:
235      ret8 = pit8253_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 0);
235      ret8 = pit8253_r((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 0);
236236      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
237237      return ret8;
238238   case 0xb4/4:
239      ret8 = pit8253_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 1);
239      ret8 = pit8253_r((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 1);
240240      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
241241      return ret8;
242242   case 0xb8/4:
243      ret8 = pit8253_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2);
243      ret8 = pit8253_r((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 2);
244244      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
245245      return ret8;
246246   case 0xbc/4:
247      ret8 = pit8253_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 3);
247      ret8 = pit8253_r((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 3);
248248      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
249249      return ret8;
250250   default:
r4087r4088
337337      break;
338338   case 0xb0/4:
339339      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask );
340      pit8253_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 0, data & 0x000000ff);
340      pit8253_w((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 0, data & 0x000000ff);
341341      return;
342342   case 0xb4/4:
343343      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask );
344      pit8253_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 1, data & 0x000000ff);
344      pit8253_w((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 1, data & 0x000000ff);
345345      return;
346346   case 0xb8/4:
347347      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask );
348      pit8253_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2, data & 0x000000ff);
348      pit8253_w((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 2, data & 0x000000ff);
349349      return;
350350   case 0xbc/4:
351351      verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask );
352      pit8253_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 3, data & 0x000000ff);
352      pit8253_w((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 3, data & 0x000000ff);
353353      return;
354354   default:
355355      verboselog( machine, 0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask );
r4087r4088
13631363}
13641364
13651365static int ip22_get_out2(running_machine *machine) {
1366   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
1366   return pit8253_get_output((device_config*)devtag_get_device(machine, PIT8254, "pit8254"), 2 );
13671367}
13681368
13691369static MACHINE_START( ip22 )
src/mess/drivers/exidy.c
r4087r4088
201201static const device_config *cassette_device_image(running_machine *machine)
202202{
203203   if (exidy_fe & 0x20)
204      return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette2" );
204      return devtag_get_device(machine, CASSETTE, "cassette2");
205205   else
206      return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette1" );
206      return devtag_get_device(machine, CASSETTE, "cassette1");
207207}
208208
209209
r4087r4088
354354   cass_data.input.length = 0;
355355   cass_data.input.bit = 1;
356356
357   exidy_ay31015 = device_list_find_by_tag( machine->config->devicelist, AY31015, "ay_3_1015" );
357   exidy_ay31015 = devtag_get_device(machine, AY31015, "ay_3_1015");
358358
359359   centronics_config(machine, 0, exidy_cent_config);
360360   /* assumption: select is tied low */
r4087r4088
374374
375375static  READ8_HANDLER ( exidy_wd179x_r )
376376{
377   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
377   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
378378   switch (offset & 0x03)
379379   {
380380   case 0:
r4087r4088
392392
393393static WRITE8_HANDLER ( exidy_wd179x_w )
394394{
395   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
395   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
396396   switch (offset & 0x03)
397397   {
398398   case 0:
r4087r4088
451451   {
452452      if (data & 0x20)
453453      {
454         cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
455         cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette2" ), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER);
454         cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette1"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
455         cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette2"), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER);
456456      }
457457      else
458458      {
459         cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette2" ), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
460         cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER);
459         cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette2"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
460         cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette1"), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER);
461461      }
462462   }
463463   else
464464   {
465      cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette2" ), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
466      cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
465      cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette2"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
466      cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette1"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
467467   }
468468
469469   /* cassette 1 motor */
470   cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ),
470   cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette1"),
471471      (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
472472
473473   /* cassette 2 motor */
474   cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette2" ),
474   cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette2"),
475475      (data & 0x20) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
476476
477477   if ((data & EXIDY_CASSETTE_MOTOR_MASK) && (~data & 0x80))
r4087r4088
574574
575575static const device_config *printer_device(running_machine *machine)
576576{
577   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
577   return devtag_get_device(machine, PRINTER, "printer");
578578}
579579
580580static READ8_HANDLER(exidy_ff_port_r)
src/mess/drivers/pet.c
r4087r4088
636636
637637static VIDEO_UPDATE( pet_crtc )
638638{
639   const device_config *mc6845 = device_list_find_by_tag(screen->machine->config->devicelist, MC6845, "crtc");
639   const device_config *mc6845 = devtag_get_device(screen->machine, MC6845, "crtc");
640640   mc6845_update(mc6845, bitmap, cliprect);
641641   return 0;
642642}
src/mess/drivers/a2600.c
r4087r4088
810810
811811      /* Check if we should stop the tape */
812812      if ( cpu_get_pc(space->machine->cpu[0]) == 0x00FD ) {
813         const device_config *img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
813         const device_config *img = devtag_get_device(space->machine, CASSETTE, "cassette");
814814         if ( img ) {
815815            cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
816816         }
817817      }
818818   } else if ( offset == 0xFF9 ) {
819819      /* Cassette port read */
820      double tap_val = cassette_input( device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ) );
820      double tap_val = cassette_input( devtag_get_device(space->machine, CASSETTE, "cassette") );
821821      //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(machine->cpu[0]), tap_val);
822822      if ( tap_val < 0 ) {
823823         data = 0x00;
r4087r4088
11021102      keypad_right_column = data & 0x0F;
11031103      break;
11041104   case 0x0a:   /* KidVid voice module */
1105      cassette_change_state( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), ( data & 0x02 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED | CASSETTE_PLAY, CASSETTE_MOTOR_DISABLED );
1105      cassette_change_state( devtag_get_device(machine, CASSETTE, "cassette"), ( data & 0x02 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED | CASSETTE_PLAY, CASSETTE_MOTOR_DISABLED );
11061106      break;
11071107   }
11081108}
r4087r4088
17481748      modeSS_byte_started = 0;
17491749      memory_set_direct_update_handler(space, modeSS_opbase );
17501750      /* Already start the motor of the cassette for the user */
1751      cassette_change_state( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), CASSETTE_MOTOR_ENABLED, CASSETTE_MOTOR_DISABLED );
1751      cassette_change_state( devtag_get_device(machine, CASSETTE, "cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MOTOR_DISABLED );
17521752      break;
17531753
17541754   case modeFV:
src/mess/drivers/pcw.c
r4087r4088
434434
435435static WRITE8_HANDLER(pcw_system_control_w)
436436{
437   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
437   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
438438   LOG(("SYSTEM CONTROL: %d\n",data));
439439
440440   switch (data)
r4087r4088
654654
655655static READ8_HANDLER(pcw_fdc_r)
656656{
657   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
657   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
658658   /* from Jacob Nevins docs. FDC I/O is not fully decoded */
659659   if (offset & 1)
660660   {
r4087r4088
666666
667667static WRITE8_HANDLER(pcw_fdc_w)
668668{
669   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
669   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
670670   /* from Jacob Nevins docs. FDC I/O is not fully decoded */
671671   if (offset & 1)
672672   {
src/mess/drivers/bw2.c
r4087r4088
312312static READ8_HANDLER( bw2_wd2797_r )
313313{
314314   UINT8 result = 0xff;
315   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
315   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
316316
317317   switch (offset & 0x03)
318318   {
r4087r4088
335335
336336static WRITE8_HANDLER( bw2_wd2797_w )
337337{
338   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
338   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
339339   switch (offset & 0x3)
340340   {
341341      case 0:
r4087r4088
373373
374374static WRITE8_DEVICE_HANDLER( bw2_ppi8255_a_w )
375375{
376   device_config *fdc = (device_config*)device_list_find_by_tag( device->machine->config->devicelist, WD179X, "wd179x");
376   device_config *fdc = (device_config*)devtag_get_device(device->machine, WD179X, "wd179x");
377377   /*
378378
379379      PA0     KB0 Keyboard line select 0
r4087r4088
595595static MACHINE_START( bw2 )
596596{
597597   bw2_state *state = machine->driver_data;
598   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
598   device_config *fdc = (device_config*)devtag_get_device(machine, WD179X, "wd179x");
599599
600600
601601   centronics_config(machine,0, bw2_centronics_config);
src/mess/drivers/enterp.c
r4087r4088
240240
241241static READ8_HANDLER ( enterprise_wd177x_read )
242242{
243   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
243   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
244244   switch (offset & 0x03)
245245   {
246246   case 0:
r4087r4088
260260
261261static WRITE8_HANDLER (   enterprise_wd177x_write )
262262{
263   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
263   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
264264   switch (offset & 0x03)
265265   {
266266   case 0:
r4087r4088
346346
347347static WRITE8_HANDLER ( exdos_card_w )
348348{
349   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
349   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
350350   /* drive side */
351351   int head = (data>>4) & 0x01;
352352
src/mess/drivers/apf.c
r4087r4088
208208
209209   data = 0x000;
210210
211   if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038)
211   if (cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) > 0.0038)
212212      data =(1<<7);
213213
214214   return data;
r4087r4088
255255   keyboard_data = input_port_read(space->machine, keynames[keyboard_line]);
256256
257257   /* bit 4: cassette motor control */
258   cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),
258   cassette_change_state(devtag_get_device(space->machine, CASSETTE, "cassette"),
259259      (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
260260      CASSETTE_MASK_MOTOR);
261261
262262   /* bit 6: cassette write */
263   cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),
263   cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"),
264264      (data & 0x40) ? -1.0 : 1.0);
265265}
266266
r4087r4088
340340static WRITE8_HANDLER(apf_dischw_w)
341341{
342342   int drive;
343   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x");
343   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
344344
345345   /* bit 3 is index of drive to select */
346346   drive = (data>>3) & 0x01;
r4087r4088
363363
364364static WRITE8_HANDLER(apf_wd179x_command_w)
365365{   
366   wd17xx_command_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset,~data);
366   wd17xx_command_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset,~data);
367367}
368368
369369static WRITE8_HANDLER(apf_wd179x_track_w)
370370{
371   wd17xx_track_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset,~data);
371   wd17xx_track_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset,~data);
372372}
373373
374374static WRITE8_HANDLER(apf_wd179x_sector_w)
375375{
376   wd17xx_sector_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset,~data);
376   wd17xx_sector_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset,~data);
377377}
378378
379379static WRITE8_HANDLER(apf_wd179x_data_w)
380380{
381   wd17xx_data_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset,~data);
381   wd17xx_data_w((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset,~data);
382382}
383383
384384static READ8_HANDLER(apf_wd179x_status_r)
385385{
386   return ~wd17xx_status_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
386   return ~wd17xx_status_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
387387}
388388
389389static READ8_HANDLER(apf_wd179x_track_r)
390390{
391   return ~wd17xx_track_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
391   return ~wd17xx_track_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
392392}
393393
394394static READ8_HANDLER(apf_wd179x_sector_r)
395395{
396   return ~wd17xx_sector_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
396   return ~wd17xx_sector_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
397397}
398398
399399static READ8_HANDLER(apf_wd179x_data_r)
400400{
401   return wd17xx_data_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD179X, "wd179x"), offset);
401   return wd17xx_data_r((device_config*)devtag_get_device(space->machine, WD179X, "wd179x"), offset);
402402}
403403
404404static ADDRESS_MAP_START(apf_imagination_map, ADDRESS_SPACE_PROGRAM, 8)
src/mess/drivers/amiga.c
r4087r4088
4646
4747static READ16_HANDLER( amiga_clock_r )
4848{
49   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, MSM6242, "rtc");
49   const device_config *rtc = devtag_get_device(space->machine, MSM6242, "rtc");
5050   return msm6242_r(rtc, offset / 2);
5151}
5252
5353
5454static WRITE16_HANDLER( amiga_clock_w )
5555{
56   const device_config *rtc = device_list_find_by_tag(space->machine->config->devicelist, MSM6242, "rtc");
56   const device_config *rtc = devtag_get_device(space->machine, MSM6242, "rtc");
5757   msm6242_w(rtc, offset / 2, data);
5858}
5959
src/mess/drivers/bebox.c
r4087r4088
3535#include "formats/pc_dsk.h"
3636
3737
38static READ8_HANDLER(at_dma8237_1_r)  { return dma8237_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, DMA8237, "dma8237_2" ), offset / 2); }
39static WRITE8_HANDLER(at_dma8237_1_w) { dma8237_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, DMA8237, "dma8237_2" ), offset / 2, data); }
38static READ8_HANDLER(at_dma8237_1_r)  { return dma8237_r((device_config*)devtag_get_device(space->machine, DMA8237, "dma8237_2"), offset / 2); }
39static WRITE8_HANDLER(at_dma8237_1_w) { dma8237_w((device_config*)devtag_get_device(space->machine, DMA8237, "dma8237_2"), offset / 2, data); }
4040
4141static READ64_HANDLER( bebox_dma8237_1_r )
4242{
src/mess/drivers/acrnsys1.c
r4087r4088
3636
3737static WRITE8_DEVICE_HANDLER( ins8154_b1_port_a_w )
3838{
39   ttl74145_w((device_config*)device_list_find_by_tag( device->machine->config->devicelist, TTL74145, "ttl74145" ), 0, data & 0x07);
39   ttl74145_w((device_config*)devtag_get_device(device->machine, TTL74145, "ttl74145"), 0, data & 0x07);
4040}
4141
4242static WRITE8_DEVICE_HANDLER( acrnsys1_led_segment_w )
src/mess/drivers/newbrain.c
r4087r4088
6363static const device_config *cassette_device_image(running_machine *machine, int index)
6464{
6565   if ( index )
66      return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette2" );
66      return devtag_get_device(machine, CASSETTE, "cassette2");
6767   else
68      return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette1" );
68      return devtag_get_device(machine, CASSETTE, "cassette1");
6969}
7070
7171/* Enable/Status */
r4087r4088
543543
544544static WRITE8_HANDLER( fdc_auxiliary_w )
545545{
546   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
546   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
547547   /*
548548
549549      bit      description
src/mess/drivers/einstein.c
r4087r4088
419419
420420static WRITE8_DEVICE_HANDLER(einstein_serial_transmit_clock)
421421{
422   const device_config *uart = device_list_find_by_tag(device->machine->config->devicelist, MSM8251, "uart");
422   const device_config *uart = devtag_get_device(device->machine, MSM8251, "uart");
423423   msm8251_transmit_clock(uart);
424424}
425425
426426static WRITE8_DEVICE_HANDLER(einstein_serial_receive_clock)
427427{
428   const device_config *uart = device_list_find_by_tag(device->machine->config->devicelist, MSM8251, "uart");
428   const device_config *uart = devtag_get_device(device->machine, MSM8251, "uart");
429429   msm8251_receive_clock(uart);
430430}
431431
r4087r4088
593593static WRITE8_HANDLER(einstein_fdc_w)
594594{
595595   int reg = offset & 0x03;
596   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
596   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
597597
598598   logerror("fdc w: PC: %04x %04x %02x\n",cpu_get_pc(space->machine->cpu[0]),offset,data);
599599
r4087r4088
629629static  READ8_HANDLER(einstein_fdc_r)
630630{
631631   int reg = offset & 0x03;
632   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
632   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
633633
634634   logerror("fdc r: PC: %04x %04x\n",cpu_get_pc(space->machine->cpu[0]),offset);
635635
r4087r4088
693693
694694static WRITE8_HANDLER(einstein_serial_w)
695695{
696   const device_config *uart = device_list_find_by_tag(space->machine->config->devicelist, MSM8251, "uart");
696   const device_config *uart = devtag_get_device(space->machine, MSM8251, "uart");
697697   int reg = offset & 0x01;
698698
699699   /* logerror("serial w: %04x %02x\n",offset,data); */
r4087r4088
710710
711711static READ8_HANDLER(einstein_serial_r)
712712{
713   const device_config *uart = device_list_find_by_tag(space->machine->config->devicelist, MSM8251, "uart");
713   const device_config *uart = devtag_get_device(space->machine, MSM8251, "uart");
714714   int reg = offset & 0x01;
715715
716716   /* logerror("serial r: %04x\n",offset); */
r4087r4088
820820
821821static WRITE8_HANDLER(einstein_drive_w)
822822{
823   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD177X, "wd177x");
823   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD177X, "wd177x");
824824
825825   /* bit 4: side select */
826826   /* bit 3: select drive 3 */
r4087r4088
10251025      case 0x2d:
10261026      case 0x2e:
10271027      case 0x2f:
1028         return einstein_ctc_r( device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), offset);
1028         return einstein_ctc_r( devtag_get_device(space->machine, Z80CTC, "z80ctc"), offset);
10291029      case 0x30:
10301030      case 0x31:
10311031      case 0x32:
r4087r4088
11291129      case 0x2d:
11301130      case 0x2e:
11311131      case 0x2f:
1132         einstein_ctc_w( device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), offset,data);
1132         einstein_ctc_w( devtag_get_device(space->machine, Z80CTC, "z80ctc"), offset,data);
11331133         return;
11341134      case 0x30:
11351135      case 0x31:
r4087r4088
12181218      case 0x2d:
12191219      case 0x2e:
12201220      case 0x2f:
1221         return einstein_ctc_r( device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), offset);
1221         return einstein_ctc_r( devtag_get_device(space->machine, Z80CTC, "z80ctc"), offset);
12221222      case 0x30:
12231223      case 0x31:
12241224      case 0x32:
r4087r4088
13051305      case 0x2d:
13061306      case 0x2e:
13071307      case 0x2f:
1308         einstein_ctc_w( device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), offset,data);
1308         einstein_ctc_w( devtag_get_device(space->machine, Z80CTC, "z80ctc"), offset,data);
13091309         return;
13101310      case 0x30:
13111311      case 0x31:
r4087r4088
14261426{
14271427   TMS9928A_configure(&tms9928a_interface);
14281428
1429   einstein_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" );
1429   einstein_z80pio = devtag_get_device(machine, Z80PIO, "z80pio");
14301430}
14311431
14321432static MACHINE_RESET( einstein )
r4087r4088
14571457
14581458   /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */
14591459   einstein_ctc_trigger = 0;
1460   timer_pulse(machine, ATTOTIME_IN_HZ(2000000), (void *)device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, einstein_ctc_trigger_callback);
1460   timer_pulse(machine, ATTOTIME_IN_HZ(2000000), (void *)devtag_get_device(machine, Z80CTC, "z80ctc"), 0, einstein_ctc_trigger_callback);
14611461
14621462   centronics_config(machine, 0, einstein_cent_config);
14631463   /* assumption: select is tied low */
src/mess/drivers/jupiter.c
r4087r4088
169169   }
170170   if ( ! ( offset & 0x8000 ) )
171171   {
172//      cassette_output( device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), -1 );
172//      cassette_output( devtag_get_device(space->machine, CASSETTE, "cassette"), -1 );
173173      speaker_level_w(0,0);
174174      data = ( data & 0xe0 ) | ( data & input_port_read( space->machine, "KEY7" ) );;
175175   }
176   if ( cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0 )
176   if ( cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) > 0 )
177177   {
178178      data &= ~0x20;
179179   }
r4087r4088
183183
184184static WRITE8_HANDLER( jupiter_port_fe_w )
185185{
186//   cassette_output( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), 1 );
186//   cassette_output( devtag_get_device(machine, CASSETTE, "cassette"), 1 );
187187   speaker_level_w(0,1);
188188}
189189
src/mess/drivers/ssystem3.c
r4087r4088
216216
217217static WRITE8_DEVICE_HANDLER(ssystem3_via_write_b)
218218{
219   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
219   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
220220   UINT8 d;
221221
222222   ssystem3_playfield_write(device->machine, data&1, data&8);
src/mess/drivers/amstrad.c
r4087r4088
211211
212212static const device_config *printer_device(running_machine *machine)
213213{
214   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
214   return devtag_get_device(machine, PRINTER, "printer");
215215}
216216
217217
r4087r4088
330330/* Set b7 with cassette tape input */
331331   if(amstrad_system_type != SYSTEM_GX4000)
332332   {
333      if (cassette_input(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" )) > 0.03) {
333      if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.03) {
334334         data |= (1<<7);
335335      }
336336   }
r4087r4088
396396   if(amstrad_system_type != SYSTEM_GX4000)
397397   {
398398      if ((changed_data & 0x20) != 0) {
399         cassette_output(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),
399         cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"),
400400            ((data & 0x20) ? -1.0 : +1.0));
401401      }
402402   }
r4087r4088
405405   if(amstrad_system_type != SYSTEM_GX4000)
406406   {
407407      if ((changed_data & 0x10) != 0) {
408         cassette_change_state(device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ),
408         cassette_change_state(devtag_get_device(device->machine, CASSETTE, "cassette"),
409409            ((data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED),
410410            CASSETTE_MASK_MOTOR);
411411      }
r4087r4088
12461246
12471247static READ8_HANDLER ( AmstradCPC_ReadPortHandler )
12481248{
1249   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
1249   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
12501250   unsigned char data = 0xFF;
12511251   unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8);
12521252   m6845_personality_t crtc_type;
r4087r4088
13021302   if ((offset & (1<<11)) == 0)
13031303   {
13041304      if (r1r0 < 0x03 )
1305         data = ppi8255_r((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), r1r0);
1305         data = ppi8255_r((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), r1r0);
13061306   }
13071307/* if b10 = 0 : Expansion Peripherals Read selected
13081308
r4087r4088
13461346/* Offset handler for write */
13471347static WRITE8_HANDLER ( AmstradCPC_WritePortHandler )
13481348{
1349   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, NEC765A, "nec765");
1349   device_config *fdc = (device_config*)devtag_get_device(space->machine, NEC765A, "nec765");
13501350   if ((offset & (1<<15)) == 0)
13511351   {
13521352      if(aleste_mode & 0x04) // Aleste mode
r4087r4088
14241424*/
14251425   if ((offset & (1<<11)) == 0) {
14261426      unsigned int Index = ((offset & 0x0300) >> 8);
1427      ppi8255_w((device_config*)device_list_find_by_tag( space->machine->config->devicelist, PPI8255, "ppi8255" ), Index, data);
1427      ppi8255_w((device_config*)devtag_get_device(space->machine, PPI8255, "ppi8255"), Index, data);
14281428   }
14291429/* if b10 = 0 : Expansion Peripherals Write selected */
14301430   if ((offset & (1<<10)) == 0) {
src/mess/drivers/a310.c
r4087r4088
364364
365365static READ32_HANDLER(ioc_r)
366366{
367   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");   
367   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
368368   if (offset >= 0x80000 && offset < 0xc0000)
369369   {
370370      switch (offset & 0x1f)
r4087r4088
418418
419419static WRITE32_HANDLER(ioc_w)
420420{
421   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");   
421   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
422422   if (offset >= 0x80000 && offset < 0xc0000)
423423   {
424424//      logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
src/mess/drivers/samcoupe.c
r4087r4088
8181
8282static READ8_HANDLER( samcoupe_disk_r )
8383{
84   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");
84   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
8585   
8686   /* drive and side is encoded into bit 5 and 3 */
8787   wd17xx_set_drive(fdc,(offset >> 4) & 1);
r4087r4088
102102
103103static WRITE8_HANDLER( samcoupe_disk_w )
104104{
105   device_config *fdc = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, WD1772, "wd1772");
105   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
106106
107107   /* drive and side is encoded into bit 5 and 3 */
108108   wd17xx_set_drive(fdc,(offset >> 4) & 1);
src/mess/drivers/tutor.c
r4087r4088
270270static TIMER_CALLBACK(tape_interrupt_handler)
271271{
272272   //assert(tape_interrupt_enable);
273   cpu_set_input_line(machine->cpu[0], 1, (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.0) ? ASSERT_LINE : CLEAR_LINE);
273   cpu_set_input_line(machine->cpu[0], 1, (cassette_input(devtag_get_device(machine, CASSETTE, "cassette")) > 0.0) ? ASSERT_LINE : CLEAR_LINE);
274274}
275275
276276/* CRU handler */
277277static  READ8_HANDLER(tutor_cassette_r)
278278{
279   return (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0) ? 1 : 0;
279   return (cassette_input(devtag_get_device(space->machine, CASSETTE, "cassette")) > 0.0) ? 1 : 0;
280280}
281281
282282/* memory handler */
r4087r4088
293293      {
294294      case 0:
295295         /* data out */
296         cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), (data) ? +1.0 : -1.0);
296         cassette_output(devtag_get_device(space->machine, CASSETTE, "cassette"), (data) ? +1.0 : -1.0);
297297         break;
298298      case 1:
299299         /* interrupt control??? */
src/mess/drivers/ip20.c
r4087r4088
171171   case 0x0d04:
172172      verboselog(machine, 2, "HPC DUART0 Channel B Data Read\n" );
173173//      return 0;
174      scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
174      scc = devtag_get_device(space->machine, SCC8530, "scc");
175175      return scc_r(scc, 2);
176176   case 0x0d08:
177177      verboselog(machine, 2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask    );
r4087r4088
180180   case 0x0d0c:
181181      verboselog(machine, 2, "HPC DUART0 Channel A Data Read\n" );
182182//      return 0;
183      scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
183      scc = devtag_get_device(space->machine, SCC8530, "scc");
184184      return scc_r(scc, 3);
185185   case 0x0d10:
186186//      verboselog(machine, 2, "HPC DUART1 Channel B Control Read\n" );
r4087r4088
362362      break;
363363   case 0x0d00:
364364      verboselog(machine, 2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
365      scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
365      scc = devtag_get_device(space->machine, SCC8530, "scc");
366366      scc_w(scc, 0, data);
367367      break;
368368   case 0x0d04:
369369      verboselog(machine, 2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
370      scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
370      scc = devtag_get_device(space->machine, SCC8530, "scc");
371371      scc_w(scc, 2, data);
372372      break;
373373   case 0x0d08:
374374      verboselog(machine, 2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
375      scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
375      scc = devtag_get_device(space->machine, SCC8530, "scc");
376376      scc_w(scc, 1, data);
377377      break;
378378   case 0x0d0c:
379379      verboselog(machine, 2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
380      scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
380      scc = devtag_get_device(space->machine, SCC8530, "scc");
381381      scc_w(scc, 3, data);
382382      break;
383383   case 0x0d10:
src/mess/drivers/bbc.c
r4087r4088
695695
696696static INTERRUPT_GEN( bbcb_vsync )
697697{
698   const device_config *via_0 = device_list_find_by_tag(device->machine->config->devicelist, VIA6522, "via6522_0");
698   const device_config *via_0 = devtag_get_device(device->machine, VIA6522, "via6522_0");
699699   via_ca1_w(via_0, 0,1);
700700   via_ca1_w(via_0, 0,0);
701701   bbc_frameclock();
src/mess/drivers/kc.c
r4087r4088
5858      case 0x08d:
5959      case 0x08e:
6060      case 0x08f:
61         return kc85_ctc_r(device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), port&3);
61         return kc85_ctc_r(devtag_get_device(space->machine, Z80CTC, "z80ctc"), port&3);
6262
6363   }
6464
r4087r4088
102102      case 0x08d:
103103      case 0x08e:
104104      case 0x08f:
105         kc85_ctc_w(device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), port&3, data);
105         kc85_ctc_w(devtag_get_device(space->machine, Z80CTC, "z80ctc"), port&3, data);
106106         return;
107107   }
108108
r4087r4088
154154      case 0x08d:
155155      case 0x08e:
156156      case 0x08f:
157         return kc85_ctc_r(device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), port&3);
157         return kc85_ctc_r(devtag_get_device(space->machine, Z80CTC, "z80ctc"), port&3);
158158   }
159159
160160   logerror("unhandled port r: %04x\n",offset);
r4087r4088
187187      case 0x08d:
188188      case 0x08e:
189189      case 0x08f:
190         kc85_ctc_w(device_list_find_by_tag(space->machine->config->devicelist, Z80CTC, "z80ctc"), port&3, data);
190         kc85_ctc_w(devtag_get_device(space->machine, Z80CTC, "z80ctc"), port&3, data);
191191         return;
192192   }
193193

Previous 15994 Revisions Next


© 1998-2018 The MESS Team