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
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/****************************************************************************
BBC Master Compact Joystick/Mouse port
*****************************************************************************/
#include "emu.h"
#include "joyport.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(BBC_JOYPORT_SLOT, bbc_joyport_slot_device, "bbc_joyport_slot", "BBC Master Compact Joystick/Mouse port")
//**************************************************************************
// DEVICE BBC_JOYPORT INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_bbc_joyport_interface - constructor
//-------------------------------------------------
device_bbc_joyport_interface::device_bbc_joyport_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "bbcjoyport")
{
m_slot = dynamic_cast<bbc_joyport_slot_device *>(device.owner());
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bbcmc_joyport_slot_device - constructor
//-------------------------------------------------
bbc_joyport_slot_device::bbc_joyport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, BBC_JOYPORT_SLOT, tag, owner, clock),
device_single_card_slot_interface(mconfig, *this),
m_device(nullptr),
m_cb1_handler(*this),
m_cb2_handler(*this)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void bbc_joyport_slot_device::device_start()
{
m_device = get_card_device();
// resolve callbacks
m_cb1_handler.resolve_safe();
m_cb2_handler.resolve_safe();
}
//-------------------------------------------------
// pb_r
//-------------------------------------------------
uint8_t bbc_joyport_slot_device::pb_r()
{
// TODO: Joyport connected to PB0-PB4 only. PB5-PB7 are expansion port.
if (m_device)
return 0xe0 | m_device->pb_r();
else
return 0xff;
}
//-------------------------------------------------
// pb_w
//-------------------------------------------------
void bbc_joyport_slot_device::pb_w(uint8_t data)
{
if (m_device)
m_device->pb_w(data);
}
//-------------------------------------------------
// SLOT_INTERFACE( bbc_joyport_devices )
//-------------------------------------------------
// slot devices
#include "joystick.h"
//#include "mouse.h"
void bbc_joyport_devices(device_slot_interface &device)
{
device.option_add("joystick", BBCMC_JOYSTICK);
//device.option_add("mouse", BBCMC_MOUSE);
}
|