예제 #1
0
        private static int NEOGEO_VBLANK_RELOAD_HPOS = 0x11f; //287
        public static void video_init()
        {
            Wintime.wintime_init();
            global_throttle = true;
            //UI.ui_handler_callback = UI.handler_ingame;
            sDrawText      = "";
            popup_text_end = 0;
            popcount       = new int[256] {
                0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
                1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
                1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
                2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
                1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
                2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
                2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
                3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
            };
            switch (Machine.sBoard)
            {
            case "CPS-1":
                //case "CPS-1(QSound)":
                screenstate.width  = 0x200;
                screenstate.height = 0x100;
                //screenstate.visarea.min_x = 0;
                //screenstate.visarea.max_x = 0x1ff;
                //screenstate.visarea.min_y = 0;
                //screenstate.visarea.max_y = 0x1ff;
                fullwidth                 = 0x200;
                fullheight                = 0x200;
                frame_update_time         = new Atime(0, (long)(1e18 / 59.61));//59.61Hz
                screenstate.vblank_period = 0;
                //           bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
                // UI.ui_update_callback = UI.ui_updateC;
                bitmapbase    = new ushort[2][];
                bitmapbase[0] = new ushort[0x200 * 0x200];
                bitmapbase[1] = new ushort[0x200 * 0x200];
                //          bbmp = new Bitmap[3];
                //          bbmp[0] = new Bitmap(512, 512);
                //          bbmp[1] = new Bitmap(512, 256);
                //          bbmp[2] = new Bitmap(384, 224);
                video_update_callback = CPS.video_update_cps1;
                video_eof_callback    = CPS.video_eof_cps1;
                break;

                /*case "CPS2":
                 *  screenstate.width = 0x200;
                 *  screenstate.height = 0x100;
                 *  screenstate.visarea.min_x = 0;
                 *  screenstate.visarea.max_x = 0x1ff;
                 *  screenstate.visarea.min_y = 0;
                 *  screenstate.visarea.max_y = 0x1ff;
                 *  fullwidth = 0x200;
                 *  fullheight = 0x200;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 8000000) * 512 * 262);//59.637404580152669Hz
                 *  screenstate.vblank_period = 0;
                 *  bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
                 *  UI.ui_update_callback = UI.ui_updateC;
                 *  bitmapbase = new ushort[2][];
                 *  bitmapbase[0] = new ushort[0x200 * 0x200];
                 *  bitmapbase[1] = new ushort[0x200 * 0x200];
                 *  bbmp = new Bitmap[3];
                 *  bbmp[0] = new Bitmap(512, 512);
                 *  bbmp[1] = new Bitmap(512, 256);
                 *  bbmp[2] = new Bitmap(384, 224);
                 *  video_update_callback = CPS.video_update_cps1;
                 *  video_eof_callback = CPS.video_eof_cps1;
                 *  break;
                 * case "Neo Geo":
                 *  screenstate.width = 384;
                 *  screenstate.height = 264;
                 *  screenstate.visarea.min_x = NEOGEO_HBEND;//30
                 *  screenstate.visarea.max_x = NEOGEO_HBSTART - 1;//349
                 *  screenstate.visarea.min_y = NEOGEO_VBEND;//16
                 *  screenstate.visarea.max_y = NEOGEO_VBSTART - 1;//239
                 *  fullwidth = 384;
                 *  fullheight = 264;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 6000000) * screenstate.width * screenstate.height);//59.1856060608428Hz
                 *  screenstate.vblank_period = (long)(1e18 / 6000000) * 384 * (264 - 224);
                 *  UI.ui_update_callback = UI.ui_updateN;
                 *  bitmapbaseN = new int[2][];
                 *  bitmapbaseN[0] = new int[384 * 264];
                 *  bitmapbaseN[1] = new int[384 * 264];
                 *  bbmp = new Bitmap[1];
                 *  bbmp[0] = new Bitmap(320, 224);
                 *  video_update_callback = Neogeo.video_update_neogeo;
                 *  video_eof_callback = Neogeo.video_eof_neogeo;
                 *  break;
                 * case "Namco System 1":
                 *  screenstate.width = 0x200;
                 *  screenstate.height = 0x200;
                 *  screenstate.visarea.min_x = 0;
                 *  screenstate.visarea.max_x = 0x1ff;
                 *  screenstate.visarea.min_y = 0;
                 *  screenstate.visarea.max_y = 0x1ff;
                 *  fullwidth = 0x200;
                 *  fullheight = 0x200;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 60.606060));
                 *  screenstate.vblank_period = 0;
                 *  UI.ui_update_callback = UI.ui_updateNa;
                 *  bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
                 *  bitmapbase = new ushort[2][];
                 *  bitmapbase[0] = new ushort[0x200 * 0x200];
                 *  bitmapbase[1] = new ushort[0x200 * 0x200];
                 *  bbmp = new Bitmap[2];
                 *  bbmp[0] = new Bitmap(512, 512);
                 *  bbmp[1] = new Bitmap(288, 224);
                 *  video_update_callback = Namcos1.video_update_namcos1;
                 *  video_eof_callback = Namcos1.video_eof_namcos1;
                 *  break;
                 * case "IGS011":
                 *  screenstate.width = 0x200;
                 *  screenstate.height = 0x100;
                 *  screenstate.visarea.min_x = 0;
                 *  screenstate.visarea.max_x = 0x1ff;
                 *  screenstate.visarea.min_y = 0;
                 *  screenstate.visarea.max_y = 0xff;
                 *  fullwidth = 0x200;
                 *  fullheight = 0x200;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 60));
                 *  screenstate.vblank_period = 0;
                 *  UI.ui_update_callback = UI.ui_updateIGS011;
                 *  bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
                 *  bitmapbase = new ushort[2][];
                 *  bitmapbase[0] = new ushort[0x200 * 0x200];
                 *  bitmapbase[1] = new ushort[0x200 * 0x200];
                 *  bbmp = new Bitmap[1];
                 *  bbmp[0] = new Bitmap(512, 240);
                 *  video_update_callback = IGS011.video_update_igs011;
                 *  video_eof_callback = IGS011.video_eof_igs011;
                 *  break;
                 * case "PGM":
                 *  screenstate.width = 0x200;
                 *  screenstate.height = 0x200;
                 *  screenstate.visarea.min_x = 0;
                 *  screenstate.visarea.max_x = 0x1bf;
                 *  screenstate.visarea.min_y = 0;
                 *  screenstate.visarea.max_y = 0xdf;
                 *  fullwidth = 0x200;
                 *  fullheight = 0x200;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 60));
                 *  screenstate.vblank_period = 0;
                 *  UI.ui_update_callback = UI.ui_updatePGM;
                 *  bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
                 *  bitmapbase = new ushort[2][];
                 *  bitmapbase[0] = new ushort[0x200 * 0x200];
                 *  bitmapbase[1] = new ushort[0x200 * 0x200];
                 *  bbmp = new Bitmap[1];
                 *  bbmp[0] = new Bitmap(448, 224);
                 *  video_update_callback = PGM.video_update_pgm;
                 *  video_eof_callback = PGM.video_eof_pgm;
                 *  break;
                 * case "M72":
                 *  screenstate.width = 0x200;
                 *  screenstate.height = 0x11c;
                 *  screenstate.visarea.min_x = 0x40;
                 *  screenstate.visarea.max_x = 0x1bf;
                 *  screenstate.visarea.min_y = 0;
                 *  screenstate.visarea.max_y = 0xff;
                 *  fullwidth = 0x200;
                 *  fullheight = 0x200;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 8000000) * screenstate.width * screenstate.height);
                 *  screenstate.vblank_period = (long)(1e18 / 8000000) * 512 * (284 - 256);
                 *  UI.ui_update_callback = UI.ui_updatePGM;
                 *  bitmapbase = new ushort[2][];
                 *  bitmapbase[0] = new ushort[0x200 * 0x200];//0x11c
                 *  bitmapbase[1] = new ushort[0x200 * 0x200];//0x11c
                 *  bbmp = new Bitmap[1];
                 *  bbmp[0] = new Bitmap(512, 284);
                 *  video_update_callback = M72.video_update_m72;
                 *  video_eof_callback = M72.video_eof_m72;
                 *  break;
                 * case "M92":
                 *  screenstate.width = 0x200;
                 *  screenstate.height = 0x100;
                 *  screenstate.visarea.min_x = 0x50;
                 *  screenstate.visarea.max_x = 0x18f;
                 *  screenstate.visarea.min_y = 0x8;
                 *  screenstate.visarea.max_y = 0xf7;
                 *  fullwidth = 0x200;
                 *  fullheight = 0x200;
                 *  frame_update_time = new Atime(0, (long)(1e18 / 60));
                 *  screenstate.vblank_period = 0;
                 *  UI.ui_update_callback = UI.ui_updatePGM;
                 *  bitmapbase = new ushort[2][];
                 *  bitmapbase[0] = new ushort[0x200 * 0x200];
                 *  bitmapbase[1] = new ushort[0x200 * 0x200];
                 *  bbmp = new Bitmap[1];
                 *  bbmp[0] = new Bitmap(0x200, 0x100);
                 *  video_update_callback = M92.video_update_m92;
                 *  video_eof_callback = M92.video_eof_m92;
                 *  break;*/
            }
            screenstate.frame_period = frame_update_time.attoseconds;
            screenstate.scantime     = screenstate.frame_period / screenstate.height;
            screenstate.pixeltime    = screenstate.frame_period / (screenstate.height * screenstate.width);
            screenstate.frame_number = 0;
            //   bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
            bitmapcolor        = new int[Video.fullwidth * Video.fullheight];
            vblank_begin_timer = Timer.timer_alloc_common(vblank_begin_callback, "vblank_begin_callback", false);
            Timer.timer_adjust_periodic(vblank_begin_timer, frame_update_time, Attotime.ATTOTIME_NEVER);
            scanline0_timer = Timer.timer_alloc_common(scanline0_callback, "scanline0_callback", false);
            Timer.timer_adjust_periodic(scanline0_timer, video_screen_get_time_until_pos(0, 0), Attotime.ATTOTIME_NEVER);
            switch (Machine.sBoard)
            {
            case "CPS-1":
            case "CPS-1(QSound)":
            case "Namco System 1":
                break;

            case "CPS2":
                Cpuexec.cpu[0].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 262);
                Cpuexec.cpu[0].partial_frame_timer  = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
                break;

            case "Neo Geo":
                break;

            case "IGS011":
                Cpuexec.cpu[0].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 5);
                Cpuexec.cpu[0].partial_frame_timer  = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
                break;

            case "M72":
                Cpuexec.cpu[1].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 128);
                Cpuexec.cpu[1].partial_frame_timer  = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
                break;
            }
            screenstate.vblank_start_time = Attotime.ATTOTIME_ZERO;
        }
