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; }
static MACHINE_RESET( super8 ) { /* reset PIO */ z80pio_init(0, &z80pio_intf); z80pio_reset(0); keyboard_scan(); /* enable ROM in base >0000, and re-enable RAM shortly thereafter */ memory_set_bankptr(1, memory_region(REGION_CPU1) + 0xC000); timer_set(TIME_IN_USEC(10), 0, reset_timer_callback); }
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); }
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; }