src/mess/machine/b2m.c
| r2526 | r2527 | |
| 17 | 17 | #include "machine/wd17xx.h" |
| 18 | 18 | #include "machine/pic8259.h" |
| 19 | 19 | #include "machine/msm8251.h" |
| 20 | #include "sound/custom.h" |
| 21 | #include "streams.h" |
| 20 | 22 | |
| 21 | 23 | static int b2m_8255_porta; |
| 22 | 24 | UINT16 b2m_video_scroll; |
| r2526 | r2527 | |
| 153 | 155 | |
| 154 | 156 | static PIT8253_OUTPUT_CHANGED(bm2_pit_irq) |
| 155 | 157 | { |
| 158 | if (state==1) logerror("Timer IRQ\n"); |
| 156 | 159 | pic8259_set_irq_line((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"),1,state); |
| 157 | 160 | } |
| 158 | 161 | |
| 162 | UINT8 vblank_state = 0; |
| 159 | 163 | INTERRUPT_GEN (b2m_vblank_interrupt) |
| 160 | 164 | { |
| 161 | | pic8259_set_irq_line((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"),0,1); |
| 165 | vblank_state++; |
| 166 | if (vblank_state>1) vblank_state=0; |
| 167 | pic8259_set_irq_line((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"),0,vblank_state); |
| 162 | 168 | } |
| 163 | 169 | const struct pit8253_config b2m_pit8253_intf = |
| 164 | 170 | { |
| r2526 | r2527 | |
| 329 | 335 | DRIVER_INIT(b2m) |
| 330 | 336 | { |
| 331 | 337 | memset(mess_ram,0,128*1024); |
| 338 | vblank_state = 0; |
| 332 | 339 | } |
| 333 | 340 | |
| 334 | 341 | WRITE8_HANDLER ( b2m_palette_w ) |
| r2526 | r2527 | |
| 426 | 433 | basicdsk_set_geometry (image, 80, 2, 5, 1024, 1, 0, FALSE); |
| 427 | 434 | return INIT_PASS; |
| 428 | 435 | } |
| 436 | |
| 437 | static sound_stream *mixer_channel; |
| 438 | static void *b2m_sh_start(int clock, const struct CustomSound_interface *config); |
| 439 | static void b2m_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length); |
| 440 | |
| 441 | const struct CustomSound_interface b2m_sound_interface = |
| 442 | { |
| 443 | b2m_sh_start, |
| 444 | NULL, |
| 445 | NULL |
| 446 | }; |
| 447 | |
| 448 | static void *b2m_sh_start(int clock, const struct CustomSound_interface *config) |
| 449 | { |
| 450 | mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, b2m_sh_update); |
| 451 | return (void *) ~0; |
| 452 | } |
| 453 | |
| 454 | static void b2m_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length) |
| 455 | { |
| 456 | device_config *pit8253 = (device_config*)device_list_find_by_tag( Machine->config->devicelist, PIT8253, "pit8253" ); |
| 457 | INT16 channel_1_signal; |
| 458 | static int channel_1_incr = 0; |
| 459 | int channel_1_baseclock; |
| 460 | |
| 461 | int rate = Machine->sample_rate / 2; |
| 462 | |
| 463 | stream_sample_t *sample_left = buffer[0]; |
| 464 | stream_sample_t *sample_right = buffer[1]; |
| 465 | |
| 466 | channel_1_baseclock = pit8253_get_frequency(pit8253, 1); |
| 467 | |
| 468 | channel_1_signal = pit8253_get_output (pit8253,1) ? 3000 : -3000; |
| 469 | |
| 470 | |
| 471 | while (length--) |
| 472 | { |
| 473 | *sample_left = 0; |
| 474 | *sample_right = 0; |
| 475 | |
| 476 | /* music channel 1 */ |
| 477 | |
| 478 | *sample_left = channel_1_signal; |
| 479 | channel_1_incr -= channel_1_baseclock; |
| 480 | while( channel_1_incr < 0 ) |
| 481 | { |
| 482 | channel_1_incr += rate; |
| 483 | channel_1_signal = -channel_1_signal; |
| 484 | } |
| 485 | |
| 486 | |
| 487 | sample_left++; |
| 488 | sample_right++; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | void b2m_sh_change_clock(double clock) |
| 493 | { |
| 494 | stream_update(mixer_channel); |
| 495 | } |
src/mess/drivers/special.c
| r2526 | r2527 | |
| 70 | 70 | AM_RANGE( 0xffe9, 0xffe9 ) AM_READWRITE(wd17xx_track_r,wd17xx_track_w) |
| 71 | 71 | AM_RANGE( 0xffea, 0xffea ) AM_READWRITE(wd17xx_sector_r,wd17xx_sector_w) |
| 72 | 72 | AM_RANGE( 0xffea, 0xffeb ) AM_READWRITE(wd17xx_data_r,wd17xx_data_w) |
| 73 | | AM_RANGE( 0xffec, 0xffef ) AM_DEVREAD(PIT8253, "pit8253", pit8253_r) AM_WRITE(specimx_sound_w) |
| 73 | AM_RANGE( 0xffec, 0xffef ) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w) |
| 74 | 74 | AM_RANGE( 0xfff0, 0xfff3 ) AM_READWRITE(specimx_disk_ctrl_r, specimx_disk_ctrl_w) |
| 75 | 75 | AM_RANGE( 0xfff8, 0xfff8 ) AM_READWRITE(specimx_video_color_r,specimx_video_color_w) |
| 76 | 76 | AM_RANGE( 0xfffc, 0xfffe ) AM_WRITE(specimx_select_bank) |