Exemplo n.º 1
0
        public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
        {
            uint pi = 0, cpi = 0;
            for (int i = 0; i < Mame.Machine.drv.total_colors; i++)
            {
                /* red component */
                int bit0 = (color_prom[cpi] >> 0) & 0x01;
                int bit1 = (color_prom[cpi] >> 1) & 0x01;
                int bit2 = (color_prom[cpi] >> 2) & 0x01;
                int bit3 = (color_prom[cpi] >> 3) & 0x01;
                palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                /* green component */
                bit0 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 0) & 0x01;
                bit1 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 1) & 0x01;
                bit2 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 2) & 0x01;
                bit3 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 3) & 0x01;
                palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                /* blue component */
                bit0 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                bit1 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                bit2 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                bit3 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 3) & 0x01;
                palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                cpi++;
            }

            cpi += (2 * Mame.Machine.drv.total_colors);

            /* color_prom now points to the beginning of the character color codes */
            driver_kyugo.color_codes = new _BytePtr(color_prom, (int)cpi);	/* we'll need it later */
        }
Exemplo n.º 2
0
        static void digdug_vh_convert_color_prom(byte[] palette, ushort[] colortable, _BytePtr color_prom)
        {
            for (int i = 0; i < 32; i++)
            {
                int bit0 = (color_prom[31 - i] >> 0) & 0x01;
                int bit1 = (color_prom[31 - i] >> 1) & 0x01;
                int bit2 = (color_prom[31 - i] >> 2) & 0x01;
                palette[3 * i] =(byte)( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                bit0 = (color_prom[31 - i] >> 3) & 0x01;
                bit1 = (color_prom[31 - i] >> 4) & 0x01;
                bit2 = (color_prom[31 - i] >> 5) & 0x01;
                palette[3 * i + 1] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                bit0 = 0;
                bit1 = (color_prom[31 - i] >> 6) & 0x01;
                bit2 = (color_prom[31 - i] >> 7) & 0x01;
                palette[3 * i + 2] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
            }

            /* characters */
            for (int i = 0; i < 8; i++)
            {
                colortable[i * 2 + 0]=  0;
                colortable[i * 2 + 1]=(ushort)( 31 - i * 2);
            }
            /* sprites */
            for (int i = 0 * 4; i < 64 * 4; i++)
                colortable[8 * 2 + i]= (ushort)(31 - ((color_prom[i + 32] & 0x0f) + 0x10));
            /* playfield */
            for (int i = 64 * 4; i < 128 * 4; i++)
                colortable[8 * 2 + i]=  (ushort)(31 - (color_prom[i + 32] & 0x0f));
        }
Exemplo n.º 3
0
 static konamiic()
 {
     for (int i = 0; i < MAX_K007121; i++)
         K007121_ctrlram[i] = new byte[8];
     for (int i = 0; i < MAX_K051316; i++)
         K051316_offset[i] = new int[2];
     for (int i = 0; i < MAX_K051316; i++)
         K051316_ctrlram[i] = new _BytePtr(16);
 }
Exemplo n.º 4
0
           public static void c1942_vh_convert_color_prom(_BytePtr palette, _ShortPtr colortable, _BytePtr color_prom)
        {

            uint cpi = 0;
            int pi = 0;
            for (int i = 0; i < Mame.Machine.drv.total_colors; i++)
            {
                /* red component */
                int bit0 = (color_prom[cpi] >> 0) & 0x01;
                int bit1 = (color_prom[cpi] >> 1) & 0x01;
                int bit2 = (color_prom[cpi] >> 2) & 0x01;
                int bit3 = (color_prom[cpi] >> 3) & 0x01;
                palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                /* green component */
                bit0 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 0) & 0x01;
                bit1 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 1) & 0x01;
                bit2 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 2) & 0x01;
                bit3 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 3) & 0x01;
                palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                /* blue component */
                bit0 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                bit1 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                bit2 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                bit3 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 3) & 0x01;
                palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                cpi++;
            }

            cpi += 2 * Mame.Machine.drv.total_colors;
            /* color_prom now points to the beginning of the lookup table */


            /* characters use colors 128-143 */
            for (int i = 0; i < (Mame.Machine.gfx[0].total_colors * Mame.Machine.gfx[0].color_granularity); i++)
                COLOR(colortable, 0, i, (ushort)(((color_prom[cpi++]) & 0x0f) + 128));

            /* background tiles use colors 0-63 in four banks */
            for (int i = 0; i < (Mame.Machine.gfx[1].total_colors * Mame.Machine.gfx[1].color_granularity) / 4; i++)
            {
                COLOR(colortable, 1, i, (ushort)(((color_prom[cpi]) & 0x0f)));
                COLOR(colortable, 1, i + 32 * 8, (ushort)(((color_prom[cpi]) & 0x0f) + 16));
                COLOR(colortable, 1, i + 2 * 32 * 8, (ushort)(((color_prom[cpi]) & 0x0f) + 32));
                COLOR(colortable, 1, i + 3 * 32 * 8, (ushort)(((color_prom[cpi]) & 0x0f) + 48));
                cpi++;
            }

            /* sprites use colors 64-79 */
            for (int i = 0; i < (Mame.Machine.gfx[2].total_colors * Mame.Machine.gfx[2].color_granularity); i++)
                COLOR(colortable, 2, i, (ushort)(((color_prom[cpi++]) & 0x0f) + 64));
        }
