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
|
/**********************************************************************
Sega Master System controller port emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
**********************************************************************/
#pragma once
#ifndef __SMS_CONTROL_PORT__
#define __SMS_CONTROL_PORT__
#include "emu.h"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_SMS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, SMS_CONTROL_PORT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
#define MCFG_SMS_CONTROL_PORT_MODIFY(_tag) \
MCFG_DEVICE_MODIFY(_tag)
#define MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(_devcb) \
devcb = &sms_control_port_device::set_th_input_handler(*device, DEVCB2_##_devcb);
#define MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(_devcb) \
devcb = &sms_control_port_device::set_pixel_handler(*device, DEVCB2_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> sms_control_port_device
class device_sms_control_port_interface;
class sms_control_port_device : public device_t,
public device_slot_interface
{
public:
// construction/destruction
sms_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~sms_control_port_device();
// static configuration helpers
template<class _Object> static devcb2_base &set_th_input_handler(device_t &device, _Object object) { return downcast<sms_control_port_device &>(device).m_th_pin_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_pixel_handler(device_t &device, _Object object) { return downcast<sms_control_port_device &>(device).m_pixel_handler.set_callback(object); }
// Physical DE-9 connector interface
// Data returned by the port_r methods:
// bit 0 - pin 1 - Up
// bit 1 - pin 2 - Down
// bit 2 - pin 3 - Left
// bit 3 - pin 4 - Right
// bit 4 - pin 5 - Vcc (no data)
// bit 5 - pin 6 - TL (Button 1/Light Phaser Trigger)
// bit 6 - pin 7 - TH (Light Phaser sensor)
// pin 8 - GND
// bit 7 - pin 9 - TR (Button 2)
//
UINT8 port_r();
void port_w( UINT8 data );
void th_pin_w(int state);
UINT32 pixel_r();
//protected:
// device-level overrides
virtual void device_start();
device_sms_control_port_interface *m_device;
private:
devcb2_write_line m_th_pin_handler;
devcb2_read32 m_pixel_handler;
};
// ======================> device_sms_control_port_interface
// class representing interface-specific live sms_expansion card
class device_sms_control_port_interface : public device_slot_card_interface
{
public:
// construction/destruction
device_sms_control_port_interface(const machine_config &mconfig, device_t &device);
virtual ~device_sms_control_port_interface();
virtual UINT8 peripheral_r() { return 0xff; };
virtual void peripheral_w(UINT8 data) { };
protected:
sms_control_port_device *m_port;
};
// device type definition
extern const device_type SMS_CONTROL_PORT;
// slot devices
#include "joypad.h"
#include "lphaser.h"
#include "paddle.h"
#include "sports.h"
#include "sportsjp.h"
#include "rfu.h"
SLOT_INTERFACE_EXTERN( sms_control_port_devices );
#endif
|