src/mess/machine/c2040.c
| r7311 | r7312 | |
| 622 | 622 | |
| 623 | 623 | */ |
| 624 | 624 | |
| 625 | | /* TODO active led 1 */ |
| 625 | /* TODO activity led 1 */ |
| 626 | 626 | |
| 627 | | /* TODO active led 0 */ |
| 627 | /* TODO activity led 0 */ |
| 628 | 628 | |
| 629 | 629 | /* TODO error led */ |
| 630 | 630 | } |
| r7311 | r7312 | |
| 667 | 667 | { |
| 668 | 668 | if (c2040->unit[unit].mtr != mtr) |
| 669 | 669 | { |
| 670 | | if (mtr) |
| 670 | if (!mtr) |
| 671 | 671 | { |
| 672 | 672 | /* read track data */ |
| 673 | 673 | read_current_track(c2040, unit); |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | | floppy_mon_w(c2040->unit[unit].image, !mtr); |
| 676 | floppy_mon_w(c2040->unit[unit].image, mtr); |
| 677 | 677 | |
| 678 | 678 | c2040->unit[unit].mtr = mtr; |
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | | static void micropolis_step_motor(c2040_t *c2040, int unit, int stp) |
| 682 | static void micropolis_step_motor(c2040_t *c2040, int unit, int mtr, int stp) |
| 683 | 683 | { |
| 684 | | if (c2040->unit[unit].stp != stp) |
| 684 | if (!mtr && (c2040->unit[unit].stp != stp)) |
| 685 | 685 | { |
| 686 | 686 | int tracks = 0; |
| 687 | 687 | |
| r7311 | r7312 | |
| 771 | 771 | |
| 772 | 772 | c2040_t *c2040 = get_safe_token(device->owner); |
| 773 | 773 | |
| 774 | | /* stepper motor 1 */ |
| 775 | | int s1 = data & 0x03; |
| 776 | | micropolis_step_motor(c2040, 1, s1); |
| 777 | | |
| 778 | | /* stepper motor 0 */ |
| 779 | | int s0 = (data >> 2) & 0x03; |
| 780 | | micropolis_step_motor(c2040, 0, s0); |
| 781 | | |
| 782 | 774 | /* spindle motor 1 */ |
| 783 | 775 | int mtr1 = BIT(data, 4); |
| 784 | 776 | spindle_motor(c2040, 1, mtr1); |
| r7311 | r7312 | |
| 787 | 779 | int mtr0 = BIT(data, 5); |
| 788 | 780 | spindle_motor(c2040, 0, mtr0); |
| 789 | 781 | |
| 790 | | timer_enable(c2040->bit_timer, mtr1 | mtr0); |
| 782 | /* stepper motor 1 */ |
| 783 | int s1 = data & 0x03; |
| 784 | micropolis_step_motor(c2040, 1, mtr1, s1); |
| 785 | |
| 786 | /* stepper motor 0 */ |
| 787 | int s0 = (data >> 2) & 0x03; |
| 788 | micropolis_step_motor(c2040, 0, mtr0, s0); |
| 789 | |
| 790 | timer_enable(c2040->bit_timer, !mtr1 | !mtr0); |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | static READ_LINE_DEVICE_HANDLER( ready_r ) |
| r7311 | r7312 | |
| 938 | 938 | int s0 = (data >> 2) & 0x03; |
| 939 | 939 | mpi_step_motor(c2040, 0, mtr0, s0); |
| 940 | 940 | |
| 941 | | timer_enable(c2040->bit_timer, mtr1 | mtr0); |
| 942 | | |
| 943 | | /* TODO pull sync */ |
| 941 | timer_enable(c2040->bit_timer, !mtr1 | !mtr0); |
| 944 | 942 | } |
| 945 | 943 | |
| 946 | 944 | static const via6522_interface c8050_via_intf = |
| r7311 | r7312 | |
| 1563 | 1561 | /* toggle M6502 SO */ |
| 1564 | 1562 | cpu_set_input_line(c2040->cpu_dos, M6502_SET_OVERFLOW, ASSERT_LINE); |
| 1565 | 1563 | cpu_set_input_line(c2040->cpu_dos, M6502_SET_OVERFLOW, CLEAR_LINE); |
| 1564 | |
| 1565 | /* turn off spindle motors */ |
| 1566 | c2040->unit[0].mtr = c2040->unit[1].mtr = 1; |
| 1566 | 1567 | } |
| 1567 | 1568 | |
| 1568 | 1569 | /*------------------------------------------------- |