Exemplo n.º 5
0
        static void draw_sprites(Mame.osd_bitmap bitmap)
        {
            /* sprite information is scattered through memory */
            /* and uses a portion of the text layer memory (outside the visible area) */
            _BytePtr spriteram_area1 = new _BytePtr(Generic.spriteram, 0x28);
            _BytePtr spriteram_area2 = new _BytePtr(Generic.spriteram_2, 0x28);
            _BytePtr spriteram_area3 = new _BytePtr(driver_kyugo.kyugo_videoram, 0x28);

            for (int n = 0; n < 12 * 2; n++)
            {
                int offs = 2 * (n % 12) + 64 * (n / 12);

                int sx = spriteram_area3[offs + 1] + 256 * (spriteram_area2[offs + 1] & 1);
                if (sx > 320) sx -= 512;

                int sy = 255 - spriteram_area1[offs];
                if (driver_kyugo.flipscreen != 0) sy = 240 - sy;

                int color = spriteram_area1[offs + 1] & 0x1f;

                for (int y = 0; y < 16; y++)
                {
                    int attr2 = spriteram_area2[offs + 128 * y];
                    int code = spriteram_area3[offs + 128 * y];
                    if ((attr2 & 0x01) != 0) code += 512;
                    if ((attr2 & 0x02) != 0) code += 256;
                    bool flipx = (attr2 & 0x08) != 0;
                    bool flipy = (attr2 & 0x04) != 0;
                    if (driver_kyugo.flipscreen != 0)
                    {
                        flipx = !flipx;
                        flipy = !flipy;
                    }

                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                        (uint)code,
                        (uint)color,
                        flipx, flipy,
                        sx, driver_kyugo.flipscreen != 0 ? sy - 16 * y : sy + 16 * y,
                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                }
            }
        }
Exemplo n.º 6
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {

                for (int i = 0; i < TOTAL_COLORS(1); i++)
                {
                    COLOR(colortable, 1, i, color_prom[0] & 0x0f);
                    color_prom.offset++;
                }
                for (int i = 0; i < TOTAL_COLORS(2); i++)
                {
                    COLOR(colortable, 2, i, (color_prom[0] & 0x0f) + 16);
                    color_prom.offset++;
                }
            }
