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
161
162
163
164
165
166
167
168
169
170
171
172
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
VideoBrain Expansion Port emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
GND 1 2 BO2
BO1 3 4 BO0
BA0 5 6 BA1
BA2 7 8 BA3
BA4 9 10 BA5
BA6 11 12 BA7
+5V 13 14 BA8
BA9 15 16 _CS1
BA10 17 18 BO7
BO6 19 20 BO5
BO4 21 22 BO3
BA11 23 24 BA12
BRC 25 26 ?
EXTRES 27 28 _CS2
? 29 30 UV202/35
HBLANK 31 32 UV201/5
UV201/2 33 34 UV201/4
UV201/3 35 36 BISTROBE
UV202/1 37 38 BA13
UV202/18 39 40 ?
R/W 41 42 +5V
GND 43 44 GND
GND 45 46 N/C
? 47 48 N/C
N/C 49 50 N/C
**********************************************************************/
#pragma once
#ifndef __VIDEOBRAIN_EXPANSION_SLOT__
#define __VIDEOBRAIN_EXPANSION_SLOT__
#include "emu.h"
//**************************************************************************
// CONSTANTS
//**************************************************************************
#define VIDEOBRAIN_EXPANSION_SLOT_TAG "exp"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, VIDEOBRAIN_EXPANSION_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_EXTRES_CALLBACK(_write) \
devcb = &videobrain_expansion_slot_device::set_extres_wr_callback(*device, DEVCB2_##_write);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class videobrain_expansion_slot_device;
// ======================> device_videobrain_expansion_card_interface
class device_videobrain_expansion_card_interface : public device_slot_card_interface
{
friend class videobrain_expansion_slot_device;
public:
// construction/destruction
device_videobrain_expansion_card_interface(const machine_config &mconfig, device_t &device);
virtual ~device_videobrain_expansion_card_interface() { }
protected:
// initialization
virtual UINT8* videobrain_rom_pointer(running_machine &machine, size_t size);
virtual UINT8* videobrain_ram_pointer(running_machine &machine, size_t size);
// runtime
virtual UINT8 videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2) { return 0; };
virtual void videobrain_bo_w(address_space &space, offs_t offset, UINT8 data, int cs1, int cs2) { };
virtual void videobrain_extres_w() { };
videobrain_expansion_slot_device *m_slot;
dynamic_buffer m_rom;
dynamic_buffer m_ram;
size_t m_rom_mask;
size_t m_ram_mask;
};
// ======================> videobrain_expansion_slot_device
class videobrain_expansion_slot_device : public device_t,
public device_slot_interface,
public device_image_interface
{
public:
// construction/destruction
videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~videobrain_expansion_slot_device() { }
template<class _Object> static devcb2_base &set_extres_wr_callback(device_t &device, _Object object) { return downcast<videobrain_expansion_slot_device &>(device).m_write_extres.set_callback(object); }
// computer interface
UINT8 bo_r(address_space &space, offs_t offset, int cs1, int cs2);
void bo_w(address_space &space, offs_t offset, UINT8 data, int cs1, int cs2);
DECLARE_READ8_MEMBER( cs1_r ) { return bo_r(space, offset + 0x1000, 0, 1); }
DECLARE_WRITE8_MEMBER( cs1_w ) { bo_w(space, offset + 0x1000, data, 0, 1); }
DECLARE_READ8_MEMBER( cs2_r ) { return bo_r(space, offset + 0x1800, 1, 0); }
DECLARE_WRITE8_MEMBER( cs2_w ) { bo_w(space, offset + 0x1800, data, 1, 0); }
DECLARE_READ8_MEMBER( unmap_r ) { return bo_r(space, offset + 0x3000, 1, 0); }
DECLARE_WRITE8_MEMBER( unmap_w ) { bo_w(space, offset + 0x3000, data, 1, 0); }
// cartridge interface
DECLARE_WRITE_LINE_MEMBER( extres_w ) { m_write_extres(state); }
protected:
// device-level overrides
virtual void device_config_complete() { update_names(); }
virtual void device_start();
// image-level overrides
virtual bool call_load();
virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
virtual iodevice_t image_type() const { return IO_CARTSLOT; }
virtual bool is_readable() const { return 1; }
virtual bool is_writeable() const { return 0; }
virtual bool is_creatable() const { return 0; }
virtual bool must_be_loaded() const { return 0; }
virtual bool is_reset_on_load() const { return 1; }
virtual const char *image_interface() const { return "vidbrain_cart"; }
virtual const char *file_extensions() const { return "bin"; }
virtual const option_guide *create_option_guide() const { return NULL; }
// slot interface overrides
virtual void get_default_card_software(astring &result);
devcb2_write_line m_write_extres;
device_videobrain_expansion_card_interface *m_cart;
};
// device type definition
extern const device_type VIDEOBRAIN_EXPANSION_SLOT;
SLOT_INTERFACE_EXTERN( vidbrain_expansion_cards );
#endif
|