mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
- Some more machine->pen lookup removal
- Changed Beathead driver to use partial updates instead of caching scanline level information
This commit is contained in:
parent
b7c4a537cd
commit
2e595362d8
@ -141,7 +141,7 @@ static TIMER_CALLBACK( scanline_callback )
|
||||
int scanline = param;
|
||||
|
||||
/* update the video */
|
||||
beathead_scanline_update(scanline);
|
||||
video_screen_update_now(0);
|
||||
|
||||
/* on scanline zero, clear any halt condition */
|
||||
if (scanline == 0)
|
||||
|
@ -12,8 +12,6 @@ extern UINT32 * beathead_palette_select;
|
||||
VIDEO_START( beathead );
|
||||
VIDEO_UPDATE( beathead );
|
||||
|
||||
void beathead_scanline_update(int scanline);
|
||||
|
||||
WRITE32_HANDLER( beathead_vram_transparent_w );
|
||||
WRITE32_HANDLER( beathead_vram_bulk_w );
|
||||
WRITE32_HANDLER( beathead_vram_latch_w );
|
||||
|
@ -76,7 +76,7 @@ VIDEO_UPDATE( aliens )
|
||||
K052109_tilemap_update();
|
||||
|
||||
fillbitmap(priority_bitmap,0,cliprect);
|
||||
fillbitmap(bitmap,machine->pens[layer_colorbase[1] * 16],cliprect);
|
||||
fillbitmap(bitmap,layer_colorbase[1] * 16,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,1);
|
||||
tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,2);
|
||||
tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,4);
|
||||
|
@ -133,7 +133,7 @@ VIDEO_UPDATE( alpha68k_II )
|
||||
last_bank=bank_base;
|
||||
tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
fillbitmap(bitmap,machine->pens[2047],cliprect);
|
||||
fillbitmap(bitmap,2047,cliprect);
|
||||
//AT
|
||||
draw_sprites(machine, bitmap,cliprect,0,0x07c0,0x0800);
|
||||
draw_sprites(machine, bitmap,cliprect,1,0x0000,0x0800);
|
||||
@ -272,7 +272,7 @@ VIDEO_UPDATE( alpha68k_V )
|
||||
last_bank=bank_base;
|
||||
tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
fillbitmap(bitmap,machine->pens[4095],cliprect);
|
||||
fillbitmap(bitmap,4095,cliprect);
|
||||
|
||||
/* This appears to be correct priority */
|
||||
if (alpha68k_microcontroller_id == 0x8814) /* Sky Adventure */
|
||||
@ -308,7 +308,7 @@ VIDEO_UPDATE( alpha68k_V_sb )
|
||||
last_bank=bank_base;
|
||||
tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
fillbitmap(bitmap,machine->pens[4095],cliprect);
|
||||
fillbitmap(bitmap,4095,cliprect);
|
||||
|
||||
/* This appears to be correct priority */
|
||||
draw_sprites_V(machine,bitmap,cliprect,0,0x07c0,0x0800,0x4000,0x8000,0x3fff);
|
||||
@ -480,7 +480,7 @@ static void kyros_draw_sprites(running_machine *machine, mame_bitmap *bitmap, co
|
||||
VIDEO_UPDATE( kyros )
|
||||
{
|
||||
colortable_entry_set_value(machine->colortable, 0x100, *videoram16 & 0xff);
|
||||
fillbitmap(bitmap, machine->pens[0x100], cliprect); //AT
|
||||
fillbitmap(bitmap, 0x100, cliprect); //AT
|
||||
|
||||
kyros_draw_sprites(machine, bitmap,cliprect,2,0x0800);
|
||||
kyros_draw_sprites(machine, bitmap,cliprect,3,0x0c00);
|
||||
@ -538,7 +538,7 @@ static void sstingry_draw_sprites(running_machine *machine, mame_bitmap *bitmap,
|
||||
VIDEO_UPDATE( sstingry )
|
||||
{
|
||||
colortable_entry_set_value(machine->colortable, 0x100, *videoram16 & 0xff);
|
||||
fillbitmap(bitmap, machine->pens[0x100], cliprect); //AT
|
||||
fillbitmap(bitmap, 0x100, cliprect); //AT
|
||||
|
||||
sstingry_draw_sprites(machine, bitmap,cliprect,2,0x0800);
|
||||
sstingry_draw_sprites(machine, bitmap,cliprect,3,0x0c00);
|
||||
|
@ -95,7 +95,7 @@ VIDEO_UPDATE( ambush )
|
||||
int offs;
|
||||
|
||||
|
||||
fillbitmap(bitmap,machine->pens[0],cliprect);
|
||||
fillbitmap(bitmap,0,cliprect);
|
||||
|
||||
|
||||
/* Draw the background priority characters */
|
||||
|
@ -117,7 +117,7 @@ VIDEO_UPDATE( asterix )
|
||||
sortlayers(layer, layerpri);
|
||||
|
||||
fillbitmap(priority_bitmap, 0, cliprect);
|
||||
fillbitmap(bitmap, machine->pens[0], cliprect);
|
||||
fillbitmap(bitmap, 0, cliprect);
|
||||
|
||||
K056832_tilemap_draw(machine, bitmap, cliprect, layer[0], 0, 1);
|
||||
K056832_tilemap_draw(machine, bitmap, cliprect, layer[1], 0, 2);
|
||||
|
@ -56,7 +56,7 @@ VIDEO_UPDATE( asuka )
|
||||
fillbitmap(priority_bitmap,0,cliprect);
|
||||
|
||||
/* Ensure screen blanked even when bottom layer not drawn due to disable bit */
|
||||
fillbitmap(bitmap, machine->pens[0], cliprect);
|
||||
fillbitmap(bitmap, 0, cliprect);
|
||||
|
||||
TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,1);
|
||||
TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,layer[1],0,2);
|
||||
@ -81,7 +81,7 @@ VIDEO_UPDATE( bonzeadv )
|
||||
fillbitmap(priority_bitmap,0,cliprect);
|
||||
|
||||
/* Ensure screen blanked even when bottom layer not drawn due to disable bit */
|
||||
fillbitmap(bitmap, machine->pens[0], cliprect);
|
||||
fillbitmap(bitmap, 0, cliprect);
|
||||
|
||||
TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,1);
|
||||
TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,layer[1],0,2);
|
||||
|
@ -228,13 +228,9 @@ static void draw_fg_bitmap(running_machine *machine, mame_bitmap *bitmap )
|
||||
if (data)
|
||||
{
|
||||
if (flip_screen)
|
||||
{
|
||||
*BITMAP_ADDR16(bitmap, 255 - y, 255 - x) = machine->pens[data];
|
||||
}
|
||||
*BITMAP_ADDR16(bitmap, 255 - y, 255 - x) = data;
|
||||
else
|
||||
{
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[data];
|
||||
}
|
||||
*BITMAP_ADDR16(bitmap, y, x) = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ static void screenrefresh(running_machine *machine, mame_bitmap *bitmap,const re
|
||||
if (sb_enable) draw_sprites(machine,bitmap,clip,0);
|
||||
|
||||
/* Render background over sprites */
|
||||
copyscrollbitmap_trans(bitmap,front_bitmap,1,&scrollx,1,&scrolly,clip,machine->pens[256]);
|
||||
copyscrollbitmap_trans(bitmap,front_bitmap,1,&scrollx,1,&scrolly,clip,256);
|
||||
|
||||
/* Render high priority sprites, if enabled */
|
||||
if (sb_enable) draw_sprites(machine,bitmap,clip,1);
|
||||
|
@ -148,7 +148,7 @@ INLINE const UINT8 *get_source_ptr(running_machine *machine, UINT32 sprite, int
|
||||
|
||||
static void bbusters_draw_block(running_machine *machine, mame_bitmap *dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block)
|
||||
{
|
||||
const pen_t *pal = &machine->pens[machine->gfx[bank]->color_base + machine->gfx[bank]->color_granularity * (color % machine->gfx[bank]->total_colors)];
|
||||
pen_t pen_base = machine->gfx[bank]->color_base + machine->gfx[bank]->color_granularity * (color % machine->gfx[bank]->total_colors);
|
||||
UINT32 xinc=(scale_line_count * 0x10000 ) / size;
|
||||
UINT8 pixel;
|
||||
int x_index;
|
||||
@ -176,7 +176,7 @@ static void bbusters_draw_block(running_machine *machine, mame_bitmap *dest,int
|
||||
|
||||
pixel=*srcptr++;
|
||||
if (x+(x_index>>16)>=0 && x+(x_index>>16)<256 && pixel!=15)
|
||||
destline[x+(x_index>>16)]=pal[pixel];
|
||||
destline[x+(x_index>>16)]= pen_base + pixel;
|
||||
|
||||
if (flipx)
|
||||
x_index-=xinc;
|
||||
|
@ -27,10 +27,6 @@ UINT32 * beathead_palette_select;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static offs_t scanline_offset[240];
|
||||
static UINT8 scanline_palette[240];
|
||||
|
||||
static int current_scanline;
|
||||
static UINT32 finescroll;
|
||||
static offs_t vram_latch_offset;
|
||||
|
||||
@ -115,10 +111,10 @@ WRITE32_HANDLER( beathead_finescroll_w )
|
||||
UINT32 oldword = finescroll;
|
||||
UINT32 newword = COMBINE_DATA(&finescroll);
|
||||
|
||||
/* if VBLANK is going off on a non-zero scanline, suspend time */
|
||||
if ((oldword & 8) && !(newword & 8) && current_scanline != 0)
|
||||
/* if VBLANK is going off on a scanline other than the last, suspend time */
|
||||
if ((oldword & 8) && !(newword & 8) && video_screen_get_vpos(0) != 261)
|
||||
{
|
||||
logerror("Suspending time! (scanline = %d)\n", current_scanline);
|
||||
logerror("Suspending time! (scanline = %d)\n", video_screen_get_vpos(0));
|
||||
cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
@ -178,29 +174,6 @@ WRITE32_HANDLER( beathead_hsync_ram_w )
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Scanline updater
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void beathead_scanline_update(int scanline)
|
||||
{
|
||||
/* remember the current scanline */
|
||||
current_scanline = scanline;
|
||||
|
||||
/* grab the latch for the previous scanline */
|
||||
scanline--;
|
||||
if (scanline < 0 || scanline >= 240)
|
||||
return;
|
||||
|
||||
/* cache the offset and palette for this scanline */
|
||||
scanline_offset[scanline] = (finescroll & 8) ? ~0 : vram_latch_offset + (finescroll & 3);
|
||||
scanline_palette[scanline] = *beathead_palette_select & 0x7f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Main screen refresher
|
||||
@ -214,20 +187,27 @@ VIDEO_UPDATE( beathead )
|
||||
/* generate the final screen */
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
offs_t src = scanline_offset[y] + cliprect->min_x;
|
||||
UINT8 scanline[336];
|
||||
pen_t pen_base = (*beathead_palette_select & 0x7f) * 256;
|
||||
UINT16 scanline[336];
|
||||
|
||||
/* unswizzle the scanline first */
|
||||
if (scanline_offset[y] != ~0)
|
||||
{
|
||||
/* blanking */
|
||||
if (finescroll & 8)
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
scanline[x] = ((UINT8 *)videoram32)[BYTE4_XOR_LE(src++)];
|
||||
}
|
||||
scanline[x] = pen_base;
|
||||
|
||||
/* non-blanking */
|
||||
else
|
||||
memset(scanline, 0, sizeof(scanline));
|
||||
{
|
||||
offs_t scanline_offset = vram_latch_offset + (finescroll & 3);
|
||||
offs_t src = scanline_offset + cliprect->min_x;
|
||||
|
||||
/* unswizzle the scanline first */
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
scanline[x] = pen_base | ((UINT8 *)videoram32)[BYTE4_XOR_LE(src++)];
|
||||
}
|
||||
|
||||
/* then draw it */
|
||||
draw_scanline8(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], &machine->pens[scanline_palette[y] * 256], -1);
|
||||
draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL, -1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static void draw_background(mame_bitmap *bitmap, const rectangle *cliprect)
|
||||
int stop3 = background_latches[11] >> 4;
|
||||
UINT8 *mixer = &background_mixer[(background_latches[12] << 4) & 0xf0];
|
||||
UINT16 scanline[VISIBLE_X_MAX];
|
||||
int pen_base = 0x200 + ((background_latches[12] >> 4) << 4);
|
||||
pen_t pen_base = 0x200 + ((background_latches[12] >> 4) << 4);
|
||||
|
||||
/* the cocktail flip flag controls whether we count up or down in X */
|
||||
if (!exerion_cocktail_flip)
|
||||
|
@ -119,7 +119,7 @@ VIDEO_UPDATE( magmax )
|
||||
UINT32 rom15F_addr = (((scroll_v + v) & 0x07)<<2) + (map_v_scr_100<<5);
|
||||
UINT32 map_v_scr_1fe_6 =((scroll_v + v) & 0x1fe)<<6;
|
||||
|
||||
int pen_base = 0x110 + 0x20 + (map_v_scr_100>>1);
|
||||
pen_t pen_base = 0x110 + 0x20 + (map_v_scr_100>>1);
|
||||
|
||||
for (h = 0; h < 0x100; h++)
|
||||
{
|
||||
|
@ -364,7 +364,7 @@ static void draw_road(mame_bitmap *bitmap)
|
||||
int xoffs, yoffs, xscroll, roadpal;
|
||||
UINT16 scanline[256 + 8];
|
||||
UINT16 *dest = scanline;
|
||||
int pen_base;
|
||||
pen_t pen_base;
|
||||
|
||||
/* first add the vertical position modifier and the vertical scroll */
|
||||
yoffs = ((polepos_vertical_position_modifier[y] + road16_vscroll) >> 3) & 0x1ff;
|
||||
|
@ -178,7 +178,7 @@ static void draw_background(mame_bitmap *bitmap)
|
||||
{
|
||||
int offs, x, y;
|
||||
UINT16 scanline[288];
|
||||
int pen_base = 0x300 + 0x10*palettebank;
|
||||
pen_t pen_base = 0x300 + 0x10*palettebank;
|
||||
|
||||
// copy the background image from RAM (0x190200-0x19FDFF) to bitmap
|
||||
if (bitmapflip)
|
||||
|
Loading…
Reference in New Issue
Block a user