Previous 15994 Revisions Next

r15461 Thursday 14th June, 2012 at 16:00:43 UTC by Michael Zapf
Added log output (nw)
[src/mess/machine]tms9901.c

src/mess/machine/tms9901.c
r15460r15461
9999
100100#include "tms9901.h"
101101
102#define VERBOSE 1
103#define LOG logerror
104
102105/*
103106    Constructor
104107*/
r15460r15461
120123   {   /* if timer is enabled, INT3 pin is overriden by timer */
121124      if (m_timer_int_pending)
122125      {
126         if (VERBOSE>8) LOG("tms9901: timer fires\n");
123127         current_ints |= TMS9901_INT3;
124128      }
125      else
129      else
130      {
131         if (VERBOSE>8) LOG("tms9901: timer clear\n");
126132         current_ints &= ~TMS9901_INT3;
133      }
127134   }
128135
129136   /* enabled_ints: enabled interrupts */
r15460r15461
315322      {
316323         /* we are quitting clock mode */
317324         m_clock_mode = false;
325         if (VERBOSE>5) LOG("tms9901: int mode\n");
318326      }
319327      else
320328      {
321329         m_clock_mode = true;
330         if (VERBOSE>5) LOG("tms9901: clock mode\n");
322331         // we are switching to clock mode: latch the current value of
323332         // the decrementer register
324333         if (m_clock_register != 0)
r15460r15461
357366            m_clock_register &= ~mask;      /* clear bit */
358367
359368         /* reset clock timer (page 8) */
369         if (VERBOSE>6) LOG("tms9901: clock register = %04x\n", m_clock_register);
360370         timer_reload();
361371      }
362372      else
r15460r15461
371381         if (offset == 3)
372382            m_timer_int_pending = false;   /* SBO 3 clears pending timer interrupt (??) */
373383
384         if (VERBOSE>6) LOG("tms9901: interrupts = %04x\n", m_enabled_ints);
374385         field_interrupts();      /* changed interrupt state */
375386      }
376387      break;
r15460r15461
388399            // Spec is not clear on whether the mask bits are also reset by RST2*
389400            // TODO: Check on a real machine. (I'd guess from the text they are not touched)
390401            m_enabled_ints = 0;
402            if (VERBOSE>5) LOG("tms9901: Soft reset (RST2*)\n");
391403         }
392404      }
393405      else
r15460r15461
397409         else
398410            m_enabled_ints &= ~0x4000;      /* unset bit */
399411
412         if (VERBOSE>6) LOG("tms9901: interrupts = %04x\n", m_enabled_ints);
400413         field_interrupts();      /* changed interrupt state */
401414      }
402415      break;
r15460r15461
417430   case 0x1E:
418431   case 0x1F:
419432      int pin = offset & 0x0F;
433      if (VERBOSE>6) LOG("tms9901: output on P%d = %d\n", pin, data);
420434      int mask = (1 << pin);
421435
422436      // MZ: see above - I think this is wrong
r15460r15461
460474   if (id==DECREMENTER) // we have only that one
461475   {
462476      m_decrementer_value--;
477      if (VERBOSE>6) LOG("tms9901: decrementer = %d\n", m_decrementer_value);
463478      if (m_decrementer_value<=0)
464479      {
465480         m_timer_int_pending = true;         // decrementer interrupt requested

Previous 15994 Revisions Next


© 1998-2018 The MESS Team