summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/oricext/oricext.h
blob: 5308ca36da88c2efafe58a2a59f6e1f2a4a1e0c4 (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
/***************************************************************************

  oric.h - Oric 1/Atmos extension port

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

#ifndef __ORICEXT_H__
#define __ORICEXT_H__

#include "emu.h"
#include "cpu/m6502/m6502.h"

#define MCFG_ORICEXT_ADD(_tag, _slot_intf, _def_slot, _cputag, _irq)    \
	MCFG_DEVICE_ADD(_tag, ORICEXT_CONNECTOR, 0) \
	MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
	downcast<oricext_connector *>(device)->set_cputag(_cputag); \
	devcb = &oricext_connector::set_irq_handler(*device, DEVCB_##_irq);


class oricext_device;

class oricext_connector: public device_t,
							public device_slot_interface
{
public:
	oricext_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	virtual ~oricext_connector();

	void set_cputag(const char *tag);
	template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<oricext_connector &>(device).irq_handler.set_callback(object); }
	void irq_w(int state);

protected:
	devcb_write_line irq_handler;
	const char *cputag;
	virtual void device_start();
	virtual void device_config_complete();
};

class oricext_device : public device_t,
						public device_slot_card_interface
{
public:
	oricext_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);

	void set_cputag(const char *tag);
	DECLARE_WRITE_LINE_MEMBER(irq_w);

protected:
	const char *cputag;
	m6502_device *cpu;
	oricext_connector *connector;
	memory_bank *bank_c000_r, *bank_e000_r, *bank_f800_r, *bank_c000_w, *bank_e000_w, *bank_f800_w;
	UINT8 *rom, *ram;
	UINT8 junk_read[8192], junk_write[8192];

	virtual void device_start();
};

extern const device_type ORICEXT_CONNECTOR;
SLOT_INTERFACE_EXTERN( oricext_intf );

#endif  /* __ORICEXT_H__ */