summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/a800/a8sio.h
blob: b513ea0c9f1c124d8c09af3a2c912df132f2ced7 (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
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
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/***************************************************************************

  a8sio.h - Atari 8 bit SIO bus interface


              1 1
      2 4 6 8 0 2
     +-----------+
    / o o o o o o \
   / o o o o o o o \
  +-----------------+
     1 3 5 7 9 1 1
               1 3

  1 - clock in (to computer)
  2 - clock out
  3 - data in
  4 - GND
  5 - data out
  6 - GND
  7 - command (active low)
  8 - motor
  9 - proceed (active low)
 10 - +5V/ready
 11 - audio in
 12 - +12V (A400/A800)
 13 - interrupt (active low)

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

#ifndef MAME_BUS_A800_A8SIO_H
#define MAME_BUS_A800_A8SIO_H

#pragma once

void a8sio_cards(device_slot_interface &device);

class a8sio_slot_device : public device_t,
							public device_slot_interface
{
public:
	// construction/destruction
	a8sio_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, char const *dflt)
		: a8sio_slot_device(mconfig, tag, owner, (uint32_t)0)
	{
		option_reset();
		a8sio_cards(*this);
		set_default_option(dflt);
		set_fixed(false);
	}
	a8sio_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// inline configuration
	void set_a8sio_slot(const char *tag, const char *slottag) { m_a8sio_tag = tag; m_a8sio_slottag = slottag; }

protected:
	a8sio_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);

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

	// configuration
	const char *m_a8sio_tag;
	const char *m_a8sio_slottag;
};


// device type definition
DECLARE_DEVICE_TYPE(A8SIO_SLOT, a8sio_slot_device)


class device_a8sio_card_interface;

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

	// inline configuration
	auto clock_in() { return m_out_clock_in_cb.bind(); }
	auto data_in() { return m_out_data_in_cb.bind(); }
	auto audio_in() { return m_out_audio_in_cb.bind(); }

	void add_a8sio_card(device_a8sio_card_interface *card);
	device_a8sio_card_interface *get_a8sio_card();

	DECLARE_WRITE_LINE_MEMBER( clock_in_w );  // pin 1
	//virtual DECLARE_WRITE_LINE_MEMBER( clock_out_w ); // pin 2
	DECLARE_WRITE_LINE_MEMBER( data_in_w );   // pin 3
	//DECLARE_WRITE_LINE_MEMBER( data_out_wi ); // pin 5
	//DECLARE_WRITE_LINE_MEMBER( command_w );   // pin 7
	DECLARE_WRITE_LINE_MEMBER( motor_w );     // pin 8
	//DECLARE_WRITE_LINE_MEMBER( proceed_w );   // pin 9
	DECLARE_WRITE8_MEMBER( audio_in_w );      // pin 11

protected:
	a8sio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);

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

	devcb_write_line    m_out_clock_in_cb; // pin 1
	devcb_write_line    m_out_data_in_cb; // pin 3
	devcb_write8        m_out_audio_in_cb; // pin 11

	device_a8sio_card_interface *m_device;
};

// device type definition
DECLARE_DEVICE_TYPE(A8SIO, a8sio_device)


class device_a8sio_card_interface : public device_slot_card_interface
{
	friend class a8sio_device;
public:
	// construction/destruction
	virtual ~device_a8sio_card_interface();

	void set_a8sio_device();

	// inline configuration
	void set_a8sio_tag(const char *tag, const char *slottag) { m_a8sio_tag = tag; m_a8sio_slottag = slottag; }

	virtual DECLARE_WRITE_LINE_MEMBER( motor_w );

public:
	device_a8sio_card_interface(const machine_config &mconfig, device_t &device);

	a8sio_device  *m_a8sio;
	const char *m_a8sio_tag;
	const char *m_a8sio_slottag;
};

#endif // MAME_BUS_A800_A8SIO_H