1 // license:BSD-3-Clause
2 // copyright-holders:Barry Rodewald
3 /*
4  * cpc_ssa1.h  --  Amstrad SSA-1 Speech Synthesiser, dk'Tronics Speech Synthesiser
5  *
6  *  Created on: 16/07/2011
7  *
8  *  Amstrad SSA-1 - SP0256-AL2 based Speech Synthesiser and Sound Amplifier
9  *
10  *  Uses on-board resonator, clocked at 3.12MHz
11  *
12  *  Decodes only I/O lines A10, A4 and A0
13  *  Official I/O ports:
14  *    &FBEE (read)
15  *     - bit 7: SP0256 Status 1 (SBY)
16  *     - bit 6: SP0256 Status 2 (/LRQ)
17  *
18  *    &FBEE (write)
19  *     - bits 7-0: SP0256 Allophone number (must be 0x00 to 0x3f, however, all data lines are hooked up)
20  *
21  *    &FAEE (write)
22  *     - same as above, used because of a bug in the driver software, but still works due to the way the I/O ports are
23  *       decoded on the CPC.
24  *
25  *  More info and PCB pics at http://www.cpcwiki.eu/index.php/Amstrad_SSA-1_Speech_Synthesizer
26  *
27  *
28  *  dk'Tronics Speech Synthesiser - SP0256-AL2 based speech synthesiser
29  *
30  *  Uses the CPC's clock of 4MHz from pin 50 of the expansion port, gives faster and higher pitched voices than the SSA-1
31  *
32  *  Official I/O ports:
33  *    &FBFE (read)
34  *     - bit 7: SP0256 Status 2 (/LRQ)
35  *
36  *    &FBFE (write)
37  *     - bits 5-0: SP0256 Allophone number
38  *
39  *  More info and PCB pics at http://www.cpcwiki.eu/index.php/Dk%27tronics_Speech_Synthesizer
40  *
41  */
42 
43 #ifndef MAME_BUS_CPC_CPC_SSA1_H
44 #define MAME_BUS_CPC_CPC_SSA1_H
45 
46 #pragma once
47 
48 
49 #include "cpcexp.h"
50 #include "sound/sp0256.h"
51 
52 class cpc_ssa1_device : public device_t,
53 						public device_cpc_expansion_card_interface
54 {
55 public:
56 	// construction/destruction
57 	cpc_ssa1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
58 
set_lrq(uint8_t state)59 	void set_lrq(uint8_t state) { m_lrq = state; }
get_lrq()60 	uint8_t get_lrq() { return m_lrq; }
set_sby(uint8_t state)61 	void set_sby(uint8_t state) { m_sby = state; }
get_sby()62 	uint8_t get_sby() { return m_sby; }
63 
64 	uint8_t ssa1_r();
65 	void ssa1_w(uint8_t data);
66 
67 protected:
68 	// device-level overrides
69 	virtual void device_start() override;
70 	virtual void device_reset() override;
71 
72 	// optional information overrides
73 	virtual const tiny_rom_entry *device_rom_region() const override;
74 	virtual void device_add_mconfig(machine_config &config) override;
75 
76 private:
77 	DECLARE_WRITE_LINE_MEMBER(lrq_cb);
78 	DECLARE_WRITE_LINE_MEMBER(sby_cb);
79 
80 	cpc_expansion_slot_device *m_slot;
81 
82 	uint8_t *m_rom;
83 	uint8_t m_lrq;
84 	uint8_t m_sby;
85 
86 	required_device<sp0256_device> m_sp0256_device;
87 };
88 
89 class cpc_dkspeech_device : public device_t,
90 							public device_cpc_expansion_card_interface
91 {
92 public:
93 	// construction/destruction
94 	cpc_dkspeech_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
95 
set_lrq(uint8_t state)96 	void set_lrq(uint8_t state) { m_lrq = state; }
get_lrq()97 	uint8_t get_lrq() { return m_lrq; }
set_sby(uint8_t state)98 	void set_sby(uint8_t state) { m_sby = state; }
get_sby()99 	uint8_t get_sby() { return m_sby; }
100 
101 	uint8_t dkspeech_r();
102 	void dkspeech_w(uint8_t data);
103 
104 protected:
105 	// device-level overrides
106 	virtual void device_start() override;
107 	virtual void device_reset() override;
108 
109 	// optional information overrides
110 	virtual const tiny_rom_entry *device_rom_region() const override;
111 	virtual void device_add_mconfig(machine_config &config) override;
112 
113 private:
114 	DECLARE_WRITE_LINE_MEMBER(lrq_cb);
115 	DECLARE_WRITE_LINE_MEMBER(sby_cb);
116 
117 	cpc_expansion_slot_device *m_slot;
118 
119 	uint8_t *m_rom;
120 	uint8_t m_lrq;
121 	uint8_t m_sby;
122 
123 	required_device<sp0256_device> m_sp0256_device;
124 };
125 
126 // device type definition
127 DECLARE_DEVICE_TYPE(CPC_SSA1,     cpc_ssa1_device)
128 DECLARE_DEVICE_TYPE(CPC_DKSPEECH, cpc_dkspeech_device)
129 
130 
131 #endif // MAME_BUS_CPC_CPC_SSA1_H
132