Beispiel #1
0
 public static void soundram_w(int offset, byte data)
 {
     if (offset < 0x1000)
     {
         offset &= 0x3ff;
         Namco.namcos1_cus30_w(offset, data);
     }
     else
     {
         offset &= 0x7ff;
         namcos1_triram[offset] = data;
     }
 }
Beispiel #2
0
 public static byte soundram_r(int offset)
 {
     if (offset < 0x1000)
     {
         offset &= 0x3ff;
         return(Namco.namcos1_cus30_r(offset));
     }
     else
     {
         offset &= 0x7ff;
         return(namcos1_triram[offset]);
     }
 }
Beispiel #3
0
        public static void N2WriteMemory(ushort address, byte data)
        {
            int offset;

            if (address == 0x4000)
            {
                YM2151.ym2151_register_port_0_w(data);
            }
            else if (address == 0x4001)
            {
                YM2151.ym2151_data_port_0_w(data);
            }
            else if (address >= 0x5000 && address <= 0x53ff)
            {
                offset = address & 0x3ff;
                Namco.namcos1_cus30_w(offset, data);
            }
            else if (address >= 0x7000 && address <= 0x77ff)
            {
                offset = address & 0x7ff;
                namcos1_triram[offset] = data;
            }
            else if (address >= 0x8000 && address <= 0x9fff)
            {
                offset             = address & 0x1fff;
                bank_ram20[offset] = data;
            }
            else if (address >= 0xc000 && address <= 0xc001)
            {
                namcos1_sound_bankswitch_w(data);
            }
            else if (address == 0xd001)
            {
                namcos1_watchdog_w();
            }
            else if (address == 0xe000)
            {
                irq_ack_w(2);
            }
            else
            {
                int i1 = 1;
            }
        }
Beispiel #4
0
        public static byte N2ReadMemory(ushort address)
        {
            byte result;
            int  offset;

            if (address >= 0x0000 && address <= 0x3fff)
            {
                offset = address & 0x3fff;
                result = audiorom[audiocpurom_offset + offset];
            }
            else if (address >= 0x4000 && address <= 0x4001)
            {
                result = YM2151.ym2151_status_port_0_r();
            }
            else if (address >= 0x5000 && address <= 0x53ff)
            {
                offset = address & 0x3ff;
                result = Namco.namcos1_cus30_r(offset);
            }
            else if (address >= 0x7000 && address <= 0x77ff)
            {
                offset = address & 0x7ff;
                result = namcos1_triram[offset];
            }
            else if (address >= 0x8000 && address <= 0x9fff)
            {
                offset = address & 0x1fff;
                result = bank_ram20[offset];
            }
            else if (address >= 0xc000 && address <= 0xffff)
            {
                offset = address & 0x3fff;
                result = audiorom[offset];
            }
            else
            {
                result = 0;
            }
            return(result);
        }
Beispiel #5
0
        public static void sound_init()
        {
            iRecord = 0;

            leftmix  = new int[0x3c0];
            rightmix = new int[0x3c0];

            finalmixb = new byte[0xf00];

            sound_muted = 0;

            buf2.Play(0, BufferPlayFlags.Looping);

            last_update_second = 0;
            //WavWrite.CreateSoundFile(@"\VS2008\compare1\compare1\bin\Debug\2.wav");
            Atime update_frequency = new Atime(0, Attotime.ATTOSECONDS_PER_SECOND / 50);

            switch (Machine.sBoard)
            {
            case "CPS-1":
                latched_value      = new ushort[2];
                utempdata          = new ushort[2];
                sound_update       = sound_updateC;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                OKI6295.okim6295_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                okistream    = new sound_stream(1000000 / 132, 0, 1, OKI6295.okim6295_update);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "CPS-1(QSound)":
            case "CPS2":
                sound_update       = sound_updateQ;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                QSound.qsound_start();
                qsoundstream = new sound_stream(4000000 / 166, 0, 2, QSound.qsound_update);
                mixerstream  = new sound_stream(48000, 2, 0, null);
                break;

            case "Neo Geo":
                latched_value      = new ushort[2];
                utempdata          = new ushort[2];
                sound_update       = sound_updateN;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2610.ym2610_start();
                ay8910stream = new sound_stream(250000, 0, 1, AY8910.ay8910_update);
                ym2610stream = new sound_stream(111111, 0, 2, FM.ym2610_update_one);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "Namco System 1":
                sound_update       = sound_updateNa;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579580);
                Namco.namco_start();
                DAC.dac_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                namcostream  = new sound_stream(192000, 0, 2, Namco.namco_update_stereo);
                dacstream    = new sound_stream(192000, 0, 1, DAC.DAC_update);
                mixerstream  = new sound_stream(48000, 5, 0, null);
                break;

            case "IGS011":
                sound_update       = sound_updateIGS011;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                OKI6295.okim6295_start();
                YM3812.ym3812_start(3579545);
                okistream    = new sound_stream(1047600 / 132, 0, 1, OKI6295.okim6295_update);
                ym3812stream = new sound_stream(49715, 0, 1, FMOpl.ym3812_update_one);
                mixerstream  = new sound_stream(48000, 2, 0, null);
                break;

            case "PGM":
                latched_value      = new ushort[3];
                utempdata          = new ushort[3];
                sound_update       = sound_updatePGM;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                ICS2115.ics2115_start();
                ics2115stream = new sound_stream(33075, 0, 2, ICS2115.ics2115_update);
                mixerstream   = new sound_stream(48000, 2, 0, null);
                break;

            case "M72":
                latched_value      = new ushort[1];
                utempdata          = new ushort[1];
                sound_update       = sound_updateM72;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                DAC.dac_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                dacstream    = new sound_stream(192000, 0, 1, DAC.DAC_update);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "M92":
                latched_value      = new ushort[1];
                utempdata          = new ushort[1];
                sound_update       = sound_updateM92;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                Iremga20.iremga20_start();
                ym2151stream   = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                iremga20stream = new sound_stream(894886, 0, 2, Iremga20.iremga20_update);
                mixerstream    = new sound_stream(48000, 4, 0, null);
                break;
            }
            Timer.timer_adjust_periodic(sound_update_timer, update_frequency, update_frequency);
        }