Exemplo n.º 7
0
            public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh)
            {
                _BytePtr sr, ss;
                int offs, i;
                _BytePtr RAM = (Mame.memory_region(Mame.REGION_CPU1));


                if (Mame.palette_recalc() != null)
                {
                    Generic.SetDirtyBuffer(true);
                    //memset(dirtybuffer,1,videoram_size);
                }

                jackal_scrollram = new _BytePtr(RAM, 0x0020);
                Generic.colorram = new _BytePtr(RAM, 0x2000);
                Generic.videoram = new _BytePtr(RAM, 0x2400);

                Generic.spriteram_size[0] = 0x500;

                if ((jackal_videoctrl[0x03] & 0x08) != 0)
                {
                    sr = new _BytePtr(RAM, 0x03800);	// Sprite 2
                    ss = new _BytePtr(RAM, 0x13800);	// Additional Sprite 2
                }
                else
                {
                    sr = new _BytePtr(RAM, 0x03000);	// Sprite 1
                    ss = new _BytePtr(RAM, 0x13000);	// Additional Sprite 1
                }

                /* for every character in the Video RAM, check if it has been modified */
                /* since last time and update it accordingly. */
                for (offs = Generic.videoram_size[0] - 1; offs >= 0; offs--)
                {
                    if (Generic.dirtybuffer[offs])
                    {
                        int sx, sy;

                        Generic.dirtybuffer[offs] = false;

                        sx = offs % 32;
                        sy = offs / 32;

                        Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0],
                            (uint)(Generic.videoram[offs] + ((Generic.colorram[offs] & 0xc0) << 2) + ((Generic.colorram[offs] & 0x30) << 6)),
                            0,//colorram[offs] & 0x0f, there must be a PROM like in Contra
                            (Generic.colorram[offs] & 0x10) != 0, (Generic.colorram[offs] & 0x20) != 0,
                            8 * sx, 8 * sy,
                            null, Mame.TRANSPARENCY_NONE, 0);
                    }
                }


                /* copy the temporary bitmap to the screen */
                {
                    int h_scroll_num = 0, v_scroll_num = 0;
                    int[] h_scroll = new int[32], v_scroll = new int[32];

                    if ((jackal_videoctrl[2] & 0x08) != 0)
                    {
                        h_scroll_num = 32;
                        for (i = 0; i < 32; i++)
                            h_scroll[i] = -(jackal_scrollram[i]);
                    }

                    if ((jackal_videoctrl[2] & 0x04) != 0)
                    {
                        v_scroll_num = 32;
                        for (i = 0; i < 32; i++)
                            v_scroll[i] = -(jackal_scrollram[i]);
                    }

                    if (jackal_videoctrl[0] != 0)
                    {
                        v_scroll_num = 1;
                        v_scroll[0] = -(jackal_videoctrl[0]);
                    }

                    if (jackal_videoctrl[1] != 0)
                    {
                        h_scroll_num = 1;
                        h_scroll[0] = -(jackal_videoctrl[1]);
                    }

                    if ((h_scroll_num == 0) && (v_scroll_num == 0))
                        Mame.copybitmap(bitmap, Generic.tmpbitmap, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0);
                    else
                        Mame.copyscrollbitmap(bitmap, Generic.tmpbitmap, h_scroll_num, h_scroll, v_scroll_num, v_scroll, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0);
                }

                /* Draw the sprites. */
                {
                    byte sr1, sr2, sr3, sr4, sr5;
                    int spritenum, sx, sy, color;
                    byte sn1, sn2, sp;
                    bool flipx, flipy;

                    for (offs = 0; offs < 0x0F5; /* offs += 5 */ )
                    {
                        sn1 = ss[offs++]; // offs+0
                        sn2 = ss[offs++]; // offs+1
                        sy = ss[offs++]; // offs+2
                        sx = ss[offs++]; // offs+3
                        sp = ss[offs++]; // offs+4

                        flipx = (sp & 0x20) != 0;
                        flipy = (sp & 0x40) != 0;
                        color = ((sn2 & 0xf0) >> 4);

                        if ((sp & 0xC) == 0)
                        {
                            spritenum = sn1 + ((sn2 & 0x3) << 8);

                            if (sy > 0xF0) sy = sy - 256;
                            if ((sp & 0x01) != 0) sx = sx - 256;

                            if ((sp & 0x10) != 0)
                            {
                                if ((sx > -16) || (sx < 0xF0))
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[2],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx + 16 : sx, flipy ? sy + 16 : sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[2],
                                        (uint)spritenum + 1,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx : sx + 16, flipy ? sy + 16 : sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[2],
                                        (uint)spritenum + 2,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx + 16 : sx, flipy ? sy : sy + 16,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[2],
                                        (uint)spritenum + 3,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx : sx + 16, flipy ? sy : sy + 16,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                            }
                            else
                            {
                                if ((sx > -8) || (sx < 0xF0))
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[2],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                            }
                        }
                        else if ((sx < 0xF0) && (sp & 0x01) == 0)
                        {
                            spritenum = sn1 * 4 + ((sn2 & (8 + 4)) >> 2) + ((sn2 & (2 + 1)) << 10);

                            if ((sp & 0x0C) == 0x0C)
                            {
                                Mame.drawgfx(bitmap, Mame.Machine.gfx[4],
                                    (uint)spritenum,
                                    (uint)color,
                                    flipx, flipy,
                                    sx, sy,
                                    Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                            }
                            if ((sp & 0x0C) == 0x08)
                            {
                                Mame.drawgfx(bitmap, Mame.Machine.gfx[4],
                                    (uint)spritenum,
                                    (uint)color,
                                    flipx, flipy,
                                    sx, sy,
                                    Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                Mame.drawgfx(bitmap, Mame.Machine.gfx[4],
                                    (uint)spritenum - 2,
                                    (uint)color,
                                    flipx, flipy,
                                    sx, sy + 8,
                                    Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                            }
                            if ((sp & 0x0C) == 0x04)
                            {
                                Mame.drawgfx(bitmap, Mame.Machine.gfx[4],
                                    (uint)spritenum,
                                    (uint)color,
                                    flipx, flipy,
                                    sx, sy,
                                    Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                Mame.drawgfx(bitmap, Mame.Machine.gfx[4],
                                    (uint)spritenum + 1,
                                    (uint)color,
                                    flipx, flipy,
                                    sx + 8, sy,
                                    Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                            }
                        }
                    }

                    for (offs = 0; offs < 0x11D; offs += 5)
                    {
                        if ((sr[offs + 2] < 0xF0) && (sr[offs + 4] & 0x01) == 0)
                        {
                            sr1 = sr[offs];
                            sr2 = sr[offs + 1];
                            sr3 = sr[offs + 2];
                            sr4 = sr[offs + 3];
                            sr5 = sr[offs + 4];

                            sy = sr3;
                            sx = sr4;

                            flipx = (sr5 & 0x20) != 0;
                            flipy = (sr5 & 0x40) != 0;
                            color = ((sr2 & 0xf0) >> 4);

                            spritenum = sr1 + ((sr2 & 0x3) << 8);

                            if ((sr5 & 0xC) != 0)   /* half sized sprite */
                            {

                                spritenum = sr1 * 4 + ((sr2 & (8 + 4)) >> 2) + ((sr2 & (2 + 1)) << 10);

                                if ((sr5 & 0x0C) == 0x0C)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                       Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                                if ((sr5 & 0x0C) == 0x08)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum - 2,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy + 8,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                                if ((sr5 & 0x0C) == 0x04)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum + 1,
                                        (uint)color,
                                        flipx, flipy,
                                        sx + 8, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }

                            }
                            else
                            {
                                if ((sr5 & 0x10) != 0)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx + 16 : sx, flipy ? sy + 16 : sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum + 1,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx : sx + 16, flipy ? sy + 16 : sy,
                                       Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum + 2,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx + 16 : sx, flipy ? sy : sy + 16,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum + 3,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx : sx + 16, flipy ? sy : sy + 16,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                                else
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                            }
                        }
                    }

                    for (offs = 0x4F1; offs >= 0x11D; offs -= 5)
                    {
                        if ((sr[offs + 2] < 0xF0) && (sr[offs + 4] & 0x01) == 0)
                        {
                            sr1 = sr[offs];
                            sr2 = sr[offs + 1];
                            sr3 = sr[offs + 2];
                            sr4 = sr[offs + 3];
                            sr5 = sr[offs + 4];

                            sy = sr3;
                            sx = sr4;

                            flipx = (sr5 & 0x20) != 0;
                            flipy = (sr5 & 0x40) != 0;
                            color = ((sr2 & 0xf0) >> 4);

                            if ((sr[offs + 4] & 0xC) != 0)    /* half sized sprite */
                            {

                                spritenum = sr1 * 4 + ((sr2 & (8 + 4)) >> 2) + ((sr2 & (2 + 1)) << 10);

                                if ((sr5 & 0x0C) == 0x0C)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                                if ((sr5 & 0x0C) == 0x08)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                       Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum - 2,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy + 8,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                                if ((sr5 & 0x0C) == 0x04)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[3],
                                        (uint)spritenum + 1,
                                        (uint)color,
                                        flipx, flipy,
                                        sx + 8, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }

                            }
                            else
                            {
                                spritenum = sr1 + ((sr2 & 0x3) << 8);

                                if ((sr5 & 0x10) != 0)
                                {
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx + 16 : sx, flipy ? sy + 16 : sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)(spritenum + 1),
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx : sx + 16, flipy ? sy + 16 : sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)(spritenum + 2),
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx + 16 : sx, flipy ? sy : sy + 16,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)(spritenum + 3),
                                        (uint)color,
                                        flipx, flipy,
                                        flipx ? sx : sx + 16, flipy ? sy : sy + 16,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                                }
                                else
                                    Mame.drawgfx(bitmap, Mame.Machine.gfx[1],
                                        (uint)spritenum,
                                        (uint)color,
                                        flipx, flipy,
                                        sx, sy,
                                        Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0);
                            }
                        }
                    }
                }
            }
