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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Acorn ANF04 Bitstik
http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_BitStik.html
Robocom Bitstik 2
**********************************************************************/
#include "emu.h"
#include "bitstik.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(BBC_BITSTIK1, bbc_bitstik1_device, "bbc_bitstik1", "Acorn Bitstik")
DEFINE_DEVICE_TYPE(BBC_BITSTIK2, bbc_bitstik2_device, "bbc_bitstik2", "Robo Bitstik 2")
//-------------------------------------------------
// ROM( bitstik )
//-------------------------------------------------
ROM_START(bitstik1)
ROM_REGION(0x4000, "exp_rom", 0)
ROM_LOAD("bitstik1.rom", 0x0000, 0x2000, CRC(a3c539f8) SHA1(c6f2cf2f6d1e48819a8381c6a1c97ca8fa5ab117))
ROM_RELOAD(0x2000, 0x2000)
ROM_END
ROM_START(bitstik2)
ROM_REGION(0x4000, "exp_rom", 0)
ROM_LOAD("bitstik2.rom", 0x0000, 0x2000, CRC(a2b5a743) SHA1(4d0040af6bdc6a587e42d4aa36d528b768cf9549))
ROM_RELOAD(0x2000, 0x2000)
ROM_END
//-------------------------------------------------
// INPUT_PORTS( bitstik )
//-------------------------------------------------
static INPUT_PORTS_START(bitstik)
PORT_START("CHANNEL0")
PORT_BIT(0xff, 0x00, IPT_AD_STICK_X) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick X")
PORT_START("CHANNEL1")
PORT_BIT(0xff, 0x00, IPT_AD_STICK_Y) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick Y")
PORT_START("CHANNEL2")
PORT_BIT(0xff, 0x00, IPT_AD_STICK_Z) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick Z")
PORT_START("CHANNEL3")
PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Right Button - Release")
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Top Button - Execute")
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Left Button - Confirm")
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor bbc_bitstik_device::device_input_ports() const
{
return INPUT_PORTS_NAME(bitstik);
}
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const tiny_rom_entry *bbc_bitstik1_device::device_rom_region() const
{
return ROM_NAME(bitstik1);
}
const tiny_rom_entry *bbc_bitstik2_device::device_rom_region() const
{
return ROM_NAME(bitstik2);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bbc_bitstik_device - constructor
//-------------------------------------------------
bbc_bitstik_device::bbc_bitstik_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, const XTAL &clock) :
device_t(mconfig, type, tag, owner, clock),
device_bbc_analogue_interface(mconfig, *this),
m_channel(*this, "CHANNEL%u", 0),
m_buttons(*this, "BUTTONS")
{
}
bbc_bitstik1_device::bbc_bitstik1_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
bbc_bitstik_device(mconfig, BBC_BITSTIK1, tag, owner, clock)
{
}
bbc_bitstik2_device::bbc_bitstik2_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
bbc_bitstik_device(mconfig, BBC_BITSTIK2, tag, owner, clock)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void bbc_bitstik_device::device_start()
{
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
uint8_t bbc_bitstik_device::ch_r(int channel)
{
return m_channel[channel]->read();
}
uint8_t bbc_bitstik_device::pb_r()
{
return m_buttons->read() & 0x30;
}
|