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
|
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/*********************************************************************
ssbapple.c
Implementation of the SSB Apple speech card
Must be in slot 2 for the provided software to work!
*********************************************************************/
#include "emu.h"
#include "ssbapple.h"
#include "sound/tms5220.h"
#include "speaker.h"
namespace {
/***************************************************************************
PARAMETERS
***************************************************************************/
#define TMS_TAG "tms5220"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class a2bus_ssb_device:
public device_t,
public device_a2bus_card_interface
{
public:
// construction/destruction
a2bus_ssb_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
static constexpr feature_type imperfect_features() { return feature::SOUND; }
required_device<tms5220_device> m_tms;
protected:
a2bus_ssb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, const XTAL &clock);
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
// overrides of standard a2bus slot functions
virtual uint8_t read_cnxx(uint8_t offset) override;
virtual void write_cnxx(uint8_t offset, uint8_t data) override;
virtual bool take_c800() override;
};
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void a2bus_ssb_device::device_add_mconfig(machine_config &config)
{
SPEAKER(config, "ssbapple").front_center();
TMS5220(config, m_tms, XTAL::u(640000)); // guess - this gives 8 kHz output according to the datasheet
m_tms->add_route(ALL_OUTPUTS, "ssbapple", 1.0);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
a2bus_ssb_device::a2bus_ssb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, const XTAL &clock) :
device_t(mconfig, type, tag, owner, clock),
device_a2bus_card_interface(mconfig, *this),
m_tms(*this, TMS_TAG)
{
}
a2bus_ssb_device::a2bus_ssb_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
a2bus_ssb_device(mconfig, A2BUS_SSBAPPLE, tag, owner, clock)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2bus_ssb_device::device_start()
{
if (slotno() != 2)
popmessage("SSB Card should be in slot 2!\n");
}
void a2bus_ssb_device::device_reset()
{
}
bool a2bus_ssb_device::take_c800()
{
return false;
}
uint8_t a2bus_ssb_device::read_cnxx(uint8_t offset)
{
return 0x1f | m_tms->status_r();
}
void a2bus_ssb_device::write_cnxx(uint8_t offset, uint8_t data)
{
m_tms->data_w(data);
}
} // anonymous namespace
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE_PRIVATE(A2BUS_SSBAPPLE, device_a2bus_card_interface, a2bus_ssb_device, "a2ssbapl", "Multitech Industrial SSB Apple speech card")
|