summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/oricext/oricext.cpp
blob: 59bbb54aa55e07b923f3051085ee078cdeea3fe2 (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
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#include "emu.h"
#include "oricext.h"
#include "jasmin.h"
#include "microdisc.h"

DEFINE_DEVICE_TYPE(ORICEXT_CONNECTOR, oricext_connector, "oricext_connector", "ORIC extension connector")

oricext_connector::oricext_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	device_t(mconfig, ORICEXT_CONNECTOR, tag, owner, clock),
	device_single_card_slot_interface<device_oricext_interface>(mconfig, *this),
	irq_handler(*this),
	reset_handler(*this)
{
}

oricext_connector::~oricext_connector()
{
}

void oricext_connector::device_start()
{
	irq_handler.resolve_safe();
	reset_handler.resolve_safe();
}

void oricext_connector::irq_w(int state)
{
	irq_handler(state);
}

void oricext_connector::reset_w(int state)
{
	reset_handler(state);
}

void oricext_connector::set_view(memory_view &_view)
{
	auto card = get_card_device();
	if(card)
		card->set_view(_view);
}

void oricext_connector::map_io(address_space_installer &space)
{
	auto card = get_card_device();
	if(card)
		card->map_io(space);
}

void oricext_connector::map_rom()
{
	auto card = get_card_device();
	if(card)
		card->map_rom();
}

device_oricext_interface::device_oricext_interface(const machine_config &mconfig, device_t &device) :
	device_interface(device, "oricext"),
	view(nullptr),
	connector(nullptr)
{
}

void device_oricext_interface::interface_pre_start()
{
	connector = downcast<oricext_connector *>(device().owner());
}

void device_oricext_interface::irq_w(int state)
{
	connector->irq_w(state);
}

void device_oricext_interface::reset_w(int state)
{
	connector->reset_w(state);
}

void device_oricext_interface::set_view(memory_view &_view)
{
	view = &_view;
}

void oricext_intf(device_slot_interface &device)
{
	device.option_add("jasmin", ORIC_JASMIN);
	device.option_add("microdisc", ORIC_MICRODISC);
}