(MESS) Improve mouse tracking for pre-ADB Macs. [Rob Braun]

This commit is contained in:
arbee 2015-01-03 16:43:42 -05:00
parent f17d2dec29
commit d22725a623
2 changed files with 87 additions and 8 deletions

View File

@ -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;
}

View File

@ -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<scc8530_t>("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);