summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/cpc/cpc_ssa1.h
blob: 88ad17757d35f590735044661e6a86ce8c394cc2 (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
// license:BSD-3-Clause
// copyright-holders:Barry Rodewald
/*
 * cpc_ssa1.h  --  Amstrad SSA-1 Speech Synthesiser, dk'Tronics Speech Synthesiser
 *
 *  Created on: 16/07/2011
 *
 *  Amstrad SSA-1 - SP0256-AL2 based Speech Synthesiser and Sound Amplifier
 *
 *  Uses on-board resonator, clocked at 3.12MHz
 *
 *  Decodes only I/O lines A10, A4 and A0
 *  Official I/O ports:
 *    &FBEE (read)
 *     - bit 7: SP0256 Status 1 (SBY)
 *     - bit 6: SP0256 Status 2 (/LRQ)
 *
 *    &FBEE (write)
 *     - bits 7-0: SP0256 Allophone number (must be 0x00 to 0x3f, however, all data lines are hooked up)
 *
 *    &FAEE (write)
 *     - same as above, used because of a bug in the driver software, but still works due to the way the I/O ports are
 *       decoded on the CPC.
 *
 *  More info and PCB pics at http://www.cpcwiki.eu/index.php/Amstrad_SSA-1_Speech_Synthesizer
 *
 *
 *  dk'Tronics Speech Synthesiser - SP0256-AL2 based speech synthesiser
 *
 *  Uses the CPC's clock of 4MHz from pin 50 of the expansion port, gives faster and higher pitched voices than the SSA-1
 *
 *  Official I/O ports:
 *    &FBFE (read)
 *     - bit 7: SP0256 Status 2 (/LRQ)
 *
 *    &FBFE (write)
 *     - bits 5-0: SP0256 Allophone number
 *
 *  More info and PCB pics at http://www.cpcwiki.eu/index.php/Dk%27tronics_Speech_Synthesizer
 *
 */

#ifndef MAME_BUS_CPC_CPC_SSA1_H
#define MAME_BUS_CPC_CPC_SSA1_H

#pragma once


#include "cpcexp.h"
#include "sound/sp0256.h"

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

	void set_lrq(uint8_t state) { m_lrq = state; }
	uint8_t get_lrq() { return m_lrq; }
	void set_sby(uint8_t state) { m_sby = state; }
	uint8_t get_sby() { return m_sby; }

	uint8_t ssa1_r();
	void ssa1_w(uint8_t data);

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

	// optional information overrides
	virtual const tiny_rom_entry *device_rom_region() const override;
	virtual void device_add_mconfig(machine_config &config) override;

private:
	DECLARE_WRITE_LINE_MEMBER(lrq_cb);
	DECLARE_WRITE_LINE_MEMBER(sby_cb);

	cpc_expansion_slot_device *m_slot;

	uint8_t *m_rom;
	uint8_t m_lrq;
	uint8_t m_sby;

	required_device<sp0256_device> m_sp0256_device;
};

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

	void set_lrq(uint8_t state) { m_lrq = state; }
	uint8_t get_lrq() { return m_lrq; }
	void set_sby(uint8_t state) { m_sby = state; }
	uint8_t get_sby() { return m_sby; }

	uint8_t dkspeech_r();
	void dkspeech_w(uint8_t data);

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

	// optional information overrides
	virtual const tiny_rom_entry *device_rom_region() const override;
	virtual void device_add_mconfig(machine_config &config) override;

private:
	DECLARE_WRITE_LINE_MEMBER(lrq_cb);
	DECLARE_WRITE_LINE_MEMBER(sby_cb);

	cpc_expansion_slot_device *m_slot;

	uint8_t *m_rom;
	uint8_t m_lrq;
	uint8_t m_sby;

	required_device<sp0256_device> m_sp0256_device;
};

// device type definition
DECLARE_DEVICE_TYPE(CPC_SSA1,     cpc_ssa1_device)
DECLARE_DEVICE_TYPE(CPC_DKSPEECH, cpc_dkspeech_device)


#endif // MAME_BUS_CPC_CPC_SSA1_H