src/mess/audio/ted7360.c
| r3156 | r3157 | |
| 11 | 11 | #include "streams.h" |
| 12 | 12 | #include "deprecat.h" |
| 13 | 13 | |
| 14 | | #define VERBOSE_DBG 1 |
| 15 | | #include "includes/cbm.h" |
| 16 | 14 | #include "includes/c16.h" |
| 17 | 15 | #include "video/ted7360.h" |
| 18 | 16 | |
| r3156 | r3157 | |
| 58 | 56 | else |
| 59 | 57 | ted7360[offset] = data; |
| 60 | 58 | tone1samples = machine->sample_rate / TONE_FREQUENCY (TONE1_VALUE); |
| 61 | | DBG_LOG (1, "ted7360", ("tone1 %d %d sample:%d\n", |
| 62 | | TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), tone1samples)); |
| 59 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 60 | mame_printf_debug("tone1 %d %d sample:%d\n", TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), tone1samples); |
| 63 | 61 | |
| 64 | 62 | break; |
| 65 | 63 | case 0xf: |
| 66 | 64 | case 0x10: |
| 67 | 65 | ted7360[offset] = data; |
| 68 | 66 | tone2samples = machine->sample_rate / TONE_FREQUENCY (TONE2_VALUE); |
| 69 | | DBG_LOG (1, "ted7360", ("tone2 %d %d sample:%d\n", |
| 70 | | TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), tone2samples)); |
| 67 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 68 | mame_printf_debug("tone2 %d %d sample:%d\n", TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), tone2samples); |
| 71 | 69 | |
| 72 | 70 | noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * machine->sample_rate |
| 73 | 71 | * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY); |
| 74 | | DBG_LOG (1, "ted7360", ("noise %d sample:%d\n", |
| 75 | | NOISE_FREQUENCY, noisesamples)); |
| 72 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 73 | mame_printf_debug("noise %d sample:%d\n", NOISE_FREQUENCY, noisesamples); |
| 76 | 74 | if (!NOISE_ON || ((double) noisepos / noisesamples >= 1.0)) |
| 77 | 75 | { |
| 78 | 76 | noisepos = 0; |
| r3156 | r3157 | |
| 80 | 78 | break; |
| 81 | 79 | case 0x11: |
| 82 | 80 | ted7360[offset] = data; |
| 83 | | DBG_LOG(1, "ted7360", ("%s volume %d, %s %s %s\n", |
| 84 | | TONE_ON?"on":"off", |
| 85 | | VOLUME, TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", |
| 86 | | NOISE_ON?"noise":"")); |
| 81 | |
| 82 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 83 | mame_printf_debug("%s volume %d, %s %s %s\n", TONE_ON?"on":"off", VOLUME, |
| 84 | TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", NOISE_ON?"noise":""); |
| 85 | |
| 87 | 86 | if (!TONE_ON||!TONE1_ON) tone1pos=0; |
| 88 | 87 | if (!TONE_ON||!TONE2_ON) tone2pos=0; |
| 89 | 88 | if (!TONE_ON||!NOISE_ON) noisepos=0; |
src/mess/video/vic4567.c
| r3156 | r3157 | |
| 55 | 55 | |
| 56 | 56 | WRITE8_HANDLER ( vic3_port_w ) |
| 57 | 57 | { |
| 58 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 58 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 59 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 60 | |
| 59 | 61 | offset &= 0x7f; |
| 60 | 62 | switch (offset) |
| 61 | 63 | { |
| r3156 | r3157 | |
| 68 | 70 | vic2_port_w(machine, offset,data); |
| 69 | 71 | break; |
| 70 | 72 | case 0x2f: |
| 71 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 73 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 74 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 72 | 75 | vic2.reg[offset] = data; |
| 73 | 76 | break; |
| 74 | 77 | case 0x30: |
| 75 | 78 | vic2.reg[offset] = data; |
| 76 | | if (vic2.port_changed!=NULL) { |
| 77 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 79 | if (vic2.port_changed!=NULL) |
| 80 | { |
| 81 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 82 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 78 | 83 | vic2.reg[offset] = data; |
| 79 | 84 | vic2.port_changed(data); |
| 80 | 85 | } |
| r3156 | r3157 | |
| 99 | 104 | case 0x3e: |
| 100 | 105 | case 0x3f: |
| 101 | 106 | vic2.reg[offset] = data; |
| 102 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 107 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 108 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 103 | 109 | break; |
| 104 | 110 | case 0x40: |
| 105 | 111 | case 0x41: |
| r3156 | r3157 | |
| 109 | 115 | case 0x45: |
| 110 | 116 | case 0x46: |
| 111 | 117 | case 0x47: |
| 112 | | DBG_LOG (2, "vic plane write", ("%.2x:%.2x\n", offset, data)); |
| 118 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic plane write"); |
| 119 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 113 | 120 | break; |
| 114 | 121 | default: |
| 115 | 122 | vic2.reg[offset] = data; |
| r3156 | r3157 | |
| 133 | 140 | case 0x2f: |
| 134 | 141 | case 0x30: |
| 135 | 142 | val = vic2.reg[offset]; |
| 136 | | DBG_LOG (2, "vic read", ("%.2x:%.2x\n", offset, val)); |
| 143 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic read"); |
| 144 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 137 | 145 | break; |
| 138 | 146 | case 0x31: |
| 139 | 147 | case 0x32: |
| r3156 | r3157 | |
| 151 | 159 | case 0x3e: |
| 152 | 160 | case 0x3f: /* not used */ |
| 153 | 161 | val = vic2.reg[offset]; |
| 154 | | DBG_LOG (2, "vic read", ("%.2x:%.2x\n", offset, val)); |
| 162 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic read"); |
| 163 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 155 | 164 | break; |
| 156 | 165 | case 0x40: |
| 157 | 166 | case 0x41: |
| r3156 | r3157 | |
| 161 | 170 | case 0x45: |
| 162 | 171 | case 0x46: |
| 163 | 172 | case 0x47: |
| 164 | | DBG_LOG (2, "vic3 plane read", ("%.2x:%.2x\n", offset, val)); |
| 173 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic3 plane read"); |
| 174 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 165 | 175 | break; |
| 166 | 176 | default: |
| 167 | 177 | val = vic2.reg[offset]; |
src/mess/video/vic6567.c
| r3156 | r3157 | |
| 62 | 62 | #include "vic4567.h" |
| 63 | 63 | #include "utils.h" |
| 64 | 64 | |
| 65 | | #define VERBOSE_DBG 1 |
| 66 | | #include "includes/cbm.h" |
| 67 | | |
| 68 | 65 | /* lightpen values */ |
| 69 | 66 | #include "includes/c64.h" |
| 70 | 67 | |
| r3156 | r3157 | |
| 292 | 289 | { |
| 293 | 290 | if (!(vic2.reg[0x19] & 0x80)) |
| 294 | 291 | { |
| 295 | | DBG_LOG (2, "vic2", ("irq start %.2x\n", mask)); |
| 292 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic2"); |
| 293 | mame_printf_debug("irq start %.2x\n", mask); |
| 296 | 294 | vic2.reg[0x19] |= 0x80; |
| 297 | 295 | vic2.interrupt (1); |
| 298 | 296 | } |
| r3156 | r3157 | |
| 305 | 303 | vic2.reg[0x19] &= ~mask; |
| 306 | 304 | if ((vic2.reg[0x19] & 0x80) && !(vic2.reg[0x19] & vic2.reg[0x1a] & 0xf)) |
| 307 | 305 | { |
| 308 | | DBG_LOG (2, "vic2", ("irq end %.2x\n", mask)); |
| 306 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic2"); |
| 307 | mame_printf_debug("irq end %.2x\n", mask); |
| 309 | 308 | vic2.reg[0x19] &= ~0x80; |
| 310 | 309 | vic2.interrupt (0); |
| 311 | 310 | } |
| r3156 | r3157 | |
| 319 | 318 | static TIMER_CALLBACK(vic2_timer_timeout) |
| 320 | 319 | { |
| 321 | 320 | int which = param; |
| 322 | | DBG_LOG (3, "vic2 ", ("timer %d timeout\n", which)); |
| 321 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic2"); |
| 322 | mame_printf_debug("timer %d timeout\n", which); |
| 323 | 323 | switch (which) |
| 324 | 324 | { |
| 325 | 325 | case 1: /* light pen */ |
| r3156 | r3157 | |
| 340 | 340 | |
| 341 | 341 | WRITE8_HANDLER ( vic2_port_w ) |
| 342 | 342 | { |
| 343 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 343 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 344 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 345 | |
| 344 | 346 | offset &= 0x3f; |
| 345 | 347 | switch (offset) |
| 346 | 348 | { |
| r3156 | r3157 | |
| 522 | 524 | case 0x2f: |
| 523 | 525 | if (vic2.vic2e) |
| 524 | 526 | { |
| 525 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 527 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 528 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 526 | 529 | vic2.reg[offset] = data; |
| 527 | 530 | } |
| 528 | 531 | break; |
| r3156 | r3157 | |
| 548 | 551 | case 0x3e: |
| 549 | 552 | case 0x3f: |
| 550 | 553 | vic2.reg[offset] = data; |
| 551 | | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 554 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic write"); |
| 555 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 552 | 556 | break; |
| 553 | 557 | default: |
| 554 | 558 | vic2.reg[offset] = data; |
| r3156 | r3157 | |
| 614 | 618 | case 0x30: |
| 615 | 619 | if (vic2.vic2e) { |
| 616 | 620 | val = vic2.reg[offset]; |
| 617 | | DBG_LOG (2, "vic read", ("%.2x:%.2x\n", offset, val)); |
| 621 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic read"); |
| 622 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 618 | 623 | } else |
| 619 | 624 | val = 0xff; |
| 620 | 625 | break; |
| r3156 | r3157 | |
| 634 | 639 | case 0x3e: |
| 635 | 640 | case 0x3f: /* not used */ |
| 636 | 641 | val = vic2.reg[offset]; |
| 637 | | DBG_LOG (2, "vic read", ("%.2x:%.2x\n", offset, val)); |
| 642 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic read"); |
| 643 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 638 | 644 | break; |
| 639 | 645 | default: |
| 640 | 646 | val = vic2.reg[offset]; |
| 641 | 647 | } |
| 642 | 648 | if ((offset != 0x11) && (offset != 0x12)) |
| 643 | | DBG_LOG (2, "vic read", ("%.2x:%.2x\n", offset, val)); |
| 649 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic read"); |
| 650 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 644 | 651 | return val; |
| 645 | 652 | } |
| 646 | 653 | |
src/mess/video/ted7360.c
| r3156 | r3157 | |
| 358 | 358 | #include "utils.h" |
| 359 | 359 | #include "sound/custom.h" |
| 360 | 360 | |
| 361 | | #define VERBOSE_DBG 0 |
| 362 | | #include "includes/cbm.h" |
| 363 | 361 | #include "includes/c16.h" |
| 364 | 362 | #include "includes/cbmserb.h" |
| 365 | 363 | #include "includes/vc1541.h" |
| r3156 | r3157 | |
| 554 | 552 | { |
| 555 | 553 | if (!(ted7360[9] & 0x80)) |
| 556 | 554 | { |
| 557 | | DBG_LOG (1, "ted7360", ("irq start %.2x\n", mask)); |
| 555 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 556 | mame_printf_debug("irq start %.2x\n", mask); |
| 557 | |
| 558 | 558 | ted7360[9] |= 0x80; |
| 559 | 559 | c16_interrupt (machine, 1); |
| 560 | 560 | } |
| r3156 | r3157 | |
| 567 | 567 | ted7360[9] &= ~mask; |
| 568 | 568 | if ((ted7360[9] & 0x80) && !(ted7360[9] & ted7360[0xa] & 0x5e)) |
| 569 | 569 | { |
| 570 | | DBG_LOG (1, "ted7360", ("irq end %.2x\n", mask)); |
| 570 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 571 | mame_printf_debug("irq end %.2x\n", mask); |
| 572 | |
| 571 | 573 | ted7360[9] &= ~0x80; |
| 572 | 574 | c16_interrupt (machine, 0); |
| 573 | 575 | } |
| r3156 | r3157 | |
| 582 | 584 | static TIMER_CALLBACK(ted7360_timer_timeout) |
| 583 | 585 | { |
| 584 | 586 | int which = param; |
| 585 | | DBG_LOG (3, "ted7360 ", ("timer %d timeout\n", which)); |
| 587 | |
| 588 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 589 | mame_printf_debug("timer %d timeout\n", which); |
| 590 | |
| 586 | 591 | switch (which) |
| 587 | 592 | { |
| 588 | 593 | case 1: |
| r3156 | r3157 | |
| 625 | 630 | |
| 626 | 631 | if ((offset != 8) && ((offset < 0x15) || (offset > 0x19))) |
| 627 | 632 | { |
| 628 | | DBG_LOG (1, "ted7360_port_w", ("%.2x:%.2x\n", offset, data)); |
| 633 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 634 | mame_printf_debug("%.2x:%.2x\n", offset, data); |
| 629 | 635 | } |
| 636 | |
| 630 | 637 | switch (offset) |
| 631 | 638 | { |
| 632 | 639 | case 0xe: |
| r3156 | r3157 | |
| 714 | 721 | x_begin = HORICONTALPOS; |
| 715 | 722 | x_end = x_begin + 320; |
| 716 | 723 | } |
| 717 | | DBG_LOG (3, "ted7360_port_w", ("%s %s\n", data & 0x40 ? "ntsc" : "pal", |
| 718 | | data & 0x20 ? "hori freeze" : "")); |
| 724 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 725 | mame_printf_debug("%s %s\n", data & 0x40 ? "ntsc" : "pal", data & 0x20 ? "hori freeze" : ""); |
| 726 | |
| 719 | 727 | chargenaddr = CHARGENADDR; |
| 720 | 728 | } |
| 721 | 729 | break; |
| r3156 | r3157 | |
| 742 | 750 | #endif |
| 743 | 751 | if ((data ^ old) & 1) |
| 744 | 752 | { |
| 745 | | /* DBG_LOG(1,"set rasterline hi",("soll:%d\n",RASTERLINE)); */ |
| 753 | // mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "set rasterline hi"); |
| 754 | // mame_printf_debug("soll:%d\n",RASTERLINE); |
| 746 | 755 | } |
| 747 | 756 | break; |
| 748 | 757 | case 0xb: |
| r3156 | r3157 | |
| 750 | 759 | { |
| 751 | 760 | ted7360_drawlines (machine, lastline, rasterline); |
| 752 | 761 | ted7360[offset] = data; |
| 753 | | /* DBG_LOG(1,"set rasterline lo",("soll:%d\n",RASTERLINE)); */ |
| 762 | |
| 763 | // mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "set rasterline lo"); |
| 764 | // mame_printf_debug("soll:%d\n",RASTERLINE); |
| 754 | 765 | } |
| 755 | 766 | break; |
| 756 | 767 | case 0xc: |
| r3156 | r3157 | |
| 768 | 779 | ted7360[offset] = data; |
| 769 | 780 | bitmapaddr = BITMAPADDR; |
| 770 | 781 | chargenaddr = CHARGENADDR; |
| 771 | | DBG_LOG (3, "ted7360_port_w", ("bitmap %.4x %s\n", |
| 772 | | BITMAPADDR, INROM ? "rom" : "ram")); |
| 782 | |
| 783 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 784 | mame_printf_debug("bitmap %.4x %s\n", BITMAPADDR, INROM ? "rom" : "ram"); |
| 773 | 785 | } |
| 774 | 786 | break; |
| 775 | 787 | case 0x13: |
| r3156 | r3157 | |
| 778 | 790 | ted7360_drawlines (machine, lastline, rasterline); |
| 779 | 791 | ted7360[offset] = data; |
| 780 | 792 | chargenaddr = CHARGENADDR; |
| 781 | | DBG_LOG (3, "ted7360_port_w", ("chargen %.4x %s %d\n", |
| 782 | | CHARGENADDR, data & 2 ? "" : "doubleclock", |
| 783 | | data & 1)); |
| 793 | |
| 794 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 795 | mame_printf_debug("chargen %.4x %s %d\n", CHARGENADDR, data & 2 ? "" : "doubleclock", data & 1); |
| 784 | 796 | } |
| 785 | 797 | break; |
| 786 | 798 | case 0x14: |
| r3156 | r3157 | |
| 789 | 801 | ted7360_drawlines (machine, lastline, rasterline); |
| 790 | 802 | ted7360[offset] = data; |
| 791 | 803 | videoaddr = VIDEOADDR; |
| 792 | | DBG_LOG (3, "ted7360_port_w", ("videoram %.4x\n", |
| 793 | | VIDEOADDR)); |
| 804 | |
| 805 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 806 | mame_printf_debug("videoram %.4x\n", VIDEOADDR); |
| 794 | 807 | } |
| 795 | 808 | break; |
| 796 | 809 | case 0x15: /* backgroundcolor */ |
| r3156 | r3157 | |
| 836 | 849 | break; |
| 837 | 850 | case 0x1c: |
| 838 | 851 | ted7360[offset] = data; /*? */ |
| 839 | | DBG_LOG (1, "ted7360_port_w", ("write to rasterline high %.2x\n", |
| 840 | | data)); |
| 852 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 853 | mame_printf_debug("write to rasterline high %.2x\n", data); |
| 841 | 854 | break; |
| 842 | 855 | case 0x1f: |
| 843 | 856 | ted7360[offset] = data; |
| 844 | | DBG_LOG (1, "ted7360_port_w", ("write to cursorblink %.2x\n", data)); |
| 857 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 858 | mame_printf_debug("write to cursorblink %.2x\n", data); |
| 845 | 859 | break; |
| 846 | 860 | default: |
| 847 | 861 | ted7360[offset] = data; |
| r3156 | r3157 | |
| 926 | 940 | break; |
| 927 | 941 | case 0x1f: |
| 928 | 942 | val = ((rasterline & 7) << 4) | (ted7360[offset] & 0x0f); |
| 929 | | DBG_LOG (1, "ted7360_port_w", ("read from cursorblink %.2x\n", val)); |
| 943 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_w"); |
| 944 | mame_printf_debug("read from cursorblink %.2x\n", val); |
| 930 | 945 | break; |
| 931 | 946 | default: |
| 932 | 947 | val = ted7360[offset]; |
| r3156 | r3157 | |
| 935 | 950 | if ((offset != 8) && (offset >= 6) && (offset != 0x1c) && (offset != 0x1d) && (offset != 9) |
| 936 | 951 | && ((offset < 0x15) || (offset > 0x19))) |
| 937 | 952 | { |
| 938 | | DBG_LOG (1, "ted7360_port_r", ("%.2x:%.2x\n", offset, val)); |
| 953 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360_port_r"); |
| 954 | mame_printf_debug("%.2x:%.2x\n", offset, val); |
| 939 | 955 | } |
| 940 | 956 | return val; |
| 941 | 957 | } |
src/mess/machine/c65.c
| r3156 | r3157 | |
| 12 | 12 | #include "sound/sid6581.h" |
| 13 | 13 | #include "machine/6526cia.h" |
| 14 | 14 | |
| 15 | | #define VERBOSE_DBG 1 |
| 16 | | #include "includes/cbm.h" |
| 17 | 15 | #include "includes/cbmserb.h" |
| 18 | 16 | #include "includes/vc1541.h" |
| 19 | 17 | #include "video/vic4567.h" |
| r3156 | r3157 | |
| 118 | 116 | case 0: |
| 119 | 117 | if (src.d==0x3ffff) dump=1; |
| 120 | 118 | if (dump) |
| 121 | | DBG_LOG(1,"dma copy job", |
| 122 | | ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 119 | { |
| 120 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma copy job"); |
| 121 | mame_printf_debug("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 123 | 122 | len.w.l, src.d, dst.d, c65_read_mem(machine, pair.d), |
| 124 | | c65_read_mem(machine, pair.d+1) ) ); |
| 123 | c65_read_mem(machine, pair.d+1)); |
| 124 | } |
| 125 | 125 | if ( (dma.version==1) |
| 126 | 126 | &&( (src.d&0x400000)||(dst.d&0x400000)) ) { |
| 127 | 127 | if ( !(src.d&0x400000) ) { |
| r3156 | r3157 | |
| 144 | 144 | } |
| 145 | 145 | break; |
| 146 | 146 | case 3: |
| 147 | | DBG_LOG(3,"dma fill job", |
| 148 | | ("len:%.4x value:%.2x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 147 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma fill job"); |
| 148 | mame_printf_debug("len:%.4x value:%.2x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 149 | 149 | len.w.l, fill, dst.d, c65_read_mem(machine, pair.d), |
| 150 | | c65_read_mem(machine, pair.d+1))); |
| 151 | | for (i=0; i<len.w.l; i++) |
| 152 | | c65_write_mem(machine, dst.d++,fill); |
| 153 | | break; |
| 150 | c65_read_mem(machine, pair.d+1)); |
| 151 | for (i=0; i<len.w.l; i++) |
| 152 | c65_write_mem(machine, dst.d++,fill); |
| 153 | break; |
| 154 | 154 | case 0x30: |
| 155 | | DBG_LOG(1,"dma copy down", |
| 156 | | ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 155 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma copy down"); |
| 156 | mame_printf_debug("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 157 | 157 | len.w.l, src.d, dst.d, c65_read_mem(machine, pair.d), |
| 158 | | c65_read_mem(machine, pair.d+1) ) ); |
| 158 | c65_read_mem(machine, pair.d+1)); |
| 159 | 159 | for (i=0; i<len.w.l; i++) |
| 160 | 160 | c65_write_mem(machine, dst.d--,c65_read_mem(machine, src.d--)); |
| 161 | 161 | break; |
| 162 | 162 | default: |
| 163 | | DBG_LOG(1,"dma job", |
| 164 | | ("cmd:%.2x len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 163 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma job"); |
| 164 | mame_printf_debug("cmd:%.2x len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", |
| 165 | 165 | cmd,len.w.l, src.d, dst.d, c65_read_mem(machine, pair.d), |
| 166 | | c65_read_mem(machine, pair.d+1))); |
| 166 | c65_read_mem(machine, pair.d+1)); |
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | default: |
| 170 | | DBG_LOG (1, "dma chip write", ("%.3x %.2x\n", offset,value)); |
| 170 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma chip write"); |
| 171 | mame_printf_debug("%.3x %.2x\n", offset,value); |
| 171 | 172 | break; |
| 172 | 173 | } |
| 173 | 174 | } |
| r3156 | r3157 | |
| 175 | 176 | static int c65_dma_port_r(running_machine *machine, int offset) |
| 176 | 177 | { |
| 177 | 178 | /* offset 3 bit 7 in progress ? */ |
| 178 | | DBG_LOG (2, "dma chip read", ("%.3x\n", offset)); |
| 179 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma chip read"); |
| 180 | mame_printf_debug("%.3x\n", offset); |
| 179 | 181 | return 0x7f; |
| 180 | 182 | } |
| 181 | 183 | |
| r3156 | r3157 | |
| 185 | 187 | { |
| 186 | 188 | c65_6511_port=value; |
| 187 | 189 | } |
| 188 | | DBG_LOG (2, "r6511 write", ("%.2x %.2x\n", offset, value)); |
| 190 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "r6511 write"); |
| 191 | mame_printf_debug("%.2x %.2x\n", offset, value); |
| 189 | 192 | } |
| 190 | 193 | |
| 191 | 194 | static int c65_6511_port_r(running_machine *machine, int offset) |
| r3156 | r3157 | |
| 197 | 200 | if (input_port_read(machine, "SPECIAL") & 0x20) |
| 198 | 201 | data &= ~1; |
| 199 | 202 | } |
| 200 | | DBG_LOG (2, "r6511 read", ("%.2x\n", offset)); |
| 203 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "r6511 read"); |
| 204 | mame_printf_debug("%.2x\n", offset); |
| 201 | 205 | |
| 202 | 206 | return data; |
| 203 | 207 | } |
| r3156 | r3157 | |
| 328 | 332 | |
| 329 | 333 | static void c65_fdc_w(running_machine *machine, int offset, int data) |
| 330 | 334 | { |
| 331 | | DBG_LOG (1, "fdc write", ("%.5x %.2x %.2x\n", activecpu_get_pc(), offset, data)); |
| 335 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "fdc write"); |
| 336 | mame_printf_debug("%.5x %.2x %.2x\n", activecpu_get_pc(), offset, data); |
| 337 | |
| 332 | 338 | switch (offset&0xf) { |
| 333 | 339 | case 0: |
| 334 | 340 | c65_fdc.reg[0]=data; |
| r3156 | r3157 | |
| 409 | 415 | data=c65_fdc.reg[offset&0xf]; |
| 410 | 416 | break; |
| 411 | 417 | } |
| 412 | | DBG_LOG (1, "fdc read", ("%.5x %.2x %.2x\n", activecpu_get_pc(), offset, data)); |
| 418 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "fdc read"); |
| 419 | mame_printf_debug("%.5x %.2x %.2x\n", activecpu_get_pc(), offset, data); |
| 420 | |
| 413 | 421 | return data; |
| 414 | 422 | } |
| 415 | 423 | |
| r3156 | r3157 | |
| 484 | 492 | else if (offset<0x440) |
| 485 | 493 | sid6581_1_port_w(machine, offset&0x3f, data); |
| 486 | 494 | else |
| 487 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data)); |
| 495 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 496 | mame_printf_debug("%.3x %.2x\n", offset, data); |
| 488 | 497 | break; |
| 489 | 498 | case 0x500: |
| 490 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data)); |
| 499 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 500 | mame_printf_debug("%.3x %.2x\n", offset, data); |
| 491 | 501 | break; |
| 492 | 502 | case 0x600: |
| 493 | 503 | c65_6511_port_w(machine, offset&0xff,data); |
| r3156 | r3157 | |
| 509 | 519 | break; |
| 510 | 520 | case 0x200: |
| 511 | 521 | case 0x300: |
| 512 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset+0xc00, data)); |
| 522 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 523 | mame_printf_debug("%.3x %.2x\n", offset+0xc00, data); |
| 513 | 524 | break; |
| 514 | 525 | } |
| 515 | 526 | } |
| r3156 | r3157 | |
| 529 | 540 | break; |
| 530 | 541 | case 0x100:case 0x200: case 0x300: |
| 531 | 542 | /* read only !? */ |
| 532 | | DBG_LOG (1, "io read", ("%.3x\n", offset)); |
| 543 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io read"); |
| 544 | mame_printf_debug("%.3x\n", offset); |
| 533 | 545 | break; |
| 534 | 546 | case 0x400: |
| 535 | 547 | if (offset<0x420) |
| 536 | 548 | return sid6581_0_port_r(machine, offset & 0x3f); |
| 537 | 549 | if (offset<0x440) |
| 538 | 550 | return sid6581_1_port_r(machine, offset&0x3f); |
| 539 | | DBG_LOG (1, "io read", ("%.3x\n", offset)); |
| 551 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io read"); |
| 552 | mame_printf_debug("%.3x\n", offset); |
| 540 | 553 | break; |
| 541 | 554 | case 0x500: |
| 542 | | DBG_LOG (1, "io read", ("%.3x\n", offset)); |
| 555 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io read"); |
| 556 | mame_printf_debug("%.3x\n", offset); |
| 543 | 557 | break; |
| 544 | 558 | case 0x600: |
| 545 | 559 | return c65_6511_port_r(machine, offset&0xff); |
| r3156 | r3157 | |
| 558 | 572 | return cia_1_r(machine, offset); |
| 559 | 573 | case 0x200: |
| 560 | 574 | case 0x300: |
| 561 | | DBG_LOG (1, "io read", ("%.3x\n", offset+0xc00)); |
| 575 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io read"); |
| 576 | mame_printf_debug("%.3x\n", offset+0xc00); |
| 562 | 577 | break; |
| 563 | 578 | } |
| 564 | 579 | return 0xff; |
| r3156 | r3157 | |
| 581 | 596 | read8_machine_func rh; |
| 582 | 597 | write8_machine_func wh; |
| 583 | 598 | |
| 584 | | DBG_LOG (2, "c65 bankswitch", ("%.2x\n",value)); |
| 599 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c65 bankswitch"); |
| 600 | mame_printf_debug("%.2x\n",value); |
| 585 | 601 | |
| 586 | 602 | if (c65_io_on) |
| 587 | 603 | { |
| r3156 | r3157 | |
| 633 | 649 | if (data == old) |
| 634 | 650 | return; |
| 635 | 651 | |
| 636 | | DBG_LOG (1, "bankswitch", ("%d\n", data & 7)); |
| 637 | | loram = (data & 1) ? 1 : 0; |
| 638 | | hiram = (data & 2) ? 1 : 0; |
| 639 | | charen = (data & 4) ? 1 : 0; |
| 652 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "bankswitch"); |
| 653 | mame_printf_debug("%d\n", data & 0x07); |
| 640 | 654 | |
| 655 | loram = (data & 0x01) ? 1 : 0; |
| 656 | hiram = (data & 0x02) ? 1 : 0; |
| 657 | charen = (data & 0x04) ? 1 : 0; |
| 658 | |
| 641 | 659 | if ((!c64_game && c64_exrom) |
| 642 | 660 | || (loram && hiram && !c64_exrom)) |
| 643 | 661 | { |
src/mess/machine/vc1541.c
| r3156 | r3157 | |
| 106 | 106 | #include "cpu/m6502/m6502.h" |
| 107 | 107 | #include "machine/6522via.h" |
| 108 | 108 | |
| 109 | | #define VERBOSE_DBG 1 |
| 110 | | #include "includes/cbm.h" |
| 111 | 109 | #include "includes/cbmdrive.h" |
| 112 | 110 | #include "machine/tpi6525.h" |
| 113 | 111 | |
| r3156 | r3157 | |
| 402 | 400 | static void vc1541_via0_irq (running_machine *machine, int level) |
| 403 | 401 | { |
| 404 | 402 | vc1541->via0irq = level; |
| 405 | | DBG_LOG(2, "vc1541 via0 irq",("level %d %d\n",vc1541->via0irq,vc1541->via1irq)); |
| 403 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 via0 irq"); |
| 404 | mame_printf_debug("level %d %d\n",vc1541->via0irq,vc1541->via1irq); |
| 405 | |
| 406 | 406 | cpunum_set_input_line (machine, vc1541->cpunumber, |
| 407 | 407 | M6502_IRQ_LINE, vc1541->via1irq || vc1541->via0irq); |
| 408 | 408 | } |
| r3156 | r3157 | |
| 432 | 432 | case 11: |
| 433 | 433 | break; |
| 434 | 434 | } |
| 435 | | if (value!=old) { |
| 435 | if (value!=old) |
| 436 | { |
| 437 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 serial read"); |
| 438 | mame_printf_debug("%s %s %s\n", serial.atn[0]?"ATN":"atn", serial.clock[0]?"CLOCK":"clock", serial.data[0]?"DATA":"data"); |
| 436 | 439 | |
| 437 | | DBG_LOG(2, "vc1541 serial read",("%s %s %s\n", |
| 438 | | serial.atn[0]?"ATN":"atn", |
| 439 | | serial.clock[0]?"CLOCK":"clock", |
| 440 | | serial.data[0]?"DATA":"data")); |
| 440 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 serial read"); |
| 441 | mame_printf_debug("%s %s %s\n", value&0x80?"ATN":"atn", value&4?"CLOCK":"clock", value&1?"DATA":"data"); |
| 441 | 442 | |
| 442 | | DBG_LOG(2, "vc1541 serial read",("%s %s %s\n", |
| 443 | | value&0x80?"ATN":"atn", |
| 444 | | value&4?"CLOCK":"clock", |
| 445 | | value&1?"DATA":"data")); |
| 446 | 443 | old=value; |
| 447 | 444 | } |
| 448 | 445 | |
| r3156 | r3157 | |
| 451 | 448 | |
| 452 | 449 | static WRITE8_HANDLER( vc1541_via0_write_portb ) |
| 453 | 450 | { |
| 454 | | DBG_LOG(2, "vc1541 serial write",("%s %s %s\n", |
| 455 | | data&0x10?"ATN":"atn", |
| 456 | | data&8?"CLOCK":"clock", |
| 457 | | data&2?"DATA":"data")); |
| 451 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 serial write"); |
| 452 | mame_printf_debug("%s %s %s\n", data&0x10?"ATN":"atn", data&8?"CLOCK":"clock", data&2?"DATA":"data"); |
| 458 | 453 | |
| 459 | 454 | vc1541->drive.serial.data=data&2?0:1; |
| 460 | 455 | vc1541->drive.serial.acka=(data&0x10)?1:0; |
| r3156 | r3157 | |
| 501 | 496 | static void vc1541_via1_irq (running_machine *machine, int level) |
| 502 | 497 | { |
| 503 | 498 | vc1541->via1irq = level; |
| 504 | | DBG_LOG(2, "vc1541 via1 irq",("level %d %d\n",vc1541->via0irq,vc1541->via1irq)); |
| 499 | |
| 500 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 via1 irq"); |
| 501 | mame_printf_debug("level %d %d\n",vc1541->via0irq,vc1541->via1irq); |
| 502 | |
| 505 | 503 | cpunum_set_input_line (machine, vc1541->cpunumber, |
| 506 | 504 | M6502_IRQ_LINE, vc1541->via1irq || vc1541->via0irq); |
| 507 | 505 | } |
| r3156 | r3157 | |
| 509 | 507 | static READ8_HANDLER( vc1541_via1_read_porta ) |
| 510 | 508 | { |
| 511 | 509 | int data=vc1541->head.data[vc1541->d64.pos]; |
| 512 | | DBG_LOG(2, "vc1541 drive",("port a read %.2x\n", data)); |
| 510 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 drive"); |
| 511 | mame_printf_debug("port a read %.2x\n", data); |
| 512 | |
| 513 | 513 | return data; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | static WRITE8_HANDLER( vc1541_via1_write_porta ) |
| 517 | 517 | { |
| 518 | | DBG_LOG(1, "vc1541 drive",("port a write %.2x\n", data)); |
| 518 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 drive"); |
| 519 | mame_printf_debug("port a write %.2x\n", data); |
| 519 | 520 | } |
| 520 | 521 | |
| 521 | 522 | static READ8_HANDLER( vc1541_via1_read_portb ) |
| r3156 | r3157 | |
| 536 | 537 | static WRITE8_HANDLER( vc1541_via1_write_portb ) |
| 537 | 538 | { |
| 538 | 539 | static int old=0; |
| 539 | | if (data!=old) { |
| 540 | | DBG_LOG(1, "vc1541 drive",("%.2x\n", data)); |
| 540 | if (data!=old) |
| 541 | { |
| 542 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 drive"); |
| 543 | mame_printf_debug("%.2x\n", data); |
| 544 | |
| 541 | 545 | if ((old&3)!=(data&3)) { |
| 542 | 546 | switch (old&3) { |
| 543 | 547 | case 0: |
| r3156 | r3157 | |
| 666 | 670 | /* delivers status for displaying */ |
| 667 | 671 | void vc1541_drive_status (char *text, int size) |
| 668 | 672 | { |
| 669 | | #if 1||VERBOSE_DBG |
| 673 | #if 1 |
| 670 | 674 | if (vc1541->type==TypeVC1541) { |
| 671 | 675 | snprintf (text, size, "%s %4.1f %s %.2x %s %s %s", |
| 672 | 676 | vc1541->led ? "LED" : "led", |
| r3156 | r3157 | |
| 717 | 721 | serial.atn[0] = serial.atn[1] && serial.atn[2]; |
| 718 | 722 | if (serial.atn[0] == level) |
| 719 | 723 | { |
| 720 | | DBG_LOG(1, "vc1541",("%d:%.4x atn %s\n", |
| 721 | | cpu_getactivecpu (), |
| 722 | | activecpu_get_pc(), |
| 723 | | serial.atn[0]?"ATN":"atn")); |
| 724 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541"); |
| 725 | mame_printf_debug("%d:%.4x atn %s\n", cpu_getactivecpu (), activecpu_get_pc(), serial.atn[0]?"ATN":"atn"); |
| 726 | |
| 724 | 727 | via_set_input_ca1 (machine, 2, !level); |
| 725 | 728 | #if 0 |
| 726 | 729 | value=vc1541->drive.serial.data; |
| r3156 | r3157 | |
| 758 | 761 | serial.data[0] = serial.data[1] && serial.data[2]; |
| 759 | 762 | if (serial.data[0] == level) |
| 760 | 763 | { |
| 761 | | DBG_LOG(1, "vc1541",("%d:%.4x data %s\n", |
| 762 | | cpu_getactivecpu (), |
| 763 | | activecpu_get_pc(), |
| 764 | | serial.data[0]?"DATA":"data")); |
| 764 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541"); |
| 765 | mame_printf_debug("%d:%.4x data %s\n", cpu_getactivecpu (), activecpu_get_pc(), serial.data[0]?"DATA":"data"); |
| 765 | 766 | } |
| 766 | 767 | } |
| 767 | 768 | } |
| r3156 | r3157 | |
| 788 | 789 | serial.clock[0] = serial.clock[1] && serial.clock[2]; |
| 789 | 790 | if (serial.clock[0] == level) |
| 790 | 791 | { |
| 791 | | DBG_LOG(1, "vc1541",("%d:%.4x clock %s\n", |
| 792 | | cpu_getactivecpu (), |
| 793 | | activecpu_get_pc(), |
| 794 | | serial.clock[0]?"CLOCK":"clock")); |
| 792 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541"); |
| 793 | mame_printf_debug("%d:%.4x clock %s\n", cpu_getactivecpu (), activecpu_get_pc(), serial.clock[0]?"CLOCK":"clock"); |
| 795 | 794 | } |
| 796 | 795 | } |
| 797 | 796 | } |
| r3156 | r3157 | |
| 827 | 826 | static WRITE8_HANDLER ( c1551_port_w ) |
| 828 | 827 | { |
| 829 | 828 | static int old=0; |
| 830 | | if (offset) { |
| 831 | | DBG_LOG(1, "c1551 port",("write %.2x\n",data)); |
| 829 | if (offset) |
| 830 | { |
| 831 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 port"); |
| 832 | mame_printf_debug("write %.2x\n",data); |
| 833 | |
| 832 | 834 | vc1541->drive.c1551.cpu_port=data; |
| 833 | 835 | |
| 834 | | if (data!=old) { |
| 835 | | DBG_LOG(1, "vc1541 drive",("%.2x\n", data)); |
| 836 | if (data!=old) |
| 837 | { |
| 838 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541 drive"); |
| 839 | mame_printf_debug("%.2x\n", data); |
| 836 | 840 | if ((old&3)!=(data&3)) { |
| 837 | 841 | switch (old&3) { |
| 838 | 842 | case 0: |
| r3156 | r3157 | |
| 877 | 881 | vc1541->led = data & 8; |
| 878 | 882 | } else { |
| 879 | 883 | vc1541->drive.c1551.cpu_ddr=data; |
| 880 | | DBG_LOG(1, "c1551 ddr",("write %.2x\n",data)); |
| 884 | |
| 885 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 ddr"); |
| 886 | mame_printf_debug("write %.2x\n",data); |
| 881 | 887 | } |
| 882 | 888 | } |
| 883 | 889 | |
| r3156 | r3157 | |
| 897 | 903 | } |
| 898 | 904 | data&=~vc1541->drive.c1551.cpu_ddr; |
| 899 | 905 | data|=vc1541->drive.c1551.cpu_ddr&vc1541->drive.c1551.cpu_port; |
| 900 | | DBG_LOG(3, "c1551 port",("read %.2x\n", data)); |
| 906 | |
| 907 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 port"); |
| 908 | mame_printf_debug("read %.2x\n", data); |
| 901 | 909 | } else { |
| 902 | 910 | data=vc1541->drive.c1551.cpu_ddr; |
| 903 | | DBG_LOG(3, "c1551 ddr",("read %.2x\n", data)); |
| 911 | |
| 912 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 ddr"); |
| 913 | mame_printf_debug("read %.2x\n", data); |
| 904 | 914 | } |
| 905 | 915 | return data; |
| 906 | 916 | } |
| r3156 | r3157 | |
| 932 | 942 | static int c1551_port_b_r (void) |
| 933 | 943 | { |
| 934 | 944 | int data=vc1541->head.data[vc1541->d64.pos]; |
| 935 | | DBG_LOG(2, "c1551 drive",("port a read %.2x\n", data)); |
| 945 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 drive"); |
| 946 | mame_printf_debug("port a read %.2x\n", data); |
| 936 | 947 | return data; |
| 937 | 948 | } |
| 938 | 949 | |
| r3156 | r3157 | |
| 961 | 972 | |
| 962 | 973 | static void c1551x_write_data (running_machine *machine, TPI6525 *This, int data) |
| 963 | 974 | { |
| 964 | | DBG_LOG(1, "c1551 cpu", ("%d write data %.2x\n", |
| 965 | | cpu_getactivecpu (), data)); |
| 975 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 cpu"); |
| 976 | mame_printf_debug("%d write data %.2x\n", cpu_getactivecpu (), data); |
| 966 | 977 | #ifdef CPU_SYNC |
| 967 | 978 | cpu_sync(); |
| 968 | 979 | #endif |
| r3156 | r3157 | |
| 976 | 987 | cpu_sync (); |
| 977 | 988 | #endif |
| 978 | 989 | data=tpi6525_0_port_a_r(machine, 0); |
| 979 | | DBG_LOG(2, "c1551 cpu",("%d read data %.2x\n", |
| 980 | | cpu_getactivecpu (), data)); |
| 990 | |
| 991 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 cpu"); |
| 992 | mame_printf_debug("%d read data %.2x\n", cpu_getactivecpu (), data); |
| 993 | |
| 981 | 994 | return data; |
| 982 | 995 | } |
| 983 | 996 | |
| 984 | 997 | static void c1551x_write_handshake (running_machine *machine, TPI6525 *This, int data) |
| 985 | 998 | { |
| 986 | | DBG_LOG(1, "c1551 cpu",("%d write handshake %.2x\n", |
| 987 | | cpu_getactivecpu (), data)); |
| 999 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 cpu"); |
| 1000 | mame_printf_debug("%d write handshake %.2x\n", cpu_getactivecpu (), data); |
| 988 | 1001 | #ifdef CPU_SYNC |
| 989 | 1002 | cpu_sync(); |
| 990 | 1003 | #endif |
| r3156 | r3157 | |
| 998 | 1011 | cpu_sync(); |
| 999 | 1012 | #endif |
| 1000 | 1013 | data=tpi6525_0_port_c_r(machine, 0)&8?0x80:0; |
| 1001 | | DBG_LOG(2, "c1551 cpu",("%d read handshake %.2x\n", |
| 1002 | | cpu_getactivecpu (), data)); |
| 1014 | |
| 1015 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 cpu"); |
| 1016 | mame_printf_debug("%d read handshake %.2x\n", cpu_getactivecpu (), data); |
| 1017 | |
| 1003 | 1018 | return data; |
| 1004 | 1019 | } |
| 1005 | 1020 | |
| r3156 | r3157 | |
| 1010 | 1025 | cpu_sync(); |
| 1011 | 1026 | #endif |
| 1012 | 1027 | data=tpi6525_0_port_c_r(machine, 0)&3; |
| 1013 | | DBG_LOG(1, "c1551 cpu",("%d read status %.2x\n", |
| 1014 | | cpu_getactivecpu (), data)); |
| 1028 | |
| 1029 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551 cpu"); |
| 1030 | mame_printf_debug("%d read status %.2x\n", cpu_getactivecpu (), data); |
| 1031 | |
| 1015 | 1032 | return data; |
| 1016 | 1033 | } |
| 1017 | 1034 | |
src/mess/machine/c128.c
| r3156 | r3157 | |
| 16 | 16 | #include "machine/6526cia.h" |
| 17 | 17 | #include "deprecat.h" |
| 18 | 18 | |
| 19 | | #define VERBOSE_DBG 1 |
| 20 | | #include "includes/cbm.h" |
| 21 | 19 | #include "includes/cbmserb.h" |
| 22 | 20 | #include "includes/vc1541.h" |
| 23 | 21 | #include "video/vic6567.h" |
| r3156 | r3157 | |
| 71 | 69 | |
| 72 | 70 | static WRITE8_HANDLER(c128_dma8726_port_w) |
| 73 | 71 | { |
| 74 | | DBG_LOG(1,"dma write",("%.3x %.2x\n",offset,data)); |
| 72 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma write"); |
| 73 | mame_printf_debug("%.3x %.2x\n",offset,data); |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | static READ8_HANDLER(c128_dma8726_port_r) |
| 78 | 77 | { |
| 79 | | DBG_LOG(1,"dma read",("%.3x\n",offset)); |
| 78 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "dma read"); |
| 79 | mame_printf_debug("%.3x\n",offset); |
| 80 | 80 | return 0xff; |
| 81 | 81 | } |
| 82 | 82 | |
| r3156 | r3157 | |
| 126 | 126 | c128_dma8726_port_w(machine, offset&0xff,data); |
| 127 | 127 | break; |
| 128 | 128 | case 0xe: |
| 129 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data)); |
| 129 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 130 | mame_printf_debug("%.3x %.2x\n", offset, data); |
| 130 | 131 | break; |
| 131 | 132 | } |
| 132 | 133 | } |
| r3156 | r3157 | |
| 162 | 163 | return cia_1_r(machine, offset); |
| 163 | 164 | else if ((offset >= 0xf00) & (offset <= 0xfff)) |
| 164 | 165 | return c128_dma8726_port_r(machine, offset&0xff); |
| 165 | | DBG_LOG (1, "io read", ("%.3x\n", offset)); |
| 166 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io read"); |
| 167 | mame_printf_debug("%.3x\n", offset); |
| 166 | 168 | return 0xff; |
| 167 | 169 | } |
| 168 | 170 | |
| r3156 | r3157 | |
| 175 | 177 | if (!c64mode) |
| 176 | 178 | return; |
| 177 | 179 | |
| 178 | | data = (UINT8) cpunum_get_info_int(0, CPUINFO_INT_M6510_PORT) & 7; |
| 179 | | if ((data == old)&&(exrom==c64_exrom)&&(game==c64_game)&&!reset) |
| 180 | data = (UINT8) cpunum_get_info_int(0, CPUINFO_INT_M6510_PORT) & 0x07; |
| 181 | if ((data == old) && (exrom == c64_exrom) && (game == c64_game) && !reset) |
| 180 | 182 | return; |
| 181 | 183 | |
| 182 | | DBG_LOG (1, "bankswitch", ("%d\n", data & 7)); |
| 183 | | loram = (data & 1) ? 1 : 0; |
| 184 | | hiram = (data & 2) ? 1 : 0; |
| 185 | | charen = (data & 4) ? 1 : 0; |
| 184 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "bankswitch"); |
| 185 | mame_printf_debug("%d\n", data & 0x07); |
| 186 | 186 | |
| 187 | loram = (data & 0x01) ? 1 : 0; |
| 188 | hiram = (data & 0x02) ? 1 : 0; |
| 189 | charen = (data & 0x04) ? 1 : 0; |
| 190 | |
| 187 | 191 | if ((!c64_game && c64_exrom) |
| 188 | 192 | || (loram && hiram && !c64_exrom)) |
| 189 | 193 | { |
| r3156 | r3157 | |
| 542 | 546 | { |
| 543 | 547 | if (!MMU_CPU8502) |
| 544 | 548 | { |
| 545 | | DBG_LOG (1, "switching to z80", |
| 546 | | ("active %d\n",cpu_getactivecpu()) ); |
| 549 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "switching to z80"); |
| 550 | mame_printf_debug("active %d\n",cpu_getactivecpu()); |
| 551 | |
| 547 | 552 | memory_set_context(0); |
| 548 | 553 | c128_bankswitch_z80(machine); |
| 549 | 554 | memory_set_context(1); |
| r3156 | r3157 | |
| 552 | 557 | } |
| 553 | 558 | else |
| 554 | 559 | { |
| 555 | | DBG_LOG (1, "switching to m6502", |
| 556 | | ("active %d\n",cpu_getactivecpu()) ); |
| 560 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "switching to m6502"); |
| 561 | mame_printf_debug("active %d\n",cpu_getactivecpu()); |
| 562 | |
| 557 | 563 | memory_set_context(1); |
| 558 | 564 | c128_bankswitch_128(machine, reset); |
| 559 | 565 | memory_set_context(0); |
src/mess/machine/cbmdrive.c
| r3156 | r3157 | |
| 4 | 4 | #include <string.h> |
| 5 | 5 | #include "driver.h" |
| 6 | 6 | |
| 7 | | #define VERBOSE_DBG 1 /* general debug messages */ |
| 8 | | #include "includes/cbm.h" |
| 9 | 7 | #include "includes/cbmserb.h" |
| 10 | 8 | #include "includes/cbmieeeb.h" |
| 11 | 9 | |
| r3156 | r3157 | |
| 139 | 137 | } |
| 140 | 138 | c1551->size += c1551->image[i + 1]; |
| 141 | 139 | |
| 142 | | DBG_LOG (3, "d64 readprg", ("size %d\n", c1551->size)); |
| 140 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "d64 readprg"); |
| 141 | mame_printf_debug("size %d\n", c1551->size); |
| 143 | 142 | |
| 144 | 143 | c1551->buffer = (UINT8*)realloc (c1551->buffer, c1551->size); |
| 145 | 144 | if (!c1551->buffer) |
| r3156 | r3157 | |
| 147 | 146 | |
| 148 | 147 | c1551->size--; |
| 149 | 148 | |
| 150 | | DBG_LOG (3, "d64 readprg", ("track: %d sector: %d\n", |
| 151 | | c1551->image[pos + 1], |
| 152 | | c1551->image[pos + 2])); |
| 149 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "d64 readprg"); |
| 150 | mame_printf_debug("track: %d sector: %d\n", c1551->image[pos + 1], c1551->image[pos + 2]); |
| 153 | 151 | |
| 154 | 152 | for (i = 0; i < c1551->size; i += 254) |
| 155 | 153 | { |
| r3156 | r3157 | |
| 158 | 156 | memcpy (c1551->buffer + i, c1551->image + pos + 2, 254); |
| 159 | 157 | pos = d64_tracksector2offset (c1551->image[pos + 0], |
| 160 | 158 | c1551->image[pos + 1]); |
| 161 | | DBG_LOG (3, "d64 readprg", ("track: %d sector: %d\n", |
| 162 | | c1551->image[pos], |
| 163 | | c1551->image[pos + 1])); |
| 159 | |
| 160 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "d64 readprg"); |
| 161 | mame_printf_debug("track: %d sector: %d\n", c1551->image[pos], c1551->image[pos + 1]); |
| 164 | 162 | } |
| 165 | 163 | else |
| 166 | 164 | { |
| r3156 | r3157 | |
| 432 | 430 | drive->state = OPEN; |
| 433 | 431 | drive->pos = 0; |
| 434 | 432 | } |
| 435 | | DBG_LOG (1, "cbm_open", ("%s %s type:%c %c\n", name, |
| 436 | | rc ? "failed" : "success", type, mode ? mode : ' ')); |
| 433 | |
| 434 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm_open"); |
| 435 | mame_printf_debug("%s %s type:%c %c\n", name, rc ? "failed" : "success", type, mode ? mode : ' '); |
| 437 | 436 | } |
| 438 | 437 | else if ((drive->cmdpos == 1) && (drive->cmdbuffer[0] == 0x5f)) |
| 439 | 438 | { |
| r3156 | r3157 | |
| 555 | 554 | if (!c1551->i.iec.handshakein) |
| 556 | 555 | { |
| 557 | 556 | c1551->i.iec.state++; |
| 558 | | DBG_LOG(1,"c1551",("taken data %.2x\n",c1551->i.iec.datain)); |
| 557 | |
| 558 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551"); |
| 559 | mame_printf_debug("taken data %.2x\n", c1551->i.iec.datain); |
| 560 | |
| 559 | 561 | if (c1551->cmdpos < sizeof (c1551->cmdbuffer)) |
| 560 | 562 | c1551->cmdbuffer[c1551->cmdpos++] = c1551->i.iec.datain; |
| 561 | 563 | if ((c1551->i.iec.datain == 0x3f) || (c1551->i.iec.datain == 0x5f)) |
| r3156 | r3157 | |
| 643 | 645 | c1551->i.iec.state++; |
| 644 | 646 | if ((c1551->state == 0) || (c1551->state == OPEN)) |
| 645 | 647 | { |
| 646 | | DBG_LOG (1, "c1551", ("taken data %.2x\n", |
| 647 | | c1551->i.iec.datain)); |
| 648 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551"); |
| 649 | mame_printf_debug("taken data %.2x\n", c1551->i.iec.datain); |
| 650 | |
| 648 | 651 | if (c1551->cmdpos < sizeof (c1551->cmdbuffer)) |
| 649 | 652 | c1551->cmdbuffer[c1551->cmdpos++] = c1551->i.iec.datain; |
| 650 | 653 | } |
| 651 | 654 | else if (c1551->state == WRITING) |
| 652 | 655 | { |
| 653 | | DBG_LOG (1, "c1551", ("written data %.2x\n", c1551->i.iec.datain)); |
| 656 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "c1551"); |
| 657 | mame_printf_debug("written data %.2x\n", c1551->i.iec.datain); |
| 654 | 658 | } |
| 655 | 659 | c1551->i.iec.handshakeout = 1; |
| 656 | 660 | } |
| r3156 | r3157 | |
| 670 | 674 | } |
| 671 | 675 | |
| 672 | 676 | if (oldstate != c1551->i.iec.state) |
| 673 | | if (VERBOSE_DBG >= 1) logerror("state %d->%d %d\n", oldstate, c1551->i.iec.state, c1551->state); |
| 677 | mame_printf_debug("state %d->%d %d\n", oldstate, c1551->i.iec.state, c1551->state); |
| 674 | 678 | } |
| 675 | 679 | |
| 676 | 680 | static int vc1541_time_greater(CBM_Drive * vc1541, attotime threshold) |
| r3156 | r3157 | |
| 816 | 820 | { |
| 817 | 821 | if (vc1541->cmdpos < sizeof (vc1541->cmdbuffer)) |
| 818 | 822 | vc1541->cmdbuffer[vc1541->cmdpos++] = vc1541->i.serial.value; |
| 819 | | DBG_LOG (1, "serial read", ("%s %s %.2x\n", |
| 820 | | vc1541->i.serial.broadcast ? "broad" : "", |
| 821 | | vc1541->i.serial.last ? "last" : "", |
| 822 | | vc1541->i.serial.value)); |
| 823 | |
| 824 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "serial read"); |
| 825 | mame_printf_debug("%s %s %.2x\n", vc1541->i.serial.broadcast ? "broad" : "", |
| 826 | vc1541->i.serial.last ? "last" : "", vc1541->i.serial.value); |
| 823 | 827 | } |
| 824 | 828 | vc1541->i.serial.state++; |
| 825 | 829 | } |
| r3156 | r3157 | |
| 1172 | 1176 | } |
| 1173 | 1177 | if (vc1541_time_greater(vc1541, ATTOTIME_IN_USEC(20))) |
| 1174 | 1178 | { |
| 1175 | | DBG_LOG (1, "vc1541", ("%.2x written\n", vc1541->i.serial.value)); |
| 1179 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vc1541"); |
| 1180 | mame_printf_debug("%.2x written\n", vc1541->i.serial.value); |
| 1181 | |
| 1176 | 1182 | vc1541->i.serial.data = 1; |
| 1177 | 1183 | vc1541->i.serial.clock = 0; |
| 1178 | 1184 | vc1541->i.serial.state++; |
| r3156 | r3157 | |
| 1283 | 1289 | } |
| 1284 | 1290 | |
| 1285 | 1291 | if (oldstate != vc1541->i.serial.state) |
| 1286 | | if (VERBOSE_DBG >= 1) logerror("%d state %d->%d %d %s %s %s\n", |
| 1287 | | vc1541->i.serial.device, |
| 1288 | | oldstate, |
| 1289 | | vc1541->i.serial.state, vc1541->state, |
| 1290 | | cbm_serial.atn[0] ? "ATN" : "atn", |
| 1291 | | cbm_serial.clock[0] ? "CLOCK" : "clock", |
| 1292 | mame_printf_debug("%d state %d->%d %d %s %s %s\n", |
| 1293 | vc1541->i.serial.device, oldstate, vc1541->i.serial.state, vc1541->state, |
| 1294 | cbm_serial.atn[0] ? "ATN" : "atn", cbm_serial.clock[0] ? "CLOCK" : "clock", |
| 1292 | 1295 | cbm_serial.data[0] ? "DATA" : "data"); |
| 1293 | 1296 | } |
| 1294 | 1297 | |
| r3156 | r3157 | |
| 1438 | 1441 | } |
| 1439 | 1442 | |
| 1440 | 1443 | if (oldstate != drive->i.ieee.state) |
| 1441 | | if (VERBOSE_DBG >= 1) logerror("%d state %d->%d %d\n", |
| 1442 | | drive->i.ieee.device, |
| 1443 | | oldstate, |
| 1444 | | drive->i.ieee.state, drive->state |
| 1445 | | ); |
| 1444 | mame_printf_debug("%d state %d->%d %d\n", drive->i.ieee.device, oldstate, |
| 1445 | drive->i.ieee.state, drive->state); |
| 1446 | 1446 | } |
src/mess/machine/cbmieeeb.c
| r3156 | r3157 | |
| 300 | 300 | |
| 301 | 301 | #include "driver.h" |
| 302 | 302 | |
| 303 | | #define VERBOSE_DBG 1 |
| 304 | | #include "includes/cbm.h" |
| 305 | | |
| 306 | 303 | #include "includes/cbmdrive.h" |
| 307 | 304 | #include "includes/cbmserb.h" |
| 308 | 305 | |
| r3156 | r3157 | |
| 352 | 349 | |
| 353 | 350 | void cbm_ieee_dav_w(int device, int data) |
| 354 | 351 | { |
| 355 | | DBG_LOG(1,"cbm ieee dav",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 352 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee dav"); |
| 353 | mame_printf_debug("%.4x dev:%d %d\n", activecpu_get_pc(), device, data); |
| 354 | |
| 356 | 355 | cbmieee.bus[device].dav=data; |
| 357 | 356 | if (device==0) c2031_state(cbm_drive); |
| 358 | 357 | } |
| 359 | 358 | |
| 360 | 359 | void cbm_ieee_nrfd_w(int device, int data) |
| 361 | 360 | { |
| 362 | | DBG_LOG(1,"cbm ieee nrfd",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 361 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee nrfd"); |
| 362 | mame_printf_debug("%.4x dev:%d %d\n", activecpu_get_pc(), device, data); |
| 363 | |
| 363 | 364 | cbmieee.bus[device].nrfd=data; |
| 364 | 365 | if (device==0) c2031_state(cbm_drive); |
| 365 | 366 | } |
| 366 | 367 | |
| 367 | 368 | void cbm_ieee_ndac_w(int device, int data) |
| 368 | 369 | { |
| 369 | | DBG_LOG(1,"cbm ieee ndac",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 370 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee ndac"); |
| 371 | mame_printf_debug("%.4x dev:%d %d\n", activecpu_get_pc(), device, data); |
| 372 | |
| 370 | 373 | cbmieee.bus[device].ndac=data; |
| 371 | 374 | if (device==0) c2031_state(cbm_drive); |
| 372 | 375 | } |
| 373 | 376 | |
| 374 | 377 | void cbm_ieee_atn_w(int device, int data) |
| 375 | 378 | { |
| 376 | | DBG_LOG(1,"cbm ieee atn",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 379 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee atn"); |
| 380 | mame_printf_debug("%.4x dev:%d %d\n", activecpu_get_pc(), device, data); |
| 381 | |
| 377 | 382 | cbmieee.bus[device].atn=data; |
| 378 | 383 | if (device==0) c2031_state(cbm_drive); |
| 379 | 384 | } |
| 380 | 385 | |
| 381 | 386 | void cbm_ieee_eoi_w(int device, int data) |
| 382 | 387 | { |
| 383 | | DBG_LOG(1,"cbm ieee eoi",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 388 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee eoi"); |
| 389 | mame_printf_debug("%.4x dev:%d %d\n", activecpu_get_pc(), device, data); |
| 390 | |
| 384 | 391 | cbmieee.bus[device].eoi=data; |
| 385 | 392 | if (device==0) c2031_state(cbm_drive); |
| 386 | 393 | } |
| 387 | 394 | |
| 388 | 395 | void cbm_ieee_data_w(int device, int data) |
| 389 | 396 | { |
| 390 | | DBG_LOG(1,"cbm ieee data",("%.4x dev:%d %.2x\n", activecpu_get_pc(), device, data)); |
| 397 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee data"); |
| 398 | mame_printf_debug("%.4x dev:%d %.2x\n", activecpu_get_pc(), device, data); |
| 399 | |
| 391 | 400 | cbmieee.bus[device].data=data; |
| 392 | 401 | if (device==0) c2031_state(cbm_drive); |
| 393 | 402 | } |
| r3156 | r3157 | |
| 395 | 404 | int cbm_ieee_srq_r(void) |
| 396 | 405 | { |
| 397 | 406 | int data=cbmieee.bus[1].srq; |
| 398 | | DBG_LOG(1,"cbm ieee srq",("read %d\n", data)); |
| 407 | |
| 408 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee srq"); |
| 409 | mame_printf_debug("read %d\n", data); |
| 410 | |
| 399 | 411 | return data; |
| 400 | 412 | } |
| 401 | 413 | |
| 402 | 414 | int cbm_ieee_dav_r(void) |
| 403 | 415 | { |
| 404 | 416 | int data=cbmieee.bus[0].dav&&cbmieee.bus[1].dav; |
| 405 | | DBG_LOG(1,"cbm ieee dav",("read %d\n", data)); |
| 417 | |
| 418 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee dav"); |
| 419 | mame_printf_debug("read %d\n", data); |
| 420 | |
| 406 | 421 | return data; |
| 407 | 422 | } |
| 408 | 423 | |
| 409 | 424 | int cbm_ieee_nrfd_r(void) |
| 410 | 425 | { |
| 411 | 426 | int data=cbmieee.bus[0].nrfd && cbmieee.bus[1].nrfd; |
| 412 | | DBG_LOG(1,"cbm ieee nrfd",("read %d\n", data)); |
| 427 | |
| 428 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee nrfd"); |
| 429 | mame_printf_debug("read %d\n", data); |
| 430 | |
| 413 | 431 | return data; |
| 414 | 432 | } |
| 415 | 433 | |
| 416 | 434 | int cbm_ieee_ndac_r(void) |
| 417 | 435 | { |
| 418 | 436 | int data=cbmieee.bus[0].ndac&&cbmieee.bus[1].ndac; |
| 419 | | DBG_LOG(1,"cbm ieee ndac",("read %d\n", data)); |
| 437 | |
| 438 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee ndac"); |
| 439 | mame_printf_debug("read %d\n", data); |
| 440 | |
| 420 | 441 | return data; |
| 421 | 442 | } |
| 422 | 443 | |
| 423 | 444 | int cbm_ieee_atn_r(void) |
| 424 | 445 | { |
| 425 | 446 | int data=cbmieee.bus[0].atn&&cbmieee.bus[1].atn; |
| 426 | | DBG_LOG(1,"cbm ieee atn",("read %d\n", data)); |
| 447 | |
| 448 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee atn"); |
| 449 | mame_printf_debug("read %d\n", data); |
| 450 | |
| 427 | 451 | return data; |
| 428 | 452 | } |
| 429 | 453 | |
| 430 | 454 | int cbm_ieee_eoi_r(void) |
| 431 | 455 | { |
| 432 | 456 | int data=cbmieee.bus[0].eoi&&cbmieee.bus[1].eoi; |
| 433 | | /* DBG_LOG(1,"cbm ieee eoi",("read %d\n", data)); */ |
| 457 | |
| 458 | // mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee eoi"); |
| 459 | // mame_printf_debug("read %d\n", data)); |
| 460 | |
| 434 | 461 | return data; |
| 435 | 462 | } |
| 436 | 463 | |
| 437 | 464 | int cbm_ieee_data_r(void) |
| 438 | 465 | { |
| 439 | 466 | int data=cbmieee.bus[0].data&cbmieee.bus[1].data; |
| 440 | | DBG_LOG(1,"cbm ieee data",("read %.2x\n", data)); |
| 467 | |
| 468 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "cbm ieee data"); |
| 469 | mame_printf_debug("read %.2x\n", data); |
| 470 | |
| 441 | 471 | return data; |
| 442 | 472 | } |
| 443 | 473 | |
src/mess/machine/tpi6525.c
| r3156 | r3157 | |
| 74 | 74 | #include <ctype.h> |
| 75 | 75 | #include "driver.h" |
| 76 | 76 | |
| 77 | | #define VERBOSE_DBG 1 |
| 78 | | #include "includes/cbm.h" |
| 79 | | |
| 80 | 77 | #include "tpi6525.h" |
| 81 | 78 | |
| 82 | 79 | TPI6525 tpi6525[4]={ |
| r3156 | r3157 | |
| 116 | 113 | { |
| 117 | 114 | if (!This->interrupt.level && (This->air!=0)) { |
| 118 | 115 | This->interrupt.level=1; |
| 119 | | DBG_LOG (3, "tpi6525",("%d set interrupt\n",This->number)); |
| 116 | |
| 117 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 118 | mame_printf_debug("%d set interrupt\n",This->number); |
| 119 | |
| 120 | 120 | if (This->interrupt.output!=NULL) |
| 121 | 121 | This->interrupt.output(machine, This->interrupt.level); |
| 122 | 122 | } |
| r3156 | r3157 | |
| 126 | 126 | { |
| 127 | 127 | if (This->interrupt.level && (This->air==0)) { |
| 128 | 128 | This->interrupt.level=0; |
| 129 | | DBG_LOG (3, "tpi6525",("%d clear interrupt\n",This->number)); |
| 129 | |
| 130 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 131 | mame_printf_debug("%d clear interrupt\n",This->number); |
| 132 | |
| 130 | 133 | if (This->interrupt.output!=NULL) |
| 131 | 134 | This->interrupt.output(machine, This->interrupt.level); |
| 132 | 135 | } |
| r3156 | r3157 | |
| 266 | 269 | if (This->c.read) data&=This->c.read(); |
| 267 | 270 | data=(data&~This->c.ddr)|(This->c.ddr&This->c.port); |
| 268 | 271 | } |
| 269 | | DBG_LOG (2, "tpi6525", |
| 270 | | ("%d read %.2x %.2x\n",This->number, offset,data)); |
| 272 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 273 | mame_printf_debug("%d read %.2x %.2x\n",This->number, offset,data); |
| 271 | 274 | break; |
| 272 | 275 | case 3: |
| 273 | 276 | data=This->a.ddr; |
| r3156 | r3157 | |
| 306 | 309 | tpi6525_clear_interrupt(machine, This); |
| 307 | 310 | break; |
| 308 | 311 | } |
| 309 | | DBG_LOG (3, "tpi6525", |
| 310 | | ("%d read %.2x %.2x\n",This->number, offset,data)); |
| 312 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 313 | mame_printf_debug("%d read %.2x %.2x\n",This->number, offset,data); |
| 311 | 314 | return data; |
| 312 | 315 | } |
| 313 | 316 | |
| 314 | 317 | static void tpi6525_port_w(running_machine *machine, TPI6525 *This, int offset, int data) |
| 315 | 318 | { |
| 316 | | DBG_LOG (2, "tpi6525", |
| 317 | | ("%d write %.2x %.2x\n",This->number, offset,data)); |
| 319 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 320 | mame_printf_debug("%d write %.2x %.2x\n",This->number, offset,data); |
| 318 | 321 | |
| 319 | 322 | switch (offset&7) { |
| 320 | 323 | case 0: |
src/mess/machine/c64.c
| r3156 | r3157 | |
| 29 | 29 | #include "machine/6526cia.h" |
| 30 | 30 | #include "deprecat.h" |
| 31 | 31 | |
| 32 | | #define VERBOSE_DBG 1 |
| 33 | 32 | #include "includes/cbm.h" |
| 34 | 33 | #include "includes/cbmserb.h" |
| 35 | 34 | #include "includes/vc1541.h" |
| r3156 | r3157 | |
| 311 | 310 | |
| 312 | 311 | if (level != old_level) |
| 313 | 312 | { |
| 314 | | DBG_LOG (3, "mos6510", ("irq %s\n", level ? "start" : "end")); |
| 313 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "mos6510"); |
| 314 | mame_printf_debug("irq %s\n", level ? "start" : "end"); |
| 315 | |
| 315 | 316 | if (is_c128(machine)) |
| 316 | 317 | { |
| 317 | 318 | if (0 && (cpu_getactivecpu() == 0)) |
| r3156 | r3157 | |
| 446 | 447 | if (c64_cia1_on) |
| 447 | 448 | cia_1_w(machine, offset, data); |
| 448 | 449 | else |
| 449 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data)); |
| 450 | { |
| 451 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 452 | mame_printf_debug("%.3x %.2x\n", offset, data); |
| 453 | } |
| 450 | 454 | } |
| 451 | 455 | else if (offset < 0xf00) |
| 452 | 456 | { |
| 453 | 457 | /* i/o 1 */ |
| 454 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data)); |
| 458 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 459 | mame_printf_debug("%.3x %.2x\n", offset, data); |
| 455 | 460 | } |
| 456 | 461 | else |
| 457 | 462 | { |
| 458 | 463 | /* i/o 2 */ |
| 459 | | DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data)); |
| 464 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io write"); |
| 465 | mame_printf_debug("%.3x %.2x\n", offset, data); |
| 460 | 466 | } |
| 461 | 467 | } |
| 462 | 468 | |
| r3156 | r3157 | |
| 501 | 507 | else if (c64_cia1_on && (offset < 0xe00)) |
| 502 | 508 | return cia_1_r(machine, offset); |
| 503 | 509 | |
| 504 | | DBG_LOG (1, "io read", ("%.3x\n", offset)); |
| 510 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "io read"); |
| 511 | mame_printf_debug("%.3x\n", offset); |
| 505 | 512 | |
| 506 | 513 | return 0xff; |
| 507 | 514 | } |
| r3156 | r3157 | |
| 640 | 647 | if (!c64_game && c64_exrom) |
| 641 | 648 | ultimax_mode = 1; |
| 642 | 649 | |
| 643 | | DBG_LOG (1, "bankswitch", ("%d\n", data & 7)); |
| 650 | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "bankswitch"); |
| 651 | mame_printf_debug("%d\n", data & 0x07); |
| 652 | |
| 644 | 653 | loram = (data & 1) ? 1 : 0; |
| 645 | 654 | hiram = (data & 2) ? 1 : 0; |
| 646 | 655 | charen = (data & 4) ? 1 : 0; |