Previous 15994 Revisions Next

r14891 Wednesday 11th April, 2012 at 03:21:29 UTC by R. Belmont
uPD1990AC: only read the CSx bits when STB is active. Fixes Apple II ThunderClock card. (nw, will credit in MAME)
[src/emu/machine]upd1990a.c upd1990a.h

src/emu/machine/upd1990a.c
r14890r14891
193193   save_item(NAME(m_c));
194194   save_item(NAME(m_clk));
195195   save_item(NAME(m_tp));
196    save_item(NAME(m_c_unlatched));
196197}
197198
198199
r14890r14891
298299
299300   if (m_cs && m_stb && !m_clk)
300301   {
302        m_c = m_c_unlatched;            // if STB = 1, latch in the command bits
303
301304      switch (m_c)
302305      {
303306      case MODE_REGISTER_HOLD:
r14890r14891
426429
427430   if (!m_clk && state) // rising edge
428431   {
432        logerror("Rising edge\n");
429433      if (m_c == MODE_SHIFT)
430434      {
435            logerror("MODE_SHIFT\n");
431436         m_shift_reg[0] >>= 1;
432437         m_shift_reg[0] |= (BIT(m_shift_reg[1], 0) << 7);
433438
r14890r14891
445450
446451         if (m_oe)
447452         {
453                logerror("OE\n");
448454            m_data_out = BIT(m_shift_reg[0], 0);
449455
450456            if (LOG) logerror("uPD1990A '%s' DATA OUT %u\n", tag(), m_data_out);
r14890r14891
466472{
467473   if (LOG) logerror("uPD1990A '%s' C0 %u\n", tag(), state);
468474
469   m_c = (m_c & 0x06) | state;
475   m_c_unlatched = (m_c_unlatched & 0x06) | state;
470476}
471477
472478
r14890r14891
478484{
479485   if (LOG) logerror("uPD1990A '%s' C1 %u\n", tag(), state);
480486
481   m_c = (m_c & 0x05) | (state << 1);
487   m_c_unlatched = (m_c_unlatched & 0x05) | (state << 1);
482488}
483489
484490
r14890r14891
490496{
491497   if (LOG) logerror("uPD1990A '%s' C2 %u\n", tag(), state);
492498
493   m_c = (m_c & 0x03) | (state << 2);
499   m_c_unlatched = (m_c_unlatched & 0x03) | (state << 2);
494500}
495501
496502
src/emu/machine/upd1990a.h
r14890r14891
115115   int m_c;               // command
116116   int m_clk;               // shift clock
117117   int m_tp;               // time pulse
118    int m_c_unlatched;          // command waiting for STB
118119
119120   // timers
120121   emu_timer *m_timer_clock;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team