예제 #1
0
        public static void CPSInit()
        {
            int i, n;

            cps_a_regs      = new ushort[0x20];
            cps_b_regs      = new ushort[0x20];
            gfxram          = new byte[0x30000];
            Memory.mainram  = new byte[0x100000];
            Memory.audioram = new byte[0x800];
            Machine.bRom    = true;
            Memory.mainrom  = Machine.GetRom("maincpu.rom");
            gfxrom          = Machine.GetRom("gfx.rom");
            n       = gfxrom.Length;
            gfx1rom = new byte[n * 2];
            for (i = 0; i < n; i++)
            {
                gfx1rom[i * 2]     = (byte)(gfxrom[i] & 0x0f);
                gfx1rom[i * 2 + 1] = (byte)(gfxrom[i] >> 4);
            }
            Memory.audiorom = Machine.GetRom("audiocpu.rom");
            switch (Machine.sBoard)
            {
            case "CPS-1":
                cps_version = 1;
                starsrom    = Machine.GetRom("stars.rom");
                //OKI6295.okirom = Machine.GetRom("oki.rom");
                if (Memory.mainrom == null || gfxrom == null /*|| Memory.audiorom == null || OKI6295.okirom == null*/)
                {
                    Machine.bRom = false;
                }
                break;

            case "CPS-1(QSound)":
                cps_version       = 1;
                qsound_sharedram1 = new byte[0x1000];
                qsound_sharedram2 = new byte[0x1000];
                audioromop        = Machine.GetRom("audiocpuop.rom");
                user1rom          = Machine.GetRom("user1.rom");
                //QSound.qsoundrom = ByteToSbyte(Machine.GetRom("qsound.rom"));
                if (Memory.mainrom == null || audioromop == null || gfxrom == null || Memory.audiorom == null /*|| QSound.qsoundrom == null*/)
                {
                    Machine.bRom = false;
                }
                break;

            case "CPS2":
                cps_version        = 2;
                cps2_objram1       = new ushort[0x1000];
                cps2_objram2       = new ushort[0x1000];
                cps2_output        = new ushort[0x06];
                cps2networkpresent = 0;
                cps2_objram_bank   = 0;
                scancount          = 0;
                cps1_scanline1     = 262;
                cps1_scanline2     = 262;
                cps1_scancalls     = 0;
                qsound_sharedram1  = new byte[0x1000];
                qsound_sharedram2  = new byte[0x1000];
                if (Machine.sManufacturer != "bootleg")
                {
                    mainromop = Machine.GetRom("maincpuop.rom");
                }
                audioromop = Machine.GetRom("audiocpu.rom");
                //QSound.qsoundrom = ByteToSbyte(Machine.GetRom("qsound.rom"));
                if (Memory.mainrom == null || (Machine.sManufacturer != "bootleg" && mainromop == null) || audioromop == null || gfxrom == null || Memory.audiorom == null /*|| QSound.qsoundrom == null*/)
                {
                    Machine.bRom = false;
                }
                break;
            }
            if (Machine.bRom)
            {
                scrollxoff = 0x00;
                scrollyoff = 0x100;
                switch (Machine.sName)
                {
                case "ffight":
                case "ffighta":
                case "ffightu":
                case "ffightu1":
                case "ffightj":
                    cpsb_addr      = 0x20;
                    cpsb_value     = 0x0004;
                    mult_factor1   = -1;
                    mult_factor2   = -1;
                    mult_result_lo = -1;
                    mult_result_hi = -1;
                    layer_control  = 0x2e;
                    priority       = new int[4] {
                        0x26, 0x30, 0x28, 0x32
                    };
                    palette_control   = 0x2a;
                    layer_enable_mask = new int[5] {
                        0x02, 0x04, 0x08, 0x00, 0x00
                    };
                    in2_addr       = 0x00;
                    in3_addr       = 0x00;
                    out2_addr      = 0x00;
                    bootleg_kludge = 0;
                    dswa           = 0xff;
                    dswb           = 0xf4;
                    dswc           = 0x9f;
                    lsRange0       = new List <gfx_range>();
                    lsRange0.Add(new gfx_range(0x4400, 0x4bff, 0));
                    lsRange1 = new List <gfx_range>();
                    lsRange1.Add(new gfx_range(0x3000, 0x3fff, 0));
                    lsRange2 = new List <gfx_range>();
                    lsRange2.Add(new gfx_range(0x0980, 0x0bff, 0));
                    lsRangeS = new List <gfx_range>();
                    lsRangeS.Add(new gfx_range(0x0000, 0x21ff, 0));
                    break;
                }
                if (cps_version == 2)
                {
                    cpsb_addr      = 0x32;
                    cpsb_value     = -1;
                    mult_factor1   = 0x00;
                    mult_factor2   = 0x02;
                    mult_result_lo = 0x04;
                    mult_result_hi = 0x06;
                    layer_control  = 0x26;
                    priority       = new int[4] {
                        0x28, 0x2a, 0x2c, 0x2e
                    };
                    palette_control   = 0x30;
                    layer_enable_mask = new int[5] {
                        0x02, 0x04, 0x08, 0x30, 0x30
                    };
                    in2_addr       = 0x00;
                    in3_addr       = 0x00;
                    out2_addr      = 0x00;
                    bootleg_kludge = 0;
                    lsRange0       = new List <gfx_range>();
                    lsRange0.Add(new gfx_range(0x0000, 0x1ffff, 0x20000));
                    lsRange1 = new List <gfx_range>();
                    lsRange1.Add(new gfx_range(0x0000, 0xffff, 0x10000));
                    lsRange2 = new List <gfx_range>();
                    lsRange2.Add(new gfx_range(0x0000, 0x3fff, 0x4000));
                    lsRangeS = new List <gfx_range>();
                    lsRangeS.Add(new gfx_range(0x0000, 0xffff, 0));
                }
            }
        }