emupal: add decoder for xxxxxBBBxGGGxRRR format,

cclimber: small cleanup
This commit is contained in:
hap 2024-06-30 12:16:15 +02:00
parent 9abb39b644
commit e71dcb76df
7 changed files with 310 additions and 331 deletions

View File

@ -168,6 +168,12 @@ palette_device &palette_device::set_format(xbgr_333_t, u32 entries)
return *this;
}
palette_device &palette_device::set_format(xbgr_333_nib_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 0,4,8>, entries);
return *this;
}
palette_device &palette_device::set_format(xrgb_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,4,0>, entries);

View File

@ -210,6 +210,7 @@ public:
enum xrgb_333_t { xRGB_333, xxxxxxxRRRGGGBBB };
enum xrbg_333_t { xRBG_333, xxxxxxxRRRBBBGGG };
enum xbgr_333_t { xBGR_333, xxxxxxxBBBGGGRRR };
enum xbgr_333_nib_t { xBGR_333_nibble, xxxxxBBBxGGGxRRR };
enum xrgb_444_t { xRGB_444, xxxxRRRRGGGGBBBB };
enum xrbg_444_t { xRBG_444, xxxxRRRRBBBBGGGG };
enum xbrg_444_t { xBRG_444, xxxxBBBBRRRRGGGG };
@ -297,6 +298,7 @@ public:
palette_device &set_format(xrgb_333_t, u32 entries);
palette_device &set_format(xrbg_333_t, u32 entries);
palette_device &set_format(xbgr_333_t, u32 entries);
palette_device &set_format(xbgr_333_nib_t, u32 entries);
palette_device &set_format(xrgb_444_t, u32 entries);
palette_device &set_format(xrbg_444_t, u32 entries);
palette_device &set_format(xbrg_444_t, u32 entries);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
#ifndef MAME_NICHIBUT_CCLIMBER_H
#define MAME_NICHIBUT_CCLIMBER_H
#ifndef MAME_NICHIBUTSU_CCLIMBER_H
#define MAME_NICHIBUTSU_CCLIMBER_H
#pragma once
@ -52,6 +52,7 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override { m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); }
virtual void video_start() override;
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
@ -89,7 +90,6 @@ protected:
void cclimber_draw_bigsprite(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void toprollr_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
private:
optional_shared_ptr<uint8_t> m_column_scroll;
optional_shared_ptr<uint8_t> m_decrypted_opcodes;
@ -99,7 +99,6 @@ private:
uint8_t bagmanf_a000_r();
void bagmanf_vblank_irq(int state);
DECLARE_VIDEO_START(cclimber);
void cclimber_palette(palette_device &palette) const;
uint32_t screen_update_cclimber(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -122,13 +121,15 @@ public:
cclimber_state(mconfig, type, tag),
m_swimmer_background_color(*this, "bgcolor"),
m_soundlatch(*this, "soundlatch")
{}
{ }
void swimmer_root(machine_config &config);
void swimmer(machine_config &config);
void au(machine_config &config);
void guzzler(machine_config &config);
protected:
virtual void video_start() override;
private:
optional_shared_ptr<uint8_t> m_swimmer_background_color;
optional_device<generic_latch_8_device> m_soundlatch;
@ -145,19 +146,16 @@ private:
void au_map(address_map &map);
void guzzler_map(address_map &map);
static rgb_t au_palette(u32 raw);
void swimmer_palette(palette_device &palette) const;
void swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element* gfx);
uint32_t screen_update_swimmer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void swimmer_set_background_pen();
void set_background_pen();
void set_sidepen(uint16_t pen) { m_sidepen = pen; }
TILE_GET_INFO_MEMBER(swimmer_get_pf_tile_info);
DECLARE_VIDEO_START(swimmer);
DECLARE_VIDEO_START(au);
bool m_swimmer_side_background_enabled = false;
bool m_swimmer_palettebank = false;
int m_swimmer_sidepen = 0x120;
bool m_side_background_enabled = false;
bool m_palettebank = false;
uint16_t m_sidepen = 0;
static constexpr int SWIMMER_BG_SPLIT = 0x18 * 8;
};
@ -171,12 +169,15 @@ public:
m_toprollr_bg_coloram(*this, "bg_coloram"),
m_bank1(*this, "bank1"),
m_bank1d(*this, "bank1d")
{}
{ }
void toprollr(machine_config &config);
void init_toprollr();
protected:
virtual void video_start() override;
private:
optional_shared_ptr<uint8_t> m_toprollr_bg_videoram;
optional_shared_ptr<uint8_t> m_toprollr_bg_coloram;
@ -193,10 +194,9 @@ private:
TILE_GET_INFO_MEMBER(toprollr_get_pf_tile_info);
TILE_GET_INFO_MEMBER(toprollr_get_bs_tile_info);
TILE_GET_INFO_MEMBER(toproller_get_bg_tile_info);
DECLARE_VIDEO_START(toprollr);
tilemap_t *m_toproller_bg_tilemap = nullptr;
uint8_t m_toprollr_rombank = 0U;
tilemap_t *m_bg_tilemap = nullptr;
uint8_t m_rombank = 0;
};
class yamato_state : public cclimber_state
@ -204,7 +204,7 @@ class yamato_state : public cclimber_state
public:
yamato_state(const machine_config &mconfig, device_type type, const char* tag) :
cclimber_state(mconfig, type, tag)
{}
{ }
void yamato(machine_config &config);
@ -225,10 +225,10 @@ private:
void yamato_palette(palette_device &palette) const;
uint32_t screen_update_yamato(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint8_t m_yamato_p0 = 0U;
uint8_t m_yamato_p1 = 0U;
uint8_t m_yamato_p0 = 0;
uint8_t m_yamato_p1 = 0;
static constexpr int YAMATO_SKY_PEN_BASE = 0x60;
};
#endif // MAME_NICHIBUT_CCLIMBER_H
#endif // MAME_NICHIBUTSU_CCLIMBER_H

