summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/plus4user.h
blob: b1039756d0bb6aa17059dbcb83f72b215aac2279 (plain) (blame)
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
/**********************************************************************

    Commodore Plus/4 User Port emulation

    Copyright MESS Team.
    Visit http://mamedev.org for licensing and usage restrictions.

**********************************************************************

                    GND       1      A       GND
                    +5V       2      B       P0
                _BRESET       3      C       RxD
                     P2       4      D       RTS
                     P3       5      E       DTR
                     P4       6      F       P7
                     P5       7      H       DCD
                     P0       8      J       P6
                    ATN       9      K       P1
                  +9VAC      10      L       DSR
                  +9VAC      11      M       TxD
                    GND      12      N       GND

**********************************************************************/

#pragma once

#ifndef __PLUS4_USER_PORT__
#define __PLUS4_USER_PORT__

#include "emu.h"



//**************************************************************************
//  CONSTANTS
//**************************************************************************

#define PLUS4_USER_PORT_TAG     "user"



//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_PLUS4_USER_PORT_ADD(_tag, _slot_intf, _def_slot) \
	MCFG_DEVICE_ADD(_tag, PLUS4_USER_PORT, 0) \
	MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)



//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> plus4_user_port_device

class device_plus4_user_port_interface;

class plus4_user_port_device : public device_t,
								public device_slot_interface
{
public:
	// construction/destruction
	plus4_user_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	// computer interface
	DECLARE_READ8_MEMBER( p_r );
	DECLARE_WRITE8_MEMBER( p_w );
	DECLARE_READ_LINE_MEMBER( rxd_r );
	DECLARE_READ_LINE_MEMBER( dcd_r );
	DECLARE_READ_LINE_MEMBER( dsr_r );
	DECLARE_WRITE_LINE_MEMBER( txd_w );
	DECLARE_WRITE_LINE_MEMBER( dtr_w );
	DECLARE_WRITE_LINE_MEMBER( rts_w );
	DECLARE_WRITE_LINE_MEMBER( rxc_w );
	DECLARE_WRITE_LINE_MEMBER( atn_w );

protected:
	// device-level overrides
	virtual void device_config_complete() { };
	virtual void device_start();
	virtual void device_reset();

	device_plus4_user_port_interface *m_cart;
};


// ======================> device_plus4_user_port_interface

// class representing interface-specific live plus4_expansion card
class device_plus4_user_port_interface : public device_slot_card_interface
{
public:
	// construction/destruction
	device_plus4_user_port_interface(const machine_config &mconfig, device_t &device);
	virtual ~device_plus4_user_port_interface();

	virtual UINT8 plus4_p_r() { return 0xff; };
	virtual void plus4_p_w(UINT8 data) { };

	virtual int plus4_rxd_r() { return 1; };
	virtual int plus4_dcd_r() { return 0; };
	virtual int plus4_dsr_r() { return 0; };
	virtual void plus4_txd_w(int state) { };
	virtual void plus4_dtr_w(int state) { };
	virtual void plus4_rts_w(int state) { };
	virtual void plus4_rxc_w(int state) { };
	virtual void plus4_atn_w(int state) { };

protected:
	plus4_user_port_device *m_slot;
};


// device type definition
extern const device_type PLUS4_USER_PORT;



#endif