1 // license:GPL-2.0+
2 // copyright-holders:Dirk Best
3 /***************************************************************************
4 
5     EACA Colour Genie Expansion Slot
6 
7     50-pin slot
8 
9      1  GND        26  /MREQ
10      2  A8         27  /WR
11      3  A7         28  /C4
12      4  A6         29  (not used)
13      5  A9         30  /C1
14      6  A5         31  BD3
15      7  A4         32  /C3
16      8  A3         33  (not used)
17      9  A10        34  /C2
18     10  A2         35  DB6
19     11  A11        36  /RD
20     12  A1         37  BD4
21     13  A0         38  (not used)
22     14  A12        39  BD7
23     15  A14        40  (not used)
24     16  A13        41  BD5
25     17  /RFSH      42  (not useD)
26     18  A15        43  BD0
27     19  /INT       44  (not used)
28     20  /BUSRQ     45  BD2
29     21  /NMI       46  /RESET
30     22  /WAIT      47  /M1
31     23  /HALT      48  /IORQ
32     24  /BUSAK     49  BD1
33     25  /ROMDIS    50  +5V
34 
35 ***************************************************************************/
36 
37 #ifndef MAME_BUS_CGENIE_EXPANSION_EXPANSION_H
38 #define MAME_BUS_CGENIE_EXPANSION_EXPANSION_H
39 
40 #pragma once
41 
42 // include here so drivers don't need to
43 #include "carts.h"
44 
45 
46 //**************************************************************************
47 //  TYPE DEFINITIONS
48 //**************************************************************************
49 
50 class device_cg_exp_interface;
51 
52 class cg_exp_slot_device : public device_t, public device_single_card_slot_interface<device_cg_exp_interface>
53 {
54 public:
55 	// construction/destruction
cg_exp_slot_device(machine_config const & mconfig,char const * tag,device_t * owner)56 	cg_exp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner)
57 		: cg_exp_slot_device(mconfig, tag, owner, (uint32_t)0)
58 	{
59 		option_reset();
60 		cg_exp_slot_carts(*this);
61 		set_default_option(nullptr);
62 		set_fixed(false);
63 	}
64 	cg_exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
65 	virtual ~cg_exp_slot_device();
66 
set_program_space(T && tag,int spacenum)67 	template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
set_io_space(T && tag,int spacenum)68 	template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
69 
70 	// callbacks
int_handler()71 	auto int_handler() { return m_int_handler.bind(); }
nmi_handler()72 	auto nmi_handler() { return m_nmi_handler.bind(); }
reset_handler()73 	auto reset_handler() { return m_reset_handler.bind(); }
74 
75 	// called from cart device
DECLARE_WRITE_LINE_MEMBER(int_w)76 	DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); }
DECLARE_WRITE_LINE_MEMBER(nmi_w)77 	DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
DECLARE_WRITE_LINE_MEMBER(reset_w)78 	DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_reset_handler(state); }
79 
80 	required_address_space m_program;
81 	required_address_space m_io;
82 
83 protected:
84 	// device-level overrides
85 	virtual void device_start() override;
86 
87 	device_cg_exp_interface *m_cart;
88 
89 private:
90 	devcb_write_line m_int_handler;
91 	devcb_write_line m_nmi_handler;
92 	devcb_write_line m_reset_handler;
93 };
94 
95 // class representing interface-specific live expansion device
96 class device_cg_exp_interface : public device_interface
97 {
98 public:
99 	// construction/destruction
100 	virtual ~device_cg_exp_interface();
101 
102 protected:
103 	device_cg_exp_interface(const machine_config &mconfig, device_t &device);
104 
105 	cg_exp_slot_device *m_slot;
106 };
107 
108 // device type definition
109 DECLARE_DEVICE_TYPE(CG_EXP_SLOT, cg_exp_slot_device)
110 
111 #endif // MAME_BUS_CGENIE_EXPANSION_EXPANSION_H
112