trunk/src/mess/machine/ser_mouse.c
| r20439 | r20440 | |
| 15 | 15 | serial_mouse_device::serial_mouse_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock) |
| 16 | 16 | : device_t(mconfig, type, name, tag, owner, clock), |
| 17 | 17 | device_rs232_port_interface(mconfig, *this), |
| 18 | | device_serial_interface(mconfig, *this) |
| 18 | device_serial_interface(mconfig, *this), |
| 19 | m_x(*this, "ser_mouse_x"), |
| 20 | m_y(*this, "ser_mouse_y"), |
| 21 | m_btn(*this, "ser_mouse_btn") |
| 19 | 22 | { |
| 20 | 23 | } |
| 21 | 24 | |
| r20439 | r20440 | |
| 77 | 80 | /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */ |
| 78 | 81 | if (m_head==m_tail) |
| 79 | 82 | { |
| 80 | | nx = ioport("ser_mouse_x")->read(); |
| 83 | nx = m_x->read(); |
| 81 | 84 | |
| 82 | 85 | dx = nx - ox; |
| 83 | 86 | if (dx<=-0x800) dx = nx + 0x1000 - ox; /* Prevent jumping */ |
| 84 | 87 | if (dx>=0x800) dx = nx - 0x1000 - ox; |
| 85 | 88 | ox = nx; |
| 86 | 89 | |
| 87 | | ny = ioport("ser_mouse_y")->read(); |
| 90 | ny = m_y->read(); |
| 88 | 91 | |
| 89 | 92 | dy = ny - oy; |
| 90 | 93 | if (dy<=-0x800) dy = ny + 0x1000 - oy; |
| 91 | 94 | if (dy>=0x800) dy = ny - 0x1000 - oy; |
| 92 | 95 | oy = ny; |
| 93 | 96 | |
| 94 | | nb = ioport("ser_mouse_btn")->read(); |
| 97 | nb = m_btn->read(); |
| 95 | 98 | mbc = nb^m_mb; |
| 96 | 99 | m_mb = nb; |
| 97 | 100 | |