summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2014-06-03 10:54:04 +0000
committer Curt Coder <curtcoder@mail.com>2014-06-03 10:54:04 +0000
commit82f73878965c76a78c1bbb7af75ef933fd8a305d (patch)
tree59c45afba6e0d0c031b59c450f60175384479bb2
parent05a0a0fd6d7887d57c92a529f6621c829834a892 (diff)
(MESS) ql: Expansion WIP. (nw)
-rw-r--r--.gitattributes4
-rw-r--r--src/emu/bus/ql/exp.c3
-rw-r--r--src/emu/bus/ql/rom.c2
-rw-r--r--src/emu/bus/ql/sandy_superdisk.c13
-rw-r--r--src/emu/bus/ql/sandy_superdisk.h3
-rw-r--r--src/emu/bus/ql/sandy_superqboard.c15
-rw-r--r--src/emu/bus/ql/sandy_superqboard.h3
-rw-r--r--src/emu/bus/ql/trumpcard.c17
-rw-r--r--src/emu/bus/ql/trumpcard.h3
-rw-r--r--src/lib/formats/ql_dsk.c54
-rw-r--r--src/lib/formats/ql_dsk.h30
-rw-r--r--src/lib/lib.mak1
-rw-r--r--src/mess/machine/microdrv.c2
-rw-r--r--src/mess/machine/qimi.c220
-rw-r--r--src/mess/machine/qimi.h87
-rw-r--r--src/mess/mess.mak1
16 files changed, 446 insertions, 12 deletions
diff --git a/.gitattributes b/.gitattributes
index cb87b7450ad..f0969606792 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3620,6 +3620,8 @@ src/lib/formats/primoptp.c svneol=native#text/plain
src/lib/formats/primoptp.h svneol=native#text/plain
src/lib/formats/pyldin_dsk.c svneol=native#text/plain
src/lib/formats/pyldin_dsk.h svneol=native#text/plain
+src/lib/formats/ql_dsk.c svneol=native#text/plain
+src/lib/formats/ql_dsk.h svneol=native#text/plain
src/lib/formats/rk_cas.c svneol=native#text/plain
src/lib/formats/rk_cas.h svneol=native#text/plain
src/lib/formats/sc3000_bit.c svneol=native#text/plain
@@ -8804,6 +8806,8 @@ src/mess/machine/psxcport.c svneol=native#text/plain
src/mess/machine/psxcport.h svneol=native#text/plain
src/mess/machine/psxmultitap.c svneol=native#text/plain
src/mess/machine/psxmultitap.h svneol=native#text/plain
+src/mess/machine/qimi.c svneol=native#text/plain
+src/mess/machine/qimi.h svneol=native#text/plain
src/mess/machine/qx10kbd.c svneol=native#text/plain
src/mess/machine/qx10kbd.h svneol=native#text/plain
src/mess/machine/radio86.c svneol=native#text/plain
diff --git a/src/emu/bus/ql/exp.c b/src/emu/bus/ql/exp.c
index 02d60d4de2a..242789505fd 100644
--- a/src/emu/bus/ql/exp.c
+++ b/src/emu/bus/ql/exp.c
@@ -30,7 +30,8 @@ const device_type QL_EXPANSION_SLOT = &device_creator<ql_expansion_slot_t>;
//-------------------------------------------------
device_ql_expansion_card_interface::device_ql_expansion_card_interface(const machine_config &mconfig, device_t &device) :
- device_slot_card_interface(mconfig, device)
+ device_slot_card_interface(mconfig, device),
+ m_romoeh(0)
{
m_slot = dynamic_cast<ql_expansion_slot_t *>(device.owner());
}
diff --git a/src/emu/bus/ql/rom.c b/src/emu/bus/ql/rom.c
index bdb3b05c5e0..85122c1642b 100644
--- a/src/emu/bus/ql/rom.c
+++ b/src/emu/bus/ql/rom.c
@@ -32,7 +32,7 @@ const device_type QL_ROM_CARTRIDGE_SLOT = &device_creator<ql_rom_cartridge_slot_
device_ql_rom_cartridge_card_interface::device_ql_rom_cartridge_card_interface(const machine_config &mconfig, device_t &device) :
device_slot_card_interface(mconfig, device),
m_rom(*this, "rom"),
- m_romoeh(1)
+ m_romoeh(0)
{
m_slot = dynamic_cast<ql_rom_cartridge_slot_t *>(device.owner());
}
diff --git a/src/emu/bus/ql/sandy_superdisk.c b/src/emu/bus/ql/sandy_superdisk.c
index 7db9de8fc68..b0c126d6964 100644
--- a/src/emu/bus/ql/sandy_superdisk.c
+++ b/src/emu/bus/ql/sandy_superdisk.c
@@ -59,6 +59,15 @@ SLOT_INTERFACE_END
//-------------------------------------------------
+// FLOPPY_FORMATS( floppy_formats )
+//-------------------------------------------------
+
+FLOPPY_FORMATS_MEMBER( sandy_super_disk_t::floppy_formats )
+ FLOPPY_QL_FORMAT
+FLOPPY_FORMATS_END
+
+
+//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( sandy_super_disk )
//-------------------------------------------------
@@ -66,8 +75,8 @@ static MACHINE_CONFIG_FRAGMENT( sandy_super_disk )
MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000)
//MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(sandy_super_disk_t, fdc_intrq_w))
//MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(sandy_super_disk_t, fdc_drq_w))
- MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_super_disk_floppies, "35dd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_super_disk_floppies, NULL, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_super_disk_floppies, "35dd", sandy_super_disk_t::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_super_disk_floppies, NULL, sandy_super_disk_t::floppy_formats)
MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "printer")
MACHINE_CONFIG_END
diff --git a/src/emu/bus/ql/sandy_superdisk.h b/src/emu/bus/ql/sandy_superdisk.h
index 47136429567..dada2167d18 100644
--- a/src/emu/bus/ql/sandy_superdisk.h
+++ b/src/emu/bus/ql/sandy_superdisk.h
@@ -16,6 +16,7 @@
#include "exp.h"
#include "bus/centronics/ctronics.h"
+#include "formats/ql_dsk.h"
#include "machine/wd_fdc.h"
@@ -37,6 +38,8 @@ public:
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
+ DECLARE_FLOPPY_FORMATS( floppy_formats );
+
protected:
// device-level overrides
virtual void device_start();
diff --git a/src/emu/bus/ql/sandy_superqboard.c b/src/emu/bus/ql/sandy_superqboard.c
index 4bb0f35a719..88aa0b9550b 100644
--- a/src/emu/bus/ql/sandy_superqboard.c
+++ b/src/emu/bus/ql/sandy_superqboard.c
@@ -39,7 +39,7 @@ ROM_START( sandy_superqboard )
ROM_LOAD( "sandy_disk_controller_v1.18y_1984.ic2", 0x0000, 0x8000, CRC(d02425be) SHA1(e730576e3e0c6a1acad042c09e15fc62a32d8fbd) )
ROM_REGION( 0x100, "plds", 0 )
- ROM_LOAD( "gal16v8.ic5", 0x000, 0x000, NO_DUMP )
+ ROM_LOAD( "gal16v8.ic5", 0x000, 0x100, NO_DUMP )
ROM_END
@@ -64,6 +64,15 @@ SLOT_INTERFACE_END
//-------------------------------------------------
+// FLOPPY_FORMATS( floppy_formats )
+//-------------------------------------------------
+
+FLOPPY_FORMATS_MEMBER( sandy_superqboard_t::floppy_formats )
+ FLOPPY_QL_FORMAT
+FLOPPY_FORMATS_END
+
+
+//-------------------------------------------------
// centronics
//-------------------------------------------------
@@ -80,8 +89,8 @@ WRITE_LINE_MEMBER( sandy_superqboard_t::busy_w )
static MACHINE_CONFIG_FRAGMENT( sandy_superqboard )
MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, XTAL_16MHz/2)
- MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_superqboard_floppies, "35hd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_superqboard_floppies, NULL, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_superqboard_floppies, "35hd", sandy_superqboard_t::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_superqboard_floppies, NULL, sandy_superqboard_t::floppy_formats)
MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(sandy_superqboard_t, busy_w))
diff --git a/src/emu/bus/ql/sandy_superqboard.h b/src/emu/bus/ql/sandy_superqboard.h
index 0907ba10c4f..e6e398e19a1 100644
--- a/src/emu/bus/ql/sandy_superqboard.h
+++ b/src/emu/bus/ql/sandy_superqboard.h
@@ -16,6 +16,7 @@
#include "exp.h"
#include "bus/centronics/ctronics.h"
+#include "formats/ql_dsk.h"
#include "machine/wd_fdc.h"
@@ -39,6 +40,8 @@ public:
WRITE_LINE_MEMBER( busy_w );
+ DECLARE_FLOPPY_FORMATS( floppy_formats );
+
protected:
// device-level overrides
virtual void device_start();
diff --git a/src/emu/bus/ql/trumpcard.c b/src/emu/bus/ql/trumpcard.c
index e74fdbd6aba..722d840a155 100644
--- a/src/emu/bus/ql/trumpcard.c
+++ b/src/emu/bus/ql/trumpcard.c
@@ -37,8 +37,8 @@ ROM_START( ql_trump_card )
ROM_LOAD( "trumpcard-125.rom", 0x0000, 0x8000, CRC(938eaa46) SHA1(9b3458cf3a279ed86ba395dc45c8f26939d6c44d) )
ROM_REGION( 0x100, "plds", 0 )
- ROM_LOAD( "1u4", 0x000, 0x000, NO_DUMP )
- ROM_LOAD( "2u4", 0x000, 0x000, NO_DUMP )
+ ROM_LOAD( "1u4", 0x000, 0x100, NO_DUMP )
+ ROM_LOAD( "2u4", 0x000, 0x100, NO_DUMP )
ROM_END
@@ -62,6 +62,15 @@ SLOT_INTERFACE_END
//-------------------------------------------------
+// FLOPPY_FORMATS( floppy_formats )
+//-------------------------------------------------
+
+FLOPPY_FORMATS_MEMBER( ql_trump_card_t::floppy_formats )
+ FLOPPY_QL_FORMAT
+FLOPPY_FORMATS_END
+
+
+//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( ql_trump_card )
//-------------------------------------------------
@@ -69,8 +78,8 @@ static MACHINE_CONFIG_FRAGMENT( ql_trump_card )
MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000)
//MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ql_trump_card_t, fdc_intrq_w))
//MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(ql_trump_card_t, fdc_drq_w))
- MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", ql_trump_card_floppies, "35dd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", ql_trump_card_floppies, NULL, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", ql_trump_card_floppies, "35dd", ql_trump_card_t::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", ql_trump_card_floppies, NULL, ql_trump_card_t::floppy_formats)
MACHINE_CONFIG_END
diff --git a/src/emu/bus/ql/trumpcard.h b/src/emu/bus/ql/trumpcard.h
index 7e0ecc0e4ce..61ed069e475 100644
--- a/src/emu/bus/ql/trumpcard.h
+++ b/src/emu/bus/ql/trumpcard.h
@@ -16,6 +16,7 @@
#include "exp.h"
#include "machine/wd_fdc.h"
+#include "formats/ql_dsk.h"
@@ -36,6 +37,8 @@ public:
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
+ DECLARE_FLOPPY_FORMATS( floppy_formats );
+
protected:
// device-level overrides
virtual void device_start();
diff --git a/src/lib/formats/ql_dsk.c b/src/lib/formats/ql_dsk.c
new file mode 100644
index 00000000000..5351a92c83f
--- /dev/null
+++ b/src/lib/formats/ql_dsk.c
@@ -0,0 +1,54 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/*********************************************************************
+
+ formats/ql_dsk.c
+
+ Sinclair QL disk image formats
+
+*********************************************************************/
+
+#include "emu.h"
+#include "formats/ql_dsk.h"
+
+ql_format::ql_format() : wd177x_format(formats)
+{
+}
+
+const char *ql_format::name() const
+{
+ return "ql";
+}
+
+const char *ql_format::description() const
+{
+ return "Sinclair QL disk image";
+}
+
+const char *ql_format::extensions() const
+{
+ return "dsk,img";
+}
+
+// unverified gaps
+const ql_format::format ql_format::formats[] = {
+ { // QDOS 800KB
+ floppy_image::FF_35, floppy_image::SSSD, floppy_image::MFM,
+ 2000, 5, 80, 2, 1024, {}, 1, {}, 80, 22, 24
+ },
+ { // 720KB DSDD
+ floppy_image::FF_35, floppy_image::SSSD, floppy_image::MFM,
+ 2000, 9, 80, 2, 512, {}, 1, {}, 80, 22, 24
+ },
+ { // 1.44MB DSHD
+ floppy_image::FF_35, floppy_image::SSSD, floppy_image::MFM,
+ 2000, 18, 80, 2, 512, {}, 1, {}, 80, 22, 24
+ },
+ { // 2.88MB DSED
+ floppy_image::FF_35, floppy_image::SSSD, floppy_image::MFM,
+ 2000, 40, 80, 2, 512, {}, 1, {}, 80, 41, 24
+ },
+ {}
+};
+
+const floppy_format_type FLOPPY_QL_FORMAT = &floppy_image_format_creator<ql_format>;
diff --git a/src/lib/formats/ql_dsk.h b/src/lib/formats/ql_dsk.h
new file mode 100644
index 00000000000..7c7f52be852
--- /dev/null
+++ b/src/lib/formats/ql_dsk.h
@@ -0,0 +1,30 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/*********************************************************************
+
+ formats/ql_dsk.h
+
+ Sinclair QL disk image formats
+
+*********************************************************************/
+
+#ifndef QL_DSK_H_
+#define QL_DSK_H_
+
+#include "wd177x_dsk.h"
+
+class ql_format : public wd177x_format {
+public:
+ ql_format();
+
+ virtual const char *name() const;
+ virtual const char *description() const;
+ virtual const char *extensions() const;
+
+private:
+ static const format formats[];
+};
+
+extern const floppy_format_type FLOPPY_QL_FORMAT;
+
+#endif
diff --git a/src/lib/lib.mak b/src/lib/lib.mak
index daf04cb1b9d..9dfcdf997af 100644
--- a/src/lib/lib.mak
+++ b/src/lib/lib.mak
@@ -182,6 +182,7 @@ FORMATSOBJS = \
$(LIBOBJ)/formats/pmd_cas.o \
$(LIBOBJ)/formats/primoptp.o \
$(LIBOBJ)/formats/pyldin_dsk.o \
+ $(LIBOBJ)/formats/ql_dsk.o \
$(LIBOBJ)/formats/rk_cas.o \
$(LIBOBJ)/formats/sc3000_bit.o \
$(LIBOBJ)/formats/sf7000_dsk.o \
diff --git a/src/mess/machine/microdrv.c b/src/mess/machine/microdrv.c
index 88e70249ffc..93923db937b 100644
--- a/src/mess/machine/microdrv.c
+++ b/src/mess/machine/microdrv.c
@@ -13,7 +13,7 @@
CONSTANTS
***************************************************************************/
-#define LOG 1
+#define LOG 0
#define MDV_SECTOR_COUNT 255
#define MDV_SECTOR_LENGTH 686
diff --git a/src/mess/machine/qimi.c b/src/mess/machine/qimi.c
new file mode 100644
index 00000000000..a99b0b2f514
--- /dev/null
+++ b/src/mess/machine/qimi.c
@@ -0,0 +1,220 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ QL Internal Mouse Interface emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "qimi.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define QL_CONFIG_PORT "config"
+#define QIMI_PORT_MASK 0x01
+#define QIMI_NONE 0x00
+#define QIMI_MOUSE 0x01
+
+#define MOUSEX_TAG "MOUSEX"
+#define MOUSEY_TAG "MOUSEY"
+#define MOUSEB_TAG "MOUSEB"
+
+// Mouse bits in Sandy port order
+#define MOUSE_MIDDLE 0x02
+#define MOUSE_RIGHT 0x04
+#define MOUSE_LEFT 0x08
+#define MOUSE_DIRY 0x10
+#define MOUSE_DIRX 0x20
+#define MOUSE_INTY 0x40
+#define MOUSE_INTX 0x80
+#define MOUSE_INT_MASK (MOUSE_INTX | MOUSE_INTY)
+
+#define QIMI_INTX 0x04
+#define QIMI_INTY 0x20
+#define QIMI_DIRX 0x10
+#define QIMI_DIRY 0x01
+#define QIMI_LEFT 0x20
+#define QIMI_RIGHT 0x10
+#define QIMI_INT_MASK (QIMI_INTX | QIMI_INTY)
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type QIMI = &device_creator<qimi_t>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( qimi )
+//-------------------------------------------------
+
+INPUT_PORTS_START( qimi )
+ PORT_START(QL_CONFIG_PORT)
+ PORT_CONFNAME( QIMI_PORT_MASK, QIMI_NONE, "QIMI enabled")
+ PORT_CONFSETTING( QIMI_NONE, "No" )
+ PORT_CONFSETTING( QIMI_MOUSE, "Yes" )
+
+ PORT_START(MOUSEX_TAG)
+ PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)
+
+ PORT_START(MOUSEY_TAG)
+ PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)
+
+ PORT_START(MOUSEB_TAG) /* Mouse buttons */
+ PORT_BIT( MOUSE_RIGHT, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1)
+ PORT_BIT( MOUSE_LEFT, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2)
+ PORT_BIT( MOUSE_MIDDLE, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Mouse Button 3") PORT_CODE(MOUSECODE_BUTTON3)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor qimi_t::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( qimi );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// qimi_t - constructor
+//-------------------------------------------------
+
+qimi_t::qimi_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, QIMI, "QL Internal Mouse Interface", tag, owner, clock, "qimi", __FILE__),
+ m_write_extint(*this),
+ m_mousex(*this, MOUSEX_TAG),
+ m_mousey(*this, MOUSEY_TAG),
+ m_mouseb(*this, MOUSEB_TAG),
+ m_config(*this, QL_CONFIG_PORT)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void qimi_t::device_start()
+{
+ // resolve callbacks
+ m_write_extint.resolve_safe();
+
+ // allocate timer
+ m_mouse_timer = timer_alloc();
+ m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500));
+}
+
+
+//-------------------------------------------------
+// device_timer - handler timer events
+//-------------------------------------------------
+
+void qimi_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ UINT8 x = m_mousex->read();
+ UINT8 y = m_mousey->read();
+ UINT8 do_int = 0;
+
+ //m_mouse_int = 0;
+
+ // Set X interupt flag and direction if x has changed
+ if (x > m_ql_mouse_x)
+ {
+ m_mouse_int |= MOUSE_INTX;
+ m_mouse_int |= MOUSE_DIRX;
+ }
+ else if (x < m_ql_mouse_x)
+ {
+ m_mouse_int |= MOUSE_INTX;
+ m_mouse_int &= ~MOUSE_DIRX;
+ }
+
+ // Set Y interupt flag and direction if y has changed
+ if (y > m_ql_mouse_y)
+ {
+ m_mouse_int |= MOUSE_INTY;
+ m_mouse_int &= ~MOUSE_DIRY;
+ }
+ else if (y < m_ql_mouse_y)
+ {
+ m_mouse_int |= MOUSE_INTY;
+ m_mouse_int |= MOUSE_DIRY;
+ }
+
+ // Update saved location
+ m_ql_mouse_x = x;
+ m_ql_mouse_y = y;
+
+ // if it is a QIMI, then always do int if triggered.
+ // if this is a Sandy mouse, only trigger an int if it is enabled in the mask register
+ do_int = 1;
+
+ //logerror("m_mouse_int=%02X, MOUSE_INT_MASK=%02X, m_disk_io_byte=%02X, (m_disk_io_byte & SANDY_MOUSE_INTMASK)=%02x\n",m_mouse_int,MOUSE_INT_MASK,m_disk_io_byte,(m_disk_io_byte & SANDY_MOUSE_INTMASK));
+
+ // if mouse moved trigger external int
+ if((m_mouse_int & MOUSE_INT_MASK) && do_int)
+ {
+ m_write_extint(ASSERT_LINE);
+ }
+}
+
+
+//-------------------------------------------------
+// read -
+//-------------------------------------------------
+
+READ8_MEMBER( qimi_t::read )
+{
+ UINT8 result = 0;
+ UINT8 buttons;
+
+ switch (offset)
+ {
+ // 0x1bf9c, button status
+ case 0x00 :
+ buttons = m_mouseb->read();
+ result = ((buttons & MOUSE_RIGHT) << 2) | ((buttons & MOUSE_LEFT) << 2);
+ break;
+
+ // 0x1bfbc, direction status
+ case 0x20 :
+ result = ((m_mouse_int & MOUSE_INTX) >> 5) | ((m_mouse_int & MOUSE_INTY) >> 1) |
+ ((m_mouse_int & MOUSE_DIRX) >> 1) | ((m_mouse_int & MOUSE_DIRY) >> 4);
+ break;
+ case 0x22 :
+ m_mouse_int &= ~MOUSE_INT_MASK;
+ break;
+ }
+
+ return result;
+}
+
+
+//-------------------------------------------------
+// write -
+//-------------------------------------------------
+
+WRITE8_MEMBER( qimi_t::write )
+{
+ // write to 0x1bfbe resets int status
+ if (offset == 0x22)
+ {
+ m_mouse_int = 0;
+ }
+}
diff --git a/src/mess/machine/qimi.h b/src/mess/machine/qimi.h
new file mode 100644
index 00000000000..410c214f1de
--- /dev/null
+++ b/src/mess/machine/qimi.h
@@ -0,0 +1,87 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ QL Internal Mouse Interface emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __QIMI__
+#define __QIMI__
+
+#include "emu.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define QIMI_IO_BASE 0x1bf9c
+#define QIMI_IO_LEN 0x22
+#define QIMI_IO_END (QIMI_IO_BASE + QIMI_IO_LEN )
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_QIMI_EXTINT_CALLBACK(_write) \
+ devcb = &qimi_t::set_exting_wr_callback(*device, DEVCB_##_write);
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> qimi_t
+
+class qimi_t : public device_t
+{
+public:
+ // construction/destruction
+ qimi_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ template<class _Object> static devcb_base &set_exting_wr_callback(device_t &device, _Object object) { return downcast<qimi_t &>(device).m_write_extint.set_callback(object); }
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+private:
+ devcb_write_line m_write_extint;
+
+ required_ioport m_mousex;
+ required_ioport m_mousey;
+ required_ioport m_mouseb;
+ required_ioport m_config;
+
+ UINT8 m_mouse_int;
+
+ emu_timer *m_mouse_timer;
+
+ UINT8 m_ql_mouse_x;
+ UINT8 m_ql_mouse_y;
+};
+
+
+// device type definition
+extern const device_type QIMI;
+
+
+
+#endif
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index 6ca221d1083..6d9e575c99d 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -1763,6 +1763,7 @@ $(MESSOBJ)/sinclair.a: \
$(MESS_MACHINE)/beta.o \
$(MESS_MACHINE)/spec_snqk.o \
$(MESS_DRIVERS)/ql.o \
+ $(MESS_MACHINE)/qimi.o \
$(MESS_VIDEO)/zx8301.o \
$(MESS_MACHINE)/zx8302.o \