summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bbc/userport/usersplit.h
blob: 0c359a59fc917f4447953b147400520d3d78d892 (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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Watford Electronics User Port Splitter

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


#ifndef MAME_BUS_BBC_USERPORT_USERSPLIT_H
#define MAME_BUS_BBC_USERPORT_USERSPLIT_H

#pragma once

#include "userport.h"

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

// ======================> bbc_usersplit_device

class bbc_usersplit_device :
	public device_t,
	public device_bbc_userport_interface
{
public:
	// construction/destruction
	bbc_usersplit_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);

	DECLARE_INPUT_CHANGED_MEMBER(userport_changed) { m_selected = newval; }

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

	// optional information overrides
	virtual void device_add_mconfig(machine_config &config) override;
	virtual ioport_constructor device_input_ports() const override;

	virtual uint8_t pb_r() override;
	virtual void pb_w(uint8_t data) override;
	virtual void write_cb1(int state) override;
	virtual void write_cb2(int state) override;

private:
	DECLARE_WRITE_LINE_MEMBER(cb1a_w);
	DECLARE_WRITE_LINE_MEMBER(cb2a_w);
	DECLARE_WRITE_LINE_MEMBER(cb1b_w);
	DECLARE_WRITE_LINE_MEMBER(cb2b_w);

	required_device_array<bbc_userport_slot_device, 2> m_userport;
	uint8_t m_selected;
};


// device type definition
DECLARE_DEVICE_TYPE(BBC_USERSPLIT, bbc_usersplit_device)


#endif // MAME_BUS_BBC_USERPORT_USERSPLIT_H