trunk/src/mame/drivers/spectra.c
r18188 | r18189 | |
4 | 4 | |
5 | 5 | Rotating game, like Midway's "Rotation VIII". |
6 | 6 | |
| 7 | 2012-09-28 System working [Robbbert] |
| 8 | |
7 | 9 | Schematic and PinMAME used as references. |
| 10 | Code for the sn76477 sound was derived from PinMAME. |
8 | 11 | |
| 12 | There is a bug - if you score 1000 and had less than 100, the hundreds digit will |
| 13 | be blank. It will of course fix itself during the course of the game. |
9 | 14 | |
| 15 | |
10 | 16 | *******************************************************************************************/ |
11 | 17 | |
12 | 18 | |
r18188 | r18189 | |
14 | 20 | #include "cpu/m6502/m6502.h" |
15 | 21 | #include "machine/6532riot.h" |
16 | 22 | #include "machine/nvram.h" |
| 23 | #include "sound/sn76477.h" |
17 | 24 | #include "spectra.lh" |
18 | 25 | |
19 | 26 | |
r18188 | r18189 | |
23 | 30 | spectra_state(const machine_config &mconfig, device_type type, const char *tag) |
24 | 31 | : driver_device(mconfig, type, tag), |
25 | 32 | m_maincpu(*this, "maincpu"), |
| 33 | m_snsnd(*this, "snsnd"), |
26 | 34 | m_p_ram(*this, "ram"), |
27 | 35 | m_samples(*this, "samples") |
28 | 36 | { } |
r18188 | r18189 | |
37 | 45 | |
38 | 46 | // devices |
39 | 47 | required_device<cpu_device> m_maincpu; |
| 48 | required_device<sn76477_device> m_snsnd; |
40 | 49 | required_shared_ptr<UINT8> m_p_ram; |
41 | 50 | required_device<samples_device> m_samples; |
42 | 51 | |
r18188 | r18189 | |
137 | 146 | WRITE8_MEMBER( spectra_state::portb_w ) |
138 | 147 | { |
139 | 148 | m_portb = data; |
| 149 | float vco = 5.0; |
| 150 | if (BIT(data, 0)) vco -= 0.3125; |
| 151 | if (BIT(data, 1)) vco -= 0.625; |
| 152 | if (BIT(data, 2)) vco -= 1.25; |
| 153 | if (BIT(data, 3)) vco -= 2.5; |
| 154 | sn76477_vco_voltage_w(m_snsnd, 5.4 - vco); |
| 155 | sn76477_enable_w(m_snsnd, !BIT(data, 4)); // strobe: toggles enable |
| 156 | sn76477_envelope_1_w(m_snsnd, !BIT(data, 5)); //decay: toggles envelope |
| 157 | sn76477_vco_w(m_snsnd, BIT(data, 6)); // "phaser" sound: VCO toggled |
| 158 | sn76477_mixer_b_w(m_snsnd, BIT(data, 7)); // "pulse" sound: pins 25 & 27 changed |
| 159 | sn76477_mixer_c_w(m_snsnd, BIT(data, 7)); // "pulse" sound: pins 25 & 27 changed |
140 | 160 | } |
141 | 161 | |
142 | 162 | |
r18188 | r18189 | |
159 | 179 | |
160 | 180 | // 00-27 displays |
161 | 181 | // 40-6F lamps |
162 | | // 70-7F solenoids (73=outhole) no knocker |
| 182 | // 70-7F solenoids - no knocker |
163 | 183 | TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::outtimer) |
164 | 184 | { |
165 | 185 | static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x5c, 0x63, 0x01, 0x40, 0x08, 0 }; // 74C912 |
r18188 | r18189 | |
190 | 210 | m_out_offs = 0xff; |
191 | 211 | } |
192 | 212 | |
| 213 | static const sn76477_interface sn76477_intf = |
| 214 | { |
| 215 | RES_M(1000), /* 4 noise_res */ |
| 216 | RES_M(1000), /* 5 filter_res */ |
| 217 | CAP_N(0), /* 6 filter_cap */ |
| 218 | RES_K(470), /* 7 decay_res */ |
| 219 | CAP_N(1), /* 8 attack_decay_cap */ |
| 220 | RES_K(22), /* 10 attack_res */ |
| 221 | RES_K(100), /* 11 amplitude_res */ |
| 222 | RES_K(52), /* 12 feedback_res */ |
| 223 | 5.0, /* 16 vco_voltage */ |
| 224 | CAP_U(0.01), /* 17 vco_cap */ |
| 225 | RES_K(390), /* 18 vco_res */ |
| 226 | 0.0, /* 19 pitch_voltage */ |
| 227 | RES_M(1), /* 20 slf_res */ |
| 228 | CAP_U(0.1), /* 21 slf_cap */ |
| 229 | CAP_U(0.47), /* 23 oneshot_cap */ |
| 230 | RES_K(470), /* 24 oneshot_res */ |
| 231 | 0, /* 22 vco (variable) */ |
| 232 | 0, /* 26 mixer A (grounded) */ |
| 233 | 0, /* 25 mixer B (variable) */ |
| 234 | 0, /* 27 mixer C (variable) */ |
| 235 | 0, /* 1 envelope 1 (variable) */ |
| 236 | 0, /* 28 envelope 2 (grounded) */ |
| 237 | 1 /* 9 enable (variable) */ |
| 238 | }; |
| 239 | |
| 240 | |
193 | 241 | static MACHINE_CONFIG_START( spectra, spectra_state ) |
194 | 242 | /* basic machine hardware */ |
195 | 243 | MCFG_CPU_ADD("maincpu", M6502, 3579545/4) // actually a 6503 |
r18188 | r18189 | |
204 | 252 | |
205 | 253 | /* Sound */ |
206 | 254 | MCFG_FRAGMENT_ADD( genpin_audio ) |
| 255 | MCFG_SOUND_ADD("snsnd", SN76477, 0) |
| 256 | MCFG_SOUND_CONFIG(sn76477_intf) |
| 257 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
207 | 258 | MACHINE_CONFIG_END |
208 | 259 | |
209 | 260 | /*-------------------------------- |
r18188 | r18189 | |
218 | 269 | ROM_END |
219 | 270 | |
220 | 271 | |
221 | | GAME(1979, spectra, 0, spectra, spectra, driver_device, 0, ROT0, "Valley", "Spectra IV", GAME_IS_SKELETON_MECHANICAL) |
| 272 | GAME(1979, spectra, 0, spectra, spectra, driver_device, 0, ROT0, "Valley", "Spectra IV", GAME_MECHANICAL) |