Exemplo n.º 8
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                uint pi = 0, cpi = 0;
                for (int i = 0; i < Mame.Machine.drv.total_colors; i++)
                {
                    /* red component */
                    int bit0 = (color_prom[cpi] >> 0) & 0x01;
                    int bit1 = (color_prom[cpi] >> 1) & 0x01;
                    int bit2 = (color_prom[cpi] >> 2) & 0x01;
                    int bit3 = (color_prom[cpi] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    /* green component */
                    bit0 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    /* blue component */
                    bit0 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    cpi++;
                }
            }
Exemplo n.º 9
0
 static void jackal_rambank_w(int offset, int data)
 {
     jackal_rambank = new _BytePtr(Mame.memory_region(Mame.REGION_CPU1), ((data & 0x10) << 12));
     jackal_spritebank = new _BytePtr(Mame.memory_region(Mame.REGION_CPU1), ((data & 0x08) << 13));
     Mame.cpu_setbank(1, new _BytePtr(Mame.memory_region(Mame.REGION_CPU1), ((data & 0x20) << 11) + 0x4000));
 }
Exemplo n.º 10
0
 public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
 {
     for (int i = 0; i < Mame.Machine.drv.total_colors; i++)
     {
         palette[i * 3 + 0] = 0;
         palette[i * 3 + 1] = 0;
         palette[i * 3 + 2] = 0;
     }
 }
Exemplo n.º 11
0
            public override void init_machine()
            {
                rom2a = Mame.memory_region(Mame.REGION_GFX4);
                rom2b = new _BytePtr(Mame.memory_region(Mame.REGION_GFX4), 0x1000);
                rom2c = new _BytePtr(Mame.memory_region(Mame.REGION_GFX4), 0x3000);

                nmi_timer = null;

                xevious_halt_w(0, 0);
            }
Exemplo n.º 12
0
 public override void driver_init()
 {
     input_type = 3;
     nvram_size = 0x80;
     nvram = new _BytePtr(Mame.memory_region(Mame.REGION_CPU1), 0xe000);	/* NVRAM */
     kabuki.spang_decode();
 }
Exemplo n.º 13
0
 public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
 {
     for (int i = 0; i < Mame.Machine.drv.color_table_len; i++)
         colortable[i] = (ushort)(i ^ 0x0f);
 }
