src/mess/video/pc_mda.c
| r4087 | r4088 | |
| 128 | 128 | |
| 129 | 129 | static VIDEO_UPDATE( mc6845_mda ) |
| 130 | 130 | { |
| 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); |
| 132 | 132 | mc6845_update( devconf, bitmap, cliprect ); |
| 133 | 133 | return 0; |
| 134 | 134 | } |
| r4087 | r4088 | |
| 363 | 363 | *************************************************************************/ |
| 364 | 364 | WRITE8_HANDLER ( pc_MDA_w ) |
| 365 | 365 | { |
| 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); |
| 367 | 367 | switch( offset ) |
| 368 | 368 | { |
| 369 | 369 | case 0: case 2: case 4: case 6: |
| r4087 | r4088 | |
| 380 | 380 | |
| 381 | 381 | READ8_HANDLER ( pc_MDA_r ) |
| 382 | 382 | { |
| 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); |
| 384 | 384 | int data = 0xff; |
| 385 | 385 | switch( offset ) |
| 386 | 386 | { |
| r4087 | r4088 | |
| 520 | 520 | |
| 521 | 521 | static VIDEO_UPDATE( mc6845_hercules ) |
| 522 | 522 | { |
| 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); |
| 524 | 524 | mc6845_update( devconf, bitmap, cliprect ); |
| 525 | 525 | return 0; |
| 526 | 526 | } |
| r4087 | r4088 | |
| 528 | 528 | |
| 529 | 529 | static void hercules_mode_control_w(running_machine *machine, int data) |
| 530 | 530 | { |
| 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); |
| 532 | 532 | |
| 533 | 533 | MDA_LOG(1,"hercules_mode_control_w",("$%02x: colums %d, gfx %d, enable %d, blink %d\n", |
| 534 | 534 | data, (data&1)?80:40, (data>>1)&1, (data>>3)&1, (data>>5)&1)); |
| r4087 | r4088 | |
| 564 | 564 | |
| 565 | 565 | static WRITE8_HANDLER ( pc_hercules_w ) |
| 566 | 566 | { |
| 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); |
| 568 | 568 | |
| 569 | 569 | switch( offset ) |
| 570 | 570 | { |
| r4087 | r4088 | |
| 604 | 604 | |
| 605 | 605 | static READ8_HANDLER ( pc_hercules_r ) |
| 606 | 606 | { |
| 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); |
| 608 | 608 | int data = 0xff; |
| 609 | 609 | |
| 610 | 610 | switch( offset ) |
src/mess/video/pc_t1t.c
| r4087 | r4088 | |
| 165 | 165 | |
| 166 | 166 | static VIDEO_UPDATE( mc6845_t1000 ) |
| 167 | 167 | { |
| 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); |
| 169 | 169 | mc6845_update( devconf, bitmap, cliprect); |
| 170 | 170 | return 0; |
| 171 | 171 | } |
| r4087 | r4088 | |
| 739 | 739 | switch( offset ) |
| 740 | 740 | { |
| 741 | 741 | 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); |
| 743 | 743 | mc6845_address_w( devconf, offset, data ); |
| 744 | 744 | break; |
| 745 | 745 | 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); |
| 747 | 747 | mc6845_register_w( devconf, offset, data ); |
| 748 | 748 | break; |
| 749 | 749 | case 8: |
| r4087 | r4088 | |
| 779 | 779 | switch( offset ) |
| 780 | 780 | { |
| 781 | 781 | 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); |
| 783 | 783 | mc6845_address_w( devconf, offset, data ); |
| 784 | 784 | break; |
| 785 | 785 | 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); |
| 787 | 787 | mc6845_register_w( devconf, offset, data ); |
| 788 | 788 | break; |
| 789 | 789 | case 10: |
| r4087 | r4088 | |
| 824 | 824 | break; |
| 825 | 825 | |
| 826 | 826 | 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); |
| 828 | 828 | data = mc6845_register_r( devconf, offset ); |
| 829 | 829 | break; |
| 830 | 830 | |
| r4087 | r4088 | |
| 884 | 884 | { |
| 885 | 885 | pcjr.pc_framecnt++; |
| 886 | 886 | } |
| 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); |
| 888 | 888 | } |
| 889 | 889 | |
src/mess/video/pc_cga.c
| r4087 | r4088 | |
| 517 | 517 | static VIDEO_UPDATE( mc6845_cga ) |
| 518 | 518 | { |
| 519 | 519 | 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); |
| 521 | 521 | mc6845_update( devconf, bitmap, cliprect); |
| 522 | 522 | |
| 523 | 523 | /* Check for changes in font dipsetting */ |
| r4087 | r4088 | |
| 1059 | 1059 | */ |
| 1060 | 1060 | static void pc_cga_mode_control_w(running_machine *machine, int data) |
| 1061 | 1061 | { |
| 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); |
| 1063 | 1063 | |
| 1064 | 1064 | CGA_LOG(1,"CGA_mode_control_w",("$%02x: columns %d, gfx %d, hires %d, blink %d\n", |
| 1065 | 1065 | data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1)); |
| r4087 | r4088 | |
| 1197 | 1197 | |
| 1198 | 1198 | static READ8_HANDLER( pc_cga8_r ) |
| 1199 | 1199 | { |
| 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); |
| 1201 | 1201 | int data = 0xff; |
| 1202 | 1202 | switch( offset ) |
| 1203 | 1203 | { |
| r4087 | r4088 | |
| 1222 | 1222 | |
| 1223 | 1223 | switch(offset) { |
| 1224 | 1224 | 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); |
| 1226 | 1226 | mc6845_address_w( devconf, offset, data ); |
| 1227 | 1227 | break; |
| 1228 | 1228 | 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); |
| 1230 | 1230 | mc6845_register_w( devconf, offset, data ); |
| 1231 | 1231 | break; |
| 1232 | 1232 | case 8: |
| r4087 | r4088 | |
| 1488 | 1488 | |
| 1489 | 1489 | static WRITE8_HANDLER ( pc1512_w ) |
| 1490 | 1490 | { |
| 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); |
| 1492 | 1492 | |
| 1493 | 1493 | switch (offset) |
| 1494 | 1494 | { |
| r4087 | r4088 | |
| 1652 | 1652 | static VIDEO_UPDATE( mc6845_pc1512 ) |
| 1653 | 1653 | { |
| 1654 | 1654 | 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); |
| 1656 | 1656 | mc6845_update( devconf, bitmap, cliprect); |
| 1657 | 1657 | |
| 1658 | 1658 | /* Check for changes in font dipsetting */ |
src/mess/machine/apple3.c
| r4087 | r4088 | |
| 178 | 178 | a3 |= VAR_EXTA0 << ((offset - 0xD0) / 2); |
| 179 | 179 | else |
| 180 | 180 | 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")); |
| 182 | 182 | result = 0x00; |
| 183 | 183 | break; |
| 184 | 184 | |
| r4087 | r4088 | |
| 246 | 246 | a3 |= VAR_EXTA0 << ((offset - 0xD0) / 2); |
| 247 | 247 | else |
| 248 | 248 | 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")); |
| 250 | 250 | break; |
| 251 | 251 | |
| 252 | 252 | case 0xDB: |
| r4087 | r4088 | |
| 271 | 271 | |
| 272 | 272 | INTERRUPT_GEN( apple3_interrupt ) |
| 273 | 273 | { |
| 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"); |
| 275 | 275 | |
| 276 | 276 | via_ca2_w(via_1, 0, (AY3600_keydata_strobe_r() & 0x80) ? 1 : 0); |
| 277 | 277 | via_cb1_w(via_1, 0, video_screen_get_vblank(device->machine->primary_screen)); |
| r4087 | r4088 | |
| 467 | 467 | |
| 468 | 468 | /* reinstall VIA handlers */ |
| 469 | 469 | { |
| 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"); |
| 472 | 472 | memory_install_read8_device_handler(space, via_0, 0xFFD0, 0xFFDF, 0, 0, via_r); |
| 473 | 473 | memory_install_write8_device_handler(space, via_0, 0xFFD0, 0xFFDF, 0, 0, via_w); |
| 474 | 474 | memory_install_read8_device_handler(space, via_1, 0xFFE0, 0xFFEF, 0, 0, via_r); |
| r4087 | r4088 | |
| 725 | 725 | memory_region(machine, "main")[0x0685] = 0x00; |
| 726 | 726 | |
| 727 | 727 | 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")); |
| 729 | 729 | |
| 730 | 730 | AY3600_init(machine); |
| 731 | 731 | |
src/mess/machine/msx_slot.c
| r4087 | r4088 | |
| 1127 | 1127 | |
| 1128 | 1128 | MSX_SLOT_RESET(diskrom) |
| 1129 | 1129 | { |
| 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"); |
| 1131 | 1131 | wd17xx_reset(fdc); |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | static READ8_HANDLER (msx_diskrom_page1_r) |
| 1135 | 1135 | { |
| 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"); |
| 1137 | 1137 | switch (offset) { |
| 1138 | 1138 | case 0: return wd17xx_status_r (fdc, 0); |
| 1139 | 1139 | case 1: return wd17xx_track_r (fdc, 0); |
| r4087 | r4088 | |
| 1147 | 1147 | |
| 1148 | 1148 | static READ8_HANDLER (msx_diskrom_page2_r) |
| 1149 | 1149 | { |
| 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"); |
| 1151 | 1151 | if (offset >= 0x7f8) { |
| 1152 | 1152 | switch (offset) { |
| 1153 | 1153 | case 0x7f8: |
| r4087 | r4088 | |
| 1196 | 1196 | |
| 1197 | 1197 | MSX_SLOT_WRITE(diskrom) |
| 1198 | 1198 | { |
| 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"); |
| 1200 | 1200 | if (addr >= 0xa000 && addr < 0xc000) { |
| 1201 | 1201 | addr -= 0x4000; |
| 1202 | 1202 | } |
| r4087 | r4088 | |
| 1243 | 1243 | |
| 1244 | 1244 | MSX_SLOT_RESET(diskrom2) |
| 1245 | 1245 | { |
| 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"); |
| 1247 | 1247 | wd17xx_reset (fdc); |
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | static READ8_HANDLER (msx_diskrom2_page1_r) |
| 1251 | 1251 | { |
| 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"); |
| 1253 | 1253 | switch (offset) { |
| 1254 | 1254 | case 0: return wd17xx_status_r(fdc, 0); |
| 1255 | 1255 | case 1: return wd17xx_track_r(fdc, 0); |
| r4087 | r4088 | |
| 1263 | 1263 | |
| 1264 | 1264 | static READ8_HANDLER (msx_diskrom2_page2_r) |
| 1265 | 1265 | { |
| 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"); |
| 1267 | 1267 | if (offset >= 0x7b8) { |
| 1268 | 1268 | switch (offset) { |
| 1269 | 1269 | case 0x7b8: |
| r4087 | r4088 | |
| 1311 | 1311 | |
| 1312 | 1312 | MSX_SLOT_WRITE(diskrom2) |
| 1313 | 1313 | { |
| 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"); |
| 1315 | 1315 | if (addr >= 0xa000 && addr < 0xc000) { |
| 1316 | 1316 | addr -= 0x4000; |
| 1317 | 1317 | } |
src/mess/machine/coco.c
| r4087 | r4088 | |
| 455 | 455 | |
| 456 | 456 | static void pak_load_trailer(running_machine *machine, const pak_decodedtrailer *trailer) |
| 457 | 457 | { |
| 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"); |
| 459 | 459 | cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc); |
| 460 | 460 | cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x); |
| 461 | 461 | cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y); |
| r4087 | r4088 | |
| 1120 | 1120 | |
| 1121 | 1121 | static const device_config *cartslot_image(running_machine *machine) |
| 1122 | 1122 | { |
| 1123 | | return device_list_find_by_tag( machine->config->devicelist, CARTSLOT, "cart" ); |
| 1123 | return devtag_get_device(machine, CARTSLOT, "cart"); |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | static const device_config *cassette_device_image(running_machine *machine) |
| 1127 | 1127 | { |
| 1128 | | return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ); |
| 1128 | return devtag_get_device(machine, CASSETTE, "cassette"); |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | static const device_config *bitbanger_image(running_machine *machine) |
| 1132 | 1132 | { |
| 1133 | | return device_list_find_by_tag(machine->config->devicelist, BITBANGER, "bitbanger"); |
| 1133 | return devtag_get_device(machine, BITBANGER, "bitbanger"); |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | static const device_config *printer_image(running_machine *machine) |
| 1137 | 1137 | { |
| 1138 | | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer"); |
| 1138 | return devtag_get_device(machine, PRINTER, "printer"); |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | static int get_soundmux_status(void) |
| r4087 | r4088 | |
| 1215 | 1215 | |
| 1216 | 1216 | WRITE8_HANDLER ( dgnalpha_psg_porta_write ) |
| 1217 | 1217 | { |
| 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"); |
| 1219 | 1219 | /* Bits 0..3 are the drive select lines for the internal floppy interface */ |
| 1220 | 1220 | /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */ |
| 1221 | 1221 | /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */ |
| r4087 | r4088 | |
| 1671 | 1671 | /* The Dragon Alpha hardware reverses the order of the WD2797 registers */ |
| 1672 | 1672 | READ8_HANDLER(wd2797_r) |
| 1673 | 1673 | { |
| 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"); |
| 1675 | 1675 | int result = 0; |
| 1676 | 1676 | |
| 1677 | 1677 | switch(offset & 0x03) |
| r4087 | r4088 | |
| 1697 | 1697 | |
| 1698 | 1698 | WRITE8_HANDLER(wd2797_w) |
| 1699 | 1699 | { |
| 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"); |
| 1701 | 1701 | switch(offset & 0x3) |
| 1702 | 1702 | { |
| 1703 | 1703 | case 0: |
| r4087 | r4088 | |
| 1937 | 1937 | |
| 1938 | 1938 | /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */ |
| 1939 | 1939 | 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"); |
| 1941 | 1941 | UINT8 memsize = get_sam_memorysize(sam); |
| 1942 | 1942 | UINT8 maptype = get_sam_maptype(sam); |
| 1943 | 1943 | // UINT8 pagemode = get_sam_pagemode(machine); |
src/mess/machine/99_dsk.c
| r4087 | r4088 | |
| 436 | 436 | */ |
| 437 | 437 | void ti99_fdc_reset(running_machine *machine) |
| 438 | 438 | { |
| 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"); |
| 440 | 440 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_fdc_dsr; |
| 441 | 441 | DSEL = 0; |
| 442 | 442 | DSKnum = -1; |
| r4087 | r4088 | |
| 491 | 491 | */ |
| 492 | 492 | static void fdc_cru_w(running_machine *machine, int offset, int data) |
| 493 | 493 | { |
| 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"); |
| 495 | 495 | |
| 496 | 496 | switch (offset) |
| 497 | 497 | { |
| r4087 | r4088 | |
| 571 | 571 | */ |
| 572 | 572 | static READ8_HANDLER(fdc_mem_r) |
| 573 | 573 | { |
| 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"); |
| 575 | 575 | |
| 576 | 576 | switch (offset) |
| 577 | 577 | { |
| r4087 | r4088 | |
| 598 | 598 | */ |
| 599 | 599 | static WRITE8_HANDLER(fdc_mem_w) |
| 600 | 600 | { |
| 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"); |
| 602 | 602 | |
| 603 | 603 | data ^= 0xFF; /* inverted data bus */ |
| 604 | 604 | |
| r4087 | r4088 | |
| 650 | 650 | #if HAS_99CCFDC |
| 651 | 651 | void ti99_ccfdc_reset(running_machine *machine) |
| 652 | 652 | { |
| 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"); |
| 654 | 654 | |
| 655 | 655 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_ccfdc_dsr; |
| 656 | 656 | DSEL = 0; |
| r4087 | r4088 | |
| 704 | 704 | */ |
| 705 | 705 | static void ccfdc_cru_w(running_machine *machine, int offset, int data) |
| 706 | 706 | { |
| 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"); |
| 708 | 708 | |
| 709 | 709 | switch (offset) |
| 710 | 710 | { |
| r4087 | r4088 | |
| 865 | 865 | */ |
| 866 | 866 | void ti99_bwg_reset(running_machine *machine) |
| 867 | 867 | { |
| 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"); |
| 869 | 869 | |
| 870 | 870 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_bwg_dsr; |
| 871 | 871 | bwg_ram = memory_region(machine, region_dsr) + offset_bwg_ram; |
| r4087 | r4088 | |
| 922 | 922 | */ |
| 923 | 923 | static void bwg_cru_w(running_machine *machine, int offset, int data) |
| 924 | 924 | { |
| 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"); |
| 926 | 926 | |
| 927 | 927 | switch (offset) |
| 928 | 928 | { |
| r4087 | r4088 | |
| 1039 | 1039 | */ |
| 1040 | 1040 | static READ8_HANDLER(bwg_mem_r) |
| 1041 | 1041 | { |
| 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"); |
| 1043 | 1043 | |
| 1044 | 1044 | int reply = 0; |
| 1045 | 1045 | |
| r4087 | r4088 | |
| 1050 | 1050 | else if (bwg_rtc_enable) |
| 1051 | 1051 | { |
| 1052 | 1052 | 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); |
| 1054 | 1054 | } |
| 1055 | 1055 | else |
| 1056 | 1056 | { |
| r4087 | r4088 | |
| 1084 | 1084 | */ |
| 1085 | 1085 | static WRITE8_HANDLER(bwg_mem_w) |
| 1086 | 1086 | { |
| 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"); |
| 1088 | 1088 | |
| 1089 | 1089 | if (offset < 0x1c00) |
| 1090 | 1090 | ; |
| r4087 | r4088 | |
| 1093 | 1093 | else if (bwg_rtc_enable) |
| 1094 | 1094 | { |
| 1095 | 1095 | 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); |
| 1097 | 1097 | } |
| 1098 | 1098 | else |
| 1099 | 1099 | { |
| r4087 | r4088 | |
| 1419 | 1419 | { |
| 1420 | 1420 | /* rtc */ |
| 1421 | 1421 | 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); |
| 1423 | 1423 | } |
| 1424 | 1424 | else if (offset < 0x1400) |
| 1425 | 1425 | { |
| r4087 | r4088 | |
| 1469 | 1469 | { |
| 1470 | 1470 | /* rtc */ |
| 1471 | 1471 | 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); |
| 1473 | 1473 | } |
| 1474 | 1474 | else if (offset < 0x1400) |
| 1475 | 1475 | { |
src/mess/machine/pmd85.c
| r4087 | r4088 | |
| 504 | 504 | switch (offset & 0x80) |
| 505 | 505 | { |
| 506 | 506 | 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); |
| 508 | 508 | } |
| 509 | 509 | break; |
| 510 | 510 | case 0x08: /* ROM module connector */ |
| r4087 | r4088 | |
| 520 | 520 | switch (offset & 0x80) |
| 521 | 521 | { |
| 522 | 522 | 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); |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | break; |
| r4087 | r4088 | |
| 535 | 535 | case 0x10: /* 8251 (casette recorder, V24) */ |
| 536 | 536 | switch (offset & 0x01) |
| 537 | 537 | { |
| 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); |
| 540 | 540 | } |
| 541 | 541 | break; |
| 542 | 542 | 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); |
| 544 | 544 | 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); |
| 546 | 546 | 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); |
| 548 | 548 | } |
| 549 | 549 | break; |
| 550 | 550 | case 0x80: /* external interfaces */ |
| r4087 | r4088 | |
| 571 | 571 | switch (offset & 0x80) |
| 572 | 572 | { |
| 573 | 573 | 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); |
| 575 | 575 | /* PMD-85.3 memory banking */ |
| 576 | 576 | if ((offset & 0x03) == 0x03) |
| 577 | 577 | { |
| r4087 | r4088 | |
| 594 | 594 | switch (offset & 0x80) |
| 595 | 595 | { |
| 596 | 596 | 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); |
| 598 | 598 | break; |
| 599 | 599 | } |
| 600 | 600 | } |
| r4087 | r4088 | |
| 610 | 610 | case 0x10: /* 8251 (casette recorder, V24) */ |
| 611 | 611 | switch (offset & 0x01) |
| 612 | 612 | { |
| 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; |
| 615 | 615 | } |
| 616 | 616 | break; |
| 617 | 617 | 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); |
| 619 | 619 | break; |
| 620 | 620 | 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); |
| 622 | 622 | logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data); |
| 623 | 623 | break; |
| 624 | 624 | 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); |
| 626 | 626 | break; |
| 627 | 627 | } |
| 628 | 628 | break; |
| r4087 | r4088 | |
| 656 | 656 | switch (offset & 0x80) |
| 657 | 657 | { |
| 658 | 658 | 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); |
| 660 | 660 | } |
| 661 | 661 | break; |
| 662 | 662 | } |
| r4087 | r4088 | |
| 679 | 679 | switch (offset & 0x80) |
| 680 | 680 | { |
| 681 | 681 | 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); |
| 683 | 683 | break; |
| 684 | 684 | } |
| 685 | 685 | break; |
| r4087 | r4088 | |
| 778 | 778 | if (!(input_port_read(machine, "DSW0") & 0x02)) /* V.24 / Tape Switch */ |
| 779 | 779 | { |
| 780 | 780 | /* 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) |
| 782 | 782 | { |
| 783 | 783 | switch (pmd85_model) |
| 784 | 784 | { |
| 785 | 785 | case PMD85_1: |
| 786 | 786 | if (clk_level_tape) |
| 787 | 787 | { |
| 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; |
| 789 | 789 | clk_level_tape = 0; |
| 790 | 790 | } |
| 791 | 791 | else |
| 792 | 792 | { |
| 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; |
| 794 | 794 | |
| 795 | 795 | if (previous_level!=current_level) |
| 796 | 796 | { |
| r4087 | r4088 | |
| 798 | 798 | |
| 799 | 799 | set_out_data_bit(pmd85_cassette_serial_connection.State, data); |
| 800 | 800 | 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")); |
| 802 | 802 | |
| 803 | 803 | clk_level_tape = 1; |
| 804 | 804 | } |
| r4087 | r4088 | |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | /* 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) |
| 819 | 819 | { |
| 820 | 820 | data = get_in_data_bit(pmd85_cassette_serial_connection.input_state); |
| 821 | 821 | 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); |
| 823 | 823 | |
| 824 | 824 | 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")); |
| 826 | 826 | |
| 827 | 827 | clk_level_tape = clk_level_tape ? 0 : 1; |
| 828 | 828 | |
| r4087 | r4088 | |
| 832 | 832 | clk_level_tape = 1; |
| 833 | 833 | |
| 834 | 834 | 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")); |
| 836 | 836 | clk_level = clk_level ? 0 : 1; |
| 837 | 837 | } |
| 838 | 838 | } |
| r4087 | r4088 | |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | static 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"); |
| 904 | 904 | |
| 905 | 905 | pit8253_gate_w(pit8253, 0, 1); |
| 906 | 906 | pit8253_gate_w(pit8253, 1, 1); |
| 907 | 907 | pit8253_gate_w(pit8253, 2, 1); |
| 908 | 908 | 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); |
| 910 | 910 | } |
| 911 | 911 | } |
| 912 | 912 | |
src/mess/machine/c128.c
| r4087 | r4088 | |
| 93 | 93 | WRITE8_HANDLER( c128_write_d000 ) |
| 94 | 94 | { |
| 95 | 95 | 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"); |
| 98 | 98 | |
| 99 | 99 | UINT8 c64_port6510 = (UINT8) device_get_info_int(space->machine->cpu[0], CPUINFO_INT_M6510_PORT); |
| 100 | 100 | |
| r4087 | r4088 | |
| 148 | 148 | static READ8_HANDLER( c128_read_io ) |
| 149 | 149 | { |
| 150 | 150 | 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"); |
| 153 | 153 | |
| 154 | 154 | if (offset < 0x400) |
| 155 | 155 | return vic2_port_r (space, offset & 0x3ff); |
| r4087 | r4088 | |
| 840 | 840 | { |
| 841 | 841 | if (direction & 0x08) |
| 842 | 842 | { |
| 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)); |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | if (direction & 0x20) |
| 847 | 847 | { |
| 848 | 848 | if(!(data & 0x20)) |
| 849 | 849 | { |
| 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); |
| 851 | 851 | timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 852 | 852 | } |
| 853 | 853 | else |
| 854 | 854 | { |
| 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); |
| 856 | 856 | timer_reset(datasette_timer, attotime_never); |
| 857 | 857 | } |
| 858 | 858 | } |
| r4087 | r4088 | |
| 868 | 868 | { |
| 869 | 869 | UINT8 data = c64_port_data; |
| 870 | 870 | |
| 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) |
| 872 | 872 | data &= ~0x10; |
| 873 | 873 | else |
| 874 | 874 | data |= 0x10; |
src/mess/machine/pet.c
| r4087 | r4088 | |
| 44 | 44 | |
| 45 | 45 | static READ8_HANDLER( pet_mc6845_register_r ) |
| 46 | 46 | { |
| 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"); |
| 48 | 48 | return mc6845_register_r(devconf, offset); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | static WRITE8_HANDLER( pet_mc6845_register_w ) |
| 52 | 52 | { |
| 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"); |
| 54 | 54 | mc6845_register_w(devconf, offset, data); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | static WRITE8_HANDLER( pet_mc6845_address_w ) |
| 58 | 58 | { |
| 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"); |
| 60 | 60 | mc6845_address_w(devconf, offset, data); |
| 61 | 61 | } |
| 62 | 62 | |
| r4087 | r4088 | |
| 78 | 78 | { |
| 79 | 79 | int data = 0xf0 | pet_keyline_select; |
| 80 | 80 | |
| 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) |
| 82 | 82 | data &= ~0x10; |
| 83 | 83 | |
| 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) |
| 85 | 85 | data &= ~0x20; |
| 86 | 86 | |
| 87 | 87 | if (!cbm_ieee_eoi_r(space->machine)) |
| r4087 | r4088 | |
| 144 | 144 | static READ8_HANDLER( pet_pia0_ca1_in ) |
| 145 | 145 | { |
| 146 | 146 | // 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; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
| r4087 | r4088 | |
| 157 | 157 | { |
| 158 | 158 | if (!data) |
| 159 | 159 | { |
| 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); |
| 161 | 161 | timer_adjust_periodic(datasette1_timer, attotime_zero, 0, ATTOTIME_IN_HZ(48000)); // I put 48000 because I was given some .wav with this freq |
| 162 | 162 | } |
| 163 | 163 | else |
| 164 | 164 | { |
| 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); |
| 166 | 166 | timer_reset(datasette1_timer, attotime_never); |
| 167 | 167 | } |
| 168 | 168 | } |
| r4087 | r4088 | |
| 301 | 301 | |
| 302 | 302 | if (!(data & 0x10)) |
| 303 | 303 | { |
| 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); |
| 305 | 305 | timer_adjust_periodic(datasette2_timer, attotime_zero, 0, ATTOTIME_IN_HZ(48000)); // I put 48000 because I was given some .wav with this freq |
| 306 | 306 | } |
| 307 | 307 | else |
| 308 | 308 | { |
| 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); |
| 310 | 310 | timer_reset(datasette2_timer, attotime_never); |
| 311 | 311 | } |
| 312 | 312 | |
| r4087 | r4088 | |
| 321 | 321 | static READ8_DEVICE_HANDLER( pet_via_cb1_r ) |
| 322 | 322 | { |
| 323 | 323 | // 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; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | |
| r4087 | r4088 | |
| 352 | 352 | |
| 353 | 353 | static WRITE8_HANDLER(cbm8096_io_w) |
| 354 | 354 | { |
| 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"); |
| 356 | 356 | |
| 357 | 357 | if (offset < 0x10) ; |
| 358 | 358 | else if (offset < 0x14) pia_0_w(space, offset & 3, data); |
| r4087 | r4088 | |
| 367 | 367 | |
| 368 | 368 | static READ8_HANDLER(cbm8096_io_r) |
| 369 | 369 | { |
| 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"); |
| 371 | 371 | |
| 372 | 372 | int data = 0xff; |
| 373 | 373 | if (offset < 0x10) ; |
| r4087 | r4088 | |
| 562 | 562 | static TIMER_CALLBACK( pet_tape1_timer ) |
| 563 | 563 | { |
| 564 | 564 | // 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; |
| 566 | 566 | pia_0_ca1_w(cputag_get_address_space(machine,"main",ADDRESS_SPACE_PROGRAM), 0, data); |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | /* NOT WORKING - Just placeholder */ |
| 570 | 570 | static TIMER_CALLBACK( pet_tape2_timer ) |
| 571 | 571 | { |
| 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"); |
| 573 | 573 | // 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; |
| 575 | 575 | via_cb1_w(via_0, 0, data); |
| 576 | 576 | } |
| 577 | 577 | |
src/mess/machine/oric.c
| r4087 | r4088 | |
| 274 | 274 | |
| 275 | 275 | static const device_config *cassette_device_image(running_machine *machine) |
| 276 | 276 | { |
| 277 | | return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ); |
| 277 | return devtag_get_device(machine, CASSETTE, "cassette"); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /* not called yet - this will update the via with the state of the tape data. |
| r4087 | r4088 | |
| 283 | 283 | { |
| 284 | 284 | int data; |
| 285 | 285 | 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"); |
| 287 | 287 | |
| 288 | 288 | data = 0; |
| 289 | 289 | |
| r4087 | r4088 | |
| 352 | 352 | static void oric_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 353 | 353 | { |
| 354 | 354 | 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"); |
| 356 | 356 | |
| 357 | 357 | acknowledge = 1; |
| 358 | 358 | |
| r4087 | r4088 | |
| 732 | 732 | |
| 733 | 733 | static READ8_HANDLER (oric_jasmin_r) |
| 734 | 734 | { |
| 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"); |
| 737 | 737 | unsigned char data = 0x0ff; |
| 738 | 738 | |
| 739 | 739 | switch (offset & 0x0f) |
| r4087 | r4088 | |
| 763 | 763 | |
| 764 | 764 | static WRITE8_HANDLER(oric_jasmin_w) |
| 765 | 765 | { |
| 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"); |
| 768 | 768 | switch (offset & 0x0f) |
| 769 | 769 | { |
| 770 | 770 | /* microdisc floppy disc interface */ |
| r4087 | r4088 | |
| 970 | 970 | READ8_HANDLER (oric_microdisc_r) |
| 971 | 971 | { |
| 972 | 972 | 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"); |
| 974 | 974 | |
| 975 | 975 | switch (offset & 0x0ff) |
| 976 | 976 | { |
| r4087 | r4088 | |
| 998 | 998 | |
| 999 | 999 | default: |
| 1000 | 1000 | { |
| 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"); |
| 1002 | 1002 | data = via_r(via_0, offset & 0x0f); |
| 1003 | 1003 | } |
| 1004 | 1004 | break; |
| r4087 | r4088 | |
| 1010 | 1010 | |
| 1011 | 1011 | WRITE8_HANDLER(oric_microdisc_w) |
| 1012 | 1012 | { |
| 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"); |
| 1014 | 1014 | switch (offset & 0x0ff) |
| 1015 | 1015 | { |
| 1016 | 1016 | /* microdisc floppy disc interface */ |
| r4087 | r4088 | |
| 1058 | 1058 | |
| 1059 | 1059 | default: |
| 1060 | 1060 | { |
| 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"); |
| 1062 | 1062 | via_w(via_0, offset & 0x0f, data); |
| 1063 | 1063 | } |
| 1064 | 1064 | break; |
| r4087 | r4088 | |
| 1139 | 1139 | |
| 1140 | 1140 | static void oric_common_init_machine(running_machine *machine) |
| 1141 | 1141 | { |
| 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"); |
| 1143 | 1143 | |
| 1144 | 1144 | /* clear all irqs */ |
| 1145 | 1145 | oric_irqs = 0; |
| r4087 | r4088 | |
| 1226 | 1226 | |
| 1227 | 1227 | READ8_HANDLER ( oric_IO_r ) |
| 1228 | 1228 | { |
| 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"); |
| 1230 | 1230 | #if 0 |
| 1231 | 1231 | switch (input_port_read(machine, "FLOPPY") & 0x07) |
| 1232 | 1232 | { |
| r4087 | r4088 | |
| 1266 | 1266 | |
| 1267 | 1267 | WRITE8_HANDLER ( oric_IO_w ) |
| 1268 | 1268 | { |
| 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"); |
| 1270 | 1270 | #if 0 |
| 1271 | 1271 | switch (input_port_read(machine, "FLOPPY") & 0x07) |
| 1272 | 1272 | { |
src/mess/machine/vector06.c
| r4087 | r4088 | |
| 41 | 41 | |
| 42 | 42 | static READ8_DEVICE_HANDLER (vector06_8255_portc_r ) |
| 43 | 43 | { |
| 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")); |
| 45 | 45 | UINT8 retVal = input_port_read(device->machine, "LINE8"); |
| 46 | 46 | if (level > 0) { |
| 47 | 47 | retVal |= 0x10; |
| r4087 | r4088 | |
| 124 | 124 | }; |
| 125 | 125 | |
| 126 | 126 | READ8_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)); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | WRITE8_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 ); |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | READ8_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)); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | WRITE8_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 ); |
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
| r4087 | r4088 | |
| 171 | 171 | |
| 172 | 172 | WRITE8_HANDLER(vector_disc_w) |
| 173 | 173 | { |
| 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"); |
| 175 | 175 | wd17xx_set_side (fdc,((data & 4) >> 2) ^ 1); |
| 176 | 176 | wd17xx_set_drive(fdc,data & 1); |
| 177 | 177 | } |
| r4087 | r4088 | |
| 205 | 205 | |
| 206 | 206 | MACHINE_START( vector06 ) |
| 207 | 207 | { |
| 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"); |
| 209 | 209 | wd17xx_set_density (fdc, DEN_FM_HI); |
| 210 | 210 | } |
| 211 | 211 | |
src/mess/machine/orion.c
| r4087 | r4088 | |
| 71 | 71 | |
| 72 | 72 | MACHINE_START( orion128 ) |
| 73 | 73 | { |
| 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"); |
| 75 | 75 | |
| 76 | 76 | wd17xx_set_density (fdc,DEN_FM_HI); |
| 77 | 77 | orion_video_mode_mask = 7; |
| r4087 | r4088 | |
| 79 | 79 | |
| 80 | 80 | READ8_HANDLER ( orion128_system_r ) |
| 81 | 81 | { |
| 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); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | WRITE8_HANDLER ( orion128_system_w ) |
| 86 | 86 | { |
| 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); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | READ8_HANDLER ( orion128_romdisk_r ) |
| 91 | 91 | { |
| 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); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | WRITE8_HANDLER ( orion128_romdisk_w ) |
| 96 | 96 | { |
| 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); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static void orion_set_video_mode(running_machine *machine, int width) { |
| r4087 | r4088 | |
| 204 | 204 | |
| 205 | 205 | static WRITE8_HANDLER ( orion_disk_control_w ) |
| 206 | 206 | { |
| 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"); |
| 208 | 208 | |
| 209 | 209 | wd17xx_set_side(fdc,((data & 0x10) >> 4) ^ 1); |
| 210 | 210 | wd17xx_set_drive(fdc,data & 3); |
| r4087 | r4088 | |
| 212 | 212 | |
| 213 | 213 | READ8_HANDLER ( orion128_floppy_r ) |
| 214 | 214 | { |
| 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"); |
| 216 | 216 | |
| 217 | 217 | switch(offset) { |
| 218 | 218 | case 0x0 : |
| r4087 | r4088 | |
| 229 | 229 | |
| 230 | 230 | WRITE8_HANDLER ( orion128_floppy_w ) |
| 231 | 231 | { |
| 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"); |
| 233 | 233 | |
| 234 | 234 | switch(offset) { |
| 235 | 235 | case 0x0 : |
| r4087 | r4088 | |
| 272 | 272 | |
| 273 | 273 | MACHINE_START( orionz80 ) |
| 274 | 274 | { |
| 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"); |
| 276 | 276 | |
| 277 | 277 | wd17xx_set_density (fdc,DEN_FM_HI); |
| 278 | 278 | mc146818_init(machine, MC146818_IGNORE_CENTURY); |
| r4087 | r4088 | |
| 443 | 443 | |
| 444 | 444 | MACHINE_START( orionpro ) |
| 445 | 445 | { |
| 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"); |
| 447 | 447 | wd17xx_set_density (fdc,DEN_FM_HI); |
| 448 | 448 | } |
| 449 | 449 | |
| r4087 | r4088 | |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | READ8_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"); |
| 566 | 566 | |
| 567 | 567 | switch (offset & 0xff) { |
| 568 | 568 | case 0x00 : return 0x56; |
| r4087 | r4088 | |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | WRITE8_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"); |
| 597 | 597 | |
| 598 | 598 | switch (offset & 0xff) { |
| 599 | 599 | case 0x04 : orionpro_ram0_segment = data; orionpro_bank_switch(space->machine); break; |
src/mess/machine/svi318.c
| r4087 | r4088 | |
| 165 | 165 | { |
| 166 | 166 | int data = 0x0f; |
| 167 | 167 | |
| 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) |
| 169 | 169 | data |= 0x80; |
| 170 | 170 | if (!svi318_cassette_present(device->machine, 0)) |
| 171 | 171 | data |= 0x40; |
| r4087 | r4088 | |
| 226 | 226 | if (svi318_cassette_present(device->machine, 0)) |
| 227 | 227 | { |
| 228 | 228 | cassette_change_state( |
| 229 | | device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), |
| 229 | devtag_get_device(device->machine, CASSETTE, "cassette"), |
| 230 | 230 | (data & 0x10) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, |
| 231 | 231 | CASSETTE_MOTOR_DISABLED); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /* 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); |
| 236 | 236 | |
| 237 | 237 | svi.keyboard_row = data & 0x0F; |
| 238 | 238 | } |
| r4087 | r4088 | |
| 261 | 261 | |
| 262 | 262 | static const device_config *printer_image(running_machine *machine) |
| 263 | 263 | { |
| 264 | | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer"); |
| 264 | return devtag_get_device(machine, PRINTER, "printer"); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | static WRITE8_HANDLER( svi318_printer_w ) |
| r4087 | r4088 | |
| 361 | 361 | |
| 362 | 362 | static WRITE8_HANDLER( svi318_fdc_drive_motor_w ) |
| 363 | 363 | { |
| 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"); |
| 365 | 365 | switch (data & 3) |
| 366 | 366 | { |
| 367 | 367 | case 1: |
| r4087 | r4088 | |
| 378 | 378 | static WRITE8_HANDLER( svi318_fdc_density_side_w ) |
| 379 | 379 | { |
| 380 | 380 | 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"); |
| 382 | 382 | |
| 383 | 383 | wd17xx_set_density(fdc, data & 0x01 ? DEN_FM_LO:DEN_MFM_LO); |
| 384 | 384 | |
| r4087 | r4088 | |
| 507 | 507 | } |
| 508 | 508 | else if (!strcmp(screen->tag, "svi806")) |
| 509 | 509 | { |
| 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"); |
| 511 | 511 | mc6845_update(mc6845, bitmap, cliprect); |
| 512 | 512 | } |
| 513 | 513 | else |
| r4087 | r4088 | |
| 775 | 775 | |
| 776 | 776 | int svi318_cassette_present(running_machine *machine, int id) |
| 777 | 777 | { |
| 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"); |
| 779 | 779 | |
| 780 | 780 | if ( img == NULL ) |
| 781 | 781 | return FALSE; |
| r4087 | r4088 | |
| 787 | 787 | READ8_HANDLER( svi318_io_ext_r ) |
| 788 | 788 | { |
| 789 | 789 | 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"); |
| 791 | 791 | |
| 792 | 792 | if (svi.bankLow == SVI_CART) { |
| 793 | 793 | return 0xff; |
| r4087 | r4088 | |
| 806 | 806 | case 0x25: |
| 807 | 807 | case 0x26: |
| 808 | 808 | 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); |
| 810 | 810 | break; |
| 811 | 811 | |
| 812 | 812 | case 0x28: |
| r4087 | r4088 | |
| 817 | 817 | case 0x2D: |
| 818 | 818 | case 0x2E: |
| 819 | 819 | 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); |
| 821 | 821 | break; |
| 822 | 822 | |
| 823 | 823 | case 0x30: |
| r4087 | r4088 | |
| 836 | 836 | data = svi318_fdc_irqdrq_r(space, 0); |
| 837 | 837 | break; |
| 838 | 838 | 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"); |
| 840 | 840 | data = mc6845_register_r(devconf, 0); |
| 841 | 841 | } |
| 842 | 842 | break; |
| r4087 | r4088 | |
| 847 | 847 | |
| 848 | 848 | WRITE8_HANDLER( svi318_io_ext_w ) |
| 849 | 849 | { |
| 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"); |
| 851 | 851 | |
| 852 | 852 | if (svi.bankLow == SVI_CART) { |
| 853 | 853 | return; |
| r4087 | r4088 | |
| 867 | 867 | case 0x25: |
| 868 | 868 | case 0x26: |
| 869 | 869 | 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); |
| 871 | 871 | break; |
| 872 | 872 | |
| 873 | 873 | case 0x28: |
| r4087 | r4088 | |
| 878 | 878 | case 0x2D: |
| 879 | 879 | case 0x2E: |
| 880 | 880 | 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); |
| 882 | 882 | break; |
| 883 | 883 | |
| 884 | 884 | case 0x30: |
| r4087 | r4088 | |
| 901 | 901 | break; |
| 902 | 902 | |
| 903 | 903 | 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"); |
| 905 | 905 | mc6845_address_w(devconf, 0, data); |
| 906 | 906 | } |
| 907 | 907 | break; |
| 908 | 908 | 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"); |
| 910 | 910 | mc6845_register_w(devconf, 0, data); |
| 911 | 911 | } |
| 912 | 912 | break; |
src/mess/machine/compis.c
| r4087 | r4088 | |
| 288 | 288 | /*-------------------------------------------------------------------------*/ |
| 289 | 289 | static void compis_fdc_reset(running_machine *machine) |
| 290 | 290 | { |
| 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"); |
| 292 | 292 | |
| 293 | 293 | nec765_reset(fdc, 0); |
| 294 | 294 | |
| r4087 | r4088 | |
| 298 | 298 | |
| 299 | 299 | static void compis_fdc_tc(running_machine *machine, int state) |
| 300 | 300 | { |
| 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"); |
| 302 | 302 | /* Terminal count if iSBX-218A has DMA enabled */ |
| 303 | 303 | if (input_port_read(machine, "DSW1")) |
| 304 | 304 | { |
| r4087 | r4088 | |
| 334 | 334 | |
| 335 | 335 | READ16_HANDLER (compis_fdc_dack_r) |
| 336 | 336 | { |
| 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"); |
| 338 | 338 | UINT16 data; |
| 339 | 339 | data = 0xffff; |
| 340 | 340 | /* DMA acknowledge if iSBX-218A has DMA enabled */ |
| r4087 | r4088 | |
| 348 | 348 | |
| 349 | 349 | WRITE16_HANDLER (compis_fdc_w) |
| 350 | 350 | { |
| 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"); |
| 352 | 352 | switch(offset) |
| 353 | 353 | { |
| 354 | 354 | case 2: |
| r4087 | r4088 | |
| 362 | 362 | |
| 363 | 363 | READ16_HANDLER (compis_fdc_r) |
| 364 | 364 | { |
| 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"); |
| 366 | 366 | UINT16 data; |
| 367 | 367 | data = 0xffff; |
| 368 | 368 | switch(offset) |
| r4087 | r4088 | |
| 389 | 389 | |
| 390 | 390 | static const device_config *printer_device(running_machine *machine) |
| 391 | 391 | { |
| 392 | | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer"); |
| 392 | return devtag_get_device(machine, PRINTER, "printer"); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /*-------------------------------------------------------------------------*/ |
| r4087 | r4088 | |
| 532 | 532 | |
| 533 | 533 | READ16_HANDLER ( compis_rtc_r ) |
| 534 | 534 | { |
| 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); |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | WRITE16_HANDLER ( compis_rtc_w ) |
| 539 | 539 | { |
| 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); |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /*-------------------------------------------------------------------------*/ |
| r4087 | r4088 | |
| 560 | 560 | |
| 561 | 561 | READ16_HANDLER ( compis_usart_r ) |
| 562 | 562 | { |
| 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"); |
| 564 | 564 | return msm8251_data_r(uart, offset); |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | WRITE16_HANDLER ( compis_usart_w ) |
| 568 | 568 | { |
| 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"); |
| 570 | 570 | switch (offset) |
| 571 | 571 | { |
| 572 | 572 | case 0x00: |
| r4087 | r4088 | |
| 1559 | 1559 | /* OSP PIC 8259 */ |
| 1560 | 1560 | cpu_set_irq_callback(machine->cpu[0], compis_irq_callback); |
| 1561 | 1561 | |
| 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"); |
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | /*-------------------------------------------------------------------------*/ |
src/mess/machine/mac.c
| r4087 | r4088 | |
| 571 | 571 | static TIMER_CALLBACK(kbd_clock) |
| 572 | 572 | { |
| 573 | 573 | 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"); |
| 575 | 575 | |
| 576 | 576 | if (kbd_comm == TRUE) |
| 577 | 577 | { |
| r4087 | r4088 | |
| 890 | 890 | |
| 891 | 891 | void mac_scc_mouse_irq(running_machine *machine, int x, int y) |
| 892 | 892 | { |
| 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"); |
| 894 | 894 | static int last_was_x = 0; |
| 895 | 895 | |
| 896 | 896 | if (x && y) |
| r4087 | r4088 | |
| 918 | 918 | |
| 919 | 919 | READ16_HANDLER ( mac_scc_r ) |
| 920 | 920 | { |
| 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"); |
| 922 | 922 | UINT16 result; |
| 923 | 923 | |
| 924 | 924 | result = scc_r(scc, offset); |
| r4087 | r4088 | |
| 929 | 929 | |
| 930 | 930 | WRITE16_HANDLER ( mac_scc_w ) |
| 931 | 931 | { |
| 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"); |
| 933 | 933 | scc_w(scc, offset, (UINT8) data); |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | WRITE16_HANDLER ( mac_scc_2_w ) |
| 937 | 937 | { |
| 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"); |
| 939 | 939 | UINT8 wdata = data>>8; |
| 940 | 940 | |
| 941 | 941 | scc_w(scc, offset, wdata); |
| r4087 | r4088 | |
| 1512 | 1512 | |
| 1513 | 1513 | static TIMER_CALLBACK(mac_adb_tick) |
| 1514 | 1514 | { |
| 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"); |
| 1516 | 1516 | |
| 1517 | 1517 | // do one clock transition on CB1 to advance the VIA shifter |
| 1518 | 1518 | adb_extclock ^= 1; |
| r4087 | r4088 | |
| 1724 | 1724 | { |
| 1725 | 1725 | set_scc_waitrequest((data & 0x80) >> 7); |
| 1726 | 1726 | 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); |
| 1728 | 1728 | if (mac_model == MODEL_MAC_SE) // on SE this selects which floppy drive (0 = upper, 1 = lower) |
| 1729 | 1729 | { |
| 1730 | 1730 | mac_drive_select = ((data & 0x10) >> 4); |
| r4087 | r4088 | |
| 1777 | 1777 | READ16_HANDLER ( mac_via_r ) |
| 1778 | 1778 | { |
| 1779 | 1779 | 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"); |
| 1781 | 1781 | |
| 1782 | 1782 | offset >>= 8; |
| 1783 | 1783 | offset &= 0x0f; |
| r4087 | r4088 | |
| 1791 | 1791 | |
| 1792 | 1792 | WRITE16_HANDLER ( mac_via_w ) |
| 1793 | 1793 | { |
| 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"); |
| 1795 | 1795 | |
| 1796 | 1796 | offset >>= 8; |
| 1797 | 1797 | offset &= 0x0f; |
| r4087 | r4088 | |
| 1814 | 1814 | READ16_HANDLER ( mac_via2_r ) |
| 1815 | 1815 | { |
| 1816 | 1816 | 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"); |
| 1818 | 1818 | |
| 1819 | 1819 | offset >>= 8; |
| 1820 | 1820 | offset &= 0x0f; |
| r4087 | r4088 | |
| 1828 | 1828 | |
| 1829 | 1829 | WRITE16_HANDLER ( mac_via2_w ) |
| 1830 | 1830 | { |
| 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"); |
| 1832 | 1832 | |
| 1833 | 1833 | offset >>= 8; |
| 1834 | 1834 | offset &= 0x0f; |
| r4087 | r4088 | |
| 2038 | 2038 | static void mac_vblank_irq(running_machine *machine) |
| 2039 | 2039 | { |
| 2040 | 2040 | 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"); |
| 2042 | 2042 | |
| 2043 | 2043 | /* handle ADB keyboard/mouse */ |
| 2044 | 2044 | if (has_adb()) |
src/mess/machine/mz700.c
| r4087 | r4088 | |
| 168 | 168 | if (mz700_motor_on) |
| 169 | 169 | data |= 0x10; |
| 170 | 170 | |
| 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) |
| 172 | 172 | data |= 0x20; /* set the RDATA status */ |
| 173 | 173 | |
| 174 | 174 | if (ne556_out[0]) |
| r4087 | r4088 | |
| 217 | 217 | pio_port_c_output = data; |
| 218 | 218 | |
| 219 | 219 | cassette_change_state( |
| 220 | | device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), |
| 220 | devtag_get_device(device->machine, CASSETTE, "cassette"), |
| 221 | 221 | ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 222 | 222 | CASSETTE_MOTOR_DISABLED); |
| 223 | 223 | |
| 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); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /************************ MMIO ***********************************************/ |
| r4087 | r4088 | |
| 236 | 236 | { |
| 237 | 237 | /* the first four ports are connected to a 8255 PPI */ |
| 238 | 238 | 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); |
| 240 | 240 | break; |
| 241 | 241 | |
| 242 | 242 | 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); |
| 244 | 244 | break; |
| 245 | 245 | |
| 246 | 246 | case 8: |
| r4087 | r4088 | |
| 260 | 260 | { |
| 261 | 261 | /* the first four ports are connected to a 8255 PPI */ |
| 262 | 262 | 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); |
| 264 | 264 | break; |
| 265 | 265 | |
| 266 | 266 | /* the next four ports are connected to a 8253 PIT */ |
| 267 | 267 | 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); |
| 269 | 269 | break; |
| 270 | 270 | |
| 271 | 271 | case 8: |
| 272 | 272 | 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); |
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | 276 | } |
| r4087 | r4088 | |
| 518 | 518 | { |
| 519 | 519 | /* the first four ports are connected to a 8255 PPI */ |
| 520 | 520 | 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); |
| 522 | 522 | break; |
| 523 | 523 | |
| 524 | 524 | 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); |
| 526 | 526 | break; |
| 527 | 527 | |
| 528 | 528 | default: |
src/mess/machine/lisa.c
| r4087 | r4088 | |
| 337 | 337 | |
| 338 | 338 | INLINE void COPS_send_data_if_possible(running_machine *machine) |
| 339 | 339 | { |
| 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"); |
| 341 | 341 | |
| 342 | 342 | if ((! hold_COPS_data) && fifo_size && (! COPS_Ready)) |
| 343 | 343 | { |
| r4087 | r4088 | |
| 523 | 523 | static TIMER_CALLBACK(read_COPS_command) |
| 524 | 524 | { |
| 525 | 525 | 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"); |
| 527 | 527 | |
| 528 | 528 | COPS_Ready = 0; |
| 529 | 529 | |
| r4087 | r4088 | |
| 818 | 818 | |
| 819 | 819 | static WRITE8_DEVICE_HANDLER(COPS_via_out_b) |
| 820 | 820 | { |
| 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"); |
| 822 | 822 | |
| 823 | 823 | /* pull-up */ |
| 824 | 824 | data |= (~ via_r(via_0, VIA_DDRA)) & 0x01; |
| r4087 | r4088 | |
| 1170 | 1170 | init_COPS(machine); |
| 1171 | 1171 | |
| 1172 | 1172 | { |
| 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"); |
| 1174 | 1174 | COPS_via_out_ca2(via_0, 0, 0); /* VIA core forgets to do so */ |
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | /* initialize floppy */ |
| 1178 | 1178 | { |
| 1179 | 1179 | 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 (?) */ |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| r4087 | r4088 | |
| 1328 | 1328 | /*if (lisa_features.floppy_hardware == twiggy) |
| 1329 | 1329 | twiggy_set_head_line(offset & 1); |
| 1330 | 1330 | 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); |
| 1332 | 1332 | break; |
| 1333 | 1333 | case 6: |
| 1334 | 1334 | DISK_DIAG = offset & 1; |
| r4087 | r4088 | |
| 1905 | 1905 | |
| 1906 | 1906 | static READ16_HANDLER ( lisa_IO_r ) |
| 1907 | 1907 | { |
| 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"); |
| 1910 | 1910 | int answer=0; |
| 1911 | 1911 | |
| 1912 | 1912 | switch ((offset & 0x7000) >> 12) |
| r4087 | r4088 | |
| 2034 | 2034 | |
| 2035 | 2035 | static WRITE16_HANDLER ( lisa_IO_w ) |
| 2036 | 2036 | { |
| 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"); |
| 2039 | 2039 | |
| 2040 | 2040 | switch ((offset & 0x7000) >> 12) |
| 2041 | 2041 | { |
src/mess/machine/cgenie.c
| r4087 | r4088 | |
| 83 | 83 | |
| 84 | 84 | static TIMER_CALLBACK( handle_cassette_input ) |
| 85 | 85 | { |
| 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; |
| 87 | 87 | |
| 88 | 88 | if ( new_level != cass_level ) |
| 89 | 89 | { |
| r4087 | r4088 | |
| 321 | 321 | { |
| 322 | 322 | int port_ff_changed = port_ff ^ data; |
| 323 | 323 | |
| 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 ); |
| 325 | 325 | |
| 326 | 326 | /* background bits changed ? */ |
| 327 | 327 | if( port_ff_changed & FF_BGD ) |
| r4087 | r4088 | |
| 476 | 476 | |
| 477 | 477 | READ8_HANDLER( cgenie_status_r ) |
| 478 | 478 | { |
| 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"); |
| 480 | 480 | /* If the floppy isn't emulated, return 0 */ |
| 481 | 481 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 482 | 482 | return 0; |
| r4087 | r4088 | |
| 485 | 485 | |
| 486 | 486 | READ8_HANDLER( cgenie_track_r ) |
| 487 | 487 | { |
| 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"); |
| 489 | 489 | /* If the floppy isn't emulated, return 0xff */ |
| 490 | 490 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 491 | 491 | return 0xff; |
| r4087 | r4088 | |
| 494 | 494 | |
| 495 | 495 | READ8_HANDLER( cgenie_sector_r ) |
| 496 | 496 | { |
| 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"); |
| 498 | 498 | /* If the floppy isn't emulated, return 0xff */ |
| 499 | 499 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 500 | 500 | return 0xff; |
| r4087 | r4088 | |
| 503 | 503 | |
| 504 | 504 | READ8_HANDLER(cgenie_data_r ) |
| 505 | 505 | { |
| 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"); |
| 507 | 507 | /* If the floppy isn't emulated, return 0xff */ |
| 508 | 508 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 509 | 509 | return 0xff; |
| r4087 | r4088 | |
| 512 | 512 | |
| 513 | 513 | WRITE8_HANDLER( cgenie_command_w ) |
| 514 | 514 | { |
| 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"); |
| 516 | 516 | /* If the floppy isn't emulated, return immediately */ |
| 517 | 517 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 518 | 518 | return; |
| r4087 | r4088 | |
| 521 | 521 | |
| 522 | 522 | WRITE8_HANDLER( cgenie_track_w ) |
| 523 | 523 | { |
| 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"); |
| 525 | 525 | /* If the floppy isn't emulated, ignore the write */ |
| 526 | 526 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 527 | 527 | return; |
| r4087 | r4088 | |
| 530 | 530 | |
| 531 | 531 | WRITE8_HANDLER( cgenie_sector_w ) |
| 532 | 532 | { |
| 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"); |
| 534 | 534 | /* If the floppy isn't emulated, ignore the write */ |
| 535 | 535 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 536 | 536 | return; |
| r4087 | r4088 | |
| 539 | 539 | |
| 540 | 540 | WRITE8_HANDLER( cgenie_data_w ) |
| 541 | 541 | { |
| 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"); |
| 543 | 543 | /* If the floppy isn't emulated, ignore the write */ |
| 544 | 544 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 545 | 545 | return; |
| r4087 | r4088 | |
| 592 | 592 | |
| 593 | 593 | WRITE8_HANDLER( cgenie_motor_w ) |
| 594 | 594 | { |
| 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"); |
| 596 | 596 | UINT8 drive = 255; |
| 597 | 597 | |
| 598 | 598 | logerror("cgenie motor_w $%02X\n", data); |
src/mess/machine/geneve.c
| r4087 | r4088 | |
| 290 | 290 | */ |
| 291 | 291 | static void inta_callback(running_machine *machine, int state) |
| 292 | 292 | { |
| 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); |
| 294 | 294 | cpu_set_input_line(machine->cpu[0], 1, state ? ASSERT_LINE : CLEAR_LINE); |
| 295 | 295 | } |
| 296 | 296 | |
| r4087 | r4088 | |
| 299 | 299 | */ |
| 300 | 300 | static void intb_callback(running_machine *machine, int state) |
| 301 | 301 | { |
| 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); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
| r4087 | r4088 | |
| 419 | 419 | case 0xf13d: |
| 420 | 420 | case 0xf13e: |
| 421 | 421 | 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); |
| 423 | 423 | |
| 424 | 424 | default: |
| 425 | 425 | logerror("unmapped read offs=%d\n", (int) offset); |
| r4087 | r4088 | |
| 465 | 465 | case 0x801d: |
| 466 | 466 | case 0x801e: |
| 467 | 467 | 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); |
| 469 | 469 | |
| 470 | 470 | default: |
| 471 | 471 | logerror("unmapped read offs=%d\n", (int) offset); |
| r4087 | r4088 | |
| 682 | 682 | case 0xf13d: |
| 683 | 683 | case 0xf13e: |
| 684 | 684 | 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); |
| 686 | 686 | return; |
| 687 | 687 | |
| 688 | 688 | default: |
| r4087 | r4088 | |
| 731 | 731 | case 0x801d: |
| 732 | 732 | case 0x801e: |
| 733 | 733 | 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); |
| 735 | 735 | return; |
| 736 | 736 | |
| 737 | 737 | default: |
| r4087 | r4088 | |
| 948 | 948 | KeyQueueLen--; |
| 949 | 949 | } |
| 950 | 950 | /* 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); |
| 952 | 952 | KeyInBuf = 0; |
| 953 | 953 | } |
| 954 | 954 | } |
| r4087 | r4088 | |
| 969 | 969 | buffer clear is disabled, and key queue is not empty. */ |
| 970 | 970 | if ((! KeyReset) && (mode_flags & mf_keyclock) && (mode_flags & mf_keyclear) && KeyQueueLen) |
| 971 | 971 | { |
| 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); |
| 973 | 973 | KeyInBuf = 1; |
| 974 | 974 | } |
| 975 | 975 | } |
| r4087 | r4088 | |
| 1281 | 1281 | */ |
| 1282 | 1282 | /*void tms9901_set_int2(int state) |
| 1283 | 1283 | { |
| 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); |
| 1285 | 1285 | }*/ |
| 1286 | 1286 | |
| 1287 | 1287 | /* |
src/mess/machine/beta.c
| r4087 | r4088 | |
| 70 | 70 | READ8_HANDLER(betadisk_status_r) |
| 71 | 71 | { |
| 72 | 72 | 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); |
| 74 | 74 | } else { |
| 75 | 75 | return 0xff; |
| 76 | 76 | } |
| r4087 | r4088 | |
| 79 | 79 | READ8_HANDLER(betadisk_track_r) |
| 80 | 80 | { |
| 81 | 81 | 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); |
| 83 | 83 | } else { |
| 84 | 84 | return 0xff; |
| 85 | 85 | } |
| r4087 | r4088 | |
| 88 | 88 | READ8_HANDLER(betadisk_sector_r) |
| 89 | 89 | { |
| 90 | 90 | 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); |
| 92 | 92 | } else { |
| 93 | 93 | return 0xff; |
| 94 | 94 | } |
| r4087 | r4088 | |
| 97 | 97 | READ8_HANDLER(betadisk_data_r) |
| 98 | 98 | { |
| 99 | 99 | 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); |
| 101 | 101 | } else { |
| 102 | 102 | return 0xff; |
| 103 | 103 | } |
| r4087 | r4088 | |
| 114 | 114 | |
| 115 | 115 | WRITE8_HANDLER(betadisk_param_w) |
| 116 | 116 | { |
| 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"); |
| 118 | 118 | if (betadisk_active==1) { |
| 119 | 119 | wd17xx_set_drive(fdc, data & 3); |
| 120 | 120 | wd17xx_set_side (fdc,(data & 0x10) ? 0 : 1 ); |
| r4087 | r4088 | |
| 130 | 130 | WRITE8_HANDLER(betadisk_command_w) |
| 131 | 131 | { |
| 132 | 132 | 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); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | WRITE8_HANDLER(betadisk_track_w) |
| 138 | 138 | { |
| 139 | 139 | 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); |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | WRITE8_HANDLER(betadisk_sector_w) |
| 145 | 145 | { |
| 146 | 146 | 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); |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | WRITE8_HANDLER(betadisk_data_w) |
| 152 | 152 | { |
| 153 | 153 | 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); |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
src/mess/machine/vc20.c
| r4087 | r4088 | |
| 96 | 96 | |
| 97 | 97 | if(via0_ca2) |
| 98 | 98 | { |
| 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); |
| 100 | 100 | timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 101 | 101 | } |
| 102 | 102 | else |
| 103 | 103 | { |
| 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); |
| 105 | 105 | timer_reset(datasette_timer, attotime_never); |
| 106 | 106 | } |
| 107 | 107 | } |
| r4087 | r4088 | |
| 121 | 121 | if (!serial_data || !cbm_serial_data_read (device->machine)) |
| 122 | 122 | value &= ~0x02; |
| 123 | 123 | |
| 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) |
| 125 | 125 | value &= ~0x40; |
| 126 | 126 | else |
| 127 | 127 | value |= 0x40; |
| r4087 | r4088 | |
| 185 | 185 | |
| 186 | 186 | static READ8_DEVICE_HANDLER( vc20_via1_read_ca1 ) |
| 187 | 187 | { |
| 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; |
| 189 | 189 | return data; |
| 190 | 190 | } |
| 191 | 191 | |
| r4087 | r4088 | |
| 324 | 324 | static WRITE8_DEVICE_HANDLER( vc20_via1_write_portb ) |
| 325 | 325 | { |
| 326 | 326 | /* 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)); |
| 328 | 328 | via1_portb = data; |
| 329 | 329 | } |
| 330 | 330 | |
| r4087 | r4088 | |
| 556 | 556 | |
| 557 | 557 | static TIMER_CALLBACK( vic20_tape_timer ) |
| 558 | 558 | { |
| 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; |
| 561 | 561 | via_ca1_w(via_1, 0, data); |
| 562 | 562 | } |
| 563 | 563 | |
| r4087 | r4088 | |
| 612 | 612 | |
| 613 | 613 | MACHINE_RESET( vic20 ) |
| 614 | 614 | { |
| 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"); |
| 616 | 616 | |
| 617 | 617 | if (has_vc1541) |
| 618 | 618 | { |
| r4087 | r4088 | |
| 663 | 663 | |
| 664 | 664 | INTERRUPT_GEN( vic20_frame_interrupt ) |
| 665 | 665 | { |
| 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"); |
| 667 | 667 | |
| 668 | 668 | via_ca1_w(via_0, 0, vc20_via0_read_ca1(via_0, 0)); |
| 669 | 669 | keyboard[0] = input_port_read(device->machine, "ROW0"); |
src/mess/machine/special.c
| r4087 | r4088 | |
| 70 | 70 | dat = (dat << 2) ^0xff; |
| 71 | 71 | if (input_port_read(device->machine, "LINE12")!=0xff) dat ^= 0x02; |
| 72 | 72 | |
| 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")); |
| 74 | 74 | if (level >= 0) { |
| 75 | 75 | dat ^= 0x01; |
| 76 | 76 | } |
| r4087 | r4088 | |
| 99 | 99 | { |
| 100 | 100 | specialist_8255_portc = data; |
| 101 | 101 | |
| 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); |
| 103 | 103 | |
| 104 | 104 | dac_data_w(0,data & 0x20); //beeper |
| 105 | 105 | |
| r4087 | r4088 | |
| 129 | 129 | |
| 130 | 130 | READ8_HANDLER( specialist_keyboard_r ) |
| 131 | 131 | { |
| 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)); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | WRITE8_HANDLER( specialist_keyboard_w ) |
| 136 | 136 | { |
| 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 ); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| r4087 | r4088 | |
| 246 | 246 | |
| 247 | 247 | MACHINE_START( specimx ) |
| 248 | 248 | { |
| 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"); |
| 250 | 250 | wd17xx_set_density (fdc,DEN_FM_HI); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | static 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"); |
| 255 | 255 | |
| 256 | 256 | pit8253_gate_w(pit8253, 0, 0); |
| 257 | 257 | pit8253_gate_w(pit8253, 1, 0); |
| r4087 | r4088 | |
| 272 | 272 | |
| 273 | 273 | WRITE8_HANDLER( specimx_disk_ctrl_w ) |
| 274 | 274 | { |
| 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"); |
| 276 | 276 | |
| 277 | 277 | switch(offset) { |
| 278 | 278 | case 2 : |
| r4087 | r4088 | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | WRITE8_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"); |
| 442 | 442 | |
| 443 | 443 | wd17xx_set_side (fdc,data & 1); |
| 444 | 444 | wd17xx_set_drive(fdc,(data >> 1) & 1); |
src/mess/machine/c64.c
| r4087 | r4088 | |
| 109 | 109 | static void c64_nmi(running_machine *machine) |
| 110 | 110 | { |
| 111 | 111 | 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"); |
| 113 | 113 | int cia1irq = cia_get_irq(cia_1); |
| 114 | 114 | |
| 115 | 115 | if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq) /* KEY_RESTORE */ |
| r4087 | r4088 | |
| 281 | 281 | static UINT8 c64_cia0_port_b_r (const device_config *device) |
| 282 | 282 | { |
| 283 | 283 | 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")); |
| 285 | 285 | |
| 286 | 286 | if (!(cia0porta & 0x80)) value &= c64_keyline[7]; |
| 287 | 287 | if (!(cia0porta & 0x40)) value &= c64_keyline[6]; |
| r4087 | r4088 | |
| 353 | 353 | |
| 354 | 354 | void c64_vic_interrupt (running_machine *machine, int level) |
| 355 | 355 | { |
| 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"); |
| 357 | 357 | #if 1 |
| 358 | 358 | if (level != vicirq) |
| 359 | 359 | { |
| r4087 | r4088 | |
| 468 | 468 | WRITE8_HANDLER( c64_write_io ) |
| 469 | 469 | { |
| 470 | 470 | 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"); |
| 473 | 473 | |
| 474 | 474 | c64_io_mirror[ offset ] = data; |
| 475 | 475 | if (offset < 0x400) { |
| r4087 | r4088 | |
| 514 | 514 | READ8_HANDLER( c64_read_io ) |
| 515 | 515 | { |
| 516 | 516 | 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"); |
| 519 | 519 | |
| 520 | 520 | if (offset < 0x400) |
| 521 | 521 | return vic2_port_r (space, offset & 0x3ff); |
| r4087 | r4088 | |
| 801 | 801 | { |
| 802 | 802 | if (direction & 0x08) |
| 803 | 803 | { |
| 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)); |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | if (direction & 0x20) |
| 808 | 808 | { |
| 809 | 809 | if(!(data & 0x20)) |
| 810 | 810 | { |
| 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); |
| 812 | 812 | timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 813 | 813 | } |
| 814 | 814 | else |
| 815 | 815 | { |
| 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); |
| 817 | 817 | timer_reset(datasette_timer, attotime_never); |
| 818 | 818 | } |
| 819 | 819 | } |
| r4087 | r4088 | |
| 838 | 838 | |
| 839 | 839 | if (c64_tape_on) |
| 840 | 840 | { |
| 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) |
| 842 | 842 | data &= ~0x10; |
| 843 | 843 | else |
| 844 | 844 | data |= 0x10; |
| r4087 | r4088 | |
| 861 | 861 | { |
| 862 | 862 | running_machine *machine = device->machine; |
| 863 | 863 | 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")); |
| 865 | 865 | int controller1 = input_port_read(machine, "CTRLSEL") & 0x07; |
| 866 | 866 | int controller2 = input_port_read(machine, "CTRLSEL") & 0x70; |
| 867 | 867 | |
| r4087 | r4088 | |
| 1007 | 1007 | |
| 1008 | 1008 | TIMER_CALLBACK( c64_tape_timer ) |
| 1009 | 1009 | { |
| 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"); |
| 1012 | 1012 | |
| 1013 | 1013 | if((last > +0.0) && (tmp < +0.0)) |
| 1014 | 1014 | cia_issue_index(cia_0); |
src/mess/machine/pc.c
| r4087 | r4088 | |
| 750 | 750 | |
| 751 | 751 | if ( ! ( pc_ppi.portb & 0x08 ) ) |
| 752 | 752 | { |
| 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") ); |
| 754 | 754 | |
| 755 | 755 | if ( tap_val < 0 ) |
| 756 | 756 | { |
| r4087 | r4088 | |
| 793 | 793 | pit8253_gate_w( pc_devices.pit8253, 2, data & 1); |
| 794 | 794 | pc_speaker_set_spkrdata( data & 0x02 ); |
| 795 | 795 | |
| 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); |
| 797 | 797 | |
| 798 | 798 | pc_ppi.clock_signal = ( pc_ppi.keyb_clock ) ? 1 : 0; |
| 799 | 799 | |
| r4087 | r4088 | |
| 1032 | 1032 | /* KB controller port B */ |
| 1033 | 1033 | pc_ppi.portb = data; |
| 1034 | 1034 | 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); |
| 1036 | 1036 | pc_speaker_set_spkrdata( data & 0x02 ); |
| 1037 | 1037 | |
| 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); |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | |
| r4087 | r4088 | |
| 1066 | 1066 | */ |
| 1067 | 1067 | static READ8_DEVICE_HANDLER ( pcjr_ppi_portc_r ) |
| 1068 | 1068 | { |
| 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 ); |
| 1070 | 1070 | int data=0xff; |
| 1071 | 1071 | |
| 1072 | 1072 | data&=~0x80; |
| r4087 | r4088 | |
| 1074 | 1074 | data = ( data & ~0x01 ) | ( pcjr_keyb.latch ? 0x01: 0x00 ); |
| 1075 | 1075 | if ( ! ( pc_ppi.portb & 0x08 ) ) |
| 1076 | 1076 | { |
| 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") ); |
| 1078 | 1078 | |
| 1079 | 1079 | if ( tap_val < 0 ) |
| 1080 | 1080 | { |
| r4087 | r4088 | |
| 1132 | 1132 | |
| 1133 | 1133 | static device_config * pc_get_device(running_machine *machine ) |
| 1134 | 1134 | { |
| 1135 | | return (device_config*)device_list_find_by_tag( machine->config->devicelist, NEC765A, "nec765"); |
| 1135 | return (device_config*)devtag_get_device(machine, NEC765A, "nec765"); |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | static const struct pc_fdc_interface fdc_interface_nc = |
| r4087 | r4088 | |
| 1379 | 1379 | { |
| 1380 | 1380 | cpu_set_irq_callback(machine->cpu[0], pc_irq_callback); |
| 1381 | 1381 | |
| 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") ); |
| 1387 | 1387 | pc_hdc_set_dma8237_device( pc_devices.dma8237 ); |
| 1388 | 1388 | speaker_level_w( 0, 0 ); |
| 1389 | 1389 | } |
src/mess/machine/ti99_4x.c
| r4087 | r4088 | |
| 747 | 747 | handset_buflen = 0; |
| 748 | 748 | handset_clock = 0; |
| 749 | 749 | 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); |
| 751 | 751 | |
| 752 | 752 | /* read config */ |
| 753 | 753 | if (ti99_model == model_99_8) |
| r4087 | r4088 | |
| 1715 | 1715 | handset_clock = ! handset_clock; |
| 1716 | 1716 | handset_buf >>= 4; |
| 1717 | 1717 | 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); |
| 1719 | 1719 | |
| 1720 | 1720 | if (handset_buflen == 1) |
| 1721 | 1721 | { |
| r4087 | r4088 | |
| 1763 | 1763 | handset_clock = 1; |
| 1764 | 1764 | handset_buf = ~ message; |
| 1765 | 1765 | 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); |
| 1767 | 1767 | } |
| 1768 | 1768 | |
| 1769 | 1769 | /* |
| r4087 | r4088 | |
| 2146 | 2146 | */ |
| 2147 | 2147 | static void tms9901_set_int1(running_machine *machine, int state) |
| 2148 | 2148 | { |
| 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); |
| 2150 | 2150 | } |
| 2151 | 2151 | |
| 2152 | 2152 | /* |
| r4087 | r4088 | |
| 2154 | 2154 | */ |
| 2155 | 2155 | void tms9901_set_int2(running_machine *machine, int state) |
| 2156 | 2156 | { |
| 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); |
| 2158 | 2158 | } |
| 2159 | 2159 | |
| 2160 | 2160 | /* |
| r4087 | r4088 | |
| 2238 | 2238 | } |
| 2239 | 2239 | |
| 2240 | 2240 | /* 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) |
| 2242 | 2242 | answer |= 8;*/ |
| 2243 | 2243 | |
| 2244 | 2244 | return answer; |
| r4087 | r4088 | |
| 2272 | 2272 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 2273 | 2273 | if ( ti99_model != model_99_8 ) |
| 2274 | 2274 | { |
| 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) |
| 2276 | 2276 | answer |= 8; |
| 2277 | 2277 | } |
| 2278 | 2278 | else |
| 2279 | 2279 | { |
| 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) |
| 2281 | 2281 | answer |= 8; |
| 2282 | 2282 | } |
| 2283 | 2283 | |
| r4087 | r4088 | |
| 2374 | 2374 | } |
| 2375 | 2375 | |
| 2376 | 2376 | /* 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) |
| 2378 | 2378 | answer |= 8;*/ |
| 2379 | 2379 | |
| 2380 | 2380 | return answer; |
| r4087 | r4088 | |
| 2413 | 2413 | |
| 2414 | 2414 | if ( ti99_model != model_99_8 ) |
| 2415 | 2415 | { |
| 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" ); |
| 2417 | 2417 | } |
| 2418 | 2418 | else |
| 2419 | 2419 | { |
| 2420 | | img = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ); |
| 2420 | img = devtag_get_device(device->machine, CASSETTE, "cassette"); |
| 2421 | 2421 | } |
| 2422 | 2422 | cassette_change_state(img, data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 2423 | 2423 | } |
| r4087 | r4088 | |
| 2443 | 2443 | { |
| 2444 | 2444 | if (ti99_model != model_99_8) /* 99/8 only has one tape port!!! */ |
| 2445 | 2445 | { |
| 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); |
| 2448 | 2448 | } |
| 2449 | 2449 | else |
| 2450 | 2450 | { |
| 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); |
| 2452 | 2452 | } |
| 2453 | 2453 | } |
| 2454 | 2454 | |
src/mess/machine/bbc.c
| r4087 | r4088 | |
| 580 | 580 | |
| 581 | 581 | if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ |
| 582 | 582 | { |
| 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"); |
| 585 | 585 | |
| 586 | 586 | myo=offset-0x200; |
| 587 | 587 | if ((myo>=0x00) && (myo<=0x07)) return BBC_6845_r(space, myo-0x00); /* Video Controller */ |
| 588 | 588 | if ((myo>=0x08) && (myo<=0x0f)) return BBC_6850_r(space, myo-0x08); /* Serial Controller */ |
| 589 | 589 | 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 */ |
| 591 | 591 | if ((myo>=0x20) && (myo<=0x23)) return 0xfe; /* VideoULA */ |
| 592 | 592 | if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd1770l_read(space, myo-0x24); /* 1770 */ |
| 593 | 593 | if ((myo>=0x28) && (myo<=0x2f)) return bbcm_wd1770_read(space, myo-0x28); /* disc control latch */ |
| r4087 | r4088 | |
| 611 | 611 | |
| 612 | 612 | if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ |
| 613 | 613 | { |
| 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"); |
| 616 | 616 | |
| 617 | 617 | myo=offset-0x200; |
| 618 | 618 | if ((myo>=0x00) && (myo<=0x07)) BBC_6845_w(space, myo-0x00,data); /* Video Controller */ |
| 619 | 619 | if ((myo>=0x08) && (myo<=0x0f)) BBC_6850_w(space, myo-0x08,data); /* Serial Controller */ |
| 620 | 620 | 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 */ |
| 622 | 622 | if ((myo>=0x20) && (myo<=0x23)) videoULA_w(space, myo-0x20,data); /* VideoULA */ |
| 623 | 623 | if ((myo>=0x24) && (myo<=0x27)) bbcm_wd1770l_write(space, myo-0x24,data); /* 1770 */ |
| 624 | 624 | if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(space, myo-0x28,data); /* disc control latch */ |
| r4087 | r4088 | |
| 765 | 765 | { |
| 766 | 766 | static const char *const colnames[] = { "COL0", "COL1", "COL2", "COL3", "COL4", |
| 767 | 767 | "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"); |
| 769 | 769 | |
| 770 | 770 | /* only do auto scan if keyboard is not enabled */ |
| 771 | 771 | if (b3_keyboard == 1) |
| r4087 | r4088 | |
| 801 | 801 | { |
| 802 | 802 | static const char *const colnames[] = { "COL0", "COL1", "COL2", "COL3", "COL4", |
| 803 | 803 | "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"); |
| 805 | 805 | |
| 806 | 806 | /* only do auto scan if keyboard is not enabled */ |
| 807 | 807 | if (b3_keyboard == 1) |
| r4087 | r4088 | |
| 839 | 839 | int res; |
| 840 | 840 | static const char *const colnames[] = { "COL0", "COL1", "COL2", "COL3", "COL4", |
| 841 | 841 | "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"); |
| 843 | 843 | |
| 844 | 844 | column = data & 0x0f; |
| 845 | 845 | row = (data>>4) & 0x07; |
| r4087 | r4088 | |
| 1159 | 1159 | /* joystick EOC */ |
| 1160 | 1160 | static READ8_DEVICE_HANDLER( bbcb_via_system_read_cb1 ) |
| 1161 | 1161 | { |
| 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); |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | |
| r4087 | r4088 | |
| 1269 | 1269 | |
| 1270 | 1270 | static WRITE8_DEVICE_HANDLER( bbcb_via_user_write_ca2 ) |
| 1271 | 1271 | { |
| 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"); |
| 1273 | 1273 | |
| 1274 | 1274 | /* write value to printer on rising edge of ca2 */ |
| 1275 | 1275 | if ((bbc_printer_ca2==0) && (data==1)) |
| r4087 | r4088 | |
| 1335 | 1335 | |
| 1336 | 1336 | UPD7002_EOC(BBC_uPD7002_EOC) |
| 1337 | 1337 | { |
| 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"); |
| 1339 | 1339 | via_cb1_w(via_0, 0,data); |
| 1340 | 1340 | } |
| 1341 | 1341 | |
| r4087 | r4088 | |
| 1352 | 1352 | |
| 1353 | 1353 | WRITE8_HANDLER ( BBC_6850_w ) |
| 1354 | 1354 | { |
| 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"); |
| 1356 | 1356 | |
| 1357 | 1357 | switch (offset&1) |
| 1358 | 1358 | { |
| r4087 | r4088 | |
| 1370 | 1370 | |
| 1371 | 1371 | READ8_HANDLER (BBC_6850_r) |
| 1372 | 1372 | { |
| 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"); |
| 1374 | 1374 | UINT8 retval=0; |
| 1375 | 1375 | |
| 1376 | 1376 | switch (offset&1) |
| r4087 | r4088 | |
| 1429 | 1429 | { |
| 1430 | 1430 | if (!mc6850_clock && new_clock) |
| 1431 | 1431 | { |
| 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"); |
| 1433 | 1433 | acia_tx_clock_in(acia); |
| 1434 | 1434 | } |
| 1435 | 1435 | mc6850_clock = new_clock; |
| r4087 | r4088 | |
| 1439 | 1439 | { |
| 1440 | 1440 | |
| 1441 | 1441 | 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")); |
| 1443 | 1443 | |
| 1444 | 1444 | // look for rising edges on the cassette wave |
| 1445 | 1445 | if (((dev_val>=0.0) && (last_dev_val<0.0)) || ((dev_val<0.0) && (last_dev_val>=0.0))) |
| r4087 | r4088 | |
| 1498 | 1498 | { |
| 1499 | 1499 | if (status) |
| 1500 | 1500 | { |
| 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); |
| 1502 | 1502 | timer_adjust_periodic(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 1503 | 1503 | } 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); |
| 1505 | 1505 | timer_reset(bbc_tape_timer, attotime_never); |
| 1506 | 1506 | len0=0; |
| 1507 | 1507 | len1=0; |
| r4087 | r4088 | |
| 1578 | 1578 | static READ8_HANDLER( bbc_i8271_read ) |
| 1579 | 1579 | { |
| 1580 | 1580 | 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"); |
| 1582 | 1582 | ret=0x0ff; |
| 1583 | 1583 | logerror("i8271 read %d ",offset); |
| 1584 | 1584 | switch (offset) |
| r4087 | r4088 | |
| 1604 | 1604 | |
| 1605 | 1605 | static WRITE8_HANDLER( bbc_i8271_write ) |
| 1606 | 1606 | { |
| 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"); |
| 1608 | 1608 | logerror("i8271 write %d %d\n",offset,data); |
| 1609 | 1609 | |
| 1610 | 1610 | switch (offset) |
| r4087 | r4088 | |
| 1742 | 1742 | |
| 1743 | 1743 | static WRITE8_HANDLER(bbc_wd177x_status_w) |
| 1744 | 1744 | { |
| 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"); |
| 1746 | 1746 | drive_control = data; |
| 1747 | 1747 | |
| 1748 | 1748 | /* set drive */ |
| r4087 | r4088 | |
| 1773 | 1773 | READ8_HANDLER ( bbc_wd1770_read ) |
| 1774 | 1774 | { |
| 1775 | 1775 | 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"); |
| 1777 | 1777 | switch (offset) |
| 1778 | 1778 | { |
| 1779 | 1779 | case 4: |
| r4087 | r4088 | |
| 1798 | 1798 | |
| 1799 | 1799 | WRITE8_HANDLER ( bbc_wd1770_write ) |
| 1800 | 1800 | { |
| 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"); |
| 1802 | 1802 | logerror("wd177x write: $%02X $%02X\n", offset,data); |
| 1803 | 1803 | switch (offset) |
| 1804 | 1804 | { |
| r4087 | r4088 | |
| 1862 | 1862 | |
| 1863 | 1863 | static WRITE8_HANDLER( bbc_opus_status_w ) |
| 1864 | 1864 | { |
| 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"); |
| 1866 | 1866 | drive_control = data; |
| 1867 | 1867 | |
| 1868 | 1868 | /* set drive */ |
| r4087 | r4088 | |
| 1890 | 1890 | |
| 1891 | 1891 | READ8_HANDLER( bbc_opus_read ) |
| 1892 | 1892 | { |
| 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"); |
| 1894 | 1894 | logerror("wd177x read: $%02X\n", offset); |
| 1895 | 1895 | |
| 1896 | 1896 | if (bbc_DFSType==6) |
| r4087 | r4088 | |
| 1922 | 1922 | |
| 1923 | 1923 | WRITE8_HANDLER (bbc_opus_write) |
| 1924 | 1924 | { |
| 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"); |
| 1926 | 1926 | logerror("wd177x write: $%02X $%02X\n", offset,data); |
| 1927 | 1927 | |
| 1928 | 1928 | if (bbc_DFSType==6) |
| r4087 | r4088 | |
| 1968 | 1968 | READ8_HANDLER ( bbcm_wd1770_read ) |
| 1969 | 1969 | { |
| 1970 | 1970 | 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"); |
| 1972 | 1972 | switch (offset) |
| 1973 | 1973 | { |
| 1974 | 1974 | case 0: |
| r4087 | r4088 | |
| 1992 | 1992 | |
| 1993 | 1993 | WRITE8_HANDLER ( bbcm_wd1770_write ) |
| 1994 | 1994 | { |
| 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"); |
| 1996 | 1996 | //logerror("wd177x write: $%02X $%02X\n", offset,data); |
| 1997 | 1997 | switch (offset) |
| 1998 | 1998 | { |
| r4087 | r4088 | |
| 2021 | 2021 | |
| 2022 | 2022 | WRITE8_HANDLER ( bbcm_wd1770l_write ) |
| 2023 | 2023 | { |
| 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"); |
| 2025 | 2025 | drive_control = data; |
| 2026 | 2026 | |
| 2027 | 2027 | /* set drive */ |
src/mess/machine/kc.c
| r4087 | r4088 | |
| 203 | 203 | |
| 204 | 204 | WRITE8_HANDLER(kc85_disc_hw_terminal_count_w) |
| 205 | 205 | { |
| 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"); |
| 207 | 207 | logerror("kc85 disc hw tc w: %02x\n",data); |
| 208 | 208 | nec765_set_tc_state(fdc, data & 0x01); |
| 209 | 209 | } |
| r4087 | r4088 | |
| 405 | 405 | bit = 0; |
| 406 | 406 | |
| 407 | 407 | /* 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) |
| 409 | 409 | bit = 1; |
| 410 | 410 | |
| 411 | 411 | /* update astb with bit */ |
| r4087 | r4088 | |
| 423 | 423 | if (((kc_cassette_motor_state^motor_state)&0x01)!=0) |
| 424 | 424 | { |
| 425 | 425 | /* 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"), |
| 427 | 427 | motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 428 | 428 | CASSETTE_MASK_MOTOR); |
| 429 | 429 | |
| r4087 | r4088 | |
| 1853 | 1853 | kc85_50hz_state = 0; |
| 1854 | 1854 | kc85_15khz_state = 0; |
| 1855 | 1855 | 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); |
| 1857 | 1857 | timer_set(machine, attotime_zero, NULL, 0, kc85_reset_timer_callback); |
| 1858 | 1858 | kc85_module_system_init(); |
| 1859 | 1859 | } |
| r4087 | r4088 | |
| 1869 | 1869 | kc85_pio_data[0] = 0x0f; |
| 1870 | 1870 | kc85_pio_data[1] = 0x0f1; |
| 1871 | 1871 | |
| 1872 | | kc85_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" ); |
| 1872 | kc85_z80pio = devtag_get_device(machine, Z80PIO, "z80pio"); |
| 1873 | 1873 | |
| 1874 | 1874 | kc85_4_update_0x04000(machine); |
| 1875 | 1875 | kc85_4_update_0x08000(machine); |
| r4087 | r4088 | |
| 1905 | 1905 | memory_set_bankptr(machine, 2,mess_ram+0x0c000); |
| 1906 | 1906 | memory_set_bankptr(machine, 7,mess_ram+0x0c000); |
| 1907 | 1907 | |
| 1908 | | kc85_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" ); |
| 1908 | kc85_z80pio = devtag_get_device(machine, Z80PIO, "z80pio"); |
| 1909 | 1909 | |
| 1910 | 1910 | kc85_3_update_0x08000(machine); |
| 1911 | 1911 | kc85_3_update_0x0c000(machine); |
src/mess/devices/coco_fdc.c
| r4087 | r4088 | |
| 241 | 241 | |
| 242 | 242 | static void fdc_coco_dskreg_w(running_machine *machine, coco_cartridge *cartridge, UINT8 data) |
| 243 | 243 | { |
| 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"); |
| 245 | 245 | fdc_info *info = fdc_get_info(cartridge); |
| 246 | 246 | UINT8 drive = 0; |
| 247 | 247 | UINT8 head = 0; |
| r4087 | r4088 | |
| 300 | 300 | |
| 301 | 301 | static UINT8 fdc_coco_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr) |
| 302 | 302 | { |
| 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"); |
| 304 | 304 | UINT8 result = 0; |
| 305 | 305 | switch(addr & 0xEF) |
| 306 | 306 | { |
| r4087 | r4088 | |
| 328 | 328 | |
| 329 | 329 | static void fdc_coco_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data) |
| 330 | 330 | { |
| 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"); |
| 332 | 332 | switch(addr & 0xEF) |
| 333 | 333 | { |
| 334 | 334 | case 0: case 1: case 2: case 3: |
| r4087 | r4088 | |
| 415 | 415 | case 0x10: /* FF50 */ |
| 416 | 416 | if (real_time_clock(machine) == RTC_DISTO) |
| 417 | 417 | { |
| 418 | | dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto"); |
| 418 | dev = devtag_get_device(machine, MSM6242, "disto"); |
| 419 | 419 | result = msm6242_r(dev, msm6242_rtc_address); |
| 420 | 420 | } |
| 421 | 421 | break; |
| r4087 | r4088 | |
| 423 | 423 | case 0x38: /* FF78 */ |
| 424 | 424 | if (real_time_clock(machine) == RTC_CLOUD9) |
| 425 | 425 | { |
| 426 | | dev = device_list_find_by_tag(machine->config->devicelist, DS1315, "cloud9"); |
| 426 | dev = devtag_get_device(machine, DS1315, "cloud9"); |
| 427 | 427 | ds1315_r_0(dev, addr); |
| 428 | 428 | } |
| 429 | 429 | break; |
| r4087 | r4088 | |
| 431 | 431 | case 0x39: /* FF79 */ |
| 432 | 432 | if (real_time_clock(machine) == RTC_CLOUD9) |
| 433 | 433 | { |
| 434 | | dev = device_list_find_by_tag(machine->config->devicelist, DS1315, "cloud9"); |
| 434 | dev = devtag_get_device(machine, DS1315, "cloud9"); |
| 435 | 435 | ds1315_r_1(dev, addr); |
| 436 | 436 | } |
| 437 | 437 | break; |
| r4087 | r4088 | |
| 439 | 439 | case 0x3C: /* FF7C */ |
| 440 | 440 | if (real_time_clock(machine) == RTC_CLOUD9) |
| 441 | 441 | { |
| 442 | | dev = device_list_find_by_tag(machine->config->devicelist, DS1315, "cloud9"); |
| 442 | dev = devtag_get_device(machine, DS1315, "cloud9"); |
| 443 | 443 | result = ds1315_r_data(dev, addr); |
| 444 | 444 | } |
| 445 | 445 | break; |
| r4087 | r4088 | |
| 450 | 450 | case 0x43: |
| 451 | 451 | case 0x44: |
| 452 | 452 | 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"); |
| 454 | 454 | if (dev != NULL) |
| 455 | 455 | result = coco_vhd_io_r((device_config *) dev, addr); |
| 456 | 456 | break; |
| r4087 | r4088 | |
| 475 | 475 | case 0x10: /* FF50 */ |
| 476 | 476 | if (real_time_clock(machine) == RTC_DISTO) |
| 477 | 477 | { |
| 478 | | dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto"); |
| 478 | dev = devtag_get_device(machine, MSM6242, "disto"); |
| 479 | 479 | msm6242_w(dev, msm6242_rtc_address, data); |
| 480 | 480 | } |
| 481 | 481 | break; |
| r4087 | r4088 | |
| 491 | 491 | case 0x43: |
| 492 | 492 | case 0x44: |
| 493 | 493 | 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"); |
| 495 | 495 | if (dev != NULL) |
| 496 | 496 | coco_vhd_io_w((device_config *) dev, addr, data); |
| 497 | 497 | break; |
| r4087 | r4088 | |
| 571 | 571 | |
| 572 | 572 | static void fdc_dragon_dskreg_w(running_machine *machine,coco_cartridge *cartridge, UINT8 data) |
| 573 | 573 | { |
| 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"); |
| 575 | 575 | fdc_info *info = fdc_get_info(cartridge); |
| 576 | 576 | |
| 577 | 577 | if (LOG_FDC) |
| r4087 | r4088 | |
| 603 | 603 | |
| 604 | 604 | static UINT8 fdc_dragon_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr) |
| 605 | 605 | { |
| 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"); |
| 607 | 607 | UINT8 result = 0; |
| 608 | 608 | switch(addr & 0xEF) |
| 609 | 609 | { |
| r4087 | r4088 | |
| 631 | 631 | |
| 632 | 632 | static void fdc_dragon_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data) |
| 633 | 633 | { |
| 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"); |
| 635 | 635 | switch(addr & 0xEF) |
| 636 | 636 | { |
| 637 | 637 | case 0: |
src/mess/drivers/sord.c
| r4087 | r4088 | |
| 91 | 91 | |
| 92 | 92 | LOG(("fd5 0x010 r: %02x %04x\n",fd5_databus,cpu_get_pc(space->cpu))); |
| 93 | 93 | |
| 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); |
| 97 | 97 | |
| 98 | 98 | return fd5_databus; |
| 99 | 99 | } |
| r4087 | r4088 | |
| 105 | 105 | fd5_databus = data; |
| 106 | 106 | |
| 107 | 107 | /* 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); |
| 111 | 111 | |
| 112 | 112 | cpu_yield(space->cpu); |
| 113 | 113 | } |
| r4087 | r4088 | |
| 131 | 131 | |
| 132 | 132 | static WRITE8_HANDLER(fd5_tc_w) |
| 133 | 133 | { |
| 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"); |
| 135 | 135 | nec765_set_tc_state(fdc, 1); |
| 136 | 136 | nec765_set_tc_state(fdc, 0); |
| 137 | 137 | } |
| r4087 | r4088 | |
| 177 | 177 | floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40); |
| 178 | 178 | floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40); |
| 179 | 179 | 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); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | static const device_config *cassette_device_image(running_machine *machine) |
| 185 | 185 | { |
| 186 | | return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ); |
| 186 | return devtag_get_device(machine, CASSETTE, "cassette"); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /*********************************************************************************************/ |
| r4087 | r4088 | |
| 441 | 441 | { |
| 442 | 442 | if (state) |
| 443 | 443 | { |
| 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); |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | |
src/mess/drivers/tm990189.c
| r4087 | r4088 | |
| 283 | 283 | { |
| 284 | 284 | (void)ic; |
| 285 | 285 | |
| 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); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | static READ8_DEVICE_HANDLER( sys9901_r0 ) |
| r4087 | r4088 | |
| 296 | 296 | reply |= input_port_read(device->machine, keynames[digitsel]) << 1; |
| 297 | 297 | |
| 298 | 298 | /* 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) |
| 300 | 300 | reply |= 0x40; |
| 301 | 301 | |
| 302 | 302 | return reply; |
| r4087 | r4088 | |
| 346 | 346 | |
| 347 | 347 | static WRITE8_DEVICE_HANDLER( sys9901_tapewdata_w ) |
| 348 | 348 | { |
| 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); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /* |
| r4087 | r4088 | |
| 360 | 360 | if (/*rs232_rts &&*/ /*(mame_ftell(rs232_fp) < mame_fsize(rs232_fp))*/1) |
| 361 | 361 | { |
| 362 | 362 | 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); |
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
| r4087 | r4088 | |
| 376 | 376 | |
| 377 | 377 | rs232_fp = image; |
| 378 | 378 | |
| 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); |
| 380 | 380 | rs232_input_timer = timer_alloc(image->machine, rs232_input_callback, NULL); |
| 381 | 381 | timer_adjust_periodic(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10)); |
| 382 | 382 | |
| r4087 | r4088 | |
| 395 | 395 | |
| 396 | 396 | rs232_fp = NULL; |
| 397 | 397 | |
| 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); |
| 399 | 399 | |
| 400 | 400 | timer_reset(rs232_input_timer, attotime_never); /* FIXME - timers should only be allocated once */ |
| 401 | 401 | } |
| r4087 | r4088 | |
| 436 | 436 | case 5: /* CKON: set DECKCONTROL */ |
| 437 | 437 | LED_state |= 0x20; |
| 438 | 438 | { |
| 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"); |
| 440 | 440 | cassette_change_state(img, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 441 | 441 | } |
| 442 | 442 | break; |
| r4087 | r4088 | |
| 444 | 444 | case 6: /* CKOF: clear DECKCONTROL */ |
| 445 | 445 | LED_state &= ~0x20; |
| 446 | 446 | { |
| 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"); |
| 448 | 448 | cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 449 | 449 | } |
| 450 | 450 | break; |
src/mess/drivers/x68k.c
| r4087 | r4088 | |
| 347 | 347 | // 4 channel DMA controller (Hitachi HD63450) |
| 348 | 348 | static WRITE16_HANDLER( x68k_dmac_w ) |
| 349 | 349 | { |
| 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"); |
| 351 | 351 | hd63450_w(device, offset, data, mem_mask); |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | static READ16_HANDLER( x68k_dmac_r ) |
| 355 | 355 | { |
| 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"); |
| 357 | 357 | return hd63450_r(device, offset, mem_mask); |
| 358 | 358 | } |
| 359 | 359 | |
| r4087 | r4088 | |
| 557 | 557 | sys.mouse.inputtype++; |
| 558 | 558 | if(sys.mouse.inputtype > 2) |
| 559 | 559 | { |
| 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"); |
| 561 | 561 | int val = scc_get_reg_b(scc, 0); |
| 562 | 562 | sys.mouse.inputtype = 0; |
| 563 | 563 | sys.mouse.bufferempty = 1; |
| r4087 | r4088 | |
| 577 | 577 | */ |
| 578 | 578 | static READ16_HANDLER( x68k_scc_r ) |
| 579 | 579 | { |
| 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"); |
| 581 | 581 | offset %= 4; |
| 582 | 582 | switch(offset) |
| 583 | 583 | { |
| r4087 | r4088 | |
| 596 | 596 | |
| 597 | 597 | static WRITE16_HANDLER( x68k_scc_w ) |
| 598 | 598 | { |
| 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"); |
| 600 | 600 | static unsigned char prev; |
| 601 | 601 | offset %= 4; |
| 602 | 602 | |
| r4087 | r4088 | |
| 630 | 630 | |
| 631 | 631 | static TIMER_CALLBACK(x68k_scc_ack) |
| 632 | 632 | { |
| 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"); |
| 634 | 634 | if(sys.mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty |
| 635 | 635 | return; |
| 636 | 636 | |
| r4087 | r4088 | |
| 655 | 655 | |
| 656 | 656 | static void x68k_set_adpcm(running_machine* machine) |
| 657 | 657 | { |
| 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"); |
| 659 | 659 | UINT32 rate = 0; |
| 660 | 660 | |
| 661 | 661 | switch(sys.adpcm.rate & 0x0c) |
| r4087 | r4088 | |
| 731 | 731 | // NEC uPD72065 at 0xe94000 |
| 732 | 732 | static WRITE16_HANDLER( x68k_fdc_w ) |
| 733 | 733 | { |
| 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"); |
| 735 | 735 | unsigned int drive, x; |
| 736 | 736 | switch(offset) |
| 737 | 737 | { |
| r4087 | r4088 | |
| 806 | 806 | { |
| 807 | 807 | unsigned int ret; |
| 808 | 808 | 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"); |
| 810 | 810 | |
| 811 | 811 | switch(offset) |
| 812 | 812 | { |
| r4087 | r4088 | |
| 855 | 855 | static int x68k_fdc_read_byte(running_machine *machine,int addr) |
| 856 | 856 | { |
| 857 | 857 | 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"); |
| 859 | 859 | |
| 860 | 860 | if(sys.fdc.drq_state != 0) |
| 861 | 861 | data = nec765_dack_r(fdc, 0); |
| r4087 | r4088 | |
| 865 | 865 | |
| 866 | 866 | static void x68k_fdc_write_byte(running_machine *machine,int addr, int data) |
| 867 | 867 | { |
| 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"); |
| 869 | 869 | nec765_dack_w(fdc, 0, data); |
| 870 | 870 | } |
| 871 | 871 | |
| r4087 | r4088 | |
| 899 | 899 | |
| 900 | 900 | static WRITE8_HANDLER( x68k_ct_w ) |
| 901 | 901 | { |
| 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"); |
| 903 | 903 | // CT1 and CT2 bits from YM2151 port 0x1b |
| 904 | 904 | // CT1 - ADPCM clock - 0 = 8MHz, 1 = 4MHz |
| 905 | 905 | // CT2 - 1 = Set ready state of FDC |
| r4087 | r4088 | |
| 1034 | 1034 | |
| 1035 | 1035 | /*static READ16_HANDLER( x68k_mfp_r ) |
| 1036 | 1036 | { |
| 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); |
| 1038 | 1038 | |
| 1039 | 1039 | return mc68901_register_r(x68k_mfp, offset); |
| 1040 | 1040 | }*/ |
| 1041 | 1041 | |
| 1042 | 1042 | READ16_HANDLER( x68k_mfp_r ) |
| 1043 | 1043 | { |
| 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); |
| 1045 | 1045 | // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full, |
| 1046 | 1046 | // MFP Timer C, and the power switch |
| 1047 | 1047 | // logerror("MFP: [%08x] Reading offset %i\n",cpu_get_pc(space->cpu),offset); |
| r4087 | r4088 | |
| 1103 | 1103 | |
| 1104 | 1104 | static WRITE16_HANDLER( x68k_mfp_w ) |
| 1105 | 1105 | { |
| 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); |
| 1107 | 1107 | |
| 1108 | 1108 | /* For the Interrupt registers, the bits are set out as such: |
| 1109 | 1109 | Reg A - bit 7: GPIP7 (HSync) |
| r4087 | r4088 | |
| 1481 | 1481 | |
| 1482 | 1482 | static void x68k_dma_irq(running_machine *machine, int channel) |
| 1483 | 1483 | { |
| 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"); |
| 1485 | 1485 | current_vector[3] = hd63450_get_vector(device, channel); |
| 1486 | 1486 | current_irq_line = 3; |
| 1487 | 1487 | logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,current_vector[3]); |
| r4087 | r4088 | |
| 1498 | 1498 | |
| 1499 | 1499 | static void x68k_dma_error(running_machine *machine, int channel, int irq) |
| 1500 | 1500 | { |
| 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"); |
| 1502 | 1502 | if(irq != 0) |
| 1503 | 1503 | { |
| 1504 | 1504 | current_vector[3] = hd63450_get_error_vector(device,channel); |
| r4087 | r4088 | |
| 1562 | 1562 | |
| 1563 | 1563 | static IRQ_CALLBACK(x68k_int_ack) |
| 1564 | 1564 | { |
| 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); |
| 1566 | 1566 | |
| 1567 | 1567 | if(irqline == 6) // MFP |
| 1568 | 1568 | { |
src/mess/drivers/ip22.c
| r4087 | r4088 | |
| 232 | 232 | // mame_printf_info("INT3: r @ %x mask %08x (PC=%x)\n", offset*4, mem_mask, activecpu_get_pc()); |
| 233 | 233 | return int3_regs[offset-0x80/4]; |
| 234 | 234 | 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); |
| 236 | 236 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 237 | 237 | return ret8; |
| 238 | 238 | 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); |
| 240 | 240 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 241 | 241 | return ret8; |
| 242 | 242 | 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); |
| 244 | 244 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 245 | 245 | return ret8; |
| 246 | 246 | 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); |
| 248 | 248 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 249 | 249 | return ret8; |
| 250 | 250 | default: |
| r4087 | r4088 | |
| 337 | 337 | break; |
| 338 | 338 | case 0xb0/4: |
| 339 | 339 | 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); |
| 341 | 341 | return; |
| 342 | 342 | case 0xb4/4: |
| 343 | 343 | 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); |
| 345 | 345 | return; |
| 346 | 346 | case 0xb8/4: |
| 347 | 347 | 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); |
| 349 | 349 | return; |
| 350 | 350 | case 0xbc/4: |
| 351 | 351 | 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); |
| 353 | 353 | return; |
| 354 | 354 | default: |
| 355 | 355 | verboselog( machine, 0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask ); |
| r4087 | r4088 | |
| 1363 | 1363 | } |
| 1364 | 1364 | |
| 1365 | 1365 | static 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 ); |
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | static MACHINE_START( ip22 ) |
src/mess/drivers/exidy.c
| r4087 | r4088 | |
| 201 | 201 | static const device_config *cassette_device_image(running_machine *machine) |
| 202 | 202 | { |
| 203 | 203 | if (exidy_fe & 0x20) |
| 204 | | return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette2" ); |
| 204 | return devtag_get_device(machine, CASSETTE, "cassette2"); |
| 205 | 205 | else |
| 206 | | return device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette1" ); |
| 206 | return devtag_get_device(machine, CASSETTE, "cassette1"); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | |
| r4087 | r4088 | |
| 354 | 354 | cass_data.input.length = 0; |
| 355 | 355 | cass_data.input.bit = 1; |
| 356 | 356 | |
| 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"); |
| 358 | 358 | |
| 359 | 359 | centronics_config(machine, 0, exidy_cent_config); |
| 360 | 360 | /* assumption: select is tied low */ |
| r4087 | r4088 | |
| 374 | 374 | |
| 375 | 375 | static READ8_HANDLER ( exidy_wd179x_r ) |
| 376 | 376 | { |
| 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"); |
| 378 | 378 | switch (offset & 0x03) |
| 379 | 379 | { |
| 380 | 380 | case 0: |
| r4087 | r4088 | |
| 392 | 392 | |
| 393 | 393 | static WRITE8_HANDLER ( exidy_wd179x_w ) |
| 394 | 394 | { |
| 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"); |
| 396 | 396 | switch (offset & 0x03) |
| 397 | 397 | { |
| 398 | 398 | case 0: |
| r4087 | r4088 | |
| 451 | 451 | { |
| 452 | 452 | if (data & 0x20) |
| 453 | 453 | { |
| 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); |
| 456 | 456 | } |
| 457 | 457 | else |
| 458 | 458 | { |
| 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); |
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | else |
| 464 | 464 | { |
| 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); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /* 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"), |
| 471 | 471 | (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 472 | 472 | |
| 473 | 473 | /* 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"), |
| 475 | 475 | (data & 0x20) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 476 | 476 | |
| 477 | 477 | if ((data & EXIDY_CASSETTE_MOTOR_MASK) && (~data & 0x80)) |
| r4087 | r4088 | |
| 574 | 574 | |
| 575 | 575 | static const device_config *printer_device(running_machine *machine) |
| 576 | 576 | { |
| 577 | | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer"); |
| 577 | return devtag_get_device(machine, PRINTER, "printer"); |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | static READ8_HANDLER(exidy_ff_port_r) |
src/mess/drivers/apf.c
| r4087 | r4088 | |
| 208 | 208 | |
| 209 | 209 | data = 0x000; |
| 210 | 210 | |
| 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) |
| 212 | 212 | data =(1<<7); |
| 213 | 213 | |
| 214 | 214 | return data; |
| r4087 | r4088 | |
| 255 | 255 | keyboard_data = input_port_read(space->machine, keynames[keyboard_line]); |
| 256 | 256 | |
| 257 | 257 | /* 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"), |
| 259 | 259 | (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 260 | 260 | CASSETTE_MASK_MOTOR); |
| 261 | 261 | |
| 262 | 262 | /* 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"), |
| 264 | 264 | (data & 0x40) ? -1.0 : 1.0); |
| 265 | 265 | } |
| 266 | 266 | |
| r4087 | r4088 | |
| 340 | 340 | static WRITE8_HANDLER(apf_dischw_w) |
| 341 | 341 | { |
| 342 | 342 | 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"); |
| 344 | 344 | |
| 345 | 345 | /* bit 3 is index of drive to select */ |
| 346 | 346 | drive = (data>>3) & 0x01; |
| r4087 | r4088 | |
| 363 | 363 | |
| 364 | 364 | static WRITE8_HANDLER(apf_wd179x_command_w) |
| 365 | 365 | { |
| 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); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | static WRITE8_HANDLER(apf_wd179x_track_w) |
| 370 | 370 | { |
| 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); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | static WRITE8_HANDLER(apf_wd179x_sector_w) |
| 375 | 375 | { |
| 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); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | static WRITE8_HANDLER(apf_wd179x_data_w) |
| 380 | 380 | { |
| 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); |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | static READ8_HANDLER(apf_wd179x_status_r) |
| 385 | 385 | { |
| 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); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | static READ8_HANDLER(apf_wd179x_track_r) |
| 390 | 390 | { |
| 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); |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | static READ8_HANDLER(apf_wd179x_sector_r) |
| 395 | 395 | { |
| 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); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | static READ8_HANDLER(apf_wd179x_data_r) |
| 400 | 400 | { |
| 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); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | static ADDRESS_MAP_START(apf_imagination_map, ADDRESS_SPACE_PROGRAM, 8) |
src/mess/drivers/einstein.c
| r4087 | r4088 | |
| 419 | 419 | |
| 420 | 420 | static WRITE8_DEVICE_HANDLER(einstein_serial_transmit_clock) |
| 421 | 421 | { |
| 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"); |
| 423 | 423 | msm8251_transmit_clock(uart); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | static WRITE8_DEVICE_HANDLER(einstein_serial_receive_clock) |
| 427 | 427 | { |
| 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"); |
| 429 | 429 | msm8251_receive_clock(uart); |
| 430 | 430 | } |
| 431 | 431 | |
| r4087 | r4088 | |
| 593 | 593 | static WRITE8_HANDLER(einstein_fdc_w) |
| 594 | 594 | { |
| 595 | 595 | 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"); |
| 597 | 597 | |
| 598 | 598 | logerror("fdc w: PC: %04x %04x %02x\n",cpu_get_pc(space->machine->cpu[0]),offset,data); |
| 599 | 599 | |
| r4087 | r4088 | |
| 629 | 629 | static READ8_HANDLER(einstein_fdc_r) |
| 630 | 630 | { |
| 631 | 631 | 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"); |
| 633 | 633 | |
| 634 | 634 | logerror("fdc r: PC: %04x %04x\n",cpu_get_pc(space->machine->cpu[0]),offset); |
| 635 | 635 | |
| r4087 | r4088 | |
| 693 | 693 | |
| 694 | 694 | static WRITE8_HANDLER(einstein_serial_w) |
| 695 | 695 | { |
| 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"); |
| 697 | 697 | int reg = offset & 0x01; |
| 698 | 698 | |
| 699 | 699 | /* logerror("serial w: %04x %02x\n",offset,data); */ |
| r4087 | r4088 | |
| 710 | 710 | |
| 711 | 711 | static READ8_HANDLER(einstein_serial_r) |
| 712 | 712 | { |
| 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"); |
| 714 | 714 | int reg = offset & 0x01; |
| 715 | 715 | |
| 716 | 716 | /* logerror("serial r: %04x\n",offset); */ |
| r4087 | r4088 | |
| 820 | 820 | |
| 821 | 821 | static WRITE8_HANDLER(einstein_drive_w) |
| 822 | 822 | { |
| 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"); |
| 824 | 824 | |
| 825 | 825 | /* bit 4: side select */ |
| 826 | 826 | /* bit 3: select drive 3 */ |
| r4087 | r4088 | |
| 1025 | 1025 | case 0x2d: |
| 1026 | 1026 | case 0x2e: |
| 1027 | 1027 | 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); |
| 1029 | 1029 | case 0x30: |
| 1030 | 1030 | case 0x31: |
| 1031 | 1031 | case 0x32: |
| r4087 | r4088 | |
| 1129 | 1129 | case 0x2d: |
| 1130 | 1130 | case 0x2e: |
| 1131 | 1131 | 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); |
| 1133 | 1133 | return; |
| 1134 | 1134 | case 0x30: |
| 1135 | 1135 | case 0x31: |
| r4087 | r4088 | |
| 1218 | 1218 | case 0x2d: |
| 1219 | 1219 | case 0x2e: |
| 1220 | 1220 | 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); |
| 1222 | 1222 | case 0x30: |
| 1223 | 1223 | case 0x31: |
| 1224 | 1224 | case 0x32: |
| r4087 | r4088 | |
| 1305 | 1305 | case 0x2d: |
| 1306 | 1306 | case 0x2e: |
| 1307 | 1307 | 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); |
| 1309 | 1309 | return; |
| 1310 | 1310 | case 0x30: |
| 1311 | 1311 | case 0x31: |
| r4087 | r4088 | |
| 1426 | 1426 | { |
| 1427 | 1427 | TMS9928A_configure(&tms9928a_interface); |
| 1428 | 1428 | |
| 1429 | | einstein_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" ); |
| 1429 | einstein_z80pio = devtag_get_device(machine, Z80PIO, "z80pio"); |
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | 1432 | static MACHINE_RESET( einstein ) |
| r4087 | r4088 | |
| 1457 | 1457 | |
| 1458 | 1458 | /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */ |
| 1459 | 1459 | 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); |
| 1461 | 1461 | |
| 1462 | 1462 | centronics_config(machine, 0, einstein_cent_config); |
| 1463 | 1463 | /* assumption: select is tied low */ |
src/mess/drivers/amstrad.c
| r4087 | r4088 | |
| 211 | 211 | |
| 212 | 212 | static const device_config *printer_device(running_machine *machine) |
| 213 | 213 | { |
| 214 | | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer"); |
| 214 | return devtag_get_device(machine, PRINTER, "printer"); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
| r4087 | r4088 | |
| 330 | 330 | /* Set b7 with cassette tape input */ |
| 331 | 331 | if(amstrad_system_type != SYSTEM_GX4000) |
| 332 | 332 | { |
| 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) { |
| 334 | 334 | data |= (1<<7); |
| 335 | 335 | } |
| 336 | 336 | } |
| r4087 | r4088 | |
| 396 | 396 | if(amstrad_system_type != SYSTEM_GX4000) |
| 397 | 397 | { |
| 398 | 398 | 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"), |
| 400 | 400 | ((data & 0x20) ? -1.0 : +1.0)); |
| 401 | 401 | } |
| 402 | 402 | } |
| r4087 | r4088 | |
| 405 | 405 | if(amstrad_system_type != SYSTEM_GX4000) |
| 406 | 406 | { |
| 407 | 407 | 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"), |
| 409 | 409 | ((data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED), |
| 410 | 410 | CASSETTE_MASK_MOTOR); |
| 411 | 411 | } |
| r4087 | r4088 | |
| 1246 | 1246 | |
| 1247 | 1247 | static READ8_HANDLER ( AmstradCPC_ReadPortHandler ) |
| 1248 | 1248 | { |
| 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"); |
| 1250 | 1250 | unsigned char data = 0xFF; |
| 1251 | 1251 | unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8); |
| 1252 | 1252 | m6845_personality_t crtc_type; |
| r4087 | r4088 | |
| 1302 | 1302 | if ((offset & (1<<11)) == 0) |
| 1303 | 1303 | { |
| 1304 | 1304 | 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); |
| 1306 | 1306 | } |
| 1307 | 1307 | /* if b10 = 0 : Expansion Peripherals Read selected |
| 1308 | 1308 | |
| r4087 | r4088 | |
| 1346 | 1346 | /* Offset handler for write */ |
| 1347 | 1347 | static WRITE8_HANDLER ( AmstradCPC_WritePortHandler ) |
| 1348 | 1348 | { |
| 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"); |
| 1350 | 1350 | if ((offset & (1<<15)) == 0) |
| 1351 | 1351 | { |
| 1352 | 1352 | if(aleste_mode & 0x04) // Aleste mode |
| r4087 | r4088 | |
| 1424 | 1424 | */ |
| 1425 | 1425 | if ((offset & (1<<11)) == 0) { |
| 1426 | 1426 | 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); |
| 1428 | 1428 | } |
| 1429 | 1429 | /* if b10 = 0 : Expansion Peripherals Write selected */ |
| 1430 | 1430 | if ((offset & (1<<10)) == 0) { |
src/mess/drivers/ip20.c
| r4087 | r4088 | |
| 171 | 171 | case 0x0d04: |
| 172 | 172 | verboselog(machine, 2, "HPC DUART0 Channel B Data Read\n" ); |
| 173 | 173 | // return 0; |
| 174 | | scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc"); |
| 174 | scc = devtag_get_device(space->machine, SCC8530, "scc"); |
| 175 | 175 | return scc_r(scc, 2); |
| 176 | 176 | case 0x0d08: |
| 177 | 177 | verboselog(machine, 2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask ); |
| r4087 | r4088 | |
| 180 | 180 | case 0x0d0c: |
| 181 | 181 | verboselog(machine, 2, "HPC DUART0 Channel A Data Read\n" ); |
| 182 | 182 | // return 0; |
| 183 | | scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc"); |
| 183 | scc = devtag_get_device(space->machine, SCC8530, "scc"); |
| 184 | 184 | return scc_r(scc, 3); |
| 185 | 185 | case 0x0d10: |
| 186 | 186 | // verboselog(machine, 2, "HPC DUART1 Channel B Control Read\n" ); |
| r4087 | r4088 | |
| 362 | 362 | break; |
| 363 | 363 | case 0x0d00: |
| 364 | 364 | 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"); |
| 366 | 366 | scc_w(scc, 0, data); |
| 367 | 367 | break; |
| 368 | 368 | case 0x0d04: |
| 369 | 369 | 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"); |
| 371 | 371 | scc_w(scc, 2, data); |
| 372 | 372 | break; |
| 373 | 373 | case 0x0d08: |
| 374 | 374 | 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"); |
| 376 | 376 | scc_w(scc, 1, data); |
| 377 | 377 | break; |
| 378 | 378 | case 0x0d0c: |
| 379 | 379 | 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"); |
| 381 | 381 | scc_w(scc, 3, data); |
| 382 | 382 | break; |
| 383 | 383 | case 0x0d10: |