Previous 199869 Revisions Next

r34212 Tuesday 6th January, 2015 at 04:08:20 UTC by R. Belmont
(MESS) mac: greatly improve keyboard reliability on Macs with first-generation ADB hardware (SE,II,IIx,IIcx,SE/30,IIci). [Rob Braun]
[src/mess/includes]mac.h
[src/mess/machine]macadb.c

trunk/src/mess/includes/mac.h
r242723r242724
290290   INT32 m_adb_streaming, m_adb_stream_ptr;
291291   INT32 m_adb_linestate;
292292   bool  m_adb_srqflag;
293#define kADBKeyBufSize 32
294        UINT8 m_adb_keybuf[kADBKeyBufSize];
295        UINT8 m_adb_keybuf_start;
296        UINT8 m_adb_keybuf_end;
293297
294298   // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition)
295299   UINT8 m_pm_data_send, m_pm_data_recv, m_pm_ack, m_pm_req, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state;
trunk/src/mess/machine/macadb.c
r242723r242724
194194      // if we want to update the current read, do so
195195      if (update)
196196      {
197         if(m_adb_currentkeys[0] != codes[0]) {
198            m_adb_keybuf[m_adb_keybuf_end] = codes[0];
199            m_adb_keybuf_end = (m_adb_keybuf_end+1) % kADBKeyBufSize;
200         }
201         if(m_adb_currentkeys[1] != codes[1]) {
202            m_adb_keybuf[m_adb_keybuf_end] = codes[1];
203            m_adb_keybuf_end = (m_adb_keybuf_end+1) % kADBKeyBufSize;
204         }
197205         m_adb_currentkeys[0] = codes[0];
198206         m_adb_currentkeys[1] = codes[1];
199207      }
r242723r242724
388396            }
389397            else if (addr == m_adb_keybaddr)
390398            {
399               int kbd_has_data = 1;
391400               #if LOG_ADB || LOG_ADB_TALK_LISTEN
392401               printf("Talking to keyboard, register %x\n", reg);
393402               #endif
r242723r242724
402411                     }
403412                     else
404413                     {
405                        this->adb_pollkbd(1);
414                        kbd_has_data = this->adb_pollkbd(1);
406415                     }
407416
408417/*                            if (m_adb_currentkeys[0] != 0xff)
r242723r242724
414423                                printf("Keys[1] = %02x\n", m_adb_currentkeys[1]);
415424                            }*/
416425
417                     m_adb_buffer[0] = m_adb_currentkeys[1];
418                     m_adb_buffer[1] = m_adb_currentkeys[0];
419                     m_adb_datasize = 2;
426                     if(kbd_has_data)
427                     {
428                        if(m_adb_keybuf_start == m_adb_keybuf_end)
429                        {
430   //                        printf("%s: buffer empty\n", __func__);
431                           m_adb_buffer[0] = 0xff;
432                           m_adb_buffer[1] = 0xff;
433                        }
434                        else
435                        {
436                           m_adb_buffer[1] = m_adb_keybuf[m_adb_keybuf_start];
437                           m_adb_keybuf_start = (m_adb_keybuf_start+1) % kADBKeyBufSize;
438                           if(m_adb_keybuf_start != m_adb_keybuf_end)
439                           {
440                              m_adb_buffer[0] = m_adb_keybuf[m_adb_keybuf_start];
441                              m_adb_keybuf_start = (m_adb_keybuf_start+1) % kADBKeyBufSize;
442                           }
443                           else
444                           {
445                              m_adb_buffer[0] = 0xff;
446                           }
447                        }
448                        m_adb_datasize = 2;
449                     }
420450                     break;
421451
422452                  // read modifier keys
r242723r242724
633663         if ((mac->m_adb_direction) && (ADB_IS_BITBANG))
634664         {
635665            mac->adb_talk();
666            if((mac->m_adb_last_talk == 2) && mac->m_adb_datasize) {
667               mac->m_adb_timer_ticks = 8;
668               mac->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
669            }
636670         }
637671      }
638672      else
r242723r242724
11911225   {
11921226      m_key_matrix[i] = 0;
11931227   }
1228   m_adb_keybuf_start = 0;
1229   m_adb_keybuf_end = 0;
11941230}
11951231
11961232WRITE_LINE_MEMBER(mac_state::adb_linechange_w)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team