Esempio n. 1
0
 public static void m72_sound_command_byte_w(int offset, byte data)
 {
     Sound.soundlatch_w(data);
     setvector_param = 3;
     Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
     Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
 }
Esempio n. 2
0
 public static void ym2610_start()
 {
     AY8910.ay8910_start_ym();
     /* Timer Handler set */
     timer0 = Timer.timer_alloc_common(timer_callback_0, "timer_callback_0", false);
     timer1 = Timer.timer_alloc_common(timer_callback_1, "timer_callback_1", false);
     /**** initialize YM2610 ****/
     FM.ym2610_init();
 }
Esempio n. 3
0
 public static void video_start_neogeo()
 {
     sprite_gfx         = new byte[spritesrom.Length * 2];
     neogeo_videoram    = new ushort[0x10000];
     palettes           = new ushort[2, 0x1000];
     pens               = new int[0x1000];
     transarray         = new int[384 * 264];
     bgarray            = new int[384 * 264];
     trans_color        = unchecked ((int)0xffff00ff);
     rgb_weights_normal = new double[5] {
         138.24919544273797, 64.712389372353314, 30.414823021125919, 13.824919571647138, 7.7986725921356159
     };
     rgb_weights_normal_bit15 = new double[5] {
         136.26711031260342, 63.784604843122239, 29.978764292156193, 13.626711058241233, 7.6868626613063098
     };
     rgb_weights_dark = new double[5] {
         77.012238506947057, 36.048281863327709, 16.942692484743652, 7.7012238659431276, 4.3442801368916566
     };
     rgb_weights_dark_bit15 = new double[5] {
         76.322306339305158, 35.725334891159271, 16.790907407744047, 7.6322306490423326, 4.3053608862660706
     };
     zoom_x_tables = new int[, ]
     {
         { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
         { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
         { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
         { 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
         { 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 },
         { 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0 },
         { 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
         { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
         { 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0 },
         { 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0 },
         { 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1 },
         { 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1 },
         { 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 },
         { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 },
         { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
         { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
     };
     Array.Clear(palettes, 0, 0x2000);
     Array.Clear(pens, 0, 0x1000);
     Array.Clear(neogeo_videoram, 0, 0x10000);
     for (int i = 0; i < 384 * 264; i++)
     {
         transarray[i] = trans_color;
     }
     auto_animation_timer = Timer.timer_alloc_common(auto_animation_timer_callback, "auto_animation_timer_callback", false);
     optimize_sprite_data();
     videoram_read_buffer         = 0;
     videoram_offset              = 0;
     videoram_modulo              = 0;
     auto_animation_speed         = 0;
     auto_animation_disabled      = 0;
     auto_animation_counter       = 0;
     auto_animation_frame_counter = 0;
 }
Esempio n. 4
0
 public static void m92_soundlatch_w(ushort data)
 {
     /*StreamWriter sw1 = new StreamWriter("1.txt", false);
      * sw1.WriteLine(Video.screenstate.frame_number.ToString() + "\ta" + data.ToString());
      * sw1.Close();*/
     setvector_param = 3;
     Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
     Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
     Sound.soundlatch_w((ushort)(data & 0xff));
 }
Esempio n. 5
0
 public static void m72_sound_command_w(int offset, ushort data)
 {
     /*StreamWriter sw1 = new StreamWriter("1.txt", true);
      * sw1.WriteLine(Video.screenstate.frame_number.ToString() + "\t" + data.ToString());
      * sw1.Close();*/
     //if (ACCESSING_BITS_0_7)
     {
         Sound.soundlatch_w(data);
         setvector_param = 3;
         Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
         Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
     }
 }
Esempio n. 6
0
 public static void m72_ym2151_irq_handler(int irq)
 {
     if (irq != 0)
     {
         setvector_param = 1;
         Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
         Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
     }
     else
     {
         setvector_param = 2;
         Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
         Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
     }
 }
Esempio n. 7
0
 public static void sound_irq(int state)
 {
     if (state != 0)
     {
         setvector_param = 1;
         Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
         Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
     }
     else
     {
         setvector_param = 2;
         Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
         Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
     }
 }
Esempio n. 8
0
 public static void init_machine()
 {
     //Inptport.input_init();
     Generic.generic_machine_init();
     Timer.timer_init();
     soft_reset_timer = Timer.timer_alloc_common(soft_reset, "soft_reset", false);
     //Inptport.input_port_init();
     Cpuexec.cpuexec_init();
     Watchdog.watchdog_init();
     Cpuint.cpuint_init();
     Video.video_init();
     //Sound.sound_init();
     State.state_init();
     Machine.machine_start();
 }
Esempio n. 9
0
        public static void init_machine()
        {
            //fileio_init();
            //config_init();
            Inptport.input_init();
            //output_init();

            //render_init();
            //ui_init();

            Generic.generic_machine_init();

            Timer.timer_init();
            soft_reset_timer = Timer.timer_alloc_common(soft_reset, "soft_reset", false);

            //osd_init();

            //time(&mame->base_time);

            Inptport.input_port_init();
            //if (newbase != 0)
            //    mame->base_time = newbase;

            /* intialize UI input */
            //ui_input_init();

            //rom_init();
            //memory_init();
            Cpuexec.cpuexec_init();
            Watchdog.watchdog_init();

            //cps1_gfx_decode();

            //device_list_start();

            Video.video_init();

            Sound.sound_init();

            State.state_init();

            Machine.machine_start();
        }
Esempio n. 10
0
 public static void machine_start_neogeo()
 {
     if (Memory.mainrom.Length > 0x100000)
     {
         main_cpu_bank_address = 0x100000;
     }
     else
     {
         main_cpu_bank_address = 0x000000;
     }
     audio_cpu_banks[0] = 0x1e;
     audio_cpu_banks[1] = 0x0e;
     audio_cpu_banks[2] = 0x06;
     audio_cpu_banks[3] = 0x02;
     display_position_interrupt_timer = Timer.timer_alloc_common(display_position_interrupt_callback, "display_position_interrupt_callback", false);
     display_position_vblank_timer    = Timer.timer_alloc_common(display_position_vblank_callback, "display_position_vblank_callback", false);
     vblank_interrupt_timer           = Timer.timer_alloc_common(vblank_interrupt_callback, "vblank_interrupt_callback", false);
     Pd4900a.pd4990a_init();
     calendar_init();
     irq3_pending = 1;
 }
Esempio n. 11
0
        public static void watchdog_init()
        {
            watchdog_timer = Timer.timer_alloc_common(watchdog_callback, "watchdog_callback", false);
            switch (Machine.sBoard)
            {
            case "CPS-1":
            case "CPS-1(QSound)":
            case "CPS2":
                watchdog_time = Attotime.ATTOTIME_ZERO;
                break;

            case "Neo Geo":
                watchdog_time = new Atime(0, (long)128762e12);
                break;

            case "Namco System 1":
            case "IGS011":
            case "PGM":
                watchdog_time = Attotime.ATTOTIME_ZERO;
                break;
            }
        }
Esempio n. 12
0
 public static void m92_spritecontrol_w(int offset, byte data)
 {
     m92_spritecontrol[offset] = (byte)data;
     if (offset * 2 == 2)
     {
         if ((data & 0xff) == 8)
         {
             m92_sprite_list = (((0x100 - m92_spritecontrol[0]) & 0xff) * 4);
         }
         else
         {
             m92_sprite_list = 0x400;
         }
     }
     if (offset * 2 == 4)
     {
         Generic.buffer_spriteram16_w();
         m92_sprite_buffer_busy = 0;
         Timer.emu_timer timer = Timer.timer_alloc_common(spritebuffer_callback, "spritebuffer_callback", true);
         Timer.timer_adjust_periodic(timer, Attotime.attotime_mul(new Atime(0, (long)(1e18 / 26666000)), 0x400), Attotime.ATTOTIME_NEVER);
     }
 }
Esempio n. 13
0
        private static void cpu_inittimers()
        {
            switch (Machine.sBoard)
            {
            case "CPS-1(QSound)":
            case "CPS2":
                timedint_period = new Atime(0, (long)(1e18 / 250));
                timedint_timer  = Timer.timer_alloc_common(Generic.irq_1_0_line_hold, "irq_1_0_line_hold", false);
                Timer.timer_adjust_periodic(timedint_timer, timedint_period, timedint_period);
                break;

                /*case "Neo Geo":
                 *  interleave_boost_timer = Timer.timer_alloc_common(null_callback, "boost_callback", false);
                 *  interleave_boost_timer_end = Timer.timer_alloc_common(end_interleave_boost, "end_interleave_boost", false);
                 *  break;
                 * case "CPS1":
                 * case "Namco System 1":
                 * case "IGS011":
                 * case "PGM":
                 * case "M72":
                 * case "M92":
                 *  break;*/
            }
        }
Esempio n. 14
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.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;
        }
Esempio n. 15
0
 public static void machine_start_m92()
 {
     setvector_param = 0;
     setvector_callback();
     scanline_timer = Timer.timer_alloc_common(m92_scanline_interrupt, "m92_scanline_interrupt", false);
 }
Esempio n. 16
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;
        }
Esempio n. 17
0
 public static void m72_sound_irq_ack_w(int offset, byte data)
 {
     setvector_param = 4;
     Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true);
     Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER);
 }
Esempio n. 18
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);
        }
Esempio n. 19
0
 public static void machine_start_m72()
 {
     scanline_timer = Timer.timer_alloc_common(m72_scanline_interrupt, "m72_scanline_interrupt", false);
 }