diff options
author | 2014-03-26 08:39:25 +0000 | |
---|---|---|
committer | 2014-03-26 08:39:25 +0000 | |
commit | 0916535c50c0bc54409c90eb6ee95f3fcbe83d62 (patch) | |
tree | 5212d373d0f50dd798fca06c682f43eff9a27597 /src/mess/includes/ql.h | |
parent | dc41389e02c49ffb7c6296773c2580b927604cfb (diff) |
(MESS) ql.c: Added emulation of both the QIMI and Sandy mice to the QL driver as well as adding support of those to the Sandy SuperQBoard. Moved the selection of the mouse and disk interface from dip switches to config, as this seemed more appropriate. [Phill-Harvey-Smith]
Diffstat (limited to 'src/mess/includes/ql.h')
-rw-r--r-- | src/mess/includes/ql.h | 128 |
1 files changed, 99 insertions, 29 deletions
diff --git a/src/mess/includes/ql.h b/src/mess/includes/ql.h index 4cf92bd8214..e3248037467 100644 --- a/src/mess/includes/ql.h +++ b/src/mess/includes/ql.h @@ -8,6 +8,8 @@ #include "bus/rs232/rs232.h" #include "machine/ram.h" #include "machine/wd17xx.h" +#include "bus/centronics/ctronics.h" + #define SCREEN_TAG "screen" @@ -30,32 +32,40 @@ #define X3 XTAL_4_436MHz #define X4 XTAL_11MHz -#define QL_CONFIG_PORT "QLCONFIG" -#define DISK_TYPE_MASK 0x03 -#define DISK_TYPE_NONE 0x00 -#define DISK_TYPE_TRUMP 0x01 -#define DISK_TYPE_SANDY 0x02 - -#define TRUMP_DRIVE1_MASK 0x01 -#define TRUMP_DRIVE0_MASK 0x02 -#define TRUMP_MOTOR_MASK 0x04 -#define TRUMP_SIDE_SHIFT 3 -#define TRUMP_SIDE_MASK (1 << TRUMP_SIDE_SHIFT) - -#define CART_ROM_BASE 0x0c000 -#define CART_ROM_END 0x0ffff -#define TRUMP_ROM_BASE 0x14000 -#define TRUMP_ROM_LEN 0x08000 -#define TRUMP_ROM_END (TRUMP_ROM_BASE+(TRUMP_ROM_LEN-1)) - -#define TRUMP_IO_BASE 0x1c000 -#define TRUMP_IO_LEN 0x04000 -#define TRUMP_IO_END (TRUMP_IO_BASE+(TRUMP_IO_LEN-1)) - -#define SANDY_ROM_BASE 0x1c000 -#define SANDY_IO_BASE 0xc3fc0 -#define SANDY_IO_LEN 0x00040 -#define SANDY_IO_END (SANDY_IO_BASE+(SANDY_IO_LEN-1)) +#define QL_CONFIG_PORT "config" +#define QIMI_PORT_MASK 0x01 +#define QIMI_NONE 0x00 +#define QIMI_MOUSE 0x01 +#define DISK_TYPE_MASK 0x06 +#define DISK_TYPE_NONE 0x00 +#define DISK_TYPE_TRUMP 0x02 +#define DISK_TYPE_SANDY_SD 0x04 +#define DISK_TYPE_SANDY_SQB 0x06 +#define IS_SANDY_DISK(__dtype__) ((__dtype__ == DISK_TYPE_SANDY_SD) || (__dtype__ == DISK_TYPE_SANDY_SQB)) + +#define TRUMP_DRIVE1_MASK 0x01 +#define TRUMP_DRIVE0_MASK 0x02 +#define TRUMP_MOTOR_MASK 0x04 +#define TRUMP_SIDE_SHIFT 3 +#define TRUMP_SIDE_MASK (1 << TRUMP_SIDE_SHIFT) + +#define CART_ROM_BASE 0x0c000 +#define CART_ROM_END 0x0ffff + +#define TRUMP_ROM_MBASE 0x10000 +#define TRUMP_ROM_BASE 0x14000 +#define TRUMP_ROM_LEN 0x08000 +#define TRUMP_ROM_END (TRUMP_ROM_MBASE+(TRUMP_ROM_LEN-1)) + +#define TRUMP_IO_BASE 0x1c000 +#define TRUMP_IO_LEN 0x04000 +#define TRUMP_IO_END (TRUMP_IO_BASE+(TRUMP_IO_LEN-1)) + +#define SANDY_ROM_BASE_SD 0x1c000 +#define SANDY_ROM_BASE_SQB 0x20000 +#define SANDY_IO_BASE 0xc3fc0 +#define SANDY_IO_LEN 0x00040 +#define SANDY_IO_END (SANDY_IO_BASE+(SANDY_IO_LEN-1)) #define SANDY_DRIVE0_MASK 0x02 #define SANDY_DRIVE1_MASK 0x04 @@ -66,11 +76,43 @@ #define SANDY_DDEN_MASK (1 << SANDY_DDEN_SHIFT) #define SANDY_PRINTER_STROBE 0x20 #define SANDY_PRINTER_INTMASK 0x40 +#define SANDY_MOUSE_INTMASK 0x80 + +#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_IO_BASE 0x1bf9c +#define QIMI_IO_LEN 0x22 +#define QIMI_IO_END (QIMI_IO_BASE + QIMI_IO_LEN ) + +#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) class ql_state : public driver_device { public: + enum + { + TIMER_MOUSE_TICK, + }; + ql_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, M68008_TAG), @@ -94,7 +136,11 @@ public: m_y6(*this, "Y6"), m_y7(*this, "Y7"), m_joy0(*this, "JOY0"), - m_joy1(*this, "JOY1") + m_joy1(*this, "JOY1"), + m_config(*this, QL_CONFIG_PORT), + m_mousex(*this, MOUSEX_TAG), + m_mousey(*this, MOUSEY_TAG), + m_mouseb(*this, MOUSEB_TAG) { } required_device<cpu_device> m_maincpu; @@ -119,6 +165,10 @@ public: required_ioport m_y7; required_ioport m_joy0; required_ioport m_joy1; + optional_ioport m_config; + optional_ioport m_mousex; + optional_ioport m_mousey; + optional_ioport m_mouseb; virtual void machine_start(); virtual void machine_reset(); @@ -155,14 +205,34 @@ public: void trump_card_set_control(UINT8 data); void sandy_set_control(UINT8 data); - - int m_disk_type; + void sandy_print_char(UINT8 data); + + UINT8 m_disk_type; int m_disk_io_base; UINT8 m_disk_io_byte; UINT8 m_printer_char; DECLARE_READ_LINE_MEMBER(disk_io_dden_r); DECLARE_WRITE_LINE_MEMBER(disk_io_intrq_w); DECLARE_WRITE_LINE_MEMBER(disk_io_drq_w); + + DECLARE_WRITE_LINE_MEMBER( sandy_printer_busy ); + + // QIMI or Sandy mouse + void mouse_tick(); + + DECLARE_READ8_MEMBER( qimi_io_r ); + DECLARE_WRITE8_MEMBER( qimi_io_w ); + + UINT8 m_mouse_int; + + emu_timer *m_mouse_timer; + + UINT8 m_ql_mouse_x; + UINT8 m_ql_mouse_y; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + }; #endif |