Purged remaining globals from video/generic.c and audio/generic.c

This commit is contained in:
Aaron Giles 2009-11-28 08:31:22 +00:00
parent 6bfe172c78
commit 5e643c1251
20 changed files with 117 additions and 116 deletions

View File

@ -15,12 +15,15 @@
/*************************************************************************** /***************************************************************************
GLOBAL VARIABLES TYPE DEFINITIONS
***************************************************************************/ ***************************************************************************/
static UINT16 latch_clear_value = 0x00; struct _generic_audio_private
static UINT16 latched_value[4]; {
static UINT8 latch_read[4]; UINT16 latch_clear_value;
UINT16 latched_value[4];
UINT8 latch_read[4];
};
@ -35,14 +38,13 @@ static UINT8 latch_read[4];
int generic_sound_init(running_machine *machine) int generic_sound_init(running_machine *machine)
{ {
/* reset latches */ generic_audio_private *state;
latch_clear_value = 0;
memset(latched_value, 0, sizeof(latched_value)); state = machine->generic_audio_data = auto_alloc_clear(machine, generic_audio_private);
memset(latch_read, 0, sizeof(latch_read));
/* register globals with the save state system */ /* register globals with the save state system */
state_save_register_global_array(machine, latched_value); state_save_register_global_array(machine, state->latched_value);
state_save_register_global_array(machine, latch_read); state_save_register_global_array(machine, state->latch_read);
return 0; return 0;
} }
@ -66,16 +68,17 @@ int generic_sound_init(running_machine *machine)
static TIMER_CALLBACK( latch_callback ) static TIMER_CALLBACK( latch_callback )
{ {
generic_audio_private *state = machine->generic_audio_data;
UINT16 value = param >> 8; UINT16 value = param >> 8;
int which = param & 0xff; int which = param & 0xff;
/* if the latch hasn't been read and the value is changed, log a warning */ /* if the latch hasn't been read and the value is changed, log a warning */
if (!latch_read[which] && latched_value[which] != value) if (!state->latch_read[which] && state->latched_value[which] != value)
logerror("Warning: sound latch %d written before being read. Previous: %02x, new: %02x\n", which, latched_value[which], value); logerror("Warning: sound latch %d written before being read. Previous: %02x, new: %02x\n", which, state->latched_value[which], value);
/* store the new value and mark it not read */ /* store the new value and mark it not read */
latched_value[which] = value; state->latched_value[which] = value;
latch_read[which] = 0; state->latch_read[which] = 0;
} }
@ -93,10 +96,11 @@ INLINE void latch_w(const address_space *space, int which, UINT16 value)
latch_r - handle a read from a given latch latch_r - handle a read from a given latch
-------------------------------------------------*/ -------------------------------------------------*/
INLINE UINT16 latch_r(int which) INLINE UINT16 latch_r(const address_space *space, int which)
{ {
latch_read[which] = 1; generic_audio_private *state = space->machine->generic_audio_data;
return latched_value[which]; state->latch_read[which] = 1;
return state->latched_value[which];
} }
@ -104,9 +108,10 @@ INLINE UINT16 latch_r(int which)
latch_clear - clear a given latch latch_clear - clear a given latch
-------------------------------------------------*/ -------------------------------------------------*/
INLINE void latch_clear(int which) INLINE void latch_clear(const address_space *space, int which)
{ {
latched_value[which] = latch_clear_value; generic_audio_private *state = space->machine->generic_audio_data;
state->latched_value[which] = state->latch_clear_value;
} }
@ -130,14 +135,14 @@ WRITE16_HANDLER( soundlatch4_word_w ) { latch_w(space, 3, data); }
reading from sound latches reading from sound latches
-------------------------------------------------*/ -------------------------------------------------*/
READ8_HANDLER( soundlatch_r ) { return latch_r(0); } READ8_HANDLER( soundlatch_r ) { return latch_r(space, 0); }
READ16_HANDLER( soundlatch_word_r ) { return latch_r(0); } READ16_HANDLER( soundlatch_word_r ) { return latch_r(space, 0); }
READ8_HANDLER( soundlatch2_r ) { return latch_r(1); } READ8_HANDLER( soundlatch2_r ) { return latch_r(space, 1); }
READ16_HANDLER( soundlatch2_word_r ) { return latch_r(1); } READ16_HANDLER( soundlatch2_word_r ) { return latch_r(space, 1); }
READ8_HANDLER( soundlatch3_r ) { return latch_r(2); } READ8_HANDLER( soundlatch3_r ) { return latch_r(space, 2); }
READ16_HANDLER( soundlatch3_word_r ) { return latch_r(2); } READ16_HANDLER( soundlatch3_word_r ) { return latch_r(space, 2); }
READ8_HANDLER( soundlatch4_r ) { return latch_r(3); } READ8_HANDLER( soundlatch4_r ) { return latch_r(space, 3); }
READ16_HANDLER( soundlatch4_word_r ) { return latch_r(3); } READ16_HANDLER( soundlatch4_word_r ) { return latch_r(space, 3); }
/*------------------------------------------------- /*-------------------------------------------------
@ -145,10 +150,10 @@ READ16_HANDLER( soundlatch4_word_r ) { return latch_r(3); }
for clearing sound latches for clearing sound latches
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_HANDLER( soundlatch_clear_w ) { latch_clear(0); } WRITE8_HANDLER( soundlatch_clear_w ) { latch_clear(space, 0); }
WRITE8_HANDLER( soundlatch2_clear_w ) { latch_clear(1); } WRITE8_HANDLER( soundlatch2_clear_w ) { latch_clear(space, 1); }
WRITE8_HANDLER( soundlatch3_clear_w ) { latch_clear(2); } WRITE8_HANDLER( soundlatch3_clear_w ) { latch_clear(space, 2); }
WRITE8_HANDLER( soundlatch4_clear_w ) { latch_clear(3); } WRITE8_HANDLER( soundlatch4_clear_w ) { latch_clear(space, 3); }
/*------------------------------------------------- /*-------------------------------------------------
@ -158,6 +163,7 @@ WRITE8_HANDLER( soundlatch4_clear_w ) { latch_clear(3); }
void soundlatch_setclearedvalue(running_machine *machine, int value) void soundlatch_setclearedvalue(running_machine *machine, int value)
{ {
generic_audio_private *state = machine->generic_audio_data;
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!"); assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
latch_clear_value = value; state->latch_clear_value = value;
} }

View File

@ -141,6 +141,8 @@ typedef struct _cheat_private cheat_private;
typedef struct _debugcpu_private debugcpu_private; typedef struct _debugcpu_private debugcpu_private;
typedef struct _debugvw_private debugvw_private; typedef struct _debugvw_private debugvw_private;
typedef struct _generic_machine_private generic_machine_private; typedef struct _generic_machine_private generic_machine_private;
typedef struct _generic_video_private generic_video_private;
typedef struct _generic_audio_private generic_audio_private;
/* structure to hold a pointer/size pair for generic pointers */ /* structure to hold a pointer/size pair for generic pointers */
@ -176,6 +178,7 @@ struct _generic_pointers
generic_ptr buffered_spriteram3;/* tertiary buffered spriteram */ generic_ptr buffered_spriteram3;/* tertiary buffered spriteram */
generic_ptr paletteram; /* palette RAM */ generic_ptr paletteram; /* palette RAM */
generic_ptr paletteram2; /* secondary palette RAM */ generic_ptr paletteram2; /* secondary palette RAM */
bitmap_t * tmpbitmap; /* temporary bitmap */
}; };
@ -233,6 +236,8 @@ struct _running_machine
debugcpu_private * debugcpu_data; /* internal data from debugcpu.c */ debugcpu_private * debugcpu_data; /* internal data from debugcpu.c */
debugvw_private * debugvw_data; /* internal data from debugvw.c */ debugvw_private * debugvw_data; /* internal data from debugvw.c */
generic_machine_private *generic_machine_data; /* internal data from machine/generic.c */ generic_machine_private *generic_machine_data; /* internal data from machine/generic.c */
generic_video_private * generic_video_data; /* internal data from video/generic.c */
generic_audio_private * generic_audio_data; /* internal data from audio/generic.c */
#ifdef MESS #ifdef MESS
images_private * images_data; /* internal data from image.c */ images_private * images_data; /* internal data from image.c */
ui_mess_private * ui_mess_data; /* internal data from uimess.c */ ui_mess_private * ui_mess_data; /* internal data from uimess.c */