Exemplo n.º 14
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                uint pi = 0, cpi = 0;
                for (int i = 0; i < 128; i++)
                {
                    /* red component */
                    int bit0 = (color_prom[cpi] >> 0) & 0x01;
                    int bit1 = (color_prom[cpi] >> 1) & 0x01;
                    int bit2 = (color_prom[cpi] >> 2) & 0x01;
                    int bit3 = (color_prom[cpi] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    /* green component */
                    bit0 = (color_prom[cpi + 256] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 256] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 256] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 256] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    /* blue component */
                    bit0 = (color_prom[cpi + 2 * 256] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 2 * 256] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 2 * 256] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 2 * 256] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    cpi++;
                }

                /* color 0x80 is used by sprites to mark transparency */
                palette[pi++] = 0;
                palette[pi++] = 0;
                palette[pi++] = 0;

                cpi += 128;  /* the bottom part of the PROM is unused */
                cpi += 2 * 256;
                /* color_prom now points to the beginning of the lookup table */

                /* background tiles */
                for (int i = 0; i < TOTAL_COLORS(1); i++)
                {
                    COLOR(colortable, 1, i, (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(1)] & 0x0f) << 4));

                    cpi++;
                }
                cpi += (uint)TOTAL_COLORS(1);

                /* sprites */
                for (int i = 0; i < TOTAL_COLORS(2); i++)
                {
                    int c = (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(2)] & 0x0f) << 4);

                    if ((c & 0x80) != 0) COLOR(colortable, 2, i, c & 0x7f);
                    else COLOR(colortable, 2, i, 0x80); /* transparent */

                    cpi++;
                }
                cpi += (uint)TOTAL_COLORS(2);

                /* foreground characters */
                for (int i = 0; i < TOTAL_COLORS(0); i++)
                {
                    if (i % 2 == 0) COLOR(colortable, 0, i, 0x80);  /* transparent */
                    else COLOR(colortable, 0, i, i / 2);
                }
            }
Exemplo n.º 15
0
 public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
 {
     AvgDvg.avg_init_palette_white(palette, colortable, color_prom);
 }
Exemplo n.º 16
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                //#define TOTAL_COLORS(gfxn) (Machine.gfx[gfxn].total_colors * Machine.gfx[gfxn].color_granularity)
                //#define COLOR(gfxn,offs) (colortable[Machine.drv.gfxdecodeinfo[gfxn].color_codes_start + offs])
                int cpi = 0;
                for (int i = 0; i < 32; i++)
                {
                    int bit0 = (color_prom[cpi + 31 - i] >> 0) & 0x01;
                    int bit1 = (color_prom[cpi + 31 - i] >> 1) & 0x01;
                    int bit2 = (color_prom[cpi + 31 - i] >> 2) & 0x01;
                    palette[3 * i] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    bit0 = (color_prom[cpi + 31 - i] >> 3) & 0x01;
                    bit1 = (color_prom[cpi + 31 - i] >> 4) & 0x01;
                    bit2 = (color_prom[cpi + 31 - i] >> 5) & 0x01;
                    palette[3 * i + 1] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    bit0 = 0;
                    bit1 = (color_prom[cpi + 31 - i] >> 6) & 0x01;
                    bit2 = (color_prom[cpi + 31 - i] >> 7) & 0x01;
                    palette[3 * i + 2] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                }

                cpi += 32;

                /* characters */
                for (int i = 0; i < Mame.Machine.gfx[0].total_colors * Mame.Machine.gfx[0].color_granularity; i++)
                {
                    colortable[Mame.Machine.drv.gfxdecodeinfo[0].color_codes_start + i]= (ushort)(15 - (color_prom[cpi++] & 0x0f));
                }
                cpi += 128;

                /* sprites */
                for (int i = 0; i < Mame.Machine.gfx[1].total_colors * Mame.Machine.gfx[1].color_granularity; i++)
                {
                    if (i % 4 == 0)
                        colortable[Mame.Machine.drv.gfxdecodeinfo[1].color_codes_start + i]= 0;
                    //COLOR(1,i) = 0;	/* preserve transparency */
                    else
                        //COLOR(1, i) = 15 - ((color_prom[cpi] & 0x0f)) + 0x10;
                        colortable[Mame.Machine.drv.gfxdecodeinfo[1].color_codes_start + i]= (ushort)(15 - (color_prom[cpi] & 0x0f) + 0x10);

                    cpi++;
                }

                cpi += 128;


                /* now the stars */
                for (int i = 32; i < 32 + 64; i++)
                {
                    int bits;
                    int[] map = { 0x00, 0x88, 0xcc, 0xff };

                    bits = ((i - 32) >> 0) & 0x03;
                    palette[3 * i] = (byte)map[bits];
                    bits = ((i - 32) >> 2) & 0x03;
                    palette[3 * i + 1] = (byte)map[bits];
                    bits = ((i - 32) >> 4) & 0x03;
                    palette[3 * i + 2] = (byte)map[bits];
                }
            }
