static int AY8910_init(const char *chip_name,int chip, int clock,int volume,int sample_rate, mem_read_handler portAread,mem_read_handler portBread, mem_write_handler portAwrite,mem_write_handler portBwrite) { struct AY8910 *PSG = &AYPSG[chip]; int i; #ifdef SINGLE_CHANNEL_MIXER char buf[40]; int gain = MIXER_GET_GAIN(volume); int pan = MIXER_GET_PAN(volume); #else char buf[3][40]; const char *name[3]; int vol[3]; #endif /* the step clock for the tone and noise generators is the chip clock */ /* divided by 8; for the envelope generator of the AY-3-8910, it is half */ /* that much (clock/16), but the envelope of the YM2149 goes twice as */ /* fast, therefore again clock/8. */ // causes crashes with YM2610 games - overflow? // if (options.use_filter) sample_rate = clock/8; memset(PSG,0,sizeof(struct AY8910)); PSG->PortAread = portAread; PSG->PortBread = portBread; PSG->PortAwrite = portAwrite; PSG->PortBwrite = portBwrite; #ifdef SINGLE_CHANNEL_MIXER for (i = 0;i < 3;i++) PSG->mix_vol[i] = MIXER_GET_LEVEL(volume); sprintf(buf,"%s #%d",chip_name,chip); PSG->Channel = stream_init(buf,MIXERG(100,gain,pan),sample_rate,chip,AY8910Update); #else for (i = 0;i < 3;i++) { vol[i] = volume; name[i] = buf[i]; sprintf(buf[i],"%s #%d Ch %c",chip_name,chip,'A'+i); } PSG->Channel = stream_init_multi(3,name,vol,sample_rate,chip,AY8910Update); #endif if (PSG->Channel == -1) return 1; return 0; }
static struct GfxDecodeInfo gfxdecodeinfo[] = { { REGION_GFX1, 0x0000, &charlayout, 0, 16 }, { REGION_GFX2, 0x0000, &spritelayout1, 16*4, 16 }, /* upper half */ { REGION_GFX2, 0x0010, &spritelayout1, 16*4, 16 }, /* lower half */ { REGION_GFX2, 0x0000, &spritelayout2, 16*4, 16 }, { -1 } /* end of array */ }; static struct AY8910interface ay8910_interface = { 5, /* 5 chips */ 14318180/8, /* 1.789772727 MHz */ { MIXERG(10,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(10,MIXER_GAIN_4x,MIXER_PAN_LEFT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_LEFT) }, /* R L | R R L */ /* effects | music */ { 0, 0, gyruss_portA_r }, { 0 }, { 0 }, { gyruss_filter0_w, gyruss_filter1_w } }; static struct DACinterface dac_interface = { 1, { MIXER(50,MIXER_PAN_LEFT) } };
}; static struct GfxDecodeInfo gfxdecodeinfo[] = { { REGION_GFX1, 0x0000, &charlayout, 0, 8 }, { REGION_GFX1, 0x0000, &spritelayout, 0, 8 }, { -1 } /* end of array */ }; static struct AY8910interface ay8910_interface = { 2, /* 2 chips */ 14318000/8, /* 1.78975 Mhz */ { MIXERG(30,MIXER_GAIN_2x,MIXER_PAN_CENTER), MIXERG(30,MIXER_GAIN_2x,MIXER_PAN_CENTER) }, { soundlatch_r }, { scramble_portB_r }, { 0 }, { 0 } }; static struct MachineDriver machine_driver_amidar = { /* basic machine hardware */ { { CPU_Z80, 18432000/6, /* 3.072 Mhz */
PORT_DIPSETTING( 0x06, "A 1/1 B 1/6 C 1/1" ) PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END struct AY8910interface frogger_ay8910_interface = { 1, /* 1 chip */ 14318000/8, /* 1.78975 MHz */ { MIXERG(80,MIXER_GAIN_2x,MIXER_PAN_CENTER) }, { soundlatch_r }, { frogger_portB_r }, { 0 }, { 0 } }; static MACHINE_DRIVER_START( frogger ) /* basic machine hardware */ MDRV_IMPORT_FROM(galaxian_base) MDRV_CPU_MODIFY("main") MDRV_CPU_MEMORY(readmem,writemem) MDRV_CPU_ADD(Z80,14318000/8)
{ REGION_GFX2, 0, &mcatadv_tiles16x16x4_layout, 0, 0x200 }, { REGION_GFX3, 0, &mcatadv_tiles16x16x4_layout, 0, 0x200 }, { -1 } }; /* Stolen from Psikyo.c */ static void sound_irq( int irq ) { cpu_set_irq_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE); } struct YM2610interface mcatadv_ym2610_interface = { 1, 16000000/2, /* ? */ { MIXERG(8,MIXER_GAIN_4x,MIXER_PAN_CENTER) }, // volume of AY-3-8910 voices { 0 }, /* A_r */ { 0 }, /* B_r */ { 0 }, /* A_w */ { 0 }, /* B_w */ { sound_irq }, /* irq */ { REGION_SOUND1 }, /* delta_t */ { REGION_SOUND1 }, /* adpcm */ { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) } }; static MACHINE_INIT( mcatadv ) { watchdog_reset_r(0); }
#define Z80_CLOCK (6000000) #define YM_CLOCK (8000000) static void YM_2610IRQHandler(int irq); static unsigned int z80_in_neo(unsigned int address); static void z80_out_neo(unsigned int address, unsigned int data); static int nbnk8, nbnkc, nbnke, nbnkf; static struct YM2610interface neogeo_ym2610_interface = { 1, 8000000, { MIXERG(30,MIXER_GAIN_1x,MIXER_PAN_CENTER) }, // PSG volume { 0 }, { 0 }, { 0 }, { 0 }, { YM_2610IRQHandler }, { RGN_SAMP2 }, { RGN_SAMP1 }, { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) } // FM volume }; static READ_HANDLER( neo_readport2 ) { return z80_in_neo(offset); }
{ REGION_GFX3, 0x08000, &tilelayout, 256, 16 }, { REGION_GFX3, 0x09000, &tilelayout, 256, 16 }, { REGION_GFX3, 0x0a000, &tilelayout, 256, 16 }, { REGION_GFX3, 0x0b000, &tilelayout, 256, 16 }, { -1 } /* end of array */ }; /* actually there is one AY8910 and one YM2203, but the sound core doesn't */ /* support that so we use 2 YM2203 */ static struct YM2203interface ym2203_interface = { 2, /* 2 chips */ 1250000, /* 1.25 MHz */ { YM2203_VOL(20,MIXERG(20,MIXER_GAIN_2x,MIXER_PAN_CENTER)), YM2203_VOL(20,MIXERG(20,MIXER_GAIN_2x,MIXER_PAN_CENTER)) }, { soundlatch_r }, { soundlatch2_r }, { 0 }, { 0 } }; static struct MachineDriver machine_driver_citycon = { /* basic machine hardware */ { { CPU_M6809, 2048000, /* 2.048 Mhz ??? */
8000000, /* 8 MHz */ { 50 }, { 0 }, { 0 }, { 0 }, { 0 }, { sound_irq }, { REGION_SOUND1 }, { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) } }; struct YM2610interface ym2610_interface = { 1, 8000000, { MIXERG(15,MIXER_GAIN_4x,MIXER_PAN_CENTER) }, { 0 }, { 0 }, { 0 }, { 0 }, { sound_irq }, { REGION_SOUND2 }, { REGION_SOUND1 }, { YM3012_VOL(20,MIXER_PAN_LEFT,20,MIXER_PAN_RIGHT) } }; /******************************************************************************/ static NVRAM_HANDLER( bbusters ) { if( read_or_write ) {