View File

@ -3,7 +3,7 @@
#include "emu.h"
#include "cclimber.h"
/* set to 1 to fix protection check after bonus round (see notes in pacman.c driver) */
// set to 1 to fix protection check after bonus round (see notes in pacman.c driver)
#define CANNONB_HACK 0
void cclimber_state::cclimber_decode(const uint8_t convtable[8][16])
@ -15,14 +15,14 @@ void cclimber_state::cclimber_decode(const uint8_t convtable[8][16])
int i,j;
uint8_t src = rom[A];
/* pick the translation table from bit 0 of the address */
/* and from bits 1 7 of the source data */
// pick the translation table from bit 0 of the address
// and from bits 1 7 of the source data
i = (A & 1) | (src & 0x02) | ((src & 0x80) >> 5);
/* pick the offset in the table from bits 0 2 4 6 of the source data */
// pick the offset in the table from bits 0 2 4 6 of the source data
j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3);
/* decode the opcodes */
// decode the opcodes
m_decrypted_opcodes[A] = (src & 0xaa) | convtable[i][j];
}
}
@ -31,7 +31,7 @@ void cclimber_state::init_cclimber()
{
static const uint8_t convtable[8][16] =
{
/* 0xff marks spots which are unused and therefore unknown */
// 0xff marks spots which are unused and therefore unknown
{ 0x44,0x14,0x54,0x10,0x11,0x41,0x05,0x50,0x51,0x00,0x40,0x55,0x45,0x04,0x01,0x15 },
{ 0x44,0x10,0x15,0x55,0x00,0x41,0x40,0x51,0x14,0x45,0x11,0x50,0x01,0x54,0x04,0x05 },
{ 0x45,0x10,0x11,0x44,0x05,0x50,0x51,0x04,0x41,0x14,0x15,0x40,0x01,0x54,0x55,0x00 },
@ -66,7 +66,7 @@ void cclimber_state::init_ckongb()
{
uint8_t *rom = memregion("maincpu")->base();
for (int A = 0x0000; A < 0x6000; A++) /* all the program ROMs are encrypted */
for (int A = 0x0000; A < 0x6000; A++) // all the program ROMs are encrypted
{
rom[A] = rom[A] ^ 0xf0;
}
@ -88,7 +88,7 @@ void cclimber_state::init_cannonb()
{
uint8_t *rom = memregion("maincpu")->base();
for (int A = 0x0000; A < 0x1000; A++) /* only first ROM is encrypted */
for (int A = 0x0000; A < 0x1000; A++) // only first ROM is encrypted
{
uint8_t src;
int i;

View File

@ -43,7 +43,7 @@ void cclimber_state::cclimber_palette(palette_device &palette) const
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
for (int i = 0;i < palette.entries(); i++)
for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
@ -165,9 +165,9 @@ void swimmer_state::swimmer_palette(palette_device &palette) const
// side panel backgrond pen
#if 0
// values calculated from the resistors don't seem to match the real board
palette.set_pen_color(m_swimmer_sidepen, rgb_t(0x24, 0x5d, 0x4e));
palette.set_pen_color(m_sidepen, rgb_t(0x24, 0x5d, 0x4e));
#endif
palette.set_pen_color(m_swimmer_sidepen, rgb_t(0x20, 0x98, 0x79));
palette.set_pen_color(m_sidepen, rgb_t(0x20, 0x98, 0x79));
}
@ -284,7 +284,7 @@ void toprollr_state::toprollr_palette(palette_device &palette) const
***************************************************************************/
void swimmer_state::swimmer_set_background_pen()
void swimmer_state::set_background_pen()
{
int bit0, bit1, bit2;
@ -310,8 +310,6 @@ void swimmer_state::swimmer_set_background_pen()
}
void cclimber_state::cclimber_colorram_w(offs_t offset, uint8_t data)
{
/* A5 is not connected, there is only 0x200 bytes of RAM */
@ -334,13 +332,13 @@ void cclimber_state::flip_screen_y_w(int state)
void swimmer_state::sidebg_enable_w(int state)
{
m_swimmer_side_background_enabled = state;
m_side_background_enabled = state;
}
void swimmer_state::palette_bank_w(int state)
{
m_swimmer_palettebank = state;
m_palettebank = state;
}
@ -353,8 +351,7 @@ TILE_GET_INFO_MEMBER(cclimber_state::cclimber_get_pf_tile_info)
tile_index = tile_index ^ 0x20;
const int code = ((m_colorram[tile_index] & 0x10) << 5) |
((m_colorram[tile_index] & 0x20) << 3) |
m_videoram[tile_index];
((m_colorram[tile_index] & 0x20) << 3) | m_videoram[tile_index];
const int color = m_colorram[tile_index] & 0x0f;
@ -371,7 +368,7 @@ TILE_GET_INFO_MEMBER(swimmer_state::swimmer_get_pf_tile_info)
tile_index = tile_index ^ 0x20;
const int code = ((m_colorram[tile_index] & 0x30) << 4) | m_videoram[tile_index];
const int color = (m_swimmer_palettebank << 4) | (m_colorram[tile_index] & 0x0f);
const int color = (m_palettebank << 4) | (m_colorram[tile_index] & 0x0f);
tileinfo.set(0, code, color, flags);
}
@ -396,7 +393,7 @@ TILE_GET_INFO_MEMBER(cclimber_state::cclimber_get_bs_tile_info)
tile_index = ((tile_index & 0x1e0) >> 1) | (tile_index & 0x0f);
const int code = ((m_bigsprite_control[1] & 0x08) << 5) | m_bigsprite_videoram[tile_index];
const int color = m_bigsprite_control[1] & 0x07;
const int color = m_bigsprite_control[1] & 0x07;
tileinfo.set(2, code, color, 0);
}
@ -426,7 +423,7 @@ TILE_GET_INFO_MEMBER(toprollr_state::toproller_get_bg_tile_info)
}
VIDEO_START_MEMBER(cclimber_state,cclimber)
void cclimber_state::video_start()
{
m_pf_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cclimber_state::cclimber_get_pf_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_pf_tilemap->set_transparent_pen(0);
@ -442,8 +439,7 @@ VIDEO_START_MEMBER(cclimber_state,cclimber)
save_item(NAME(m_flip_y));
}
VIDEO_START_MEMBER(swimmer_state,swimmer)
void swimmer_state::video_start()
{
m_pf_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(swimmer_state::swimmer_get_pf_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_pf_tilemap->set_transparent_pen(0);
@ -457,23 +453,17 @@ VIDEO_START_MEMBER(swimmer_state,swimmer)
save_item(NAME(m_flip_x));
save_item(NAME(m_flip_y));
save_item(NAME(m_swimmer_side_background_enabled));
save_item(NAME(m_swimmer_palettebank));
save_item(NAME(m_side_background_enabled));
save_item(NAME(m_palettebank));
}
VIDEO_START_MEMBER(swimmer_state, au)
{
VIDEO_START_CALL_MEMBER(swimmer);
m_swimmer_sidepen = 0;
}
VIDEO_START_MEMBER(toprollr_state,toprollr)
void toprollr_state::video_start()
{
m_pf_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(toprollr_state::toprollr_get_pf_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_pf_tilemap->set_transparent_pen(0);
m_toproller_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(toprollr_state::toproller_get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_toproller_bg_tilemap->set_scroll_rows(1);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(toprollr_state::toproller_get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap->set_scroll_rows(1);
m_bs_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(toprollr_state::toprollr_get_bs_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bs_tilemap->set_scroll_cols(1);
@ -548,7 +538,7 @@ void cclimber_state::cclimber_draw_sprites(bitmap_ind16 &bitmap, const rectangle
{
int x = m_spriteram[offs + 3] + 1;
/* x + 1 is evident in cclimber and ckong. It looks worse,
but it has been confirmed on several PCBs. */
but it has been confirmed on several PCBs. */
int y = 240 - m_spriteram[offs + 2];
@ -625,7 +615,7 @@ void swimmer_state::swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &
const int code = ((m_spriteram[offs + 1] & 0x30) << 2) |
(m_spriteram[offs + 0] & 0x3f);
const int color = (m_swimmer_palettebank << 4) |
const int color = (m_palettebank << 4) |
(m_spriteram[offs + 1] & 0x0f);
int flipx = m_spriteram[offs + 0] & 0x40;
@ -653,14 +643,14 @@ uint32_t cclimber_state::screen_update_cclimber(screen_device &screen, bitmap_in
bitmap.fill(0, cliprect);
draw_playfield(screen, bitmap, cliprect);
/* draw the "big sprite" under the regular sprites */
// draw the "big sprite" under the regular sprites
if ((m_bigsprite_control[0] & 0x01))
{
cclimber_draw_bigsprite(screen, bitmap, cliprect);
cclimber_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(1));
}
/* draw the "big sprite" over the regular sprites */
// draw the "big sprite" over the regular sprites
else
{
cclimber_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(1));
@ -685,14 +675,14 @@ uint32_t yamato_state::screen_update_yamato(screen_device &screen, bitmap_ind16
draw_playfield(screen, bitmap, cliprect);
/* draw the "big sprite" under the regular sprites */
// draw the "big sprite" under the regular sprites
if ((m_bigsprite_control[0] & 0x01))
{
cclimber_draw_bigsprite(screen, bitmap, cliprect);
toprollr_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(1));
}
/* draw the "big sprite" over the regular sprites */
// draw the "big sprite" over the regular sprites
else
{
toprollr_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(1));
@ -706,9 +696,9 @@ uint32_t yamato_state::screen_update_yamato(screen_device &screen, bitmap_ind16
uint32_t swimmer_state::screen_update_swimmer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
if (m_swimmer_background_color)
swimmer_set_background_pen();
set_background_pen();
if (m_swimmer_side_background_enabled)
if (m_side_background_enabled)
{
if (m_flip_x)
{
@ -716,7 +706,7 @@ uint32_t swimmer_state::screen_update_swimmer(screen_device &screen, bitmap_ind1
rectangle split_rect_right(0x100 - SWIMMER_BG_SPLIT, 0xff, 0, 0xff);
split_rect_left &= cliprect;
bitmap.fill(m_swimmer_sidepen, split_rect_left);
bitmap.fill(m_sidepen, split_rect_left);
split_rect_right &= cliprect;
bitmap.fill(0, split_rect_right);
@ -730,7 +720,7 @@ uint32_t swimmer_state::screen_update_swimmer(screen_device &screen, bitmap_ind1
bitmap.fill(0, split_rect_left);
split_rect_right &= cliprect;
bitmap.fill(m_swimmer_sidepen, split_rect_right);
bitmap.fill(m_sidepen, split_rect_right);
}
}
else
@ -738,14 +728,14 @@ uint32_t swimmer_state::screen_update_swimmer(screen_device &screen, bitmap_ind1
draw_playfield(screen, bitmap, cliprect);
/* draw the "big sprite" under the regular sprites */
// draw the "big sprite" under the regular sprites
if ((m_bigsprite_control[0] & 0x01))
{
cclimber_draw_bigsprite(screen, bitmap, cliprect);
swimmer_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(1));
}
/* draw the "big sprite" over the regular sprites */
// draw the "big sprite" over the regular sprites
else
{
swimmer_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(1));
@ -765,19 +755,19 @@ uint32_t toprollr_state::screen_update_toprollr(screen_device &screen, bitmap_in
bitmap.fill(0, cliprect);
m_toproller_bg_tilemap->set_scrollx(0, m_toprollr_bg_videoram[0]);
m_toproller_bg_tilemap->set_flip((m_flip_x ? TILEMAP_FLIPX : 0) | (m_flip_y ? TILEMAP_FLIPY : 0));
m_toproller_bg_tilemap->mark_all_dirty();
m_toproller_bg_tilemap->draw(screen, bitmap, scroll_area_clip, 0, 0);
m_bg_tilemap->set_scrollx(0, m_toprollr_bg_videoram[0]);
m_bg_tilemap->set_flip((m_flip_x ? TILEMAP_FLIPX : 0) | (m_flip_y ? TILEMAP_FLIPY : 0));
m_bg_tilemap->mark_all_dirty();
m_bg_tilemap->draw(screen, bitmap, scroll_area_clip, 0, 0);
/* draw the "big sprite" over the regular sprites */
// draw the "big sprite" over the regular sprites
if ((m_bigsprite_control[1] & 0x20))
{
toprollr_draw_sprites(bitmap, scroll_area_clip, m_gfxdecode->gfx(1));
toprollr_draw_bigsprite(screen, bitmap, scroll_area_clip);
}
/* draw the "big sprite" under the regular sprites */
// draw the "big sprite" under the regular sprites
else
{
toprollr_draw_bigsprite(screen, bitmap, scroll_area_clip);

View File

@ -30,6 +30,7 @@ GK 2000 (H8/323 version):
- piezo, 16 LEDs, button sensors chessboard
Saitek GK 2100 is on the same hardware, but has a H8/325 instead of H8/323.
Travel Champion 2100 has the same MCU.
H8/323 A13 MCU is used in:
- Saitek GK 2000 (86071220X12)