trunk/src/emu/machine/6522via.c
| r19625 | r19626 | |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | | attotime via6522_device::cycles_to_time(int c) |
| 122 | | { |
| 123 | | return attotime::from_hz(clock()) * c; |
| 124 | | } |
| 125 | 121 | |
| 126 | | |
| 127 | | UINT32 via6522_device::time_to_cycles(attotime t) |
| 128 | | { |
| 129 | | return (t * clock()).as_double(); |
| 130 | | } |
| 131 | | |
| 132 | | |
| 133 | 122 | UINT16 via6522_device::get_counter1_value() |
| 134 | 123 | { |
| 135 | 124 | UINT16 val; |
| 136 | 125 | |
| 137 | 126 | if(m_t1_active) |
| 138 | 127 | { |
| 139 | | val = time_to_cycles(m_t1->remaining()) - IFR_DELAY; |
| 128 | val = attotime_to_clocks(m_t1->remaining()) - IFR_DELAY; |
| 140 | 129 | } |
| 141 | 130 | else |
| 142 | 131 | { |
| 143 | | val = 0xffff - time_to_cycles(machine().time() - m_time1); |
| 132 | val = 0xffff - attotime_to_clocks(machine().time() - m_time1); |
| 144 | 133 | } |
| 145 | 134 | |
| 146 | 135 | return val; |
| r19625 | r19626 | |
| 369 | 358 | if (m_shift_counter) |
| 370 | 359 | { |
| 371 | 360 | if (SO_O2_CONTROL(m_acr)) { |
| 372 | | m_shift_timer->adjust(cycles_to_time(2)); |
| 361 | m_shift_timer->adjust(clocks_to_attotime(2)); |
| 373 | 362 | } else { |
| 374 | | m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2)); |
| 363 | m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); |
| 375 | 364 | } |
| 376 | 365 | } |
| 377 | 366 | else |
| r19625 | r19626 | |
| 419 | 408 | if (m_shift_counter) |
| 420 | 409 | { |
| 421 | 410 | if (SI_O2_CONTROL(m_acr)) { |
| 422 | | m_shift_timer->adjust(cycles_to_time(2)); |
| 411 | m_shift_timer->adjust(clocks_to_attotime(2)); |
| 423 | 412 | } else { |
| 424 | | m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2)); |
| 413 | m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); |
| 425 | 414 | } |
| 426 | 415 | } |
| 427 | 416 | else |
| r19625 | r19626 | |
| 472 | 461 | { |
| 473 | 462 | m_out_b ^= 0x80; |
| 474 | 463 | } |
| 475 | | m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY)); |
| 464 | m_t1->adjust(clocks_to_attotime(TIMER1_VALUE + IFR_DELAY)); |
| 476 | 465 | } |
| 477 | 466 | else |
| 478 | 467 | { |
| r19625 | r19626 | |
| 570 | 559 | logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", machine().describe_context(), tag()); |
| 571 | 560 | } |
| 572 | 561 | } |
| 562 | |
| 563 | /* combine input and output values */ |
| 564 | val = (m_out_a & m_ddr_a) + (m_in_a & ~m_ddr_a); |
| 573 | 565 | } |
| 566 | else |
| 567 | { |
| 568 | val = m_in_a; |
| 569 | } |
| 574 | 570 | |
| 575 | | /* combine input and output values */ |
| 576 | | val = (m_out_a & m_ddr_a) + (m_in_a & ~m_ddr_a); |
| 577 | | |
| 578 | 571 | CLR_PA_INT(); |
| 579 | 572 | |
| 580 | 573 | /* If CA2 is configured as output and in pulse or handshake mode, |
| r19625 | r19626 | |
| 585 | 578 | m_out_ca2_func(0); |
| 586 | 579 | m_out_ca2 = 0; |
| 587 | 580 | |
| 588 | | m_ca2_timer->adjust(cycles_to_time(1)); |
| 581 | m_ca2_timer->adjust(clocks_to_attotime(1)); |
| 589 | 582 | } |
| 590 | 583 | /* If CA2 is configured as output and in pulse or handshake mode, |
| 591 | 584 | CA2 is set now */ |
| r19625 | r19626 | |
| 650 | 643 | clear_int(INT_T2); |
| 651 | 644 | if (m_t2_active) |
| 652 | 645 | { |
| 653 | | val = time_to_cycles(m_t2->remaining()) & 0xff; |
| 646 | val = attotime_to_clocks(m_t2->remaining()) & 0xff; |
| 654 | 647 | } |
| 655 | 648 | else |
| 656 | 649 | { |
| r19625 | r19626 | |
| 660 | 653 | } |
| 661 | 654 | else |
| 662 | 655 | { |
| 663 | | val = (0x10000 - (time_to_cycles(machine().time() - m_time2) & 0xffff) - 1) & 0xff; |
| 656 | val = (0x10000 - (attotime_to_clocks(machine().time() - m_time2) & 0xffff) - 1) & 0xff; |
| 664 | 657 | } |
| 665 | 658 | } |
| 666 | 659 | break; |
| r19625 | r19626 | |
| 668 | 661 | case VIA_T2CH: |
| 669 | 662 | if (m_t2_active) |
| 670 | 663 | { |
| 671 | | val = time_to_cycles(m_t2->remaining()) >> 8; |
| 664 | val = attotime_to_clocks(m_t2->remaining()) >> 8; |
| 672 | 665 | } |
| 673 | 666 | else |
| 674 | 667 | { |
| r19625 | r19626 | |
| 678 | 671 | } |
| 679 | 672 | else |
| 680 | 673 | { |
| 681 | | val = (0x10000 - (time_to_cycles(machine().time() - m_time2) & 0xffff) - 1) >> 8; |
| 674 | val = (0x10000 - (attotime_to_clocks(machine().time() - m_time2) & 0xffff) - 1) >> 8; |
| 682 | 675 | } |
| 683 | 676 | } |
| 684 | 677 | break; |
| r19625 | r19626 | |
| 689 | 682 | clear_int(INT_SR); |
| 690 | 683 | if (SI_O2_CONTROL(m_acr)) |
| 691 | 684 | { |
| 692 | | m_shift_timer->adjust(cycles_to_time(2)); |
| 685 | m_shift_timer->adjust(clocks_to_attotime(2)); |
| 693 | 686 | } |
| 694 | 687 | if (SI_T2_CONTROL(m_acr)) |
| 695 | 688 | { |
| 696 | | m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2)); |
| 689 | m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); |
| 697 | 690 | } |
| 698 | 691 | break; |
| 699 | 692 | |
| r19625 | r19626 | |
| 775 | 768 | m_out_ca2_func(0); |
| 776 | 769 | m_out_ca2 = 0; |
| 777 | 770 | |
| 778 | | m_ca2_timer->adjust(cycles_to_time(1)); |
| 771 | m_ca2_timer->adjust(clocks_to_attotime(1)); |
| 779 | 772 | } |
| 780 | 773 | else if (CA2_AUTO_HS(m_pcr)) |
| 781 | 774 | { |
| r19625 | r19626 | |
| 856 | 849 | m_out_b_func(0, write_data); |
| 857 | 850 | } |
| 858 | 851 | } |
| 859 | | m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY)); |
| 852 | m_t1->adjust(clocks_to_attotime(TIMER1_VALUE + IFR_DELAY)); |
| 860 | 853 | m_t1_active = 1; |
| 861 | 854 | break; |
| 862 | 855 | |
| r19625 | r19626 | |
| 872 | 865 | |
| 873 | 866 | if (!T2_COUNT_PB6(m_acr)) |
| 874 | 867 | { |
| 875 | | m_t2->adjust(cycles_to_time(TIMER2_VALUE + IFR_DELAY)); |
| 868 | m_t2->adjust(clocks_to_attotime(TIMER2_VALUE + IFR_DELAY)); |
| 876 | 869 | m_t2_active = 1; |
| 877 | 870 | } |
| 878 | 871 | else |
| 879 | 872 | { |
| 880 | | m_t2->adjust(cycles_to_time(TIMER2_VALUE)); |
| 873 | m_t2->adjust(clocks_to_attotime(TIMER2_VALUE)); |
| 881 | 874 | m_t2_active = 1; |
| 882 | 875 | m_time2 = machine().time(); |
| 883 | 876 | } |
| r19625 | r19626 | |
| 889 | 882 | clear_int(INT_SR); |
| 890 | 883 | if (SO_O2_CONTROL(m_acr)) |
| 891 | 884 | { |
| 892 | | m_shift_timer->adjust(cycles_to_time(2)); |
| 885 | m_shift_timer->adjust(clocks_to_attotime(2)); |
| 893 | 886 | } |
| 894 | 887 | if (SO_T2_CONTROL(m_acr)) |
| 895 | 888 | { |
| 896 | | m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2)); |
| 889 | m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); |
| 897 | 890 | } |
| 898 | 891 | break; |
| 899 | 892 | |
| r19625 | r19626 | |
| 941 | 934 | } |
| 942 | 935 | if (T1_CONTINUOUS(data)) |
| 943 | 936 | { |
| 944 | | m_t1->adjust(cycles_to_time(counter1 + IFR_DELAY)); |
| 937 | m_t1->adjust(clocks_to_attotime(counter1 + IFR_DELAY)); |
| 945 | 938 | m_t1_active = 1; |
| 946 | 939 | } |
| 947 | 940 | } |
trunk/src/mess/machine/c1551.c
| r19625 | r19626 | |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | | /* |
| 11 | | |
| 12 | | TODO: |
| 13 | | |
| 14 | | - byte latching does not match hardware behavior |
| 15 | | (CPU skips data bytes if implemented per schematics) |
| 16 | | |
| 17 | | */ |
| 18 | | |
| 19 | 10 | #include "c1551.h" |
| 20 | 11 | |
| 21 | 12 | |
| r19625 | r19626 | |
| 118 | 109 | |
| 119 | 110 | */ |
| 120 | 111 | |
| 112 | // stepper motor |
| 113 | m_ga->stp_w(data & 0x03); |
| 114 | |
| 121 | 115 | // spindle motor |
| 122 | 116 | m_ga->mtr_w(BIT(data, 2)); |
| 123 | 117 | |
| 124 | | // stepper motor |
| 125 | | m_ga->stp_w(data & 0x03); |
| 126 | | |
| 127 | 118 | // activity LED |
| 128 | 119 | output_set_led_value(LED_ACT, BIT(data, 3)); |
| 129 | 120 | |
| r19625 | r19626 | |
| 175 | 166 | m_tcbm_data = data; |
| 176 | 167 | } |
| 177 | 168 | |
| 169 | READ8_MEMBER( c1551_device::tpi0_r ) |
| 170 | { |
| 171 | UINT8 data = m_tpi0->read(space, offset); |
| 172 | |
| 173 | m_ga->ted_w(0); |
| 174 | m_ga->ted_w(1); |
| 175 | |
| 176 | return data; |
| 177 | } |
| 178 | |
| 179 | WRITE8_MEMBER( c1551_device::tpi0_w ) |
| 180 | { |
| 181 | m_tpi0->write(space, offset, data); |
| 182 | |
| 183 | m_ga->ted_w(0); |
| 184 | m_ga->ted_w(1); |
| 185 | } |
| 186 | |
| 178 | 187 | READ8_MEMBER( c1551_device::tpi0_pc_r ) |
| 179 | 188 | { |
| 180 | 189 | /* |
| r19625 | r19626 | |
| 340 | 349 | |
| 341 | 350 | static ADDRESS_MAP_START( c1551_mem, AS_PROGRAM, 8, c1551_device ) |
| 342 | 351 | AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_RAM |
| 343 | | AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_DEVREADWRITE_LEGACY(M6523_0_TAG, tpi6525_r, tpi6525_w) |
| 352 | AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_READWRITE(tpi0_r, tpi0_w) |
| 344 | 353 | AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(M6510T_TAG, 0) |
| 345 | 354 | ADDRESS_MAP_END |
| 346 | 355 | |
| r19625 | r19626 | |
| 353 | 362 | { |
| 354 | 363 | DEVCB_NULL, |
| 355 | 364 | DEVCB_NULL, |
| 356 | | DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, atni_w) |
| 365 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, c64h156_device, atni_w) |
| 357 | 366 | }; |
| 358 | 367 | |
| 359 | 368 | |
| r19625 | r19626 | |
| 569 | 578 | |
| 570 | 579 | if (tpi1_selected(offset)) |
| 571 | 580 | { |
| 572 | | data = tpi6525_r(m_tpi1, space, offset & 0x07); |
| 581 | data = m_tpi1->read(space, offset & 0x07); |
| 573 | 582 | } |
| 574 | 583 | |
| 575 | 584 | return data; |
| r19625 | r19626 | |
| 584 | 593 | { |
| 585 | 594 | if (tpi1_selected(offset)) |
| 586 | 595 | { |
| 587 | | tpi6525_w(m_tpi1, space, offset & 0x07, data); |
| 596 | m_tpi1->write(space, offset & 0x07, data); |
| 588 | 597 | } |
| 589 | 598 | |
| 590 | 599 | m_exp->cd_w(space, offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h); |
trunk/src/mess/machine/c1571.c
| r19625 | r19626 | |
| 11 | 11 | |
| 12 | 12 | TODO: |
| 13 | 13 | |
| 14 | | - fast serial |
| 14 | - refactor to use wd_fdc and modern floppy |
| 15 | 15 | - 1541/1571 Alignment shows drive speed as 266 rpm, should be 310 |
| 16 | | - CP/M disks |
| 17 | 16 | |
| 18 | 17 | */ |
| 19 | 18 | |
| r19625 | r19626 | |
| 164 | 163 | static ADDRESS_MAP_START( c1571_mem, AS_PROGRAM, 8, base_c1571_device ) |
| 165 | 164 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 166 | 165 | AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write) |
| 167 | | AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write) |
| 166 | AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_READWRITE(via1_r, via1_w) |
| 168 | 167 | AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE_LEGACY(WD1770_TAG, wd17xx_r, wd17xx_w) |
| 169 | 168 | AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x3ff0) AM_DEVREADWRITE(M6526_TAG, mos6526_device, read, write) |
| 170 | 169 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) |
| r19625 | r19626 | |
| 227 | 226 | |
| 228 | 227 | */ |
| 229 | 228 | |
| 229 | // fast serial direction |
| 230 | m_ser_dir = BIT(data, 1); |
| 231 | |
| 232 | // side select |
| 233 | m_ga->set_side(BIT(data, 2)); |
| 234 | |
| 230 | 235 | // 1/2 MHz |
| 231 | 236 | int clock_1_2 = BIT(data, 5); |
| 232 | 237 | |
| r19625 | r19626 | |
| 243 | 248 | m_1_2mhz = clock_1_2; |
| 244 | 249 | } |
| 245 | 250 | |
| 246 | | // fast serial direction |
| 247 | | int ser_dir = BIT(data, 1); |
| 248 | | |
| 249 | | if (m_ser_dir != ser_dir) |
| 250 | | { |
| 251 | | m_ser_dir = ser_dir; |
| 252 | | |
| 253 | | set_iec_data(); |
| 254 | | set_iec_srq(); |
| 255 | | |
| 256 | | m_cia->cnt_w(m_ser_dir || m_bus->srq_r()); |
| 257 | | m_cia->sp_w(m_ser_dir || m_bus->data_r()); |
| 258 | | } |
| 259 | | |
| 260 | | // side select |
| 261 | | m_ga->set_side(BIT(data, 2)); |
| 262 | | |
| 263 | 251 | // attention out |
| 264 | 252 | m_bus->atn_w(this, !BIT(data, 6)); |
| 253 | |
| 254 | update_iec(); |
| 265 | 255 | } |
| 266 | 256 | |
| 267 | 257 | READ8_MEMBER( base_c1571_device::via0_pb_r ) |
| r19625 | r19626 | |
| 318 | 308 | // data out |
| 319 | 309 | m_data_out = BIT(data, 1); |
| 320 | 310 | |
| 311 | // clock out |
| 312 | m_bus->clk_w(this, !BIT(data, 3)); |
| 313 | |
| 321 | 314 | // attention acknowledge |
| 322 | 315 | m_ga->atna_w(BIT(data, 4)); |
| 323 | 316 | |
| 324 | | // clock out |
| 325 | | m_bus->clk_w(this, !BIT(data, 3)); |
| 317 | update_iec(); |
| 326 | 318 | } |
| 327 | 319 | |
| 328 | 320 | READ_LINE_MEMBER( base_c1571_device::atn_in_r ) |
| r19625 | r19626 | |
| 359 | 351 | // via6522_interface via1_intf |
| 360 | 352 | //------------------------------------------------- |
| 361 | 353 | |
| 354 | READ8_MEMBER( base_c1571_device::via1_r ) |
| 355 | { |
| 356 | UINT8 data = m_via1->read(space, offset); |
| 357 | |
| 358 | m_ga->ted_w(!m_1_2mhz); |
| 359 | m_ga->ted_w(1); |
| 360 | |
| 361 | return data; |
| 362 | } |
| 363 | |
| 364 | WRITE8_MEMBER( base_c1571_device::via1_w ) |
| 365 | { |
| 366 | m_via1->write(space, offset, data); |
| 367 | |
| 368 | m_ga->ted_w(!m_1_2mhz); |
| 369 | m_ga->ted_w(1); |
| 370 | } |
| 371 | |
| 362 | 372 | WRITE_LINE_MEMBER( base_c1571_device::via1_irq_w ) |
| 363 | 373 | { |
| 364 | 374 | m_via1_irq = state; |
| r19625 | r19626 | |
| 465 | 475 | |
| 466 | 476 | WRITE_LINE_MEMBER( base_c1571_device::cia_cnt_w ) |
| 467 | 477 | { |
| 468 | | // fast serial clock out |
| 469 | 478 | m_cnt_out = state; |
| 470 | | set_iec_srq(); |
| 479 | update_iec(); |
| 471 | 480 | } |
| 472 | 481 | |
| 473 | 482 | WRITE_LINE_MEMBER( base_c1571_device::cia_sp_w ) |
| 474 | 483 | { |
| 475 | | // fast serial data out |
| 476 | 484 | m_sp_out = state; |
| 477 | | set_iec_data(); |
| 485 | update_iec(); |
| 478 | 486 | } |
| 479 | 487 | |
| 480 | 488 | READ8_MEMBER( base_c1571_device::cia_pb_r ) |
| r19625 | r19626 | |
| 507 | 515 | // C64H156_INTERFACE( ga_intf ) |
| 508 | 516 | //------------------------------------------------- |
| 509 | 517 | |
| 510 | | WRITE_LINE_MEMBER( base_c1571_device::atn_w ) |
| 511 | | { |
| 512 | | set_iec_data(); |
| 513 | | } |
| 514 | | |
| 515 | 518 | WRITE_LINE_MEMBER( base_c1571_device::byte_w ) |
| 516 | 519 | { |
| 517 | | m_maincpu->set_input_line(M6502_SET_OVERFLOW, state); |
| 518 | | |
| 519 | 520 | m_via1->write_ca1(state); |
| 521 | m_maincpu->set_input_line(M6502_SET_OVERFLOW, state); |
| 520 | 522 | } |
| 521 | 523 | |
| 522 | 524 | static C64H156_INTERFACE( ga_intf ) |
| 523 | 525 | { |
| 524 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, atn_w), |
| 525 | 526 | DEVCB_NULL, |
| 527 | DEVCB_NULL, |
| 526 | 528 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, byte_w) |
| 527 | 529 | }; |
| 528 | 530 | |
| r19625 | r19626 | |
| 673 | 675 | |
| 674 | 676 | |
| 675 | 677 | //************************************************************************** |
| 676 | | // INLINE HELPERS |
| 677 | | //************************************************************************** |
| 678 | | |
| 679 | | //------------------------------------------------- |
| 680 | | // base_c1571_device - constructor |
| 681 | | //------------------------------------------------- |
| 682 | | |
| 683 | | inline void base_c1571_device::set_iec_data() |
| 684 | | { |
| 685 | | int data = !m_data_out && !m_ga->atn_r(); |
| 686 | | |
| 687 | | // fast serial data |
| 688 | | if (m_ser_dir) data &= m_sp_out; |
| 689 | | |
| 690 | | m_bus->data_w(this, data); |
| 691 | | } |
| 692 | | |
| 693 | | |
| 694 | | //------------------------------------------------- |
| 695 | | // base_c1571_device - constructor |
| 696 | | //------------------------------------------------- |
| 697 | | |
| 698 | | inline void base_c1571_device::set_iec_srq() |
| 699 | | { |
| 700 | | int srq = 1; |
| 701 | | |
| 702 | | // fast serial clock |
| 703 | | if (m_ser_dir) srq &= m_cnt_out; |
| 704 | | |
| 705 | | m_bus->srq_w(this, srq); |
| 706 | | } |
| 707 | | |
| 708 | | |
| 709 | | |
| 710 | | //************************************************************************** |
| 711 | 678 | // LIVE DEVICE |
| 712 | 679 | //************************************************************************** |
| 713 | 680 | |
| r19625 | r19626 | |
| 809 | 776 | wd17xx_mr_w(m_fdc, 1); |
| 810 | 777 | |
| 811 | 778 | m_sp_out = 1; |
| 812 | | set_iec_data(); |
| 813 | | |
| 814 | 779 | m_cnt_out = 1; |
| 815 | | set_iec_srq(); |
| 780 | |
| 781 | update_iec(); |
| 816 | 782 | } |
| 817 | 783 | |
| 818 | 784 | |
| r19625 | r19626 | |
| 822 | 788 | |
| 823 | 789 | void base_c1571_device::cbm_iec_srq(int state) |
| 824 | 790 | { |
| 825 | | m_cia->cnt_w(m_ser_dir || state); |
| 791 | update_iec(); |
| 826 | 792 | } |
| 827 | 793 | |
| 828 | 794 | |
| r19625 | r19626 | |
| 832 | 798 | |
| 833 | 799 | void base_c1571_device::cbm_iec_atn(int state) |
| 834 | 800 | { |
| 835 | | m_via0->write_ca1(!state); |
| 836 | | m_ga->atni_w(!state); |
| 837 | | |
| 838 | | set_iec_data(); |
| 801 | update_iec(); |
| 839 | 802 | } |
| 840 | 803 | |
| 841 | 804 | |
| r19625 | r19626 | |
| 845 | 808 | |
| 846 | 809 | void base_c1571_device::cbm_iec_data(int state) |
| 847 | 810 | { |
| 848 | | m_cia->sp_w(m_ser_dir || state); |
| 811 | update_iec(); |
| 849 | 812 | } |
| 850 | 813 | |
| 851 | 814 | |
| r19625 | r19626 | |
| 893 | 856 | int wp = floppy_wpt_r(image); |
| 894 | 857 | c1571->m_ga->on_disk_changed(wp); |
| 895 | 858 | } |
| 859 | |
| 860 | |
| 861 | //------------------------------------------------- |
| 862 | // update_iec - |
| 863 | //------------------------------------------------- |
| 864 | |
| 865 | void base_c1571_device::update_iec() |
| 866 | { |
| 867 | m_cia->cnt_w(m_ser_dir || m_bus->srq_r()); |
| 868 | m_cia->sp_w(m_ser_dir || m_bus->data_r()); |
| 869 | |
| 870 | int atn = m_bus->atn_r(); |
| 871 | m_via0->write_ca1(!atn); |
| 872 | m_ga->atni_w(!atn); |
| 873 | |
| 874 | // serial data |
| 875 | int data = !m_data_out && !m_ga->atn_r(); |
| 876 | if (m_ser_dir) data &= m_sp_out; |
| 877 | m_bus->data_w(this, data); |
| 878 | |
| 879 | // fast clock |
| 880 | int srq = 1; |
| 881 | if (m_ser_dir) srq &= m_cnt_out; |
| 882 | m_bus->srq_w(this, srq); |
| 883 | } |
trunk/src/mess/machine/64h156.c
| r19625 | r19626 | |
| 329 | 329 | |
| 330 | 330 | int byte_sync = !(uc1b && m_soe && !uf4_qb); |
| 331 | 331 | |
| 332 | | if (LOG) logerror("BYTE %u SOE %u\n", m_byte_sync, m_soe); |
| 332 | if (LOG) logerror("BYTE %u SOE %u\n", byte_sync, m_soe); |
| 333 | 333 | |
| 334 | 334 | // UD3 |
| 335 | 335 | |
| r19625 | r19626 | |
| 365 | 365 | if (m_byte_sync != byte_sync) |
| 366 | 366 | { |
| 367 | 367 | m_byte_sync = byte_sync; |
| 368 | | m_out_byte_func(m_byte_sync); |
| 368 | |
| 369 | if (m_accl) |
| 370 | { |
| 371 | if (!byte_sync) |
| 372 | { |
| 373 | m_accl_yb = m_ud2; |
| 374 | m_accl_byte_sync = byte_sync; |
| 375 | m_out_byte_func(m_accl_byte_sync); |
| 376 | } |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | m_out_byte_func(m_byte_sync); |
| 381 | } |
| 369 | 382 | } |
| 370 | 383 | |
| 371 | 384 | m_uf4_qb = uf4_qb; |
| r19625 | r19626 | |
| 405 | 418 | m_last_bit_sync(0), |
| 406 | 419 | m_bit_sync(0), |
| 407 | 420 | m_byte_sync(1), |
| 421 | m_accl_byte_sync(1), |
| 408 | 422 | m_block_sync(1), |
| 409 | 423 | m_ue7(0), |
| 410 | 424 | m_ue7_tc(0), |
| 411 | 425 | m_uf4(0), |
| 412 | 426 | m_uf4_qb(0), |
| 413 | 427 | m_ud2(0), |
| 428 | m_accl_yb(0), |
| 414 | 429 | m_u4a(0), |
| 415 | 430 | m_u4b(0), |
| 416 | 431 | m_ue3(0), |
| r19625 | r19626 | |
| 458 | 473 | save_item(NAME(m_last_bit_sync)); |
| 459 | 474 | save_item(NAME(m_bit_sync)); |
| 460 | 475 | save_item(NAME(m_byte_sync)); |
| 476 | save_item(NAME(m_accl_byte_sync)); |
| 461 | 477 | save_item(NAME(m_block_sync)); |
| 462 | 478 | save_item(NAME(m_ue7)); |
| 463 | 479 | save_item(NAME(m_ue7_tc)); |
| 464 | 480 | save_item(NAME(m_uf4)); |
| 465 | 481 | save_item(NAME(m_uf4_qb)); |
| 466 | 482 | save_item(NAME(m_ud2)); |
| 483 | save_item(NAME(m_accl_yb)); |
| 467 | 484 | save_item(NAME(m_u4a)); |
| 468 | 485 | save_item(NAME(m_u4b)); |
| 469 | 486 | save_item(NAME(m_ue3)); |
| r19625 | r19626 | |
| 504 | 521 | |
| 505 | 522 | if (m_soe) |
| 506 | 523 | { |
| 507 | | data = m_ud2; |
| 524 | if (m_accl) |
| 525 | { |
| 526 | data = m_accl_yb; |
| 527 | } |
| 528 | else |
| 529 | { |
| 530 | data = m_ud2; |
| 531 | } |
| 508 | 532 | } |
| 509 | 533 | |
| 510 | | if (LOG) logerror("YB read %02x:%02x\n", m_ud2, data); |
| 534 | if (LOG) logerror("%s YB read %02x:%02x\n", machine().describe_context(), m_ud2, data); |
| 511 | 535 | |
| 512 | 536 | return data; |
| 513 | 537 | } |
| r19625 | r19626 | |
| 558 | 582 | |
| 559 | 583 | READ_LINE_MEMBER( c64h156_device::byte_r ) |
| 560 | 584 | { |
| 561 | | return m_byte_sync; |
| 585 | int state = 1; |
| 586 | |
| 587 | if (m_accl) |
| 588 | { |
| 589 | state = m_accl_byte_sync; |
| 590 | } |
| 591 | else |
| 592 | { |
| 593 | state = m_byte_sync; |
| 594 | } |
| 595 | |
| 596 | return state; |
| 562 | 597 | } |
| 563 | 598 | |
| 564 | 599 | |
| 565 | 600 | //------------------------------------------------- |
| 601 | // ted_w - |
| 602 | //------------------------------------------------- |
| 603 | |
| 604 | WRITE_LINE_MEMBER( c64h156_device::ted_w ) |
| 605 | { |
| 606 | if (m_accl && !m_accl_byte_sync && !state) |
| 607 | { |
| 608 | m_accl_byte_sync = 1; |
| 609 | m_out_byte_func(m_accl_byte_sync); |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | |
| 614 | //------------------------------------------------- |
| 566 | 615 | // mtr_w - motor write |
| 567 | 616 | //------------------------------------------------- |
| 568 | 617 | |
trunk/src/mess/drivers/plus4.c
| r19625 | r19626 | |
| 4 | 4 | |
| 5 | 5 | - cassette motor is turned on only for a moment while LOADing |
| 6 | 6 | - c16 function ROM test fails |
| 7 | | - c1551 won't load anything |
| 8 | 7 | - clean up keyboard handling |
| 9 | 8 | - clean up TED |
| 10 | 9 | - dump PLA |
| r19625 | r19626 | |
| 910 | 909 | MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) |
| 911 | 910 | MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, plus4_datassette_devices, "c1531", NULL) |
| 912 | 911 | MCFG_CBM_IEC_ADD(iec_intf, NULL) |
| 913 | | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, NULL, NULL) |
| 912 | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, "c1551", NULL) |
| 914 | 913 | MCFG_PLUS4_USER_PORT_ADD(PLUS4_USER_PORT_TAG, plus4_user_port_cards, NULL, NULL) |
| 915 | 914 | |
| 916 | 915 | // internal ram |
| r19625 | r19626 | |
| 950 | 949 | MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) |
| 951 | 950 | MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, plus4_datassette_devices, "c1531", NULL) |
| 952 | 951 | MCFG_CBM_IEC_ADD(iec_intf, NULL) |
| 953 | | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, NULL, NULL) |
| 952 | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, "c1551", NULL) |
| 954 | 953 | MCFG_PLUS4_USER_PORT_ADD(PLUS4_USER_PORT_TAG, plus4_user_port_cards, NULL, NULL) |
| 955 | 954 | |
| 956 | 955 | // internal ram |