src/mess/machine/kc.c
| r12934 | r12935 | |
| 236 | 236 | |
| 237 | 237 | void kc_state::cassette_set_motor(int motor_state) |
| 238 | 238 | { |
| 239 | | /* state changed? */ |
| 240 | | if (((m_cassette_motor_state^motor_state)&0x01) != 0) |
| 239 | /* set new motor state in cassette device */ |
| 240 | m_cassette->change_state(motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 241 | |
| 242 | if (motor_state) |
| 241 | 243 | { |
| 242 | | /* set new motor state in cassette device */ |
| 243 | | m_cassette->change_state(motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 244 | | |
| 245 | | if (motor_state) |
| 246 | | { |
| 247 | | /* start timer */ |
| 248 | | m_cassette_timer->adjust(attotime::zero, 0, KC_CASSETTE_TIMER_FREQUENCY); |
| 249 | | } |
| 250 | | else |
| 251 | | { |
| 252 | | /* stop timer */ |
| 253 | | m_cassette_timer->reset(); |
| 254 | | } |
| 244 | /* start timer */ |
| 245 | m_cassette_timer->adjust(attotime::zero, 0, KC_CASSETTE_TIMER_FREQUENCY); |
| 255 | 246 | } |
| 256 | | |
| 257 | | /* store new state */ |
| 258 | | m_cassette_motor_state = motor_state; |
| 247 | else |
| 248 | { |
| 249 | /* stop timer */ |
| 250 | m_cassette_timer->reset(); |
| 251 | } |
| 259 | 252 | } |
| 260 | 253 | |
| 261 | 254 | /* |
| r12934 | r12935 | |
| 617 | 610 | update_0x08000(); |
| 618 | 611 | |
| 619 | 612 | /* 16 speaker levels */ |
| 620 | | int speaker_level = (data>>1) & 0x0f; |
| 613 | m_speaker_level = (data>>1) & 0x0f; |
| 621 | 614 | |
| 622 | | /* this might not be correct, the range might |
| 623 | | be logarithmic and not linear! */ |
| 624 | | speaker_level_w(m_speaker, (speaker_level<<4)); |
| 615 | speaker_update(); |
| 625 | 616 | } |
| 626 | 617 | |
| 627 | 618 | /* port 0x84/0x85: |
| r12934 | r12935 | |
| 700 | 691 | /* used in cassette write -> K0 */ |
| 701 | 692 | WRITE_LINE_MEMBER( kc_state::ctc_zc0_callback ) |
| 702 | 693 | { |
| 703 | | |
| 694 | if (state) |
| 695 | { |
| 696 | m_k0_line^=1; |
| 697 | speaker_update(); |
| 698 | } |
| 704 | 699 | } |
| 705 | 700 | |
| 706 | 701 | /* used in cassette write -> K1 */ |
| 707 | 702 | WRITE_LINE_MEMBER( kc_state::ctc_zc1_callback) |
| 708 | 703 | { |
| 704 | if (state) |
| 705 | { |
| 706 | m_k1_line^=1; |
| 707 | speaker_update(); |
| 709 | 708 | |
| 709 | // K1 line is also cassette output |
| 710 | m_cassette->output((m_k1_line & 1) ? +1 : -1); |
| 711 | } |
| 712 | |
| 710 | 713 | } |
| 711 | 714 | |
| 712 | 715 | static TIMER_CALLBACK(kc85_15khz_timer_callback ) |
| r12934 | r12935 | |
| 745 | 748 | } |
| 746 | 749 | } |
| 747 | 750 | |
| 751 | void kc_state::speaker_update() |
| 752 | { |
| 753 | /* this might not be correct, the range might be logarithmic and not linear! */ |
| 754 | speaker_level_w(m_speaker, m_k0_line ? (m_speaker_level | (m_k1_line ? 0x01 : 0)) : 0); |
| 755 | } |
| 748 | 756 | |
| 749 | 757 | /* keyboard callback */ |
| 750 | 758 | WRITE_LINE_MEMBER( kc_state::keyboard_cb ) |
| r12934 | r12935 | |
| 791 | 799 | // set low resolution at reset |
| 792 | 800 | m_high_resolution = 0; |
| 793 | 801 | |
| 802 | cassette_set_motor(0); |
| 803 | |
| 794 | 804 | /* this is temporary. Normally when a Z80 is reset, it will |
| 795 | 805 | execute address 0. It appears the KC85 series pages the rom |
| 796 | 806 | at address 0x0000-0x01000 which has a single jump in it, |