mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
Changed popeye to use palette computed from schematics. Also implemented interlaced field support. This is actually read by the game. [Couriersud]
This commit is contained in:
parent
63f24d8a54
commit
97d055a985
@ -24,8 +24,9 @@ Notes:
|
|||||||
|
|
||||||
INTERRUPT_GEN_MEMBER(popeye_state::popeye_interrupt)
|
INTERRUPT_GEN_MEMBER(popeye_state::popeye_interrupt)
|
||||||
{
|
{
|
||||||
|
m_field ^= 1;
|
||||||
/* NMIs are enabled by the I register?? How can that be? */
|
/* NMIs are enabled by the I register?? How can that be? */
|
||||||
if (device.state().state_int(Z80_I) & 1) /* skyskipr: 0/1, popeye: 2/3 but also 0/1 */
|
if (device.state().state_int(Z80_I) & 1) /* skyskipr: 0/1, popeye: 2/3 but also 0/1 */
|
||||||
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
|
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +204,11 @@ static INPUT_PORTS_START( skyskipr )
|
|||||||
PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) )
|
PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) )
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
static CUSTOM_INPUT( pop_field_r )
|
||||||
|
{
|
||||||
|
popeye_state *state = field.machine().driver_data<popeye_state>();
|
||||||
|
return state->m_field ^ 1;
|
||||||
|
}
|
||||||
|
|
||||||
static INPUT_PORTS_START( popeye )
|
static INPUT_PORTS_START( popeye )
|
||||||
PORT_START("P1") /* IN0 */
|
PORT_START("P1") /* IN0 */
|
||||||
@ -230,7 +236,7 @@ static INPUT_PORTS_START( popeye )
|
|||||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
|
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
|
||||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
|
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
|
||||||
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
|
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
|
||||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
|
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(pop_field_r, (void *) 0) /* inverted init e/o signal (even odd) */
|
||||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
|
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
|
||||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
|
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
|
||||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
|
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
UINT8 m_bitmap_type;
|
UINT8 m_bitmap_type;
|
||||||
tilemap_t *m_fg_tilemap;
|
tilemap_t *m_fg_tilemap;
|
||||||
UINT8 m_lastflip;
|
UINT8 m_lastflip;
|
||||||
|
int m_field;
|
||||||
|
|
||||||
DECLARE_READ8_MEMBER(protection_r);
|
DECLARE_READ8_MEMBER(protection_r);
|
||||||
DECLARE_WRITE8_MEMBER(protection_w);
|
DECLARE_WRITE8_MEMBER(protection_w);
|
||||||
@ -48,6 +49,8 @@ public:
|
|||||||
void set_background_palette(int bank);
|
void set_background_palette(int bank);
|
||||||
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
|
void draw_field(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
|
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
};
|
};
|
||||||
|
@ -7,12 +7,18 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
#include "video/resnet.h"
|
||||||
#include "includes/popeye.h"
|
#include "includes/popeye.h"
|
||||||
|
|
||||||
static const size_t popeye_bitmapram_size = 0x2000;
|
static const size_t popeye_bitmapram_size = 0x2000;
|
||||||
|
|
||||||
enum { TYPE_SKYSKIPR, TYPE_POPEYE };
|
enum { TYPE_SKYSKIPR, TYPE_POPEYE };
|
||||||
|
|
||||||
|
#define USE_NEW_COLOR (1)
|
||||||
|
|
||||||
|
// Only enable USE_INTERLACE if you can ensure the game is rendered at an
|
||||||
|
// integer multiple of it's original resolution
|
||||||
|
#define USE_INTERLACE (0)
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -49,6 +55,61 @@ enum { TYPE_SKYSKIPR, TYPE_POPEYE };
|
|||||||
The bootleg is the same, but the outputs are not inverted.
|
The bootleg is the same, but the outputs are not inverted.
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
static const res_net_decode_info popeye_7051_decode_info =
|
||||||
|
{
|
||||||
|
1, /* one prom 5 lines */
|
||||||
|
0, /* start at 0 */
|
||||||
|
31, /* end at 31 */
|
||||||
|
/* R, G, B, */
|
||||||
|
{ 0, 0, 0 }, /* offsets */
|
||||||
|
{ 0, 3, 6 }, /* shifts */
|
||||||
|
{0x07,0x07,0x03 } /* masks */
|
||||||
|
};
|
||||||
|
|
||||||
|
static const res_net_decode_info popeye_7052_decode_info =
|
||||||
|
{
|
||||||
|
2, /* there may be two proms needed to construct color */
|
||||||
|
0, /* start at 0 */
|
||||||
|
255, /* end at 255 */
|
||||||
|
/* R, G, B, R, G, B */
|
||||||
|
{ 0, 0, 0, 256, 256, 256}, /* offsets */
|
||||||
|
{ 0, 3, 0, 0, -1, 2}, /* shifts */
|
||||||
|
{0x07,0x01,0x00,0x00,0x06,0x03} /* masks */
|
||||||
|
};
|
||||||
|
|
||||||
|
static const res_net_info popeye_7051_txt_net_info =
|
||||||
|
{
|
||||||
|
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_MB7051 | RES_NET_MONITOR_SANYO_EZV20,
|
||||||
|
{
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } },
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } },
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 680, 0, 2, { 470, 220, 0 } } /* popeye */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const res_net_info popeye_7051_bck_net_info =
|
||||||
|
{
|
||||||
|
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_MB7051 | RES_NET_MONITOR_SANYO_EZV20,
|
||||||
|
{
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1200, 680, 470 } },
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1200, 680, 470 } },
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 680, 0, 2, { 680, 470, 0 } } /* popeye */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const res_net_info popeye_7052_obj_net_info =
|
||||||
|
{
|
||||||
|
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_MB7052 | RES_NET_MONITOR_SANYO_EZV20,
|
||||||
|
{
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } },
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } },
|
||||||
|
{ RES_NET_AMP_DARLINGTON, 680, 0, 2, { 470, 220, 0 } } /* popeye */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void popeye_state::convert_color_prom(const UINT8 *color_prom)
|
void popeye_state::convert_color_prom(const UINT8 *color_prom)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -58,6 +119,19 @@ void popeye_state::convert_color_prom(const UINT8 *color_prom)
|
|||||||
color_prom += 32;
|
color_prom += 32;
|
||||||
|
|
||||||
/* characters */
|
/* characters */
|
||||||
|
#if USE_NEW_COLOR
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
int prom_offs = i | ((i & 8) << 1); /* address bits 3 and 4 are tied together */
|
||||||
|
int r, g, b;
|
||||||
|
r = compute_res_net(((color_prom[prom_offs] ^ m_invertmask) >> 0) & 0x07, 0, &popeye_7051_txt_net_info);
|
||||||
|
g = compute_res_net(((color_prom[prom_offs] ^ m_invertmask) >> 3) & 0x07, 1, &popeye_7051_txt_net_info);
|
||||||
|
b = compute_res_net(((color_prom[prom_offs] ^ m_invertmask) >> 6) & 0x03, 2, &popeye_7051_txt_net_info);
|
||||||
|
m_palette->set_pen_color(16 + (2 * i) + 0,rgb_t(0,0,0));
|
||||||
|
m_palette->set_pen_color(16 + (2 * i) + 1,rgb_t(r,g,b));
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
for (i = 0;i < 16;i++)
|
for (i = 0;i < 16;i++)
|
||||||
{
|
{
|
||||||
int prom_offs = i | ((i & 8) << 1); /* address bits 3 and 4 are tied together */
|
int prom_offs = i | ((i & 8) << 1); /* address bits 3 and 4 are tied together */
|
||||||
@ -81,10 +155,21 @@ void popeye_state::convert_color_prom(const UINT8 *color_prom)
|
|||||||
|
|
||||||
m_palette->set_pen_color(16 + (2 * i) + 1,rgb_t(r,g,b));
|
m_palette->set_pen_color(16 + (2 * i) + 1,rgb_t(r,g,b));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
color_prom += 32;
|
color_prom += 32;
|
||||||
|
|
||||||
|
#if USE_NEW_COLOR
|
||||||
/* sprites */
|
/* sprites */
|
||||||
|
rgb_t *rgb;
|
||||||
|
UINT8 cpi[512];
|
||||||
|
|
||||||
|
for (i=0; i<512; i++)
|
||||||
|
cpi[i] = color_prom[i] ^ m_invertmask;
|
||||||
|
|
||||||
|
rgb = compute_res_net_all(machine(), &cpi[0], &popeye_7052_decode_info, &popeye_7052_obj_net_info);
|
||||||
|
m_palette->set_pen_colors(48, rgb, 256);
|
||||||
|
auto_free(machine(), rgb);
|
||||||
|
#else
|
||||||
for (i = 0;i < 256;i++)
|
for (i = 0;i < 256;i++)
|
||||||
{
|
{
|
||||||
int bit0,bit1,bit2,r,g,b;
|
int bit0,bit1,bit2,r,g,b;
|
||||||
@ -110,12 +195,13 @@ void popeye_state::convert_color_prom(const UINT8 *color_prom)
|
|||||||
|
|
||||||
color_prom++;
|
color_prom++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PALETTE_INIT_MEMBER(popeye_state, popeye)
|
PALETTE_INIT_MEMBER(popeye_state, popeye)
|
||||||
{
|
{
|
||||||
const UINT8 *color_prom = memregion("proms")->base();
|
const UINT8 *color_prom = memregion("proms")->base();
|
||||||
m_invertmask = 0xff;
|
m_invertmask = (USE_NEW_COLOR) ? 0x00 : 0xff;
|
||||||
|
|
||||||
convert_color_prom(color_prom);
|
convert_color_prom(color_prom);
|
||||||
}
|
}
|
||||||
@ -123,7 +209,7 @@ PALETTE_INIT_MEMBER(popeye_state, popeye)
|
|||||||
PALETTE_INIT_MEMBER(popeye_state,popeyebl)
|
PALETTE_INIT_MEMBER(popeye_state,popeyebl)
|
||||||
{
|
{
|
||||||
const UINT8 *color_prom = memregion("proms")->base();
|
const UINT8 *color_prom = memregion("proms")->base();
|
||||||
m_invertmask = 0x00;
|
m_invertmask = (USE_NEW_COLOR) ? 0xff : 0x00;
|
||||||
|
|
||||||
convert_color_prom(color_prom);
|
convert_color_prom(color_prom);
|
||||||
}
|
}
|
||||||
@ -133,6 +219,17 @@ void popeye_state::set_background_palette(int bank)
|
|||||||
int i;
|
int i;
|
||||||
UINT8 *color_prom = memregion("proms")->base() + 16 * bank;
|
UINT8 *color_prom = memregion("proms")->base() + 16 * bank;
|
||||||
|
|
||||||
|
#if USE_NEW_COLOR
|
||||||
|
UINT8 cpi[16];
|
||||||
|
rgb_t *rgb;
|
||||||
|
for (i=0; i<16; i++)
|
||||||
|
cpi[i] = color_prom[i] ^ m_invertmask;
|
||||||
|
|
||||||
|
rgb = compute_res_net_all(machine(), cpi, &popeye_7051_decode_info, &popeye_7051_bck_net_info);
|
||||||
|
m_palette->set_pen_colors(0, rgb, 16);
|
||||||
|
auto_free(machine(), rgb);
|
||||||
|
|
||||||
|
#else
|
||||||
for (i = 0;i < 16;i++)
|
for (i = 0;i < 16;i++)
|
||||||
{
|
{
|
||||||
int bit0,bit1,bit2;
|
int bit0,bit1,bit2;
|
||||||
@ -164,6 +261,7 @@ void popeye_state::set_background_palette(int bank)
|
|||||||
|
|
||||||
color_prom++;
|
color_prom++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(popeye_state::popeye_videoram_w)
|
WRITE8_MEMBER(popeye_state::popeye_videoram_w)
|
||||||
@ -248,8 +346,10 @@ void popeye_state::video_start()
|
|||||||
m_fg_tilemap->set_transparent_pen(0);
|
m_fg_tilemap->set_transparent_pen(0);
|
||||||
|
|
||||||
m_lastflip = 0;
|
m_lastflip = 0;
|
||||||
|
m_field = 0;
|
||||||
|
|
||||||
save_item(NAME(m_lastflip));
|
save_item(NAME(m_field));
|
||||||
|
save_item(NAME(m_lastflip));
|
||||||
save_item(NAME(*m_tmpbitmap2));
|
save_item(NAME(*m_tmpbitmap2));
|
||||||
save_pointer(NAME(m_bitmapram), popeye_bitmapram_size);
|
save_pointer(NAME(m_bitmapram), popeye_bitmapram_size);
|
||||||
}
|
}
|
||||||
@ -264,8 +364,10 @@ VIDEO_START_MEMBER(popeye_state,popeye)
|
|||||||
m_fg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(popeye_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
|
m_fg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(popeye_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
|
||||||
m_fg_tilemap->set_transparent_pen(0);
|
m_fg_tilemap->set_transparent_pen(0);
|
||||||
|
|
||||||
m_lastflip = 0;
|
m_lastflip = 0;
|
||||||
|
m_field = 0;
|
||||||
|
|
||||||
|
save_item(NAME(m_field));
|
||||||
save_item(NAME(m_lastflip));
|
save_item(NAME(m_lastflip));
|
||||||
save_item(NAME(*m_tmpbitmap2));
|
save_item(NAME(*m_tmpbitmap2));
|
||||||
save_pointer(NAME(m_bitmapram), popeye_bitmapram_size);
|
save_pointer(NAME(m_bitmapram), popeye_bitmapram_size);
|
||||||
@ -365,10 +467,23 @@ void popeye_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void popeye_state::draw_field(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
for (y=(cliprect.min_y & ~1) + m_field; y<=cliprect.max_y; y += 2)
|
||||||
|
for (x=cliprect.min_x; x<=cliprect.max_x; x++)
|
||||||
|
bitmap.pix(y, x) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
UINT32 popeye_state::screen_update_popeye(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
UINT32 popeye_state::screen_update_popeye(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||||
{
|
{
|
||||||
draw_background(bitmap, cliprect);
|
draw_background(bitmap, cliprect);
|
||||||
draw_sprites(bitmap, cliprect);
|
draw_sprites(bitmap, cliprect);
|
||||||
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||||
|
#if USE_INTERLACE
|
||||||
|
draw_field(bitmap, cliprect);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user