Previous 15994 Revisions Next

r14930 Saturday 14th April, 2012 at 21:53:48 UTC by Curt Coder
[C64] Cartridge WIP. (nw)
[src/mess/machine]c64_currah_speech.c c64_currah_speech.h

src/mess/machine/c64_currah_speech.c
r14929r14930
6060   --------------
6161
6262   INIT      Initialize the cartridge
63   BYE         Disable the cartridge
6364   KON 0      Enable keyvoices, low voice
6465   KON 1      Enable keyvoices, high voice
6566   KOFF      Disable keyvoices
66   SAY ""      Say words
67   SAY 0/1 ""   Say words
6768
6869*/
6970
r14929r14930
9293
9394ROM_START( c64_currah_speech )
9495   ROM_REGION( 0x10000, SP0256_TAG, 0 )
95   ROM_LOAD( "sp0256a-al2", 0x000, 0x800, CRC(df8de0b0) SHA1(86fb6d9fef955ac0bc76e0c45c66585946d278a1) )
96   ROM_LOAD( "sp0256a-al2", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
9697ROM_END
9798
9899
r14929r14930
123124
124125static MACHINE_CONFIG_FRAGMENT( c64_currah_speech )
125126   MCFG_SPEAKER_STANDARD_MONO("mono")
126   MCFG_SOUND_ADD(SP0256_TAG, SP0256, 1000000) // ???
127   MCFG_SOUND_ADD(SP0256_TAG, SP0256, 4000000) // ???
127128   MCFG_SOUND_CONFIG(sp0256_intf)
128129   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
129130MACHINE_CONFIG_END
r14929r14930
142143
143144
144145//**************************************************************************
146//  INLINE HELPERS
147//**************************************************************************
148
149//-------------------------------------------------
150//  set_osc1 -
151//-------------------------------------------------
152
153void c64_currah_speech_cartridge_device::set_osc1(int voice, int intonation)
154{
155   int dotclock = m_slot->dotclock();
156
157   // TODO SP0256 does not handle clock change
158   // TODO intonation
159   m_nsp->set_unscaled_clock(dotclock / (2 << voice));
160}
161
162
163
164//**************************************************************************
145165//  LIVE DEVICE
146166//**************************************************************************
147167
r14929r14930
152172c64_currah_speech_cartridge_device::c64_currah_speech_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
153173   device_t(mconfig, C64_CURRAH_SPEECH, "C64 Currah Speech", tag, owner, clock),
154174   device_c64_expansion_card_interface(mconfig, *this),
155   m_nsp(*this, SP0256_TAG),
156   m_rom_en(0)
175   m_nsp(*this, SP0256_TAG)
157176{
158177}
159178
r14929r14930
164183
165184void c64_currah_speech_cartridge_device::device_start()
166185{
167   // state saving
168   save_item(NAME(m_rom_en));
169186}
170187
171188
r14929r14930
175192
176193void c64_currah_speech_cartridge_device::device_reset()
177194{
178   m_rom_en = 0;
195   m_game = 1;
196   m_exrom = 1;
179197}
180198
181199
r14929r14930
210228
211229      data = sp0256_sby_r(m_nsp) << 7;
212230   }
213   else if (offset == 0xa7f0)
231   
232   if (!space.debugger_access() && (offset == 0xa7f0))
214233   {
215      m_rom_en = !m_rom_en;
234      m_game = !m_game;
235      m_exrom = !m_exrom;
216236   }
217237
218238   return data;
r14929r14930
242262     
243263      */
244264
245      // TODO offset bit 0 = low/high voice
265      int voice = BIT(offset, 0);
266      int intonation = BIT(data, 7);
267
268      set_osc1(voice, intonation);
269
246270      sp0256_ALD_w(m_nsp, 0, data & 0x3f);
247271   }
248272}
249
250
251//-------------------------------------------------
252//  c64_game_r - GAME read
253//-------------------------------------------------
254
255int c64_currah_speech_cartridge_device::c64_game_r(offs_t offset, int ba, int rw, int hiram)
256{
257   return !(m_rom_en && ba && rw && ((offset & 0xe000) == 0xa000));
258}
259
260
261//-------------------------------------------------
262//  c64_exrom_r - EXROM read
263//-------------------------------------------------
264
265int c64_currah_speech_cartridge_device::c64_exrom_r(offs_t offset, int ba, int rw, int hiram)
266{
267   return !(m_rom_en && ba && rw && ((offset & 0xe000) == 0xa000));
268}
src/mess/machine/c64_currah_speech.h
r14929r14930
4545   // device_c64_expansion_card_interface overrides
4646   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
4747   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
48   virtual int c64_game_r(offs_t offset, int ba, int rw, int hiram);
49   virtual int c64_exrom_r(offs_t offset, int ba, int rw, int hiram);
5048
5149private:
52   required_device<device_t> m_nsp;
50   inline void set_osc1(int voice, int intonation);
5351
54   int m_rom_en;
52   required_device<device_t> m_nsp;
5553};
5654
5755

Previous 15994 Revisions Next


© 1998-2018 The MESS Team