mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
abc1600: Cleanup
This commit is contained in:
parent
4df837c2e5
commit
e0273591c3
@ -61,8 +61,9 @@ Notes:
|
||||
// MACROS / CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
#define I8035_Z2_TAG "z2"
|
||||
#define I8035_Z5_TAG "z5"
|
||||
#define I8035_Z2_TAG "z2"
|
||||
#define I8035_Z5_TAG "z5"
|
||||
#define R8_TAG "r8"
|
||||
|
||||
|
||||
|
||||
@ -173,7 +174,7 @@ void abc99_device::device_add_mconfig(machine_config &config)
|
||||
m_mousecpu->t1_in_cb().set(FUNC(abc99_device::z5_t1_r));
|
||||
|
||||
// mouse
|
||||
R8(config, m_mouse, 0);
|
||||
LUXOR_R8(config, m_mouse, 0);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
@ -26,7 +26,7 @@
|
||||
// ======================> abc99_device
|
||||
|
||||
class abc99_device : public device_t,
|
||||
public abc_keyboard_interface
|
||||
public abc_keyboard_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
@ -87,7 +87,7 @@ private:
|
||||
required_device<i8035_device> m_maincpu;
|
||||
required_device<i8035_device> m_mousecpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<r8_device> m_mouse;
|
||||
required_device<luxor_r8_device> m_mouse;
|
||||
required_ioport m_z14;
|
||||
required_ioport m_cursor;
|
||||
output_finder<11> m_leds;
|
||||
|
@ -14,24 +14,24 @@
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(R8, r8_device, "r8", "Luxor R8")
|
||||
DEFINE_DEVICE_TYPE(LUXOR_R8, luxor_r8_device, "luxor_r8", "Luxor R8")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// INPUT_PORTS( r8 )
|
||||
//-------------------------------------------------
|
||||
|
||||
INPUT_PORTS_START( r8 )
|
||||
static INPUT_PORTS_START( r8 )
|
||||
PORT_START("MOUSEB")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Left Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Middle Mouse Button") PORT_CODE(MOUSECODE_BUTTON3)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Right Mouse Button") PORT_CODE(MOUSECODE_BUTTON2)
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Middle Mouse Button") PORT_CODE(MOUSECODE_BUTTON3)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Right Mouse Button") PORT_CODE(MOUSECODE_BUTTON2)
|
||||
|
||||
PORT_START("MOUSEX")
|
||||
PORT_BIT( 0xfff, 0x000, IPT_MOUSE_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0)
|
||||
PORT_BIT( 0xfff, 0x000, IPT_MOUSE_X ) PORT_SENSITIVITY(50)
|
||||
|
||||
PORT_START("MOUSEY")
|
||||
PORT_BIT( 0xfff, 0x000, IPT_MOUSE_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0)
|
||||
PORT_BIT( 0xfff, 0x000, IPT_MOUSE_Y ) PORT_SENSITIVITY(50)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ INPUT_PORTS_END
|
||||
// input_ports - device-specific input ports
|
||||
//-------------------------------------------------
|
||||
|
||||
ioport_constructor r8_device::device_input_ports() const
|
||||
ioport_constructor luxor_r8_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( r8 );
|
||||
}
|
||||
@ -49,37 +49,37 @@ ioport_constructor r8_device::device_input_ports() const
|
||||
// scan_mouse -
|
||||
//-------------------------------------------------
|
||||
|
||||
TIMER_CALLBACK_MEMBER(r8_device::scan_mouse)
|
||||
TIMER_CALLBACK_MEMBER(luxor_r8_device::scan_mouse)
|
||||
{
|
||||
switch(m_mouse.phase)
|
||||
switch(m_phase)
|
||||
{
|
||||
case 0:
|
||||
m_mouse.xa = m_mouse.x > m_mouse.prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.xb = m_mouse.x < m_mouse.prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.ya = m_mouse.y > m_mouse.prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.yb = m_mouse.y < m_mouse.prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_xa = m_x > m_prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_xb = m_x < m_prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_ya = m_y > m_prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_yb = m_y < m_prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
break;
|
||||
case 1:
|
||||
m_mouse.xa = m_mouse.xb = m_mouse.x != m_mouse.prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.ya = m_mouse.yb = m_mouse.y != m_mouse.prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_xa = m_xb = m_x != m_prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_ya = m_yb = m_y != m_prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
break;
|
||||
case 2:
|
||||
m_mouse.xa = m_mouse.x < m_mouse.prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.xb = m_mouse.x > m_mouse.prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.ya = m_mouse.y < m_mouse.prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_mouse.yb = m_mouse.y > m_mouse.prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_xa = m_x < m_prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_xb = m_x > m_prev_x ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_ya = m_y < m_prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
m_yb = m_y > m_prev_y ? CLEAR_LINE : ASSERT_LINE;
|
||||
break;
|
||||
case 3:
|
||||
m_mouse.xa = m_mouse.xb = ASSERT_LINE;
|
||||
m_mouse.ya = m_mouse.yb = ASSERT_LINE;
|
||||
m_mouse.prev_x = m_mouse.x;
|
||||
m_mouse.prev_y = m_mouse.y;
|
||||
m_mouse.x = m_mouse_x->read();
|
||||
m_mouse.y = m_mouse_y->read();
|
||||
m_xa = m_xb = ASSERT_LINE;
|
||||
m_ya = m_yb = ASSERT_LINE;
|
||||
m_prev_x = m_x;
|
||||
m_prev_y = m_y;
|
||||
m_x = m_mouse_x->read();
|
||||
m_y = m_mouse_y->read();
|
||||
break;
|
||||
}
|
||||
|
||||
m_mouse.phase = (m_mouse.phase + 1) & 3;
|
||||
m_phase = (m_phase + 1) & 3;
|
||||
}
|
||||
|
||||
|
||||
@ -89,11 +89,11 @@ TIMER_CALLBACK_MEMBER(r8_device::scan_mouse)
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// r8_device - constructor
|
||||
// luxor_r8_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
r8_device::r8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, R8, tag, owner, clock),
|
||||
luxor_r8_device::luxor_r8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, LUXOR_R8, tag, owner, clock),
|
||||
m_mouse_timer(nullptr),
|
||||
m_mouse_b(*this, "MOUSEB"),
|
||||
m_mouse_x(*this, "MOUSEX"),
|
||||
@ -106,22 +106,22 @@ r8_device::r8_device(const machine_config &mconfig, const char *tag, device_t *o
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void r8_device::device_start()
|
||||
void luxor_r8_device::device_start()
|
||||
{
|
||||
// allocate timers
|
||||
m_mouse_timer = timer_alloc(FUNC(r8_device::scan_mouse), this);
|
||||
m_mouse_timer = timer_alloc(FUNC(luxor_r8_device::scan_mouse), this);
|
||||
m_mouse_timer->adjust(attotime::from_hz(1000), 0, attotime::from_hz(1000));
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_mouse.phase));
|
||||
save_item(NAME(m_mouse.x));
|
||||
save_item(NAME(m_mouse.y));
|
||||
save_item(NAME(m_mouse.prev_x));
|
||||
save_item(NAME(m_mouse.prev_y));
|
||||
save_item(NAME(m_mouse.xa));
|
||||
save_item(NAME(m_mouse.xb));
|
||||
save_item(NAME(m_mouse.ya));
|
||||
save_item(NAME(m_mouse.yb));
|
||||
save_item(NAME(m_phase));
|
||||
save_item(NAME(m_x));
|
||||
save_item(NAME(m_y));
|
||||
save_item(NAME(m_prev_x));
|
||||
save_item(NAME(m_prev_y));
|
||||
save_item(NAME(m_xa));
|
||||
save_item(NAME(m_xb));
|
||||
save_item(NAME(m_ya));
|
||||
save_item(NAME(m_yb));
|
||||
}
|
||||
|
||||
|
||||
@ -129,13 +129,13 @@ void r8_device::device_start()
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void r8_device::device_reset()
|
||||
void luxor_r8_device::device_reset()
|
||||
{
|
||||
m_mouse.phase = 0;
|
||||
m_mouse.xa = m_mouse.xb = ASSERT_LINE;
|
||||
m_mouse.ya = m_mouse.yb = ASSERT_LINE;
|
||||
m_mouse.x = m_mouse.y = 0;
|
||||
m_mouse.prev_x = m_mouse.prev_y = 0;
|
||||
m_phase = 0;
|
||||
m_xa = m_xb = ASSERT_LINE;
|
||||
m_ya = m_yb = ASSERT_LINE;
|
||||
m_x = m_y = 0;
|
||||
m_prev_x = m_prev_y = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -143,15 +143,15 @@ void r8_device::device_reset()
|
||||
// read -
|
||||
//-------------------------------------------------
|
||||
|
||||
u8 r8_device::read()
|
||||
u8 luxor_r8_device::read()
|
||||
{
|
||||
u8 data = 0;
|
||||
|
||||
// mouse movement
|
||||
data |= m_mouse.xa;
|
||||
data |= m_mouse.xb << 1;
|
||||
data |= m_mouse.ya << 2;
|
||||
data |= m_mouse.yb << 3;
|
||||
data |= m_xa;
|
||||
data |= m_xb << 1;
|
||||
data |= m_ya << 2;
|
||||
data |= m_yb << 3;
|
||||
|
||||
// mouse buttons
|
||||
data |= (m_mouse_b->read() & 0x07) << 4;
|
||||
|
@ -13,29 +13,17 @@
|
||||
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS / CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
#define R8_TAG "r8"
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> r8_device
|
||||
// ======================> luxor_r8_device
|
||||
|
||||
class r8_device : public device_t
|
||||
class luxor_r8_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
r8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
luxor_r8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
u8 read();
|
||||
|
||||
@ -55,23 +43,20 @@ private:
|
||||
required_ioport m_mouse_x;
|
||||
required_ioport m_mouse_y;
|
||||
|
||||
struct
|
||||
{
|
||||
int phase;
|
||||
int x;
|
||||
int y;
|
||||
int prev_x;
|
||||
int prev_y;
|
||||
int xa;
|
||||
int xb;
|
||||
int ya;
|
||||
int yb;
|
||||
} m_mouse;
|
||||
int m_phase;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_prev_x;
|
||||
int m_prev_y;
|
||||
int m_xa;
|
||||
int m_xb;
|
||||
int m_ya;
|
||||
int m_yb;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(R8, r8_device)
|
||||
DECLARE_DEVICE_TYPE(LUXOR_R8, luxor_r8_device)
|
||||
|
||||
|
||||
#endif // MAME_BUS_ABCKB_R8_H
|
||||
|
Loading…
Reference in New Issue
Block a user