View File

@ -15,11 +15,14 @@
/*************************************************************************** /***************************************************************************
GLOBAL VARIABLES TYPE DEFINITIONS
***************************************************************************/ ***************************************************************************/
bitmap_t *tmpbitmap; struct _generic_video_private
static int flip_screen_x, flip_screen_y; {
int flip_screen_x;
int flip_screen_y;
};
@ -227,25 +230,12 @@ INLINE void set_color_888(running_machine *machine, pen_t color, int rshift, int
void generic_video_init(running_machine *machine) void generic_video_init(running_machine *machine)
{ {
machine->generic.paletteram.v = NULL; generic_video_private *state;
machine->generic.paletteram2.v = NULL;
machine->generic.videoram.v = NULL; state = machine->generic_video_data = auto_alloc_clear(machine, generic_video_private);
machine->generic.videoram_size = 0;
machine->generic.colorram.v = NULL; state_save_register_item(machine, "video", NULL, 0, state->flip_screen_x);
machine->generic.colorram_size = 0; state_save_register_item(machine, "video", NULL, 0, state->flip_screen_y);
machine->generic.spriteram.v = NULL;
machine->generic.spriteram_size = 0;
machine->generic.spriteram2.v = NULL;
machine->generic.spriteram2_size = 0;
machine->generic.spriteram3.v = NULL;
machine->generic.spriteram3_size = 0;
machine->generic.buffered_spriteram.v = NULL;
machine->generic.buffered_spriteram2.v = NULL;
machine->generic.buffered_spriteram3.v = NULL;
tmpbitmap = NULL;
flip_screen_x = flip_screen_y = 0;
state_save_register_item(machine, "video", NULL, 0, flip_screen_x);
state_save_register_item(machine, "video", NULL, 0, flip_screen_y);
} }
@ -262,10 +252,10 @@ void generic_video_init(running_machine *machine)
VIDEO_START( generic_bitmapped ) VIDEO_START( generic_bitmapped )
{ {
/* allocate the temporary bitmap */ /* allocate the temporary bitmap */
tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); machine->generic.tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
/* ensure the contents of the bitmap are saved */ /* ensure the contents of the bitmap are saved */
state_save_register_bitmap(machine, "video", NULL, 0, "tmpbitmap", tmpbitmap); state_save_register_bitmap(machine, "video", NULL, 0, "tmpbitmap", machine->generic.tmpbitmap);
} }
@ -276,7 +266,7 @@ VIDEO_START( generic_bitmapped )
VIDEO_UPDATE( generic_bitmapped ) VIDEO_UPDATE( generic_bitmapped )
{ {
copybitmap(bitmap, tmpbitmap, 0, 0, 0, 0, cliprect); copybitmap(bitmap, screen->machine->generic.tmpbitmap, 0, 0, 0, 0, cliprect);
return 0; return 0;
} }
@ -399,14 +389,15 @@ void buffer_spriteram_2(running_machine *machine, UINT8 *ptr, int length)
static void updateflip(running_machine *machine) static void updateflip(running_machine *machine)
{ {
generic_video_private *state = machine->generic_video_data;
int width = video_screen_get_width(machine->primary_screen); int width = video_screen_get_width(machine->primary_screen);
int height = video_screen_get_height(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen);
attoseconds_t period = video_screen_get_frame_period(machine->primary_screen).attoseconds; attoseconds_t period = video_screen_get_frame_period(machine->primary_screen).attoseconds;
rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); rectangle visarea = *video_screen_get_visible_area(machine->primary_screen);
tilemap_set_flip_all(machine,(TILEMAP_FLIPX & flip_screen_x) | (TILEMAP_FLIPY & flip_screen_y)); tilemap_set_flip_all(machine,(TILEMAP_FLIPX & state->flip_screen_x) | (TILEMAP_FLIPY & state->flip_screen_y));
if (flip_screen_x) if (state->flip_screen_x)
{ {
int temp; int temp;
@ -414,7 +405,7 @@ static void updateflip(running_machine *machine)
visarea.min_x = width - visarea.max_x - 1; visarea.min_x = width - visarea.max_x - 1;
visarea.max_x = temp; visarea.max_x = temp;
} }
if (flip_screen_y) if (state->flip_screen_y)
{ {
int temp; int temp;
@ -450,7 +441,8 @@ void flip_screen_set_no_update(running_machine *machine, int on)
* where writing to flip_screen_x to * where writing to flip_screen_x to
* bypass update_flip * bypass update_flip
*/ */
flip_screen_x = on; generic_video_private *state = machine->generic_video_data;
state->flip_screen_x = on;
} }
@ -460,10 +452,11 @@ void flip_screen_set_no_update(running_machine *machine, int on)
void flip_screen_x_set(running_machine *machine, int on) void flip_screen_x_set(running_machine *machine, int on)
{ {
generic_video_private *state = machine->generic_video_data;
if (on) on = ~0; if (on) on = ~0;
if (flip_screen_x != on) if (state->flip_screen_x != on)
{ {
flip_screen_x = on; state->flip_screen_x = on;
updateflip(machine); updateflip(machine);
} }
} }
@ -475,10 +468,11 @@ void flip_screen_x_set(running_machine *machine, int on)
void flip_screen_y_set(running_machine *machine, int on) void flip_screen_y_set(running_machine *machine, int on)
{ {
generic_video_private *state = machine->generic_video_data;
if (on) on = ~0; if (on) on = ~0;
if (flip_screen_y != on) if (state->flip_screen_y != on)
{ {
flip_screen_y = on; state->flip_screen_y = on;
updateflip(machine); updateflip(machine);
} }
} }
@ -490,7 +484,8 @@ void flip_screen_y_set(running_machine *machine, int on)
int flip_screen_get(running_machine *machine) int flip_screen_get(running_machine *machine)
{ {
return flip_screen_x; generic_video_private *state = machine->generic_video_data;
return state->flip_screen_x;
} }
@ -500,7 +495,8 @@ int flip_screen_get(running_machine *machine)
int flip_screen_x_get(running_machine *machine) int flip_screen_x_get(running_machine *machine)
{ {
return flip_screen_x; generic_video_private *state = machine->generic_video_data;
return state->flip_screen_x;
} }
@ -510,7 +506,8 @@ int flip_screen_x_get(running_machine *machine)
int flip_screen_y_get(running_machine *machine) int flip_screen_y_get(running_machine *machine)
{ {
return flip_screen_y; generic_video_private *state = machine->generic_video_data;
return state->flip_screen_y;
} }

View File

@ -18,14 +18,6 @@
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
extern bitmap_t *tmpbitmap;
/*************************************************************************** /***************************************************************************
COMMON GRAPHICS LAYOUTS COMMON GRAPHICS LAYOUTS
***************************************************************************/ ***************************************************************************/

View File

@ -83,7 +83,7 @@ static INTERRUPT_GEN( big10_interrupt )
static VIDEO_START( big10 ) static VIDEO_START( big10 )
{ {
VIDEO_START_CALL(generic_bitmapped); VIDEO_START_CALL(generic_bitmapped);
v9938_init (machine, 0, machine->primary_screen, tmpbitmap, MODEL_V9938, VDP_MEM, big10_vdp_interrupt); v9938_init (machine, 0, machine->primary_screen, machine->generic.tmpbitmap, MODEL_V9938, VDP_MEM, big10_vdp_interrupt);
v9938_reset(0); v9938_reset(0);
} }

View File

@ -102,7 +102,7 @@ static WRITE8_HANDLER( gei_bitmap_w )
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
*BITMAP_ADDR16(tmpbitmap, sy, sx+i) = color[8-i-1]; *BITMAP_ADDR16(space->machine->generic.tmpbitmap, sy, sx+i) = color[8-i-1];
} }
static PALETTE_INIT(gei) static PALETTE_INIT(gei)

