summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/m62.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/m62.cpp')
-rw-r--r--src/mame/video/m62.cpp194
1 files changed, 66 insertions, 128 deletions
diff --git a/src/mame/video/m62.cpp b/src/mame/video/m62.cpp
index cc04766f9e5..5c85ba0e08c 100644
--- a/src/mame/video/m62.cpp
+++ b/src/mame/video/m62.cpp
@@ -105,56 +105,22 @@ static const res_net_info battroad_char_net_info =
-static const res_net_decode_info m62_tile_decode_info =
+static const res_net_decode_info m62_decode_info =
{
1, /* single PROM per color */
0x000, 0x0ff, /* start/end */
/* R G B */
- { 0x000, 0x200, 0x400 }, /* offsets */
+ { 0x000, 0x100, 0x200 }, /* offsets */
{ 0, 0, 0 }, /* shifts */
{ 0x0f, 0x0f, 0x0f } /* masks */
};
-
-static const res_net_decode_info m62_sprite_decode_info =
-{
- 1, /* single PROM per color */
- 0x000, 0x0ff, /* start/end */
- /* R G B */
- { 0x100, 0x300, 0x500 }, /* offsets */
- { 0, 0, 0 }, /* shifts */
- { 0x0f, 0x0f, 0x0f } /* masks */
-};
-
-
-static const res_net_decode_info lotlot_tile_decode_info =
-{
- 1, /* single PROM per color */
- 0x000, 0x17f, /* start/end */
- /* R G B */
- { 0x000, 0x300, 0x600 }, /* offsets */
- { 0, 0, 0 }, /* shifts */
- { 0x0f, 0x0f, 0x0f } /* masks */
-};
-
-
-static const res_net_decode_info lotlot_sprite_decode_info =
-{
- 1, /* single PROM per color */
- 0x000, 0x17f, /* start/end */
- /* R G B */
- { 0x180, 0x480, 0x780 }, /* offsets */
- { 0, 0, 0 }, /* shifts */
- { 0x0f, 0x0f, 0x0f } /* masks */
-};
-
-
static const res_net_decode_info battroad_char_decode_info =
{
1, /* single PROM per color */
0x000, 0x01f, /* start/end */
/* R G B */
- { 0x600, 0x600, 0x600 }, /* offsets */
+ { 0x000, 0x000, 0x000 }, /* offsets */
{ 6, 3, 0 }, /* shifts */
{ 0x03, 0x07, 0x07 } /* masks */
};
@@ -171,108 +137,80 @@ static const res_net_decode_info spelunk2_tile_decode_info =
};
-static const res_net_decode_info spelunk2_sprite_decode_info =
+void m62_state::m62_amplify_contrast(bool include_fg)
{
- 1, /* single PROM per color */
- 0x000, 0x0ff, /* start/end */
- /* R G B */
- { 0x400, 0x500, 0x600 }, /* offsets */
- { 0, 0, 0 }, /* shifts */
- { 0x0f, 0x0f, 0x0f } /* masks */
-};
+ palette_device* pals[3];
+ pals[0] = m_chr_palette;
+ pals[1] = m_spr_palette;
+
+ if (m_fg_palette && include_fg)
+ pals[2] = m_fg_palette;
+ else
+ pals[2] = 0;
-void m62_state::m62_amplify_contrast(palette_t *palette, uint32_t numcolors)
-{
// m62 palette is very dark, so amplify default contrast
uint32_t i, ymax=1;
- if (!numcolors) numcolors = palette->num_colors();
- // find maximum brightness
- for (i=0;i < numcolors;i++)
+ for (int j = 0;j < 3;j++)
{
- rgb_t rgb = palette->entry_color(i);
- uint32_t y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b();
- ymax = std::max(ymax, y);
+ if (pals[j])
+ {
+ // find maximum brightness
+ for (i = 0;i < pals[j]->palette()->num_colors();i++)
+ {
+ rgb_t rgb = pals[j]->palette()->entry_color(i);
+ uint32_t y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b();
+ ymax = std::max(ymax, y);
+ }
+ }
}
- palette->set_contrast(255000.0/ymax);
+ for (int j = 0;j < 3;j++)
+ {
+ if (pals[j])
+ {
+ pals[j]->palette()->set_contrast(255000.0 / ymax);
+ }
+ }
}
-PALETTE_INIT_MEMBER(m62_state, m62)
+PALETTE_INIT_MEMBER(m62_state, m62_spr)
{
- const uint8_t *color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
-
- compute_res_net_all(rgb, color_prom, m62_tile_decode_info, m62_tile_net_info);
+ compute_res_net_all(rgb, m_sprite_color_proms, m62_decode_info, m62_sprite_net_info);
palette.set_pen_colors(0x000, rgb);
-
- compute_res_net_all(rgb, color_prom, m62_sprite_decode_info, m62_sprite_net_info);
- palette.set_pen_colors(0x100, rgb);
-
- m62_amplify_contrast(palette.palette(),0);
-
- /* we'll need this at run time */
- m_sprite_height_prom = color_prom + 0x600;
}
-
-PALETTE_INIT_MEMBER(m62_state,lotlot)
+PALETTE_INIT_MEMBER(m62_state, m62_chr)
{
- const uint8_t *color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
-
- compute_res_net_all(rgb, color_prom, lotlot_tile_decode_info, m62_tile_net_info);
+ compute_res_net_all(rgb, m_chr_color_proms, m62_decode_info, m62_tile_net_info);
palette.set_pen_colors(0x000, rgb);
-
- compute_res_net_all(rgb, color_prom, lotlot_sprite_decode_info, m62_sprite_net_info);
- palette.set_pen_colors(0x180, rgb);
-
- m62_amplify_contrast(palette.palette(),0);
-
- /* we'll need this at run time */
- m_sprite_height_prom = color_prom + 0x900;
}
-
-PALETTE_INIT_MEMBER(m62_state,battroad)
+PALETTE_INIT_MEMBER(m62_state, m62_lotlot_fg)
{
- const uint8_t *color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
-
- // m62 palette
- compute_res_net_all(rgb, color_prom, m62_tile_decode_info, m62_tile_net_info);
+ compute_res_net_all(rgb, m_fg_color_proms, m62_decode_info, m62_tile_net_info);
palette.set_pen_colors(0x000, rgb);
+}
- compute_res_net_all(rgb, color_prom, m62_sprite_decode_info, m62_sprite_net_info);
- palette.set_pen_colors(0x100, rgb);
-
- m62_amplify_contrast(palette.palette(),0x200);
+PALETTE_INIT_MEMBER(m62_state,m62_battroad_fg)
+{
// custom palette for foreground
- compute_res_net_all(rgb, color_prom, battroad_char_decode_info, battroad_char_net_info);
- palette.set_pen_colors(0x200, rgb);
-
- /* we'll need this at run time */
- m_sprite_height_prom = color_prom + 0x620;
+ std::vector<rgb_t> rgb;
+ compute_res_net_all(rgb, m_fg_color_proms, battroad_char_decode_info, battroad_char_net_info);
+ palette.set_pen_colors(0x000, rgb);
}
PALETTE_INIT_MEMBER(m62_state,spelunk2)
{
- const uint8_t *color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
-
- compute_res_net_all(rgb, color_prom, spelunk2_tile_decode_info, m62_tile_net_info);
+ compute_res_net_all(rgb, m_chr_color_proms, spelunk2_tile_decode_info, m62_tile_net_info);
palette.set_pen_colors(0x000, rgb);
-
- compute_res_net_all(rgb, color_prom, spelunk2_sprite_decode_info, m62_sprite_net_info);
- palette.set_pen_colors(0x200, rgb);
-
- m62_amplify_contrast(palette.palette(),0);
-
- /* we'll need this at run time */
- m_sprite_height_prom = color_prom + 0x700;
}
@@ -341,7 +279,7 @@ WRITE8_MEMBER(m62_state::m62_textram_w)
}
-void m62_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int colormask, int prioritymask, int priority )
+void m62_state::draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, int colormask, int prioritymask, int priority )
{
int offs;
@@ -388,7 +326,7 @@ void m62_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, i
do
{
- m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
+ m_spr_decode->gfx(0)->transpen(bitmap,cliprect,
code + i * incr,col,
flipx,flipy,
sx,sy + 16 * i,0);
@@ -401,7 +339,7 @@ void m62_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, i
void m62_state::m62_start( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
+ m_bg_tilemap = &machine().tilemap().create(*m_chr_decode, tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
register_savestate();
@@ -414,7 +352,7 @@ void m62_state::m62_start( tilemap_get_info_delegate tile_get_info, int rows, in
void m62_state::m62_textlayer( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
{
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
+ m_fg_tilemap = &machine().tilemap().create(*m_fg_decode, tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
if (rows != 0)
m_fg_tilemap->set_scroll_rows(rows);
@@ -455,7 +393,7 @@ VIDEO_START_MEMBER(m62_state,kungfum)
m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_kungfum_bg_tile_info),this), 32, 0, 8, 8, 64, 32);
}
-uint32_t m62_state::screen_update_kungfum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_kungfum(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int i;
for (i = 0; i < 6; i++)
@@ -499,7 +437,7 @@ void m62_state::video_start()
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
}
-uint32_t m62_state::screen_update_ldrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_ldrun(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll);
m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll);
@@ -543,7 +481,7 @@ WRITE8_MEMBER(m62_state::ldrun3_topbottom_mask_w)
m_ldrun3_topbottom_mask = data & 1;
}
-uint32_t m62_state::screen_update_ldrun3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_ldrun3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
screen_update_ldrun(screen, bitmap, cliprect);
@@ -553,11 +491,11 @@ uint32_t m62_state::screen_update_ldrun3(screen_device &screen, bitmap_ind16 &bi
my_cliprect.min_y = 0 * 8;
my_cliprect.max_y = 1 * 8 - 1;
- bitmap.fill(m_palette->black_pen(), my_cliprect);
+ bitmap.fill(m_chr_palette->black_pen(), my_cliprect);
my_cliprect.min_y = 31 * 8;
my_cliprect.max_y = 32 * 8 - 1;
- bitmap.fill(m_palette->black_pen(), my_cliprect);
+ bitmap.fill(m_chr_palette->black_pen(), my_cliprect);
}
return 0;
@@ -589,7 +527,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_battroad_fg_tile_info)
int color;
code = m_m62_textram[tile_index << 1];
color = m_m62_textram[(tile_index << 1) | 1];
- SET_TILE_INFO_MEMBER(2, code | ((color & 0x40) << 3) | ((color & 0x10) << 4), color & 0x0f, 0);
+ SET_TILE_INFO_MEMBER(0, code | ((color & 0x40) << 3) | ((color & 0x10) << 4), color & 0x0f, 0);
}
VIDEO_START_MEMBER(m62_state,battroad)
@@ -600,7 +538,7 @@ VIDEO_START_MEMBER(m62_state,battroad)
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
}
-uint32_t m62_state::screen_update_battroad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_battroad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll);
m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll);
@@ -633,7 +571,7 @@ VIDEO_START_MEMBER(m62_state,ldrun4)
m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_ldrun4_bg_tile_info),this), 1, 0, 8, 8, 64, 32);
}
-uint32_t m62_state::screen_update_ldrun4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_ldrun4(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll - 2);
@@ -664,7 +602,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_lotlot_fg_tile_info)
int color;
code = m_m62_textram[tile_index << 1];
color = m_m62_textram[(tile_index << 1) | 1];
- SET_TILE_INFO_MEMBER(2, code | ((color & 0xc0) << 2), color & 0x1f, 0);
+ SET_TILE_INFO_MEMBER(0, code | ((color & 0xc0) << 2), color & 0x1f, 0);
}
VIDEO_START_MEMBER(m62_state,lotlot)
@@ -673,7 +611,7 @@ VIDEO_START_MEMBER(m62_state,lotlot)
m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_lotlot_fg_tile_info),this), 1, 1, 12, 10, 32, 64);
}
-uint32_t m62_state::screen_update_lotlot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_lotlot(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll - 64);
m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll + 32);
@@ -723,12 +661,12 @@ TILE_GET_INFO_MEMBER(m62_state::get_kidniki_fg_tile_info)
int color;
code = m_m62_textram[tile_index << 1];
color = m_m62_textram[(tile_index << 1) | 1];
- SET_TILE_INFO_MEMBER(2, code | ( ( color & 0xc0 ) << 2 ), color & 0x1f, 0);
+ SET_TILE_INFO_MEMBER(0, code | ( ( color & 0xc0 ) << 2 ), color & 0x1f, 0);
}
VIDEO_START_MEMBER(m62_state,kidniki)
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(m62_state::get_kidniki_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_bg_tilemap = &machine().tilemap().create(*m_chr_decode, tilemap_get_info_delegate(FUNC(m62_state::get_kidniki_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
@@ -737,7 +675,7 @@ VIDEO_START_MEMBER(m62_state,kidniki)
m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_kidniki_fg_tile_info),this), 1, 1, 12, 8, 32, 64);
}
-uint32_t m62_state::screen_update_kidniki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_kidniki(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll);
m_fg_tilemap->set_scrollx(0, -64);
@@ -778,7 +716,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_spelunkr_fg_tile_info)
code = m_m62_textram[tile_index << 1];
color = m_m62_textram[(tile_index << 1) | 1];
if (color & 0xe0) popmessage("fg tilemap %x %x", tile_index, color & 0xe0);
- SET_TILE_INFO_MEMBER(2, code | ((color & 0x10) << 4), (color & 0x0f) | (m_spelunkr_palbank << 4), 0);
+ SET_TILE_INFO_MEMBER(0, code | ((color & 0x10) << 4), (color & 0x0f) | (m_spelunkr_palbank << 4), 0);
}
VIDEO_START_MEMBER(m62_state,spelunkr)
@@ -787,7 +725,7 @@ VIDEO_START_MEMBER(m62_state,spelunkr)
m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_fg_tile_info),this), 1, 1, 12, 8, 32, 32);
}
-uint32_t m62_state::screen_update_spelunkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_spelunkr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll);
m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll + 128);
@@ -829,7 +767,7 @@ VIDEO_START_MEMBER(m62_state,spelunk2)
m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_fg_tile_info),this), 1, 1, 12, 8, 32, 32);
}
-uint32_t m62_state::screen_update_spelunk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_spelunk2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll - 1);
m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll + 128);
@@ -863,7 +801,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_youjyudn_fg_tile_info)
int color;
code = m_m62_textram[tile_index << 1];
color = m_m62_textram[(tile_index << 1) | 1];
- SET_TILE_INFO_MEMBER(2, code | ((color & 0xc0) << 2), (color & 0x0f), 0);
+ SET_TILE_INFO_MEMBER(0, code | ((color & 0xc0) << 2), (color & 0x0f), 0);
}
VIDEO_START_MEMBER(m62_state,youjyudn)
@@ -874,7 +812,7 @@ VIDEO_START_MEMBER(m62_state,youjyudn)
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
}
-uint32_t m62_state::screen_update_youjyudn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_youjyudn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll);
m_fg_tilemap->set_scrollx(0, -64);
@@ -915,7 +853,7 @@ VIDEO_START_MEMBER(m62_state,horizon)
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
}
-uint32_t m62_state::screen_update_horizon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m62_state::screen_update_horizon(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int i;
for (i = 0; i < 32; i++)