Previous 199869 Revisions Next

r31195 Saturday 5th July, 2014 at 07:41:03 UTC by Alex Jackson
nec v25: Implement programmable clock divider via execute_clocks_to_cycles() instead of set_clock_scale(). Properly restore the clock divider on state load [Alex Jackson]
[src/emu/cpu/nec]v25.c v25.h v25sfr.c

trunk/src/emu/cpu/nec/v25.h
r31194r31195
4141   // device-level overrides
4242   virtual void device_start();
4343   virtual void device_reset();
44   virtual void device_post_load() { notify_clock_changed(); }
4445
4546   // device_execute_interface overrides
47   virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return clocks / m_PCK; }
48   virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return cycles * m_PCK; }
4649   virtual UINT32 execute_min_cycles() const { return 1; }
4750   virtual UINT32 execute_max_cycles() const { return 80; }
4851   virtual UINT32 execute_input_lines() const { return 1; }
trunk/src/emu/cpu/nec/v25sfr.c
r31194r31195
192192         {
193193            if(d & 0x80)
194194            {
195               tmp = m_TM0 * ((d & 0x40) ? 128 : 12 );
196               time = attotime::from_hz(clock()) * tmp;
195               tmp = m_PCK * m_TM0 * ((d & 0x40) ? 128 : 12 );
196               time = attotime::from_hz(unscaled_clock()) * tmp;
197197               m_timers[0]->adjust(time, INTTU0);
198198            }
199199            else
r31194r31195
201201
202202            if(d & 0x20)
203203            {
204               tmp = m_MD0 * ((d & 0x10) ? 128 : 12 );
205               time = attotime::from_hz(clock()) * tmp;
204               tmp = m_PCK * m_MD0 * ((d & 0x10) ? 128 : 12 );
205               time = attotime::from_hz(unscaled_clock()) * tmp;
206206               m_timers[1]->adjust(time, INTTU1);
207207            }
208208            else
r31194r31195
212212         {
213213            if(d & 0x80)
214214            {
215               tmp = m_MD0 * ((d & 0x40) ? 128 : 6 );
216               time = attotime::from_hz(clock()) * tmp;
215               tmp = m_PCK * m_MD0 * ((d & 0x40) ? 128 : 6 );
216               time = attotime::from_hz(unscaled_clock()) * tmp;
217217               m_timers[0]->adjust(time, INTTU0, time);
218218               m_timers[1]->adjust(attotime::never);
219219               m_TM0 = m_MD0;
r31194r31195
229229         m_TMC1 = d & 0xC0;
230230         if(d & 0x80)
231231         {
232            tmp = m_MD1 * ((d & 0x40) ? 128 : 6 );
233            time = attotime::from_hz(clock()) * tmp;
232            tmp = m_PCK * m_MD1 * ((d & 0x40) ? 128 : 6 );
233            time = attotime::from_hz(unscaled_clock()) * tmp;
234234            m_timers[2]->adjust(time, INTTU2, time);
235235            m_TM1 = m_MD1;
236236         }
r31194r31195
261261            logerror("        Warning: invalid clock divider\n");
262262            m_PCK = 8;
263263         }
264         set_clock_scale(1.0 / m_PCK);
265264         tmp = m_PCK << m_TB;
266265         time = attotime::from_hz(unscaled_clock()) * tmp;
267266         m_timers[3]->adjust(time, INTTB, time);
267         notify_clock_changed(); /* make device_execute_interface pick up the new clocks_to_cycles() */
268268         logerror("        Internal RAM %sabled\n", (m_RAMEN ? "en" : "dis"));
269269         logerror("        Time base set to 2^%d\n", m_TB);
270270         logerror("        Clock divider set to %d\n", m_PCK);
trunk/src/emu/cpu/nec/v25.c
r31194r31195
159159
160160void v25_common_device::device_reset()
161161{
162   int tmp;
163162   attotime time;
164163
165164   m_ip = 0;
r31194r31195
201200   m_PCK = 8;
202201   m_IDB = 0xFFE00;
203202
204   set_clock_scale(1.0 / m_PCK);
205   tmp = m_PCK << m_TB;
203   int tmp = m_PCK << m_TB;
206204   time = attotime::from_hz(unscaled_clock()) * tmp;
207205   m_timers[3]->adjust(time, INTTB, time);
208206
r31194r31195
436434      Mod_RM.RM.b[i] = breg_name[i & 7];
437435   }
438436
437   m_PCK = 8;
438
439439   m_no_interrupt = 0;
440440   m_prefetch_count = 0;
441441   m_prefetch_reset = 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team