From d22725a6235a250ebee30888600c154e1cc991df Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 3 Jan 2015 16:43:42 -0500 Subject: (MESS) Improve mouse tracking for pre-ADB Macs. [Rob Braun] --- src/emu/machine/8530scc.c | 4 +-- src/mess/machine/mac.c | 91 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 87 insertions(+), 8 deletions(-) diff --git a/src/emu/machine/8530scc.c b/src/emu/machine/8530scc.c index 595d785d591..c3998000ed5 100644 --- a/src/emu/machine/8530scc.c +++ b/src/emu/machine/8530scc.c @@ -227,7 +227,7 @@ UINT8 scc8530_t::getareg() rv |= (ourCh->txUnderrun) ? 0x40 : 0; rv |= (ourCh->syncHunt) ? 0x10 : 0; - rv |= channel[0].reg_val[0] & 0x05; // pick up TXBE and RXBF bits + rv |= channel[0].reg_val[0] & 0x0D; // pick up TXBE, RXBF, DCD bits return rv; } @@ -258,7 +258,7 @@ UINT8 scc8530_t::getbreg() rv |= (ourCh->txUnderrun) ? 0x40 : 0; rv |= (ourCh->syncHunt) ? 0x10 : 0; - rv |= channel[1].reg_val[0] & 0x05; // pick up TXBE and RXBF bits + rv |= channel[1].reg_val[0] & 0x0D; // pick up TXBE, RXBF, DCD bits return rv; } diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c index 75764ea349d..a494b3411f9 100644 --- a/src/mess/machine/mac.c +++ b/src/mess/machine/mac.c @@ -840,13 +840,14 @@ void mac_state::mouse_callback() { count_x++; m_mouse_bit_x = 0; + x_needs_update = 2; } else { count_x--; m_mouse_bit_x = 1; + x_needs_update = 1; } - x_needs_update = 1; } else if (count_y) { @@ -854,13 +855,14 @@ void mac_state::mouse_callback() { count_y++; m_mouse_bit_y = 1; + y_needs_update = 1; } else { count_y--; m_mouse_bit_y = 0; + y_needs_update = 2; } - y_needs_update = 1; } if (x_needs_update || y_needs_update) @@ -1040,21 +1042,98 @@ WRITE_LINE_MEMBER(mac_state::drq_539x_1_w) void mac_state::scc_mouse_irq(int x, int y) { scc8530_t *scc = machine().device("scc"); + static int lasty = 0; + static int lastx = 0; + if (x && y) { - if (m_last_was_x) + if (m_last_was_x) { scc->set_status(0x0a); - else + if(x == 2) { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 0; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 1; + } + } else { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 1; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 0; + } + } + lastx = !lastx; + } else { scc->set_status(0x02); + if(y == 2) { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 0; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 1; + } + } else { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 1; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 0; + } + } + lasty = !lasty; + } m_last_was_x ^= 1; } else { - if (x) + if (x) { scc->set_status(0x0a); - else + if(x == 2) { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 0; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 1; + } + } else { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 1; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 0; + } + } + lastx = !lastx; + } else { scc->set_status(0x02); + if(y == 2) { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 0; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 1; + } + } else { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 1; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 0; + } + } + lasty = !lasty; + } } this->set_scc_interrupt(1); -- cgit v1.2.3