* Fix issues related to flip_screen being a define

* add "int flip_screen_get(void)"
* define flip_screen flip_screen_get()
* clean up drivers with collisions 
* mark write accesses to flip_screen_x with FIXME
This commit is contained in:
Couriersud 2008-02-25 21:15:59 +00:00
parent df962f9ec4
commit 8e96884cc6
24 changed files with 80 additions and 47 deletions

View File

@ -526,6 +526,16 @@ void flip_screen_y_set(int on)
}
/*-------------------------------------------------
flip_screen_get - get global flip
-------------------------------------------------*/
int flip_screen_get(void)
{
return flip_screen_x;
}
/***************************************************************************
COMMON PALETTE INITIALIZATION
***************************************************************************/

View File

@ -63,6 +63,7 @@ extern UINT8 *paletteram_2; /* use when palette RAM is split in two parts */
extern UINT16 *paletteram16_2;
extern mame_bitmap *tmpbitmap;
extern int flip_screen_x, flip_screen_y;
@ -124,7 +125,9 @@ void buffer_spriteram_2(UINT8 *ptr, int length);
void flip_screen_set(int on);
void flip_screen_x_set(int on);
void flip_screen_y_set(int on);
#define flip_screen flip_screen_x
int flip_screen_get(void);
#define flip_screen flip_screen_get()

View File

