src/mess/includes/b2m.h
| r5878 | r5879 | |
| 10 | 10 | #include "machine/i8255a.h" |
| 11 | 11 | #include "machine/pit8253.h" |
| 12 | 12 | #include "machine/pic8259.h" |
| 13 | #include "sound/speaker.h" |
| 14 | #include "sound/wave.h" |
| 13 | 15 | |
| 14 | 16 | /*----------- defined in machine/b2m.c -----------*/ |
| 15 | 17 | |
| r5878 | r5879 | |
| 33 | 35 | extern READ8_HANDLER( b2m_localmachine_r ); |
| 34 | 36 | extern WRITE8_HANDLER( b2m_localmachine_w ); |
| 35 | 37 | |
| 36 | | #define SOUND_B2M DEVICE_GET_INFO_NAME( b2m_sound ) |
| 37 | | |
| 38 | | DEVICE_GET_INFO( b2m_sound ); |
| 39 | | |
| 40 | | |
| 41 | 38 | /*----------- defined in video/b2m.c -----------*/ |
| 42 | 39 | |
| 43 | 40 | extern VIDEO_START( b2m ); |
src/mess/machine/b2m.c
| r5878 | r5879 | |
| 15 | 15 | #include "machine/wd17xx.h" |
| 16 | 16 | #include "machine/pic8259.h" |
| 17 | 17 | #include "machine/msm8251.h" |
| 18 | | #include "streams.h" |
| 19 | 18 | #include "includes/b2m.h" |
| 20 | 19 | |
| 21 | 20 | static int b2m_8255_porta; |
| r5878 | r5879 | |
| 32 | 31 | static UINT8 b2m_color[4]; |
| 33 | 32 | static UINT8 b2m_localmachine; |
| 34 | 33 | |
| 35 | | static int b2m_sound_input; |
| 36 | | static sound_stream *mixer_channel; |
| 37 | 34 | |
| 38 | | |
| 39 | 35 | static READ8_HANDLER (b2m_keyboard_r ) |
| 40 | 36 | { |
| 41 | 37 | UINT8 key = 0x00; |
| r5878 | r5879 | |
| 164 | 160 | |
| 165 | 161 | |
| 166 | 162 | static PIT8253_OUTPUT_CHANGED(bm2_pit_out1) |
| 167 | | { |
| 168 | | if (mixer_channel!=NULL) { |
| 169 | | stream_update( mixer_channel ); |
| 170 | | } |
| 171 | | b2m_sound_input = state; |
| 163 | { |
| 164 | const device_config *speaker = devtag_get_device(device->machine, "speaker"); |
| 165 | |
| 166 | speaker_level_w(speaker, state); |
| 167 | |
| 172 | 168 | } |
| 173 | 169 | |
| 174 | 170 | static PIT8253_OUTPUT_CHANGED(bm2_pit_out2) |
| r5878 | r5879 | |
| 350 | 346 | |
| 351 | 347 | MACHINE_RESET(b2m) |
| 352 | 348 | { |
| 353 | | b2m_sound_input = 0; |
| 354 | | |
| 355 | 349 | b2m_side = 0; |
| 356 | 350 | b2m_drive = 0; |
| 357 | 351 | |
| 358 | 352 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), b2m_irq_callback); |
| 359 | 353 | b2m_set_bank(machine, 7); |
| 360 | 354 | } |
| 361 | | |
| 362 | | static STREAM_UPDATE( b2m_sh_update ) |
| 363 | | { |
| 364 | | INT16 channel_1_signal; |
| 365 | | |
| 366 | | stream_sample_t *sample_left = outputs[0]; |
| 367 | | |
| 368 | | channel_1_signal = b2m_sound_input ? 3000 : -3000; |
| 369 | | |
| 370 | | while (samples--) |
| 371 | | { |
| 372 | | *sample_left = channel_1_signal; |
| 373 | | sample_left++; |
| 374 | | } |
| 375 | | } |
| 376 | | |
| 377 | | static DEVICE_START(b2m_sound) |
| 378 | | { |
| 379 | | b2m_sound_input = 0; |
| 380 | | mixer_channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, b2m_sh_update); |
| 381 | | } |
| 382 | | |
| 383 | | |
| 384 | | DEVICE_GET_INFO( b2m_sound ) |
| 385 | | { |
| 386 | | switch (state) |
| 387 | | { |
| 388 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 389 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(b2m_sound); break; |
| 390 | | |
| 391 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 392 | | case DEVINFO_STR_NAME: strcpy(info->s, "B2M Custom"); break; |
| 393 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 394 | | } |
| 395 | | } |