int senjyo_sh_start(const struct MachineSound *msound) { int i; channel = mixer_allocate_channel(15); mixer_set_name(channel,"Tone"); /* z80 ctc init */ ctc_intf.baseclock[0] = Machine->drv->cpu[1].cpu_clock; z80ctc_init (&ctc_intf); /* z80 pio init */ z80pio_init (&pio_intf); if ((_single = (signed char *)malloc(SINGLE_LENGTH)) == 0) { free(_single); return 1; } for (i = 0;i < SINGLE_LENGTH;i++) /* freq = ctc2 zco / 8 */ _single[i] = ((i/SINGLE_DIVIDER)&0x01)*127; /* CTC2 single tone generator */ mixer_set_volume(channel,0); mixer_play_sample(channel,_single,SINGLE_LENGTH,single_rate,1); return 0; }
void init_clay(t_clay *clay, const char *rom_path) { clay->cpu.memRead = mmu_mem_read; clay->cpu.memWrite = mmu_mem_write; clay->cpu.ioRead = io_handler_read; clay->cpu.ioWrite = io_handler_write; mmu_init(&clay->mmu, rom_path); z80ctc_init(&clay->ctc); ay_3_8912_init(&clay->ay); if (audio_output_init(&clay->audio_out, 44100*2, &clay->ay, (audio_output_sample_callback)ay_3_8912_sample_stereo)) // 2 sec sound buffer fprintf(stderr, "An error occured while initializing the sound sampler.\n"); }
int cchasm_sh_start(const struct MachineSound *msound) { sound_flags = 0; output[0] = 0; output[1] = 0; channel[0] = stream_init("CTC sound 1", 50, Machine->sample_rate, 0, tone_update); channel[1] = stream_init("CTC sound 2", 50, Machine->sample_rate, 1, tone_update); ctc_intf.baseclock[0] = Machine->drv->cpu[1].cpu_clock; z80ctc_init (&ctc_intf); return 0; }
void *cchasm_sh_start(int clock, const struct CustomSound_interface *config) { sound_flags = 0; output[0] = 0; output[1] = 0; channel[0] = stream_create(0, 1, Machine->sample_rate, (void *)0, tone_update); channel[1] = stream_create(0, 1, Machine->sample_rate, (void *)1, tone_update); ctc_intf.baseclock[0] = Machine->drv->cpu[1].cpu_clock; z80ctc_init (&ctc_intf); timer_pulse(TIME_IN_HZ(Machine->drv->frames_per_second), 0, cchasm_sh_update); return auto_malloc(1); }
void senjyo_sh_start(void) { int i; /* z80 ctc init */ ctc_intf.baseclock = Machine->drv->cpu[1].cpu_clock; z80ctc_init (0, &ctc_intf); /* z80 pio init */ z80pio_init (0, &pio_intf); _single = (INT16 *)auto_malloc(SINGLE_LENGTH*2); for (i = 0;i < SINGLE_LENGTH;i++) /* freq = ctc2 zco / 8 */ _single[i] = ((i/SINGLE_DIVIDER)&0x01)*127*256; /* CTC2 single tone generator */ sample_set_volume(0,0); sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1); timer_pulse(TIME_IN_HZ(Machine->refresh_rate), 0, senjyo_sh_update); }
void senjyo_sh_start(void) { int i; /* z80 ctc init */ ctc_intf.baseclock = cpunum_get_clock(1); z80ctc_init (0, &ctc_intf); /* z80 pio init */ z80pio_init (0, &pio_intf); _single = (INT16 *)auto_malloc(SINGLE_LENGTH*2); for (i = 0;i < SINGLE_LENGTH;i++) /* freq = ctc2 zco / 8 */ _single[i] = ((i/SINGLE_DIVIDER)&0x01)*127*256; /* CTC2 single tone generator */ sample_set_volume(0,0); sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1); timer_pulse(video_screen_get_frame_period(Machine->primary_screen), NULL, 0, senjyo_sh_update); }
static MACHINE_INIT(JOCTRONIC) { /* init CTC */ ctc_intf.baseclock[0] = Machine->drv->cpu[0].cpu_clock; z80ctc_init(&ctc_intf); sndbrd_0_init(core_gameData->hw.soundBoard, 1, memory_region(REGION_CPU2), NULL, NULL); }
static MACHINE_INIT(EFO) { sndbrd_0_init(core_gameData->hw.soundBoard, 1, memory_region(REGION_CPU2), NULL, NULL); ctc_intf.baseclock[2] = Machine->drv->cpu[0].cpu_clock; z80ctc_init(&ctc_intf); timer_pulse(TIME_IN_HZ(2000000), 0, ck0_pulse); }
void dlair_init_machine(void) { /* initialize the CTC */ ctc_intf.baseclock[0] = Machine->drv->cpu[0].cpu_clock; z80ctc_init(&ctc_intf); }
static MACHINE_RESET( pipeline ) { ctc_intf.baseclock = cpunum_get_clock(0); z80ctc_init(0, &ctc_intf); }
int starforc_sh_start(void) { int i; if (SN76496_sh_start(&interface) != 0) return 1; /* z80 ctc init */ ctc_intf.baseclock[0] = Machine->drv->cpu[1].cpu_clock; z80ctc_init (&ctc_intf); /* z80 pio init */ z80pio_init (&pio_intf); /* setup daisy chain connection */ { static Z80_DaisyChain daisy_chain[] = { { z80pio_reset , z80pio_interrupt, z80pio_reti , 0 }, /* device 0 = PIO_0 , low priority */ { z80ctc_reset , z80ctc_interrupt, z80ctc_reti , 0 }, /* device 1 = CTC_0 , high priority */ { 0,0,0,-1} /* end mark */ }; cpu_setdaisychain (1,daisy_chain ); /* daisy_chain is connect link for Z80 daisy-chain . paramater is { pointer of reset , pointer of interrupt entry,pointer of RETI handler , device paramater } reset : This function is called when z80 cpu reset interrupt entry : This function is called when z80 interrupt entry for this device It shoud be change interrupt status and set new status with cpu_cause_interrupt function return value is interrupt vector RETI handler : This function is called when z80 reti operation for this device It shoud be change interrupt status and set new status with cpu_cause_interrupt function handler shoud be allocate static. Because this pointers is used when reset cpu. The daisy chain link is build by this pointers. daisy chain priority: As for Priority , the top side is lower , bottom side is higher */ } if ((_single = (signed char *)gp2x_malloc(SINGLE_LENGTH)) == 0) { SN76496_sh_stop(); gp2x_free(_single); return 1; } for (i = 0;i < SINGLE_LENGTH;i++) /* freq = ctc2 zco / 8 */ _single[i] = ((i/SINGLE_DIVIDER)&0x01)*(SINGLE_VOLUME/2); /* CTC2 single tone generator */ osd_play_sample(4,_single,SINGLE_LENGTH,single_rate,single_volume,1); return 0; }