예제 #2
0
파일: Video.cs 프로젝트: beginor/mame.net
        private static int NEOGEO_VBLANK_RELOAD_HPOS = 0x11f; //287
        public static void video_init()
        {
            Wintime.wintime_init();
            global_throttle        = true;
            UI.ui_handler_callback = UI.handler_ingame;
            sDrawText      = "";
            popup_text_end = 0;
            popcount       = new int[256] {
                0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
                1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
                1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
                2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
                1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
                2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
                2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
                3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
            };
            switch (Machine.sBoard)
            {
            case "CPS-1":
            case "CPS-1(QSound)":
                screenstate.visarea.min_x = 0;
                screenstate.visarea.max_x = 0x1ff;
                screenstate.visarea.min_y = 0;
                screenstate.visarea.max_y = 0x1ff;
                fullwidth             = 0x200;
                fullheight            = 0x200;
                frame_update_time     = new Atime(0, (long)(1e18 / 59.61));//59.61Hz
                bitmapGDI             = new Bitmap(Video.fullwidth, Video.fullheight);
                UI.ui_update_callback = UI.ui_updateC;
                bitmapbaseC           = new ushort[2][];
                bitmapbaseC[0]        = new ushort[0x200 * 0x200];
                bitmapbaseC[1]        = new ushort[0x200 * 0x200];
                bbmp    = new Bitmap[3];
                bbmp[0] = new Bitmap(512, 512);
                bbmp[1] = new Bitmap(512, 256);
                bbmp[2] = new Bitmap(384, 224);
                video_update_callback = CPS.video_update_cps1;
                video_eof_callback    = CPS.video_eof_cps1;
                break;

            case "CPS2":
                fullwidth             = 0x200;
                fullheight            = 0x200;
                frame_update_time     = new Atime(0, (long)(1e18 / 8000000) * 512 * 262);//59.637404580152669Hz
                bitmapGDI             = new Bitmap(Video.fullwidth, Video.fullheight);
                UI.ui_update_callback = UI.ui_updateC;
                bitmapbaseC           = new ushort[2][];
                bitmapbaseC[0]        = new ushort[0x200 * 0x200];
                bitmapbaseC[1]        = new ushort[0x200 * 0x200];
                bbmp    = new Bitmap[3];
                bbmp[0] = new Bitmap(512, 512);
                bbmp[1] = new Bitmap(512, 256);
                bbmp[2] = new Bitmap(384, 224);
                video_update_callback = CPS.video_update_cps1;
                video_eof_callback    = CPS.video_eof_cps1;
                break;

            case "Neo Geo":
                screenstate.width         = 384;
                screenstate.height        = 264;
                screenstate.visarea.min_x = NEOGEO_HBEND;       //30
                screenstate.visarea.max_x = NEOGEO_HBSTART - 1; //349
                screenstate.visarea.min_y = NEOGEO_VBEND;       //16
                screenstate.visarea.max_y = NEOGEO_VBSTART - 1; //239
                fullwidth  = 384;
                fullheight = 264;
                screenstate.frame_period = (long)(1e18 / 6000000) * screenstate.width * screenstate.height;
                screenstate.scantime     = (long)(1e18 / 6000000) * screenstate.width;
                screenstate.pixeltime    = (long)(1e18 / 6000000);
                frame_update_time        = new Atime(0, (long)(1e18 / 6000000) * 384 * 264);//59.1856060608428Hz
                UI.ui_update_callback    = UI.ui_updateN;
                bitmapbaseN           = new int[2][];
                bitmapbaseN[0]        = new int[384 * 264];
                bitmapbaseN[1]        = new int[384 * 264];
                bbmp                  = new Bitmap[1];
                bbmp[0]               = new Bitmap(320, 224);
                video_update_callback = Neogeo.video_update_neogeo;
                video_eof_callback    = Neogeo.video_eof_neogeo;
                break;

            case "Namco System 1":
                screenstate.visarea.min_x = 0;
                screenstate.visarea.max_x = 0x1ff;
                screenstate.visarea.min_y = 0;
                screenstate.visarea.max_y = 0x1ff;
                fullwidth             = 0x200;
                fullheight            = 0x200;
                frame_update_time     = new Atime(0, (long)(1e18 / 60.606060));
                UI.ui_update_callback = UI.ui_updateNa;
                bitmapGDI             = new Bitmap(Video.fullwidth, Video.fullheight);
                bitmapbaseNa          = new ushort[2][];
                bitmapbaseNa[0]       = new ushort[0x200 * 0x200];
                bitmapbaseNa[1]       = new ushort[0x200 * 0x200];
                bbmp    = new Bitmap[2];
                bbmp[0] = new Bitmap(512, 512);
                bbmp[1] = new Bitmap(288, 224);
                video_update_callback = Namcos1.video_update_namcos1;
                video_eof_callback    = Namcos1.video_eof_namcos1;
                break;

            case "IGS011":
                screenstate.visarea.min_x = 0;
                screenstate.visarea.max_x = 0x1ff;
                screenstate.visarea.min_y = 0;
                screenstate.visarea.max_y = 0xff;
                fullwidth             = 0x200;
                fullheight            = 0x200;
                frame_update_time     = new Atime(0, (long)(1e18 / 60));
                UI.ui_update_callback = UI.ui_updateIGS011;
                bitmapGDI             = new Bitmap(Video.fullwidth, Video.fullheight);
                bitmapbaseIGS011      = new ushort[2][];
                bitmapbaseIGS011[0]   = new ushort[0x200 * 0x200];
                bitmapbaseIGS011[1]   = new ushort[0x200 * 0x200];
                bbmp    = new Bitmap[1];
                bbmp[0] = new Bitmap(512, 240);
                video_update_callback = IGS011.video_update_igs011;
                video_eof_callback    = IGS011.video_eof_igs011;
                break;

            case "PGM":
                fullwidth             = 0x200;
                fullheight            = 0x200;
                frame_update_time     = new Atime(0, (long)(1e18 / 60));
                UI.ui_update_callback = UI.ui_updatePGM;
                bitmapGDI             = new Bitmap(Video.fullwidth, Video.fullheight);
                bitmapbasePGM         = new ushort[2][];
                bitmapbasePGM[0]      = new ushort[0x200 * 0x200];
                bitmapbasePGM[1]      = new ushort[0x200 * 0x200];
                bbmp    = new Bitmap[1];
                bbmp[0] = new Bitmap(448, 224);
                video_update_callback = PGM.video_update_pgm;
                video_eof_callback    = PGM.video_eof_pgm;
                break;
            }
            screenstate.frame_number = 0;
            bitmapGDI          = new Bitmap(Video.fullwidth, Video.fullheight);
            bitmapcolor        = new int[Video.fullwidth * Video.fullheight];
            vblank_begin_timer = Timer.timer_alloc_common(vblank_begin_callback, "vblank_begin_callback", false);
            Timer.timer_adjust_periodic(vblank_begin_timer, frame_update_time, Attotime.ATTOTIME_NEVER);
            switch (Machine.sBoard)
            {
            case "CPS-1":
            case "CPS-1(QSound)":
            case "Namco System 1":
                break;

            case "CPS2":
                partial_frame_period        = Attotime.attotime_div(Video.frame_update_time, 262);
                Cpuexec.partial_frame_timer = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
                break;

            case "Neo Geo":
                Timer.timer_adjust_periodic(vblank_begin_timer, video_screen_get_time_until_pos(screenstate.visarea.max_y + 1, 0), Attotime.ATTOTIME_NEVER);
                break;

            case "IGS011":
                partial_frame_period        = Attotime.attotime_div(Video.frame_update_time, 5);
                Cpuexec.partial_frame_timer = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
                break;

            case "PGM":
                partial_frame_period        = Attotime.attotime_div(Video.frame_update_time, 2);
                Cpuexec.partial_frame_timer = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
                break;
            }
            screenstate.vblank_start_time = Attotime.ATTOTIME_ZERO;
        }