View File

@ -213,7 +213,7 @@ static INTERRUPT_GEN( sangho_interrupt )
static VIDEO_START( sangho ) static VIDEO_START( sangho )
{ {
VIDEO_START_CALL(generic_bitmapped); VIDEO_START_CALL(generic_bitmapped);
v9938_init (machine, 0, machine->primary_screen, tmpbitmap, MODEL_V9938, 0x20000, msx_vdp_interrupt); v9938_init (machine, 0, machine->primary_screen, machine->generic.tmpbitmap, MODEL_V9938, 0x20000, msx_vdp_interrupt);
} }
static MACHINE_DRIVER_START(pzlestar) static MACHINE_DRIVER_START(pzlestar)

View File

@ -61,7 +61,7 @@ static TILE_GET_INFO( get_sb_tile_info )
SET_TILE_INFO(0, tileno, 0, 0); SET_TILE_INFO(0, tileno, 0, 0);
} }
static void plot_pixel_sbw(int x, int y, int col, int flip) static void plot_pixel_sbw(bitmap_t *tmpbitmap, int x, int y, int col, int flip)
{ {
if (flip) if (flip)
{ {
@ -88,7 +88,7 @@ static WRITE8_HANDLER( sbw_videoram_w )
for(i = 0; i < 8; i++) for(i = 0; i < 8; i++)
{ {
plot_pixel_sbw(x++, y, color_prom_address | ( ((v1&1)*0x20) | ((v2&1)*0x40) ), flip); plot_pixel_sbw(space->machine->generic.tmpbitmap, x++, y, color_prom_address | ( ((v1&1)*0x20) | ((v2&1)*0x40) ), flip);
v1 >>= 1; v1 >>= 1;
v2 >>= 1; v2 >>= 1;
} }
@ -98,13 +98,13 @@ static VIDEO_UPDATE(sbowling)
{ {
bitmap_fill(bitmap,cliprect,0x18); bitmap_fill(bitmap,cliprect,0x18);
tilemap_draw(bitmap,cliprect,sb_tilemap,0,0); tilemap_draw(bitmap,cliprect,sb_tilemap,0,0);
copybitmap_trans(bitmap,tmpbitmap,0,0,0,0,cliprect, color_prom_address); copybitmap_trans(bitmap,screen->machine->generic.tmpbitmap,0,0,0,0,cliprect, color_prom_address);
return 0; return 0;
} }
static VIDEO_START(sbowling) static VIDEO_START(sbowling)
{ {
tmpbitmap = auto_bitmap_alloc(machine,32*8,32*8,video_screen_get_format(machine->primary_screen)); machine->generic.tmpbitmap = auto_bitmap_alloc(machine,32*8,32*8,video_screen_get_format(machine->primary_screen));
sb_tilemap = tilemap_create(machine, get_sb_tile_info, tilemap_scan_rows, 8, 8, 32, 32); sb_tilemap = tilemap_create(machine, get_sb_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
} }

View File

@ -419,7 +419,7 @@ static void sfkick_vdp_interrupt(running_machine *machine, int i)
static VIDEO_START( sfkick ) static VIDEO_START( sfkick )
{ {
VIDEO_START_CALL(generic_bitmapped); VIDEO_START_CALL(generic_bitmapped);
v9938_init (machine, 0, machine->primary_screen, tmpbitmap, MODEL_V9938, 0x80000, sfkick_vdp_interrupt); v9938_init (machine, 0, machine->primary_screen, machine->generic.tmpbitmap, MODEL_V9938, 0x80000, sfkick_vdp_interrupt);
v9938_reset(0); v9938_reset(0);
} }

View File

@ -322,7 +322,7 @@ static const msm5205_interface msm_interface =
static VIDEO_START( sothello ) static VIDEO_START( sothello )
{ {
VIDEO_START_CALL(generic_bitmapped); VIDEO_START_CALL(generic_bitmapped);
v9938_init (machine, 0, machine->primary_screen, tmpbitmap, MODEL_V9938, VDP_MEM, sothello_vdp_interrupt); v9938_init (machine, 0, machine->primary_screen, machine->generic.tmpbitmap, MODEL_V9938, VDP_MEM, sothello_vdp_interrupt);
v9938_reset(0); v9938_reset(0);
} }

View File

@ -1043,7 +1043,7 @@ static void antic_linerefresh(running_machine *machine)
dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16; dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16; dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
draw_scanline8(tmpbitmap, 12, y, MIN(tmpbitmap->width - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL); draw_scanline8(machine->generic.tmpbitmap, 12, y, MIN(machine->generic.tmpbitmap->width - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL);
} }
static int cycle(running_machine *machine) static int cycle(running_machine *machine)

View File

@ -8,7 +8,7 @@ static bitmap_t *sprites_bitmap;
VIDEO_START( galpanic ) VIDEO_START( galpanic )
{ {
tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); machine->generic.tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
pandora_start(machine,0,0, -16); pandora_start(machine,0,0, -16);
@ -37,7 +37,7 @@ WRITE16_HANDLER( galpanic_bgvideoram_w )
sy = offset / 256; sy = offset / 256;
sx = offset % 256; sx = offset % 256;
*BITMAP_ADDR16(tmpbitmap, sy, sx) = 1024 + (data >> 1); *BITMAP_ADDR16(space->machine->generic.tmpbitmap, sy, sx) = 1024 + (data >> 1);
} }
WRITE16_HANDLER( galpanic_paletteram_w ) WRITE16_HANDLER( galpanic_paletteram_w )
@ -104,7 +104,7 @@ static void draw_fgbitmap(bitmap_t *bitmap, const rectangle *cliprect)
VIDEO_UPDATE( galpanic ) VIDEO_UPDATE( galpanic )
{ {
/* copy the temporary bitmap to the screen */ /* copy the temporary bitmap to the screen */
copybitmap(bitmap,tmpbitmap,0,0,0,0,cliprect); copybitmap(bitmap,screen->machine->generic.tmpbitmap,0,0,0,0,cliprect);
draw_fgbitmap(bitmap, cliprect); draw_fgbitmap(bitmap, cliprect);
@ -116,7 +116,7 @@ VIDEO_UPDATE( galpanic )
VIDEO_UPDATE( comad ) VIDEO_UPDATE( comad )
{ {
/* copy the temporary bitmap to the screen */ /* copy the temporary bitmap to the screen */
copybitmap(bitmap,tmpbitmap,0,0,0,0,cliprect); copybitmap(bitmap,screen->machine->generic.tmpbitmap,0,0,0,0,cliprect);
draw_fgbitmap(bitmap,cliprect); draw_fgbitmap(bitmap,cliprect);

View File

@ -78,7 +78,7 @@ VIDEO_START( magmax )
prom_tab = auto_alloc_array(machine, UINT32, 256); prom_tab = auto_alloc_array(machine, UINT32, 256);
/* Allocate temporary bitmap */ /* Allocate temporary bitmap */
tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); machine->generic.tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
for (i=0; i<256; i++) for (i=0; i<256; i++)
{ {
@ -108,7 +108,7 @@ VIDEO_UPDATE( magmax )
UINT32 scroll_v = (*magmax_scroll_y) & 0xff; UINT32 scroll_v = (*magmax_scroll_y) & 0xff;
/*clear background-over-sprites bitmap*/ /*clear background-over-sprites bitmap*/
bitmap_fill(tmpbitmap, NULL, 0); bitmap_fill(screen->machine->generic.tmpbitmap, NULL, 0);
for (v = 2*8; v < 30*8; v++) /*only for visible area*/ for (v = 2*8; v < 30*8; v++) /*only for visible area*/
{ {
@ -159,7 +159,7 @@ VIDEO_UPDATE( magmax )
/*priority: background over sprites*/ /*priority: background over sprites*/
if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c)) if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c))
*BITMAP_ADDR16(tmpbitmap, v, h) = line_data[h]; *BITMAP_ADDR16(screen->machine->generic.tmpbitmap, v, h) = line_data[h];
} }
if (flipscreen) if (flipscreen)
@ -214,7 +214,7 @@ VIDEO_UPDATE( magmax )
} }
if (!(*magmax_vreg & 0x40)) /* background disable */ if (!(*magmax_vreg & 0x40)) /* background disable */
copybitmap_trans(bitmap, tmpbitmap, flipscreen,flipscreen,0,0, cliprect, 0); copybitmap_trans(bitmap, screen->machine->generic.tmpbitmap, flipscreen,flipscreen,0,0, cliprect, 0);
/* draw the foreground characters */ /* draw the foreground characters */
for (offs = 32*32-1; offs >= 0; offs -= 1) for (offs = 32*32-1; offs >= 0; offs -= 1)

View File

@ -22,6 +22,7 @@ size_t matmania_videoram2_size;
UINT8 *matmania_videoram3,*matmania_colorram3; UINT8 *matmania_videoram3,*matmania_colorram3;
size_t matmania_videoram3_size; size_t matmania_videoram3_size;
UINT8 *matmania_scroll; UINT8 *matmania_scroll;
static bitmap_t *tmpbitmap;
static bitmap_t *tmpbitmap2; static bitmap_t *tmpbitmap2;
UINT8 *matmania_pageselect; UINT8 *matmania_pageselect;

View File

@ -109,7 +109,7 @@ WRITE8_HANDLER( megazone_flipscreen_w )
VIDEO_START( megazone ) VIDEO_START( megazone )
{ {
tmpbitmap = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen)); machine->generic.tmpbitmap = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen));
} }
@ -135,7 +135,7 @@ VIDEO_UPDATE( megazone )
flipy = !flipy; flipy = !flipy;
} }
drawgfx_opaque(tmpbitmap,0,screen->machine->gfx[1], drawgfx_opaque(screen->machine->generic.tmpbitmap,0,screen->machine->gfx[1],
((int)screen->machine->generic.videoram.u8[offs]) + ((screen->machine->generic.colorram.u8[offs] & (1<<7) ? 256 : 0) ), ((int)screen->machine->generic.videoram.u8[offs]) + ((screen->machine->generic.colorram.u8[offs] & (1<<7) ? 256 : 0) ),
(screen->machine->generic.colorram.u8[offs] & 0x0f) + 0x10, (screen->machine->generic.colorram.u8[offs] & 0x0f) + 0x10,
flipx,flipy, flipx,flipy,
@ -159,7 +159,7 @@ VIDEO_UPDATE( megazone )
} }
copyscrollbitmap(bitmap,tmpbitmap,1,&scrollx,1,&scrolly,cliprect); copyscrollbitmap(bitmap,screen->machine->generic.tmpbitmap,1,&scrollx,1,&scrolly,cliprect);
} }

