1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Mouse emulation
**********************************************************************/
#ifndef MAME_BUS_BBC_USERPORT_POINTER_H
#define MAME_BUS_BBC_USERPORT_POINTER_H
#pragma once
#include "userport.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class bbc_pointer_device :
public device_t,
public device_bbc_userport_interface
{
public:
DECLARE_INPUT_CHANGED_MEMBER(pointer_changed);
protected:
// construction/destruction
bbc_pointer_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
required_ioport m_pointer_x;
required_ioport m_pointer_y;
required_ioport m_buttons;
// quadrature output
int m_xdir, m_ydir;
// internal quadrature state
int m_direction_x, m_direction_y;
int m_distance_x, m_distance_y;
int m_phase_x, m_phase_y;
TIMER_CALLBACK_MEMBER(pointer_poll);
emu_timer *m_pointer_timer;
};
// ======================> bbc_amxmouse_device
class bbc_amxmouse_device : public bbc_pointer_device
{
public:
// construction/destruction
bbc_amxmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint8_t pb_r() override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
};
// ======================> bbc_m512mouse_device
class bbc_m512mouse_device : public bbc_pointer_device
{
public:
// construction/destruction
bbc_m512mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint8_t pb_r() override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
};
// ======================> bbc_tracker_device
class bbc_tracker_device : public bbc_pointer_device
{
public:
// construction/destruction
bbc_tracker_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint8_t pb_r() override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
};
// device type definition
DECLARE_DEVICE_TYPE(BBC_AMXMOUSE, bbc_amxmouse_device)
DECLARE_DEVICE_TYPE(BBC_M512MOUSE, bbc_m512mouse_device)
DECLARE_DEVICE_TYPE(BBC_TRACKER, bbc_tracker_device)
#endif // MAME_BUS_BBC_USERPORT_POINTER_H
|