summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/amstrad.c
diff options
context:
space:
mode:
author mahlemiut <mahlemiut@users.noreply.github.com>2014-01-29 10:01:24 +0000
committer mahlemiut <mahlemiut@users.noreply.github.com>2014-01-29 10:01:24 +0000
commit4a7e551be4b11ed7d0abf79448da120fae0767ae (patch)
treec8711c6862dfeb5ca7d35fd86951aef2b418df16 /src/mess/machine/amstrad.c
parentebe4bb2f54c5d2e4b62e756e984421f052961a61 (diff)
(MESS) amstrad: Added preliminary support for the AMX mouse. [Barry Rodewald]
Diffstat (limited to 'src/mess/machine/amstrad.c')
-rw-r--r--src/mess/machine/amstrad.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c
index eb3413312a1..32b35d97aec 100644
--- a/src/mess/machine/amstrad.c
+++ b/src/mess/machine/amstrad.c
@@ -2668,6 +2668,10 @@ READ8_MEMBER(amstrad_state::amstrad_psg_porta_read)
if (keyrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F])
{
+ if((m_io_ctrltype->read_safe(0) == 1) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) // joystick 1
+ {
+ return m_amx_mouse_data;
+ }
return keyrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0xFF;
}
return 0xFF;
@@ -2700,6 +2704,30 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int)
}
return (m_asic.ram[0x2805] & 0xf8) | m_plus_irq_cause;
}
+ // update AMX mouse inputs (normally done every 1/300th of a second)
+ if(m_io_ctrltype->read_safe(0) == 1)
+ {
+ static UINT8 prev_x,prev_y;
+ UINT8 data_x, data_y;
+
+ m_amx_mouse_data = 0;
+ data_x = m_io_mouse1->read_safe(0) & 0xff;
+ data_y = m_io_mouse2->read_safe(0) & 0xff;
+
+ if(data_x < prev_x)
+ m_amx_mouse_data |= 0x08;
+ if(data_x > prev_x)
+ m_amx_mouse_data |= 0x04;
+ if(data_y < prev_y)
+ m_amx_mouse_data |= 0x02;
+ if(data_y > prev_y)
+ m_amx_mouse_data |= 0x01;
+ m_amx_mouse_data |= (m_io_mouse3->read_safe(0) << 4);
+ prev_x = data_x;
+ prev_y = data_y;
+
+ m_amx_mouse_data |= (m_io_keyboard_row_9->read_safe(0) & 0x80); // DEL key
+ }
return 0xFF;
}