mirror of
https://github.com/holub/mame
synced 2025-06-23 21:06:38 +03:00
mac128: fix multiple keyboard regressions since 0.180 (MT#6481) [R. Belmont]
This commit is contained in:
parent
b80d130133
commit
f5da128a94
@ -202,6 +202,8 @@ public:
|
||||
/* keycode buffer (used for keypad/arrow key transition) */
|
||||
int m_keycode_buf[2];
|
||||
int m_keycode_buf_index;
|
||||
|
||||
int m_cb2_in;
|
||||
#endif
|
||||
|
||||
/* keyboard matrix to detect transition - macadb needs to stop relying on this */
|
||||
@ -380,6 +382,24 @@ void mac128_state::set_via_interrupt(int value)
|
||||
|
||||
void mac128_state::vblank_irq()
|
||||
{
|
||||
#ifndef MAC_USE_EMULATED_KBD
|
||||
/* handle keyboard */
|
||||
if (m_kbd_comm == true && m_kbd_receive == false)
|
||||
{
|
||||
int keycode = scan_keyboard();
|
||||
|
||||
if (keycode != 0x7B)
|
||||
{
|
||||
/* if key pressed, send the code */
|
||||
|
||||
logerror("keyboard enquiry successful, keycode %X\n", keycode);
|
||||
|
||||
m_inquiry_timeout->reset();
|
||||
kbd_shift_out(keycode);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m_ca1_data ^= 1;
|
||||
m_via->write_ca1(m_ca1_data);
|
||||
|
||||
@ -940,14 +960,29 @@ TIMER_CALLBACK_MEMBER(mac128_state::kbd_clock)
|
||||
|
||||
if (m_kbd_comm == TRUE)
|
||||
{
|
||||
for (i=0; i<8; i++)
|
||||
for (i=0; i<9; i++)
|
||||
{
|
||||
/* Put data on CB2 if we are sending*/
|
||||
if (m_kbd_receive == FALSE)
|
||||
{
|
||||
m_via->write_cb2(m_kbd_shift_reg&0x80?1:0);
|
||||
m_kbd_shift_reg <<= 1;
|
||||
if (i > 0)
|
||||
{
|
||||
m_kbd_shift_reg <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_via->write_cb1(0);
|
||||
m_via->write_cb1(1);
|
||||
|
||||
if (m_kbd_receive == TRUE)
|
||||
{
|
||||
if (i < 8)
|
||||
{
|
||||
m_kbd_shift_reg <<= 1;
|
||||
m_kbd_shift_reg |= (m_cb2_in & 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_kbd_receive == TRUE)
|
||||
{
|
||||
@ -967,6 +1002,7 @@ void mac128_state::kbd_shift_out(int data)
|
||||
{
|
||||
if (m_kbd_comm == TRUE)
|
||||
{
|
||||
//printf("%02x to Mac\n", data);
|
||||
m_kbd_shift_reg = data;
|
||||
machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(mac128_state::kbd_clock),this));
|
||||
}
|
||||
@ -984,7 +1020,7 @@ WRITE_LINE_MEMBER(mac128_state::mac_via_out_cb2)
|
||||
if (m_kbd_comm == TRUE && m_kbd_receive == TRUE)
|
||||
{
|
||||
/* Shift in what mac is sending */
|
||||
m_kbd_shift_reg = (m_kbd_shift_reg & ~1) | state;
|
||||
m_cb2_in = state;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1003,6 +1039,7 @@ TIMER_CALLBACK_MEMBER(mac128_state::inquiry_timeout_func)
|
||||
*/
|
||||
void mac128_state::keyboard_receive(int val)
|
||||
{
|
||||
//printf("Mac sent %02x\n", val);
|
||||
switch (val)
|
||||
{
|
||||
case 0x10:
|
||||
|
Loading…
Reference in New Issue
Block a user