View File

@ -50,7 +50,7 @@ WRITE8_HANDLER( mnchmobl_flipscreen_w )
VIDEO_START( mnchmobl ) VIDEO_START( mnchmobl )
{ {
tmpbitmap = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); machine->generic.tmpbitmap = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen));
} }
static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
@ -100,7 +100,7 @@ static void draw_background(running_machine *machine, bitmap_t *bitmap, const re
{ {
for( col=0; col<4; col++ ) for( col=0; col<4; col++ )
{ {
drawgfx_opaque( tmpbitmap,0, gfx, drawgfx_opaque( machine->generic.tmpbitmap,0, gfx,
rom[col+tile_number*4+row*0x400], rom[col+tile_number*4+row*0x400],
mnchmobl_palette_bank, mnchmobl_palette_bank,
0,0, /* flip */ 0,0, /* flip */
@ -113,7 +113,7 @@ static void draw_background(running_machine *machine, bitmap_t *bitmap, const re
int scrollx = -(mnchmobl_vreg[6]*2+(mnchmobl_vreg[7]>>7))-64-128-16; int scrollx = -(mnchmobl_vreg[6]*2+(mnchmobl_vreg[7]>>7))-64-128-16;
int scrolly = 0; int scrolly = 0;
copyscrollbitmap(bitmap,tmpbitmap, 1,&scrollx,1,&scrolly, cliprect); copyscrollbitmap(bitmap,machine->generic.tmpbitmap, 1,&scrollx,1,&scrolly, cliprect);
} }
} }

View File

@ -110,7 +110,7 @@ VIDEO_START( naughtyb )
palreg = bankreg = 0; palreg = bankreg = 0;
/* Naughty Boy has a virtual screen twice as large as the visible screen */ /* Naughty Boy has a virtual screen twice as large as the visible screen */
tmpbitmap = auto_bitmap_alloc(machine,68*8,28*8,video_screen_get_format(machine->primary_screen)); machine->generic.tmpbitmap = auto_bitmap_alloc(machine,68*8,28*8,video_screen_get_format(machine->primary_screen));
} }
@ -223,13 +223,13 @@ VIDEO_UPDATE( naughtyb )
} }
} }
drawgfx_opaque(tmpbitmap,0,screen->machine->gfx[0], drawgfx_opaque(screen->machine->generic.tmpbitmap,0,screen->machine->gfx[0],
naughtyb_videoram2[offs] + 256 * bankreg, naughtyb_videoram2[offs] + 256 * bankreg,
(naughtyb_videoram2[offs] >> 5) + 8 * palreg, (naughtyb_videoram2[offs] >> 5) + 8 * palreg,
naughtyb_cocktail,naughtyb_cocktail, naughtyb_cocktail,naughtyb_cocktail,
8*sx,8*sy); 8*sx,8*sy);
drawgfx_transpen(tmpbitmap,0,screen->machine->gfx[1], drawgfx_transpen(screen->machine->generic.tmpbitmap,0,screen->machine->gfx[1],
screen->machine->generic.videoram.u8[offs] + 256*bankreg, screen->machine->generic.videoram.u8[offs] + 256*bankreg,
(screen->machine->generic.videoram.u8[offs] >> 5) + 8 * palreg, (screen->machine->generic.videoram.u8[offs] >> 5) + 8 * palreg,
naughtyb_cocktail,naughtyb_cocktail, naughtyb_cocktail,naughtyb_cocktail,
@ -240,11 +240,11 @@ VIDEO_UPDATE( naughtyb )
{ {
int scrollx; int scrollx;
copybitmap(bitmap,tmpbitmap,0,0,-66*8,0,&leftvisiblearea); copybitmap(bitmap,screen->machine->generic.tmpbitmap,0,0,-66*8,0,&leftvisiblearea);
copybitmap(bitmap,tmpbitmap,0,0,-30*8,0,&rightvisiblearea); copybitmap(bitmap,screen->machine->generic.tmpbitmap,0,0,-30*8,0,&rightvisiblearea);
scrollx = ( naughtyb_cocktail ) ? *naughtyb_scrollreg - 239 : -*naughtyb_scrollreg + 16; scrollx = ( naughtyb_cocktail ) ? *naughtyb_scrollreg - 239 : -*naughtyb_scrollreg + 16;
copyscrollbitmap(bitmap,tmpbitmap,1,&scrollx,0,0,&scrollvisiblearea); copyscrollbitmap(bitmap,screen->machine->generic.tmpbitmap,1,&scrollx,0,0,&scrollvisiblearea);
} }
return 0; return 0;
} }