@ -323,7 +323,8 @@ static void delayed_sound_2(int data)
if (n8080_hardware == 1)
{
flip_screen = data & 0x20;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = data & 0x20;
}
if (n8080_hardware == 3)
{

View File

@ -231,7 +231,7 @@ static ADDRESS_MAP_START( 20pacgal_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x88, 0x88) AM_WRITE(rom_bank_select_w)
AM_RANGE(0x89, 0x89) AM_WRITE(_20pacgal_dac_w)
AM_RANGE(0x8a, 0x8a) AM_WRITE(MWA8_NOP) /* stars: bits 3-4 = active set; bit 5 = enable */
AM_RANGE(0x8b, 0x8b) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(_20pacgal_state, flip_screen)
AM_RANGE(0x8b, 0x8b) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(_20pacgal_state, flip)
AM_RANGE(0x8f, 0x8f) AM_WRITE(_20pacgal_coin_counter_w)
ADDRESS_MAP_END

View File

@ -93,8 +93,9 @@ static VIDEO_START(backfire)
static void draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect, UINT32 *backfire_spriteram32, int region)
{
int offs;
flip_screen = 1;
//FIXME: flip_screen_x should not be written!
flip_screen_x = 1;
for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
{
@ -144,7 +145,7 @@ static void draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rect
inc = 1;
}
if (flip_screen)
if (flip_screen_x)
{
y=240-y;
x=304-x;

View File

@ -64,7 +64,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec
{
int offs;
flip_screen = 1;
//FIXME: flip_screen_x should not be written!
flip_screen_x = 1;
for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
{
@ -110,7 +111,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec
inc = 1;
}
if (flip_screen)
if (flip_screen_x)
{
y=240-y;
x=304-x;

View File

@ -80,7 +80,8 @@ static WRITE8_HANDLER( laserbat_input_mux_w )
{
laserbat_input_mux = (data & 0x30) >> 4;
flip_screen = data & 0x08;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = data & 0x08;
coin_counter_w(0,data & 1);

View File

@ -201,7 +201,9 @@ static WRITE8_HANDLER( pacland_flipscreen_w )
{
int bit = !BIT(offset,11);
/* can't use flip_screen_set() because the visible area is asymmetrical */
flip_screen = bit;
/* FIXME: flip_screen_x should not be written. The above issue needs */
/* some other solution */
flip_screen_x = bit;
tilemap_set_flip(ALL_TILEMAPS,flip_screen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
}

View File

@ -16,7 +16,7 @@ struct __20pacgal_state
UINT8 *video_ram;
UINT8 *sprite_ram;
UINT8 *sprite_color_lookup;
UINT8 *flip_screen;
UINT8 *flip;
/* machine state */
UINT8 game_selected; /* 0 = Ms. Pac-Man, 1 = Galaga */

View File

@ -31,7 +31,7 @@ struct _qix_state
UINT8 *videoram_address;
UINT8 *videoram_mask;
UINT8 *paletteram;
UINT8 flip_screen;
UINT8 flip;
UINT8 palette_bank;
UINT8 leds;
UINT8 *scanline_latch;

View File

@ -605,7 +605,7 @@ static READ8_HANDLER( slither_trak_lr_r )
{
qix_state *state = Machine->driver_data;
return readinputport(state->flip_screen ? 6 : 4);
return readinputport(state->flip ? 6 : 4);
}
@ -613,5 +613,5 @@ static READ8_HANDLER( slither_trak_ud_r )
{
qix_state *state = Machine->driver_data;
return readinputport(state->flip_screen ? 5 : 3);
return readinputport(state->flip ? 5 : 3);
}

View File

@ -173,7 +173,7 @@ static void draw_sprites(const _20pacgal_state *state, mame_bitmap *bitmap)
sy = (sy & 0xff) - 32; /* fix wraparound */
/* only Galaga appears to be effected by the global flip state */
if (state->game_selected && (state->flip_screen[0] & 0x01))
if (state->game_selected && (state->flip[0] & 0x01))
{
flip_x = !flip_x;
flip_y = !flip_y;
@ -201,7 +201,7 @@ static void draw_chars(const _20pacgal_state *state, mame_bitmap *bitmap)
{
offs_t offs;
int flip = state->flip_screen[0] & 0x01;
int flip = state->flip[0] & 0x01;
/* for each byte in the video RAM */
for (offs = 0; offs < 0x400; offs++)

View File

@ -313,7 +313,9 @@ VIDEO_UPDATE( baraduke )
/* flip screen is embedded in the sprite control registers */
/* can't use flip_screen_set() because the visible area is asymmetrical */
flip_screen = spriteram[0x07f6] & 0x01;
/* FIXME: flip_screen_x should not be written. The above issue needs */
/* some other solution */
flip_screen_x = spriteram[0x07f6] & 0x01;
tilemap_set_flip(ALL_TILEMAPS,flip_screen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
set_scroll(0);
set_scroll(1);

View File

@ -149,7 +149,8 @@ WRITE8_HANDLER( bking_cont1_w )
coin_lockout_global_w(~data & 0x01);
flip_screen = data & 0x04;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = data & 0x04;
tilemap_set_flip(ALL_TILEMAPS, flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);

View File

@ -185,7 +185,7 @@ static VIDEO_START( madalien )
}
static void draw_edges(mame_bitmap *bitmap, const rectangle *cliprect, int flip_screen, int scroll_mode)
static void draw_edges(mame_bitmap *bitmap, const rectangle *cliprect, int flip, int scroll_mode)
{
rectangle clip_edge1;
rectangle clip_edge2;
@ -193,7 +193,7 @@ static void draw_edges(mame_bitmap *bitmap, const rectangle *cliprect, int flip_
clip_edge1 = *cliprect;
clip_edge2 = *cliprect;
if (flip_screen)
if (flip)
{
clip_edge1.min_y = *madalien_edge1_pos | 0x80;
clip_edge2.max_y = (*madalien_edge2_pos & 0x7f) ^ 0x7f;
@ -210,11 +210,11 @@ static void draw_edges(mame_bitmap *bitmap, const rectangle *cliprect, int flip_
tilemap_mark_all_tiles_dirty(tilemap_edge1[scroll_mode]);
tilemap_mark_all_tiles_dirty(tilemap_edge2[scroll_mode]);
tilemap_set_flip(tilemap_edge1[scroll_mode], flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
tilemap_set_flip(tilemap_edge1[scroll_mode], flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
tilemap_set_scrollx(tilemap_edge1[scroll_mode], 0, -(*madalien_scroll & 0xfc));
tilemap_set_scrolly(tilemap_edge1[scroll_mode], 0, *madalien_edge1_pos & 0x7f);
tilemap_set_flip(tilemap_edge2[scroll_mode], flip_screen ? TILEMAP_FLIPX : TILEMAP_FLIPY);
tilemap_set_flip(tilemap_edge2[scroll_mode], flip ? TILEMAP_FLIPX : TILEMAP_FLIPY);
tilemap_set_scrollx(tilemap_edge2[scroll_mode], 0, -(*madalien_scroll & 0xfc));
tilemap_set_scrolly(tilemap_edge2[scroll_mode], 0, *madalien_edge2_pos & 0x7f);
@ -223,7 +223,7 @@ static void draw_edges(mame_bitmap *bitmap, const rectangle *cliprect, int flip_
}
static void draw_headlight(mame_bitmap *bitmap, const rectangle *cliprect, int flip_screen)
static void draw_headlight(mame_bitmap *bitmap, const rectangle *cliprect, int flip)
{
if (BIT(*madalien_video_flags, 0))
{
@ -234,7 +234,7 @@ static void draw_headlight(mame_bitmap *bitmap, const rectangle *cliprect, int f
UINT8 x;
UINT8 hy = y - *madalien_headlight_pos;
if (flip_screen)
if (flip)
hy = ~hy;
if ((hy < cliprect->min_y) || (hy > cliprect->max_y))
@ -244,7 +244,7 @@ static void draw_headlight(mame_bitmap *bitmap, const rectangle *cliprect, int f
{
UINT8 hx = x;
if (flip_screen)
if (flip)
hx = ~hx;
if ((hx < cliprect->min_x) || (hx > cliprect->max_x))
@ -258,7 +258,7 @@ static void draw_headlight(mame_bitmap *bitmap, const rectangle *cliprect, int f
}
static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int flip_screen)
static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int flip)
{
int i;
@ -266,14 +266,14 @@ static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const
decodechar(machine->gfx[0], i, madalien_charram);
tilemap_mark_all_tiles_dirty(tilemap_fg);
tilemap_set_flip(tilemap_fg, flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
tilemap_set_flip(tilemap_fg, flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
tilemap_draw(bitmap, cliprect, tilemap_fg, 0, 0);
}
static VIDEO_UPDATE( madalien )
{
int flip_screen = BIT(readinputportbytag("DIP"), 6) && BIT(*madalien_video_control, 0);
int flip = BIT(readinputportbytag("DIP"), 6) && BIT(*madalien_video_control, 0);
// bits #0 and #1 define scrolling mode
//
@ -285,8 +285,8 @@ static VIDEO_UPDATE( madalien )
int scroll_mode = *madalien_scroll & 3;
fillbitmap(bitmap, 0, cliprect);
draw_edges(bitmap, cliprect, flip_screen, scroll_mode);
draw_foreground(machine, bitmap, cliprect, flip_screen);
draw_edges(bitmap, cliprect, flip, scroll_mode);
draw_foreground(machine, bitmap, cliprect, flip);
/* highlight section A (outside of tunnels) */
@ -304,7 +304,7 @@ static VIDEO_UPDATE( madalien )
if (scroll_mode == 3)
max_x = (*madalien_scroll & 0xfc) - 1;
if (flip_screen)
if (flip)
{
int max_x_save = max_x;
max_x = 0xff - min_x;
@ -317,7 +317,7 @@ static VIDEO_UPDATE( madalien )
*BITMAP_ADDR16(bitmap, y, x) |= 8;
}
draw_headlight(bitmap, cliprect, flip_screen);
draw_headlight(bitmap, cliprect, flip);
return 0;
}

View File

@ -29,7 +29,8 @@ WRITE8_HANDLER( n8080_video_control_w )
sheriff_color_mode = (data >> 3) & 3;
sheriff_color_data = (data >> 0) & 7;
flip_screen = data & 0x20;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = data & 0x20;
}
@ -108,7 +109,8 @@ VIDEO_START( spacefev )
{
cannon_timer = timer_alloc(spacefev_stop_red_cannon, NULL);
flip_screen = 0;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = 0;
spacefev_red_screen = 0;
spacefev_red_cannon = 0;
@ -117,7 +119,8 @@ VIDEO_START( spacefev )
VIDEO_START( sheriff )
{
flip_screen = 0;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = 0;
sheriff_color_mode = 0;
sheriff_color_data = 0;
@ -144,7 +147,7 @@ VIDEO_START( helifire )
helifire_LSFR[i] = data;
}
flip_screen = 0;
flip_screen_x = 0;
helifire_flash = 0;
}

View File

@ -345,7 +345,9 @@ VIDEO_UPDATE( namcos1 )
/* flip screen is embedded in the sprite control registers */
/* can't use flip_screen_set() because the visible area is asymmetrical */
flip_screen = spriteram[0x07f6] & 1;
/* FIXME: flip_screen_x should not be written. The above issue needs */
/* some other solution */
flip_screen_x = spriteram[0x07f6] & 1;
tilemap_set_flip(ALL_TILEMAPS,flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);

View File

@ -351,7 +351,9 @@ VIDEO_UPDATE( namcos86 )
/* flip screen is embedded in the sprite control registers */
/* can't use flip_screen_set() because the visible area is asymmetrical */
flip_screen = spriteram[0x07f6] & 1;
/* FIXME: flip_screen_x should not be written. The above issue needs */
/* some other solution */
flip_screen_x = spriteram[0x07f6] & 1;
tilemap_set_flip(ALL_TILEMAPS,flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
set_scroll(0);
set_scroll(1);

View File

@ -53,7 +53,7 @@ static VIDEO_START( qix )
/* set up save states */
state_save_register_global_pointer(state->videoram, 256 * 256);
state_save_register_global(state->flip_screen);
state_save_register_global(state->flip);
state_save_register_global(state->palette_bank);
state_save_register_global(state->leds);
}
@ -93,7 +93,7 @@ WRITE8_HANDLER( qix_flip_screen_w )
{
qix_state *state = Machine->driver_data;
state->flip_screen = data;
state->flip = data;
}
@ -363,7 +363,7 @@ static void qix_update_row(running_machine *machine, mc6845_t *mc6845, mame_bitm
/* the memory is hooked up to the MA, RA lines this way */
offs_t offs = ((ma << 6) & 0xf800) | ((ra << 8) & 0x0700);
offs_t offs_xor = state->flip_screen ? 0xffff : 0;
offs_t offs_xor = state->flip ? 0xffff : 0;
for (x = 0; x < x_count * 8; x++)
scanline[x] = state->videoram[(offs + x) ^ offs_xor];

View File

@ -40,7 +40,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec
{
int offs;
flip_screen = 1;
//FIXME: flip_screen_x should not be written!
flip_screen_x = 1;
for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
{

View File

@ -123,7 +123,7 @@ VIDEO_START( skykid )
state_save_register_global(priority);
state_save_register_global(scroll_x);
state_save_register_global(scroll_y);
state_save_register_global(flip_screen);
state_save_register_global(flip_screen_x);
}

View File

@ -188,8 +188,9 @@ VIDEO_UPDATE( sshangha )
static int last_pf1_bank,last_pf2_bank;
int offs;
flip_screen=sshangha_control_0[0]&0x80;
tilemap_set_flip(ALL_TILEMAPS,flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
//FIXME: flip_screen_x should not be written!
flip_screen_x=sshangha_control_0[0]&0x80;
tilemap_set_flip(ALL_TILEMAPS,flip_screen_x ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
tilemap_set_enable( pf2_tilemap, sshangha_control_0[5]&0x8000);
tilemap_set_enable( pf1_8x8_tilemap, sshangha_control_0[5]&0x0080);

View File

@ -189,7 +189,8 @@ VIDEO_START( congo )
WRITE8_HANDLER( zaxxon_flipscreen_w )
{
/* low bit controls flip; background and sprite flip are handled at render time */
flip_screen = ~data & 1;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = ~data & 1;
tilemap_set_flip(fg_tilemap, flip_screen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
}

View File

@ -130,7 +130,8 @@ VIDEO_START( zodiack )
tilemap_set_transparent_pen(fg_tilemap, 0);
tilemap_set_scroll_cols(fg_tilemap, 32);
flip_screen = 0;
/* FIXME: flip_screen_x should not be written. */
flip_screen_x = 0;
}
static void draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)