(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->txUnderrun) ? 0x40 : 0;
rv |= (ourCh->syncHunt) ? 0x10 : 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; return rv;
} }
@ -258,7 +258,7 @@ UINT8 scc8530_t::getbreg()
rv |= (ourCh->txUnderrun) ? 0x40 : 0; rv |= (ourCh->txUnderrun) ? 0x40 : 0;
rv |= (ourCh->syncHunt) ? 0x10 : 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; return rv;
} }

View File

@ -840,27 +840,29 @@ void mac_state::mouse_callback()
{ {
count_x++; count_x++;
m_mouse_bit_x = 0; m_mouse_bit_x = 0;
x_needs_update = 2;
} }
else else
{ {
count_x--; count_x--;
m_mouse_bit_x = 1; m_mouse_bit_x = 1;
}
x_needs_update = 1; x_needs_update = 1;
} }
}
else if (count_y) else if (count_y)
{ {
if (count_y < 0) if (count_y < 0)
{ {
count_y++; count_y++;
m_mouse_bit_y = 1; m_mouse_bit_y = 1;
y_needs_update = 1;
} }
else else
{ {
count_y--; count_y--;
m_mouse_bit_y = 0; m_mouse_bit_y = 0;
y_needs_update = 2;
} }
y_needs_update = 1;
} }
if (x_needs_update || y_needs_update) 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) void mac_state::scc_mouse_irq(int x, int y)
{ {
scc8530_t *scc = machine().device<scc8530_t>("scc"); scc8530_t *scc = machine().device<scc8530_t>("scc");
static int lasty = 0;
static int lastx = 0;
if (x && y) if (x && y)
{ {
if (m_last_was_x) if (m_last_was_x) {
scc->set_status(0x0a); 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); 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; m_last_was_x ^= 1;
} }
else else
{ {
if (x) if (x) {
scc->set_status(0x0a); 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); 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); this->set_scc_interrupt(1);