trunk/src/emu/sound/c6280.c
| r29520 | r29521 | |
| 248 | 248 | |
| 249 | 249 | c6280_device::c6280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 250 | 250 | : device_t(mconfig, C6280, "HuC6280", tag, owner, clock, "c6280", __FILE__), |
| 251 | | device_sound_interface(mconfig, *this) |
| 251 | device_sound_interface(mconfig, *this), |
| 252 | m_cpudevice(*this) |
| 252 | 253 | { |
| 253 | 254 | } |
| 254 | 255 | |
| 255 | 256 | //------------------------------------------------- |
| 256 | | // device_config_complete - perform any |
| 257 | | // operations now that the configuration is |
| 258 | | // complete |
| 259 | | //------------------------------------------------- |
| 260 | | |
| 261 | | void c6280_device::device_config_complete() |
| 262 | | { |
| 263 | | } |
| 264 | | |
| 265 | | //------------------------------------------------- |
| 266 | 257 | // device_start - device-specific startup |
| 267 | 258 | //------------------------------------------------- |
| 268 | 259 | |
| r29520 | r29521 | |
| 273 | 264 | /* Create stereo stream */ |
| 274 | 265 | m_stream = machine().sound().stream_alloc(*this, 0, 2, rate, this); |
| 275 | 266 | |
| 276 | | const c6280_interface *intf = (const c6280_interface *)static_config(); |
| 277 | | |
| 278 | 267 | /* Loudest volume level for table */ |
| 279 | 268 | double level = 65535.0 / 6.0 / 32.0; |
| 280 | 269 | |
| r29520 | r29521 | |
| 285 | 274 | m_lfo_control = 0; |
| 286 | 275 | memset(m_channel, 0, sizeof(channel) * 8); |
| 287 | 276 | |
| 288 | | m_cpudevice = machine().device<h6280_device>(intf->cpu); |
| 289 | | if (m_cpudevice == NULL) |
| 290 | | { |
| 291 | | fatalerror("c6280_init: no CPU found with tag of '%s'\n", tag()); |
| 292 | | } |
| 293 | | |
| 294 | 277 | /* Make waveform frequency table */ |
| 295 | 278 | for (int i = 0; i < 4096; i += 1) |
| 296 | 279 | { |
| r29520 | r29521 | |
| 321 | 304 | save_item(NAME(m_lfo_control)); |
| 322 | 305 | for (int chan = 0; chan < 8; chan++) |
| 323 | 306 | { |
| 324 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_frequency); |
| 325 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_control); |
| 326 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_balance); |
| 327 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_waveform); |
| 328 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_index); |
| 329 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_dda); |
| 330 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_noise_control); |
| 331 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_noise_counter); |
| 332 | | state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_counter); |
| 307 | save_item(NAME(m_channel[chan].m_frequency), chan); |
| 308 | save_item(NAME(m_channel[chan].m_control), chan); |
| 309 | save_item(NAME(m_channel[chan].m_balance), chan); |
| 310 | save_item(NAME(m_channel[chan].m_waveform), chan); |
| 311 | save_item(NAME(m_channel[chan].m_index), chan); |
| 312 | save_item(NAME(m_channel[chan].m_dda), chan); |
| 313 | save_item(NAME(m_channel[chan].m_noise_control), chan); |
| 314 | save_item(NAME(m_channel[chan].m_noise_counter), chan); |
| 315 | save_item(NAME(m_channel[chan].m_counter), chan); |
| 333 | 316 | } |
| 334 | 317 | } |
trunk/src/emu/sound/c6280.h
| r29520 | r29521 | |
| 5 | 5 | |
| 6 | 6 | #include "cpu/h6280/h6280.h" |
| 7 | 7 | |
| 8 | | struct c6280_interface |
| 9 | | { |
| 10 | | const char * cpu; |
| 11 | | }; |
| 12 | | |
| 13 | 8 | class c6280_device : public device_t, |
| 14 | 9 | public device_sound_interface |
| 15 | 10 | { |
| 16 | 11 | public: |
| 17 | 12 | c6280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 18 | 13 | |
| 14 | static void set_devicecpu_tag(device_t &device, const char *tag) { downcast<c6280_device &>(device).m_cpudevice.set_tag(tag); } |
| 15 | |
| 19 | 16 | // read/write |
| 20 | 17 | DECLARE_READ8_MEMBER( c6280_r ); |
| 21 | 18 | DECLARE_WRITE8_MEMBER( c6280_w ); |
| 22 | 19 | |
| 23 | 20 | protected: |
| 24 | 21 | // device-level overrides |
| 25 | | virtual void device_config_complete(); |
| 26 | 22 | virtual void device_start(); |
| 27 | 23 | |
| 28 | 24 | // sound stream update overrides |
| r29520 | r29521 | |
| 43 | 39 | |
| 44 | 40 | // internal state |
| 45 | 41 | sound_stream *m_stream; |
| 46 | | h6280_device *m_cpudevice; |
| 42 | required_device<h6280_device> m_cpudevice; |
| 47 | 43 | UINT8 m_select; |
| 48 | 44 | UINT8 m_balance; |
| 49 | 45 | UINT8 m_lfo_frequency; |
| r29520 | r29521 | |
| 56 | 52 | |
| 57 | 53 | extern const device_type C6280; |
| 58 | 54 | |
| 55 | #define MCFG_C6280_CPU(_tag) \ |
| 56 | c6280_device::set_devicecpu_tag(*device, "^"_tag); |
| 59 | 57 | |
| 58 | |
| 60 | 59 | #endif /* __C6280_H__ */ |
trunk/src/mess/drivers/pce.c
| r29520 | r29521 | |
| 284 | 284 | ADDRESS_MAP_END |
| 285 | 285 | |
| 286 | 286 | |
| 287 | | static const c6280_interface c6280_config = |
| 288 | | { |
| 289 | | "maincpu" |
| 290 | | }; |
| 291 | | |
| 292 | 287 | UINT32 pce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 293 | 288 | { |
| 294 | 289 | m_huc6260->video_update( bitmap, cliprect ); |
| r29520 | r29521 | |
| 337 | 332 | |
| 338 | 333 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 339 | 334 | MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6) |
| 340 | | MCFG_SOUND_CONFIG(c6280_config) |
| 335 | MCFG_C6280_CPU("maincpu") |
| 341 | 336 | MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) |
| 342 | 337 | MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) |
| 343 | 338 | |
| r29520 | r29521 | |
| 402 | 397 | |
| 403 | 398 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 404 | 399 | MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6) |
| 405 | | MCFG_SOUND_CONFIG(c6280_config) |
| 400 | MCFG_C6280_CPU("maincpu") |
| 406 | 401 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) |
| 407 | 402 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) |
| 408 | 403 | |
trunk/src/mame/drivers/paranoia.c
| r29520 | r29521 | |
| 169 | 169 | DEVCB_DRIVER_LINE_MEMBER(paranoia_state,paranoia_i8155_timer_out) |
| 170 | 170 | }; |
| 171 | 171 | |
| 172 | | static const c6280_interface c6280_config = |
| 173 | | { |
| 174 | | "maincpu" |
| 175 | | }; |
| 176 | | |
| 177 | 172 | static MACHINE_CONFIG_START( paranoia, paranoia_state ) |
| 178 | 173 | /* basic machine hardware */ |
| 179 | 174 | MCFG_CPU_ADD("maincpu", H6280, PCE_MAIN_CLOCK/3) |
| r29520 | r29521 | |
| 208 | 203 | |
| 209 | 204 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") |
| 210 | 205 | MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) |
| 211 | | MCFG_SOUND_CONFIG(c6280_config) |
| 206 | MCFG_C6280_CPU("maincpu") |
| 212 | 207 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) |
| 213 | 208 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) |
| 214 | 209 | |
trunk/src/mame/drivers/uapce.c
| r29520 | r29521 | |
| 300 | 300 | AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6270", huc6270_device, read, write ) |
| 301 | 301 | ADDRESS_MAP_END |
| 302 | 302 | |
| 303 | | static const c6280_interface c6280_config = |
| 304 | | { |
| 305 | | "maincpu" |
| 306 | | }; |
| 307 | | |
| 308 | 303 | WRITE_LINE_MEMBER(uapce_state::pce_irq_changed) |
| 309 | 304 | { |
| 310 | 305 | m_maincpu->set_input_line(0, state); |
| r29520 | r29521 | |
| 339 | 334 | |
| 340 | 335 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") |
| 341 | 336 | MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) |
| 342 | | MCFG_SOUND_CONFIG(c6280_config) |
| 337 | MCFG_C6280_CPU("maincpu") |
| 343 | 338 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) |
| 344 | 339 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) |
| 345 | 340 | |
trunk/src/mame/drivers/ggconnie.c
| r29520 | r29521 | |
| 175 | 175 | PORT_DIPSETTING(0x00, DEF_STR(On) ) |
| 176 | 176 | INPUT_PORTS_END |
| 177 | 177 | |
| 178 | | static const c6280_interface c6280_config = |
| 179 | | { |
| 180 | | "maincpu" |
| 181 | | }; |
| 182 | | |
| 183 | 178 | static MACHINE_CONFIG_START( ggconnie, ggconnie_state ) |
| 184 | 179 | /* basic machine hardware */ |
| 185 | 180 | MCFG_CPU_ADD("maincpu", H6280, PCE_MAIN_CLOCK/3) |
| r29520 | r29521 | |
| 221 | 216 | |
| 222 | 217 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") |
| 223 | 218 | MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) |
| 224 | | MCFG_SOUND_CONFIG(c6280_config) |
| 219 | MCFG_C6280_CPU("maincpu") |
| 225 | 220 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) |
| 226 | 221 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) |
| 227 | 222 | |