1 // license:BSD-3-Clause
2 // copyright-holders:R. Belmont, Golden Child
3 /*********************************************************************
4
5 ssprite.cpp
6
7 Implementation of the Synetix SuperSprite
8
9 *********************************************************************/
10
11 #include "emu.h"
12 #include "ssprite.h"
13 #include "sound/tms5220.h"
14 #include "speaker.h"
15
16
17 /***************************************************************************
18 PARAMETERS
19 ***************************************************************************/
20
21 #define TMS_TAG "ssprite_tms"
22 #define TMS5220_TAG "ssprite_tms5220"
23 #define AY_TAG "ssprite_ay"
24 #define SCREEN_TAG "screen"
25
26 //**************************************************************************
27 // GLOBAL VARIABLES
28 //**************************************************************************
29
30 DEFINE_DEVICE_TYPE(A2BUS_SSPRITE, a2bus_ssprite_device, "a2ssprite", "Synetix SuperSprite")
31
32 //-------------------------------------------------
33 // device_add_mconfig - add device configuration
34 //-------------------------------------------------
35
device_add_mconfig(machine_config & config)36 void a2bus_ssprite_device::device_add_mconfig(machine_config &config)
37 {
38 TMS9918A(config, m_tms, XTAL(10'738'635)).set_screen(SCREEN_TAG);
39 m_tms->set_vram_size(0x4000); // 16k of VRAM
40 m_tms->int_callback().set(FUNC(a2bus_ssprite_device::tms_irq_w));
41 SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER);
42
43 SPEAKER(config, "mono").front_center();
44 AY8912(config, m_ay, 1022727).add_route(ALL_OUTPUTS, "mono", 1.0);
45 TMS5220(config, m_tms5220, 640000).add_route(ALL_OUTPUTS, "mono", 1.0);
46 }
47
48 //**************************************************************************
49 // LIVE DEVICE
50 //**************************************************************************
51
a2bus_ssprite_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)52 a2bus_ssprite_device::a2bus_ssprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
53 a2bus_ssprite_device(mconfig, A2BUS_SSPRITE, tag, owner, clock)
54 {
55 }
56
a2bus_ssprite_device(const machine_config & mconfig,device_type type,const char * tag,device_t * owner,uint32_t clock)57 a2bus_ssprite_device::a2bus_ssprite_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
58 device_t(mconfig, type, tag, owner, clock),
59 device_a2bus_card_interface(mconfig, *this),
60 m_tms(*this, TMS_TAG),
61 m_ay(*this, AY_TAG),
62 m_tms5220(*this, TMS5220_TAG)
63 {
64 }
65
66 //-------------------------------------------------
67 // device_start - device-specific startup
68 //-------------------------------------------------
69
device_start()70 void a2bus_ssprite_device::device_start()
71 {
72 }
73
device_reset()74 void a2bus_ssprite_device::device_reset()
75 {
76 }
77
78 /*
79 C0nx map: (info from Synetix SuperSprite Owners manual.pdf page 33 of 266)
80 0 - TMS9918 VDP vram read/write
81 1 - TMS9918 VDP register write
82 2 - TMS5220 Speech read/write
83 3 - Video Switch APPLE VIDEO IN OFF
84 4 - Video Switch APPLE VIDEO IN ON
85 5 - Video Switch APPLE ONLY OUT
86 6 - Video Switch MIX VDP/EXTERNAL VIDEO
87 7 - TMS 9918 WRITE ONLY/FRAME RESET
88 C - AY Sound data write
89 D - AY Sound data write
90 E - AY Sound register write or data read
91 F - AY Sound register write or data read
92 */
93
94
read_c0nx(uint8_t offset)95 uint8_t a2bus_ssprite_device::read_c0nx(uint8_t offset)
96 {
97 switch (offset)
98 {
99 case 0:
100 return m_tms->vram_read();
101 case 1:
102 return m_tms->register_read();
103 case 2:
104 return 0x1f | m_tms5220->status_r();
105 case 14:
106 case 15:
107 return m_ay->data_r();
108 }
109
110 return 0xff;
111 }
112
write_c0nx(uint8_t offset,uint8_t data)113 void a2bus_ssprite_device::write_c0nx(uint8_t offset, uint8_t data)
114 {
115 switch (offset)
116 {
117 case 0:
118 m_tms->vram_write(data);
119 break;
120 case 1:
121 m_tms->register_write(data);
122 break;
123 case 2:
124 m_tms5220->data_w(data);
125 break;
126 case 12:
127 case 13:
128 m_ay->data_w(data);
129 break;
130 case 14:
131 case 15:
132 m_ay->address_w(data);
133 break;
134 }
135 }
136
WRITE_LINE_MEMBER(a2bus_ssprite_device::tms_irq_w)137 WRITE_LINE_MEMBER( a2bus_ssprite_device::tms_irq_w )
138 {
139 if (state)
140 raise_slot_irq();
141 else
142 lower_slot_irq();
143 }
144