Exemplo n.º 17
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                uint totcolors = Mame.Machine.drv.total_colors;
                uint pi = 0, cpi = 0;
                for (int i = 0; i < totcolors; i++)
                {
                    /* red component */
                    int bit0 = (color_prom[cpi + totcolors * 0] >> 0) & 0x01;
                    int bit1 = (color_prom[cpi + totcolors * 0] >> 1) & 0x01;
                    int bit2 = (color_prom[cpi + totcolors * 0] >> 2) & 0x01;
                    int bit3 = (color_prom[cpi + totcolors * 0] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    /* green component */
                    bit0 = (color_prom[cpi + totcolors * 1] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + totcolors * 1] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + totcolors * 1] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + totcolors * 1] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    /* blue component */
                    bit0 = (color_prom[cpi + totcolors * 2] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + totcolors * 2] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + totcolors * 2] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + totcolors * 2] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    cpi++;
                }

                /* text palette */
                int idx = 0;
                for (int i = 0; i < 64 * 4; i++)
                    colortable[idx++] = (ushort)i;

                cpi += 2 * totcolors;
                /* color_prom now points to the beginning of the lookup table */

                /* tiles lookup table */
                for (int i = 0; i < 128 * 4; i++)
                    colortable[idx++] = color_prom[cpi++];

                /* sprites lookup table */
                for (int i = 0; i < 64 * 8; i++)
                    colortable[idx++] = color_prom[cpi++];

            }
Exemplo n.º 18
0
        static int skykid_drgnbstr_common_vh_init()
        {
            background = Mame.tilemap_create(get_tile_info_bg, Mame.TILEMAP_OPAQUE, 8, 8, 64, 32);

            if (background != null)
            {
                _BytePtr RAM = Mame.memory_region(Mame.REGION_CPU1);

                spriteram = new _BytePtr(RAM, 0x4f80);
                Generic.spriteram_2 = new _BytePtr(RAM, 0x4f80 + 0x0800);
                Generic.spriteram_3 = new _BytePtr(RAM, 0x4f80 + 0x0800 + 0x0800);
                Generic.spriteram_size[0] = 0x80;

                return 0;
            }
            return 1;
        }
Exemplo n.º 19
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                uint cpi = 0;
                int pi = 0;
                for (int i = 0; i < Mame.Machine.drv.total_colors; i++)
                {
                    int bit0, bit1, bit2, bit3;

                    bit0 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    bit0 = (color_prom[cpi + 1 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 1 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 1 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 1 * Mame.Machine.drv.total_colors] >> 3) & 0x01;

                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    bit0 = (color_prom[cpi + 0 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 0 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 0 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 0 * Mame.Machine.drv.total_colors] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    cpi++;
                }

                cpi += 2 * Mame.Machine.drv.total_colors;
                /* color_prom now points to the beginning of the lookup table */

                /* foreground colors */
                for (int i = 0; i < TOTAL_COLORS(0); i++)
                {
                    if ((i % 2) != 0)
                        COLOR(colortable, 0, i, i / 2);
                    else
                        COLOR(colortable, 0, i, 0);
                }

                /* sprites */
                for (int i = 0; i < TOTAL_COLORS(2); i++)
                    COLOR(colortable, 2, i, (int)adj_data(color_prom[cpi++]));

                /* background bank 0 (gameplay) */
                /* background bank 1 (title screen) */
                for (int i = 0; i < TOTAL_COLORS(1); i++)
                    COLOR(colortable, 1, i, (int)adj_data(color_prom[(uint)(cpi + i)]));
            }
Exemplo n.º 20
0
 public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
 {
     //nothing
 }
Exemplo n.º 21
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                for (int i = 0; i < 32; i++)
                {
                    int bit0 = (color_prom[i] >> 0) & 0x01;
                    int bit1 = (color_prom[i] >> 1) & 0x01;
                    int bit2 = (color_prom[i] >> 2) & 0x01;
                    palette[3 * i] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    bit0 = (color_prom[i] >> 3) & 0x01;
                    bit1 = (color_prom[i] >> 4) & 0x01;
                    bit2 = (color_prom[i] >> 5) & 0x01;
                    palette[3 * i + 1] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    bit0 = 0;
                    bit1 = (color_prom[i] >> 6) & 0x01;
                    bit2 = (color_prom[i] >> 7) & 0x01;
                    palette[3 * i + 2] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                }

                /* use an otherwise unused pen for the river background */
                palette[3 * 4] = 0;
                palette[3 * 4 + 1] = 0;
                palette[3 * 4 + 2] = 0x47;

                /* normal */
                for (int i = 0; i < 4 * 8; i++)
                {
                    if ((i & 3) != 0)
                        colortable[i]= (ushort)i;
                    else colortable[i]= 0;
                }
                /* blue background (river) */
                for (int i = 4 * 8; i < 4 * 16; i++)
                {
                    if ((i & 3) != 0)
                        colortable[i]= (ushort)(i - 4 * 8);
                    else colortable[i]= 4;
                }
            }
Exemplo n.º 22
0
            public override void init_machine()
            {
                kaneko16_bgram = new _BytePtr(kaneko16_fgram, 0x1000);
                kaneko16_spritetype = 1;	// "standard" sprites

                Array.Clear(gtmr_mcu_com.buffer, gtmr_mcu_com.offset, 8);
            }
