src/emu/machine/68681.c
| r15188 | r15189 | |
| 562 | 562 | duart68681->duart_timer->adjust(rate, 0, rate); |
| 563 | 563 | } |
| 564 | 564 | break; |
| 565 | | case 0x06: /* Timer, CLK/1 */ |
| 566 | | { |
| 567 | | attotime rate = attotime::from_hz(2*device->clock()/(2*16*duart68681->CTR.w.l)); |
| 568 | | duart68681->duart_timer->adjust(rate, 0, rate); |
| 569 | | } |
| 570 | | break; |
| 571 | | case 0x07: /* Timer, CLK/16 */ |
| 572 | | { |
| 573 | | //double hz; |
| 574 | | //attotime rate = attotime::from_hz(duart68681->clock) * (16*duart68681->CTR.w.l); |
| 575 | | attotime rate = attotime::from_hz(2*device->clock()/(2*16*16*duart68681->CTR.w.l)); |
| 576 | | //hz = ATTOSECONDS_TO_HZ(rate.attoseconds); |
| 577 | | |
| 578 | | // workaround for maygay1b locking up MAME |
| 579 | | if ((2*device->clock()/(2*16*16*duart68681->CTR.w.l)) == 0) |
| 580 | | { |
| 581 | | rate = attotime::from_hz(1); |
| 582 | | } |
| 583 | | |
| 584 | | duart68681->duart_timer->adjust(rate, 0, rate); |
| 585 | | } |
| 586 | | break; |
| 587 | 565 | } |
| 588 | 566 | break; |
| 589 | 567 | case 0x0f: /* Stop counter command */ |
| r15188 | r15189 | |
| 631 | 609 | case 0: case 1: case 2: case 4: case 5: // TODO: handle these cases! |
| 632 | 610 | logerror( "68681 (%s): Unhandled timer/counter mode %d\n", device->tag(), (data >> 4) & 0x07); |
| 633 | 611 | break; |
| 634 | | case 3: case 6: case 7: |
| 612 | case 3: |
| 635 | 613 | break; |
| 614 | case 0x06: /* Timer, CLK/1 */ // Timer modes start without reading address 0xe, as per the Freescale 68681 manual |
| 615 | { |
| 616 | attotime rate = attotime::from_hz(2*device->clock()/(2*16*duart68681->CTR.w.l)); |
| 617 | duart68681->duart_timer->adjust(rate, 0, rate); |
| 618 | } |
| 619 | break; |
| 620 | case 0x07: /* Timer, CLK/16 */ |
| 621 | { |
| 622 | //double hz; |
| 623 | //attotime rate = attotime::from_hz(duart68681->clock) * (16*duart68681->CTR.w.l); |
| 624 | attotime rate = attotime::from_hz(2*device->clock()/(2*16*16*duart68681->CTR.w.l)); |
| 625 | //hz = ATTOSECONDS_TO_HZ(rate.attoseconds); |
| 626 | |
| 627 | // workaround for maygay1b locking up MAME |
| 628 | if ((2*device->clock()/(2*16*16*duart68681->CTR.w.l)) == 0) |
| 629 | { |
| 630 | rate = attotime::from_hz(1); |
| 631 | } |
| 632 | |
| 633 | duart68681->duart_timer->adjust(rate, 0, rate); |
| 634 | } |
| 635 | break; |
| 636 | 636 | } |
| 637 | 637 | duart68681_write_CSR(duart68681, 0, duart68681->channel[0].CSR, data); |
| 638 | 638 | duart68681_write_CSR(duart68681, 1, duart68681->channel[1].CSR, data); |