Previous 199869 Revisions Next

r33200 Tuesday 4th November, 2014 at 20:07:31 UTC by hap
improved cpu clock and speaker lvl
[src/mess/drivers]merlin.c

trunk/src/mess/drivers/merlin.c
r241711r241712
1313
1414  TODO:
1515  - accurate rc osc
16  - accurate speaker levels (tone pitch sounds good though)
1617  - is the rom dump good?
1718
1819***************************************************************************/
r241711r241712
2324
2425#include "merlin.lh"
2526
26// master clock is a single stage RC oscillator: R=?, C=?
27#define MERLIN_RC_CLOCK (500000)
27// master clock is a single stage RC oscillator: R=27K, C=100pf
28// this is an approximation compared with recordings
29#define MERLIN_RC_CLOCK (355000)
2830
2931
3032class merlin_state : public driver_device
r241711r241712
3739      m_speaker(*this, "speaker")
3840   { }
3941
42   DECLARE_READ8_MEMBER(read_k);
43   DECLARE_WRITE16_MEMBER(write_o);
44   DECLARE_WRITE16_MEMBER(write_r);
45
46   virtual void machine_start();
47
48protected:
4049   required_device<cpu_device> m_maincpu;
4150   required_ioport_array<4> m_button_matrix;
4251   required_device<speaker_sound_device> m_speaker;
4352
4453   UINT16 m_o;
45
46   DECLARE_READ8_MEMBER(read_k);
47   DECLARE_WRITE16_MEMBER(write_o);
48   DECLARE_WRITE16_MEMBER(write_r);
49
50   virtual void machine_start();
5154};
5255
5356
r241711r241712
9497
9598WRITE16_MEMBER(merlin_state::write_o)
9699{
97   // O0-O3: input mux
98   m_o = data;
99
100100   /* The speaker is connected to O4 through O6.  The 3 outputs are paralleled for
101101   increased current driving capability.  They are passed thru a 220 ohm resistor
102102   and then to the speaker, which has the other side grounded.  The software then
103103   toggles these lines to make sounds and noises. (There is no audio generator
104104   other than toggling it with a software delay between to make tones). */
105   m_speaker->level_w(m_o & 0x70);
105   static const int count[8] = { 0, 1, 1, 2, 1, 2, 2, 3 };
106   m_speaker->level_w(count[data >> 4 & 7]);
107
108   // O0-O3: input mux
109   // O7: N/C
110   m_o = data;
106111}
107112
108113WRITE16_MEMBER(merlin_state::write_r)
r241711r241712
177182   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
178183};
179184
185static const INT16 speaker_levels[] = { 0, 32767, 0, 32767 }; // unknown too, due to output_pla being unknown
180186
187
181188static MACHINE_CONFIG_START( merlin, merlin_state )
182189
183190   /* basic machine hardware */
r241711r241712
194201   /* sound hardware */
195202   MCFG_SPEAKER_STANDARD_MONO("mono")
196203   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
204   MCFG_SPEAKER_LEVELS(4, speaker_levels)
197205   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
198206MACHINE_CONFIG_END
199207


Previous 199869 Revisions Next


© 1997-2024 The MAME Team