Exemplo n.º 23
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                int width, height, i;

                AvgDvg.avg_init_palette_white(palette, colortable, color_prom);

                llander_lit_panel = null;
                width = Mame.Machine.scrbitmap.width;
                height = (int)(0.16 * width);

                if ((llander_panel = Mame.artwork_load_size("llander.png", 24, 230, width, height)) != null)
                {
                    if ((llander_lit_panel = Mame.artwork_load_size("llander1.png", 24 + llander_panel.num_pens_used, 230 - llander_panel.num_pens_used, width, height)) == null)
                    {
                        Mame.artwork_free(ref llander_panel);
                        llander_panel = null;
                        return;
                    }
                }
                else
                    return;

                for (i = 0; i < 16; i++)
                    palette[3 * (i + 8)] = palette[3 * (i + 8) + 1] = palette[3 * (i + 8) + 2] = (byte)((255 * i) / 15);

                for (i = 0; i < 3 * llander_panel.num_pens_used; i++)                
                    palette[3 * llander_panel.start_pen + i] = llander_panel.orig_palette[i];
                //memcpy(palette + 3 * llander_panel.start_pen, llander_panel.orig_palette,3 * llander_panel.num_pens_used);
                for (i = 0; i < 3 * llander_lit_panel.num_pens_used; i++)                
                    palette[3 * llander_lit_panel.start_pen + i] = llander_lit_panel.orig_palette[i];
                
                //memcpy(palette + 3 * llander_lit_panel.start_pen, llander_lit_panel.orig_palette,3 * llander_lit_panel.num_pens_used);
            }
Exemplo n.º 24
0
 public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
 {
     Pengo.pacman_vh_convert_color_prom(palette, colortable, color_prom);
 }
Exemplo n.º 25
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                //#define TOTAL_COLORS(gfxn) (Machine.gfx[gfxn].total_colors * Machine.gfx[gfxn].color_granularity)
                //	#define COLOR(gfxn,offs) (colortable[Machine.drv.gfxdecodeinfo[gfxn].color_codes_start + offs])
                uint pi = 0, cpi = 0;
                for (int i = 0; i < Mame.Machine.drv.total_colors; i++)
                {
                    int bit0, bit1, bit2, bit3;

                    /* red component */
                    bit0 = (color_prom[cpi] >> 0) & 0x01;
                    bit1 = (color_prom[cpi] >> 1) & 0x01;
                    bit2 = (color_prom[cpi] >> 2) & 0x01;
                    bit3 = (color_prom[cpi] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    /* green component */
                    bit0 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + Mame.Machine.drv.total_colors] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
                    /* blue component */
                    bit0 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 0) & 0x01;
                    bit1 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 1) & 0x01;
                    bit2 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 2) & 0x01;
                    bit3 = (color_prom[cpi + 2 * Mame.Machine.drv.total_colors] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);

                    cpi++;
                }

                cpi += 2 * Mame.Machine.drv.total_colors;
                /* color_prom now points to the beginning of the lookup table */

                /* characters */
                for (int i = 0; i < Mame.Machine.gfx[0].total_colors * Mame.Machine.gfx[0].color_granularity; i++)
                COLOR(colortable,0,i, (color_prom[cpi++] & 0x0f));
                /* sprites */
                for (int i = 0; i < Mame.Machine.gfx[2].total_colors * Mame.Machine.gfx[2].color_granularity; i++)
                COLOR(colortable,2,i, (color_prom[cpi++] & 0x0f) + 0x10);
            }
Exemplo n.º 26
0
            public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
            {
                uint pi = 0, cpi = 0;
                for (int i = 0; i < 256; i++)
                {
                    /* red component */
                    int bit0 = 0;
                    int bit1 = (color_prom[cpi + 256] >> 2) & 0x01;
                    int bit2 = (color_prom[cpi + 256] >> 3) & 0x01;
                    palette[pi++] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    /* green component */
                    bit0 = (color_prom[cpi] >> 3) & 0x01;
                    bit1 = (color_prom[cpi + 256] >> 0) & 0x01;
                    bit2 = (color_prom[cpi + 256] >> 1) & 0x01;
                    palette[pi++] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    /* blue component */
                    bit0 = (color_prom[cpi] >> 0) & 0x01;
                    bit1 = (color_prom[cpi] >> 1) & 0x01;
                    bit2 = (color_prom[cpi] >> 2) & 0x01;
                    palette[pi++] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);

                    COLOR(colortable, 0, i, i);
                    cpi++;
                }

                cpi += 256;
                /* color_prom now points to the beginning of the sprite palette */

                /* sprite palette */
                for (int i = 0; i < 16; i++)
                {
                    /* red component */
                    int bit0 = 0;
                    int bit1 = (color_prom[cpi] >> 6) & 0x01;
                    int bit2 = (color_prom[cpi] >> 7) & 0x01;
                    palette[pi++] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    /* green component */
                    bit0 = (color_prom[cpi] >> 3) & 0x01;
                    bit1 = (color_prom[cpi] >> 4) & 0x01;
                    bit2 = (color_prom[cpi] >> 5) & 0x01;
                    palette[pi++] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
                    /* blue component */
                    bit0 = (color_prom[cpi] >> 0) & 0x01;
                    bit1 = (color_prom[cpi] >> 1) & 0x01;
                    bit2 = (color_prom[cpi] >> 2) & 0x01;
                    palette[pi++] = (byte)(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);

                    cpi++;
                }

                cpi += 16;
                /* color_prom now points to the beginning of the sprite lookup table */


                /* sprite lookup table */
                for (int i = 0; i < TOTAL_COLORS(1); i++)
                {
                    COLOR(colortable, 1, i, 256 + (~color_prom[cpi] & 0x0f));
                    cpi++;
                }
            }
