Previous 15994 Revisions Next

r12935 Sunday 25th September, 2011 at 19:03:32 UTC by Sandro Ronco
[KC] Fixed sound and added cassette save. (no whatsnew)
[src/mess/includes]kc.h
[src/mess/machine]kc.c

src/mess/machine/kc.c
r12934r12935
236236
237237void kc_state::cassette_set_motor(int motor_state)
238238{
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)
241243   {
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);
255246   }
256
257   /* store new state */
258   m_cassette_motor_state = motor_state;
247   else
248   {
249      /* stop timer */
250      m_cassette_timer->reset();
251   }
259252}
260253
261254/*
r12934r12935
617610   update_0x08000();
618611
619612   /* 16 speaker levels */
620   int speaker_level = (data>>1) & 0x0f;
613   m_speaker_level = (data>>1) & 0x0f;
621614
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();
625616}
626617
627618/* port 0x84/0x85:
r12934r12935
700691/* used in cassette write -> K0 */
701692WRITE_LINE_MEMBER( kc_state::ctc_zc0_callback )
702693{
703
694   if (state)
695   {
696      m_k0_line^=1;
697      speaker_update();
698   }
704699}
705700
706701/* used in cassette write -> K1 */
707702WRITE_LINE_MEMBER( kc_state::ctc_zc1_callback)
708703{
704   if (state)
705   {
706      m_k1_line^=1;
707      speaker_update();
709708
709      // K1 line is also cassette output
710      m_cassette->output((m_k1_line & 1) ? +1 : -1);
711   }
712
710713}
711714
712715static TIMER_CALLBACK(kc85_15khz_timer_callback )
r12934r12935
745748   }
746749}
747750
751void 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}
748756
749757/* keyboard callback */
750758WRITE_LINE_MEMBER( kc_state::keyboard_cb )
r12934r12935
791799   // set low resolution at reset
792800   m_high_resolution = 0;
793801
802   cassette_set_motor(0);
803
794804   /* this is temporary. Normally when a Z80 is reset, it will
795805    execute address 0. It appears the KC85 series pages the rom
796806    at address 0x0000-0x01000 which has a single jump in it,
src/mess/includes/kc.h
r12934r12935
109109   // cassette
110110   void cassette_set_motor(int motor_state);
111111
112   // speaker
113   void speaker_update();
114
112115   // defined in video/kc.c
113116   virtual void video_start();
114117
r12934r12935
116119   UINT8 *            m_ram_base;
117120   int             m_pio_data[2];
118121   emu_timer *         m_cassette_timer;
119   int             m_cassette_motor_state;
120122   int               m_high_resolution;
121123   UINT8            m_ardy;
122124   UINT8            m_brdy;
123125   int             m_kc85_50hz_state;
124126   int             m_kc85_15khz_state;
125127   int               m_kc85_blink_state;
128   int               m_k0_line;
129   int               m_k1_line;
130   UINT8            m_speaker_level;
126131
127132   kcexp_slot_device *   m_expansions[3];
128133};

Previous 15994 Revisions Next


© 1998-2018 The MESS Team