summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/comxexp.h
blob: 19d9f03f9b7204b612a4d049695cfcc3c1a750b2 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/**********************************************************************

    COMX-35 Expansion Slot emulation

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

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

                    GND       1      A       GND
                     NC       2      B       DS
                    +5V       3      C       V+
                     D0       4      D       D1
                     D2       5      E       D3
                     D4       6      F       D5
                     D6       7      H       D7
                    _DP       8      J       Q
                 _CLEAR       9      K       _MRD
                    TPA      10      L       N0
                     N1      11      M       N2
                   _RAS      12      N       _INT
                  _WAIT      13      P       CLOCK
                    SC1      14      R       SC0
                   _EF4      15      S       _CASE
                    TPB      16      T       _A15
                   _MWR      17      U       A14
                    MA7      18      V       _A14
                    MA5      19      W       MA6
                    MA4      20      X       MA3
                    MA2      21      Y       _EXTROM
                    MA1      22      Z       MA0

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

#pragma once

#ifndef __COMX35_EXPANSION_SLOT__
#define __COMX35_EXPANSION_SLOT__

#include "emu.h"



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

#define COMX_EXPANSION_BUS_TAG		"comxexp"



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

#define COMX_EXPANSION_INTERFACE(_name) \
	const comx_expansion_slot_interface (_name) =


#define MCFG_COMX_EXPANSION_SLOT_ADD(_tag, _config, _slot_intf, _def_slot, _def_inp) \
    MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \
    MCFG_DEVICE_CONFIG(_config) \
	MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)



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

// ======================> comx_expansion_slot_interface

struct comx_expansion_slot_interface
{
    devcb_write_line	m_out_int_cb;
    devcb_write_line	m_out_ef4_cb;
    devcb_write_line	m_out_wait_cb;
    devcb_write_line	m_out_clear_cb;
};


// ======================> comx_expansion_slot_device

class device_comx_expansion_card_interface;

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

	UINT8 mrd_r(offs_t offset, int *extrom);
	void mwr_w(offs_t offset, UINT8 data);

	UINT8 io_r(offs_t offset);
	void io_w(offs_t offset, UINT8 data);

	DECLARE_WRITE_LINE_MEMBER( ds_w );
	DECLARE_WRITE_LINE_MEMBER( q_w );

	DECLARE_WRITE_LINE_MEMBER( int_w );
	DECLARE_WRITE_LINE_MEMBER( ef4_w );
	DECLARE_WRITE_LINE_MEMBER( wait_w );
	DECLARE_WRITE_LINE_MEMBER( clear_w );

	UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

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

	devcb_resolved_write_line	m_out_int_func;
	devcb_resolved_write_line	m_out_ef4_func;
	devcb_resolved_write_line	m_out_wait_func;
	devcb_resolved_write_line	m_out_clear_func;

	device_comx_expansion_card_interface *m_card;
};


// ======================> device_comx_expansion_card_interface

// class representing interface-specific live comx_expansion card
class device_comx_expansion_card_interface : public device_slot_card_interface
{
	friend class comx_expansion_slot_device;

public:
	// construction/destruction
	device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device);
	virtual ~device_comx_expansion_card_interface();

protected:
	// signals
	virtual void comx_ds_w(int state) { };
	virtual void comx_q_w(int state) { };

	// memory access
	virtual UINT8 comx_mrd_r(offs_t offset, int *extrom) { return 0; };
	virtual void comx_mwr_w(offs_t offset, UINT8 data) { };

	// I/O access
	virtual UINT8 comx_io_r(offs_t offset) { return 0; };
	virtual void comx_io_w(offs_t offset, UINT8 data) { };

	comx_expansion_slot_device *m_slot;
};


// device type definition
extern const device_type COMX_EXPANSION_SLOT;



#endif