View File

@ -141,8 +141,8 @@ WRITE8_HANDLER( paradise_pixmap_w )
x = (offset & 0x7f) << 1; x = (offset & 0x7f) << 1;
y = (offset >> 7); y = (offset >> 7);
*BITMAP_ADDR16(tmpbitmap, y, x+0) = 0x80f - (data >> 4); *BITMAP_ADDR16(space->machine->generic.tmpbitmap, y, x+0) = 0x80f - (data >> 4);
*BITMAP_ADDR16(tmpbitmap, y, x+1) = 0x80f - (data & 0x0f); *BITMAP_ADDR16(space->machine->generic.tmpbitmap, y, x+1) = 0x80f - (data & 0x0f);
} }
@ -159,7 +159,7 @@ VIDEO_START( paradise )
tilemap_2 = tilemap_create( machine, get_tile_info_2, tilemap_scan_rows, 8,8, 0x20,0x20 ); tilemap_2 = tilemap_create( machine, get_tile_info_2, tilemap_scan_rows, 8,8, 0x20,0x20 );
/* pixmap */ /* pixmap */
tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); machine->generic.tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
tilemap_set_transparent_pen(tilemap_0,0x0f); tilemap_set_transparent_pen(tilemap_0,0x0f);
tilemap_set_transparent_pen(tilemap_1,0xff); tilemap_set_transparent_pen(tilemap_1,0xff);
@ -251,7 +251,7 @@ if (input_code_pressed(screen->machine, KEYCODE_Z))
if (layers_ctrl&1) tilemap_draw(bitmap,cliprect, tilemap_0, 0,0); if (layers_ctrl&1) tilemap_draw(bitmap,cliprect, tilemap_0, 0,0);
if (layers_ctrl&2) tilemap_draw(bitmap,cliprect, tilemap_1, 0,0); if (layers_ctrl&2) tilemap_draw(bitmap,cliprect, tilemap_1, 0,0);
if (layers_ctrl&4) copybitmap_trans(bitmap,tmpbitmap,flip_screen_get(screen->machine),flip_screen_get(screen->machine),0,0,cliprect, 0x80f); if (layers_ctrl&4) copybitmap_trans(bitmap,screen->machine->generic.tmpbitmap,flip_screen_get(screen->machine),flip_screen_get(screen->machine),0,0,cliprect, 0x80f);
if (paradise_priority & 2) if (paradise_priority & 2)
{ {

View File

@ -72,7 +72,7 @@ VIDEO_START( tunhunt )
We keep track of dirty lines and cache the expanded bitmap. We keep track of dirty lines and cache the expanded bitmap.
With max RLE expansion, bitmap size is 256x64. With max RLE expansion, bitmap size is 256x64.
*/ */
tmpbitmap = auto_bitmap_alloc(machine, 256, 64, video_screen_get_format(machine->primary_screen)); machine->generic.tmpbitmap = auto_bitmap_alloc(machine, 256, 64, video_screen_get_format(machine->primary_screen));
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32); fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32);
@ -196,7 +196,7 @@ static void set_pens(running_machine *machine)
} }
} }
static void draw_motion_object(bitmap_t *bitmap, const rectangle *cliprect, UINT8 *spriteram) static void draw_motion_object(bitmap_t *bitmap, bitmap_t *tmpbitmap, const rectangle *cliprect, UINT8 *spriteram)
{ {
/* /*
* VSTRLO 0x1202 * VSTRLO 0x1202
@ -371,7 +371,7 @@ VIDEO_UPDATE( tunhunt )
draw_box(bitmap, cliprect); draw_box(bitmap, cliprect);
draw_motion_object(bitmap, cliprect, screen->machine->generic.spriteram.u8); draw_motion_object(bitmap, screen->machine->generic.tmpbitmap, cliprect, screen->machine->generic.spriteram.u8);
draw_shell(screen->machine, bitmap, cliprect, draw_shell(screen->machine, bitmap, cliprect,
tunhunt_ram[SHL0PC], /* picture code */ tunhunt_ram[SHL0PC], /* picture code */

View File

@ -140,7 +140,7 @@ VIDEO_START( tinvader )
24, 24, 32, 32); 24, 24, 32, 32);
spritebitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); spritebitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); machine->generic.tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
gfx_element_set_source(machine->gfx[1], zac2650_s2636_0_ram); gfx_element_set_source(machine->gfx[1], zac2650_s2636_0_ram);
gfx_element_set_source(machine->gfx[2], zac2650_s2636_0_ram); gfx_element_set_source(machine->gfx[2], zac2650_s2636_0_ram);
@ -165,7 +165,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap)
CollisionBackground = 0; /* Read from 0x1e80 bit 7 */ CollisionBackground = 0; /* Read from 0x1e80 bit 7 */
// for collision detection checking // for collision detection checking
copybitmap(tmpbitmap,bitmap,0,0,0,0,visarea); copybitmap(machine->generic.tmpbitmap,bitmap,0,0,0,0,visarea);
for(offs=0;offs<0x50;offs+=0x10) for(offs=0;offs<0x50;offs+=0x10)
{ {
@ -196,7 +196,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap)
continue; continue;
} }
if (*BITMAP_ADDR16(bitmap, y, x) != *BITMAP_ADDR16(tmpbitmap, y, x)) if (*BITMAP_ADDR16(bitmap, y, x) != *BITMAP_ADDR16(machine->generic.tmpbitmap, y, x))
{ {
CollisionBackground = 0x80; CollisionBackground = 0x80;
break; break;