1 // license:BSD-3-Clause
2 // copyright-holders:smf
3 /**********************************************************************
4 
5     Personal Peripheral Products Speakeasy 64 cartridge emulation
6 
7 **********************************************************************/
8 
9 #include "emu.h"
10 #include "speakeasy.h"
11 #include "speaker.h"
12 
13 
14 
15 //**************************************************************************
16 //  MACROS/CONSTANTS
17 //**************************************************************************
18 
19 #define SC01A_TAG       "sc01a"
20 
21 
22 
23 //**************************************************************************
24 //  DEVICE DEFINITIONS
25 //**************************************************************************
26 
27 DEFINE_DEVICE_TYPE(C64_SPEAKEASY, c64_speakeasy_cartridge_device, "c64_speakeasy", "PPP Speakeasy 64")
28 
29 
30 //-------------------------------------------------
31 //  device_add_mconfig - add device configuration
32 //-------------------------------------------------
33 
device_add_mconfig(machine_config & config)34 void c64_speakeasy_cartridge_device::device_add_mconfig(machine_config &config)
35 {
36 	SPEAKER(config, "mono").front_center();
37 
38 	VOTRAX_SC01(config, m_votrax, 720000).add_route(ALL_OUTPUTS, "mono", 0.85);
39 }
40 
41 
42 
43 //**************************************************************************
44 //  LIVE DEVICE
45 //**************************************************************************
46 
47 //-------------------------------------------------
48 //  c64_speakeasy_cartridge_device - constructor
49 //-------------------------------------------------
50 
c64_speakeasy_cartridge_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)51 c64_speakeasy_cartridge_device::c64_speakeasy_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
52 	device_t(mconfig, C64_SPEAKEASY, tag, owner, clock),
53 	device_c64_expansion_card_interface(mconfig, *this),
54 	m_votrax(*this, SC01A_TAG)
55 {
56 }
57 
58 
59 //-------------------------------------------------
60 //  device_start - device-specific startup
61 //-------------------------------------------------
62 
device_start()63 void c64_speakeasy_cartridge_device::device_start()
64 {
65 }
66 
67 
68 //-------------------------------------------------
69 //  c64_cd_r - cartridge data read
70 //-------------------------------------------------
71 
c64_cd_r(offs_t offset,uint8_t data,int sphi2,int ba,int roml,int romh,int io1,int io2)72 uint8_t c64_speakeasy_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
73 {
74 	if (!io1)
75 	{
76 		return m_votrax->request() << 7;
77 	}
78 
79 	return data;
80 }
81 
82 
83 //-------------------------------------------------
84 //  c64_cd_w - cartridge data write
85 //-------------------------------------------------
86 
c64_cd_w(offs_t offset,uint8_t data,int sphi2,int ba,int roml,int romh,int io1,int io2)87 void c64_speakeasy_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
88 {
89 	if (!io1)
90 	{
91 		m_votrax->write(data & 0x3f);
92 		m_votrax->inflection_w(data >> 6);
93 	}
94 }
95