Exemplo n.º 27
0
            public override void init_machine()
            {
                int oldcpu = Mame.cpu_getactivecpu(), i;

                /* Point all of our bankhandlers to the error handlers */
                for (i = 0; i < 8; i++)
                {
                    namcos1_banks[0, i].bank_handler_r = unknown_r;
                    namcos1_banks[0, i].bank_handler_w = unknown_w;
                    namcos1_banks[0, i].bank_offset = 0;
                    namcos1_banks[1, i].bank_handler_r = unknown_r;
                    namcos1_banks[1, i].bank_handler_w = unknown_w;
                    namcos1_banks[1, i].bank_offset = 0;
                }

                /* Prepare code for Cpu 0 */
                Mame.cpu_setactivecpu(0);
                namcos1_bankswitch_w(0x0e00, 0x03); /* bank7 = 0x3ff(PRG7) */
                namcos1_bankswitch_w(0x0e01, 0xff);

                /* Prepare code for Cpu 1 */
                Mame.cpu_setactivecpu(1);
                namcos1_bankswitch_w(0x0e00, 0x03);
                namcos1_bankswitch_w(0x0e01, 0xff);

                namcos1_cpu1_banklatch = 0x03ff;

                /* reset starting Cpu */
                Mame.cpu_setactivecpu(oldcpu);

                /* Point mcu & sound shared RAM to destination */
                {
                    _BytePtr RAM = new _BytePtr(Namco.namco_wavedata, 0x1000); /* Ram 1, bank 1, offset 0x1000 */
                    Mame.cpu_setbank(2, RAM);
                    Mame.cpu_setbank(3, RAM);
                }

                /* In case we had some cpu's suspended, resume them now */
                Mame.cpu_set_reset_line(1, Mame.ASSERT_LINE);
                Mame.cpu_set_reset_line(2, Mame.ASSERT_LINE);
                Mame.cpu_set_reset_line(3, Mame.ASSERT_LINE);

                namcos1_reset = 0;
                /* mcu patch data clear */
                mcu_patch_data = 0;

                berabohm_input_counter = 4;	/* for berabohm pressure sensitive buttons */
            }
Exemplo n.º 28
0
 public static void init_palette(byte[] game_palette, ushort[] game_colortable, _BytePtr color_prom)
 {
     Buffer.BlockCopy(invaders_palette, 0, game_palette, 0, invaders_palette.Length);
     //memcpy(game_palette,invaders_palette,sizeof(invaders_palette));
 }
Exemplo n.º 29
0
            static void namcos1_displaycontrol_w(int offset, int data)
            {
                _BytePtr disp_reg = new _BytePtr(namcos1_controlram, 0xff0);
                int newflip;

                switch (offset)
                {
                    case 0x02: /* ?? */
                        break;
                    case 0x04: /* sprite offset X */
                    case 0x05:
                        sprite_fixed_sx = disp_reg[4] * 256 + disp_reg[5] - 151;
                        if (sprite_fixed_sx > 480) sprite_fixed_sx -= 512;
                        if (sprite_fixed_sx < -32) sprite_fixed_sx += 512;
                        break;
                    case 0x06: /* flip screen */
                        newflip = (disp_reg[6] & 1) ^ 0x01;
                        if (flipscreen != newflip)
                        {
                            namcos1_set_flipscreen(newflip);
                        }
                        break;
                    case 0x07: /* sprite offset Y */
                        sprite_fixed_sy = 239 - disp_reg[7];
                        break;
                    case 0x0a: /* ?? */
                        /* 00 : blazer,dspirit,quester */
                        /* 40 : others */
                        break;
                    case 0x0e: /* ?? */
                    /* 00 : blazer,dangseed,dspirit,pacmania,quester */
                    /* 06 : others */
                    case 0x0f: /* ?? */
                        /* 00 : dangseed,dspirit,pacmania */
                        /* f1 : blazer */
                        /* f8 : galaga88,quester */
                        /* e7 : others */
                        break;
                }
#if false
	{
		char buf[80];
Exemplo n.º 30
0
 public override void vh_init_palette(byte[] palette, ushort[] colortable, _BytePtr color_prom)
 {
     driver_invaders.init_palette(palette, colortable, color_prom);
 }